You are here

function quiz_menu in Quiz 7.4

Same name and namespace in other branches
  1. 8.6 quiz.module \quiz_menu()
  2. 8.4 quiz.module \quiz_menu()
  3. 8.5 quiz.module \quiz_menu()
  4. 5.2 quiz.module \quiz_menu()
  5. 5 quiz.module \quiz_menu()
  6. 6.6 quiz.module \quiz_menu()
  7. 6.2 quiz.module \quiz_menu()
  8. 6.3 quiz.module \quiz_menu()
  9. 6.4 quiz.module \quiz_menu()
  10. 6.5 quiz.module \quiz_menu()
  11. 7.6 quiz.module \quiz_menu()
  12. 7 quiz.module \quiz_menu()
  13. 7.5 quiz.module \quiz_menu()
  14. 6.x quiz.module \quiz_menu()

Implements hook_menu().

File

./quiz.module, line 391
Quiz Module

Code

function quiz_menu() {

  // Take quiz.
  $items['node/%node/take'] = array(
    'title' => 'Take',
    'page callback' => 'quiz_take',
    'page arguments' => array(
      1,
    ),
    'access callback' => 'quiz_take_access',
    'access arguments' => array(
      1,
    ),
    'type' => MENU_LOCAL_TASK,
  );

  // Admin pages.
  $items['admin/quiz'] = array(
    'title' => '@quiz',
    'title arguments' => array(
      '@quiz' => QUIZ_NAME,
    ),
    'description' => 'View results, score answers, run reports and edit configurations.',
    'page callback' => 'system_admin_menu_block_page',
    'access arguments' => array(
      'administer quiz configuration',
      'score any quiz',
      'score own quiz',
      'view any quiz results',
      'view results for own quiz',
    ),
    'access callback' => 'quiz_access_multi_or',
    'type' => MENU_NORMAL_ITEM,
    'file' => 'system.admin.inc',
    'file path' => drupal_get_path('module', 'system'),
  );
  $items['admin/quiz/settings'] = array(
    'title' => '@quiz settings',
    'title arguments' => array(
      '@quiz' => QUIZ_NAME,
    ),
    'description' => 'Change settings for the all Quiz project modules.',
    'page callback' => 'system_admin_menu_block_page',
    'access arguments' => array(
      'administer quiz configuration',
    ),
    'type' => MENU_NORMAL_ITEM,
    'file' => 'system.admin.inc',
    'file path' => drupal_get_path('module', 'system'),
  );
  $items['admin/quiz/settings/config'] = array(
    'title' => '@quiz configuration',
    'title arguments' => array(
      '@quiz' => QUIZ_NAME,
    ),
    'description' => 'Configure the Quiz module.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'quiz_admin_settings',
    ),
    'access arguments' => array(
      'administer quiz configuration',
    ),
    'type' => MENU_NORMAL_ITEM,
    // optional
    'file' => 'quiz.admin.inc',
  );
  $items['admin/quiz/settings/quiz_form'] = array(
    'title' => '@quiz form configuration',
    'title arguments' => array(
      '@quiz' => QUIZ_NAME,
    ),
    'description' => 'Configure default values for the quiz creation form.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'quiz_admin_node_form',
    ),
    'access arguments' => array(
      'administer quiz configuration',
    ),
    'type' => MENU_NORMAL_ITEM,
    // optional
    'file' => 'quiz.admin.inc',
  );
  $items['admin/quiz/reports'] = array(
    'title' => 'Quiz reports and scoring',
    'title arguments' => array(
      '@quiz' => QUIZ_NAME,
    ),
    'description' => 'View reports and score answers.',
    'page callback' => 'system_admin_menu_block_page',
    'access arguments' => array(
      'view any quiz results',
      'view results for own quiz',
    ),
    'access callback' => 'quiz_access_multi_or',
    'type' => MENU_NORMAL_ITEM,
    'file' => 'system.admin.inc',
    'file path' => drupal_get_path('module', 'system'),
  );
  $items['admin/quiz/reports/results'] = array(
    'title' => '@quiz results',
    'title arguments' => array(
      '@quiz' => QUIZ_NAME,
    ),
    'description' => 'View results.',
    'page callback' => 'quiz_admin_quizzes',
    'access arguments' => array(
      'view any quiz results',
      'view results for own quiz',
    ),
    'access callback' => 'quiz_access_multi_or',
    'type' => MENU_NORMAL_ITEM,
    'file' => 'quiz.admin.inc',
  );
  $items['node/%node/results'] = array(
    'title' => 'Results',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'quiz_results_manage_results_form',
      1,
    ),
    'access arguments' => array(
      1,
    ),
    'access callback' => 'quiz_access_results',
    'type' => MENU_LOCAL_TASK,
    'file' => 'quiz.admin.inc',
    'weight' => 3,
  );
  $items['node/%node/myresults'] = array(
    'title' => 'My results',
    'page callback' => 'quiz_my_results',
    'page arguments' => array(
      1,
    ),
    'access callback' => 'quiz_access_my_results',
    'access arguments' => array(
      1,
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'quiz.pages.inc',
    'weight' => 3,
  );
  $items['node/%node/myresults/%quiz_rid'] = array(
    'title' => 'User results',
    'page callback' => 'quiz_user_results',
    'page arguments' => array(
      3,
    ),
    'access arguments' => array(
      3,
    ),
    'access callback' => 'quiz_access_my_result',
    'type' => MENU_CALLBACK,
    'file' => 'quiz.pages.inc',
  );
  $items['node/%node/results/%quiz_rid'] = array(
    'title' => 'Results',
    'page callback' => 'quiz_admin_results',
    'page arguments' => array(
      1,
      3,
    ),
    'type' => MENU_CALLBACK,
    // , MENU_SUGGESTED_ITEM, MENU_LOCAL_TASK, MENU_DEFAULT_LOCAL_TASK
    'file' => 'quiz.admin.inc',
    'access arguments' => array(
      1,
      3,
    ),
    'access callback' => 'quiz_access_results',
  );

  // Add questions to quiz.
  $items['node/%node/questions'] = array(
    'title' => 'Manage questions',
    'page callback' => 'quiz_questions',
    'page arguments' => array(
      1,
    ),
    'access callback' => 'quiz_type_confirm',
    'access arguments' => array(
      1,
      'update',
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'quiz.admin.inc',
    'weight' => 2,
  );

  // User pages.
  $items['user/%/myresults'] = array(
    'title' => 'My results',
    'page callback' => 'quiz_get_user_results',
    'page arguments' => array(
      1,
    ),
    'access callback' => '_quiz_user_results_access',
    'access arguments' => array(
      1,
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'quiz.pages.inc',
  );
  $items['user/quiz/%/userresults'] = array(
    'title' => 'User results',
    'page callback' => 'quiz_user_results',
    'page arguments' => array(
      2,
    ),
    'access arguments' => array(
      2,
    ),
    'access callback' => 'quiz_access_my_result',
    'type' => MENU_CALLBACK,
    'file' => 'quiz.pages.inc',
  );
  $items['node/%node/questions/browser_ahah'] = array(
    //TODO: Add node access instead of user access...
    'page callback' => 'quiz_browser_ahah',
    'type' => MENU_CALLBACK,
    'access arguments' => array(
      'create quiz content',
    ),
    'file' => 'quiz.admin.inc',
  );
  $items['node/%node/questions/term_ahah'] = array(
    //TODO: Add node access instead of user access...
    'page callback' => 'quiz_categorized_term_ahah',
    'type' => MENU_CALLBACK,
    'access arguments' => array(
      'create quiz content',
    ),
    'file' => 'quiz.admin.inc',
  );
  $items['node/%node/results/browser_ahah'] = array(
    'page callback' => 'quiz_results_mr_browser_ahah',
    'type' => MENU_CALLBACK,
    'access callback' => 'quiz_access_results',
    'access arguments' => array(
      1,
    ),
    'file' => 'quiz.admin.inc',
  );
  return $items;
}