function quiz_menu in Quiz 5
Same name and namespace in other branches
- 8.6 quiz.module \quiz_menu()
- 8.4 quiz.module \quiz_menu()
- 8.5 quiz.module \quiz_menu()
- 5.2 quiz.module \quiz_menu()
- 6.6 quiz.module \quiz_menu()
- 6.2 quiz.module \quiz_menu()
- 6.3 quiz.module \quiz_menu()
- 6.4 quiz.module \quiz_menu()
- 6.5 quiz.module \quiz_menu()
- 7.6 quiz.module \quiz_menu()
- 7 quiz.module \quiz_menu()
- 7.4 quiz.module \quiz_menu()
- 7.5 quiz.module \quiz_menu()
- 6.x quiz.module \quiz_menu()
Implementation of hook_menu().
File
- ./
quiz.module, line 77 - Quiz Module
Code
function quiz_menu($may_cache) {
$items = array();
if ($may_cache) {
$access = user_access(QUIZ_PERM_ADMIN_CONFIG);
$items[] = array(
'path' => 'admin/settings/quiz',
'title' => t('@quiz Configuration', array(
'@quiz' => QUIZ_NAME,
)),
'description' => t('Describes what the settings generally do.'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'quiz_admin_settings',
),
'access' => user_access(QUIZ_PERM_ADMIN_CONFIG),
'type' => MENU_NORMAL_ITEM,
);
$items[] = array(
'path' => 'node/add/quiz',
'title' => t('@quiz', array(
'@quiz' => QUIZ_NAME,
)),
'access' => user_access('create quiz'),
);
$items[] = array(
'path' => 'admin/quiz',
'title' => t('@quiz Results', array(
'@quiz' => QUIZ_NAME,
)),
'callback' => 'quiz_admin',
'access' => user_access('administer quiz'),
'type' => MENU_NORMAL_ITEM,
);
}
else {
drupal_add_css(drupal_get_path('module', 'quiz') . '/quiz.css', 'module', 'all');
if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
if ($node->type == 'quiz') {
// Menu item for creating adding questions to quiz
$items[] = array(
'path' => 'node/' . arg(1) . '/questions',
'title' => t('Manage questions'),
'callback' => 'quiz_questions',
'access' => user_access('create quiz'),
'type' => MENU_LOCAL_TASK,
);
// Menu item for quiz taking interface
$items[] = array(
'path' => 'node/' . arg(1) . '/quiz/start',
'title' => t('Take @quiz', array(
'@quiz' => QUIZ_NAME,
)),
'callback' => 'quiz_take_quiz',
'access' => _quiz_status_access($node),
'type' => MENU_LOCAL_TASK,
);
}
}
else {
$items[] = array(
'path' => 'user/' . arg(1) . '/myresults',
'title' => t('my results'),
'callback' => 'quiz_get_user_results',
'access' => user_access('user results'),
'type' => MENU_LOCAL_TASK,
);
$items[] = array(
'path' => 'user/quiz/' . arg(2) . '/userresults',
'title' => t('User Results'),
'callback' => 'quiz_user_results',
'access' => user_access('user results'),
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'admin/quiz/' . arg(2) . '/view',
'title' => t('View @quiz', array(
'@quiz' => QUIZ_NAME,
)),
'callback' => 'quiz_admin_results',
'access' => user_access('administer quiz'),
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'admin/quiz/' . arg(2) . '/delete',
'title' => t('Delete @quiz', array(
'@quiz' => QUIZ_NAME,
)),
'callback' => 'quiz_admin_result_delete',
'access' => user_access('administer quiz'),
'type' => MENU_CALLBACK,
);
}
}
return $items;
}