StartResultCache(60*60*24, md5(var_export($_POST, true)))) { if(CModule::IncludeModule('iblock')) { $arResult['ALLOW'] = false; $arResult['SEARCH'] = $_REQUEST['search']; print "\n"; $sort = Array("ID" => "DESC"); $filter = Array("ACTIVE" => "Y", "IBLOCK_ID" => IBLOCK_ID_CALLBACK_SCHEDULE); $options = Array("nPageSize" => 1); $schedule_res = CIBlockElement::GetList($sort, $filter, false, $options); while ($schedule_element = $schedule_res->GetNextElement()) { $schedule = $schedule_element->GetFields(); $schedule['PROPERTIES'] = $schedule_element->GetProperties(); $day = date("w"); $time = date("H:i"); if($schedule['PROPERTIES']['WEEKDAY_'.$day.'_ENABLED']['VALUE_XML_ID'] === "YES") { if(!empty($schedule['PROPERTIES']['WEEKDAY_'.$day.'_FROM']['VALUE']) && $schedule['PROPERTIES']['WEEKDAY_'.$day.'_TO']['VALUE']) { $from = mktime($schedule['PROPERTIES']['WEEKDAY_'.$day.'_FROM']['VALUE'].":00"); $now = mktime( $time.":00" ); $to = mktime($schedule['PROPERTIES']['WEEKDAY_'.$day.'_TO']['VALUE'].":00"); if($now >= $from && $now < $to) { $arResult['ALLOW'] = true; print "\n"; print "\n"; } } } } $this->IncludeComponentTemplate(); } }