1<?php
2/**
3 * DokuWiki Bootstrap3 Template: Tools 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 $TPL, $ID;
11
12$navbar_labels = $TPL->getConf('navbarLabels');
13$tools_menus   = $TPL->getToolsMenu();
14
15?>
16<!-- tools-menu -->
17<ul class="nav navbar-nav dw-action-icon" id="dw__tools">
18
19    <?php
20
21        if ($TPL->getConf('individualTools')):
22
23            foreach ($TPL->getConf('showIndividualTool') as $tool):
24
25                if (! isset($tools_menus[$tool])) continue;
26
27                $data = $tools_menus[$tool];
28
29                if (! isset($data['menu'])) continue;
30    ?>
31
32    <li class="dropdown">
33
34        <a href="<?php wl($ID) ?>" class="dropdown-toggle" data-target="#" data-toggle="dropdown" title="<?php echo $lang[$tool.'_tools'] ?>" role="button" aria-haspopup="true" aria-expanded="false">
35            <?php echo iconify($data['icon']); ?> <span class="<?php echo (in_array($tool, $navbar_labels) ? '' : 'hidden-lg hidden-md hidden-sm') ?>"><?php echo $lang[$tool.'_tools'] ?></span> <span class="caret"></span>
36        </a>
37
38        <ul class="dropdown-menu tools" role="menu">
39
40            <li class="dropdown-header hidden-xs hidden-sm">
41                <?php echo iconify($data['icon']); ?> <?php echo $lang[$tool.'_tools'] ?>
42            </li>
43            <?php
44                foreach ($data['menu'] as $type => $item) {
45                    echo $item['html'];
46                }
47            ?>
48
49        </ul>
50    </li>
51
52    <?php endforeach; else: ?>
53
54    <li class="dropdown">
55
56        <a href="<?php wl($ID) ?>" class="dropdown-toggle" data-target="#" data-toggle="dropdown" title="<?php $lang['tools'] ?>" role="button" aria-haspopup="true" aria-expanded="false">
57            <?php echo iconify('mdi:wrench'); ?> <span class="<?php echo (in_array('tools', $navbar_labels) ? '' : 'hidden-lg hidden-md hidden-sm') ?>"><?php echo $lang['tools'] ?></span> <span class="caret"></span>
58        </a>
59
60        <ul class="dropdown-menu tools" role="menu">
61            <?php
62
63                $i   = 1;
64                $max = count(array_keys($tools_menus));
65
66                foreach($tools_menus as $tool => $data):
67
68                    if (! isset($data['menu'])) continue;
69            ?>
70
71            <li class="dropdown-header">
72                <?php echo iconify($data['icon']); ?> <?php echo $lang[$tool.'_tools'] ?>
73            </li>
74
75            <?php
76                foreach ($data['menu'] as $type => $item) {
77                    echo $item['html'];
78                }
79            ?>
80
81            <?php if ($max > $i): ?>
82            <li class="divider" role="separator"></li>
83            <?php endif; ?>
84
85        <?php $i++; endforeach; ?>
86        </ul>
87    </li>
88
89    <?php endif; ?>
90
91</ul>
92<!-- /tools-menu -->
93