function signup_menu in Signup 5.2
Same name and namespace in other branches
- 5 signup.module \signup_menu()
- 6.2 signup.module \signup_menu()
- 6 signup.module \signup_menu()
- 7 signup.module \signup_menu()
Implementation of hook_menu().
Related topics
File
- ./
signup.module, line 242 - The Signup module (http://drupal.org/project/signup) manages replies to nodes. In particular, it's good for event management. Signup supports sending reminder emails and automatically closing signups for nodes with a start time, via the Event…
Code
function signup_menu($may_cache) {
global $user;
$items = array();
$access = user_access('administer all signups');
if ($may_cache) {
$items[] = array(
'path' => 'admin/settings/signup',
'description' => t('Configure settings for signups.'),
'access' => $access,
'callback' => 'drupal_get_form',
'callback arguments' => array(
'signup_settings_page',
),
'title' => user_access('access administration pages') ? t('Signup') : t('Signup settings'),
);
$items[] = array(
'path' => 'admin/content/signup',
'description' => t('View all signup-enabled posts, and open or close signups on them.'),
'access' => $access,
'callback' => 'signup_admin_page',
'title' => t('Signup administration'),
);
}
else {
// !$may_cache: dynamic menu items
_signup_initialize_scheduler_backend();
// Conditionally load either the views support, or the code that
// only should happen if views is not enabled.
$signup_path = './' . drupal_get_path('module', 'signup');
if (module_exists('views')) {
require_once $signup_path . '/views/views.inc';
}
else {
require_once $signup_path . '/includes/views.none.inc';
signup_no_views_menu($items, $may_cache);
}
// If it's a signup-enabled node, then put in a signup tab for admins.
if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(array(
'nid' => arg(1),
));
if (!empty($node->signup)) {
$access_own = user_access('administer signups for own content') && $user->uid == $node->uid;
$email_own = user_access('email users signed up for own content') && $user->uid == $node->uid;
$email_all = user_access('email all signed up users');
if (variable_get('signup_form_location', 'node') == 'tab' && _signup_needs_output($node)) {
$items[] = array(
'path' => 'node/' . arg(1) . '/signup',
'title' => t('Sign up'),
'callback' => 'signup_node_tab',
'callback arguments' => array(
$node,
),
'type' => MENU_LOCAL_TASK,
'weight' => 19,
);
}
$items[] = array(
'path' => 'node/' . arg(1) . '/signups',
'title' => t('Signups'),
'callback' => 'signup_node_admin_page',
'callback arguments' => array(
$node,
),
'access' => $access || $access_own,
'type' => MENU_LOCAL_TASK,
'weight' => 20,
);
$items[] = array(
'path' => 'node/' . arg(1) . '/signups/confirm',
'title' => t('Signups'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'signup_cancel_multiple_confirm',
$node,
),
'access' => $access || $access_own,
'type' => MENU_CALLBACK,
'weight' => 20,
);
$items[] = array(
'path' => 'node/' . arg(1) . '/signup-broadcast',
'title' => t('Signup broadcast'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'signup_broadcast_form',
$node,
),
'access' => $email_all || $email_own,
'type' => MENU_LOCAL_TASK,
'weight' => 21,
);
}
}
}
return $items;
}