diff --git a/application/controllers/CommandController.php b/application/controllers/CommandController.php index f4850839..309317b3 100644 --- a/application/controllers/CommandController.php +++ b/application/controllers/CommandController.php @@ -10,36 +10,35 @@ class CommandController extends ObjectController public function init() { parent::init(); - if ($this->object && ! $this->object->isExternal()) { - $this->getTabs()->add('arguments', array( + $o = $this->object; + if ($o && ! $o->isExternal()) { + $this->tabs()->add('arguments', [ 'url' => 'director/command/arguments', - 'urlParams' => array('name' => $this->object->object_name), + 'urlParams' => ['name' => $o->getObjectName()], 'label' => 'Arguments' - )); + ]); } } public function argumentsAction() { - $this->gracefullyActivateTab('arguments'); - $this->view->title = sprintf( - $this->translate('Command arguments: %s'), - $this->object->object_name - ); + $p = $this->params; + $o = $this->object; + $this->tabs()->activate('arguments'); + $this->setTitle($this->translate('Command arguments: %s'), $o->getObjectName()); - $this->view->table = $this - ->loadTable('icingaCommandArgument') - ->setCommandObject($this->object) - ->setFilter(Filter::where('command', $this->params->get('name'))); - - $form = $this->view->form = $this - ->loadForm('icingaCommandArgument') - ->setCommandObject($this->object); - - if ($id = $this->params->shift('argument_id')) { + /** @var \Icinga\Module\Director\Forms\IcingaCommandArgumentForm $form */ + $form = $this->loadForm('icingaCommandArgument')->setCommandObject($o); + if ($id = $p->shift('argument_id')) { $form->loadObject($id); } - $form->handleRequest(); + + $filter = Filter::where('command', $p->get('name')); + $table = $this->loadTable('icingaCommandArgument') + ->setCommandObject($o) + ->setFilter($filter); + + $this->content()->add([$form, $table]); } } diff --git a/application/tables/IcingaCommandArgumentTable.php b/application/tables/IcingaCommandArgumentTable.php index 65609095..29084532 100644 --- a/application/tables/IcingaCommandArgumentTable.php +++ b/application/tables/IcingaCommandArgumentTable.php @@ -4,8 +4,9 @@ namespace Icinga\Module\Director\Tables; use Icinga\Module\Director\Objects\IcingaCommand; use Icinga\Module\Director\Web\Table\QuickTable; +use ipl\Html\ValidHtml; -class IcingaCommandArgumentTable extends QuickTable +class IcingaCommandArgumentTable extends QuickTable implements ValidHtml { protected $commandObject; diff --git a/application/views/scripts/command/arguments.phtml b/application/views/scripts/command/arguments.phtml deleted file mode 100644 index 693053d6..00000000 --- a/application/views/scripts/command/arguments.phtml +++ /dev/null @@ -1,11 +0,0 @@ -