當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CCrmOwnerType::INFO_STUB方法代碼示例

本文整理匯總了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)) {
//.........這裏部分代碼省略.........
開發者ID:mrdeadmouse,項目名稱:u136006,代碼行數:101,代碼來源:crm_owner_type.php


注:本文中的CCrmOwnerType::INFO_STUB方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。