<? if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) die();


// получение тегов
$iblockId = 28;

$arResult['SPECIALS'] = [];
$arSelect = array("ID", "IBLOCK_ID", "NAME", "PROPERTY_LINK");//IBLOCK_ID и ID обязательно должны быть
$arFilter = array("IBLOCK_ID" => $iblockId, "ACTIVE" => "Y");
$res = CIBlockElement::GetList(array("SORT"=>"ASC"), $arFilter, false, false, $arSelect);
while ($ob = $res->GetNextElement()) {
    $arFields = $ob->GetFields();
    $arResult['SPECIALS'][] = $arFields;
}


//возможности
$iblockId=30;

if (!empty($arResult['PROPERTIES']['POSSIBILITIES']['VALUE'])) {
    $arResult['POSSIBILITIES'] = [];
    foreach ($arResult['PROPERTIES']['POSSIBILITIES']['VALUE'] as $item) {
        $arSelect = array("ID", "IBLOCK_ID", "NAME", "PREVIEW_TEXT");//IBLOCK_ID и ID обязательно должны быть
        $arFilter = array("IBLOCK_ID" => $iblockId, "ID" => $item);
        $res = CIBlockElement::GetList(array("SORT"=>"ASC"), $arFilter, false, false, $arSelect);
        while ($ob = $res->GetNextElement()) {
            $arFields = $ob->GetFields();
            $arFields['PROPERTIES'] = $ob->GetProperties();
            $arResult['POSSIBILITIES'][] = $arFields;
        }
    }
}


//faq
$iblockIdf=1;

if (!empty($arResult['PROPERTIES']['FAQ']['VALUE'])) {
    $arResult['FAQ'] = [];
    foreach ($arResult['PROPERTIES']['FAQ']['VALUE'] as $item) {
        $res = CIBlockElement::GetByID($item);
        if($arRes = $res->GetNext()) {
            $arResult['FAQ'][]=$arRes;
        }

    }
}
$vk=str_replace("https://vk.com/video-", "",$arResult['PROPERTIES']['VIDEO_LINK']['VALUE']);
$arResult['VK_LINK']=explode("_",$vk);
$arResult["PREZENT_DATE"] = CIBlockFormatProperties::DateFormat('d.m.Y H:s', MakeTimeStamp($arResult["PROPERTIES"]["PREZENT_DATE"]["VALUE"], CSite::GetDateFormat()));



//решаемые задачи
$iblockId=72;

if (!empty($arResult['PROPERTIES']['TASKS']['VALUE'])) {
    $arResult['TASKS'] = [];
    foreach ($arResult['PROPERTIES']['TASKS']['VALUE'] as $item) {
        $arSelect = array("ID", "IBLOCK_ID", "NAME", "PREVIEW_TEXT");//IBLOCK_ID и ID обязательно должны быть
        $arFilter = array("IBLOCK_ID" => $iblockId, "ID" => $item);
        $res = CIBlockElement::GetList(array("SORT"=>"ASC"), $arFilter, false, false, $arSelect);
        while ($ob = $res->GetNextElement()) {
            $arFields = $ob->GetFields();
            $arFields['PROPERTIES'] = $ob->GetProperties();
            $arResult['TASKS'][] = $arFields;
        }
    }
}

//преимущества
$iblockId=73;

if (!empty($arResult['PROPERTIES']['ADVANTAGES']['VALUE'])) {
    $arResult['ADVANTAGES'] = [];
    foreach ($arResult['PROPERTIES']['ADVANTAGES']['VALUE'] as $item) {
        $arSelect = array("ID", "IBLOCK_ID", "NAME", "PREVIEW_TEXT");//IBLOCK_ID и ID обязательно должны быть
        $arFilter = array("IBLOCK_ID" => $iblockId, "ID" => $item);
        $res = CIBlockElement::GetList(array("SORT"=>"ASC"), $arFilter, false, false, $arSelect);
        while ($ob = $res->GetNextElement()) {
            $arFields = $ob->GetFields();
            $arFields['PROPERTIES'] = $ob->GetProperties();
            $arResult['ADVANTAGES'][] = $arFields;
        }
    }
}

//документы
$iblockId=74;

if (!empty($arResult['PROPERTIES']['DOCUMENTS']['VALUE'])) {
    $arResult['DOCUMENTS'] = [];
    foreach ($arResult['PROPERTIES']['DOCUMENTS']['VALUE'] as $item) {
        $arSelect = array("ID", "IBLOCK_ID", "NAME", "PREVIEW_TEXT");//IBLOCK_ID и ID обязательно должны быть
        $arFilter = array("IBLOCK_ID" => $iblockId, "ID" => $item);
        $res = CIBlockElement::GetList(array("SORT"=>"ASC"), $arFilter, false, false, $arSelect);
        while ($ob = $res->GetNextElement()) {
            $arFields = $ob->GetFields();
            $arFields['PROPERTIES'] = $ob->GetProperties();
            $arResult['DOCUMENTS'][] = $arFields;
        }
    }
}






