[ 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 Vtiger_Base_UIType extends Vtiger_Base_Model { 12 13 /** 14 * Function to get the Template name for the current UI Type Object 15 * @return <String> - Template Name 16 */ 17 public function getTemplateName() { 18 return 'uitypes/String.tpl'; 19 } 20 21 /** 22 * Function to get the DB Insert Value, for the current field type with given User Value 23 * @param <Object> $value 24 * @return <Object> 25 */ 26 public function getDBInsertValue($value) { 27 return $value; 28 } 29 30 /** 31 * Function to get the Value of the field in the format, the user provides it on Save 32 * @param <Object> $value 33 * @return <Object> 34 */ 35 public function getUserRequestValue($value) { 36 return $value; 37 } 38 39 /** 40 * Function to get the Display Value, for the current field type with given DB Insert Value 41 * @param <Object> $value 42 * @return <Object> 43 */ 44 public function getDisplayValue($value, $record=false, $recordInstance=false) { 45 return $value; 46 } 47 48 /** 49 * Static function to get the UIType object from Vtiger Field Model 50 * @param Vtiger_Field_Model $fieldModel 51 * @return Vtiger_Base_UIType or UIType specific object instance 52 */ 53 public static function getInstanceFromField($fieldModel) { 54 $fieldDataType = $fieldModel->getFieldDataType(); 55 $uiTypeClassSuffix = ucfirst($fieldDataType); 56 $moduleName = $fieldModel->getModuleName(); 57 $moduleSpecificUiTypeClassName = $moduleName.'_'.$uiTypeClassSuffix.'_UIType'; 58 $uiTypeClassName = 'Vtiger_'.$uiTypeClassSuffix.'_UIType'; 59 $fallBackClassName = 'Vtiger_Base_UIType'; 60 61 $moduleSpecificFileName = 'modules.'. $moduleName .'.uitypes.'.$uiTypeClassSuffix; 62 $uiTypeClassFileName = 'modules.Vtiger.uitypes.'.$uiTypeClassSuffix; 63 64 $moduleSpecificFilePath = Vtiger_Loader::resolveNameToPath($moduleSpecificFileName); 65 $completeFilePath = Vtiger_Loader::resolveNameToPath($uiTypeClassFileName); 66 67 if(file_exists($moduleSpecificFilePath)) { 68 $instance = new $moduleSpecificUiTypeClassName(); 69 } 70 else if(file_exists($completeFilePath)) { 71 $instance = new $uiTypeClassName(); 72 } else { 73 $instance = new $fallBackClassName(); 74 } 75 $instance->set('field', $fieldModel); 76 return $instance; 77 } 78 79 /** 80 * Function to get the display value in edit view 81 * @param reference record id 82 * @return link 83 */ 84 public function getEditViewDisplayValue($value) { 85 return $value; 86 } 87 88 /** 89 * Function to get the Detailview template name for the current UI Type Object 90 * @return <String> - Template Name 91 */ 92 public function getDetailViewTemplateName() { 93 return 'uitypes/StringDetailView.tpl'; 94 } 95 96 /** 97 * Function to get Display value for RelatedList 98 * @param <String> $value 99 * @return <String> 100 */ 101 public function getRelatedListDisplayValue($value) { 102 return $this->getDisplayValue($value); 103 } 104 105 public function getListSearchTemplateName() { 106 return 'uitypes/FieldSearchView.tpl'; 107 } 108 }
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 |