1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 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);
}
}
}
|