63 lines
1.6 KiB
PHP
63 lines
1.6 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 = array();
|
|
$sort = Array("ID" => $arParams['BANNERS']);
|
|
$filter = Array("IBLOCK_ID" => IBLOCK_ID_SPECIAL_OFFERS_BANNERS, "ID" => $arParams['BANNERS']);
|
|
if(!isset($_GET['advertise'])) { $filter["ACTIVE"] = "Y"; }
|
|
$options = Array("nPageSize" => 1000);
|
|
|
|
if(isset($arParams["sort"]))
|
|
{
|
|
$sort = $arParams["sort"];
|
|
}
|
|
|
|
if(isset($arParams["options"]))
|
|
{
|
|
$options = $arParams["options"];
|
|
}
|
|
|
|
if(isset($arParams["filter"]))
|
|
{
|
|
$filter = array_merge($filter, $arParams["filter"]);
|
|
}
|
|
|
|
$res = CIBlockElement::GetList($sort, $filter, false, $options);
|
|
$arResult = Array();
|
|
$arResult['BANNERS'] = Array();
|
|
|
|
while ($obElement = $res->GetNextElement())
|
|
{
|
|
$ar_res = $obElement->GetFields();
|
|
$ar_res['PROPERTIES'] = $obElement->GetProperties();
|
|
$ar_res['PROPERTIES']['OFFER']['RELATED'] = get_related(4, $ar_res['PROPERTIES']['OFFER']['VALUE']);
|
|
|
|
if(isset($ar_res['PREVIEW_PICTURE']))
|
|
{
|
|
$ar_res['PREVIEW_PICTURE'] = CFile::GetPath($ar_res['PREVIEW_PICTURE']);
|
|
}
|
|
|
|
$arResult['BANNERS'][] = $ar_res;
|
|
}
|
|
|
|
$this->IncludeComponentTemplate();
|
|
}
|
|
} |