57 'TYPE' => self::RESULT_ACTION_TYPE_NONE,
59 'DATA_TYPE' => self::RESULT_DATA_TYPE_NONE,
65 self::RESULT_ACTION_TYPE_EVENT,
66 self::RESULT_ACTION_TYPE_CALLBACK,
67 self::RESULT_ACTION_TYPE_CLASS_METHOD
69 self::MODE_DIALOG => [
70 self::RESULT_ACTION_TYPE_EVENT,
71 self::RESULT_ACTION_TYPE_CALLBACK,
72 self::RESULT_ACTION_TYPE_CLASS_METHOD
74 self::MODE_SLIDER => [
75 self::RESULT_ACTION_TYPE_EVENT,
76 self::RESULT_ACTION_TYPE_CALLBACK,
77 self::RESULT_ACTION_TYPE_CLASS_METHOD,
78 self::RESULT_ACTION_TYPE_SLIDER
88 parent::__construct($component);
106 if (!is_array($params))
113 $params[
'MULTIPLE_SELECT'] = (isset($params[
'MULTIPLE_SELECT']) && $params[
'MULTIPLE_SELECT'] ===
'Y');
115 $params[
'BASE_LINK'] = (isset($params[
'BASE_LINK']) ? $params[
'BASE_LINK'] :
'');
117 $params[
'IBLOCK_ID'] = (isset($params[
'IBLOCK_ID']) ? (int)$params[
'IBLOCK_ID'] : 0);
118 if ($params[
'IBLOCK_ID'] < 0)
119 $params[
'IBLOCK_ID'] = 0;
121 $params[
'USE_MODE'] = (isset($params[
'USE_MODE']) && is_string($params[
'USE_MODE'])
122 ? trim($params[
'USE_MODE'])
126 $params[
'RESULT_ACTION_TYPE'] = (isset($params[
'RESULT_ACTION_TYPE']) && is_string($params[
'RESULT_ACTION_TYPE'])
127 ? trim($params[
'RESULT_ACTION_TYPE'])
128 : self::RESULT_ACTION_TYPE_NONE
131 if (!isset($params[
'RESULT_ACTION_NAME']))
132 $params[
'RESULT_ACTION_NAME'] =
'';
133 if (!is_string($params[
'RESULT_ACTION_NAME']) && !is_array($params[
'RESULT_ACTION_NAME']))
134 $params[
'RESULT_ACTION_NAME'] =
'';
135 $params[
'RESULT_ACTION_NAME'] = preg_replace(
'/[^a-zA-Z0-9]/',
'', $params[
'RESULT_ACTION_NAME']);
136 if (empty($params[
'RESULT_ACTION_NAME']))
137 $params[
'RESULT_ACTION_TYPE'] = self::RESULT_ACTION_TYPE_NONE;
139 $params[
'RESULT_DATA_TYPE'] = (isset($params[
'RESULT_DATA_TYPE']) && is_string($params[
'RESULT_DATA_TYPE'])
140 ? $params[
'RESULT_DATA_TYPE']
141 : self::RESULT_DATA_TYPE_NONE
143 if ($params[
'RESULT_DATA_TYPE'] == self::RESULT_DATA_TYPE_SET)
144 $params[
'MULTIPLE_SELECT'] =
false;
146 $params[
'RESULT_DATA_SET_LIST'] = (isset($params[
'RESULT_DATA_SET_LIST']) && is_array($params[
'RESULT_DATA_SET_LIST'])
147 ? $params[
'RESULT_DATA_SET_LIST']
151 $params[
'PAGETITLE_FILTER'] = (isset($params[
'PAGETITLE_FILTER']) && $params[
'PAGETITLE_FILTER'] ===
'Y' ?
'Y' :
'N');
166 $this->includeComponentTemplate();
183 return $this->errorCollection->getErrorByCode($code);
191 return $this->errorCollection->toArray();
200 static::validateListParameters(
209 if (!empty($params[
'GRID_ID']))
211 if (empty($params[
'FILTER_ID']))
213 $params[
'FILTER_ID'] = static::createFilterId($params[
'GRID_ID']);
215 if (empty($params[
'NAVIGATION_ID']))
217 $params[
'NAVIGATION_ID'] = static::createNavigationId($params[
'GRID_ID']);
227 $this->implicitPageNavigation =
true;
235 return $this->implicitPageNavigation;
243 $this->useGridFilter =
false;
251 return $this->useGridFilter;
260 if (!isset($this->resultActionMap[$mode]))
262 $this->useMode = $mode;
270 return $this->useMode;
278 return ($this->useMode == self::MODE_PAGE);
286 return ($this->useMode == self::MODE_DIALOG);
294 return ($this->useMode == self::MODE_SLIDER);
306 $dataType = $this->arParams[
'RESULT_DATA_TYPE'];
308 $dataType != self::RESULT_DATA_TYPE_SET
309 && $dataType != self::RESULT_DATA_TYPE_FILTER
311 $dataType = self::RESULT_DATA_TYPE_NONE;
314 case self::RESULT_DATA_TYPE_SET:
315 if (empty($this->arParams[
'RESULT_DATA_SET_LIST']))
317 $dataType = self::RESULT_DATA_TYPE_NONE;
320 case self::RESULT_DATA_TYPE_FILTER:
323 $dataType = self::RESULT_DATA_TYPE_NONE;
329 $this->resultAction[
'NAME'] = $this->arParams[
'RESULT_ACTION_NAME'];
330 $this->resultAction[
'DATA_TYPE'] = $dataType;
331 if ($dataType == self::RESULT_DATA_TYPE_SET)
332 $this->resultAction[
'DATA_SET'] = $this->arParams[
'RESULT_DATA_SET_LIST'];
342 && $this->resultAction[
'TYPE'] == self::RESULT_ACTION_TYPE_SLIDER
343 && $this->resultAction[
'DATA_TYPE'] == self::RESULT_DATA_TYPE_FILTER
354 'IBLOCK_NAME' =>
null,
355 'IBLOCK_TYPE_ID' =>
null,
356 'IBLOCK_SECTIONS' =>
'N',
357 'IBLOCK_SECTIONS_NAME' =>
null,
358 'IBLOCK_ELEMENTS_NAME' =>
null,
359 'SHOW_XML_ID' => (string)Main\
Config\Option::get(
'iblock',
'show_xml_id') ===
'Y',
362 if ($this->arParams[
'IBLOCK_ID'] > 0)
364 $iterator = Iblock\IblockTable::getList([
365 'select' => [
'ID',
'IBLOCK_TYPE_ID',
'NAME'],
366 'filter' => [
'=ID' => $this->arParams[
'IBLOCK_ID'],
'=ACTIVE' =>
'Y']
368 $iblock = $iterator->fetch();
372 $description[
'IBLOCK_ID'] = $this->arParams[
'IBLOCK_ID'];
373 $description[
'NAME'] = $iblock[
'NAME'];
374 $iterator = Iblock\TypeTable::getList([
375 'select' => [
'ID',
'SECTIONS'],
376 'filter' => [
'=ID' => $iblock[
'IBLOCK_TYPE_ID']]
378 $type = $iterator->fetch();
382 $description[
'IBLOCK_TYPE_ID'] = $iblock[
'IBLOCK_TYPE_ID'];
383 $description[
'IBLOCK_SECTIONS'] = $type[
'SECTIONS'];
385 $iterator = Iblock\TypeLanguageTable::getList([
386 'select' => [
'IBLOCK_TYPE_ID',
'SECTIONS_NAME',
'ELEMENTS_NAME'],
387 'filter' => [
'=IBLOCK_TYPE_ID' => $iblock[
'IBLOCK_TYPE_ID'],
'=LANGUAGE_ID' => LANGUAGE_ID]
389 $messages = $iterator->fetch();
391 if (!empty($messages))
393 $description[
'IBLOCK_SECTIONS_NAME'] = $messages[
'SECTIONS_NAME'];
394 $description[
'IBLOCK_ELEMENTS_NAME'] = $messages[
'ELEMENTS_NAME'];
399 $description[
'FILTER_ALL'] =
Loc::getMessage(
'ENTITY_SELECTOR_SLIDER_FILTER_ALL_ELEMENTS');
422 $this->defaultSettings = [
425 $this->defaultSettings[
'FILTER_ID'] = static::createFilterId($this->defaultSettings[
'GRID_ID']);
426 $this->defaultSettings[
'NAVIGATION_ID'] = static::createNavigationId($this->defaultSettings[
'GRID_ID']);
427 $this->defaultSettings[
'PAGE_SIZES'] = [5, 10, 20, 50, 100];
435 return preg_replace(
'/[^a-zA-Z0-9_:\\[\\]]/',
'', get_called_class());
444 return $gridId.
'_FILTER';
453 return $gridId.
'_NAVIGATION';
461 $this->
setUseMode($this->arParams[
'USE_MODE']);
467 self::STORAGE_GRID => [
468 'GRID_ID',
'NAVIGATION_ID',
'PAGE_SIZES'
470 self::STORAGE_GRID_FILTER => [
474 foreach ($paramsList as $entity => $list)
476 foreach ($list as $param)
478 $value = (!empty($this->arParams[$param])
479 ? $this->arParams[$param]
480 : $this->defaultSettings[$param]
485 unset($param, $list, $entity, $paramsList);
503 $entityFilter = Main\Filter\Factory::createEntityFilter(
504 Iblock\Filter\EntityList::ELEMENT,
507 'IBLOCK_ID' => $this->
getStorageItem(self::STORAGE_ENTITY_IBLOCK,
'IBLOCK_ID')
511 $usedFields = $this->gridFilterConfig->getUsedFields();
512 if(empty($usedFields))
514 $usedFields = $entityFilter->getDefaultFieldIDs();
520 'FILTER' => $entityFilter->getFieldArrays($usedFields),
521 'FILTER_PRESETS' => [],
523 'ENABLE_LABEL' =>
true,
524 'ENABLE_LIVE_SEARCH' =>
true,
527 'getList' =>
'iblock.filter.element.getlist',
528 'getField' =>
'iblock.filter.element.getfield',
529 'componentName' => $this->getName(),
530 'signedParameters' => \Bitrix\Main\Component\ParameterSigner::signParameters(
533 'IBLOCK_ID' => $this->
getStorageItem(self::STORAGE_ENTITY_IBLOCK,
'IBLOCK_ID')
543 'COLUMNS' => array_values($this->
getColumns()),
545 'NAV_OBJECT' => $this->navigation,
546 '~NAV_PARAMS' => [
'SHOW_ALWAYS' =>
false],
547 'SHOW_ROW_CHECKBOXES' => $this->arParams[
'MULTIPLE_SELECT'],
548 'SHOW_GRID_SETTINGS_MENU' =>
true,
549 'SHOW_PAGINATION' =>
true,
550 'SHOW_PAGESIZE' =>
true,
551 'SHOW_SELECTED_COUNTER' => $this->arParams[
'MULTIPLE_SELECT'],
552 'SHOW_TOTAL_COUNTER' =>
true,
554 "TOTAL_ROWS_COUNT" => $this->navigation->getRecordCount(),
556 'ALLOW_COLUMNS_SORT' =>
true,
557 'ALLOW_COLUMNS_RESIZE' =>
true,
558 'ALLOW_SORT' =>
true,
560 'AJAX_OPTION_JUMP' =>
'N',
561 'AJAX_OPTION_STYLE' =>
'N',
562 'AJAX_OPTION_HISTORY' =>
'N'
565 $grid[
'NAV_STRING'] = $this->navigationString;
567 $grid[
'PAGE_SIZES'] = [];
570 $grid[
'PAGE_SIZES'][] = [
571 'NAME' => (string)$size,
577 $grid[
'SORT'] = $this->
getStorageItem(self::STORAGE_GRID,
'GRID_ORDER');
578 $grid[
'SORT_VARS'] = $this->
getStorageItem(self::STORAGE_GRID,
'GRID_ORDER_VARS');
584 'RESULT_ACTION' => $this->resultAction,
586 'PAGETITLE' => $this->arParams[
'PAGETITLE_FILTER']
593 'SETTINGS' => $settings
595 unset($grid, $filter);
611 $APPLICATION->SetAdditionalCSS($styleList);
629 '/bitrix/css/main/grid/webform-button.css'
644 $node = (string)$node;
645 if ($node ===
'' || empty($nodeValues))
647 if (!isset($this->storage[$node]))
648 $this->storage[$node] = [];
649 $this->storage[$node] = array_merge($this->storage[$node], $nodeValues);
658 if (isset($this->storage[$node]))
659 return $this->storage[$node];
681 if (isset($this->storage[$node][$item]))
682 return $this->storage[$node][$item];
691 return $this->
getStorageItem(self::STORAGE_ENTITY_IBLOCK,
'SHOW_XML_ID');
707 return $this->
getStorageItem(self::STORAGE_GRID_FILTER,
'FILTER_ID');
715 return $this->
getStorageItem(self::STORAGE_GRID,
'NAVIGATION_ID');
752 $visibleColumns = [];
753 $visibleColumnsMap = [];
756 $userColumnsIndex = [];
758 if (!empty($userColumns))
760 $defaultList =
false;
761 $userColumnsIndex = array_fill_keys($userColumns,
true);
765 foreach (array_keys($columns) as $index)
769 || isset($userColumnsIndex[$index])
772 $visibleColumnsMap[$index] =
true;
773 $visibleColumns[$index] = $columns[$index];
778 unset($userColumns, $userColumnsIndex, $defaultList);
783 'COLUMNS' => $columns,
784 'VISIBLE_COLUMNS' => $visibleColumns,
785 'VISIBLE_COLUMNS_MAP' => $visibleColumnsMap
789 unset($visibleColumnsMap, $visibleColumns, $columns);
800 $this->navigation->allowAllRecords(
false);
801 $this->navigation->setPageSize($naviParams[
'nPageSize']);
803 $this->navigation->initFromUri();
812 return $this->gridConfig->getNavParams([
'nPageSize' => 20]);
825 'quickSearch' =>
true,
845 $result[
'ACTIVE'] = [
858 $result[
'XML_ID'] = [
860 'name' =>
Loc::getMessage(
'ENTITY_SELECTOR_FILTER_FIELD_XML_ID_MSGVER_1'),
886 return $this->
getStorageItem(self::STORAGE_GRID_FILTER,
'QUICK_SEARCH_FIELD');
894 return $this->
getStorageItem(self::STORAGE_GRID_FILTER,
'QUICK_SEARCH_DESCRIPTION');
916 $result[
'ACTIVE'] = [
919 'title' =>
Loc::getMessage(
'ENTITY_SELECTOR_GRID_COLUMN_TITLE_ACTIVE'),
925 $result[
'XML_ID'] = [
927 'name' =>
Loc::getMessage(
'ENTITY_SELECTOR_GRID_COLUMN_XML_ID_MSGVER_1'),
954 $result = $this->gridConfig->GetVisibleColumns();
957 $oldOptions = \CUserOptions::GetOption(
'list', $this->
getGridId(), []);
958 if (!empty($oldOptions[
'columns']))
960 $oldGridColumns = [];
961 $rawColumns = explode(
',', $oldOptions[
'columns']);
962 foreach ($rawColumns as $id)
966 $oldGridColumns[] = $id;
968 unset($id, $rawColumns);
969 if (!empty($oldGridColumns))
970 $result = $oldGridColumns;
971 unset($oldGridColumns);
976 $this->gridConfig->SetVisibleColumns($result);
978 if (!empty($result) && !in_array(
'ID', $result))
979 array_unshift($result,
'ID');
996 return $this->
getStorageItem(self::STORAGE_GRID,
'VISIBLE_COLUMNS');
1004 $result = [
'ID' =>
'DESC'];
1006 $sorting = $this->gridConfig->getSorting([
'sort' => $result]);
1008 $order = mb_strtolower(reset($sorting[
'sort']));
1009 if ($order !==
'asc')
1011 $field = key($sorting[
'sort']);
1016 if (!isset($column[
'sort']))
1018 if ($column[
'sort'] == $field)
1027 $result = [$field => $order];
1033 'GRID_ORDER_VARS' => $sorting[
'vars']
1037 unset($found, $field, $order, $sorting, $result);
1077 'QUICK_SEARCH_FIELD' =>
null,
1078 'QUICK_SEARCH_DESCRIPTION' => [
1084 if (!empty($fields))
1086 foreach (array_keys($fields) as $index)
1088 $row = $fields[$index];
1090 (!isset($row[
'quickSearch']) && !isset($row[
'quickSearchOnly']))
1091 || (isset($row[
'entity']) && $row[
'entity'] !=
'master')
1095 $result[
'QUICK_SEARCH_FIELD'] = $row[
'id'];
1096 $result[
'QUICK_SEARCH_DESCRIPTION'][
'FIELD'] = $row[
'id'];
1097 $result[
'QUICK_SEARCH_DESCRIPTION'][
'NAME'] = $row[
'name'];
1099 unset($index, $row);
1103 unset($fields, $result);
1115 if (!empty($preset))
1117 $this->gridFilterConfig->setFilterSettings(
1118 UI\Filter\Options::TMP_FILTER,
1126 $this->gridFilterConfig->save();
1152 $fields = $this->
getStorageItem(self::STORAGE_GRID,
'VISIBLE_COLUMNS_MAP');
1154 if ($titleField !==
'')
1155 $fields[$titleField] =
true;
1157 return array_keys($fields);
1168 if (!empty($userFilter))
1169 $result = array_merge($userFilter, $result);
1189 $iblockId = (int)$this->
getStorageItem(self::STORAGE_ENTITY_IBLOCK,
'IBLOCK_ID');
1191 $result[
'IBLOCK_ID'] = $iblockId;
1217 $filterValues = $this->gridFilterConfig->getFilter($fields);
1218 $filterRows = UI\Filter\Options::getRowsFromFields($filterValues);
1220 if (empty($filterRows))
1225 $checkQuickSearch = (
1226 $quickSearchField !==
null
1227 && isset($filterValues[
'FIND'])
1228 && is_string($filterValues[
'FIND'])
1229 && trim($filterValues[
'FIND']) !=
''
1232 if ($checkQuickSearch)
1234 $this->addFilterQuickSearchValue($result, $filterValues, $quickSearchField, $fields[$quickSearchField]);
1237 foreach ($filterRows as $id)
1239 if (!isset($fields[$id]))
1242 if ($checkQuickSearch && $id == $quickSearchField)
1245 switch ($fields[$id][
'type'])
1248 $this->addFilterNumberValue($result, $filterValues, $id, $fields[$id]);
1251 $this->addFilterDateValue($result, $filterValues, $id, $fields[$id]);
1254 $this->addFilterListValue($result, $filterValues, $id, $fields[$id]);
1256 case "custom_entity":
1260 $this->addFilterCheckboxValue($result, $filterValues, $id, $fields[$id]);
1262 case "dest_selector":
1263 $this->addFilterDestSelectorValue($result, $filterValues, $id, $fields[$id]);
1269 $this->addFilterStringValue($result, $filterValues, $id, $fields[$id]);
1274 unset($checkQuickSearch, $quickSearchField);
1275 unset($filterRows, $filterValues, $fields);
1286 return (isset($filter[
'master']) ? $filter[
'master'] : []);
1294 private function getFilterOperator(array $field, $operator)
1297 if ($operator ===
'')
1298 $operator =
'default';
1299 if (!empty($field[
'operators']) && is_array($field[
'operators']))
1301 if (isset($field[
'operators'][$operator]))
1302 $result = $field[
'operators'][$operator];
1303 elseif (isset($field[
'operators'][
'default']))
1304 $result = $field[
'operators'][
'default'];
1315 private function addFilterItems(array &$result, array $items, array $field)
1320 $entity = (isset($field[
'entity']) ? $field[
'entity'] :
'master');
1323 if (!isset($result[$entity]))
1324 $result[$entity] = [];
1325 $result[$entity] = array_merge($result[$entity], $items);
1337 private function addFilterQuickSearchValue(array &$result, array $filter, $fieldId, array $field)
1339 $findValue = trim($filter[
'FIND']);
1340 $operator = $this->getFilterOperator($field,
'quickSearch');
1341 if (is_string($operator))
1342 $fieldId = $operator.$fieldId;
1344 $this->addFilterItems($result, [$fieldId => $findValue], $field);
1354 private function addFilterNumberValue(array &$result, array $filter, $fieldId, array $field)
1356 $valueTypeIndex = $fieldId.
'_numsel';
1358 if (isset($filter[$valueTypeIndex]) && is_string($filter[$valueTypeIndex]))
1362 $minIndex = $fieldId.
'_from';
1363 $maxIndex = $fieldId.
'_to';
1365 $minValue = (isset($filter[$minIndex]) && is_string($filter[$minIndex]) ? trim($filter[$minIndex]) :
'');
1366 $maxValue = (isset($filter[$maxIndex]) && is_string($filter[$maxIndex]) ? trim($filter[$maxIndex]) :
'');
1368 switch ($filter[$valueTypeIndex])
1371 if ($minValue !==
'')
1373 $operator = $this->getFilterOperator($field,
'exact');
1374 if (is_string($operator))
1375 $fieldId = $operator.$fieldId;
1377 $items[$fieldId] = $minValue;
1381 if ($minValue !==
'' && $maxValue !==
'')
1383 $operator = $this->getFilterOperator($field,
'range');
1384 if (is_string($operator))
1385 $fieldId = $operator.$fieldId;
1387 $items[$fieldId] = [$minValue, $maxValue];
1391 if ($minValue !==
'')
1393 $operator = $this->getFilterOperator($field,
'more');
1394 if (is_string($operator))
1395 $fieldId = $operator.$fieldId;
1397 $items[$fieldId] = $minValue;
1401 if ($maxValue !==
'')
1403 $operator = $this->getFilterOperator($field,
'less');
1404 if (is_string($operator))
1405 $fieldId = $operator.$fieldId;
1407 $items[$fieldId] = $maxValue;
1411 unset($maxValue, $minValue, $maxIndex, $minIndex);
1413 $this->addFilterItems($result, $items, $field);
1416 unset($valueTypeIndex);
1426 private function addFilterDateValue(array &$result, array $filter, $fieldId, array $field)
1428 $valueTypeIndex = $fieldId.
'_datesel';
1430 if (isset($filter[$valueTypeIndex]) && is_string($filter[$valueTypeIndex]))
1434 $minIndex = $fieldId.
'_from';
1435 $maxIndex = $fieldId.
'_to';
1437 $minValue = (isset($filter[$minIndex]) && is_string($filter[$minIndex]) ? trim($filter[$minIndex]) :
'');
1438 $maxValue = (isset($filter[$maxIndex]) && is_string($filter[$maxIndex]) ? trim($filter[$maxIndex]) :
'');
1440 switch ($filter[$valueTypeIndex])
1443 if ($minValue !==
'')
1445 $operator = $this->getFilterOperator($field,
'default');
1446 if (is_string($operator))
1447 $fieldId = $operator.$fieldId;
1449 $items[$fieldId] = $minValue;
1454 if ($minValue !==
'' && $maxValue !==
'')
1456 $operator = $this->getFilterOperator($field,
'range');
1457 if (is_string($operator))
1458 $fieldId = $operator.$fieldId;
1460 $items[$fieldId] = [$minValue, $maxValue];
1464 unset($maxValue, $minValue, $maxIndex, $minIndex);
1466 $this->addFilterItems($result, $items, $field);
1478 private function addFilterListValue(array &$result, array $filter, $fieldId, array $field)
1480 $multiple = isset($field[
'params'][
'multiple']) && $field[
'params'][
'multiple'] ==
'Y';
1481 if (isset($filter[$fieldId]))
1484 $validRawValue = !empty($filter[$fieldId]) && is_array($filter[$fieldId]);
1486 $validRawValue = is_string($filter[$fieldId]) || is_int($filter[$fieldId]);
1493 foreach ($filter[$fieldId] as $item)
1495 if (isset($field[
'items'][$item]))
1499 $check = !empty($value);
1503 $value = $filter[$fieldId];
1504 $check = isset($field[
'items'][$value]);
1508 $operator = $this->getFilterOperator($field, ($multiple ?
'enum' :
'exact'));
1509 if (is_string($operator))
1510 $fieldId = $operator.$fieldId;
1512 $this->addFilterItems($result, [$fieldId => $value], $field);
1514 unset($check, $value);
1516 unset($validRawValue);
1527 private function addFilterCheckboxValue(array &$result, array $filter, $fieldId, array $field)
1529 if (isset($filter[$fieldId]))
1531 $value = $filter[$fieldId];
1532 if ($value ===
'Y' || $value ===
'N')
1534 $operator = $this->getFilterOperator($field,
'exact');
1535 if (is_string($operator))
1536 $fieldId = $operator.$fieldId;
1538 $this->addFilterItems($result, [$fieldId => $value], $field);
1551 private function addFilterDestSelectorValue(array &$result, array $filter, $fieldId, array $field)
1553 if (isset($filter[$fieldId]))
1555 $multiple = isset($field[
'params'][
'multiple']) && $field[
'params'][
'multiple'] ==
'Y';
1557 $validRawValue = !empty($filter[$fieldId]) && is_array($filter[$fieldId]);
1559 $validRawValue = is_string($filter[$fieldId]) && ($filter[$fieldId] !==
'');
1562 $operator = $this->getFilterOperator($field, ($multiple ?
'enum' :
'exact'));
1563 if (is_string($operator))
1564 $fieldId = $operator.$fieldId;
1566 $this->addFilterItems($result, [$fieldId => $filter[$fieldId]], $field);
1568 unset($validRawValue);
1579 private function addFilterStringValue(array &$result, array $filter, $fieldId, array $field)
1581 if (isset($filter[$fieldId]) && is_string($filter[$fieldId]))
1583 $value = trim($filter[$fieldId]);
1586 $operator = $this->getFilterOperator($field,
'default');
1587 if (is_string($operator))
1588 $fieldId = $operator.$fieldId;
1590 $this->addFilterItems($result, [$fieldId => $value], $field);
1609 $navComponentObject =
null;
1610 $navComponentParameters = [];
1611 if ($this->arParams[
'BASE_LINK'] !==
'')
1613 $navComponentParameters[
"BASE_LINK"] = \CHTTP::urlAddParams(
1614 $this->arParams[
'BASE_LINK'],
1619 $this->navigationString = $iterator->GetPageNavStringEx(
1620 $navComponentObject,
1625 $navComponentParameters
1627 $this->navigation->setRecordCount($iterator->NavRecordCount);
1628 unset($navComponentParameters, $navComponentObject);
1644 if (!empty($this->rows))
1646 $returnDataSet = ($this->resultAction[
'DATA_TYPE'] == self::RESULT_DATA_TYPE_SET);
1648 $editable = array_fill_keys(array_keys($this->
getColumns()),
false);
1650 foreach (array_keys($this->rows) as $index)
1652 $rawItem = $this->rows[$index];
1655 'id' => $rawItem[
'ID'],
1656 'columns' => $rawItem,
1657 'editableColumns' => $editable
1662 if (!empty($action))
1664 $item[
'actions'] = [
1668 'ONCLICK' => $action
1675 $this->rows[$index] = $item;
1677 unset($item, $rawItem, $index);
1679 unset($editable, $returnDataSet);
1702 if ($this->resultAction[
'DATA_TYPE'] != self::RESULT_DATA_TYPE_SET)
1704 switch ($this->resultAction[
'TYPE'])
1706 case self::RESULT_ACTION_TYPE_EVENT:
1708 case self::RESULT_ACTION_TYPE_CALLBACK:
1710 case self::RESULT_ACTION_TYPE_CLASS_METHOD:
1712 case self::RESULT_ACTION_TYPE_SLIDER:
1716 $convertedSet = \CUtil::PhpToJSObject($set,
false,
true,
false);
1717 $result =
'top.BX.SidePanel.Instance.postMessageTop(window, \''.$this->resultAction[
'NAME'].
'\', {filter:
'.$convertedSet.'}); top.BX.SidePanel.Instance.getTopSlider().close(
true);
';
1718 unset($convertedSet);
1729 protected function getSliderResultDataSet(array $row)
1738 protected static function isGridFilterRow(array $row)
1740 return (!isset($row['quickSearchOnly
']));
1749 protected static function clearStringValue(string $value): string
1751 return preg_replace('/[^a-zA-Z0-9_:\\[\\]]/
', '', $value);
1761 protected static function validateSingleParameter(array &$params, string $field): void
1764 if (isset($params[$field]) && is_string($params[$field]))
1766 $value = static::clearStringValue($params[$field]);
1768 $params[$field] = $value;
1779 protected static function validateListParameters(array &$params, array $list): void
1781 foreach ($list as $field)
1783 static::validateSingleParameter($params, $field);