appnavigation.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <div id="app-navigation-files" role="navigation"></div>
  2. <div class="hidden">
  3. <ul class="with-icon" tabindex="0">
  4. <?php
  5. $pinned = 0;
  6. foreach ($_['navigationItems'] as $item) {
  7. $pinned = NavigationListElements($item, $l, $pinned);
  8. }
  9. ?>
  10. </ul>
  11. </div>
  12. <?php
  13. /**
  14. * Prints the HTML for a single Entry.
  15. *
  16. * @param $item The item to be added
  17. * @param $l Translator
  18. * @param $pinned IntegerValue to count the pinned entries at the bottom
  19. *
  20. * @return int Returns the pinned value
  21. */
  22. function NavigationListElements($item, $l, $pinned) {
  23. strpos($item['classes'] ?? '', 'pinned') !== false ? $pinned++ : ''; ?>
  24. <li
  25. data-id="<?php p($item['id']) ?>"
  26. <?php if (isset($item['dir'])) { ?> data-dir="<?php p($item['dir']); ?>" <?php } ?>
  27. <?php if (isset($item['view'])) { ?> data-view="<?php p($item['view']); ?>" <?php } ?>
  28. <?php if (isset($item['expandedState'])) { ?> data-expandedstate="<?php p($item['expandedState']); ?>" <?php } ?>
  29. class="nav-<?php p($item['id']) ?>
  30. <?php if (isset($item['classes'])) {
  31. p($item['classes']);
  32. } ?>
  33. <?php p($pinned === 1 ? 'first-pinned' : '') ?>
  34. <?php if (isset($item['defaultExpandedState']) && $item['defaultExpandedState']) { ?> open<?php } ?>"
  35. <?php if (isset($item['folderPosition'])) { ?> folderposition="<?php p($item['folderPosition']); ?>" <?php } ?>>
  36. <a href="<?php p(isset($item['href']) ? $item['href'] : '#') ?>"
  37. class="nav-icon-<?php p(isset($item['icon']) && $item['icon'] !== '' ? $item['icon'] : $item['id']) ?> svg"><?php p($item['name']); ?></a>
  38. <?php
  39. NavigationElementMenu($item);
  40. if (isset($item['sublist'])) {
  41. ?>
  42. <button class="collapse app-navigation-noclose" aria-expanded="<?= !empty($item['defaultExpandedState']) ? 'true' : 'false' ?>"
  43. aria-label="<?php p($l->t('Toggle %1$s sublist', $item['name'])) ?>"
  44. <?php if (sizeof($item['sublist']) == 0) { ?> style="display: none" <?php } ?>>
  45. </button>
  46. <ul id="sublist-<?php p($item['id']); ?>">
  47. <?php
  48. foreach ($item['sublist'] as $item) {
  49. $pinned = NavigationListElements($item, $l, $pinned);
  50. } ?>
  51. </ul>
  52. <?php
  53. } ?>
  54. </li>
  55. <?php
  56. return $pinned;
  57. }
  58. /**
  59. * Prints the HTML for a dotmenu.
  60. *
  61. * @param $item The item to be added
  62. *
  63. * @return void
  64. */
  65. function NavigationElementMenu($item) {
  66. if (isset($item['menubuttons']) && $item['menubuttons'] === 'true') {
  67. ?>
  68. <div id="dotmenu-<?php p($item['id']); ?>"
  69. class="app-navigation-entry-utils" <?php if (isset($item['enableMenuButton']) && $item['enableMenuButton'] === 0) { ?> style="display: none"<?php } ?>>
  70. <ul>
  71. <li class="app-navigation-entry-utils-menu-button svg">
  72. <button id="dotmenu-button-<?php p($item['id']) ?>"></button>
  73. </li>
  74. </ul>
  75. </div>
  76. <div id="dotmenu-content-<?php p($item['id']) ?>"
  77. class="app-navigation-entry-menu">
  78. <ul>
  79. </ul>
  80. </div>
  81. <?php
  82. }
  83. }