<?php

namespace Modules\Reports\BspStructure\TicketReport;

class Controller extends \App\Mvc\Controller\Window\PaginatedListing\ListingAbstract
{
	/**
	 * The list of columns which support ordering.
	 * @var array
	 */
	protected $listOrderingColumns= ['id'];

	/**
	 * (non-PHPdoc)
	 * @see \App\Mvc\Controller\Window\PaginatedListing\ListingAbstract::list_getDefaultParams()
	 */
	protected function list_getDefaultParams()
	{
		// loag global cfg
		$CFG = \Engine\Loader_Cfg::getInstance()->getGlobal();

		$defaultFilters = $this->cfg['listingParams'];

		$defaultFilters['filters']['systems'] = [];

		foreach ($CFG['Reports']['BspStructure']['TicketReport']['listingParams']['filters']['systems'] as $system) {
			$idSys = \Entity\ExtResSystem::getSystemIdByCode($system);
			if ($idSys) {
				$defaultFilters['filters']['systems'][] = $idSys;
			}
		}

		return $defaultFilters;
	}

	/**
	 * (non-PHPdoc)
	 * @see \App\Mvc\Controller\Window\PaginatedListing\ListingAbstract::optionDefineParams()
	 */
	protected function optionDefineParams(\App\Mvc\View\Utils\RowOptions\Option\Option $option, $selection)
	{
		switch($option->getId()){
			default:
				return false;
		}

		return true;
	}


	/**
	 * (non-PHPdoc)
	 * @see \App\Mvc\Controller\Window\PaginatedListing\ListingAbstract::optionGetEntityName()
	 */
	protected function optionGetEntityName($id)
	{
		return null;
	}
}
