2023-08-30 15:49:53 +03:00

57 lines
1.4 KiB
PHP

<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();
/** @var CBitrixComponent $this */
/** @var array $arParams */
/** @var array $arResult */
/** @var string $componentPath */
/** @var string $componentName */
/** @var string $componentTemplate */
/** @global CDatabase $DB */
/** @global CUser $USER */
/** @global CMain $APPLICATION */
use Bitrix\Main\Context,
Bitrix\Main\Type\DateTime,
Bitrix\Main\Loader,
Bitrix\Iblock;
if($this->StartResultCache(60*60*24, md5(var_export($_POST, true))))
{
if(CModule::IncludeModule('iblock'))
{
$arResult = [];
$sort = Array("ACTIVE_FROM" => "DESC", "NAME" => "ASC");
$filter = Array("ACTIVE" => "Y", "IBLOCK_ID" => 6);
$options = Array("nPageSize" => isset($_GET['advertise']) ? 10000 : 4);
$res = CIBlockElement::GetList($sort, $filter, false, $options);
$arResult = ['ITEMS' => []];
while ($obElement = $res->GetNextElement())
{
$ar_res = $obElement->GetFields();
$ar_res['PROPERTIES'] = $obElement->GetProperties();
if(isset($ar_res['PREVIEW_PICTURE']))
{
$ar_res['PREVIEW_PICTURE'] = CFile::GetPath($ar_res['PREVIEW_PICTURE']);
}
$arResult['ITEMS'][] = $ar_res;
}
if($arParams["PAGINATION"] == "Y")
{
$arResult["NAV_STRING"] = $res->GetPageNavStringEx(
$navComponentObject,
"",
"catalog",
"N",
null,
[ "section_code" => "/about/news/", ]
);
}
$this->IncludeComponentTemplate();
}
}