* file that was distributed with this source code. */ if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) { die; } use Bitrix\Main\Application; use Bitrix\Main\Localization\Loc; use Bitrix\Main\Entity; use Bitrix\Main\Loader; use Bitrix\IBlock; use Citfact\FilterSubscribe\Model\SubscribeUserTable; Loc::loadMessages(__FILE__); Loader::includeModule('citfact.filter.subscribe'); $app = Application::getInstance(); $request = $app->getContext()->getRequest(); $arResult['COMPONENT_ID'] = CAjax::GetComponentID($this->getName(), $this->getTemplateName(), array()); $userId = $arParams['USER_ID']; $queryBuilder = new Entity\Query(SubscribeUserTable::getEntity()); $queryBuilder->registerRuntimeField('filter', array('data_type' => 'Citfact\\FilterSubscribe\\Model\\SubscribeTable', 'reference' => array('=this.FILTER_ID' => 'ref.ID')))->setSelect(array('*', 'filter'))->setOrder(array('ID' => 'DESC'))->setFilter(array('USER_ID' => $userId)); $filterResult = $queryBuilder->exec(); while ($filter = $filterResult->fetch()) { $arResult['ITEMS'][] = $filter; $arResult['IBLOCKS_ID'][] = $filter['IBLOCK_ID']; if ($filter['SECTION_ID'] > 0) { $arResult['SECTION_ID'][] = $filter['SECTION_ID']; } } if (array_key_exists('ITEMS', $arResult)) { $filterLexer = new \Citfact\FilterSubscribe\FilterLexer(); foreach ($arResult['ITEMS'] as $key => $filter) { $arResult['ITEMS'][$key]['FILTER_LINK'] = $filterLexer->getFilterUniqId(unserialize($filter['FILTER']));
function CheckSession() { if ($this->componentID = CAjax::GetComponentID($this->componentName, $this->componentTemplate, $this->arParams['AJAX_OPTION_ADDITIONAL'])) { if ($current_session = CAjax::GetSession()) { if ($this->componentID == $current_session) { $this->bAjaxSession = true; return true; } else { return false; } } return true; } return false; }
/** * Restarts buffer if the ajax-request */ private function startAjax() { if ($this->arParams['USE_AJAX'] !== 'Y') { return false; } if (strlen($this->arParams['AJAX_PARAM_NAME']) <= 0) { $this->arParams['AJAX_PARAM_NAME'] = 'compid'; } if (strlen($this->arParams['AJAX_COMPONENT_ID']) <= 0) { $this->arParams['AJAX_COMPONENT_ID'] = \CAjax::GetComponentID($this->getName(), $this->getTemplateName(), $this->ajaxComponentIdSalt); } if ($this->isAjax()) { global $APPLICATION; if ($this->arParams['AJAX_HEAD_RELOAD'] === 'Y') { $APPLICATION->ShowAjaxHead(); } else { $APPLICATION->RestartBuffer(); } if ($this->arParams['AJAX_TYPE'] === 'JSON') { header('Content-Type: application/json'); } if (strlen($this->arParams['AJAX_TEMPLATE_PAGE']) > 0) { $this->templatePage = basename($this->arParams['AJAX_TEMPLATE_PAGE']); } } }