function og_menu_overview_page in Organic Groups Menu (OG Menu) 7.2
Same name and namespace in other branches
- 6.2 og_menu.module \og_menu_overview_page()
- 6 og_menu.module \og_menu_overview_page()
Menu callback which shows an overview page of all the custom menus in a user's group and along with their description.
1 string reference to 'og_menu_overview_page'
- og_menu_menu in ./
og_menu.module - Implementation of hook_menu().
File
- ./
og_menu.pages.inc, line 12 - Contains page callbacks for og_menu
Code
function og_menu_overview_page($node) {
$gid = og_get_group_ids('node', array(
$node->nid,
), FALSE, array(
OG_STATE_ACTIVE,
OG_STATE_PENDING,
));
$gid = isset($gid[$node->nid]) ? $gid[$node->nid] : '';
// Set the title of the page.
drupal_set_title(t('List menus for @title', array(
'@title' => $node->title,
)), PASS_THROUGH);
// @todo Replace by D7 database independant functions
$result = db_query("\n SELECT om.gid, om.menu_name as name, m.title as title, m.description as description FROM {og_menu} om\n LEFT JOIN {menu_custom} m\n ON om.menu_name = m.menu_name\n WHERE om.gid = :gid\n ORDER BY title", array(
':gid' => $gid,
));
$header = array(
t('Title'),
array(
'data' => t('Operations'),
'colspan' => '3',
),
);
$rows = array();
foreach ($result as $menu) {
$row = array(
theme('menu_admin_overview', array(
'title' => $menu->title,
'name' => $menu->name,
'description' => $menu->description,
)),
);
$row[] = array(
'data' => l(t('list links'), 'node/' . $node->nid . '/og_menu/' . $menu->name),
);
$row[] = array(
'data' => l(t('edit menu'), 'node/' . $node->nid . '/og_menu/' . $menu->name . '/edit'),
);
$row[] = array(
'data' => l(t('add link'), 'node/' . $node->nid . '/og_menu/' . $menu->name . '/add'),
);
$rows[] = $row;
}
if ($result
->rowCount() == 0) {
return t('There are currently no menus. Click') . ' ' . l(t('Add menu'), 'node/' . $node->nid . '/og_menu/add') . t(' to create one.');
}
else {
return theme('table', array(
'header' => $header,
'rows' => $rows,
));
}
}