mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-02-03 08:49:27 -05:00
configuration: add businessprocess to main menu
This commit is contained in:
parent
ce82446732
commit
2df97ef432
1 changed files with 39 additions and 4 deletions
|
|
@ -1,9 +1,44 @@
|
|||
<?php
|
||||
|
||||
$section = $this->menuSection(N_('Overview'))
|
||||
->add($this->translate('Business Processes'))
|
||||
->setPriority(45)
|
||||
->setUrl('businessprocess');
|
||||
use Icinga\Module\Businessprocess\Storage\LegacyStorage;
|
||||
|
||||
$this->providePermission('businessprocess/create', 'Allow to create new configs');
|
||||
$this->providePermission('businessprocess/modify', 'Allow to modify processes');
|
||||
$section = $this->menuSection(N_('Business Processes'), array(
|
||||
'url' => 'businessprocess',
|
||||
'icon' => 'sitemap',
|
||||
'priority' => 46
|
||||
));
|
||||
|
||||
try {
|
||||
$storage = new LegacyStorage(
|
||||
$this->getConfig()->getSection('global')
|
||||
);
|
||||
|
||||
$prio = 0;
|
||||
foreach ($storage->listProcesses() as $name) {
|
||||
$prio++;
|
||||
|
||||
$meta = $storage->loadMetadata($name);
|
||||
if ($meta->get('AddToMenu') === 'no') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($prio > 5) {
|
||||
$section->add(N_('Show all'), array(
|
||||
'url' => 'businessprocess',
|
||||
'priority' => $prio
|
||||
));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$section->add($meta->getTitle(), array(
|
||||
'url' => 'businessprocess/process/show',
|
||||
'urlParameters' => array('config' => $name),
|
||||
'priority' => $prio
|
||||
));
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// Well... there is not much we could do here
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue