summaryrefslogtreecommitdiffstats
path: root/library/Eventdb/Web/EventdbOutputFormat.php
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:18:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:18:42 +0000
commit9f39660f50004ca7c49ea171e2a6f199487cd667 (patch)
tree4a77cd3e323c37b0e5b3d7578b9718cdf1a89262 /library/Eventdb/Web/EventdbOutputFormat.php
parentInitial commit. (diff)
downloadicingaweb2-module-eventdb-9f39660f50004ca7c49ea171e2a6f199487cd667.tar.xz
icingaweb2-module-eventdb-9f39660f50004ca7c49ea171e2a6f199487cd667.zip
Adding upstream version 1.3.0.upstream/1.3.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/Eventdb/Web/EventdbOutputFormat.php')
-rw-r--r--library/Eventdb/Web/EventdbOutputFormat.php66
1 files changed, 66 insertions, 0 deletions
diff --git a/library/Eventdb/Web/EventdbOutputFormat.php b/library/Eventdb/Web/EventdbOutputFormat.php
new file mode 100644
index 0000000..ceec1ce
--- /dev/null
+++ b/library/Eventdb/Web/EventdbOutputFormat.php
@@ -0,0 +1,66 @@
+<?php
+
+namespace Icinga\Module\Eventdb\Web;
+
+use Icinga\Web\Widget\Tabextension\OutputFormat;
+use Icinga\Web\Widget\Tabs;
+
+class EventdbOutputFormat extends OutputFormat
+{
+ /**
+ * TEXT output type
+ */
+ const TYPE_TEXT = 'text';
+
+ /**
+ * Types that are disabled by default
+ *
+ * @var array
+ */
+ protected static $disabledTypes = array(self::TYPE_PDF, self::TYPE_CSV);
+
+ /**
+ * Types that are enabled in addition to default
+ *
+ * @var array
+ */
+ protected $enable = array();
+
+ /**
+ * {@inheritdoc}
+ */
+ public function __construct($disabled = array(), $enable = array())
+ {
+ $this->enable = $enable;
+ $disabled = array_merge(static::$disabledTypes, $disabled);
+ parent::__construct($disabled);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedTypes()
+ {
+ $supported = parent::getSupportedTypes();
+
+ if (in_array(self::TYPE_TEXT, $this->enable)) {
+ $supported[self::TYPE_TEXT] = array(
+ 'name' => 'text',
+ 'label' => mt('eventdb', 'Text'),
+ 'icon' => 'doc-text',
+ 'urlParams' => array('format' => 'text'),
+ );
+ }
+
+ return $supported;
+ }
+
+ public function apply(Tabs $tabs)
+ {
+ parent::apply($tabs);
+
+ if ($textTab = $tabs->get(self::TYPE_TEXT)) {
+ $textTab->setTargetBlank(false);
+ }
+ }
+}