Repository navigation
Expand file tree
/
Copy pathdashboard_menu.php
More file actions
55 lines (45 loc) · 1.73 KB
/
Copy pathdashboard_menu.php
File metadata and controls
55 lines (45 loc) · 1.73 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
45
46
47
48
49
50
51
52
53
54
55
<?php
global $mysqli,$route,$session;
if ($session["read"] || $session["public_userid"]) {
require_once "Modules/dashboard/dashboard_model.php";
$dashboard = new Dashboard($mysqli);
load_language_files("Modules/dashboard/locale", "dashboard_messages");
$l2 = [];
if ($listmenu = $dashboard->build_menu_array('view')) {
// Level 2 List of dashboards
foreach ($listmenu as $dash) {
if ($dash['published']) {
$id = $dash['id'];
if ($dash['main']) {
$icon = 'star';
} else {
$icon = 'star_border';
}
$dashboard_item = [
"name" => $dash['name'],
"title" => $dash['desc'],
"href" => str_replace('dashboard/view&id', 'dashboard/view?id', $dash['path']),
"icon" => $icon,
"order" => $dash['order']
];
if ($session['public_userid']) {
$dashboard_item["href"] = $session['public_username'] . "/" . $dashboard_item["href"];
}
$l2[] = $dashboard_item;
$menu["dashboards"]["default"] = str_replace('dashboard/view&id', 'dashboard/view?id', $dash['path']);
}
}
}
if ($session["write"]) {
$l2[] = [
"name" => ctx_tr("dashboard_messages", "Configuration"),
"href" => "dashboard/list",
"icon" => "cog",
"order" => 99
];
}
// Level 1 top bar
if (count($l2)) {
$menu["dashboards"] = ["name" => tr("Dashboards"), "order" => 3, "icon" => "dashboard", "default" => "dashboard/list", "l2" => $l2];
}
}