Beispiel #1
0
$arResult['FIELDS']['tab_1'][] = array('id' => 'OPENED', 'name' => GetMessage('CRM_FIELD_OPENED'), 'type' => 'label', 'params' => array(), 'value' => $arResult['ELEMENT']['OPENED'] == 'Y' ? GetMessage('MAIN_YES') : GetMessage('MAIN_NO'), 'isTactile' => true);
// <-- OPENED
$arResult['FIELDS']['tab_1'][] = array('id' => 'section_contact_info', 'name' => GetMessage('CRM_SECTION_CONTACT_INFO'), 'type' => 'section', 'isTactile' => true);
// EMAIL -->
$arMutliFieldTypeInfos = CCrmFieldMulti::GetEntityTypes();
$prefix = strtolower($arResult['FORM_ID']);
$arResult['FIELDS']['tab_1'][] = array('id' => 'EMAIL', 'name' => GetMessage('CRM_FIELD_EMAIL'), 'type' => 'custom', 'colspan' => true, 'value' => CCrmViewHelper::PrepareFormMultiField($arResult['ELEMENT'], 'EMAIL', $prefix, $arMutliFieldTypeInfos), 'isTactile' => true);
//<-- EMAIL
// PHONE -->
$arResult['FIELDS']['tab_1'][] = array('id' => 'PHONE', 'name' => GetMessage('CRM_FIELD_PHONE'), 'type' => 'custom', 'colspan' => true, 'value' => CCrmViewHelper::PrepareFormMultiField($arResult['ELEMENT'], 'PHONE', $prefix, $arMutliFieldTypeInfos, array('ENABLE_SIP' => true, 'SIP_PARAMS' => array('ENTITY_TYPE' => 'CRM_' . CCrmOwnerType::CompanyName, 'ENTITY_ID' => $arResult['ELEMENT_ID']))), 'isTactile' => true);
//<-- PHONE
// WEB -->
$arResult['FIELDS']['tab_1'][] = array('id' => 'WEB', 'name' => GetMessage('CRM_FIELD_WEB'), 'type' => 'custom', 'colspan' => true, 'value' => CCrmViewHelper::PrepareFormMultiField($arResult['ELEMENT'], 'WEB', $prefix, $arMutliFieldTypeInfos), 'isTactile' => true);
// <-- WEB
// IM -->
$arResult['FIELDS']['tab_1'][] = array('id' => 'IM', 'name' => GetMessage('CRM_FIELD_MESSENGER'), 'type' => 'custom', 'colspan' => true, 'value' => CCrmViewHelper::PrepareFormMultiField($arResult['ELEMENT'], 'IM', $prefix, $arMutliFieldTypeInfos), 'isTactile' => true);
// <-- IM
// ADDRESS -->
$arResult['FIELDS']['tab_1'][] = array('id' => 'ADDRESS', 'name' => GetMessage('CRM_FIELD_ADDRESS'), 'type' => 'custom', 'value' => CompanyAddressFormatter::format($arResult['ELEMENT'], array('SEPARATOR' => AddressSeparator::HtmlLineBreak, 'TYPE_ID' => EntityAddress::Primary, 'NL2BR' => true)), 'isTactile' => true);
//<-- ADDRESS
// ADDRESS_LEGAL -->
$arResult['FIELDS']['tab_1'][] = array('id' => 'ADDRESS_LEGAL', 'name' => GetMessage('CRM_FIELD_ADDRESS_LEGAL'), 'type' => 'custom', 'value' => CompanyAddressFormatter::format($arResult['ELEMENT'], array('SEPARATOR' => AddressSeparator::HtmlLineBreak, 'TYPE_ID' => EntityAddress::Registered, 'NL2BR' => true)), 'isTactile' => true);
//<-- ADDRESS_LEGAL
// BANKING_DETAILS -->
$arResult['FIELDS']['tab_1'][] = array('id' => 'BANKING_DETAILS', 'name' => GetMessage('CRM_FIELD_BANKING_DETAILS'), 'type' => 'custom', 'value' => isset($arResult['ELEMENT']['BANKING_DETAILS']) ? nl2br($arResult['ELEMENT']['BANKING_DETAILS']) : '', 'isTactile' => true);
//<-- BANKING_DETAILS
$arResult['FIELDS']['tab_1'][] = array('id' => 'section_additional', 'name' => GetMessage('CRM_SECTION_ADDITIONAL'), 'type' => 'section');
// CREATED_BY_ID -->
// CREATED_BY_ID is displayed in sidebar. The field is added for COMPATIBILITY ONLY
ob_start();
$APPLICATION->IncludeComponent('bitrix:main.user.link', '', array('ID' => $arResult['ELEMENT']['CREATED_BY'], 'HTML_ID' => 'crm_created_by', 'USE_THUMBNAIL_LIST' => 'Y', 'SHOW_YEAR' => 'M', 'CACHE_TYPE' => 'A', 'CACHE_TIME' => '3600', 'NAME_TEMPLATE' => $arParams['NAME_TEMPLATE'], 'SHOW_LOGIN' => 'Y'), false, array('HIDE_ICONS' => 'Y', 'ACTIVE_COMPONENT' => 'Y'));
Beispiel #2
0
 function __CrmQuickPanelViewRenderSection($sectionID, &$config, &$entityData, &$entityFields, &$entityContext, $panelID)
 {
     if (!isset($config[$sectionID])) {
         return;
     }
     $sectionConfig = $config[$sectionID];
     $sectionConfig = $sectionConfig !== '' ? explode(',', $sectionConfig) : array();
     foreach ($sectionConfig as $fieldID) {
         $fieldID = trim($fieldID);
         if (!isset($entityData[$fieldID])) {
             continue;
         }
         $fieldData = $entityData[$fieldID];
         $type = isset($fieldData['type']) ? $fieldData['type'] : '';
         $data = isset($fieldData['data']) ? $fieldData['data'] : array();
         $enableCaption = isset($fieldData['enableCaption']) ? $fieldData['enableCaption'] : true;
         $editable = $enableEditButton = isset($fieldData['editable']) ? $fieldData['editable'] : false;
         $visible = isset($fieldData['visible']) ? $fieldData['visible'] : true;
         $containerID = $panelID . '_' . $sectionID . '_' . strtolower($fieldID);
         echo '<tr id="', htmlspecialcharsbx($containerID), '"', $visible ? '' : ' style="display:none;"', '>';
         echo '<td class="crm-lead-header-inner-cell crm-lead-header-inner-cell-move"><div class="crm-lead-header-inner-move-btn"></div></td>';
         if ($enableCaption) {
             echo '<td class="crm-lead-header-inner-cell crm-lead-header-inner-cell-title">';
             echo isset($fieldData['caption']) ? htmlspecialcharsbx($fieldData['caption']) : $fieldID;
             echo '</td>';
             if ($sectionID !== 'bottom') {
                 echo '<td class="crm-lead-header-inner-cell">';
             } else {
                 echo '<td class="crm-lead-header-inner-cell crm-lead-header-com-cell">';
             }
         } else {
             if ($sectionID !== 'bottom') {
                 echo '<td class="crm-lead-header-inner-cell crm-lead-header-inf-block" colspan="2">';
             } else {
                 echo '<td class="crm-lead-header-inner-cell crm-lead-header-com-cell crm-lead-header-inf-block" colspan="2">';
             }
         }
         if ($type === 'datetime') {
             echo '<div class="crm-lead-header-date-wrapper">';
             echo '<div class="crm-lead-header-date-view-wrapper">', isset($data['text']) ? htmlspecialcharsbx($data['text']) : '', '</div>';
             echo '<div class="crm-lead-header-date-edit-wrapper" style="display: none;"></div>';
             echo '</div>';
         } elseif ($type === 'boolean') {
             if (isset($data['baseType']) && $data['baseType'] === 'char') {
                 $checked = isset($data['value']) && strtoupper($data['value']) === 'Y';
             } else {
                 $checked = isset($data['value']) && $data['value'] > 0;
             }
             echo '<div class="crm-lead-header-boolean-wrapper">';
             echo '<div class="crm-lead-header-boolean-view-wrapper">', GetMessage($checked ? 'MAIN_YES' : 'MAIN_NO'), '</div>';
             echo '<div class="crm-lead-header-boolean-edit-wrapper" style="display: none;"></div>';
             echo '</div>';
         } elseif ($type === 'enumeration') {
             echo '<div class="crm-lead-header-enumeration-wrapper">';
             echo '<div class="crm-lead-header-enumeration-view-wrapper">', $data['text'] !== '' ? htmlspecialcharsbx($data['text']) : GetMessage('CRM_ENTITY_QPV_CONTROL_NOT_SELECTED'), '</div>';
             echo '<div class="crm-lead-header-enumeration-edit-wrapper" style="display: none;"></div>';
             echo '</div>';
         } elseif ($type === 'link') {
             echo '<div class="crm-lead-header-link-wrapper">';
             $text = isset($data['text']) ? htmlspecialcharsbx($data['text']) : '';
             $url = isset($data['url']) ? htmlspecialcharsbx($data['url']) : '';
             echo '<a class="crm-link" target="_blank" href="', $url, '">', $text, '</a>';
             echo '</div>';
         } elseif ($type === 'multiField') {
             $typeName = isset($data['type']) ? $data['type'] : array();
             $options = isset($entityContext['MULTI_FIELDS_OPTIONS']) ? $entityContext['MULTI_FIELDS_OPTIONS'] : array();
             $options['TOPMOST'] = true;
             echo CCrmViewHelper::PrepareFormMultiField($entityFields, $typeName, strtolower($panelID) . '_' . uniqid(), null, $options);
         } elseif ($type === 'address') {
             $lines = isset($data['lines']) ? $data['lines'] : array();
             $lineQty = count($lines);
             if ($lineQty > 0) {
                 if ($sectionID === 'bottom') {
                     echo '<div class="crm-lead-header-lhe-wrapper">';
                     echo '<div class="crm-lead-header-lhe-view-wrapper">';
                     echo implode(', ', $lines);
                     echo '</div>';
                     echo '</div>';
                 } else {
                     $className = $lineQty > 1 ? "crm-detail-info-item-text crm-detail-info-item-list" : "crm-detail-info-item-text";
                     echo '<span class="', $className, '">';
                     echo $lines[0];
                     if ($lineQty > 1) {
                         echo '<span class="crm-item-tel-list"></span>';
                     }
                     echo '</span>';
                 }
             }
         } elseif ($type === 'responsible') {
             if ($enableEditButton) {
                 $enableEditButton = false;
             }
             $guid = strtolower($panelID) . '_' . strtolower($data['fieldID']) . '_' . uniqid();
             CCrmViewHelper::RenderResponsiblePanel(array('FIELD_ID' => $data['fieldID'], 'USER_ID' => $data['userID'], 'NAME' => $data['name'], 'PHOTO' => $data['photoID'], 'PHOTO_URL' => $data['photoUrl'], 'WORK_POSITION' => $data['position'], 'USER_PROFILE_URL_TEMPLATE' => $data['profileUrlTemplate'], 'PREFIX' => $guid, 'EDITABLE' => $editable, 'INSTANT_EDITOR_ID' => $data['editorID'], 'SERVICE_URL' => $data['serviceUrl'], 'USER_INFO_PROVIDER_ID' => $data['userInfoProviderId'], 'ENABLE_LAZY_LOAD' => true, 'USER_SELECTOR_NAME' => $guid));
         } elseif ($type === 'client') {
             $entityTypeName = isset($data['ENTITY_TYPE_NAME']) ? $data['ENTITY_TYPE_NAME'] : '';
             $key = $entityTypeName === CCrmOwnerType::CompanyName ? 'COMPANY_INFO' : 'CONTACT_INFO';
             $entityInfo = isset($entityContext[$key]) ? $entityContext[$key] : null;
             if (is_array($entityInfo)) {
                 $data['PREFIX'] = strtolower($panelID) . '_' . strtolower($fieldID) . '_' . uniqid();
                 if (isset($entityInfo['FM'])) {
                     $data['FM'] = $entityInfo['FM'];
                 }
                 //if(isset($fieldData['caption']))
                 //{
                 //	$data['TITLE'] = $fieldData['caption'];
                 //}
                 $options = isset($entityInfo['MULTI_FIELDS_OPTIONS']) ? $entityInfo['MULTI_FIELDS_OPTIONS'] : array();
                 $options['TOPMOST'] = true;
                 CCrmViewHelper::RenderClientSummaryPanel($data, $options);
             }
         } elseif ($type === 'html') {
             echo '<div class="crm-lead-header-lhe-wrapper">';
             echo '<div class="crm-lead-header-lhe-view-wrapper">', isset($data['html']) ? $data['html'] : '', '</div>';
             echo '<div class="crm-lead-header-lhe-edit-wrapper" style="display: none;"></div>';
             echo '</div>';
         } elseif ($type === 'custom') {
             echo '<div class="crm-lead-header-custom-wrapper">';
             if (isset($data['html'])) {
                 echo $data['html'];
             }
             echo '</div>';
         } elseif ($type === 'text') {
             $html = isset($data['text']) ? htmlspecialcharsbx($data['text']) : '';
             if (isset($data['multiline']) && $data['multiline']) {
                 $html = preg_replace('/(\\n)/', '<br/>', $html);
             }
             echo '<div class="crm-lead-header-text-wrapper">';
             echo '<div class="crm-lead-header-text-view-wrapper">', $html, '</div>';
             echo '<div class="crm-lead-header-text-edit-wrapper" style="display: none;"></div>';
             echo '</div>';
         } else {
             echo '<div class="crm-lead-header-text-wrapper">';
             echo '<div class="crm-lead-header-text-view-wrapper">', isset($data['text']) ? htmlspecialcharsbx($data['text']) : '', '</div>';
             echo '<div class="crm-lead-header-text-edit-wrapper" style="display: none;"></div>';
             echo '</div>';
         }
         echo '</td>';
         echo '<td class="crm-lead-header-inner-cell crm-lead-header-inner-cell-del">';
         //echo '<div class="crm-lead-header-inner-del-btn"></div>';
         if ($enableEditButton) {
             echo '<div class="crm-lead-header-inner-edit-btn"></div>';
         }
         echo '</td>';
         echo '</tr>';
     }
 }