You are here

function quiz_menu in Quiz 6.6

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.2 quiz.module \quiz_menu()
  7. 6.3 quiz.module \quiz_menu()
  8. 6.4 quiz.module \quiz_menu()
  9. 6.5 quiz.module \quiz_menu()
  10. 7.6 quiz.module \quiz_menu()
  11. 7 quiz.module \quiz_menu()
  12. 7.4 quiz.module \quiz_menu()
  13. 7.5 quiz.module \quiz_menu()
  14. 6.x quiz.module \quiz_menu()

Implementation of hook_menu().

File

./quiz.module, line 149
Quiz Module

Code

function quiz_menu() {

  // ADMIN //
  $items['admin/quiz'] = array(
    'title' => t('@quiz management', array(
      '@quiz' => QUIZ_NAME,
    )),
    'description' => t('View @quiz results, score tests, run reports.', array(
      '@quiz' => QUIZ_NAME,
    )),
    'page callback' => 'system_admin_menu_block_page',
    'access arguments' => array(
      QUIZ_PERM_ADMIN_CONFIG,
    ),
    'type' => MENU_NORMAL_ITEM,
    // MENU_CALLBACK, MENU_SUGGESTED_ITEM, MENU_LOCAL_TASK, MENU_DEFAULT_LOCAL_TASK
    'file' => 'system.admin.inc',
    'file path' => drupal_get_path('module', 'system'),
  );
  $items['admin/quiz/settings'] = array(
    'title' => t('@quiz configuration', array(
      '@quiz' => QUIZ_NAME,
    )),
    'description' => t('Configure @quiz options.', array(
      '@quiz' => QUIZ_NAME,
    )),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'quiz_admin_settings',
    ),
    'access arguments' => array(
      QUIZ_PERM_ADMIN_CONFIG,
    ),
    'type' => MENU_NORMAL_ITEM,
    // optional
    'file' => 'quiz.admin.inc',
  );
  $items['admin/quiz/reports'] = array(
    'title' => t('@quiz reports', array(
      '@quiz' => QUIZ_NAME,
    )),
    'description' => t('View @quiz reports.', array(
      '@quiz' => QUIZ_NAME,
    )),
    'page callback' => 'system_admin_menu_block_page',
    'access arguments' => array(
      QUIZ_PERM_ADMIN_CONFIG,
    ),
    'type' => MENU_NORMAL_ITEM,
    'file' => 'system.admin.inc',
    'file path' => drupal_get_path('module', 'system'),
  );
  $items['admin/quiz/reports/results'] = array(
    'title' => t('@quiz results', array(
      '@quiz' => QUIZ_NAME,
    )),
    'description' => 'View results.',
    'page callback' => 'quiz_admin_quizzes',
    'access arguments' => array(
      QUIZ_PERM_ADMIN_CONFIG,
    ),
    'type' => MENU_NORMAL_ITEM,
    'file' => 'quiz.admin.inc',
  );
  $items['admin/quiz/reports/%/results'] = array(
    'title' => t('View @quiz', array(
      '@quiz' => QUIZ_NAME,
    )),
    'description' => t('View results for the given quiz.'),
    'page callback' => 'quiz_admin_results',
    'page arguments' => array(
      3,
    ),
    'type' => MENU_NORMAL_ITEM,
    // MENU_CALLBACK, MENU_SUGGESTED_ITEM, MENU_LOCAL_TASK, MENU_DEFAULT_LOCAL_TASK
    'file' => 'quiz.admin.inc',
    'access arguments' => array(
      QUIZ_PERM_ADMIN_CONFIG,
    ),
  );
  $items['admin/quiz/%/view'] = array(
    'title' => t('View @quiz', array(
      '@quiz' => QUIZ_NAME,
    )),
    'page callback' => 'quiz_admin',
    'page arguments' => array(
      2,
    ),
    'access arguments' => array(
      'administer quiz',
    ),
    'type' => MENU_CALLBACK,
    'file' => 'quiz.admin.inc',
  );
  $items['admin/quiz/%/delete'] = array(
    'title' => t('Delete @quiz', array(
      '@quiz' => QUIZ_NAME,
    )),
    'page callback' => 'quiz_admin_result_delete',
    //'page arguments' => array(2),
    'access arguments' => array(
      'administer quiz',
    ),
    'type' => MENU_CALLBACK,
    'file' => 'quiz.admin.inc',
  );

  // JSON callback
  $items['admin/quiz/listquestions'] = array(
    'title' => t('List Quiz Questions'),
    'description' => t('Auto-completion question listing.'),
    'page callback' => 'quiz_admin_list_questions_ac',
    'page arguments' => array(
      '',
    ),
    'type' => MENU_CALLBACK,
    //'access callback' => 'user_access',
    'access arguments' => array(
      'create quiz',
    ),
    'file' => 'quiz.admin.inc',
  );

  // AHAH callback
  $items['admin/quiz/newquestion'] = array(
    'title' => t('Add a Question to a Quiz'),
    'description' => t('AHAH Callback for adding a quiz question'),
    'page callback' => 'quiz_admin_add_question_ahah',
    'type' => MENU_CALLBACK,
    'access arguments' => array(
      'create quiz',
    ),
    'file' => 'quiz.admin.inc',
  );

  // Menu item for adding questions to quiz.
  $items['node/%quiz_type_access/questions'] = array(
    'title' => t('Manage questions'),
    'page callback' => 'quiz_questions',
    'page arguments' => array(
      1,
    ),
    'access callback' => 'node_access',
    'access arguments' => array(
      'update',
      1,
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'quiz.admin.inc',
  );
  $items['node/%quiz_type_access/admin'] = array(
    'title' => t('Quiz admin', array(
      '@quiz' => QUIZ_NAME,
    )),
    'page callback' => 'theme',
    'page arguments' => array(
      'quiz_view',
      1,
    ),
    'access arguments' => array(
      'administer quiz',
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'quiz.admin.inc',
  );

  // USER //
  $items['user/%/myresults'] = array(
    'title' => t('My results'),
    'page callback' => 'quiz_get_user_results',
    'page arguments' => array(
      1,
    ),
    'access arguments' => array(
      'view own results',
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'quiz.pages.inc',
  );
  $items['user/quiz/%/userresults'] = array(
    'title' => t('User results'),
    'page callback' => 'quiz_user_results',
    'page arguments' => array(
      2,
    ),
    'access arguments' => array(
      'view own results',
    ),
    'type' => MENU_CALLBACK,
    'file' => 'quiz.pages.inc',
  );
  return $items;
}