page.php 954 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Page menu
  4. *
  5. * @uses $vars['menu']
  6. * @uses $vars['selected_item']
  7. * @uses $vars['class']
  8. * @uses $vars['name']
  9. * @uses $vars['show_section_headers']
  10. */
  11. $headers = elgg_extract('show_section_headers', $vars, false);
  12. if (empty($vars['name'])) {
  13. $msg = elgg_echo('view:missing_param', array('name', 'navigation/menu/page'));
  14. elgg_log($msg, 'WARNING');
  15. $vars['name'] = '';
  16. }
  17. $class = 'elgg-menu elgg-menu-page';
  18. if (isset($vars['class'])) {
  19. $class = "$class {$vars['class']}";
  20. }
  21. if (isset($vars['selected_item'])) {
  22. $parent = $vars['selected_item']->getParent();
  23. while ($parent) {
  24. $parent->setSelected();
  25. $parent = $parent->getParent();
  26. }
  27. }
  28. foreach ($vars['menu'] as $section => $menu_items) {
  29. echo elgg_view('navigation/menu/elements/section', array(
  30. 'items' => $menu_items,
  31. 'class' => "$class elgg-menu-page-$section",
  32. 'section' => $section,
  33. 'name' => $vars['name'],
  34. 'show_section_headers' => $headers
  35. ));
  36. }