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.

51 lines
2.2 KiB

5 years ago
  1. <?php
  2. if ($sideMenuItems = BackendMenu::listSideMenuItems()):
  3. $collapsedGroups = explode('|',
  4. isset($_COOKIE['sidenav_treegroupStatus'])
  5. ? $_COOKIE['sidenav_treegroupStatus']
  6. : null
  7. );
  8. $categories = [];
  9. foreach ($sideMenuItems as $sideItemCode => $item) {
  10. if(!property_exists($item, 'group')) {
  11. $item->group = 'default';
  12. }
  13. if(!property_exists($item, 'keywords')) {
  14. $item->keywords = '';
  15. }
  16. if(!property_exists($item, 'description')) {
  17. $item->description = '';
  18. }
  19. $categories[$item->group][$sideItemCode] = $item;
  20. }
  21. ?>
  22. <ul class="top-level">
  23. <?php foreach ($categories as $category => $items):
  24. $collapsed = in_array($category, $collapsedGroups); ?>
  25. <li data-group-code="<?= e($category) ?>" <?= $collapsed ? 'data-status="collapsed"' : null ?>>
  26. <div class="group">
  27. <h3><?= e(trans($category)); ?></h3>
  28. </div>
  29. <ul>
  30. <?php foreach ($items as $item):
  31. $last_path = array_last(explode('/', request()->path())); ?>
  32. <li class="<?=
  33. ((BackendMenu::isSideMenuItemActive($item) && empty($item->scontents))
  34. || (
  35. isset($item->scontents)
  36. && $item->scontents == $last_path
  37. ))
  38. ? 'active'
  39. : null;
  40. ?>" data-keywords="<?= e(trans($item->keywords)) ?>">
  41. <a href="<?= $item->url ?>">
  42. <i class="<?= $item->icon ?>"></i>
  43. <span class="header"><?= e(trans($item->label)) ?></span>
  44. <span class="description"><?= e(trans($item->description)) ?></span>
  45. </a>
  46. </li>
  47. <?php endforeach ?>
  48. </ul>
  49. </li>
  50. <?php endforeach ?>
  51. </ul>
  52. <?php endif; ?>