Last active
August 24, 2017 11:47
-
-
Save evrekhman/101ab46b982cefdab3c84a713ed0b9d8 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); | |
$templateData = array( | |
'TEMPLATE_THEME' => $this->GetFolder().'/themes/'.$arParams['TEMPLATE_THEME'].'/colors.css', | |
'TEMPLATE_CLASS' => 'bx-'.$arParams['TEMPLATE_THEME'] | |
); | |
if (isset($templateData['TEMPLATE_THEME'])) | |
{ | |
$this->addExternalCss($templateData['TEMPLATE_THEME']); | |
} | |
$this->addExternalCss("/bitrix/css/main/bootstrap.css"); | |
$this->addExternalCss("/bitrix/css/main/font-awesome.css"); | |
?> | |
<div class=" cat-filter bx-filter <?=$templateData["TEMPLATE_CLASS"]?> "> | |
<form name="<?echo $arResult["FILTER_NAME"]."_form"?>" action="<?echo $arResult["FORM_ACTION"]?>" method="get" class="smartfilter"> | |
<div class="cat-filter__row"> | |
<?foreach($arResult["HIDDEN"] as $arItem):?> | |
<input type="hidden" name="<?echo $arItem["CONTROL_NAME"]?>" id="<?echo $arItem["CONTROL_ID"]?>" value="<?echo $arItem["HTML_VALUE"]?>" /> | |
<?endforeach;?> | |
<?foreach($arResult["ITEMS"] as $key=>$arItem)//prices | |
{ | |
$key = $arItem["ENCODED_ID"]; | |
if(isset($arItem["PRICE"])): | |
if ($arItem["VALUES"]["MAX"]["VALUE"] - $arItem["VALUES"]["MIN"]["VALUE"] <= 0) | |
continue; | |
$step_num = 4; | |
$step = ($arItem["VALUES"]["MAX"]["VALUE"] - $arItem["VALUES"]["MIN"]["VALUE"]) / $step_num; | |
$prices = array(); | |
if (Bitrix\Main\Loader::includeModule("currency")) | |
{ | |
for ($i = 0; $i < $step_num; $i++) | |
{ | |
$prices[$i] = CCurrencyLang::CurrencyFormat($arItem["VALUES"]["MIN"]["VALUE"] + $step*$i, $arItem["VALUES"]["MIN"]["CURRENCY"], false); | |
} | |
$prices[$step_num] = CCurrencyLang::CurrencyFormat($arItem["VALUES"]["MAX"]["VALUE"], $arItem["VALUES"]["MAX"]["CURRENCY"], false); | |
} | |
else | |
{ | |
$precision = $arItem["DECIMALS"]? $arItem["DECIMALS"]: 0; | |
for ($i = 0; $i < $step_num; $i++) | |
{ | |
$prices[$i] = number_format($arItem["VALUES"]["MIN"]["VALUE"] + $step*$i, $precision, ".", ""); | |
} | |
$prices[$step_num] = number_format($arItem["VALUES"]["MAX"]["VALUE"], $precision, ".", ""); | |
} | |
endif; | |
} | |
//not prices | |
foreach($arResult["ITEMS"] as $key=>$arItem) { | |
if ( | |
empty($arItem["VALUES"]) | |
|| isset($arItem["PRICE"]) | |
) | |
continue; | |
if ( | |
$arItem["DISPLAY_TYPE"] == "A" | |
&& ( | |
$arItem["VALUES"]["MAX"]["VALUE"] - $arItem["VALUES"]["MIN"]["VALUE"] <= 0 | |
) | |
) | |
continue; | |
} | |
?> | |
<?/* <span class="bx-filter-container-modef"></span> | |
<div class="bx-filter-parameters-box-title" onclick="smartFilter.hideFilterProps(this)"> | |
<span class="bx-filter-parameters-box-hint"><?=$arItem["NAME"]?> | |
<?if ($arItem["FILTER_HINT"] <> ""):?> | |
<i id="item_title_hint_<?echo $arItem["ID"]?>" class="fa fa-question-circle"></i> | |
<script type="text/javascript"> | |
new top.BX.CHint({ | |
parent: top.BX("item_title_hint_<?echo $arItem["ID"]?>"), | |
show_timeout: 10, | |
hide_timeout: 200, | |
dx: 2, | |
preventHide: true, | |
min_width: 250, | |
hint: '<?= CUtil::JSEscape($arItem["FILTER_HINT"])?>' | |
}); | |
</script> | |
<?endif?> | |
<i data-role="prop_angle" class="fa fa-angle-<?if ($arItem["DISPLAY_EXPANDED"]== "Y"):?>up<?else:?>down<?endif?>"></i> | |
</span> | |
</div> */?> | |
<? | |
$arCur = current($arResult["ITEMS"][22]["VALUES"]); | |
$checkedItemExist = false; | |
//СПИСОК | |
?> | |
<div class="cat-filter__col1"> | |
<div class="form-group"> | |
<div class="col-xs-4"> | |
<label class="control-label cat-filter__label" for=""><?=$arResult["ITEMS"][22]["NAME"]?></label> | |
</div> | |
<div class="col-xs-6"> | |
<div class="form-control-select-outer bx-filter-select-container"> | |
<div class="form-control" onclick="smartFilter.showDropDownPopup(this, '<?=CUtil::JSEscape($key)?>')"> | |
<div class="bx-filter-select-text" data-role="currentOption"> | |
<? | |
foreach ($arResult["ITEMS"][22]["VALUES"] as $val => $ar) | |
{ | |
if ($ar["CHECKED"]) | |
{ | |
echo $ar["VALUE"]; | |
$checkedItemExist = true; | |
} | |
} | |
if (!$checkedItemExist) | |
{ | |
echo GetMessage("CT_BCSF_FILTER_ALL"); | |
} | |
?> | |
</div> | |
<div class="bx-filter-select-arrow"></div> | |
<input | |
style="display: none" | |
type="radio" | |
name="<?=$arCur["CONTROL_NAME_ALT"]?>" | |
id="<? echo "all_".$arCur["CONTROL_ID"] ?>" | |
value="" | |
/> | |
<?foreach ($arResult["ITEMS"][22]["VALUES"] as $val => $ar):?> | |
<input | |
style="display: none" | |
type="radio" | |
name="<?=$ar["CONTROL_NAME_ALT"]?>" | |
id="<?=$ar["CONTROL_ID"]?>" | |
value="<? echo $ar["HTML_VALUE_ALT"] ?>" | |
<? echo $ar["CHECKED"]? 'checked="checked"': '' ?> | |
/> | |
<?endforeach?> | |
<div class="bx-filter-select-popup" data-role="dropdownContent" style="display: none;"> | |
<ul> | |
<li> | |
<label for="<?="all_".$arCur["CONTROL_ID"]?>" class="bx-filter-param-label" data-role="label_<?="all_".$arCur["CONTROL_ID"]?>" onclick="smartFilter.selectDropDownItem(this, '<?=CUtil::JSEscape("all_".$arCur["CONTROL_ID"])?>')"> | |
<? echo GetMessage("CT_BCSF_FILTER_ALL"); ?> | |
</label> | |
</li> | |
<? | |
foreach ($arResult["ITEMS"][22]["VALUES"] as $val => $ar): | |
$class = ""; | |
if ($ar["CHECKED"]) | |
$class.= " selected"; | |
if ($ar["DISABLED"]) | |
$class.= " disabled"; | |
?> | |
<li> | |
<label for="<?=$ar["CONTROL_ID"]?>" class="bx-filter-param-label<?=$class?>" data-role="label_<?=$ar["CONTROL_ID"]?>" onclick="smartFilter.selectDropDownItem(this, '<?=CUtil::JSEscape($ar["CONTROL_ID"])?>')"><?=$ar["VALUE"]?></label> | |
</li> | |
<?endforeach?> | |
</ul> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<div class="form-group"> | |
<div class="col-xs-4"> </div> | |
<div class="col-xs-8"> | |
<div class="filter-on-date"> | |
<span class="filter-on-date__text">Показать объявления</span> | |
<a class="filter-on-date__item" href="#">За вчера</a> | |
<a class="filter-on-date__item" href="#">За неделю</a> | |
<a class="filter-on-date__item" href="#">За месяц</a> | |
</div> | |
</div> | |
</div> | |
</div> | |
<? | |
//ПОЛЗУНОК //ПОЛЗУНОК //ПОЛЗУНОК //ПОЛЗУНОК //ПОЛЗУНОК?> | |
<div class="cat-filter__col2-2"> | |
<div class="col-xs-6 bx-filter-parameters-box-container-block bx-left"> | |
<i class="bx-ft-sub"><?=GetMessage("CT_BCSF_FILTER_FROM")?></i> | |
<div class="bx-filter-input-container"> | |
<input | |
class="min-price" | |
type="text" | |
name="<?echo $arResult["ITEMS"][27]["VALUES"]["MIN"]["CONTROL_NAME"]?>" | |
id="<?echo $arResult["ITEMS"][27]["VALUES"]["MIN"]["CONTROL_ID"]?>" | |
value="<?echo $arResult["ITEMS"][27]["VALUES"]["MIN"]["HTML_VALUE"]?>" | |
size="5" | |
onkeyup="smartFilter.keyup(this)" | |
/> | |
</div> | |
</div> | |
<div class="col-xs-6 bx-filter-parameters-box-container-block bx-right"> | |
<i class="bx-ft-sub"><?=GetMessage("CT_BCSF_FILTER_TO")?></i> | |
<div class="bx-filter-input-container"> | |
<input | |
class="max-price" | |
type="text" | |
name="<?echo $arResult["ITEMS"][27]["VALUES"]["MAX"]["CONTROL_NAME"]?>" | |
id="<?echo $arResult["ITEMS"][27]["VALUES"]["MAX"]["CONTROL_ID"]?>" | |
value="<?echo $arResult["ITEMS"][27]["VALUES"]["MAX"]["HTML_VALUE"]?>" | |
size="5" | |
onkeyup="smartFilter.keyup(this)" | |
/> | |
</div> | |
</div> | |
<div class="col-xs-10 col-xs-offset-1 bx-ui-slider-track-container"> | |
<div class="bx-ui-slider-track" id="drag_track_<?=$key?>"> | |
<? | |
$precision = $arResult["ITEMS"][27]["DECIMALS"]? $arResult["ITEMS"][27]["DECIMALS"]: 0; | |
$step = ($arResult["ITEMS"][27]["VALUES"]["MAX"]["VALUE"] - $arResult["ITEMS"][27]["VALUES"]["MIN"]["VALUE"]) / 4; | |
$value1 = number_format($arResult["ITEMS"][27]["VALUES"]["MIN"]["VALUE"], $precision, ".", ""); | |
$value2 = number_format($arResult["ITEMS"][27]["VALUES"]["MIN"]["VALUE"] + $step, $precision, ".", ""); | |
$value3 = number_format($arResult["ITEMS"][27]["VALUES"]["MIN"]["VALUE"] + $step * 2, $precision, ".", ""); | |
$value4 = number_format($arResult["ITEMS"][27]["VALUES"]["MIN"]["VALUE"] + $step * 3, $precision, ".", ""); | |
$value5 = number_format($arResult["ITEMS"][27]["VALUES"]["MAX"]["VALUE"], $precision, ".", ""); | |
?> | |
<div class="bx-ui-slider-part p1"><span><?=$value1?></span></div> | |
<div class="bx-ui-slider-part p2"><span><?=$value2?></span></div> | |
<div class="bx-ui-slider-part p3"><span><?=$value3?></span></div> | |
<div class="bx-ui-slider-part p4"><span><?=$value4?></span></div> | |
<div class="bx-ui-slider-part p5"><span><?=$value5?></span></div> | |
<div class="bx-ui-slider-pricebar-vd" style="left: 0;right: 0;" id="colorUnavailableActive_<?=$key?>"></div> | |
<div class="bx-ui-slider-pricebar-vn" style="left: 0;right: 0;" id="colorAvailableInactive_<?=$key?>"></div> | |
<div class="bx-ui-slider-pricebar-v" style="left: 0;right: 0;" id="colorAvailableActive_<?=$key?>"></div> | |
<div class="bx-ui-slider-range" id="drag_tracker_<?=$key?>" style="left: 0;right: 0;"> | |
<a class="bx-ui-slider-handle left" style="left:0;" href="javascript:void(0)" id="left_slider_<?=$key?>"></a> | |
<a class="bx-ui-slider-handle right" style="right:0;" href="javascript:void(0)" id="right_slider_<?=$key?>"></a> | |
</div> | |
</div> | |
</div> | |
<? | |
$arJsParams = array( | |
"leftSlider" => 'left_slider_'.$key, | |
"rightSlider" => 'right_slider_'.$key, | |
"tracker" => "drag_tracker_".$key, | |
"trackerWrap" => "drag_track_".$key, | |
"minInputId" => $arResult["ITEMS"][27]["VALUES"]["MIN"]["CONTROL_ID"], | |
"maxInputId" => $arResult["ITEMS"][27]["VALUES"]["MAX"]["CONTROL_ID"], | |
"minPrice" => $arResult["ITEMS"][27]["VALUES"]["MIN"]["VALUE"], | |
"maxPrice" => $arResult["ITEMS"][27]["VALUES"]["MAX"]["VALUE"], | |
"curMinPrice" => $arResult["ITEMS"][27]["VALUES"]["MIN"]["HTML_VALUE"], | |
"curMaxPrice" => $arResult["ITEMS"][27]["VALUES"]["MAX"]["HTML_VALUE"], | |
"fltMinPrice" => intval($arResult["ITEMS"][27]["VALUES"]["MIN"]["FILTERED_VALUE"]) ? $arResult["ITEMS"][27]["VALUES"]["MIN"]["FILTERED_VALUE"] : $arResult["ITEMS"][27]["VALUES"]["MIN"]["VALUE"] , | |
"fltMaxPrice" => intval($arResult["ITEMS"][27]["VALUES"]["MAX"]["FILTERED_VALUE"]) ? $arResult["ITEMS"][27]["VALUES"]["MAX"]["FILTERED_VALUE"] : $arResult["ITEMS"][27]["VALUES"]["MAX"]["VALUE"], | |
"precision" => $arResult["ITEMS"][27]["DECIMALS"]? $arResult["ITEMS"][27]["DECIMALS"]: 0, | |
"colorUnavailableActive" => 'colorUnavailableActive_'.$key, | |
"colorAvailableActive" => 'colorAvailableActive_'.$key, | |
"colorAvailableInactive" => 'colorAvailableInactive_'.$key, | |
); | |
?> | |
<script type="text/javascript"> | |
BX.ready(function(){ | |
window['trackBar<?=$key?>'] = new BX.Iblock.SmartFilter(<?=CUtil::PhpToJSObject($arJsParams)?>); | |
}); | |
</script> | |
</div> | |
<? | |
?> | |
<div class="cat-filter__col2-3"> | |
<?foreach($arResult["ITEMS"][23]["VALUES"] as $val => $ar):?> | |
<div class="checkbox"> | |
<label data-role="label_<?=$ar["CONTROL_ID"]?>" class="bx-filter-param-label <? echo $ar["DISABLED"] ? 'disabled': '' ?>" for="<? echo $ar["CONTROL_ID"] ?>"> | |
<span class="bx-filter-input-checkbox"> | |
<input | |
type="checkbox" | |
value="<? echo $ar["HTML_VALUE"] ?>" | |
name="<? echo $ar["CONTROL_NAME"] ?>" | |
id="<? echo $ar["CONTROL_ID"] ?>" | |
<? echo $ar["CHECKED"]? 'checked="checked"': '' ?> | |
onclick="smartFilter.click(this)" | |
/> | |
<span class="bx-filter-param-text" title="<?=$ar["VALUE"];?>"><?=$ar["VALUE"];?><? | |
if ($arParams["DISPLAY_ELEMENT_COUNT"] !== "N" && isset($ar["ELEMENT_COUNT"])): | |
?> (<span data-role="count_<?=$ar["CONTROL_ID"]?>"><? echo $ar["ELEMENT_COUNT"]; ?></span>)<? | |
endif;?></span> | |
</span> | |
</label> | |
</div> | |
<?endforeach;?> | |
<?foreach($arResult["ITEMS"][25]["VALUES"] as $val => $ar):?> | |
<div class="checkbox"> | |
<label data-role="label_<?=$ar["CONTROL_ID"]?>" class="bx-filter-param-label <? echo $ar["DISABLED"] ? 'disabled': '' ?>" for="<? echo $ar["CONTROL_ID"] ?>"> | |
<span class="bx-filter-input-checkbox"> | |
<input | |
type="checkbox" | |
value="<? echo $ar["HTML_VALUE"] ?>" | |
name="<? echo $ar["CONTROL_NAME"] ?>" | |
id="<? echo $ar["CONTROL_ID"] ?>" | |
<? echo $ar["CHECKED"]? 'checked="checked"': '' ?> | |
onclick="smartFilter.click(this)" | |
/> | |
<span class="bx-filter-param-text" title="<?=$ar["VALUE"];?>"><?=$ar["VALUE"];?><? | |
if ($arParams["DISPLAY_ELEMENT_COUNT"] !== "N" && isset($ar["ELEMENT_COUNT"])): | |
?> (<span data-role="count_<?=$ar["CONTROL_ID"]?>"><? echo $ar["ELEMENT_COUNT"]; ?></span>)<? | |
endif;?></span> | |
</span> | |
</label> | |
</div> | |
<?endforeach;?> | |
</div> | |
</div> | |
<div class="cat-filter__footer"> | |
<input | |
class="btn btn-danger" | |
type="submit" | |
id="set_filter" | |
name="set_filter" | |
value="<?=GetMessage("CT_BCSF_SET_FILTER")?>" | |
/> | |
<input | |
class="btn btn-danger" | |
type="submit" | |
id="del_filter" | |
name="del_filter" | |
value="<?=GetMessage("CT_BCSF_DEL_FILTER")?>" | |
/> | |
<div class="bx-filter-popup-result <?if ($arParams["FILTER_VIEW_MODE"] == "VERTICAL") echo $arParams["POPUP_POSITION"]?>" id="modef" <?if(!isset($arResult["ELEMENT_COUNT"])) echo 'style="display:none"';?> style="display: inline-block;"> | |
<?echo GetMessage("CT_BCSF_FILTER_COUNT", array("#ELEMENT_COUNT#" => '<span id="modef_num">'.intval($arResult["ELEMENT_COUNT"]).'</span>'));?> | |
<span class="arrow"></span> | |
<br/> | |
<a href="<?echo $arResult["FILTER_URL"]?>" target=""><?echo GetMessage("CT_BCSF_FILTER_SHOW")?></a> | |
</div> | |
</div> | |
</form> | |
<script type="text/javascript"> | |
var smartFilter = new JCSmartFilter('<?echo CUtil::JSEscape($arResult["FORM_ACTION"])?>', '<?=CUtil::JSEscape($arParams["FILTER_VIEW_MODE"])?>', <?=CUtil::PhpToJSObject($arResult["JS_FILTER_PARAMS"])?>); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment