当前位置: 首页>>代码示例>>PHP>>正文


PHP CCrmContact::PrepareFormattedName方法代码示例

本文整理汇总了PHP中CCrmContact::PrepareFormattedName方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmContact::PrepareFormattedName方法的具体用法?PHP CCrmContact::PrepareFormattedName怎么用?PHP CCrmContact::PrepareFormattedName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCrmContact的用法示例。


在下文中一共展示了CCrmContact::PrepareFormattedName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getContactInfo

 protected static function getContactInfo($contactID)
 {
     if ($contactID <= 0) {
         return array();
     }
     $result = array('FULL_NAME' => '', 'FULL_ADDRESS' => '', 'PHONE' => '', 'EMAIL' => '');
     $dbRes = \CCrmContact::GetListEx(array(), array('=ID' => $contactID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('NAME', 'SECOND_NAME', 'LAST_NAME', 'ADDRESS', 'ADDRESS_2', 'ADDRESS_CITY', 'ADDRESS_POSTAL_CODE', 'ADDRESS_REGION', 'ADDRESS_PROVINCE', 'ADDRESS_COUNTRY'));
     $fields = is_object($dbRes) ? $dbRes->Fetch() : null;
     if (is_array($fields)) {
         $result['FULL_NAME'] = \CCrmContact::PrepareFormattedName($fields);
         $result['FULL_ADDRESS'] = Format\ContactAddressFormatter::format($fields, array('SEPARATOR' => Format\AddressSeparator::NewLine));
         $dbRes = \CCrmFieldMulti::GetListEx(array('ID' => 'asc'), array('ENTITY_ID' => 'CONTACT', 'ELEMENT_ID' => $contactID, '@TYPE_ID' => array('PHONE', 'EMAIL')), false, false, array('TYPE_ID', 'VALUE'));
         while ($multiFields = $dbRes->Fetch()) {
             if ($result['PHONE'] === '' && $multiFields['TYPE_ID'] === 'PHONE') {
                 $result['PHONE'] = $multiFields['VALUE'];
             } elseif ($result['EMAIL'] === '' && $multiFields['TYPE_ID'] === 'EMAIL') {
                 $result['EMAIL'] = $multiFields['VALUE'];
             }
             if ($result['PHONE'] !== '' && $result['EMAIL'] !== '') {
                 break;
             }
         }
     }
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:25,代码来源:datagenerator.php

示例2: showField


//.........这里部分代码省略.........
                    $strResult .= "#cell_begin_left#";
                    $strResult .= $arField["TITLE"] . ":";
                    $strResult .= "#cell_end#";
                    $strResult .= "#cell_begin_right#";
                    if (array_key_exists("CONTACT_ID", $arField["VALUE"]) && intval($arField["VALUE"]["CONTACT_ID"]) > 0 || array_key_exists("CONTACT_NAME", $arField["VALUE"]) && strlen($arField["VALUE"]["CONTACT_NAME"]) > 0 || array_key_exists("CONTACT_LAST_NAME", $arField["VALUE"]) && strlen($arField["VALUE"]["CONTACT_LAST_NAME"]) > 0) {
                        if (array_key_exists("CONTACT_ID", $arField["VALUE"]) && intval($arField["VALUE"]["CONTACT_ID"]) > 0) {
                            $strResult .= '<div class="crm-feed-client-block">';
                            $strResult .= '<span class="feed-com-avatar crm-feed-user-avatar">';
                            $dbRes = CCrmContact::GetListEx(array(), array('=ID' => $arField["VALUE"]["CONTACT_ID"], 'CHECK_PERMISSIONS' => 'N'), false, false, array('PHOTO', 'COMPANY_ID'));
                            if ($arRes = $dbRes->Fetch()) {
                                $contactCompanyID = $arRes['COMPANY_ID'];
                                if (intval($arRes["PHOTO"]) > 0) {
                                    $arFileTmp = CFile::ResizeImageGet($arRes["PHOTO"], array('width' => 39, 'height' => 39), BX_RESIZE_IMAGE_EXACT, false);
                                    if (is_array($arFileTmp) && isset($arFileTmp["src"])) {
                                        $strResult .= '<img width="39" height="39" src="' . $arFileTmp['src'] . '" alt="">';
                                    }
                                }
                            }
                            $strResult .= '</span>';
                            $strResult .= CCrmViewHelper::PrepareEntityBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Contact, 'ENTITY_ID' => $arField["VALUE"]["CONTACT_ID"], 'PREFIX' => '', 'CLASS_NAME' => '', 'CHECK_PERMISSIONS' => 'N'));
                        } else {
                            $strResult .= '<div class="crm-feed-client-block">';
                            $strResult .= '<span class="feed-com-avatar crm-feed-user-avatar">';
                            if (intval($arField['VALUE']['PHOTO_ID']) > 0) {
                                $arFileTmp = CFile::ResizeImageGet($arField['VALUE']['PHOTO_ID'], array('width' => 39, 'height' => 39), BX_RESIZE_IMAGE_EXACT, false);
                                if (is_array($arFileTmp) && isset($arFileTmp["src"])) {
                                    $strResult .= '<img width="39" height="39" src="' . $arFileTmp['src'] . '" alt="">';
                                }
                            }
                            $strResult .= '</span>';
                            if (array_key_exists("ENTITY_ID", $arField["VALUE"]) && intval($arField["VALUE"]["ENTITY_ID"]) > 0) {
                                $url = CCrmOwnerType::GetShowUrl(CCrmOwnerType::Contact, $arField["VALUE"]["ENTITY_ID"], true);
                            }
                            $clientName = CCrmContact::PrepareFormattedName(array('HONORIFIC' => isset($arField['VALUE']['HONORIFIC']) ? $arField['VALUE']['HONORIFIC'] : '', 'NAME' => isset($arField['VALUE']['CONTACT_NAME']) ? $arField['VALUE']['CONTACT_NAME'] : '', 'LAST_NAME' => isset($arField['VALUE']['CONTACT_LAST_NAME']) ? $arField['VALUE']['CONTACT_LAST_NAME'] : '', 'SECOND_NAME' => isset($arField['VALUE']['CONTACT_SECOND_NAME']) ? $arField['VALUE']['CONTACT_SECOND_NAME'] : ''));
                            $strResult .= strlen($url) > 0 ? '<a href="' . $url . '" class="crm-feed-client-name">' . $clientName . '</a>' : $clientName;
                        }
                        $strResult .= '<span class="crm-feed-client-company">';
                        $strResult .= CCrmViewHelper::PrepareEntityBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => array_key_exists("COMPANY_ID", $arField["VALUE"]) && intval($arField["VALUE"]["COMPANY_ID"]) > 0 ? $arField["VALUE"]["COMPANY_ID"] : intval($contactCompanyID), 'PREFIX' => '', 'CLASS_NAME' => '', 'CHECK_PERMISSIONS' => 'N'));
                        $strResult .= '</span>';
                        $strResult .= '</div>';
                    } else {
                        $strResult .= CCrmViewHelper::PrepareEntityBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $arField["VALUE"]["COMPANY_ID"], 'PREFIX' => "", 'CLASS_NAME' => '', 'CHECK_PERMISSIONS' => 'N'));
                    }
                    $strResult .= "#cell_end#";
                    $strResult .= "#row_end#";
                }
                break;
            case "COMBI_COMPANY":
                if (is_array($arField["VALUE"]) && (array_key_exists("TITLE", $arField["VALUE"]) && strlen($arField["VALUE"]["TITLE"]) > 0)) {
                    $strResult .= "#row_begin#";
                    $strResult .= "#cell_begin_left#";
                    $strResult .= $arField["TITLE"] . ":";
                    $strResult .= "#cell_end#";
                    $strResult .= "#cell_begin_right#";
                    $url = CCrmOwnerType::GetShowUrl(CCrmOwnerType::Company, $arField["VALUE"]["ENTITY_ID"]);
                    if (intval($arField['VALUE']['LOGO_ID']) > 0) {
                        $arFileTmp = CFile::ResizeImageGet($arField['VALUE']['LOGO_ID'], array('width' => 39, 'height' => 39), BX_RESIZE_IMAGE_EXACT, false);
                    }
                    if (is_array($arFileTmp) && isset($arFileTmp['src'])) {
                        $strResult .= '<a class="crm-feed-user-block" href="' . $url . '">';
                        $strResult .= '<span class="feed-com-avatar crm-feed-company-avatar">';
                        $strResult .= '<img width="39" height="39" alt="" src="' . $arFileTmp['src'] . '">';
                        $strResult .= '</span>';
                        $strResult .= '<span class="crm-feed-user-name">' . $arField["VALUE"]["TITLE"] . '</span>';
                        $strResult .= '</a>';
                    } else {
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:67,代码来源:livefeed.php

示例3: CompareFields

 public static function CompareFields($arFieldsOrig, $arFieldsModif, $bCheckPerms = true)
 {
     $arMsg = array();
     if (array_key_exists('QUOTE_NUMBER', $arFieldsModif)) {
         $origQuoteNumber = isset($arFieldsOrig['QUOTE_NUMBER']) ? $arFieldsOrig['QUOTE_NUMBER'] : '';
         $modifQuoteNumber = isset($arFieldsModif['QUOTE_NUMBER']) ? $arFieldsModif['QUOTE_NUMBER'] : '';
         if ($origQuoteNumber != $modifQuoteNumber) {
             $arMsg[] = array('ENTITY_FIELD' => 'QUOTE_NUMBER', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_QUOTE_NUMBER'), 'EVENT_TEXT_1' => !empty($origQuoteNumber) ? $origQuoteNumber : GetMessage('CRM_QUOTE_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($modifQuoteNumber) ? $modifQuoteNumber : GetMessage('CRM_QUOTE_FIELD_COMPARE_EMPTY'));
         }
         unset($origQuoteNumber, $modifQuoteNumber);
     }
     if (array_key_exists('TITLE', $arFieldsModif)) {
         $origTitle = isset($arFieldsOrig['TITLE']) ? $arFieldsOrig['TITLE'] : '';
         $modifTitle = isset($arFieldsModif['TITLE']) ? $arFieldsModif['TITLE'] : '';
         if ($origTitle != $modifTitle) {
             $arMsg[] = array('ENTITY_FIELD' => 'TITLE', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_TITLE'), 'EVENT_TEXT_1' => !empty($origTitle) ? $origTitle : GetMessage('CRM_QUOTE_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($modifTitle) ? $modifTitle : GetMessage('CRM_QUOTE_FIELD_COMPARE_EMPTY'));
         }
         unset($origTitle, $modifTitle);
     }
     if (array_key_exists('LEAD_ID', $arFieldsModif)) {
         $origLeadId = isset($arFieldsOrig['LEAD_ID']) ? intval($arFieldsOrig['LEAD_ID']) : 0;
         $modifLeadId = isset($arFieldsModif['LEAD_ID']) ? intval($arFieldsModif['LEAD_ID']) : 0;
         if ($origLeadId != $modifLeadId) {
             $arLead = array();
             $arFilterTmp = array('@ID' => array($origLeadId, $modifLeadId));
             if (!$bCheckPerms) {
                 $arFilterTmp["CHECK_PERMISSIONS"] = "N";
             }
             $dbRes = CCrmLead::GetListEx(array('TITLE' => 'ASC'), $arFilterTmp);
             while ($arRes = $dbRes->Fetch()) {
                 $arLead[$arRes['ID']] = $arRes['TITLE'];
             }
             $arMsg[] = array('ENTITY_FIELD' => 'LEAD_ID', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_LEAD_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arLead, $origLeadId), 'EVENT_TEXT_2' => CrmCompareFieldsList($arLead, $modifLeadId));
         }
         unset($origLeadId, $modifLeadId);
     }
     if (array_key_exists('DEAL_ID', $arFieldsModif)) {
         $origDealId = isset($arFieldsOrig['DEAL_ID']) ? intval($arFieldsOrig['DEAL_ID']) : 0;
         $modifDealId = isset($arFieldsModif['DEAL_ID']) ? intval($arFieldsModif['DEAL_ID']) : 0;
         if ($origDealId != $modifDealId) {
             $arDeal = array();
             $arFilterTmp = array('ID' => array($origDealId, $modifDealId));
             if (!$bCheckPerms) {
                 $arFilterTmp["CHECK_PERMISSIONS"] = "N";
             }
             $dbRes = CCrmDeal::GetList(array('TITLE' => 'ASC'), $arFilterTmp);
             while ($arRes = $dbRes->Fetch()) {
                 $arDeal[$arRes['ID']] = $arRes['TITLE'];
             }
             $arMsg[] = array('ENTITY_FIELD' => 'DEAL_ID', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_DEAL_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arDeal, $origDealId), 'EVENT_TEXT_2' => CrmCompareFieldsList($arDeal, $modifDealId));
         }
         unset($origDealId, $modifDealId);
     }
     if (array_key_exists('COMPANY_ID', $arFieldsModif)) {
         $origCompanyId = isset($arFieldsOrig['COMPANY_ID']) ? intval($arFieldsOrig['COMPANY_ID']) : 0;
         $modifCompanyId = isset($arFieldsModif['COMPANY_ID']) ? intval($arFieldsModif['COMPANY_ID']) : 0;
         if ($origCompanyId != $modifCompanyId) {
             $arCompany = array();
             $arFilterTmp = array('ID' => array($origCompanyId, $modifCompanyId));
             if (!$bCheckPerms) {
                 $arFilterTmp["CHECK_PERMISSIONS"] = "N";
             }
             $dbRes = CCrmCompany::GetList(array('TITLE' => 'ASC'), $arFilterTmp);
             while ($arRes = $dbRes->Fetch()) {
                 $arCompany[$arRes['ID']] = $arRes['TITLE'];
             }
             $arMsg[] = array('ENTITY_FIELD' => 'COMPANY_ID', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_COMPANY_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arCompany, $origCompanyId), 'EVENT_TEXT_2' => CrmCompareFieldsList($arCompany, $modifCompanyId));
         }
         unset($origCompanyId, $modifCompanyId);
     }
     if (array_key_exists('CONTACT_ID', $arFieldsModif)) {
         $origContactId = isset($arFieldsOrig['CONTACT_ID']) ? intval($arFieldsOrig['CONTACT_ID']) : 0;
         $modifContactId = isset($arFieldsModif['CONTACT_ID']) ? intval($arFieldsModif['CONTACT_ID']) : 0;
         if ($origContactId != $modifContactId) {
             $arContact = array();
             $arFilterTmp = array('@ID' => array($origContactId, $modifContactId));
             if (!$bCheckPerms) {
                 $arFilterTmp["CHECK_PERMISSIONS"] = "N";
             }
             $dbRes = CCrmContact::GetListEx(array(), $arFilterTmp);
             while ($arRes = $dbRes->Fetch()) {
                 $arContact[$arRes['ID']] = CCrmContact::PrepareFormattedName($arRes);
             }
             $arMsg[] = array('ENTITY_FIELD' => 'CONTACT_ID', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_CONTACT_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arContact, $origContactId), 'EVENT_TEXT_2' => CrmCompareFieldsList($arContact, $modifContactId));
         }
         unset($origContactId, $modifContactId);
     }
     if (array_key_exists('ASSIGNED_BY_ID', $arFieldsModif)) {
         $origAssignedById = isset($arFieldsOrig['ASSIGNED_BY_ID']) ? intval($arFieldsOrig['ASSIGNED_BY_ID']) : 0;
         $modifAssignedById = isset($arFieldsModif['ASSIGNED_BY_ID']) ? intval($arFieldsModif['ASSIGNED_BY_ID']) : 0;
         if ($origAssignedById != $modifAssignedById) {
             $arUser = array();
             $dbUsers = CUser::GetList($sort_by = 'last_name', $sort_dir = 'asc', array('ID' => implode('|', array(intval($origAssignedById), intval($modifAssignedById)))), array('FIELDS' => array('ID', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'LOGIN', 'TITLE', 'EMAIL')));
             while ($arRes = $dbUsers->Fetch()) {
                 $arUser[$arRes['ID']] = CUser::FormatName(CSite::GetNameFormat(false), $arRes);
             }
             $arMsg[] = array('ENTITY_FIELD' => 'ASSIGNED_BY_ID', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_ASSIGNED_BY_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arUser, $origAssignedById), 'EVENT_TEXT_2' => CrmCompareFieldsList($arUser, $modifAssignedById));
         }
         unset($origAssignedById, $modifAssignedById);
     }
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:crm_quote.php

示例4: PrepareEntityInfo

 private static function PrepareEntityInfo($typeID, $ID, &$arRes, $options = null)
 {
     $enableEditUrl = is_array($options) && isset($options['ENABLE_EDIT_URL']) && $options['ENABLE_EDIT_URL'] === true;
     switch ($typeID) {
         case self::Lead:
             $treatAsContact = false;
             $treatAsCompany = false;
             if (is_array($options)) {
                 $treatAsContact = isset($options['TREAT_AS_CONTACT']) && $options['TREAT_AS_CONTACT'];
                 $treatAsCompany = isset($options['TREAT_AS_COMPANY']) && $options['TREAT_AS_COMPANY'];
             }
             if ($treatAsContact) {
                 $result = array('TITLE' => CCrmLead::PrepareFormattedName($arRes), 'LEGEND' => isset($arRes['TITLE']) ? $arRes['TITLE'] : '');
             } elseif ($treatAsCompany) {
                 $result = array('TITLE' => isset($arRes['COMPANY_TITLE']) ? $arRes['COMPANY_TITLE'] : '', 'LEGEND' => isset($arRes['TITLE']) ? $arRes['TITLE'] : '');
             } else {
                 $result = array('TITLE' => isset($arRes['TITLE']) ? $arRes['TITLE'] : '', 'LEGEND' => CCrmLead::PrepareFormattedName($arRes));
             }
             $result['RESPONSIBLE_ID'] = isset($arRes['ASSIGNED_BY_ID']) ? intval($arRes['ASSIGNED_BY_ID']) : 0;
             $result['IMAGE_FILE_ID'] = 0;
             $result['SHOW_URL'] = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_lead_show'), array('lead_id' => $ID));
             if ($enableEditUrl) {
                 $result['EDIT_URL'] = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_lead_edit'), array('lead_id' => $ID));
             }
             return $result;
         case self::Contact:
             $result = 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)));
             if ($enableEditUrl) {
                 $result['EDIT_URL'] = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_contact_edit'), array('contact_id' => $ID));
             }
             return $result;
         case self::Company:
             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];
             }
             $result = 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)));
             if ($enableEditUrl) {
                 $result['EDIT_URL'] = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_company_edit'), array('company_id' => $ID));
             }
             return $result;
         case self::Deal:
             $result = 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)));
             if ($enableEditUrl) {
                 $result['EDIT_URL'] = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_deal_edit'), array('deal_id' => $ID));
             }
             return $result;
         case self::Invoice:
             $result = 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)));
             if ($enableEditUrl) {
                 $result['EDIT_URL'] = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_invoice_edit'), array('invoice_id' => $ID));
             }
             return $result;
         case self::Quote:
             $result = 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_quote_show'), array('quote_id' => $ID)));
             if ($enableEditUrl) {
                 $result['EDIT_URL'] = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_quote_edit'), array('quote_id' => $ID));
             }
             return $result;
     }
     return null;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:73,代码来源:crm_owner_type.php

示例5: prepareCollisionMessageFields

 protected function prepareCollisionMessageFields(array &$collisions, array &$seed, array &$targ)
 {
     self::includeLangFile();
     $replacements = array('#USER_NAME#' => $this->getUserName(), '#SEED_TITLE#' => \CCrmContact::PrepareFormattedName($seed), '#SEED_ID#' => isset($seed['ID']) ? $seed['ID'] : '', '#TARG_TITLE#' => \CCrmContact::PrepareFormattedName($targ), '#TARG_ID#' => isset($targ['ID']) ? $targ['ID'] : '');
     $messages = array();
     if (isset($collisions[EntityMergeCollision::READ_PERMISSION_LACK]) && isset($collisions[EntityMergeCollision::UPDATE_PERMISSION_LACK])) {
         $messages[] = GetMessage('CRM_CONTACT_MERGER_COLLISION_READ_UPDATE_PERMISSION', $replacements);
     } elseif (isset($collisions[EntityMergeCollision::READ_PERMISSION_LACK])) {
         $messages[] = GetMessage('CRM_CONTACT_MERGER_COLLISION_READ_PERMISSION', $replacements);
     } elseif (isset($collisions[EntityMergeCollision::UPDATE_PERMISSION_LACK])) {
         $messages[] = GetMessage('CRM_CONTACT_MERGER_COLLISION_UPDATE_PERMISSION', $replacements);
     }
     if (empty($messages)) {
         return null;
     }
     $html = implode('<br/>', $messages);
     return array('TO_USER_ID' => isset($seed['ASSIGNED_BY_ID']) ? (int) $seed['ASSIGNED_BY_ID'] : 0, 'NOTIFY_MESSAGE' => $html, 'NOTIFY_MESSAGE_OUT' => $html);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:18,代码来源:contactmerger.php

示例6: PrepareCommunicationInfo

 public static function PrepareCommunicationInfo(&$arComm, $arFields = null)
 {
     if (!isset($arComm['ENTITY_SETTINGS'])) {
         if (!self::PrepareCommunicationSettings($arComm, $arFields)) {
             $arComm['TITLE'] = '';
             $arComm['DESCRIPTION'] = '';
             return false;
         }
     }
     $title = '';
     $description = '';
     $entityTypeID = isset($arComm['ENTITY_TYPE_ID']) ? intval($arComm['ENTITY_TYPE_ID']) : CCrmOwnerType::Undefined;
     if ($entityTypeID === CCrmOwnerType::Lead) {
         $honorific = '';
         $name = '';
         $secondName = '';
         $lastName = '';
         $leadTitle = '';
         if (is_array($arComm['ENTITY_SETTINGS'])) {
             $settings = $arComm['ENTITY_SETTINGS'];
             $honorific = isset($settings['HONORIFIC']) ? $settings['HONORIFIC'] : '';
             $name = isset($settings['NAME']) ? $settings['NAME'] : '';
             $secondName = isset($settings['SECOND_NAME']) ? $settings['SECOND_NAME'] : '';
             $lastName = isset($settings['LAST_NAME']) ? $settings['LAST_NAME'] : '';
             $leadTitle = isset($settings['LEAD_TITLE']) ? $settings['LEAD_TITLE'] : '';
         } else {
             $arEntity = CCrmLead::GetByID($arComm['ENTITY_ID']);
             if ($arEntity) {
                 $honorific = isset($arEntity['HONORIFIC']) ? $arEntity['HONORIFIC'] : '';
                 $name = isset($arEntity['NAME']) ? $arEntity['NAME'] : '';
                 $secondName = isset($arEntity['SECOND_NAME']) ? $arEntity['SECOND_NAME'] : '';
                 $lastName = isset($arEntity['LAST_NAME']) ? $arEntity['LAST_NAME'] : '';
                 $leadTitle = isset($arEntity['TITLE']) ? $arEntity['TITLE'] : '';
             }
         }
         if ($name === '' && $secondName === '' && $lastName === '') {
             $title = $leadTitle;
             //$description = '';
         } else {
             $title = CCrmLead::PrepareFormattedName(array('HONORIFIC' => $honorific, 'NAME' => $name, 'SECOND_NAME' => $secondName, 'LAST_NAME' => $lastName));
             $description = $leadTitle;
         }
     } elseif ($entityTypeID === CCrmOwnerType::Contact) {
         // Empty TYPE is person to person communiation, empty ENTITY_ID is unbound communication - no method to build title
         if (!($arComm['TYPE'] === '' && intval($arComm['ENTITY_ID']) === 0)) {
             $honorific = '';
             $name = '';
             $secondName = '';
             $lastName = '';
             $companyTitle = '';
             if (is_array($arComm['ENTITY_SETTINGS'])) {
                 $settings = $arComm['ENTITY_SETTINGS'];
                 $honorific = isset($settings['HONORIFIC']) ? $settings['HONORIFIC'] : '';
                 $name = isset($settings['NAME']) ? $settings['NAME'] : '';
                 $secondName = isset($settings['SECOND_NAME']) ? $settings['SECOND_NAME'] : '';
                 $lastName = isset($settings['LAST_NAME']) ? $settings['LAST_NAME'] : '';
                 $companyTitle = isset($settings['COMPANY_TITLE']) ? $settings['COMPANY_TITLE'] : '';
             } else {
                 $arEntity = CCrmContact::GetByID($arComm['ENTITY_ID']);
                 if ($arEntity) {
                     $honorific = isset($arEntity['HONORIFIC']) ? $arEntity['HONORIFIC'] : '';
                     $name = isset($arEntity['NAME']) ? $arEntity['NAME'] : '';
                     $secondName = isset($arEntity['SECOND_NAME']) ? $arEntity['SECOND_NAME'] : '';
                     $lastName = isset($arEntity['LAST_NAME']) ? $arEntity['LAST_NAME'] : '';
                     $companyTitle = isset($arEntity['COMPANY_TITLE']) ? $arEntity['COMPANY_TITLE'] : '';
                 }
             }
             $title = CCrmContact::PrepareFormattedName(array('HONORIFIC' => $honorific, 'NAME' => $name, 'SECOND_NAME' => $secondName, 'LAST_NAME' => $lastName));
             $description = $companyTitle;
         }
     } elseif ($entityTypeID === CCrmOwnerType::Company) {
         if (is_array($arComm['ENTITY_SETTINGS'])) {
             $settings = $arComm['ENTITY_SETTINGS'];
             $title = isset($settings['COMPANY_TITLE']) ? $settings['COMPANY_TITLE'] : '';
         } else {
             $arEntity = CCrmCompany::GetByID($arComm['ENTITY_ID']);
             if ($arEntity) {
                 $title = isset($arEntity['TITLE']) ? $arEntity['TITLE'] : '';
             }
         }
     }
     $arComm['TITLE'] = $title;
     $arComm['DESCRIPTION'] = $description;
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:85,代码来源:crm_activity.php

示例7: findByPhoneNumber

 public static function findByPhoneNumber($number, $params = array())
 {
     if (!is_string($number)) {
         throw new \Bitrix\Main\ArgumentTypeException('number', 'string');
     }
     if ($number === '') {
         throw new \Bitrix\Main\ArgumentException('Is empty', 'number');
     }
     if (!is_array($params)) {
         $params = array();
     }
     $userID = isset($params['USER_ID']) ? intval($params['USER_ID']) : 0;
     if ($userID <= 0) {
         $userID = CCrmPerms::GetCurrentUserID();
     }
     $isAdmin = CCrmPerms::IsAdmin($userID);
     $userPermissions = CCrmPerms::GetUserPermissions($userID);
     $enableExtendedMode = isset($params['ENABLE_EXTENDED_MODE']) ? (bool) $params['ENABLE_EXTENDED_MODE'] : true;
     $contactFormID = isset($params['CONTACT_FORM_ID']) ? intval($params['CONTACT_FORM_ID']) : '';
     if ($contactFormID === '') {
         $contactFormID = CCrmContact::DEFAULT_FORM_ID;
     }
     $dups = array();
     $criterion = new \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion('PHONE', $number);
     $entityTypes = array(CCrmOwnerType::Contact, CCrmOwnerType::Company, CCrmOwnerType::Lead);
     foreach ($entityTypes as $entityType) {
         $duplicate = $criterion->find($entityType, 1);
         if ($duplicate !== null) {
             $dups[] = $duplicate;
         }
     }
     $entityByType = array();
     foreach ($dups as &$dup) {
         /** @var \Bitrix\Crm\Integrity\Duplicate $dup */
         $entities = $dup->getEntities();
         if (!(is_array($entities) && !empty($entities))) {
             continue;
         }
         //Each entity type limited by 50 items
         foreach ($entities as &$entity) {
             /** @var \Bitrix\Crm\Integrity\DuplicateEntity $entity */
             $entityTypeID = $entity->getEntityTypeID();
             $entityID = $entity->getEntityID();
             $fields = null;
             if ($entityTypeID === CCrmOwnerType::Contact) {
                 $dbEntity = CCrmContact::GetListEx(array(), array('=ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID', 'HONORIFIC', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'PHOTO', 'POST', 'COMPANY_ID', 'COMPANY_TITLE', 'ASSIGNED_BY_ID'));
                 $entityFields = is_object($dbEntity) ? $dbEntity->Fetch() : null;
                 if (is_array($entityFields)) {
                     $formattedName = CCrmContact::PrepareFormattedName(array('HONORIFIC' => isset($entityFields['HONORIFIC']) ? $entityFields['HONORIFIC'] : '', 'NAME' => isset($entityFields['NAME']) ? $entityFields['NAME'] : '', 'SECOND_NAME' => isset($entityFields['SECOND_NAME']) ? $entityFields['SECOND_NAME'] : '', 'LAST_NAME' => isset($entityFields['LAST_NAME']) ? $entityFields['LAST_NAME'] : ''));
                     $fields = array('ID' => intval($entityFields['ID']), 'FORMATTED_NAME' => $formattedName, 'PHOTO' => isset($entityFields['PHOTO']) ? intval($entityFields['PHOTO']) : 0, 'COMPANY_ID' => isset($entityFields['COMPANY_ID']) ? intval($entityFields['COMPANY_ID']) : 0, 'COMPANY_TITLE' => isset($entityFields['COMPANY_TITLE']) ? $entityFields['COMPANY_TITLE'] : '', 'POST' => isset($entityFields['POST']) ? $entityFields['POST'] : '', 'ASSIGNED_BY_ID' => isset($entityFields['ASSIGNED_BY_ID']) ? intval($entityFields['ASSIGNED_BY_ID']) : 0, 'CAN_READ' => CCrmContact::CheckReadPermission($entityID, $userPermissions));
                     if ($fields['CAN_READ'] && $enableExtendedMode) {
                         $deals = array();
                         $dbDeal = CCrmDeal::GetListEx(array('BEGINDATE' => 'ASC'), array('=CONTACT_ID' => $entityID, 'CLOSED' => 'N', 'CHECK_PERMISSIONS' => $isAdmin ? 'N' : 'Y'), false, array('nTopCount' => 2), array('ID', 'TITLE', 'STAGE_ID'), array('PERMS' => $userPermissions));
                         if (is_object($dbDeal)) {
                             while ($dealFields = $dbDeal->Fetch()) {
                                 $dealID = intval($dealFields['ID']);
                                 //$dealFields['CAN_READ'] = CCrmDeal::CheckReadPermission($dealID, $userPermissions);
                                 $dealFields['SHOW_URL'] = CCrmOwnerType::GetShowUrl(CCrmOwnerType::Deal, $dealID);
                                 $deals[] = $dealFields;
                             }
                         }
                         $fields['DEALS'] =& $deals;
                         unset($deals);
                     }
                 }
             } elseif ($entityTypeID === CCrmOwnerType::Company) {
                 $dbEntity = CCrmCompany::GetListEx(array(), array('=ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID', 'TITLE', 'LOGO', 'ASSIGNED_BY_ID'));
                 $entityFields = is_object($dbEntity) ? $dbEntity->Fetch() : null;
                 if (is_array($entityFields)) {
                     $fields = array('ID' => intval($entityFields['ID']), 'TITLE' => isset($entityFields['TITLE']) ? $entityFields['TITLE'] : '', 'LOGO' => isset($entityFields['LOGO']) ? intval($entityFields['LOGO']) : 0, 'ASSIGNED_BY_ID' => isset($entityFields['ASSIGNED_BY_ID']) ? intval($entityFields['ASSIGNED_BY_ID']) : 0, 'CAN_READ' => CCrmCompany::CheckReadPermission($entityID, $userPermissions));
                     if ($fields['CAN_READ'] && $enableExtendedMode) {
                         $deals = array();
                         $dbDeal = CCrmDeal::GetListEx(array('BEGINDATE' => 'ASC'), array('=COMPANY_ID' => $entityID, 'CLOSED' => 'N', 'CHECK_PERMISSIONS' => $isAdmin ? 'N' : 'Y'), false, array('nTopCount' => 2), array('ID', 'TITLE', 'STAGE_ID'), array('PERMS' => $userPermissions));
                         if (is_object($dbDeal)) {
                             while ($dealFields = $dbDeal->Fetch()) {
                                 $dealID = intval($dealFields['ID']);
                                 //$dealFields['CAN_READ'] = CCrmDeal::CheckReadPermission($dealID, $userPermissions);
                                 $dealFields['SHOW_URL'] = CCrmOwnerType::GetShowUrl(CCrmOwnerType::Deal, $dealID);
                                 $deals[] = $dealFields;
                             }
                         }
                         $fields['DEALS'] =& $deals;
                         unset($deals);
                     }
                 }
             } elseif ($entityTypeID === CCrmOwnerType::Lead) {
                 $dbEntity = CCrmLead::GetListEx(array(), array('=ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID', 'TITLE', 'HONORIFIC', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'POST', 'COMPANY_TITLE', 'ASSIGNED_BY_ID'));
                 $entityFields = is_object($dbEntity) ? $dbEntity->Fetch() : null;
                 if (is_array($entityFields)) {
                     $formattedName = '';
                     if (!empty($entityFields['NAME']) || !empty($entityFields['SECOND_NAME']) || !empty($entityFields['LAST_NAME'])) {
                         $formattedName = CCrmLead::PrepareFormattedName(array('HONORIFIC' => isset($entityFields['HONORIFIC']) ? $entityFields['HONORIFIC'] : '', 'NAME' => isset($entityFields['NAME']) ? $entityFields['NAME'] : '', 'SECOND_NAME' => isset($entityFields['SECOND_NAME']) ? $entityFields['SECOND_NAME'] : '', 'LAST_NAME' => isset($entityFields['LAST_NAME']) ? $entityFields['LAST_NAME'] : ''));
                     }
                     $fields = array('ID' => intval($entityFields['ID']), 'TITLE' => isset($entityFields['TITLE']) ? $entityFields['TITLE'] : '', 'FORMATTED_NAME' => $formattedName, 'COMPANY_TITLE' => isset($entityFields['COMPANY_TITLE']) ? $entityFields['COMPANY_TITLE'] : '', 'POST' => isset($entityFields['POST']) ? $entityFields['POST'] : '', 'ASSIGNED_BY_ID' => isset($entityFields['ASSIGNED_BY_ID']) ? intval($entityFields['ASSIGNED_BY_ID']) : 0, 'CAN_READ' => CCrmLead::CheckReadPermission($entityID, $userPermissions));
                 }
             }
             if (!is_array($fields)) {
                 continue;
             }
             if ($fields['CAN_READ'] && $enableExtendedMode) {
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:sip_helper.php

示例8: TryGetInfo

 public static function TryGetInfo($typeID, $ID, &$info, $bCheckPermissions = false)
 {
     $typeID = intval($typeID);
     $ID = intval($ID);
     if ($ID <= 0) {
         return array();
     }
     $result = null;
     switch ($typeID) {
         case self::Lead:
             $dbRes = CCrmLead::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => $bCheckPermissions ? 'Y' : 'N'), false, false, array('TITLE'));
             $arRes = $dbRes ? $dbRes->Fetch() : null;
             if (is_array($arRes)) {
                 $info = array('CAPTION' => isset($arRes['TITLE']) ? $arRes['TITLE'] : '', 'IMAGE_ID' => 0);
                 return true;
             }
             break;
         case self::Contact:
             $dbRes = CCrmContact::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => $bCheckPermissions ? 'Y' : 'N'), false, false, array('HONORIFIC', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'PHOTO'));
             $arRes = $dbRes ? $dbRes->Fetch() : null;
             if (is_array($arRes)) {
                 $info = array('CAPTION' => CCrmContact::PrepareFormattedName($arRes), 'IMAGE_ID' => isset($arRes['PHOTO']) ? intval($arRes['PHOTO']) : 0);
                 return true;
             }
             break;
         case self::Company:
             $dbRes = CCrmCompany::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => $bCheckPermissions ? 'Y' : 'N'), false, false, array('TITLE', 'LOGO'));
             $arRes = $dbRes ? $dbRes->Fetch() : null;
             if (is_array($arRes)) {
                 $info = array('CAPTION' => isset($arRes['TITLE']) ? $arRes['TITLE'] : '', 'IMAGE_ID' => isset($arRes['LOGO']) ? intval($arRes['LOGO']) : 0);
                 return true;
             }
             break;
         case self::Deal:
             $dbRes = CCrmDeal::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => $bCheckPermissions ? 'Y' : 'N'), false, false, array('TITLE'));
             $arRes = $dbRes ? $dbRes->Fetch() : null;
             if (is_array($arRes)) {
                 $info = array('CAPTION' => isset($arRes['TITLE']) ? $arRes['TITLE'] : '', 'IMAGE_ID' => 0);
                 return true;
             }
             break;
         case self::Invoice:
             $dbRes = CCrmInvoice::GetList(array(), array('ID' => $ID), false, false, array('ORDER_TOPIC'));
             $arRes = $dbRes ? $dbRes->Fetch() : null;
             if (is_array($arRes)) {
                 $info = array('CAPTION' => isset($arRes['ORDER_TOPIC']) ? $arRes['ORDER_TOPIC'] : '', 'IMAGE_ID' => 0);
                 return true;
             }
             break;
         case self::Quote:
             $dbRes = CCrmQuote::GetList(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => $bCheckPermissions ? 'Y' : 'N'), false, false, array('TITLE'));
             $arRes = $dbRes ? $dbRes->Fetch() : null;
             if (is_array($arRes)) {
                 $info = array('CAPTION' => isset($arRes['TITLE']) ? $arRes['TITLE'] : '', 'IMAGE_ID' => 0);
                 return true;
             }
             break;
     }
     return false;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:60,代码来源:crm_owner_type.php

示例9: array

    }
    if (isset($arCompanyIndustryList[$arRes['INDUSTRY']])) {
        $arDesc[] = $arCompanyIndustryList[$arRes['INDUSTRY']];
    }
    $arCompanies[] = array('title' => str_replace(array(';', ','), ' ', $arRes['TITLE']), 'desc' => implode(', ', $arDesc), 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_company_show'), array('company_id' => $arRes['ID'])), 'image' => isset($arFiles[$arRes['LOGO']]) ? $arFiles[$arRes['LOGO']] : '', 'type' => 'company', 'selected' => false);
}
//CrmContact
$obRes = CCrmContact::GetListEx(array('LAST_NAME' => 'ASC', 'NAME' => 'ASC'), array(), false, array('nTopCount' => 50), array('ID', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'COMPANY_TITLE', 'PHOTO'));
$arContacts = array();
while ($arRes = $obRes->Fetch()) {
    if (!empty($arRes['PHOTO']) && !isset($arFiles[$arRes['PHOTO']])) {
        if ($arFile = CFile::GetFileArray($arRes['PHOTO'])) {
            $arFiles[$arRes['PHOTO']] = CHTTP::URN2URI($arFile['SRC']);
        }
    }
    $arContacts[] = array('id' => $arRes['ID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_contact_show'), array('contact_id' => $arRes['ID'])), 'title' => str_replace(array(';', ','), ' ', CCrmContact::PrepareFormattedName($arRes)), 'desc' => empty($arRes['COMPANY_TITLE']) ? '' : $arRes['COMPANY_TITLE'], 'image' => isset($arFiles[$arRes['PHOTO']]) ? $arFiles[$arRes['PHOTO']] : '', 'type' => 'contact', 'selected' => false);
}
//CrmLead
$arLeads = array();
$obRes = CCrmLead::GetListEx(array('TITLE' => 'ASC'), array(), false, array('nTopCount' => 50), array('ID', 'TITLE', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'STATUS_ID'));
while ($arRes = $obRes->Fetch()) {
    $arLeads[] = array('id' => $arRes['ID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_lead_show'), array('lead_id' => $arRes['ID'])), 'title' => str_replace(array(';', ','), ' ', $arRes['TITLE']), 'desc' => CCrmLead::PrepareFormattedName($arRes), 'type' => 'lead', 'selected' => false);
}
//CrmDeal
$arDeals = array();
$obRes = CCrmDeal::GetListEx(array('TITLE' => 'ASC'), array(), false, array('nTopCount' => 50), array('ID', 'TITLE'));
while ($arRes = $obRes->Fetch()) {
    $arDeals[] = array('id' => $arRes['ID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_deal_show'), array('deal_id' => $arRes['ID'])), 'title' => str_replace(array(';', ','), ' ', $arRes['TITLE']), 'desc' => '', 'type' => 'deal', 'selected' => false);
}
?>
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:30,代码来源:template.php

示例10: MapField

 private function MapField(&$entityInfo, $fieldName)
 {
     $result = '';
     $typeID = isset($entityInfo['TYPE_ID']) ? intval($entityInfo['TYPE_ID']) : CCrmOwnerType::Undefined;
     $fields = isset($entityInfo['FIELDS']) ? $entityInfo['FIELDS'] : array();
     $isHtml = $this->contentType === CCrmContentType::Html;
     $isBBCode = $this->contentType === CCrmContentType::BBCode;
     $isPlainText = $this->contentType === CCrmContentType::PlainText;
     if ($typeID === CCrmOwnerType::Lead) {
         switch ($fieldName) {
             case 'ID':
                 $result = isset($fields[$fieldName]) ? intval($fields[$fieldName]) : 0;
                 break;
             case 'NAME':
             case 'SECOND_NAME':
             case 'LAST_NAME':
             case 'TITLE':
             case 'COMPANY_TITLE':
             case 'SOURCE_DESCRIPTION':
             case 'STATUS_DESCRIPTION':
             case 'POST':
             case 'ASSIGNED_BY_WORK_POSITION':
                 $result = self::MapFieldValue($fields, $fieldName, $isHtml);
                 break;
             case 'ADDRESS':
                 $addressOptions = array();
                 if ($isHtml) {
                     $addressOptions['SEPARATOR'] = AddressSeparator::HtmlLineBreak;
                     $addressOptions['NL2BR'] = true;
                 } else {
                     $addressOptions['SEPARATOR'] = AddressSeparator::NewLine;
                 }
                 $result = LeadAddressFormatter::format($fields, $addressOptions);
                 break;
             case 'COMMENTS':
                 if ($isBBCode) {
                     $result = self::MapHtmlFieldAsBbCode($fields, 'COMMENTS');
                 } elseif ($isPlainText) {
                     $result = self::MapHtmlFieldAsPlainText($fields, 'COMMENTS');
                 } else {
                     $result = self::MapFieldValue($fields, $fieldName, false);
                 }
                 break;
             case 'SOURCE':
                 $result = self::MapReferenceValue(self::PrepareSources(), $fields, 'SOURCE_ID', $isHtml);
                 break;
             case 'STATUS':
                 $result = self::MapReferenceValue(self::PrepareLeadStatuses(), $fields, 'STATUS_ID', $isHtml);
                 break;
             case 'FORMATTED_NAME':
                 $result = CCrmLead::PrepareFormattedName(array('HONORIFIC' => isset($fields['HONORIFIC']) ? $fields['HONORIFIC'] : '', 'NAME' => isset($fields['NAME']) ? $fields['NAME'] : '', 'SECOND_NAME' => isset($fields['SECOND_NAME']) ? $fields['SECOND_NAME'] : '', 'LAST_NAME' => isset($fields['LAST_NAME']) ? $fields['LAST_NAME'] : ''));
                 if ($isHtml) {
                     $result = htmlspecialcharsbx($result);
                 }
                 break;
             case 'ASSIGNED_BY_FULL_NAME':
                 $result = CCrmViewHelper::GetFormattedUserName(isset($fields['ASSIGNED_BY_ID']) ? $fields['ASSIGNED_BY_ID'] : 0, '', $isHtml);
                 break;
             case 'CREATED_BY_FULL_NAME':
                 $result = CCrmViewHelper::GetFormattedUserName(isset($fields['CREATED_BY_ID']) ? $fields['CREATED_BY_ID'] : 0, '', $isHtml);
                 break;
             case 'MODIFY_BY_FULL_NAME':
                 $result = CCrmViewHelper::GetFormattedUserName(isset($fields['MODIFY_BY_ID']) ? $fields['MODIFY_BY_ID'] : 0, '', $isHtml);
                 break;
             case 'DATE_CREATE':
                 $result = isset($fields['DATE_CREATE']) ? FormatDate('SHORT', MakeTimeStamp($fields['DATE_CREATE'])) : '';
                 break;
             case 'DATE_MODIFY':
                 $result = isset($fields['DATE_MODIFY']) ? FormatDate('SHORT', MakeTimeStamp($fields['DATE_MODIFY'])) : '';
                 break;
             case 'CURRENCY':
                 $result = isset($fields['CURRENCY_ID']) ? CCrmCurrency::GetCurrencyName($fields['CURRENCY_ID']) : '';
                 break;
             case 'OPPORTUNITY':
                 $result = isset($fields['OPPORTUNITY']) ? $fields['OPPORTUNITY'] : 0.0;
                 break;
             case 'OPPORTUNITY_FORMATTED':
                 $result = CCrmCurrency::MoneyToString(isset($fields['OPPORTUNITY']) ? $fields['OPPORTUNITY'] : 0.0, isset($fields['CURRENCY_ID']) ? $fields['CURRENCY_ID'] : '');
                 break;
         }
     } elseif ($typeID === CCrmOwnerType::Deal) {
         switch ($fieldName) {
             case 'ID':
                 $result = isset($fields[$fieldName]) ? intval($fields[$fieldName]) : 0;
                 break;
             case 'TITLE':
             case 'ASSIGNED_BY_WORK_POSITION':
                 $result = self::MapFieldValue($fields, $fieldName, $isHtml);
                 break;
             case 'COMMENTS':
                 if ($isBBCode) {
                     $result = self::MapHtmlFieldAsBbCode($fields, 'COMMENTS');
                 } elseif ($isPlainText) {
                     $result = self::MapHtmlFieldAsPlainText($fields, 'COMMENTS');
                 } else {
                     $result = self::MapFieldValue($fields, $fieldName, false);
                 }
                 break;
             case 'TYPE':
                 $result = self::MapReferenceValue(self::PrepareDealTypes(), $fields, 'TYPE_ID', $isHtml);
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:template_mapper.php

示例11: PrepareContactItem

 public static function PrepareContactItem(&$item, &$params, $enums = array())
 {
     $itemID = intval($item['~ID']);
     if (isset($params['CONTACT_SHOW_URL_TEMPLATE'])) {
         $item['SHOW_URL'] = CComponentEngine::MakePathFromTemplate($params['CONTACT_SHOW_URL_TEMPLATE'], array('contact_id' => $itemID));
     }
     if (isset($params['CONTACT_EDIT_URL_TEMPLATE'])) {
         $item['EDIT_URL'] = CComponentEngine::MakePathFromTemplate($params['CONTACT_EDIT_URL_TEMPLATE'], array('contact_id' => $itemID));
     }
     if (!isset($item['~HONORIFIC'])) {
         $item['~HONORIFIC'] = $item['HONORIFIC'] = '';
     }
     if (!isset($item['~NAME'])) {
         $item['~NAME'] = $item['NAME'] = '';
     }
     if (!isset($item['~LAST_NAME'])) {
         $item['~LAST_NAME'] = $item['LAST_NAME'] = '';
     }
     if (!isset($item['~SECOND_NAME'])) {
         $item['~SECOND_NAME'] = $item['SECOND_NAME'] = '';
     }
     $item['~FORMATTED_NAME'] = CCrmContact::PrepareFormattedName(array('HONORIFIC' => $item['~HONORIFIC'], 'NAME' => $item['~NAME'], 'LAST_NAME' => $item['~LAST_NAME'], 'SECOND_NAME' => $item['~SECOND_NAME']));
     $item['FORMATTED_NAME'] = htmlspecialcharsbx($item['~FORMATTED_NAME']);
     $lastName = $item['~LAST_NAME'];
     $item['CLASSIFIER'] = $lastName !== '' ? strtoupper(substr($lastName, 0, 1)) : '';
     if (!isset($item['~POST'])) {
         $item['~POST'] = $item['POST'] = '';
     }
     $companyID = isset($item['~COMPANY_ID']) ? intval($item['~COMPANY_ID']) : 0;
     $item['~COMPANY_ID'] = $item['COMPANY_ID'] = $companyID;
     if (!isset($item['~COMPANY_TITLE'])) {
         $item['~COMPANY_TITLE'] = $item['COMPANY_TITLE'] = '';
     }
     /*$item['COMPANY_SHOW_URL'] = $companyID > 0
     		? CComponentEngine::MakePathFromTemplate(
     			$params['COMPANY_SHOW_URL_TEMPLATE'], array('company_id' => $companyID)
     		) : '';*/
     $assignedByID = isset($item['~ASSIGNED_BY_ID']) ? intval($item['~ASSIGNED_BY_ID']) : 0;
     $item['~ASSIGNED_BY_ID'] = $item['ASSIGNED_BY_ID'] = $assignedByID;
     $item['ASSIGNED_BY_SHOW_URL'] = $assignedByID > 0 ? CComponentEngine::MakePathFromTemplate($params['USER_PROFILE_URL_TEMPLATE'], array('user_id' => $assignedByID)) : '';
     $item['~ASSIGNED_BY_FORMATTED_NAME'] = $assignedByID > 0 ? CUser::FormatName($params['NAME_TEMPLATE'], array('LOGIN' => isset($item['~ASSIGNED_BY_LOGIN']) ? $item['~ASSIGNED_BY_LOGIN'] : '', 'NAME' => isset($item['~ASSIGNED_BY_NAME']) ? $item['~ASSIGNED_BY_NAME'] : '', 'LAST_NAME' => isset($item['~ASSIGNED_BY_LAST_NAME']) ? $item['~ASSIGNED_BY_LAST_NAME'] : '', 'SECOND_NAME' => isset($item['~ASSIGNED_BY_SECOND_NAME']) ? $item['~ASSIGNED_BY_SECOND_NAME'] : ''), true, false) : '';
     $item['ASSIGNED_BY_FORMATTED_NAME'] = htmlspecialcharsbx($item['~ASSIGNED_BY_FORMATTED_NAME']);
     if (!isset($item['~POST'])) {
         $item['~POST'] = $item['POST'] = '';
     }
     if (!isset($item['~ADDRESS'])) {
         $item['~ADDRESS'] = $item['ADDRESS'] = '';
     }
     if (!isset($item['~ADDRESS_2'])) {
         $item['~ADDRESS_2'] = $item['ADDRESS_2'] = '';
     }
     if (!isset($item['~ADDRESS_CITY'])) {
         $item['~ADDRESS_CITY'] = $item['ADDRESS_CITY'] = '';
     }
     if (!isset($item['~ADDRESS_REGION'])) {
         $item['~ADDRESS_REGION'] = $item['ADDRESS_REGION'] = '';
     }
     if (!isset($item['~ADDRESS_PROVINCE'])) {
         $item['~ADDRESS_PROVINCE'] = $item['ADDRESS_PROVINCE'] = '';
     }
     if (!isset($item['~ADDRESS_POSTAL_CODE'])) {
         $item['~ADDRESS_POSTAL_CODE'] = $item['ADDRESS_POSTAL_CODE'] = '';
     }
     if (!isset($item['~ADDRESS_COUNTRY'])) {
         $item['~ADDRESS_COUNTRY'] = $item['ADDRESS_COUNTRY'] = '';
     }
     $item['FULL_ADDRESS'] = Bitrix\Crm\Format\ContactAddressFormatter::format(array('ADDRESS' => $item['~ADDRESS'], 'ADDRESS_2' => $item['~ADDRESS_2'], 'ADDRESS_CITY' => $item['~ADDRESS_CITY'], 'ADDRESS_REGION' => $item['~ADDRESS_REGION'], 'ADDRESS_PROVINCE' => $item['~ADDRESS_PROVINCE'], 'ADDRESS_POSTAL_CODE' => $item['~ADDRESS_POSTAL_CODE'], 'ADDRESS_COUNTRY' => $item['~ADDRESS_COUNTRY']), array('SEPARATOR' => Bitrix\Crm\Format\AddressSeparator::HtmlLineBreak));
     if (!isset($item['~COMMENTS'])) {
         $item['~COMMENTS'] = $item['COMMENTS'] = '';
     }
     if (!isset($item['~TYPE_ID'])) {
         $item['~TYPE_ID'] = $item['TYPE_ID'] = '';
     }
     $typeList = $enums && isset($enums['CONTACT_TYPE']) ? $enums['CONTACT_TYPE'] : null;
     if (is_array($typeList)) {
         $typeID = $item['~TYPE_ID'];
         $item['~TYPE_NAME'] = isset($typeList[$typeID]) ? $typeList[$typeID] : $typeID;
         $item['TYPE_NAME'] = htmlspecialcharsbx($item['~TYPE_NAME']);
     }
     if (!isset($item['~PHOTO'])) {
         $item['~PHOTO'] = $item['PHOTO'] = 0;
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:83,代码来源:mobile_helper.php

示例12: prepareRecoveryData

 public static function prepareRecoveryData($entityTypeID, $entityID, array $options = null)
 {
     if (!is_int($entityTypeID)) {
         $entityTypeID = intval($entityTypeID);
     }
     if (!\CCrmOwnerType::IsDefined($entityTypeID)) {
         throw new Main\ArgumentException('Is not defined', 'entityTypeID');
     }
     if (!is_int($entityID)) {
         $entityID = intval($entityID);
     }
     if ($entityID <= 0) {
         throw new Main\ArgumentException('Must be greater than zero', 'entityID');
     }
     if (!is_array($options)) {
         $options = array();
     }
     $item = new EntityRecoveryData();
     $item->setEntityTypeID($entityTypeID);
     $item->setEntityID($entityID);
     $userID = isset($options['USER_ID']) ? intval($options['USER_ID']) : 0;
     if ($userID > 0) {
         $item->setUserID($userID);
     }
     if ($entityTypeID === \CCrmOwnerType::Lead) {
         $result = \CCrmLead::GetListEx(array(), array('=ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('*', 'UF_*'));
         $fields = is_object($result) ? $result->Fetch() : null;
         if (!is_array($fields)) {
             throw new Main\ObjectNotFoundException("The lead with ID '{$entityTypeID}' is not found");
         }
         $item->setDataItem('FIELDS', $fields);
         if (isset($fields['TITLE'])) {
             $item->setTitle($fields['TITLE']);
         }
         if (isset($fields['ASSIGNED_BY_ID'])) {
             $item->setResponsibleID(intval($fields['ASSIGNED_BY_ID']));
         }
     } elseif ($entityTypeID === \CCrmOwnerType::Contact) {
         $result = \CCrmContact::GetListEx(array(), array('=ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('*', 'UF_*'));
         $fields = is_object($result) ? $result->Fetch() : null;
         if (!is_array($fields)) {
             throw new Main\ObjectNotFoundException("The contact with ID '{$entityTypeID}' is not found");
         }
         $item->setDataItem('FIELDS', $fields);
         $item->setTitle(\CCrmContact::PrepareFormattedName($fields));
         if (isset($fields['ASSIGNED_BY_ID'])) {
             $item->setResponsibleID(intval($fields['ASSIGNED_BY_ID']));
         }
     } elseif ($entityTypeID === \CCrmOwnerType::Company) {
         $result = \CCrmCompany::GetListEx(array(), array('=ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('*', 'UF_*'));
         $fields = is_object($result) ? $result->Fetch() : null;
         if (!is_array($fields)) {
             throw new Main\ObjectNotFoundException("The company with ID '{$entityTypeID}' is not found");
         }
         $item->setDataItem('FIELDS', $fields);
         if (isset($fields['TITLE'])) {
             $item->setTitle($fields['TITLE']);
         }
         if (isset($fields['ASSIGNED_BY_ID'])) {
             $item->setResponsibleID(intval($fields['ASSIGNED_BY_ID']));
         }
     } else {
         throw new Main\NotSupportedException("The entity type '" . \CCrmOwnerType::ResolveName($entityTypeID) . "' is not supported in current context");
     }
     $entityTypeName = \CCrmOwnerType::ResolveName($entityTypeID);
     //MULTI FIELDS -->
     $multiFieldData = array();
     $multiFieldTypes = array(\CCrmFieldMulti::PHONE, \CCrmFieldMulti::EMAIL, \CCrmFieldMulti::WEB, \CCrmFieldMulti::IM);
     foreach ($multiFieldTypes as $multiFieldType) {
         $result = \CCrmFieldMulti::GetListEx(array('ID' => 'ASC'), array('TYPE_ID' => $multiFieldType, 'ENTITY_ID' => $entityTypeName, 'ELEMENT_ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, array('nTopCount' => 50), array('VALUE_TYPE', 'VALUE'));
         if (!is_object($result)) {
             continue;
         }
         while ($multiFields = $result->Fetch()) {
             $valueType = isset($multiFields['VALUE_TYPE']) ? $multiFields['VALUE_TYPE'] : '';
             $value = isset($multiFields['VALUE']) ? $multiFields['VALUE'] : '';
             if ($value === '') {
                 continue;
             }
             if (!isset($multiFieldData[$multiFieldType])) {
                 $multiFieldData[$multiFieldType] = array();
             }
             $multiFieldData[$multiFieldType][] = array('VALUE_TYPE' => $valueType, 'VALUE' => $value);
         }
     }
     if (!empty($multiFieldData)) {
         $item->setDataItem('MULTI_FIELDS', $multiFieldData);
     }
     //<-- MULTI FIELDS
     //ACTIVITIES -->
     $activityIDs = \CCrmActivity::GetBoundIDs($entityTypeID, $entityID);
     if (!empty($activityIDs)) {
         $item->setDataItem('ACTIVITY_IDS', $activityIDs);
     }
     //<-- ACTIVITIES
     //EVENTS -->
     $eventIDs = array();
     $result = \CCrmEvent::GetListEx(array('EVENT_REL_ID' => 'ASC'), array('ENTITY_TYPE' => $entityTypeName, 'ENTITY_ID' => $entityID, 'EVENT_TYPE' => 0, 'CHECK_PERMISSIONS' => 'N'), false, false, array('EVENT_REL_ID'));
     if (is_object($result)) {
         while ($eventFields = $result->Fetch()) {
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:entityrecoverymanager.php

示例13: ListAddEnumFieldsValue


//.........这里部分代码省略.........
                         $arList[$KEY]['CONTACT'][$arRes['ID']] = $arRes;
                     }
                 }
                 if (isset($VALUE['COMPANY']) && !empty($VALUE['COMPANY'])) {
                     $dbRes = CCrmCompany::GetListEx(array('TITLE' => 'ASC'), array('ID' => $VALUE['COMPANY']));
                     while ($arRes = $dbRes->Fetch()) {
                         $arList[$KEY]['COMPANY'][$arRes['ID']] = $arRes;
                     }
                 }
                 if (isset($VALUE['DEAL']) && !empty($VALUE['DEAL'])) {
                     $dbRes = CCrmDeal::GetListEx(array('TITLE' => 'ASC'), array('ID' => $VALUE['DEAL']));
                     while ($arRes = $dbRes->Fetch()) {
                         $arList[$KEY]['DEAL'][$arRes['ID']] = $arRes;
                     }
                 }
             }
             // assemble multi data
             foreach ($VALUE['FIELD'] as $ID => $arFIELD_NAME) {
                 foreach ($arFIELD_NAME as $FIELD_NAME => $FIELD_VALUE) {
                     foreach ($FIELD_VALUE as $FIELD_VALUE_NAME => $FIELD_VALUE_ID) {
                         if ($KEY == 'iblock_section') {
                             $sname = htmlspecialcharsbx($arList[$KEY][$FIELD_VALUE_ID]['NAME']);
                             $arReplaceValue[$ID][$FIELD_NAME] .= (!empty($arReplaceValue[$ID][$FIELD_NAME]) ? $delimiter : '') . $sname;
                         }
                         if ($KEY == 'iblock_element') {
                             $sname = htmlspecialcharsbx($arList[$KEY][$FIELD_VALUE_ID]['NAME']);
                             if (!$textonly) {
                                 $surl = GetIBlockElementLinkById($arList[$KEY][$FIELD_VALUE_ID]['ID']);
                                 if ($surl && strlen($surl) > 0) {
                                     $sname = '<a href="' . $surl . '">' . $sname . '</a>';
                                 }
                             }
                             $arReplaceValue[$ID][$FIELD_NAME] .= (!empty($arReplaceValue[$ID][$FIELD_NAME]) ? $delimiter : '') . $sname;
                         } else {
                             if ($KEY == 'employee') {
                                 $sname = CUser::FormatName(CSite::GetNameFormat(false), $arList[$KEY][$FIELD_VALUE_ID], false, true);
                                 if (!$textonly) {
                                     $ar['PATH_TO_USER_PROFILE'] = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_user_profile'), array('user_id' => $arList[$KEY][$FIELD_VALUE_ID]['ID']));
                                     $sname = '<a href="' . $ar['PATH_TO_USER_PROFILE'] . '" id="balloon_' . $arParams['GRID_ID'] . '_' . $arList[$KEY][$FIELD_VALUE_ID]['ID'] . '">' . $sname . '</a>' . '<script type="text/javascript">BX.tooltip(' . $arList[$KEY][$FIELD_VALUE_ID]['ID'] . ', "balloon_' . $arParams['GRID_ID'] . '_' . $arList[$KEY][$FIELD_VALUE_ID]['ID'] . '", "");</script>';
                                 }
                                 $arReplaceValue[$ID][$FIELD_NAME] .= (!empty($arReplaceValue[$ID][$FIELD_NAME]) ? $delimiter : '') . $sname;
                             } else {
                                 if ($KEY == 'enumeration') {
                                     $arReplaceValue[$ID][$FIELD_NAME] .= (!empty($arReplaceValue[$ID][$FIELD_NAME]) ? $delimiter : '') . htmlspecialcharsbx($arList[$KEY][$FIELD_VALUE_ID]['VALUE']);
                                 } else {
                                     if ($KEY == 'file') {
                                         $fileInfo = $arList[$KEY][$FIELD_VALUE_ID];
                                         if ($textonly) {
                                             $fileUrl = CFile::GetFileSRC($fileInfo);
                                         } else {
                                             $fileUrlTemplate = isset($arOptions['FILE_URL_TEMPLATE']) ? $arOptions['FILE_URL_TEMPLATE'] : '';
                                             $fileUrl = $fileUrlTemplate === '' ? CFile::GetFileSRC($fileInfo) : CComponentEngine::MakePathFromTemplate($fileUrlTemplate, array('owner_id' => $ID, 'field_name' => $FIELD_NAME, 'file_id' => $fileInfo['ID']));
                                         }
                                         $sname = $textonly ? $fileUrl : '<a href="' . htmlspecialcharsbx($fileUrl) . '" target="_blank">' . htmlspecialcharsbx($arList[$KEY][$FIELD_VALUE_ID]['FILE_NAME']) . '</a>';
                                         $arReplaceValue[$ID][$FIELD_NAME] .= (!empty($arReplaceValue[$ID][$FIELD_NAME]) ? $delimiter : '') . $sname;
                                     } else {
                                         if ($KEY == 'crm') {
                                             foreach ($FIELD_VALUE_ID as $CID) {
                                                 $link = '';
                                                 $title = '';
                                                 $prefix = '';
                                                 if ($FIELD_VALUE_NAME == 'LEAD') {
                                                     $link = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_lead_show'), array('lead_id' => $CID));
                                                     $title = $arList[$KEY]['LEAD'][$CID]['TITLE'];
                                                     $prefix = 'L';
                                                 } elseif ($FIELD_VALUE_NAME == 'CONTACT') {
                                                     $link = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_contact_show'), array('contact_id' => $CID));
                                                     if (isset($arList[$KEY]['CONTACT'][$CID])) {
                                                         $title = CCrmContact::PrepareFormattedName($arList[$KEY]['CONTACT'][$CID]);
                                                     }
                                                     $prefix = 'C';
                                                 } elseif ($FIELD_VALUE_NAME == 'COMPANY') {
                                                     $link = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_company_show'), array('company_id' => $CID));
                                                     $title = $arList[$KEY]['COMPANY'][$CID]['TITLE'];
                                                     $prefix = 'CO';
                                                 } elseif ($FIELD_VALUE_NAME == 'DEAL') {
                                                     $link = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_deal_show'), array('deal_id' => $CID));
                                                     $title = $arList[$KEY]['DEAL'][$CID]['TITLE'];
                                                     $prefix = 'D';
                                                 }
                                                 $sname = htmlspecialcharsbx($title);
                                                 if (!$textonly) {
                                                     $tooltip = '<script type="text/javascript">BX.tooltip(' . $CID . ', "balloon_' . $ID . '_' . $FIELD_NAME . '_' . $FIELD_VALUE_NAME . '_' . $CID . '", "/bitrix/components/bitrix/crm.' . strtolower($FIELD_VALUE_NAME) . '.show/card.ajax.php", "crm_balloon' . ($FIELD_VALUE_NAME == 'LEAD' || $FIELD_VALUE_NAME == 'DEAL' || $FIELD_VALUE_NAME == 'QUOTE' ? '_no_photo' : '_' . strtolower($FIELD_VALUE_NAME)) . '", true);</script>';
                                                     $sname = '<a href="' . $link . '" target="_blank" id="balloon_' . $ID . '_' . $FIELD_NAME . '_' . $FIELD_VALUE_NAME . '_' . $CID . '">' . $sname . '</a>' . $tooltip;
                                                 } else {
                                                     $sname = "[{$prefix}]{$sname}";
                                                 }
                                                 $arReplaceValue[$ID][$FIELD_NAME] .= (!empty($arReplaceValue[$ID][$FIELD_NAME]) ? $delimiter : '') . $sname;
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:crm_usertype.php

示例14: array

$arResult['PATH_TO_COMPANY_SHOW'] = $arResult['ELEMENT']['UF_COMPANY_SHOW_URL'] = $companyID > 0 ? CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_COMPANY_SHOW'], array('company_id' => $companyID)) : '';
if ($companyID > 0) {
    $dbResult = CCrmCompany::GetListEx(array(), array('=ID' => $companyID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID', 'TITLE', 'LOGO'));
    $entityInfo = $dbResult ? $dbResult->Fetch() : null;
    if (is_array($entityInfo)) {
        $arResult['ELEMENT']['UF_COMPANY_TITLE'] = isset($entityInfo['TITLE']) ? $entityInfo['TITLE'] : '';
        $arResult['ELEMENT']['UF_COMPANY_LOGO'] = isset($entityInfo['LOGO']) ? $entityInfo['LOGO'] : 0;
    }
}
$contactID = isset($arResult['ELEMENT']['UF_CONTACT_ID']) ? $arResult['ELEMENT']['UF_CONTACT_ID'] : 0;
$arResult['PATH_TO_CONTACT_SHOW'] = $arResult['ELEMENT']['UF_CONTACT_SHOW_URL'] = $contactID > 0 ? CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_SHOW'], array('contact_id' => $contactID)) : '';
if ($contactID > 0) {
    $dbResult = CCrmContact::GetListEx(array(), array('=ID' => $contactID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'POST', 'PHOTO'));
    $entityInfo = $dbResult ? $dbResult->Fetch() : null;
    if (is_array($entityInfo)) {
        $arResult['ELEMENT']['UF_CONTACT_FORMATTED_NAME'] = CCrmContact::PrepareFormattedName($entityInfo);
        $arResult['ELEMENT']['UF_CONTACT_PHOTO'] = isset($entityInfo['PHOTO']) ? $entityInfo['PHOTO'] : 0;
        $arResult['ELEMENT']['UF_CONTACT_POST'] = isset($entityInfo['POST']) ? $entityInfo['POST'] : '';
    }
}
$personTypeID = 0;
// payer information
if ($companyID > 0 || $contactID > 0) {
    // Determine person type
    $arPersonTypes = CCrmPaySystem::getPersonTypeIDs();
    if (isset($arPersonTypes['COMPANY']) && isset($arPersonTypes['CONTACT'])) {
        if ($companyID > 0) {
            $personTypeID = $arPersonTypes['COMPANY'];
        } elseif ($contactID > 0) {
            $personTypeID = $arPersonTypes['CONTACT'];
        }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例15: PreparePopupItems

 public static function PreparePopupItems($entityTypeNames, $addPrefix = true, $nameFormat = '', $count = 50)
 {
     if (!is_array($entityTypeNames)) {
         $entityTypeNames = array(strval($entityTypeNames));
     }
     $addPrefix = (bool) $addPrefix;
     $count = intval($count);
     if ($count <= 0) {
         $count = 50;
     }
     $arItems = array();
     $i = 0;
     foreach ($entityTypeNames as $typeName) {
         $typeName = strtoupper(strval($typeName));
         if ($typeName === 'CONTACT') {
             $contactTypes = CCrmStatus::GetStatusList('CONTACT_TYPE');
             $contactIndex = array();
             $obRes = CCrmContact::GetListEx(array('ID' => 'DESC'), array(), false, array('nTopCount' => $count), array('ID', 'HONORIFIC', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'COMPANY_TITLE', 'PHOTO', 'TYPE_ID'));
             while ($arRes = $obRes->Fetch()) {
                 $arImg = array();
                 if (!empty($arRes['PHOTO']) && !isset($arFiles[$arRes['PHOTO']])) {
                     if (intval($arRes['PHOTO']) > 0) {
                         $arImg = CFile::ResizeImageGet($arRes['PHOTO'], array('width' => 25, 'height' => 25), BX_RESIZE_IMAGE_EXACT);
                     }
                 }
                 $arRes['SID'] = $addPrefix ? 'C_' . $arRes['ID'] : $arRes['ID'];
                 // advanced info
                 $advancedInfo = array();
                 if (isset($arRes['TYPE_ID']) && $arRes['TYPE_ID'] != '' && isset($contactTypes[$arRes['TYPE_ID']])) {
                     $advancedInfo['contactType'] = array('id' => $arRes['TYPE_ID'], 'name' => $contactTypes[$arRes['TYPE_ID']]);
                 }
                 $arItems[$i] = array('title' => CCrmContact::PrepareFormattedName(array('HONORIFIC' => isset($arRes['HONORIFIC']) ? $arRes['HONORIFIC'] : '', 'NAME' => isset($arRes['NAME']) ? $arRes['NAME'] : '', 'SECOND_NAME' => isset($arRes['SECOND_NAME']) ? $arRes['SECOND_NAME'] : '', 'LAST_NAME' => isset($arRes['LAST_NAME']) ? $arRes['LAST_NAME'] : ''), $nameFormat), 'desc' => empty($arRes['COMPANY_TITLE']) ? "" : $arRes['COMPANY_TITLE'], 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_contact_show'), array('contact_id' => $arRes['ID'])), 'image' => $arImg['src'], 'type' => 'contact', 'selected' => 'N');
                 if (!empty($advancedInfo)) {
                     $arItems[$i]['advancedInfo'] = $advancedInfo;
                 }
                 unset($advancedInfo);
                 $contactIndex[$arRes['ID']] =& $arItems[$i];
                 $i++;
             }
             // advanced info - phone number, e-mail
             $obRes = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'CONTACT', 'ELEMENT_ID' => array_keys($contactIndex)));
             while ($arRes = $obRes->Fetch()) {
                 if (isset($contactIndex[$arRes['ELEMENT_ID']]) && ($arRes['TYPE_ID'] === 'PHONE' || $arRes['TYPE_ID'] === 'EMAIL')) {
                     $item =& $contactIndex[$arRes['ELEMENT_ID']];
                     if (!is_array($item['advancedInfo'])) {
                         $item['advancedInfo'] = array();
                     }
                     if (!is_array($item['advancedInfo']['multiFields'])) {
                         $item['advancedInfo']['multiFields'] = array();
                     }
                     $item['advancedInfo']['multiFields'][] = array('ID' => $arRes['ID'], 'TYPE_ID' => $arRes['TYPE_ID'], 'VALUE_TYPE' => $arRes['VALUE_TYPE'], 'VALUE' => $arRes['VALUE']);
                     unset($item);
                 }
             }
             unset($contactIndex);
         } elseif ($typeName === 'COMPANY') {
             $companyIndex = array();
             $arCompanyTypeList = CCrmStatus::GetStatusListEx('COMPANY_TYPE');
             $arCompanyIndustryList = CCrmStatus::GetStatusListEx('INDUSTRY');
             $obRes = CCrmCompany::GetListEx(array('ID' => 'DESC'), array(), false, array('nTopCount' => $count), array('ID', 'TITLE', 'COMPANY_TYPE', 'INDUSTRY', 'LOGO'));
             $arFiles = array();
             while ($arRes = $obRes->Fetch()) {
                 $arImg = array();
                 if (!empty($arRes['LOGO']) && !isset($arFiles[$arRes['LOGO']])) {
                     if (intval($arRes['LOGO']) > 0) {
                         $arImg = CFile::ResizeImageGet($arRes['LOGO'], array('width' => 25, 'height' => 25), BX_RESIZE_IMAGE_EXACT);
                     }
                     $arFiles[$arRes['LOGO']] = $arImg['src'];
                 }
                 $arRes['SID'] = $addPrefix ? 'CO_' . $arRes['ID'] : $arRes['ID'];
                 $arDesc = array();
                 if (isset($arCompanyTypeList[$arRes['COMPANY_TYPE']])) {
                     $arDesc[] = $arCompanyTypeList[$arRes['COMPANY_TYPE']];
                 }
                 if (isset($arCompanyIndustryList[$arRes['INDUSTRY']])) {
                     $arDesc[] = $arCompanyIndustryList[$arRes['INDUSTRY']];
                 }
                 $arItems[$i] = array('title' => str_replace(array(';', ','), ' ', $arRes['TITLE']), 'desc' => implode(', ', $arDesc), 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_company_show'), array('company_id' => $arRes['ID'])), 'image' => $arImg['src'], 'type' => 'company', 'selected' => 'N');
                 $companyIndex[$arRes['ID']] =& $arItems[$i];
                 $i++;
             }
             // advanced info - phone number, e-mail
             $obRes = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'COMPANY', 'ELEMENT_ID' => array_keys($companyIndex)));
             while ($arRes = $obRes->Fetch()) {
                 if (isset($companyIndex[$arRes['ELEMENT_ID']]) && ($arRes['TYPE_ID'] === 'PHONE' || $arRes['TYPE_ID'] === 'EMAIL')) {
                     $item =& $companyIndex[$arRes['ELEMENT_ID']];
                     if (!is_array($item['advancedInfo'])) {
                         $item['advancedInfo'] = array();
                     }
                     if (!is_array($item['advancedInfo']['multiFields'])) {
                         $item['advancedInfo']['multiFields'] = array();
                     }
                     $item['advancedInfo']['multiFields'][] = array('ID' => $arRes['ID'], 'TYPE_ID' => $arRes['TYPE_ID'], 'VALUE_TYPE' => $arRes['VALUE_TYPE'], 'VALUE' => $arRes['VALUE']);
                     unset($item);
                 }
             }
             unset($companyIndex);
         } elseif ($typeName === 'LEAD') {
             $leadIndex = array();
             $obRes = CCrmLead::GetListEx(array('ID' => 'DESC'), array(), false, array('nTopCount' => $count), array('ID', 'TITLE', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'STATUS_ID'));
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:crm_entity_selector_helper.php


注:本文中的CCrmContact::PrepareFormattedName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。