-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModule.php
More file actions
44 lines (38 loc) · 1.56 KB
/
Copy pathModule.php
File metadata and controls
44 lines (38 loc) · 1.56 KB
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
<?php
namespace Modules\ZabbixDesignDatacenter;
require_once __DIR__ . '/lib/RackPermission.php';
use Modules\ZabbixDesignDatacenter\Lib\LanguageManager;
use Modules\ZabbixDesignDatacenter\Lib\RackPermission;
use CMenu;
use CMenuItem;
class Module extends \Zabbix\Core\CModule {
public function init(): void {
$lm = new LanguageManager();
try {
if (class_exists('APP')) {
$app = new \ReflectionClass('APP');
if ($app->hasMethod('Component')) {
\APP::Component()->get('menu.main')
->findOrAdd(_('SuporTI'))
->setIcon('zi-server')
->getSubmenu()
->add(
(new CMenuItem($lm->t('Design Datacenter')))->setSubMenu(
new CMenu(array_merge(
[
(new CMenuItem($lm->t('View')))->setAction('rack.view'),
],
RackPermission::canAccessManage()
? [(new CMenuItem($lm->t('Rack Config')))->setAction('rack.manage')]
: []
))
)
);
}
}
} catch (\Exception $e) {
// Log error but do not interrupt execution
error_log('Zabbix Rack Module: Failed to register menu - ' . $e->getMessage());
}
}
}