diff --git a/library/Icinga/Web/Widget/Tabextension/OutputFormat.php b/library/Icinga/Web/Widget/Tabextension/OutputFormat.php index b5426ea47..0b533fd82 100644 --- a/library/Icinga/Web/Widget/Tabextension/OutputFormat.php +++ b/library/Icinga/Web/Widget/Tabextension/OutputFormat.php @@ -4,6 +4,7 @@ namespace Icinga\Web\Widget\Tabextension; +use Icinga\Application\Platform; use Icinga\Web\Url; use Icinga\Web\Widget\Tab; use Icinga\Web\Widget\Tabs; @@ -28,35 +29,6 @@ class OutputFormat implements Tabextension */ const TYPE_CSV = 'csv'; - /** - * An array containing the tab definitions for all supported types - * - * Using array_keys on this array or isset allows to check whether a - * requested type is supported - * - * @var array - */ - private $supportedTypes = array( - self::TYPE_PDF => array( - 'name' => 'pdf', - 'title' => 'PDF', - 'icon' => 'file-pdf', - 'urlParams' => array('format' => 'pdf'), - ), - self::TYPE_CSV => array( - 'name' => 'csv', - 'title' => 'CSV', - 'icon' => 'file-excel', - 'urlParams' => array('format' => 'csv') - ), - self::TYPE_JSON => array( - 'name' => 'json', - 'title' => 'JSON', - 'icon' => 'img/icons/json.png', - 'urlParams' => array('format' => 'json') - ) - ); - /** * An array of tabs to be added to the dropdown area * @@ -74,7 +46,7 @@ class OutputFormat implements Tabextension */ public function __construct(array $disabled = array()) { - foreach ($this->supportedTypes as $type => $tabConfig) { + foreach ($this->getSupportedTypes() as $type => $tabConfig) { if (!in_array($type, $disabled)) { $tabConfig['url'] = Url::fromRequest(); $tabConfig['tagParams'] = array( @@ -98,4 +70,44 @@ class OutputFormat implements Tabextension $tabs->addAsDropdown($tab->getName(), $tab); } } + + /** + * Return an array containing the tab definitions for all supported types + * + * Using array_keys on this array or isset allows to check whether a + * requested type is supported + * + * @return array + */ + public function getSupportedTypes() + { + $supportedTypes = array(); + + if (Platform::extensionLoaded('gd')) { + $supportedTypes[self::TYPE_PDF] = array( + 'name' => 'pdf', + 'title' => 'PDF', + 'icon' => 'file-pdf', + 'urlParams' => array('format' => 'pdf'), + ); + } + + $supportedTypes[self::TYPE_CSV] = array( + 'name' => 'csv', + 'title' => 'CSV', + 'icon' => 'file-excel', + 'urlParams' => array('format' => 'csv') + ); + + if (Platform::extensionLoaded('json')) { + $supportedTypes[self::TYPE_JSON] = array( + 'name' => 'json', + 'title' => 'JSON', + 'icon' => 'img/icons/json.png', + 'urlParams' => array('format' => 'json') + ); + } + + return $supportedTypes; + } } diff --git a/modules/setup/library/Setup/WebWizard.php b/modules/setup/library/Setup/WebWizard.php index 53a6bb8a8..faa123fe8 100644 --- a/modules/setup/library/Setup/WebWizard.php +++ b/modules/setup/library/Setup/WebWizard.php @@ -461,8 +461,8 @@ class WebWizard extends Wizard implements SetupWizard mt('setup', 'PHP Module: GD'), mt( 'setup', - 'In case you want icons being exported to PDF as' - . ' well, you\'ll need the GD extension for PHP.' + 'In case you want views being exported to PDF,' + . ' you\'ll need the GD extension for PHP.' ), Platform::extensionLoaded('gd'), Platform::extensionLoaded('gd') ? mt('setup', 'The PHP module GD is available') : (