Move setupSortControl() from Monitoring_ListController to Icinga\Web\Controller

This commit is contained in:
Alexander A. Klimov 2015-04-08 16:48:35 +02:00
parent 20b09d3bda
commit a817d9070e
2 changed files with 15 additions and 16 deletions

View File

@ -4,6 +4,7 @@
namespace Icinga\Web;
use Icinga\Web\Controller\ModuleActionController;
use Icinga\Web\Widget\SortBox;
/**
* This is the controller all modules should inherit from
@ -12,4 +13,18 @@ use Icinga\Web\Controller\ModuleActionController;
*/
class Controller extends ModuleActionController
{
/**
* Create a sort control box at the 'sortControl' view parameter
*
* @param array $columns An array containing the sort columns, with the
* submit value as the key and the label as the value
*/
protected function setupSortControl(array $columns)
{
$req = $this->getRequest();
$this->view->sortControl = SortBox::create(
'sortbox-' . $req->getActionName(),
$columns
)->applyRequest($req);
}
}

View File

@ -9,7 +9,6 @@ use Icinga\Web\Url;
use Icinga\Web\Widget\Tabextension\DashboardAction;
use Icinga\Web\Widget\Tabextension\OutputFormat;
use Icinga\Web\Widget\Tabs;
use Icinga\Web\Widget\SortBox;
use Icinga\Data\Filter\Filter;
use Icinga\Web\Widget;
use Icinga\Module\Monitoring\Forms\StatehistoryForm;
@ -694,21 +693,6 @@ class Monitoring_ListController extends Controller
return $columns;
}
/**
* Create a sort control box at the 'sortControl' view parameter
*
* @param array $columns An array containing the sort columns, with the
* submit value as the key and the value as the label
*/
private function setupSortControl(array $columns)
{
$this->view->sortControl = new SortBox(
'sortbox-' . $this->getRequest()->getActionName(),
$columns
);
$this->view->sortControl->applyRequest($this->getRequest());
}
protected function addTitleTab($action, $title, $tip)
{
$this->getTabs()->add($action, array(