[icinga-checkins] icinga.org: icingaweb2-module-director/master: ImportsourceController: add modifier actions

git at icinga.org git at icinga.org
Thu Feb 18 23:33:58 CET 2016


Module: icingaweb2-module-director
Branch: master
Commit: e5aa37087835d1e2ba6f814447a29bcb4e6e1770
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=e5aa37087835d1e2ba6f814447a29bcb4e6e1770

Author: Thomas Gelf <thomas at gelf.net>
Date:   Thu Feb 18 23:33:22 2016 +0100

ImportsourceController: add modifier actions

---

 application/controllers/ImportsourceController.php |   42 ++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/application/controllers/ImportsourceController.php b/application/controllers/ImportsourceController.php
index f63a04a..92fc28f 100644
--- a/application/controllers/ImportsourceController.php
+++ b/application/controllers/ImportsourceController.php
@@ -98,6 +98,48 @@ class ImportsourceController extends ActionController
         $this->render('object/form', null, true);
     }
 
+    public function editmodifierAction()
+    {
+        $this->addmodifierAction();
+    }
+
+    public function addmodifierAction()
+    {
+        $this->view->stayHere = true;
+        $edit = false;
+
+        if ($id = $this->params->get('id')) {
+            $edit = true;
+        }
+
+        $form = $this->view->form = $this->loadForm('importRowModifier')->setDb($this->db());
+
+        if ($edit) {
+            $form->loadObject($id);
+            $source_id = $form->getObject()->source_id;
+            $form->setSource(ImportSource::load($source_id, $this->db()));
+        } elseif ($source_id = $this->params->get('source_id')) {
+            $form->setSource(ImportSource::load($source_id, $this->db()));
+        }
+        $form->setSuccessUrl('director/importsource/modifier', array('source_id' => $source_id));
+
+        $form->handleRequest();
+
+        $tabs = $this->getTabs()->add('edit', array(
+            'url'       => 'director/importsource/edit',
+            'urlParams' => array('id' => $source_id),
+            'label'     => $this->translate('Import source'),
+        ))->add('modifier', array(
+            'label'     => $this->translate('Modifiers'),
+            'url'       => 'director/importsource/modifier',
+            'urlParams' => array('source_id' => $source_id)
+        ))->activate('modifier');
+
+        $this->view->title = $this->translate('Modifier'); // add/edit
+        $this->view->table = $this->loadTable('propertymodifier')->enforceFilter(Filter::where('source_id', $source_id))->setConnection($this->db());
+        $this->render('list/table', null, true);
+    }
+
     protected function prepareTabs($id = null)
     {
         $tabs = $this->getTabs();



More information about the icinga-checkins mailing list