1<?php
2/**
3 * DokuWiki Bootstrap3 Template: Administration Menu
4 *
5 * @link     http://dokuwiki.org/template:bootstrap3
6 * @author   Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
7 * @license  GPL 2 (http://www.gnu.org/licenses/gpl.html)
8 */
9
10global $ID, $INPUT, $auth, $TPL;
11
12if ($TPL->getConf('showAdminMenu')):
13
14$admin_plugins        = plugin_list('admin');
15$administrative_tasks = array('usermanager', 'acl', 'extension', 'config', 'styling', 'revert', 'popularity');
16$additional_plugins   = array_diff($admin_plugins, $administrative_tasks);
17
18$admin = array(
19    'administrative_tasks' => array(
20        'label'   => tpl_getLang('administrative_tasks'),
21        'icon'    => 'mdi:settings',
22        'plugins' => $administrative_tasks
23    ),
24    'additional_plugins' => array(
25        'label'   => tpl_getLang('additional_plugins'),
26        'icon'    => 'mdi:puzzle',
27        'plugins' => $additional_plugins
28    ),
29);
30
31?>
32<!-- admin -->
33<ul class="nav navbar-nav" id="dw__admin">
34    <li class="dropdown dropdown-large">
35
36        <a href="<?php wl($ID) ?>" class="dropdown-toggle" data-target="#" data-toggle="dropdown" title="<?php echo $lang['btn_admin'] ?>" role="button" aria-haspopup="true" aria-expanded="false">
37            <?php echo iconify('mdi:settings'); ?> <span class="<?php echo (in_array('admin', $TPL->getConf('navbarLabels')) ? '' : 'hidden-lg hidden-md hidden-sm') ?>"> <?php echo $lang['btn_admin'] ?></span> <span class="caret"></span>
38        </a>
39
40        <ul class="dropdown-menu dropdown-menu-large" role="menu">
41            <li class="open dropdown-row">
42
43                <?php foreach ($admin as $key => $items): if (! count($items['plugins'])) continue ?>
44
45                <ul class="dropdown-menu col-sm-<?php echo (count($additional_plugins) > 0) ? '6' : '12' ?>">
46
47                    <li class="dropdown-header">
48                        <?php echo iconify($items['icon']) ?> <?php echo ucfirst($items['label']) ?>
49                    </li>
50
51                    <?php
52
53                        foreach($items['plugins'] as $item) {
54
55                            if (($plugin = plugin_load('admin', $item)) === null) continue;
56                            if ($plugin->forAdminOnly() && !$INFO['isadmin']) continue;
57                            if ($item == 'usermanager' && ! ($auth && $auth->canDo('getUsers'))) continue;
58
59                            $label = $plugin->getMenuText($conf['lang']);
60
61                            if (method_exists($plugin, 'getMenuIcon')) {
62                                $icon = $plugin->getMenuIcon();
63                                if (! file_exists($icon)) {
64                                    $icon = tpl_incdir() . 'images/menu/puzzle.svg';
65                                }
66                            } else {
67                                $icon = tpl_incdir() . 'images/menu/puzzle.svg';
68                            }
69
70                            if (! $label) continue;
71
72                            echo '<li class="menuitem ' . (($INPUT->str('page') == $item) ? 'active' : '') . '">' .
73                                 '<a href="'. wl($ID, array('do' => 'admin', 'page' => $item)) .'" title="'. $label .'" class="admin '. $item .'">' .
74                                 inlineSVG($icon) . ' ' . $label .
75                                 '</a></li>';
76
77                        }
78
79                    ?>
80
81                </ul>
82                <?php endforeach; ?>
83            </li>
84        </ul>
85    </li>
86</ul>
87<!-- /admin -->
88<?php endif; ?>
89