merelendor 6b2903d1d8 ads
2023-08-31 16:53:10 +03:00

51 lines
1.3 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("SORT" => "ASC", "NAME" => "ASC");
$filter = [ "IBLOCK_ID" => 11 ];
if(!isset($_GET['advertise'])) { $filter['ACTIVE'] = "Y"; }
$options = Array("nPageSize" => 1000);
$res = CIBlockElement::GetList($sort, $filter, false, $options);
$arResult = ['SLIDES' => []];
while ($obElement = $res->GetNextElement())
{
$ar_res = $obElement->GetFields();
$ar_res['PROPERTIES'] = $obElement->GetProperties();
if(isset($ar_res['DETAIL_PICTURE']))
{
$ar_res['DETAIL_PICTURE'] = CFile::GetPath($ar_res['DETAIL_PICTURE']);
}
if(isset($ar_res['PREVIEW_PICTURE']))
{
$ar_res['PREVIEW_PICTURE'] = CFile::GetPath($ar_res['PREVIEW_PICTURE']);
}
$arResult['SLIDES'][] = $ar_res;
}
$this->IncludeComponentTemplate();
}
}