本文整理匯總了PHP中Vtiger_Functions::getModuleFieldInfoWithId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Vtiger_Functions::getModuleFieldInfoWithId方法的具體用法?PHP Vtiger_Functions::getModuleFieldInfoWithId怎麽用?PHP Vtiger_Functions::getModuleFieldInfoWithId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Vtiger_Functions
的用法示例。
在下文中一共展示了Vtiger_Functions::getModuleFieldInfoWithId方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: reloadValue
/**
* Update the value for relation
* @param string $sourceModule Source module name
* @param int $sourceRecord Source record
*/
public function reloadValue($sourceModule, $sourceRecord)
{
$currentUser = vglobal('current_user');
$user = new Users();
vglobal('current_user', $user->retrieveCurrentUserInfoFromFile(Users::getActiveAdminId()));
vglobal('currentModule', $sourceModule);
$db = PearDatabase::getInstance();
$params = $this->get('field')->getFieldParams();
$sourceRecordModel = Vtiger_Record_Model::getInstanceById($sourceRecord, $sourceModule);
$targetModel = Vtiger_RelationListView_Model::getInstance($sourceRecordModel, $params['module']);
$fieldInfo = Vtiger_Functions::getModuleFieldInfoWithId($params['field']);
$query = $targetModel->getRelationQuery();
$explodedQuery = explode('FROM', $query, 2);
$relationQuery = 'SELECT DISTINCT ' . $fieldInfo['columnname'] . ' FROM' . $explodedQuery[1] . ' AND ' . $fieldInfo['columnname'] . " <> ''";
vglobal('current_user', $currentUser);
$result = $db->query($relationQuery);
$currentValue = self::COMMA;
while ($value = $db->getSingleValue($result)) {
$currentValue .= $value . self::COMMA;
}
$db->update($this->get('field')->get('table'), [$this->get('field')->get('column') => $currentValue], $sourceRecordModel->getEntity()->tab_name_index[$this->get('field')->get('table')] . ' = ?', [$sourceRecord]);
}
示例2: getInstanceFromFieldId
public static function getInstanceFromFieldId($fieldId, $moduleTabId = false)
{
$fieldModel = Vtiger_Cache::get('FieldModel', $fieldId);
if ($fieldModel) {
return $fieldModel;
}
$field = Vtiger_Functions::getModuleFieldInfoWithId($fieldId);
$fieldModel = new self();
$fieldModel->initialize($field);
Vtiger_Cache::set('FieldModel', $fieldId, $fieldModel);
return $fieldModel;
}