require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/header.php");
$APPLICATION->SetTitle('Подготовка старшеклассников к экзаменам на ACADEMICA.RU');
?>
// breadcrumb
function acEgeGiaList_getBreadcrumb($request) {
$BASE_URL = '/ege-gia';
$out = array();
$cityId = isset($request['cityId'])? $request['cityId']: null;
$subjectAreaCode = isset($request['subjectAreaCode'])? $request['subjectAreaCode']: null;
if (!$subjectAreaCode) {
return $out;
}
$subjectCode = isset($request['subjectCode'])? $request['subjectCode']: null;
$subjectArea = null;
$result = CIBlockSection::GetList(
array(),
array(
'IBLOCK_ID'=>Ac_Lib::SUBJECT_EGE_GIA_IBLOCK_ID,
'CODE'=>$subjectAreaCode
),
false,
array('ID', 'IBLOCK_ID', 'CODE', 'UF_TEXT_BREADCRUMB'),
array('nPageSize'=>1)
);
$subjectArea = $result->Fetch();
if (!$subjectArea || !$subjectArea['UF_TEXT_BREADCRUMB'] || !$subjectArea['CODE']) {
return $out;
}
$subject = null;
if ($subjectCode) {
$mapper_ = new Ac_Mapper_Subject_EgeGia;
$subjects_ = $mapper_->loads(
array('IBLOCK_SECTION_ID'=>$subjectArea['ID'], 'CODE'=>$subjectCode),
array('PROPERTY_TEXT_BREADCRUMB'),
null,
1
);
if ($subjects_) {
$subject = $subjects_[0];
}
if (!$subject || !$subject->PROPERTY_TEXT_BREADCRUMB) {
return $out;
}
}
$city = null;
if ($cityId) {
$mapper_ = new Ac_Mapper_City;
$city = $mapper_->load($cityId, array('NAME', 'PROPERTY_NAME_GEN_CASE', 'PROPERTY_NAME_PREP_CASE'));
}
$cityPrep = $city? $GLOBALS['obAcademica']->getPrepositionOfCity($city->PROPERTY_NAME_PREP_CASE): 'в России';
$out[] = array(
'name' => 'Подготовка школьников '.$cityPrep,
'url' => $BASE_URL.'/stranitsa_1/'
);
$name_ = $subjectArea['UF_TEXT_BREADCRUMB'];
$name_ = str_replace('#CITY#', $city?$city->NAME:'Россия', $name_);
$name_ = str_replace('#CITY_GEN#', $city?$city->PROPERTY_NAME_GEN_CASE:'России', $name_);
$name_ = str_replace('#CITY_PREP#', $cityPrep, $name_);
$out[] = array(
'name' => $name_,
'url' => $subject? $BASE_URL.'/'.$subjectArea['CODE'].'/stranitsa_1/': ''
);
if ($subject) {
$name_ = $subject->PROPERTY_TEXT_BREADCRUMB;
$name_ = str_replace('#CITY#', $city?$city->NAME:'Россия', $name_);
$name_ = str_replace('#CITY_GEN#', $city?$city->PROPERTY_NAME_GEN_CASE:'России', $name_);
$name_ = str_replace('#CITY_PREP#', $cityPrep, $name_);
$out[] = array(
'name' => $name_,
'url' => ''
);
}
return $out;
}
//~
if (isset($_GET['PAGE_N'])) {
$breadcrumb = acEgeGiaList_getBreadcrumb(array(
'cityId' => isset($CURRENT_CITY['ID'])? $CURRENT_CITY['ID']: null,
'subjectAreaCode' => isset($_GET['SUBJECTS_AREA'])? $_GET['SUBJECTS_AREA']: null,
'subjectCode' => isset($_GET['SUBJECTS'])? $_GET['SUBJECTS']: null
));
if ($breadcrumb) {
foreach ($breadcrumb as $item_) {
$APPLICATION->AddChainItem($item_['name'], $item_['url']);
}
}
}
?>
$APPLICATION->IncludeComponent(
'bitrix:breadcrumb',
'bread_alllink',
array(
'START_FROM' => 1, // skip "/"
'SITE_ID' => 's1'
)
);
?>
$componentResult=$APPLICATION->IncludeComponent(
'academica:filter.for.ege.gia',
'.default',
array(
'IBLOCK_ID_CITY' => Ac_Lib::CITY_IBLOCK_ID,
'IBLOCK_ID_OBLASTI' => Ac_Lib::SUBJECT_EGE_GIA_IBLOCK_ID,
'IBLOCK_ID_PREDMET' => Ac_Lib::SUBJECT_EGE_GIA_IBLOCK_ID,
'CACHE_TYPE' => 'N',
//'CACHE_TIME' => '7200',
'SET_TITLE' => 'Y'
),
false
);
//$strCity = preg_replace('/([\w]+)?(\.)?'.SITE_SERVER_NAME.'/', '$1', $_SERVER["HTTP_HOST"]);
if ($_GET["filter"] == "Y") {
Ac_Lib::setPageNumberCanonicalUrl();
$yandexStatIdRight = 52; // Id среза для Яндекс.Директ
$APPLICATION->IncludeComponent(
"academica:institutions.list.for.ege.gia",
".default",
array(
//"IBLOCK_ID_INSTITUTE" => "27",
//"IBLOCK_ID_COURSES" => AC_IBLOCK_EGEGIA_PROGRAM,
//"IBLOCK_ID_CITIES" => "35",
//"IBLOCK_ID_SUBJECTS" => AC_IBLOCK_EGEGIA_SUBJECT,
// favorite
"FAVORITE_IBLOCK_ID" => "56",
"FAVORITE_TYPE_ID" => "734593",
// filter
"SELECTED_SUBJECTS_AREA" => $_GET["SUBJECTS_AREA"],
"SUBJECTS" => $_GET["SUBJECTS"],
// page
"PAGE_NUMBER" => $_GET["PAGE_N"],
"PAGE_SIZE" => "10",
//"PAGER_TEMPLATE" => "foreinlang__prof",
// cache
"CACHE_TYPE" => "A",
"CACHE_TIME" => 3600,
),
false
);
// Текст под списком
/*
* Мы за идентификаторами предметов 2 раза ходить не будем
* на странице уже есть компонеты которые обращаются к базе и выбирают из
* воспользуемся их работой
* $componentResult содержит результат работы компонента "форма фильтрации"
*/
if ($_REQUEST['PAGE_N'] == 1) {
if ($GLOBALS['CURRENT_CITY']) {
$APPLICATION->IncludeComponent(
'academica:egegia.article_link',
'',
array(
'cityId' => $GLOBALS['CURRENT_CITY']['ID'],
'subjectAreaCode' => $_GET['SUBJECTS_AREA'],
'subjectCode' => $_GET['SUBJECTS'],
'count' => 3,
'cacheTime' => 7*24*60*60
)
);
}
$GLOBALS['arFilterComponent']['SECTION_ID'] = 26372;
$GLOBALS['arFilterComponent']['PROPERTY_SUBJECT_EGE_GIA'] = $componentResult['SUBJECT'];
if (!$componentResult['SUBJECT']) {
$GLOBALS['arFilterComponent']['PROPERTY_SUBJECT_AREA_EGE_GIA'] = $componentResult['SUBJECTS_AREA'];
}
$GLOBALS['arFilterComponent']['PROPERTY_CITY'] = $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 = 1; // 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'=>'ege_gia', 'moderateStatus'=>'approved'),
array('!cityId'=>$cityId_, 'learnSection'=>'ege_gia', 'moderateStatus'=>'approved'),
),
'LIMIT' => 3
)
);
}
else {
$APPLICATION->IncludeComponent(
'academica:review.review_list_preview',
'',
array(
'TITLE' => 'Последние отзывы',
'FILTER' => array('learnSection'=>'ege_gia', 'moderateStatus'=>'approved'),
'LIMIT' => 3
)
);
}
?>
// так делать не стоит конечно
include'../bitrix/templates/academica/inc/news-list-short.php';
include'../bitrix/templates/academica/inc/ctn-article.php';
}
?>