本文整理汇总了PHP中CCrmOwnerType::INFO_STUB方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmOwnerType::INFO_STUB方法的具体用法?PHP CCrmOwnerType::INFO_STUB怎么用?PHP CCrmOwnerType::INFO_STUB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrmOwnerType
的用法示例。
在下文中一共展示了CCrmOwnerType::INFO_STUB方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: TryGetEntityInfo
public static function TryGetEntityInfo($typeID, $ID, &$info, $checkPermissions = true)
{
$typeID = intval($typeID);
$ID = intval($ID);
if (self::$INFO_STUB === null) {
self::$INFO_STUB = array('TITLE' => '', 'LEGEND' => '', 'IMAGE_FILE_ID' => 0, 'RESPONSIBLE_ID' => 0, 'SHOW_URL' => '');
}
if ($ID <= 0) {
$info = self::$INFO_STUB;
return false;
}
$key = "{$typeID}_{$ID}";
if ($checkPermissions && !CCrmAuthorizationHelper::CheckReadPermission($typeID, $ID)) {
$info = self::$INFO_STUB;
return false;
}
if (isset(self::$INFOS[$key])) {
if (is_array(self::$INFOS[$key])) {
$info = self::$INFOS[$key];
return true;
} else {
$info = self::$INFO_STUB;
return false;
}
}
switch ($typeID) {
case self::Lead:
$dbRes = CCrmLead::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID', 'TITLE', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'ASSIGNED_BY_ID'));
$arRes = $dbRes ? $dbRes->Fetch() : null;
if (!is_array($arRes)) {
self::$INFOS[$key] = false;
$info = self::$INFO_STUB;
return false;
}
self::$INFOS[$key] = array('TITLE' => isset($arRes['TITLE']) ? $arRes['TITLE'] : '', 'LEGEND' => CCrmLead::PrepareFormattedName($arRes), 'RESPONSIBLE_ID' => isset($arRes['ASSIGNED_BY_ID']) ? intval($arRes['ASSIGNED_BY_ID']) : 0, 'IMAGE_FILE_ID' => 0, 'SHOW_URL' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_lead_show'), array('lead_id' => $ID)));
$info = self::$INFOS[$key];
return true;
case self::Contact:
$dbRes = CCrmContact::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'COMPANY_ID', 'COMPANY_TITLE', 'PHOTO', 'ASSIGNED_BY_ID'));
$arRes = $dbRes ? $dbRes->Fetch() : null;
if (!is_array($arRes)) {
self::$INFOS[$key] = false;
$info = self::$INFO_STUB;
return false;
}
self::$INFOS[$key] = array('TITLE' => CCrmContact::PrepareFormattedName($arRes), 'LEGEND' => isset($arRes['COMPANY_TITLE']) ? $arRes['COMPANY_TITLE'] : '', 'RESPONSIBLE_ID' => isset($arRes['ASSIGNED_BY_ID']) ? intval($arRes['ASSIGNED_BY_ID']) : 0, 'IMAGE_FILE_ID' => isset($arRes['PHOTO']) ? intval($arRes['PHOTO']) : 0, 'SHOW_URL' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_contact_show'), array('contact_id' => $ID)));
$info = self::$INFOS[$key];
return true;
case self::Company:
$dbRes = CCrmCompany::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID', 'TITLE', 'COMPANY_TYPE', 'INDUSTRY', 'LOGO', 'ASSIGNED_BY_ID'));
$arRes = $dbRes ? $dbRes->Fetch() : null;
if (!is_array($arRes)) {
self::$INFOS[$key] = false;
$info = self::$INFO_STUB;
return false;
}
if (self::$COMPANY_TYPE === null) {
self::$COMPANY_TYPE = CCrmStatus::GetStatusList('COMPANY_TYPE');
}
if (self::$COMPANY_INDUSTRY === null) {
self::$COMPANY_INDUSTRY = CCrmStatus::GetStatusList('INDUSTRY');
}
$legendParts = array();
$typeID = isset($arRes['COMPANY_TYPE']) ? $arRes['COMPANY_TYPE'] : '';
if ($typeID !== '' && isset(self::$COMPANY_TYPE[$typeID])) {
$legendParts[] = self::$COMPANY_TYPE[$typeID];
}
$industryID = isset($arRes['INDUSTRY']) ? $arRes['INDUSTRY'] : '';
if ($industryID !== '' && isset(self::$COMPANY_INDUSTRY[$industryID])) {
$legendParts[] = self::$COMPANY_INDUSTRY[$industryID];
}
self::$INFOS[$key] = array('TITLE' => isset($arRes['TITLE']) ? $arRes['TITLE'] : '', 'LEGEND' => !empty($legendParts) ? implode(', ', $legendParts) : '', 'RESPONSIBLE_ID' => isset($arRes['ASSIGNED_BY_ID']) ? intval($arRes['ASSIGNED_BY_ID']) : 0, 'IMAGE_FILE_ID' => isset($arRes['LOGO']) ? intval($arRes['LOGO']) : 0, 'SHOW_URL' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_company_show'), array('company_id' => $ID)));
$info = self::$INFOS[$key];
return true;
case self::Deal:
$dbRes = CCrmDeal::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('TITLE', 'ASSIGNED_BY_ID'));
$arRes = $dbRes ? $dbRes->Fetch() : null;
if (!is_array($arRes)) {
self::$INFOS[$key] = false;
$info = self::$INFO_STUB;
return false;
}
self::$INFOS[$key] = array('TITLE' => isset($arRes['TITLE']) ? $arRes['TITLE'] : '', 'LEGEND' => '', 'RESPONSIBLE_ID' => isset($arRes['ASSIGNED_BY_ID']) ? intval($arRes['ASSIGNED_BY_ID']) : 0, 'IMAGE_FILE_ID' => 0, 'SHOW_URL' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_deal_show'), array('deal_id' => $ID)));
$info = self::$INFOS[$key];
return true;
case self::Invoice:
$dbRes = CCrmInvoice::GetList(array(), array('ID' => $ID), false, false, array('ORDER_TOPIC', 'RESPONSIBLE_ID'));
$arRes = $dbRes ? $dbRes->Fetch() : null;
if (!is_array($arRes)) {
self::$INFOS[$key] = false;
$info = self::$INFO_STUB;
return false;
}
self::$INFOS[$key] = array('TITLE' => isset($arRes['ORDER_TOPIC']) ? $arRes['ORDER_TOPIC'] : '', 'LEGEND' => '', 'RESPONSIBLE_ID' => isset($arRes['RESPONSIBLE_ID']) ? intval($arRes['RESPONSIBLE_ID']) : 0, 'IMAGE_FILE_ID' => 0, 'SHOW_URL' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_invoice_show'), array('invoice_id' => $ID)));
$info = self::$INFOS[$key];
return true;
case self::Quote:
$dbRes = CCrmQuote::GetList(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('TITLE', 'ASSIGNED_BY_ID'));
$arRes = $dbRes ? $dbRes->Fetch() : null;
if (!is_array($arRes)) {
//.........这里部分代码省略.........