Skip to content

Commit

Permalink
Move setupSortControl() from Monitoring_ListController to Icinga\Web\…
Browse files Browse the repository at this point in the history
…Controller
  • Loading branch information
Al2Klimov committed Apr 10, 2015
1 parent 20b09d3 commit a817d90
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
15 changes: 15 additions & 0 deletions library/Icinga/Web/Controller.php
Expand Up @@ -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
Expand All @@ -12,4 +13,18 @@
*/
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);
}
}
16 changes: 0 additions & 16 deletions modules/monitoring/application/controllers/ListController.php
Expand Up @@ -9,7 +9,6 @@
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;
Expand Down Expand Up @@ -694,21 +693,6 @@ protected function extraColumns()
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(
Expand Down

0 comments on commit a817d90

Please sign in to comment.