<?php

/**
 * DokuWiki Bootstrap3 Template: Page Tools
 *
 * @link     http://dokuwiki.org/template:bootstrap3
 * @author   Giuseppe Di Terlizzi <*****@*****.**>
 * @license  GPL 2 (http://www.gnu.org/licenses/gpl.html)
 */
// class="panel panel-default" data-spy="affix" data-offset-top="60" data-offset-bottom="200"
if ($showPageTools) {
    ?>
<div id="dw__pagetools" class="hidden-print">
  <div class="tools">
    <ul class="nav nav-stacked nav-pills">
      <?php 
    $tools = bootstrap3_tools_menu();
    unset($tools['page']['menu']['top']);
    $tools_menu = bootstrap3_toolsevent('pagetools', $tools['page']['menu'], 'main', true);
    $tools_menu = str_replace(array('class="action', '</i>', '</a>', '<span>'), array('class="action text-muted', '</i><span class="sr-only">', '</span></a>', '<span class="sr-only">'), $tools_menu);
    echo $tools_menu;
    ?>
    </ul>
  </div>
</div>
<?php 
}
/**
 * Return all DokuWiki actions for tools menu
 *
 * @author  Giuseppe Di Terlizzi <*****@*****.**>
 *
 * @return  array
 */
function bootstrap3_tools($add_icons = true)
{
    global $ACT;
    $tools['user'] = array('icon' => 'fa fa-fw fa-user', 'actions' => array('admin' => array('icon' => 'fa fa-fw fa-cogs'), 'profile' => array('icon' => 'fa fa-fw fa-refresh'), 'register' => array('icon' => 'fa fa-fw fa-user-plus'), 'login' => array('icon' => 'fa fa-fw fa-sign-' . (!empty($_SERVER['REMOTE_USER']) ? 'out' : 'in'))));
    $tools['site'] = array('icon' => 'fa fa-fw fa-wrench', 'actions' => array('recent' => array('icon' => 'fa fa-fw fa-list-alt'), 'media' => array('icon' => 'fa fa-fw fa-picture-o'), 'index' => array('icon' => 'fa fa-fw fa-sitemap')));
    $tools['page'] = array('icon' => 'fa fa-fw fa-file', 'actions' => array('edit' => array('icon' => 'fa fa-fw fa-' . ($ACT == 'edit' ? 'file-text-o' : 'pencil-square-o')), 'discussion' => array('icon' => 'fa fa-fw fa-comments'), 'revert' => array('icon' => 'fa fa-fw fa-repeat'), 'revisions' => array('icon' => 'fa fa-fw fa-clock-o'), 'backlink' => array('icon' => 'fa fa-fw fa-link'), 'subscribe' => array('icon' => 'fa fa-fw fa-envelope-o'), 'top' => array('icon' => 'fa fa-fw fa-chevron-up')));
    foreach ($tools as $id => $menu) {
        foreach ($menu['actions'] as $action => $item) {
            $tools[$id]['menu'][$action] = bootstrap3_action_item($action, $add_icons ? $item['icon'] : false);
        }
        $tools[$id]['dropdown-menu'] = bootstrap3_toolsevent($id . 'tools', $tools[$id]['menu'], 'main', true);
    }
    return $tools;
}
    <?php 
        $i = 1;
        $max = count(array_keys($tools));
        foreach ($tools as $id => $menu) {
            ?>

      <li class="dropdown-header">
        <i class="<?php 
            echo $menu['icon'];
            ?>
"></i> <?php 
            echo $lang[$id . '_tools'];
            ?>
      </li>
      <?php 
            bootstrap3_toolsevent($id . 'tools', $menu['menu']);
            ?>

      <?php 
            if ($max > $i) {
                ?>
      <li class="divider" role="separator"></li>
      <?php 
            }
            ?>

    <?php 
            $i++;
        }
        ?>
    </ul>
/**
 * DokuWiki Bootstrap3 Template: Tools Menu
 *
 * @link     http://dokuwiki.org/template:bootstrap3
 * @author   Giuseppe Di Terlizzi <*****@*****.**>
 * @license  GPL 2 (http://www.gnu.org/licenses/gpl.html)
 */
// must be run from within DokuWiki
if (!defined('DOKU_INC')) {
    die;
}
if (bootstrap3_conf('showTools')) {
    $all_tools = bootstrap3_tools_menu();
    foreach (bootstrap3_conf('showIndividualTool') as $tool) {
        if ($dropdown = bootstrap3_toolsevent($tool . 'tools', $all_tools[$tool]['menu'], 'main', true)) {
            $tools[$tool] = $all_tools[$tool];
            $tools[$tool]['dropdown'] = $dropdown;
        }
    }
    ?>

<ul class="nav navbar-nav" id="dw__tools">

<?php 
    if (bootstrap3_conf('individualTools')) {
        foreach ($tools as $id => $menu) {
            ?>

  <li class="dropdown">