Controller: moved to Web

This commit is contained in:
Thomas Gelf 2016-12-09 09:53:36 +01:00
parent 803b2aa34d
commit f41e4c34c2
4 changed files with 29 additions and 10 deletions

View file

@ -2,7 +2,7 @@
namespace Icinga\Module\Businessprocess\Controllers;
use Icinga\Module\Businessprocess\Controller;
use Icinga\Module\Businessprocess\Web\Controller;
class IndexController extends Controller
{

View file

@ -2,7 +2,7 @@
namespace Icinga\Module\Businessprocess\Controllers;
use Icinga\Module\Businessprocess\Controller;
use Icinga\Module\Businessprocess\Web\Controller;
use Icinga\Module\Businessprocess\Simulation;
use Icinga\Web\Url;

View file

@ -3,7 +3,6 @@
namespace Icinga\Module\Businessprocess\Controllers;
use Icinga\Module\Businessprocess\BusinessProcess;
use Icinga\Module\Businessprocess\Controller;
use Icinga\Module\Businessprocess\ConfigDiff;
use Icinga\Module\Businessprocess\Html\Element;
use Icinga\Module\Businessprocess\Html\HtmlString;
@ -15,6 +14,7 @@ use Icinga\Module\Businessprocess\Renderer\TileRenderer;
use Icinga\Module\Businessprocess\Renderer\TreeRenderer;
use Icinga\Module\Businessprocess\Simulation;
use Icinga\Module\Businessprocess\Html\Link;
use Icinga\Module\Businessprocess\Web\Controller;
use Icinga\Module\Businessprocess\Web\Url;
use Icinga\Web\Notification;
use Icinga\Web\Widget\Tabextension\DashboardAction;
@ -168,6 +168,7 @@ class ProcessController extends Controller
{
$action = $this->params->get('action');
$form = null;
if ($action === 'add') {
$form =$this->loadForm('AddNode')
->setProcess($bp)

View file

@ -20,14 +20,17 @@ use Icinga\Web\Widget\Tabs;
class Controller extends ModuleController
{
/** @var View */
public $view;
/** @deprecated, obsolete */
protected $backend;
/** @var BusinessProcess */
protected $bp;
/** @var View */
public $view;
/** @var Tabs */
protected $tabs;
/** @var Storage */
private $storage;
@ -122,16 +125,13 @@ class Controller extends ModuleController
*/
protected function singleTab($label)
{
$tabs = Widget::create('tabs')->add(
return $this->tabs()->add(
'tab',
array(
'label' => $label,
'url' => $this->getRequest()->getUrl()
)
)->activate('tab');
$this->controls()->add(HtmlString::create($tabs));
return $tabs;
}
/**
@ -142,11 +142,29 @@ class Controller extends ModuleController
return $this->singleTab($this->translate('Business Process'));
}
/**
* @return Tabs
*/
protected function overviewTab()
{
return $this->tabs()->add(
'overview',
array(
'label' => $this->translate('Business Process'),
'url' => 'businessprocess'
)
)->activate('overview');
}
protected function tabs()
{
// Todo: do not add to view once all of them render controls()
if ($this->view->tabs === null) {
$this->view->tabs = Widget::create('tabs');
$tabs = Widget::create('tabs');
$this->controls()->add(HtmlString::create($tabs));
$this->view->tabs = $tabs;
}
return $this->view->tabs;
}