save.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. /**
  3. * Form body for setting up site menu
  4. */
  5. // @todo Could probably make this number configurable
  6. $num_featured_items = 6;
  7. // get site menu items
  8. $menu = elgg_get_config('menus');
  9. $menu = $menu['site'];
  10. $builder = new ElggMenuBuilder($menu);
  11. $menu = $builder->getMenu('name');
  12. $menu_items = $menu['default'];
  13. $featured_menu_names = elgg_get_config('site_featured_menu_names');
  14. $dropdown_values = array();
  15. foreach ($menu_items as $item) {
  16. $dropdown_values[$item->getName()] = $item->getText();
  17. }
  18. $dropdown_values[' '] = elgg_echo('none');
  19. ?>
  20. <div class="elgg-module elgg-module-inline">
  21. <div class="elgg-head">
  22. <h3><?php echo elgg_echo('admin:menu_items:configure'); ?></h3>
  23. </div>
  24. <div class="elgg-body">
  25. <?php
  26. echo elgg_view('output/longtext', array(
  27. 'value' => elgg_echo("admin:menu_items:description")
  28. ));
  29. for ($i=0; $i<$num_featured_items; $i++) {
  30. if ($featured_menu_names && array_key_exists($i, $featured_menu_names)) {
  31. $current_value = $featured_menu_names[$i];
  32. } else {
  33. $current_value = ' ';
  34. }
  35. echo elgg_view('input/select', array(
  36. 'options_values' => $dropdown_values,
  37. 'name' => 'featured_menu_names[]',
  38. 'value' => $current_value
  39. ));
  40. }
  41. ?>
  42. </div>
  43. </div>
  44. <div class="elgg-module elgg-module-inline">
  45. <div class="elgg-head">
  46. <h3><?php echo elgg_echo('admin:add_menu_item'); ?></h3>
  47. </div>
  48. <div class="elgg-body">
  49. <?php
  50. echo elgg_view('output/longtext', array(
  51. 'value' => elgg_echo("admin:add_menu_item:description")
  52. ));
  53. $custom_items = elgg_get_config('site_custom_menu_items');
  54. $name_str = elgg_echo('name');
  55. $url_str = elgg_echo('admin:plugins:label:website');
  56. echo '<ul class="elgg-list elgg-list-simple">';
  57. if (is_array($custom_items)) {
  58. foreach ($custom_items as $title => $url) {
  59. $name_input = elgg_view('input/text', array(
  60. 'name' => 'custom_menu_titles[]',
  61. 'value' => $title
  62. ));
  63. $url_input = elgg_view('input/text', array(
  64. 'name' => 'custom_menu_urls[]',
  65. 'value' => $url
  66. ));
  67. echo "<li>$name_str: $name_input $url_str: $url_input $delete</li>";
  68. }
  69. }
  70. $new = elgg_echo('new');
  71. $name_input = elgg_view('input/text', array(
  72. 'name' => 'custom_menu_titles[]',
  73. ));
  74. $url_input = elgg_view('input/text', array(
  75. 'name' => 'custom_menu_urls[]',
  76. ));
  77. echo "<li class='custom_menuitem'>$name_str: $name_input $url_str: $url_input</li>
  78. </ul>";
  79. ?>
  80. </div>
  81. </div>
  82. <?php
  83. echo elgg_view('input/submit', array('value' => elgg_echo('save')));