You are here

function og_menu_overview_tree in Organic Groups Menu (OG Menu) 5

1 call to og_menu_overview_tree()
og_menu_overview in ./og_menu.module

File

./og_menu.module, line 168
Modifies the menu module to support menus specific to organic groups.

Code

function og_menu_overview_tree() {
  $menu = menu_get_menu();
  $root_menus = menu_get_root_menus();
  $og_menus = _generate_menu_listing();
  $header = array(
    t('Menu item'),
    t('Expanded'),
    array(
      'data' => t('Operations'),
      'colspan' => '3',
    ),
  );
  $output = '';

  // We reverse the root menu to show user created menus first.
  foreach ($og_menus as $mid => $array) {
    $operations = array();
    if ($menu['items'][$mid]['type'] & MENU_MODIFIABLE_BY_ADMIN && $array['is_primary'] != 1) {
      $operations[] = l(t('Edit'), 'admin/build/menu/menu/edit/' . $mid);
    }
    if ($menu['items'][$mid]['type'] & MENU_CREATED_BY_ADMIN && $array['is_primary'] != 1) {
      $operations[] = l(t('Delete'), 'admin/build/menu/menu/delete/' . $mid);
    }
    $operations[] = l(t('Add item'), 'admin/build/menu/item/add/' . $mid);
    $table = theme('item_list', $operations);
    $rows = menu_overview_tree_rows($mid);
    $table .= theme('table', $header, $rows ? $rows : array(
      array(
        array(
          'data' => t('No menu items defined.'),
          'colspan' => 5,
        ),
      ),
    ));
    $output .= theme('box', check_plain($root_menus[$mid]), $table);
  }
  return $output;
}