[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/pkg/vtiger/modules/Webforms/settings/models/ -> Field.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_Field_Model extends Vtiger_Field_Model {
  12  
  13      /**
  14       * Function get field is viewable or not
  15       * @return <Boolean> true/false
  16       */
  17  	public function isViewable() {
  18          return true;
  19      }
  20  
  21      /**
  22       * Function to get instance of Field by using array of data
  23       * @param <Array> $rowData
  24       * @return <Settings_Webforms_Field_Model> FieldModel
  25       */
  26  	static public function getInstanceByRow($rowData) {
  27          $fieldModel = new self();
  28          foreach ($rowData as $name => $value) {
  29              $fieldModel->set($name, $value);
  30          }
  31          return $fieldModel;
  32      }
  33  
  34      /**
  35       * Function to check whether this field editable or not
  36       * @return <Boolean> true/false
  37       */
  38  	public function isEditable() {
  39          if (($this->getName() === 'publicid') || ($this->getName() === 'posturl')) {
  40              return false;
  41          }
  42          return true;
  43      }
  44      
  45  	public function isReadOnly() {
  46          if ($this->getName() === 'name') {
  47              return $this->get('readonly');
  48          }
  49          return false;
  50      }
  51      
  52      /**
  53       * Function to get the value of a given property
  54       * @param <String> $propertyName
  55       * @return <Object>
  56       * @throws Exception
  57       */
  58      public function get($propertyName) {
  59          if($propertyName == 'fieldvalue' && $this->name == 'roundrobin_userid') {
  60              $value = str_replace('&quot;', '"', $this->$propertyName);
  61              return json_decode($value,true);
  62          }
  63          return parent::get($propertyName);
  64      }
  65      
  66      /**
  67       * Function to get Picklist values
  68       * @return <Array> Picklist values
  69       */
  70  	public function getPicklistValues() {
  71          if ($this->getName() === 'targetmodule') {
  72              return Settings_Webforms_Module_Model::getsupportedModulesList();
  73          }
  74          return array();
  75      }
  76      
  77  	public function getDisplayValue($value) {
  78          if ($this->getName() === 'enabled') {
  79              $moduleName = 'Settings:Webforms';
  80              if ($value) {
  81                  return vtranslate('LBL_ACTIVE', $moduleName);
  82              }
  83              return vtranslate('LBL_INACTIVE', $moduleName);
  84          }
  85          return parent::getDisplayValue($value);
  86      }
  87      
  88  	public function getPermissions() {
  89          return true;
  90      }
  91      
  92      /**
  93       * Function which will check if empty piclist option should be given
  94       */
  95      public function isEmptyPicklistOptionAllowed() {
  96          return false;
  97      }
  98  }


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