Ejemplo n.º 1
0
 function addPropsCell(&$row, &$arSelectedProps, &$arItems)
 {
     $arProperties = $arItems['PROPERTIES'];
     foreach ($arSelectedProps as $aProp) {
         if (empty($arProperties[$aProp['ID']])) {
             continue;
         }
         $v = '';
         foreach ($arProperties[$aProp['ID']] as $property_value_id => $property_value) {
             $res = '';
             if ($aProp['PROPERTY_TYPE'] == 'F') {
                 $res = getImageField($property_value_id, $property_value);
             } elseif ($aProp['PROPERTY_TYPE'] == 'G') {
                 $res = ProductSearchComponent::getSectionName($property_value);
             } elseif ($aProp['PROPERTY_TYPE'] == 'E') {
                 $res = ProductSearchComponent::getElementName($property_value);
             } else {
                 $res = htmlspecialcharsex($property_value);
             }
             if ($res != "") {
                 $v .= ($v != '' ? ' / ' : '') . $res;
             }
         }
         if ($v != "") {
             $row->AddViewField("PROPERTY_" . $aProp['ID'], $v);
         }
     }
 }
Ejemplo n.º 2
0
$gridOptions = new CGridOptions($arResult['TABLE_ID']);
$arSort = $gridOptions->GetSorting(array('sort' => array('name' => 'asc'), 'vars' => array('by' => 'by', 'order' => 'order')));
$arResult['SORT'] = $arSort['sort'];
$arResult['SORT_VARS'] = $arSort['SORT']['vars'];
unset($arSort);
$arResult['ROWS_COUNT'] = $arResult['DB_RESULT_LIST'] instanceof \CDBResult ? $arResult['DB_RESULT_LIST']->SelectedRowsCount() : 0;
$arResult['GRID_DATA'] = array();
foreach ($arResult['PRODUCTS'] as $productId => $arItems) {
    $arActions = array();
    if ($arItems['TYPE'] === 'S') {
        $arActions[] = array('ICONCLASS' => 'select', 'TEXT' => GetMessage('SPS_SELECT'), 'ONCLICK' => $tableId . '_helper.onSectionChange(' . $arItems['ID'] . ',"' . CUtil::JSEscape($arItems['NAME']) . '");', 'DEFAULT' => true);
    } else {
        $params = array('id' => $productId, 'type' => $arItems['TYPE']);
        $arActions[] = array('TEXT' => GetMessage('SPS_SELECT'), 'ONCLICK' => $tableId . '_helper.SelEl(' . CUtil::PhpToJSObject($params) . ', this);', 'DEFAULT' => true);
    }
    $gridDataRecord = array('id' => $arItems['TYPE'] . $arItems['ID'], 'actions' => $arActions, 'data' => $arItems, 'editable' => false, 'columns' => array('NAME' => '<a class="crm-gds-item' . ($arItems['TYPE'] === 'S' ? ' crm-gds-item-section' : ' crm-gds-item-gds') . '">' . $arItems['NAME'] . '</a>', 'ACTIVE' => $arItems['ACTIVE'] === 'Y' ? GetMEssage('SPS_PRODUCT_ACTIVE') : GetMEssage('SPS_PRODUCT_NO_ACTIVE'), 'PREVIEW_PICTURE' => getImageField('NO_FIELDS[' . $arItems['ID'] . '][PREVIEW_PICTURE]', $arItems['PREVIEW_PICTURE']), 'DETAIL_PICTURE' => getImageField('NO_FIELDS[' . $arItems['ID'] . '][DETAIL_PICTURE]', $arItems['DETAIL_PICTURE'])));
    // Product properties
    if (is_array($arResult['PUBLIC_PROPS']) && is_array($arItems['PROPERTIES'])) {
        foreach ($arItems['PROPERTIES'] as $propId => $propVal) {
            if (isset($arResult['PUBLIC_PROPS'][intval($propId)])) {
                $gridDataRecord['columns']['PROPERTY_' . $propId] = $propVal;
            }
        }
    }
    $arResult['GRID_DATA'][] = $gridDataRecord;
}
?>
<!-- START HTML -->
<div id="<?php 
echo htmlspecialcharsbx($leftContainerId);
?>