2014-11-13 15:42:25 +01:00
|
|
|
<?php
|
2015-02-04 10:46:36 +01:00
|
|
|
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
2014-11-13 15:42:25 +01:00
|
|
|
|
|
|
|
namespace Icinga\Web;
|
|
|
|
|
|
|
|
use Icinga\Web\Controller\ModuleActionController;
|
2015-04-08 16:48:35 +02:00
|
|
|
use Icinga\Web\Widget\SortBox;
|
2014-11-13 15:42:25 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This is the controller all modules should inherit from
|
|
|
|
* We will flip code with the ModuleActionController as soon as a couple
|
|
|
|
* of pending feature branches are merged back to the master.
|
|
|
|
*/
|
|
|
|
class Controller extends ModuleActionController
|
|
|
|
{
|
2015-04-08 16:48:35 +02:00
|
|
|
/**
|
2015-04-15 14:20:36 +02:00
|
|
|
* Create a SortBox widget at the `sortBox' view property
|
2015-04-08 16:48:35 +02:00
|
|
|
*
|
2015-04-15 14:20:36 +02:00
|
|
|
* @param array $columns An array containing the sort columns, with the
|
|
|
|
* submit value as the key and the label as the value
|
2015-04-08 16:48:35 +02:00
|
|
|
*/
|
|
|
|
protected function setupSortControl(array $columns)
|
|
|
|
{
|
|
|
|
$req = $this->getRequest();
|
2015-04-15 14:20:36 +02:00
|
|
|
$this->view->sortBox = SortBox::create(
|
2015-04-08 16:48:35 +02:00
|
|
|
'sortbox-' . $req->getActionName(),
|
|
|
|
$columns
|
|
|
|
)->applyRequest($req);
|
|
|
|
}
|
2014-11-13 15:42:25 +01:00
|
|
|
}
|