You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

203 lines
7.9 KiB

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