本文整理汇总了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;
}