summaryrefslogtreecommitdiffstats
path: root/application/controllers/PlugController.php.disabled
diff options
context:
space:
mode:
Diffstat (limited to 'application/controllers/PlugController.php.disabled')
-rw-r--r--application/controllers/PlugController.php.disabled72
1 files changed, 72 insertions, 0 deletions
diff --git a/application/controllers/PlugController.php.disabled b/application/controllers/PlugController.php.disabled
new file mode 100644
index 0000000..a2c6453
--- /dev/null
+++ b/application/controllers/PlugController.php.disabled
@@ -0,0 +1,72 @@
+<?php
+
+namespace Icinga\Module\Reporting\Controllers;
+
+use GuzzleHttp\Psr7\ServerRequest;
+use Icinga\Module\Reporting\Hook\ReportHook;
+use Icinga\Module\Reporting\Web\Forms\ReportForm;
+use Icinga\Module\Reporting\Web\Controller;
+use Icinga\Web\Hook;
+use Icinga\Web\Url;
+use ipl\Html\Html;
+
+class PlugController extends Controller
+{
+ public function indexAction()
+ {
+ $moduleToShow = strtolower($this->params->get('module', 'reporting'));
+
+ $reportsByModule = [];
+
+ foreach (ReportHook::getReports() as $class => $report) {
+ $moduleName = $report->getModuleName();
+
+ if (! isset($reportsByModule[$moduleName])) {
+ $reportsByModule[$moduleName] = [];
+ }
+
+ $reportsByModule[$moduleName][$class] = $report;
+ }
+
+ $editor = Html::tag('div', ['class' => 'editor']);
+
+ $nav = [];
+
+ $cards = [];
+
+ foreach ($reportsByModule as $moduleName => $reports) {
+ $link = Html::tag('a', ['href' => Url::fromRequest(['module' => $moduleName])], $moduleName);
+
+ $nav[] = $link;
+
+ if ($moduleName !== $moduleToShow) {
+ continue;
+ }
+
+ $link->getAttributes()->add('class', 'active');
+
+ foreach ($reports as $report) {
+ $cards[] = Html::tag(
+ 'div',
+ ['class' => 'card'],
+ [
+ Html::tag('div', ['class' => 'card-top'], $report->getPreview()),
+ Html::tag(
+ 'div',
+ ['class' => 'card-content'],
+ Html::tag('h5', ['class' => 'card-title'], $report->getName()),
+ Html::tag('p', ['class' => 'card-text'], $report->getDescription())
+ )
+ ]
+ );
+ }
+ }
+
+ $editor->add(Html::tag('div', ['class' => 'editor-nav'], $nav));
+ $editor->add(Html::tag('div', ['class' => 'editor-content'], $cards));
+
+ $this->addContent($editor);
+
+ $this->addContent(Html::tag('a', ['href' => 'plug', 'class' => 'modal-toggle', 'data-base-target' => 'modal-container'], 'Modal'));
+ }
+}