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>'; } }