[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
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_ModuleField_Model extends Vtiger_Field_Model { 12 13 public function getFieldName() { 14 $fieldName = parent::getFieldName(); 15 return 'selectedFieldsData['. $fieldName .'][defaultvalue]'; 16 } 17 18 public function isMandatory($forceCheck = false) { 19 if($forceCheck) { 20 return parent::isMandatory(); 21 } 22 return false; 23 } 24 25 /** 26 * Function to get the field details 27 * @return <Array> - array of field values 28 */ 29 public function getFieldInfo() { 30 $currentUser = Users_Record_Model::getCurrentUserModel(); 31 $fieldInfo = array( 32 'mandatory' => $this->isMandatory(), 33 'type' => $this->getFieldDataType(), 34 'name' => $this->getFieldName(), 35 'label' => vtranslate($this->get('label'), $this->getModuleName()), 36 'defaultValue' => $this->getEditViewDisplayValue($this->getDefaultFieldValue()), 37 'customField' => Settings_Webforms_Record_Model::isCustomField($this->get('name')), 38 'specialValidator' => $this->getValidator() 39 ); 40 41 $pickListValues = $this->getPicklistValues(); 42 if(!empty($pickListValues)) { 43 $fieldInfo['picklistvalues'] = $pickListValues; 44 } 45 46 if($this->getFieldDataType() == 'date' || $this->getFieldDataType() == 'datetime'){ 47 $currentUser = Users_Record_Model::getCurrentUserModel(); 48 $fieldInfo['date-format'] = $currentUser->get('date_format'); 49 } 50 51 if($this->getFieldDataType() == 'currency') { 52 $currentUser = Users_Record_Model::getCurrentUserModel(); 53 $fieldInfo['currency_symbol'] = $currentUser->get('currency_symbol'); 54 $fieldInfo['decimalSeperator'] = $currentUser->get('currency_decimal_separator'); 55 $fieldInfo['groupSeperator'] = $currentUser->get('currency_grouping_separator'); 56 } 57 58 if($this->getFieldDataType() == 'owner') { 59 $userList = $currentUser->getAccessibleUsers(); 60 $groupList = $currentUser->getAccessibleGroups(); 61 $pickListValues = array(); 62 $pickListValues[vtranslate('LBL_USERS', $this->getModuleName())] = $userList; 63 $pickListValues[vtranslate('LBL_GROUPS', $this->getModuleName())] = $groupList; 64 $fieldInfo['picklistvalues'] = $pickListValues; 65 } 66 67 if($this->getFieldDataType() == 'reference') { 68 $referenceList = $this->getReferenceList(); 69 $fieldInfo['referencemodules']= $referenceList; 70 } 71 72 return $fieldInfo; 73 } 74 75 public function getPicklistValues() { 76 $fieldDataType = $this->getFieldDataType(); 77 78 if ($fieldDataType != 'picklist') { 79 return parent::getPicklistValues(); 80 } 81 $pickListValues = array(); 82 $pickListValues[""] = vtranslate("LBL_SELECT_OPTION", 'Settings:Webforms'); 83 return ($pickListValues + parent::getPicklistValues()); 84 } 85 86 /** 87 * Function which will check if empty piclist option should be given 88 */ 89 public function isEmptyPicklistOptionAllowed() { 90 return false; 91 } 92 93 public static function getInstanceFromFieldObject(Vtiger_Field $fieldObj) { 94 $objectProperties = get_object_vars($fieldObj); 95 $fieldModel = new self(); 96 foreach($objectProperties as $properName=>$propertyValue) { 97 $fieldModel->$properName = $propertyValue; 98 } 99 return $fieldModel; 100 } 101 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |