[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/pkg/vtiger/modules/Webforms/settings/models/ -> Block.php (source)

   1  <?php
   2  /*+***********************************************************************************
   3   * The contents of this file are subject to the vtiger CRM Public License Version 1.0
   4   * ("License"); You may not use this file except in compliance with the License
   5   * The Original Code is:  vtiger CRM Open Source
   6   * The Initial Developer of the Original Code is vtiger.
   7   * Portions created by vtiger are Copyright (C) vtiger.
   8   * All Rights Reserved.
   9   *************************************************************************************/
  10  
  11  class Settings_Webforms_Block_Model extends Vtiger_Block_Model {
  12  
  13      /**
  14       * Function to get fields for this block
  15       * @return <Array> list of Field models list <Settings_Webforms_Field_Model>
  16       */
  17  	public function getFields() {
  18          if(empty($this->fields)) {
  19              $tableName = 'vtiger_webforms';
  20              $tabId = getTabid('Webforms');
  21              $blockName = $this->get('name');
  22              switch ($blockName) {
  23                  case 'LBL_WEBFORM_INFORMATION' : 
  24                              $fieldsList = array(
  25                              'name' => array(
  26                                      'uitype' => '1',
  27                                      'name' => 'name',
  28                                      'label' => 'Webform Name',
  29                                      'typeofdata' => 'V~M',
  30                                      'diplaytype' => '1',
  31                              ),
  32                              'targetmodule' => array(
  33                                      'uitype' => '16',
  34                                      'name' => 'targetmodule',
  35                                      'label' => 'Module',
  36                                      'typeofdata' => 'V~O',
  37                                      'diplaytype' => '1',
  38                              ),
  39                              'returnurl' => array(
  40                                      'uitype' => '17',
  41                                      'name' => 'returnurl',
  42                                      'label' => 'Return Url',
  43                                      'typeofdata' => 'V~O',
  44                                      'diplaytype' => '1',
  45                                      'defaultvalue' => '',
  46                              ),
  47                              'ownerid' => array(
  48                                      'uitype' => '53',
  49                                      'name' => 'ownerid',
  50                                      'label' => 'Assigned To',
  51                                      'typeofdata' => 'V~M',
  52                                      'diplaytype' => '1',
  53                              ),
  54                              'posturl' => array(
  55                                      'uitype' => '1',
  56                                      'name' => 'posturl',
  57                                      'label' => 'Post Url',
  58                                      'typeofdata' => 'V~O',
  59                                      'diplaytype' => '5',
  60                              ),
  61                              'publicid' => array(
  62                                      'uitype' => '1',
  63                                      'name' => 'publicid',
  64                                      'label' => 'Public Id',
  65                                      'typeofdata' => 'V~O',
  66                                      'diplaytype' => '5',
  67                              ),
  68                              'enabled' => array(
  69                                      'uitype' => '56',
  70                                      'name' => 'enabled',
  71                                      'label' => 'Status',
  72                                      'typeofdata' => 'C~O',
  73                                      'diplaytype' => '1',
  74                                      'defaultvalue' => '1',
  75                              ),
  76                      'captcha' => array(
  77                              'uitype' => '56',
  78                              'name' => 'captcha',
  79                              'label' => 'Captcha Enabled',
  80                              'typeofdata' => 'C~O',
  81                              'diplaytype' => '1',
  82                              'defaultvalue' => '0',
  83                      ),
  84                              'description' => array(
  85                                      'uitype' => '19',
  86                                      'name' => 'description',
  87                                      'label' => 'Description',
  88                                      'typeofdata' => 'V~O',
  89                                      'defaultvalue' => '',
  90                              )
  91                      );
  92                      break;
  93                  
  94                  case 'LBL_ASSIGN_USERS' : 
  95                      $fieldsList = array(
  96                              'roundrobin' =>array(
  97                                      'uitype' => '56',
  98                                      'name' => 'roundrobin',
  99                                      'label' => 'LBL_ASSIGN_ROUND_ROBIN',
 100                                      'typeofdata' => 'C~O',
 101                                      'diplaytype' => '1',
 102                                      'defaultvalue' => '0',
 103                              ),
 104                              'roundrobin_userid' =>array(
 105                                      'uitype' => '54',                                                            
 106                                      'name' => 'roundrobin_userid',
 107                                      'label' => 'LBL_ROUNDROBIN_USERS_LIST',
 108                                      'typeofdata' => 'V~M',
 109                                      'diplaytype' => '1',
 110                                      'defaultvalue' => 'NULL',
 111                              )
 112                      );
 113                      break;
 114              }
 115              
 116              foreach ($fieldsList as $fieldName => $fieldDetails) {
 117                  $fieldModel = Settings_Webforms_Field_Model::getInstanceByRow($fieldDetails);
 118                  $fieldModel->block = $this;
 119                  $fieldModel->module = $this->module;
 120                  $fieldModelsList[$fieldName] = $fieldModel;
 121              }
 122              $this->fields = $fieldModelsList;
 123          }
 124          return $this->fields;
 125      }
 126  
 127      /**
 128       * Function to get list of all blocks for selected module
 129       * @param <Settings_Webforms_Module_Model> $moduleModel
 130       * @return <Array> list of Block models
 131       */
 132  	public static function getAllForModule($moduleModel) {
 133          $blockLabels = array('LBL_WEBFORM_INFORMATION','LBL_ASSIGN_USERS');
 134  
 135          foreach ($blockLabels as $blockName) {
 136              $blockModels[$blockName] = Settings_Webforms_Block_Model::getInstanceFromName($blockName, $moduleModel);
 137          }
 138          return $blockModels;
 139      }
 140  
 141      /**
 142       * Function to get Instance for Block by using name
 143       * @param <String> $blockName
 144       * @param <Settings_Webforms_Module_Model> $moduleModel
 145       * @return <Settings_Webforms_Block_Model> BlockModel
 146       */
 147  	public static function getInstanceFromName($blockName, $moduleModel) {
 148          $blockModel = new self();
 149          $blockModel->name = $blockName;
 150          $blockModel->blocklabel = $blockName;
 151          $blockModel->module = $moduleModel;
 152  
 153          return $blockModel;
 154      }
 155  }


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1