Your IP : 172.28.240.42


Current Path : /var/www/html/clients/e-nkama.ru/e-nkama_bitrix/ajax/
Upload File :
Current File : /var/www/html/clients/e-nkama.ru/e-nkama_bitrix/ajax/fresh-news.php

<?php
require_once($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php');
CModule::IncludeModule('iblock');

$arSelect = array('ID', 'NAME', 'DETAIL_PAGE_URL', 'DETAIL_PICTURE');
$arFilter = array('IBLOCK_ID' => 10, 'ACTIVE' => 'Y');
$arOrder  = array('ACTIVE_FROM' => 'DESC', 'ID' => 'DESC');
$items = CIBlockElement::GetList($arOrder, $arFilter, false, array('nPageSize' => 1), $arSelect);

$item = $items->GetNext();
$image = my_resize($item['DETAIL_PICTURE'], 107, 80);

$res['id'] = $item['ID'];
$res['is_new'] = true;

$res['html'] = <<<HTML
<div class="fresh-news active">
     <div class="fresh-news-close" onclick="closeFreshNews()"></div>
     <a class="fresh-news-inner" href="{$item['DETAIL_PAGE_URL']}">
          <div class="img" style="background-image: url('{$image['src']}');"></div>
          <div class="body">
               <div class="head">Свежая новость</div>
               <div class="text">{$item['NAME']}</div>
          </div>
     </a>
     <audio id="wav" src="/upload/file.wav"></audio>
</div>
HTML;

if ($_GET['id'] == $res['id']) $res['is_new'] = false;

echo json_encode($res);
?>