summaryrefslogtreecommitdiffstats
path: root/application/controllers/PlugController.php.disabled
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:46:47 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:46:47 +0000
commit4ada86876033fa171e2896d7e3d3c5645d8062db (patch)
treef0d1fee61877df200ccfb1c0af58a39cd551fb46 /application/controllers/PlugController.php.disabled
parentInitial commit. (diff)
downloadicingaweb2-module-reporting-4ada86876033fa171e2896d7e3d3c5645d8062db.tar.xz
icingaweb2-module-reporting-4ada86876033fa171e2896d7e3d3c5645d8062db.zip
Adding upstream version 0.10.0.upstream/0.10.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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'));
+ }
+}