[icinga-checkins] icinga.org: icingaweb2-module-director/feature-ddo-playground: Importrun: add dedicated view script, improve...

git at icinga.org git at icinga.org
Tue Jul 19 10:31:51 CEST 2016


Module: icingaweb2-module-director
Branch: feature-ddo-playground
Commit: bcbe3210630cdf10435914e6ef3ee5437477393a
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=bcbe3210630cdf10435914e6ef3ee5437477393a

Author: Thomas Gelf <thomas at gelf.net>
Date:   Wed Jul 13 10:19:51 2016 +0200

Importrun: add dedicated view script, improve...

...controller

---

 application/controllers/ImportrunController.php |   22 +++++++++++++++++-----
 application/views/scripts/importrun/index.phtml |   16 ++++++++++++++++
 2 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/application/controllers/ImportrunController.php b/application/controllers/ImportrunController.php
index e9639a4..9476d32 100644
--- a/application/controllers/ImportrunController.php
+++ b/application/controllers/ImportrunController.php
@@ -2,23 +2,35 @@
 
 namespace Icinga\Module\Director\Controllers;
 
+use Icinga\Module\Director\Objects\ImportRun;
 use Icinga\Module\Director\Web\Controller\ActionController;
 
 class ImportrunController extends ActionController
 {
     public function indexAction()
     {
+        $db = $this->db();
         $id = $this->getRequest()->getUrl()->getParams()->shift('id');
+        $importRun = ImportRun::load($id, $db);
+        $url = clone($this->getRequest()->getUrl());
+        $chosenColumns = $this->getRequest()->getUrl()->shift('chosenColumns');
+
         $this->view->title = $this->translate('Import run');
+        $this->getTabs()->add('importrun', array(
+            'label' => $this->view->title,
+            'url'   => $url
+        ))->activate('importrun');
+
         $table = $this
             ->loadTable('importedrows')
-            ->setConnection($this->db())
-            ->setChecksum(
-                $this->db()->getImportrunRowsetChecksum($id)
-            );
+            ->setConnection($db)
+            ->setImportRun($importRun);
+
+        if ($chosenColumns) {
+            $table->setColumns(preg_split('/,/', $chosenColumns, -1, PREG_SPLIT_NO_EMPTY));
+        }
 
         $this->view->table = $this->applyPaginationLimits($table);
         $this->view->filterEditor = $table->getFilterEditor($this->getRequest());
-        $this->setViewScript('list/table');
     }
 }
diff --git a/application/views/scripts/importrun/index.phtml b/application/views/scripts/importrun/index.phtml
new file mode 100644
index 0000000..fa9dc3a
--- /dev/null
+++ b/application/views/scripts/importrun/index.phtml
@@ -0,0 +1,16 @@
+<div class="controls">
+<?= $this->tabs ?>
+<h1><?= $this->escape($this->title) ?></h1>
+<span class="action-links"<?php if (! $this->stayHere): ?> data-base-target="_next"<?php endif ?>>
+<?= $this->addLink ?>
+</span>
+<?= $this->filterEditor ?>
+<?= $this->table->getPaginator() ?>
+</div>
+
+<div class="content"<?php if (! $this->stayHere): ?> data-base-target="_next"<?php endif ?>>
+<?= $this->form ?>
+<?php if ($table->count()): ?>
+<?= $this->table->render() ?>
+<?php endif ?>
+</div>



More information about the icinga-checkins mailing list