$foreignLangFilter = array();
$foreignLangStrSearch = isset($_GET["filter"])? $_GET["filter"]: '';
if ($foreignLangStrSearch) {
$arRegExp = Array(
//"COURSE_USERS" => '#Dlja-[^D]+#',
"COURSE_USERS" => '#dlja-detej-doshkolnogo-vozrasta|dlja-shkolnikov|dlja-abiturientov|dlja-studentov|dlja-vzroslyh#i',
"COURSE_TYPE" => '#podgotovka-k-mezhdunarodnym-ekzamenam|obschij|razgovornyj|delovoj#',
"LANGUAGE" => '#^[\w]+#'
);
/*
* Сначала было бы круто найти все записи о
* том на кого расчитаны курсы, что мы и сделаем
*/
preg_match_all($arRegExp["COURSE_USERS"], $foreignLangStrSearch, $arrUsersMatches);
if (!empty($arrUsersMatches)) {
$foreignLangFilter["COURSE_USERS"] = $arrUsersMatches[0];
// foreach($foreignLangFilter["COURSE_USERS"] as $k => $strItem)
// $foreignLangFilter["COURSE_USERS"][$k] = preg_replace('#^-#', '', $strItem);
$foreignLangStrSearch = preg_replace($arRegExp["COURSE_USERS"], '', $foreignLangStrSearch);
}
/*
* Тип курса
*/
preg_match_all($arRegExp["COURSE_TYPE"], $foreignLangStrSearch, $arrTypeMatches);
if (!empty($arrTypeMatches)) {
$foreignLangFilter["COURSE_TYPE_CODE"] = $arrTypeMatches[0][0];
$foreignLangStrSearch = preg_replace($arRegExp["COURSE_TYPE"], '', $foreignLangStrSearch);
}
/*
* Язык
*/
preg_match_all($arRegExp["LANGUAGE"], $foreignLangStrSearch, $arrLanguageMatches);
if (!empty($arrTypeMatches)) {
$foreignLangFilter["LANGUAGE_CODE"] = $arrLanguageMatches[0][0];
$foreignLangStrSearch = preg_replace($arRegExp["LANGUAGE"], '', $foreignLangStrSearch);
}
// если в фильтре осталось что-то, значит там были ошибки
// следовательно пора показывать 404
// но сначала уберем все тире – это мусор
$foreignLangStrSearch = preg_replace('#-#', '', $foreignLangStrSearch);
//echo $foreignLangStrSearch;
}
//~
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
$APPLICATION->SetTitle('Курсы иностранных языков на ACADEMICA.RU');
?>
if (mb_strlen($foreignLangStrSearch, 'UTF-8')) {
@define("ERROR_404", "Y");
CHTTP::SetStatus("404 Not Found");
}
$arrFilter = $foreignLangFilter;
$arrFilter['cityId'] = isset($GLOBALS['CURRENT_CITY'])? $GLOBALS['CURRENT_CITY']['ID']: null;
//beep();dump_($arrFilter);
?>
$APPLICATION->IncludeComponent(
'bitrix:breadcrumb',
'bread_alllink',
array(
'START_FROM' => 1, // skip "/"
'SITE_ID' => 's1'
)
);
?>
$componentResult = $APPLICATION->IncludeComponent(
"academica:filter.for.in.yaz",
".default",
array(
"IBLOCK_ID_CITY" => "35",
"IBLOCK_ID_LANGUAGE" => "44",
"IBLOCK_ID_COURSE_USER" => "43",
"IBLOCK_ID_COURSE_TYPE" => "42",
"SET_TITLE" => "Y",
"SELECTED_ITEMS" => $arrFilter,
"CACHE_TYPE" => "N",
//"CACHE_TIME" => "36000000"
),
false
);
?>
if ($_GET["PAGEN_1"]) {
Ac_Lib::setPageNumberCanonicalUrl();
// Выборка учебных программ
$yandexStatIdRight = 15; // Id среза для Яндекс.Директ
// мопед не мой
$_SESSION["ACADEMICA"]["VUZ_BACK_URL"] = $_SERVER["REQUEST_URI"];
$APPLICATION->IncludeComponent(
"academica:institutions.list.for.inyaz",
".default",
array(
//"IBLOCK_ID_COURSES" => "45",
//"IBLOCK_ID_INSTITUTE" => "27",
//"IBLOCK_ID_CITIES" => "35",
"CACHE_TYPE" => "A",
"CACHE_TIME" => 3600,//"36000000",
"PAGE_NUMBER" => $_GET["PAGEN_1"],
"FAVORITE_IBLOCK_ID" => 56,
"FAVORITE_TYPE_ID" => 705374,
"PAGE_SIZE" => 10,
//"PAGER_TEMPLATE" => "foreinlang__prof",
"SELECTED_ITEMS" => $arrFilter
),
false
);
if ($_GET["PAGEN_1"] == 1) {
if ($GLOBALS['CURRENT_CITY']) {
$APPLICATION->IncludeComponent(
'academica:foreignlang.article_link',
'',
array(
'cityId' => $GLOBALS['CURRENT_CITY']['ID'],
'subjectId' => $componentResult['LANGUAGE'],
'count' => 3,
'cacheTime' => 7*24*60*60
)
);
}
$GLOBALS['arFilterComponent']['SECTION_ID'] = 23069;
$GLOBALS['arFilterComponent']['PROPERTY_304'] = $componentResult["LANGUAGE"];
$GLOBALS['arFilterComponent']['PROPERTY_305'] = $componentResult["TYPE"];
$GLOBALS['arFilterComponent']['PROPERTY_308'] = $componentResult['CITY'];
$APPLICATION->IncludeComponent("bitrix:news.list","text.block",
Array(
"DISPLAY_DATE" => "N",
"DISPLAY_NAME" => "Y",
"DISPLAY_PICTURE" => "N",
"DISPLAY_PREVIEW_TEXT" => "Y",
"AJAX_MODE" => "N",
"IBLOCK_TYPE" => "ui_elements",
"IBLOCK_ID" => "84",
"NEWS_COUNT" => "1",
"SORT_BY1" => "PROPERTY_SUBJECT_PROF",
"SORT_ORDER1" => "ASC",
"SORT_BY2" => "SORT",
"SORT_ORDER2" => "ASC",
"FILTER_NAME" => "arFilterComponent",
"FIELD_CODE" => Array(),
"PROPERTY_CODE" => Array(),
"CHECK_DATES" => "N",
"DETAIL_URL" => "",
"PREVIEW_TRUNCATE_LEN" => "",
"ACTIVE_DATE_FORMAT" => "d.m.Y",
"SET_TITLE" => "N",
"SET_STATUS_404" => "N",
"INCLUDE_IBLOCK_INTO_CHAIN" => "N",
"ADD_SECTIONS_CHAIN" => "N",
"HIDE_LINK_WHEN_NO_DETAIL" => "Y",
"PARENT_SECTION" => "",
"PARENT_SECTION_CODE" => "",
"CACHE_TYPE" => "N",
"CACHE_TIME" => "360000",
"CACHE_FILTER" => "N",
"CACHE_GROUPS" => "N",
"DISPLAY_TOP_PAGER" => "N",
"DISPLAY_BOTTOM_PAGER" => "N",
"PAGER_TITLE" => "",
"PAGER_SHOW_ALWAYS" => "N",
"PAGER_TEMPLATE" => "",
"PAGER_DESC_NUMBERING" => "N",
"PAGER_DESC_NUMBERING_CACHE_TIME" => "36000",
"PAGER_SHOW_ALL" => "N",
"AJAX_OPTION_JUMP" => "N",
"AJAX_OPTION_STYLE" => "Y",
"AJAX_OPTION_HISTORY" => "N",
"AJAX_OPTION_ADDITIONAL" => ""
)
);
}
}
else {
// Заглавная страница раздела
$yandexStatIdRight = 14; // Id среза для Яндекс.Директ
?>
// Последние отзывы
$cityId_ = isset($GLOBALS['CURRENT_CITY'])? (int)$GLOBALS['CURRENT_CITY']['ID']: null;
if ($cityId_) {
$APPLICATION->IncludeComponent(
'academica:review.review_list_preview',
'',
array(
'TITLE' => 'Последние отзывы',
'FILTER_CASCADE' => array(
array('cityId'=>$cityId_, 'learnSection'=>'foreign_lang', 'moderateStatus'=>'approved'),
array('!cityId'=>$cityId_, 'learnSection'=>'foreign_lang', 'moderateStatus'=>'approved'),
),
'LIMIT' => 3
)
);
}
else {
$APPLICATION->IncludeComponent(
'academica:review.review_list_preview',
'',
array(
'TITLE' => 'Последние отзывы',
'FILTER' => array('learnSection'=>'foreign_lang', 'moderateStatus'=>'approved'),
'LIMIT' => 3
)
);
}
?>
include'../bitrix/templates/academica/inc/news-list-short.php';
include'../bitrix/templates/academica/inc/ctn-article.php';
}
?>