1<?php 2/** 3 * DokuWiki Bootstrap3 Template: Navbar 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 $lang; 11global $TPL; 12global $ACT; 13 14$navbar_labels = $TPL->getConf('navbarLabels'); 15$navbar_classes = []; 16$navbar_classes[] = ($TPL->getConf('fixedTopNavbar') ? 'navbar-fixed-top' : null); 17$navbar_classes[] = ($TPL->getConf('inverseNavbar') ? 'navbar-inverse' : 'navbar-default'); 18$home_link = ($TPL->getConf('homePageURL') ? $TPL->getConf('homePageURL') : wl()); 19 20?> 21<!-- navbar --> 22<nav id="dw__navbar" class="navbar <?php echo trim(implode(' ', $navbar_classes)) ?>" role="navigation"> 23 24 <div class="dw-container container<?php echo ($TPL->isFluidNavbar() ? '-fluid mx-5' : '') ?>"> 25 26 <div class="navbar-header"> 27 28 <button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".navbar-collapse"> 29 <span class="icon-bar"></span> 30 <span class="icon-bar"></span> 31 <span class="icon-bar"></span> 32 </button> 33 34 <?php 35 36 // get logo either out of the template images folder or data/media folder 37 $logo_size = []; 38 $logo = tpl_getMediaFile([':wiki:logo.png', ':logo.png', 'images/logo.png'], false, $logo_size); 39 $title = $conf['title']; 40 $tagline = (($conf['tagline']) ? '<div id="dw__tagline">' . $conf['tagline'] . '</div>' : ''); 41 42 $logo_height = $logo_size[1]; 43 $nabvar_height = $TPL->getNavbarHeight(); 44 45 echo '<a class="navbar-brand d-flex align-items-center" href="' . $home_link . '" accesskey="h" title="' . $title . '">'; 46 echo '<img id="dw__logo" class="pull-left h-100 mr-4" alt="' . $title . '" src="' . $logo . '" />'; 47 echo '<div class="pull-right"><div id="dw__title">' . $title . '</div>' . $tagline . '</div>'; 48 echo '</a>'; 49 50 ?> 51 52 </div> 53 54 <div class="collapse navbar-collapse"> 55 56 <?php if ($TPL->getConf('showHomePageLink')): ?> 57 <ul class="nav navbar-nav"> 58 <li<?php echo ((wl($ID) == $home_link) ? ' class="active"' : ''); ?>> 59 <?php tpl_link($home_link, iconify('mdi:home') . ' Home')?> 60 </li> 61 </ul> 62 <?php endif;?> 63 64 <?php 65 echo $TPL->getNavbar(); // Include the navbar for different namespaces 66 echo $TPL->getDropDownPage('dropdownpage'); 67 ?> 68 69 <div class="navbar-right" id="dw__navbar_items"> 70 71 <?php 72 // Search form 73 if (actionOK('search') && $TPL->getConf('showSearchForm')) { 74 include_once 'navbar-searchform.php'; 75 } 76 77 // Tools Menu 78 if ($TPL->getConf('showTools')) { 79 include_once 'menu-tools.php'; 80 } 81 82 // Theme Switcher Menu 83 if ($TPL->getConf('showThemeSwitcher')) { 84 include_once 'theme-switcher.php'; 85 } 86 87 // Translation Menu 88 if ($TPL->getConf('showTranslation') && $ACT == 'show' && $TPL->getPlugin('translation')) { 89 include_once 'translation.php'; 90 } 91 92 // Add New Page 93 if (!plugin_isdisabled('addnewpage') && $ACT == 'show' && $TPL->getConf('showAddNewPage')) { 94 include_once 'new-page.php'; 95 } 96 ?> 97 98 <ul class="nav navbar-nav"> 99 100 <?php 101 102 if ($TPL->getConf('showEditBtn')) { 103 104 $action = null; 105 106 global $ACT; 107 108 if ($ACT == 'edit') { 109 $action = 'show'; 110 } 111 if ($ACT == 'show') { 112 $action = 'edit'; 113 } 114 115 if ($action && $edit_action = $TPL->getToolMenuItem('page', $action)) { 116 117 $edit_attr = $edit_action->getLinkAttributes(); 118 119 $edit_html = '<li class="hidden-xs"><a ' . buildAttributes($edit_attr) . '>'; 120 $edit_html .= \inlineSVG($edit_action->getSvg()); 121 $edit_html .= "</a></li>"; 122 123 echo $edit_html; 124 125 } 126 127 } 128 129 ?> 130 131 <?php if (empty($_SERVER['REMOTE_USER'])): ?> 132 <li> 133 <span class="dw__actions dw-action-icon"> 134 <?php 135 136 $register_action = $TPL->getToolMenuItem('user', 'register'); 137 $login_action = $TPL->getToolMenuItem('user', 'login'); 138 139 if ($register_action) { 140 141 $register_attr = $register_action->getLinkAttributes(); 142 $register_attr['class'] .= ' btn btn-success navbar-btn'; 143 144 $register_html = '<a ' . buildAttributes($register_attr) . '>'; 145 $register_html .= \inlineSVG($register_action->getSvg()); 146 $register_html .= '<span class="' . (in_array('register', $navbar_labels) ? null : 'sr-only') . '"> ' . hsc($register_action->getLabel()) . '</span>'; 147 $register_html .= "</a>"; 148 149 echo $register_html; 150 151 } 152 153 if (!$TPL->getConf('hideLoginLink') && $login_action) { 154 155 $login_attr = $login_action->getLinkAttributes(); 156 $login_attr['class'] .= ' btn btn-default navbar-btn'; 157 158 $login_html = '<a ' . buildAttributes($login_attr) . '>'; 159 $login_html .= \inlineSVG($login_action->getSvg()); 160 $login_html .= '<span class="' . (in_array('login', $navbar_labels) ? null : 'sr-only') . '"> ' . hsc($login_action->getLabel()) . '</span>'; 161 $login_html .= "</a>"; 162 163 echo $login_html; 164 165 } 166 167 ?> 168 </span> 169 </li> 170 <?php endif;?> 171 172 </ul> 173 174 <?php if ($TPL->getConf('tocLayout') == 'navbar'): ?> 175 <ul class="nav navbar-nav hide" id="dw__toc_menu"> 176 <li class="dropdown"> 177 <a href="<?php wl($ID)?>" class="dropdown-toggle" data-target="#" data-toggle="dropdown" title="<?php echo $lang['toc'] ?>" role="button" aria-haspopup="true" aria-expanded="false"> 178 <?php echo iconify('mdi:view-list'); ?> <span class="hidden-lg hidden-md hidden-sm"><?php echo $lang['toc'] ?></span><span class="caret"></span> 179 </a> 180 <ul class="dropdown-menu" role="menu" style="max-height: 400px; overflow-y: auto"> 181 <li class="dropdown-header"><?php echo iconify('mdi:view-list'); ?> <?php echo $lang['toc'] ?></li> 182 </ul> 183 </li> 184 </ul> 185 <?php endif;?> 186 187 <?php 188 if (!empty($_SERVER['REMOTE_USER'])) { 189 // Admin Menu 190 include_once 'menu-admin.php'; 191 192 // User Menu 193 include_once 'menu-user.php'; 194 } 195 ?> 196 197 </div> 198 199 </div> 200 </div> 201</nav> 202<!-- navbar --> 203