function __CrmEntitySummaryRenderHorSectionItem(&$item) { $type = isset($item['TYPE']) ? strtoupper($item['TYPE']) : ''; $title = isset($item['TITLE']) ? $item['TITLE'] : ''; if ($title !== '') { $title .= ':'; } $params = isset($item['PARAMS']) && is_array($item['PARAMS']) ? $item['PARAMS'] : array(); if ($type === '') { echo '<span class="crm-detail-info-item-name">', htmlspecialcharsbx($title), '</span>', '<span class="crm-detail-info-item-text">', htmlspecialcharsbx(isset($item['VALUE']) ? $item['VALUE'] : ''), '</span>'; } elseif ($type === 'PROGRESS') { echo '<div class="crm-detail-stage crm-detail-info-item">', '<div class="crm-detail-stage-name">', htmlspecialcharsbx($title), '</div>', CCrmViewHelper::RenderProgressControl($params), '</div>'; } elseif ($type === 'SELECT') { echo '<span class="crm-detail-info-item-name">', htmlspecialcharsbx($title), '</span>'; echo '<span class="crm-detail-info-item-text">'; $params['CONTAINER_CLASS'] = 'crm-item-type'; $params['TEXT_CLASS'] = 'crm-item-type-text'; $params['ARROW_CLASS'] = 'crm-item-type-text-corner'; CCrmViewHelper::RenderSelector($params); echo '</span>'; } elseif ($type === 'CLIENT_INFO') { echo '<div class="crm-item-client"><span class="crm-detail-info-item-name">', htmlspecialcharsbx($title), '</span>', '<span class="crm-detail-info-item-text">', CCrmViewHelper::PrepareClientInfoV2($params), '</span></div>'; } elseif ($type === 'CLIENT_BALLOON') { if (isset($params['name'])) { $title = $params['name']; if ($title !== '') { $title .= ':'; } } echo '<div class="crm-item-client-ballon"><span class="crm-detail-info-item-name">', htmlspecialcharsbx($title), '</span>', '<span class="crm-detail-info-item-text">'; if (isset($params['value'])) { echo $params['value']; } else { echo CCrmViewHelper::PrepareEntityBaloonHtml($params); } echo '</span></div>'; } elseif ($type === 'MULTIFIELD') { $typeName = isset($params['TYPE']) ? $params['TYPE'] : ''; $values = isset($params['VALUES']) ? $params['VALUES'] : array(); $valueTypes = isset($params['VALUE_TYPES']) ? $params['VALUE_TYPES'] : array(); $valueCount = isset($params['VALUE_COUNT']) ? intval($params['VALUE_COUNT']) : 0; $displayIfEmpty = isset($params['DISPLAY_IF_EMPTY']) ? $params['DISPLAY_IF_EMPTY'] : true; if (!$displayIfEmpty && $valueCount <= 0) { return; } $options = isset($item['OPTIONS']) && is_array($item['OPTIONS']) ? $item['OPTIONS'] : array(); $enableSip = is_array($options) && isset($options['ENABLE_SIP']) && (bool) $options['ENABLE_SIP']; $titleClassName = 'crm-detail-info-item-name'; if ($enableSip) { $titleClassName .= ' crm-detail-info-item-name-tel-sip'; } $contentClassName = 'crm-detail-info-item-text crm-item-tel'; if ($enableSip) { $contentClassName .= ' crm-item-tel-tel-sip'; } echo '<span class="' . $titleClassName . '">', htmlspecialcharsbx($title), '</span>', '<span class="' . $contentClassName . '">'; echo CCrmViewHelper::PrepareFirstMultiFieldHtml($typeName, $values, $valueTypes, array(), $options); if ($valueCount > 1) { $prefix = isset($params['PREFIX']) ? $params['PREFIX'] : ''; $anchorID = ($prefix !== '' ? "{$prefix}_" : '') . strtolower($typeName); echo '<span class="crm-item-tel-list" id="', htmlspecialcharsbx($anchorID), '"', ' onclick="', CCrmViewHelper::PrepareMultiFieldValuesPopup($anchorID, $anchorID, $typeName, $values, $valueTypes, $options), '"></span>'; } echo '</span>'; } elseif ($type === 'RESPONSIBLE') { CCrmViewHelper::RenderResponsiblePanel($params); } elseif ($type === 'MODIFICATION_INFO') { $date = isset($params['DATE']) ? $params['DATE'] : ''; $userName = isset($params['USER_NAME']) ? $params['USER_NAME'] : ''; $pathToUser = isset($params['PATH_TO_USER']) ? $params['PATH_TO_USER'] : ''; echo '<span class="crm-detail-info-item-name">', htmlspecialcharsbx($title), '</span>', '<span class="crm-detail-info-item-text">'; echo $date !== '' ? FormatDate('SHORT', MakeTimeStamp($date)) : '-'; if ($userName !== '' && $pathToUser !== '') { echo ', <a class="crm-detail-info-link" href="', htmlspecialcharsbx($pathToUser), '">', htmlspecialcharsbx($userName), '</a>'; } echo '</span>'; } elseif ($type === 'DURATION') { $from = !empty($params['FROM']) ? CCrmComponentHelper::TrimDateTimeString(ConvertTimeStamp(MakeTimeStamp($params['FROM']), 'SHORT', SITE_ID)) : '-'; $to = !empty($params['TO']) ? CCrmComponentHelper::TrimDateTimeString(ConvertTimeStamp(MakeTimeStamp($params['TO']), 'SHORT', SITE_ID)) : '-'; echo '<span class="crm-detail-info-item-name">', htmlspecialcharsbx($title), '</span>', '<span class="crm-detail-info-item-text crm-item-date">'; echo '<i>', htmlspecialcharsbx(GetMessage('CRM_DURATION_FROM')), '</i>', '<span class="crm-item-date-calendar">', htmlspecialcharsbx($from), '</span>', '<i>', htmlspecialcharsbx(GetMessage('CRM_DURATION_TO')), '</i>', '<span class="crm-item-date-calendar">', htmlspecialcharsbx($to), '</span>'; echo '</span>'; } elseif ($type === 'MONEY') { $fieldID = isset($params['FIELD_ID']) ? $params['FIELD_ID'] : ''; $value = isset($params['VALUE']) ? $params['VALUE'] : ''; $currencyID = isset($params['CURRENCY_ID']) ? $params['CURRENCY_ID'] : CCrmCurrency::GetBaseCurrencyID(); $editable = isset($params['EDITABLE']) ? $params['EDITABLE'] : false; echo '<div class="crm-item-sum', $editable ? ' crm-instant-editor-fld-block' : '', '">'; echo '<span class="crm-detail-info-item-name">', htmlspecialcharsbx($title), '</span>'; if (!$editable) { echo '<span class="crm-detail-info-item-text">', CCrmCurrency::MoneyToString($value, $currencyID), '</span>'; } else { echo '<span class="crm-detail-info-item-text">'; CCrmViewHelper::RenderInstantEditorField(array('TYPE' => 'TEXT', 'FIELD_ID' => $fieldID, 'VALUE' => $value, 'SUFFIX_HTML' => " {$currencyID}", 'INPUT_WIDTH' => 80)); echo '</span>'; } echo '</div>'; } elseif ($type === 'PERCENT') { $fieldID = isset($params['FIELD_ID']) ? $params['FIELD_ID'] : ''; $value = isset($params['VALUE']) ? $params['VALUE'] : ''; $editable = isset($params['EDITABLE']) ? $params['EDITABLE'] : false; echo '<div', $editable ? ' class="crm-instant-editor-fld-block"' : '', '>'; echo '<span class="crm-detail-info-item-name">', htmlspecialcharsbx($title), '</span>'; if (!$editable) { echo '<span class="crm-detail-info-item-text">', htmlspecialcharsbx($value), ' %</span>'; } else { echo '<span class="crm-detail-info-item-text">'; CCrmViewHelper::RenderInstantEditorField(array('TYPE' => 'TEXT', 'FIELD_ID' => $fieldID, 'VALUE' => $value, 'SUFFIX_HTML' => "%", 'INPUT_WIDTH' => 30)); echo '</span>'; } echo '</div>'; } elseif ($type === 'TEXT') { $fieldID = isset($params['FIELD_ID']) ? $params['FIELD_ID'] : ''; $value = isset($params['VALUE']) ? $params['VALUE'] : ''; $editable = isset($params['EDITABLE']) ? $params['EDITABLE'] : false; $width = isset($params['WIDTH']) ? $params['WIDTH'] : 50; echo '<div', $editable ? ' class="crm-instant-editor-fld-block"' : '', '>'; echo '<span class="crm-detail-info-item-name">', htmlspecialcharsbx($title), '</span>'; if (!$editable) { echo '<span class="crm-detail-info-item-text">', htmlspecialcharsbx($value), '</span>'; } else { echo '<span class="crm-detail-info-item-text"><span class="crm-detail-item-text-alignment">'; CCrmViewHelper::RenderInstantEditorField(array('TYPE' => 'TEXT', 'FIELD_ID' => $fieldID, 'VALUE' => $value, 'INPUT_WIDTH' => $width)); echo '</span></span>'; } echo '</div>'; } elseif ($type === 'CUSTOM') { $fieldID = isset($params['FIELD_ID']) ? $params['FIELD_ID'] : ''; $value = isset($params['VALUE']) ? $params['VALUE'] : ''; echo $value; } }