1<?php
2
3use dokuwiki\Menu\Item\AbstractItem;
4use dokuwiki\Menu\Item\Admin;
5use dokuwiki\Menu\Item\Login;
6use dokuwiki\Menu\Item\Register;
7
8if (!defined('DOKU_INC')) die();
9
10if ($conf['useacl']): ?>
11
12    <nav id="dokuwiki__usertools" class="nav-usertools <?php echo $navClass ?>">
13        <h6 class="sr-only" role="heading" aria-level="2"><?php echo $lang['user_tools']; ?></h6>
14        <ul>
15            <?php
16            try {
17                $item = new Login();
18                if ($item->visibleInContext(AbstractItem::CTX_DESKTOP))
19                    echo '<li class="log">' . $item->asHtmlLink() . '</li>';
20            } catch (RuntimeException $ignored) {
21                // item not available
22            }
23
24            if (!empty($_SERVER['REMOTE_USER'])) {
25                echo '<li class="user"><span class="sr-only">' . $lang['loggedinas'] . ' </span>' . userlink() . '</li>';
26            }
27
28            try {
29                $item = new Admin();
30                if ($item->visibleInContext(AbstractItem::CTX_DESKTOP)) {
31                    echo '<li class="admin">' . $item->asHtmlLink() . '</li>';
32                }
33            } catch (RuntimeException $ignored) {
34                // item not available
35            }
36
37            try {
38                $item = new Register();
39                if ($item->visibleInContext(AbstractItem::CTX_DESKTOP)) {
40                    echo '<li class="register">' . $item->asHtmlLink() . '</li>';
41                }
42            } catch (RuntimeException $ignored) {
43                // item not available
44            }
45
46            /** @var helper_plugin_do $doplugin */
47            $doplugin = plugin_load('helper', 'do');
48            if ($doplugin !== null && isset($_SERVER['REMOTE_USER'])) {
49                $icon = $doplugin->tpl_getUserTasksIconHTML();
50                if ($icon) {
51                    echo '<li class="user-task">' . $icon . '</li>';
52                }
53            }
54            ?>
55
56        </ul>
57    </nav><!-- #dokuwiki__usertools -->
58<?php endif ?>
59
60