Created
December 28, 2015 13:54
-
-
Save vladimmi/24f5991f8f2d0d5208a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die(); | |
/** @var array $arParams */ | |
/** @var array $arResult */ | |
/** @global CMain $APPLICATION */ | |
/** @global CUser $USER */ | |
/** @global CDatabase $DB */ | |
/** @var CBitrixComponentTemplate $this */ | |
/** @var string $templateName */ | |
/** @var string $templateFile */ | |
/** @var string $templateFolder */ | |
/** @var string $componentPath */ | |
/** @var CBitrixComponent $component */ | |
$this->setFrameMode(true); | |
function length_unit_plural($number, $w1, $w2, $w5) | |
{ | |
$n10 = $number % 10; | |
$n100 = ($number % 100 - $n10) / 10; | |
if ($n10 == 1 && $n100 != 1) return $w1; | |
elseif (($n10 >= 2 && $n10 <= 4) && $n100 != 1) return $w2; | |
else return $w5; | |
} | |
?> | |
<?if(!count($arResult['ITEMS'])):?> | |
<div class="programs-not-found">Программы не найдены</div> | |
<?if(isset($_REQUEST['SMART_FILTER_PATH'])):?> | |
<script type="application/javascript"> | |
$(document).ready(function() { | |
setTimeout(function() { | |
alert('Поиск не дал результатов, попробуйте изменить условия поиска'); | |
}, 1000); | |
}); | |
</script> | |
<?endif;?> | |
<?endif;?> | |
<?foreach($arResult["ITEMS"] as $arElement):?> | |
<div class="block_programs"> | |
<img src="<?=CFile::GetPath($arElement['SCHOOL_DATA']['PROPERTY_LOGO_VALUE'])?>" alt="" /> | |
<h3><?=$arElement["NAME"]?></h3> | |
<p><a href="<?=$arElement['SCHOOL_DATA']['DETAIL_PAGE_URL']?>"><?=$arElement['SCHOOL_DATA']['PROPERTY_SHORT_NAME_VALUE']?></a> / <a href="<?=$arElement['SCHOOL_DATA']['PROPERTY_TOWNS_RU_CODE_DETAIL_PAGE_URL']?>"><?=$arElement['SCHOOL_DATA']['PROPERTY_TOWNS_RU_CODE_NAME']?></a></p> | |
<p class="pleft"> | |
<?if($arElement['DISPLAY_PROPERTIES']['courses_ru_code']['DISPLAY_VALUE']):?> | |
Направление: <strong><?=$arElement['DISPLAY_PROPERTIES']['courses_ru_code']['DISPLAY_VALUE']?></strong><br /> | |
<?endif;?> | |
<?if($arElement['DISPLAY_PROPERTIES']['levels_ru_code']['DISPLAY_VALUE']):?> | |
Уровень: <strong><?=$arElement['DISPLAY_PROPERTIES']['levels_ru_code']['DISPLAY_VALUE']?></strong><br /> | |
<?endif;?> | |
<?if(count($arElement['DISPLAY_PROPERTIES']['langs']['DISPLAY_VALUE'])):?> | |
Язык обучения: <strong><?=implode(', ', $arElement['DISPLAY_PROPERTIES']['langs']['DISPLAY_VALUE'])?></strong><br /> | |
<?endif;?> | |
<?if($arElement['DISPLAY_PROPERTIES']['length']['DISPLAY_VALUE']):?> | |
<?php | |
$length_unit = ''; | |
switch ($arElement['DISPLAY_PROPERTIES']['length_unit']['DISPLAY_VALUE']) { | |
case 'Годы': | |
$length_unit = length_unit_plural($arElement['DISPLAY_PROPERTIES']['length']['DISPLAY_VALUE'], 'год', 'года', 'лет'); | |
break; | |
case 'Месяцы': | |
$length_unit = length_unit_plural($arElement['DISPLAY_PROPERTIES']['length']['DISPLAY_VALUE'], 'месяц', 'месяца', 'месяцев'); | |
break; | |
case 'Недели': | |
$length_unit = length_unit_plural($arElement['DISPLAY_PROPERTIES']['length']['DISPLAY_VALUE'], 'неделя', 'недели', 'недель'); | |
break; | |
case 'Дни': | |
$length_unit = length_unit_plural($arElement['DISPLAY_PROPERTIES']['length']['DISPLAY_VALUE'], 'день', 'дня', 'дней'); | |
break; | |
case 'Часы': | |
$length_unit = length_unit_plural($arElement['DISPLAY_PROPERTIES']['length']['DISPLAY_VALUE'], 'час', 'часа', 'часов'); | |
break; | |
} | |
?> | |
Продолжительность: <strong><?=$arElement['DISPLAY_PROPERTIES']['length']['DISPLAY_VALUE']?> <?=$length_unit?></strong> | |
<?endif;?> | |
</p> | |
<p class="pleft"> | |
<?if(count($arElement['DISPLAY_PROPERTIES']['study_types']['DISPLAY_VALUE'])):?> | |
Форма обучения: <strong><?=implode(', ', $arElement['DISPLAY_PROPERTIES']['study_types']['DISPLAY_VALUE'])?></strong><br /> | |
<?endif;?> | |
Возможность бесплатного обучения: <strong><?=($arElement['DISPLAY_PROPERTIES']['free_possible']['DISPLAY_VALUE'] ? 'есть' : 'нет')?></strong><br /> | |
Стоимость обучения: <strong><?=$arElement['DISPLAY_PROPERTIES']['price']['DISPLAY_VALUE']?></strong> | |
</p> | |
<div> | |
<a href="#" class="add favor" el_id="<?=$arElement['ID']?>" el_type="programs"><span>добавить в избранное</span></a> | |
<a class="link_blue" href="<?=$arElement['DETAIL_PAGE_URL']?>">Подробнее о программе</a> | |
</div> | |
</div> | |
<?endforeach;?> | |
<p><?=$arResult["NAV_STRING"]?></p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment