function addElementReview($arResult, $ID_SECTION, $IBLOCK_ID) { CModule::IncludeModule('iblock'); $property_enums = CIBlockPropertyEnum::GetList(array("DEF" => "DESC", "SORT" => "ASC"), array("IBLOCK_ID" => $IBLOCK_ID, "CODE" => "RATING", "VALUE" => $arResult['RATING'])); while ($rating = $property_enums->GetNext()) { $arRating = $rating["ID"]; } $current_date = dateActiveFrom(date('d.m.Y')); $NAME = $current_date . ' ' . $arResult['NAME']; $arFields = array("ACTIVE" => "N", "IBLOCK_ID" => $IBLOCK_ID, "IBLOCK_SECTION_ID" => $ID_SECTION, "NAME" => $NAME, "DETAIL_TEXT" => "Описание элемента", "PROPERTY_VALUES" => array("NAME" => $arResult['NAME'], "EMAIL" => $arResult['EMAIL'], "RATING" => array('VALUE' => $arRating), "BENEFITS" => $arResult['BENEFITS'], "DISADVANTAGES" => $arResult['DISADVANTAGES'], "COMMENT" => $arResult['COMMENT'])); $oElement = new CIBlockElement(); $idElement = $oElement->Add($arFields, false, false, true); return $idElement; }
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die(); /** @var array $arParams */ /** @var array $arResult */ /** @global CMain $APPLICATION */ /** @global CUser $USER */ /** @global CDatabase $DB */ /** @var CBitrixComponentTemplate $this */ $res = CIBlockElement::GetByID($arResult['ID']); if($ar_res = $res->GetNext()) $arResult['DATE_ACTIVE'] = dateActiveFrom($ar_res['DATE_ACTIVE_FROM']); ?>
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die(); /** @var array $arParams */ /** @var array $arResult */ /** @global CMain $APPLICATION */ /** @global CUser $USER */ /** @global CDatabase $DB */ /** @var CBitrixComponentTemplate $this */ foreach ($arResult["ITEMS"] as &$arItem) { $res = CIBlockElement::GetByID($arItem['ID']); if($ar_res = $res->GetNext()) $arItem['DATE_ACTIVE'] = dateActiveFrom($ar_res['DATE_ACTIVE_FROM']); } ?>