/** * Function to get the Webservice Field data type * @return <String> Data type of the field */ public function getFieldDataType() { if ($this->get('uitype') == 99) { return 'password'; } else { if (in_array($this->get('uitype'), array(32, 115))) { return 'picklist'; } else { if ($this->get('uitype') == 101) { return 'userReference'; } else { if ($this->get('uitype') == 98) { return 'userRole'; } elseif ($this->get('uitype') == 105) { return 'image'; } else { if ($this->get('uitype') == 31) { return 'theme'; } } } } } return parent::getFieldDataType(); }
/** * Static function to get the UIType object from Vtiger Field Model * @param Vtiger_Field_Model $fieldModel * @return Vtiger_Base_UIType or UIType specific object instance */ public static function getInstanceFromField($fieldModel) { $fieldDataType = $fieldModel->getFieldDataType(); $uiTypeClassSuffix = ucfirst($fieldDataType); $moduleName = $fieldModel->getModuleName(); $moduleSpecificUiTypeClassName = $moduleName . '_' . $uiTypeClassSuffix . '_UIType'; $uiTypeClassName = 'Vtiger_' . $uiTypeClassSuffix . '_UIType'; $fallBackClassName = 'Vtiger_Base_UIType'; $moduleSpecificFileName = 'modules.' . $moduleName . '.uitypes.' . $uiTypeClassSuffix; $uiTypeClassFileName = 'modules.Vtiger.uitypes.' . $uiTypeClassSuffix; $moduleSpecificFilePath = Vtiger_Loader::resolveNameToPath($moduleSpecificFileName); $completeFilePath = Vtiger_Loader::resolveNameToPath($uiTypeClassFileName); if (file_exists($moduleSpecificFilePath)) { $instance = new $moduleSpecificUiTypeClassName(); } else if (file_exists($completeFilePath)) { $instance = new $uiTypeClassName(); } else { $instance = new $fallBackClassName(); } $instance->set('field', $fieldModel); return $instance; }
/** * Function to get field data type * @return <String> data type */ public function getFieldDataType() { if (!$this->fieldDataType && $this->getFieldType() == 'INVENTORY') { $this->fieldDataType = 'inventory'; } elseif (!$this->fieldDataType) { $this->fieldDataType = parent::getFieldDataType(); } if ($this->fieldDataType == 'salutation') { $this->fieldDataType = 'string'; } return $this->fieldDataType; }
/** * Function to get the Webservice Field data type * @return <String> Data type of the field */ public function getFieldDataType() { if ($this->getName() == 'date_start' || $this->getName() == 'due_date') { return 'datetime'; } else { if ($this->get('uitype') == '30') { return 'reminder'; } else { if ($this->getName() == 'recurringtype') { return 'recurrence'; } } } return parent::getFieldDataType(); }