本文整理汇总了PHP中Vtiger_Util_Helper::getLabel方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Util_Helper::getLabel方法的具体用法?PHP Vtiger_Util_Helper::getLabel怎么用?PHP Vtiger_Util_Helper::getLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Util_Helper
的用法示例。
在下文中一共展示了Vtiger_Util_Helper::getLabel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: populateTo
public function populateTo($request)
{
$viewer = $this->getViewer($request);
$inventoryRecordId = $request->get('record');
$recordModel = Vtiger_Record_Model::getInstanceById($inventoryRecordId, $request->getModule());
$inventoryModule = $recordModel->getModule();
$inventotyfields = $inventoryModule->getFields();
$toEmailConsiderableFields = array('contact_id', 'account_id', 'vendor_id');
$db = PearDatabase::getInstance();
$to = array();
$to_info = array();
$toMailNamesList = array();
foreach ($toEmailConsiderableFields as $fieldName) {
if (!array_key_exists($fieldName, $inventotyfields)) {
continue;
}
$fieldModel = $inventotyfields[$fieldName];
if (!$fieldModel->isViewable()) {
continue;
}
$fieldValue = $recordModel->get($fieldName);
if (empty($fieldValue)) {
continue;
}
$referenceList = $fieldModel->getReferenceList();
$referenceModule = $referenceList[0];
$fieldLabel = Vtiger_Util_Helper::getLabel($fieldValue);
$referenceModuleModel = Vtiger_Module_Model::getInstance($referenceModule);
$emailFields = $referenceModuleModel->getFieldsByType('email');
if (count($emailFields) <= 0) {
continue;
}
$current_user = Users_Record_Model::getCurrentUserModel();
$queryGenerator = new QueryGenerator($referenceModule, $current_user);
$queryGenerator->setFields(array_keys($emailFields));
$query = $queryGenerator->getQuery();
$query .= ' AND crmid = ' . $fieldValue;
$result = $db->pquery($query, array());
$num_rows = $db->num_rows($result);
if ($num_rows <= 0) {
continue;
}
foreach ($emailFields as $fieldName => $emailFieldModel) {
$emailValue = $db->query_result($result, 0, $fieldName);
if (!empty($emailValue)) {
$to[] = $emailValue;
$to_info[$fieldValue][] = $emailValue;
$toMailNamesList[$fieldValue][] = array('label' => $fieldLabel, 'value' => $emailValue);
break;
}
}
if (!empty($to)) {
break;
}
}
$viewer->assign('TO', $to);
$viewer->assign('TOMAIL_NAMES_LIST', $toMailNamesList);
$viewer->assign('TOMAIL_INFO', $to_info);
}
示例2: getDisplayName
/**
* Function to get the Display Name for the record
* @return <String> - Entity Display Name for the record
*/
public function getDisplayName()
{
return Vtiger_Util_Helper::getLabel($this->getId());
}
示例3: checkDuplicates
function checkDuplicates($fieldName, $moduleName, $fieldValue, $recordId) {
$db = PearDatabase::getInstance();
$moduleInstance = Vtiger_Module_Model::getInstance($moduleName);
$fieldInstance = Vtiger_Field_Model::getInstance($fieldName, $moduleInstance);
if (!$fieldInstance) {
return false;
} else {
$tableKey = $this->getTableKey($fieldInstance, $moduleInstance);
if ($fieldInstance->uitype == 11) {
//its a phone number we remove everything but the numbers
$phoneNumber = preg_replace('/[^0-9,]|,[0-9]*$/', '', $fieldValue);
$result = $db->pquery("SELECT * FROM $fieldInstance->table INNER JOIN vtiger_crmentity ON
$fieldInstance->table.$tableKey = vtiger_crmentity.crmid WHERE deleted=0
AND $fieldInstance->table.$tableKey != ? AND TRIM(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE($fieldInstance->name,
' ', '' ),
'-', '' ),
',', '' ),
'/', '' ),
'(', '' ),
')', '' )
) = ?", array($recordId, $phoneNumber));
} else {
$result = $db->pquery("SELECT * FROM $fieldInstance->table INNER JOIN vtiger_crmentity ON
$fieldInstance->table.$tableKey = vtiger_crmentity.crmid WHERE deleted=0 AND $fieldInstance->table.$tableKey != ? AND $fieldInstance->name = ?", array($recordId, $fieldValue));
}
if ($db->num_rows($result) > 0) {
$tableKeyField = $this->getTableKey($fieldInstance, $moduleInstance);
$currentUserModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
$msg = vtranslate('record_exist', 'VGSDuplicateDetector');
while ($row = $db->fetch_row($result)) {
if ($currentUserModel->isPermitted($moduleName, 'Detail', $row[$tableKeyField])) {
$msg .= ' - <a style="color:#0000EE;text-decoration:underline;" target="_blank" href="index.php?module=' . $moduleName . '&view=Detail&record=' . $row[$tableKeyField] . '">' . Vtiger_Util_Helper::getLabel($row[$tableKeyField]) . '</a><br>';
} else {
$msg .= ' - ' . vtranslate('Private Record', 'VGSDuplicateDetector') . '<br>';
}
}
return $msg;
} else {
return false;
}
}
}