- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
function get_page() {
$routes = Utility::get_routes('', 'admin/*', '[0-9a-z\.\/\-]*');
$entities = [];
foreach ($routes as $key => $value) {
$entities[$value['entity_type']][$value['entity']][] = $value;
}
$map = [
'core' => Utility::get_string('Ядро'),
'base' => Utility::get_string('Базовое'),
'custom' => Utility::get_string('Пользовательское')
];
$menu = [];
if ($entities) {
$entities = [
'core' => $entities['core'] ?? [],
'base' => $entities['base'] ?? [],
'custom' => $entities['custom'] ?? []
];
foreach ($entities as $key => $value) {
$count = 0;
foreach ($value as $key2 => $value2) {
$index = $map[$key];
$entity = str_replace('_', ' ', $key2);
$entity_upper = ucfirst($key2);
$title = $route = '';
$on = false;
$items = [];
foreach ($value2 as $key3 => $value3) {
if ((!isset($value3['menu']) || $value3['menu']) && (!isset($value3['type']) || $value3['type'] == 'replace') && (!isset($value3['access']) || (new User)->get_access($value3['access']))) {
$first = count(explode('/', $value3['route'])) <= 2;
if (!$title && $first) {
$title = $value3['title'] ?? $entity_upper;
$route = $value3['route'];
}
$items[$value3['route']] = $value3['title'] ?? $entity_upper;
$on = true;
}
}
if ($on) {
$menu[$index][$key2] = [
'title' => $title ?: $entity_upper,
'title_link' => $route ?: 'admin/'.$entity,
'items' => $items,
'tr' => $count && $count % 3 === 0 ? '</tr><tr>' : '',
];
$count++;
}
}
}
}
return $menu;
}