Your IP : 3.144.37.240


Current Path : /var/www/u0635749/data/www/hobbyclick.ru/hobbyclick.ru/ajax/
Upload File :
Current File : /var/www/u0635749/data/www/hobbyclick.ru/hobbyclick.ru/ajax/ajax.php

<?
require_once($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php");

use Bitrix\Main\Application;
use Tequila\Metods\OrmMetod;

CModule::IncludeModule('iblock');
global $USER;
$request = Application::getInstance()->getContext()->getRequest();
$arResult = array();
$method = $request->getRequestMethod();
if ($method == 'GET') {
    $filter = $request->getQueryList()->toArray();
    GLOBAL $APPLICATION;
    $url = $APPLICATION->GetCurPage();
    $arProp = [
        'ID_OFFER',
        'ID_PRODUCT',
        'ID_TEACHER',
        'ID_HALL',
        'TREND',
        'FILTER_STRESS',
        'FILTER_REGION',
        'FILTER_MOTIV',
        'AREA_CITY',
        'METRO',
        'LEVEL',
        'AGE',
        'DAYTIME',
        'FILTER_GENDER',
        'FILTER_FORMAT',
        'RENT'
    ];
    if (!empty($filter)) {
        $arFilter = array_diff($filter, array(''));
        foreach ($arFilter as $key => $filter) {
            if (!in_array($key, $arProp)) {
                unset($arFilter[$key]);
            }
        }
        if (!empty($arFilter)) {
            switch ($request->getQuery('filter_type')) {
                case 'HALL':
                    $res = OrmMetod::getOrmHall($arFilter);
                    $offer = OrmMetod::getOrmOffer($arFilter);
                    break;
                case 'OFFER':
                    $res = OrmMetod::getOrmOffer($arFilter);
                    break;
                case 'TEACHER':
                    $res = OrmMetod::getOrmTeacher($arFilter);
                    break;
            }
        }
    }
    $result = $res;
    unset($result['ID']['-1']);
    echo count($result['ID']);
}

require_once($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php");