• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/grids.php
  • Класс: CGridOptions
  • Вызов: CGridOptions::__construct
public function __construct($grid_id, array $filterPresets = array())
{
	$this->grid_id = $grid_id;
	$this->options = array();
	$this->filter = array();
	$this->filterPresets = $filterPresets;

	$aOptions = CUserOptions::GetOption("main.interface.grid", $this->grid_id, array());

	if(!is_array($aOptions))
	{
		$aOptions = array();
	}
	if (!isset($aOptions["views"]) || !is_array($aOptions["views"]))
	{
		$aOptions["views"] = [];
	}

	if (!isset($aOptions["filters"]) || !is_array($aOptions["filters"]))
	{
		$aOptions["filters"] = [];
	}

	if(!isset($aOptions["current_view"]) || $aOptions["current_view"] == '' || !isset($aOptions["views"][$aOptions["current_view"]]))
	{
		$aOptions["current_view"] = "default";
	}

	$defaultOptions = CUserOptions::GetOption("main.interface.grid.common", $this->grid_id, array());

	if (isset($defaultOptions["view"]) && is_array($defaultOptions["view"]) && !isset($aOptions["views"]["default"]))
	{
		$aOptions["views"]["default"] = $defaultOptions["view"];
	}
	if(!isset($aOptions["views"]["default"]))
	{
		$aOptions["views"]["default"] = array("columns"=>"");
	}

	$this->all_options = $aOptions;
	$this->currentView = $aOptions["current_view"];

	if(isset($aOptions["views"][$this->currentView]))
	{
		$this->options = $aOptions["views"][$this->currentView];
	}
}