From 3253bf2c88097266374c801f885f7daaab521a99 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 30 Jul 2015 09:49:34 +0200 Subject: [PATCH] ObjectsController: reorganize tabs --- .../Web/Controller/ObjectsController.php | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/library/Director/Web/Controller/ObjectsController.php b/library/Director/Web/Controller/ObjectsController.php index ec74945e..7b3e364e 100644 --- a/library/Director/Web/Controller/ObjectsController.php +++ b/library/Director/Web/Controller/ObjectsController.php @@ -31,32 +31,28 @@ abstract class ObjectsController extends ActionController } $tabs->activate($ltype); - } elseif ($object->isGroup()) { + return; + } - $singleType = substr($type, 0, -5); - $tabs = $this->getTabs()->add('objects', array( - 'url' => sprintf('director/%ss', $singleType), - 'label' => $this->translate(ucfirst($singleType) . 's'), - )); + $object = $this->dummyObject(); + if ($object->isGroup()) { + $type = substr($type, 0, -5); + } + + $tabs = $this->getTabs()->add('objects', array( + 'url' => sprintf('director/%ss', strtolower($type)), + 'label' => $this->translate(ucfirst($type) . 's'), + )); + $tabs = $this->getTabs()->add('objecttemplates', array( + 'url' => sprintf('director/%stemplates', strtolower($type)), + 'label' => $this->translate('Templates'), + )); + if ($object->supportsGroups() || $object->isGroup()) { $tabs->add('objectgroups', array( - 'url' => sprintf('director/%ss', strtolower($type)), - 'label' => $this->translate(ucfirst(strtolower($type)) . 's') + 'url' => sprintf('director/%sgroups', $type), + 'label' => $this->translate('Groups') )); - - } else { - - $tabs = $this->getTabs()->add('objects', array( - 'url' => sprintf('director/%ss', strtolower($type)), - 'label' => $this->translate(ucfirst($type) . 's'), - )); - if ($object->supportsGroups()) { - $tabs->add('objectgroups', array( - 'url' => sprintf('director/%sgroups', $type), - 'label' => $this->translate(ucfirst($type) . 'groups') - )); - } - } $tabs->add('tree', array( @@ -82,7 +78,10 @@ abstract class ObjectsController extends ActionController $table = 'icinga' . ucfirst($type) . 'Template'; } else { $this->getTabs()->activate('objects'); + $table = 'icinga' . ucfirst($type); } + } else { + $table = 'icinga' . ucfirst($type); } if ($dummy->isTemplate()) {