You are here

quiz_multichoice.module in Quiz 8.6

File

question_types/quiz_multichoice/quiz_multichoice.module
View source
<?php

/**
 * @file
 * Contains quiz_multichoice.module
 */

/**
 * Implements hook_help().
 */
function quiz_multichoice_help($path, $args) {
  switch ($path) {
    case 'help.page.quiz_multichoice':
      return t("\n      <p>This module provides a multiple choice question type for Quiz.</p>\n\n      <p>The module has three settings.\n      <em>Multiple answers</em> allows the quiz taker to select more than one alternative\n      (it also allows for the possibility that none of the alternatives are correct).\n      Alternatives are selected using checkboxes instead of radio buttons.\n      <em>Random order</em> displays the alternatives in random order when quiz is beeing taken.\n      <em>Simple scoring</em> gives max score if everything is correct. Zero points otherwise.</p>\n\n      <p>The scoring system in multichoice is a bit complex. With multiple answers each alternative adds a given number of points to\n      the total score if it is chosen, and another number of points is added if the alternative isn't chosen. Both <em>score if chosen</em> and\n      <em>score if not chosen</em> may be edited for each alternative by the question creator.\n      If multiple answers isn't allowed the score will be set to the <em>score if chosen</em> of the alternative that has been chosen.\n      The question is considered correct if the quiz taker gets the maximum amount of points possible for the question.</p>\n    ");
  }
}

/**
 * Implements hook_quiz_question_config().
 */
function multichoice_quiz_question_config() {
  $form['multichoice_def_scoring'] = array(
    '#type' => 'radios',
    '#title' => t('Default scoring method'),
    '#description' => t('Choose the default scoring method for questions with multiple correct answers.'),
    '#options' => array(
      0 => t('Give minus one point for incorrect answers'),
      1 => t("Give one point for each incorrect option that haven't been chosen"),
    ),
    '#default_value' => variable_get('multichoice_def_scoring', 0),
  );
  $form['#validate'][] = 'multichoice_config_validate';
  return $form;
}

/**
 * Implements hook_theme().
 */
function multichoice_theme($existing, $type, $theme, $path) {
  return array(
    'multichoice_answer_node_view' => array(
      'variables' => array(
        'alternatives' => NULL,
        'show_correct' => NULL,
      ),
      'path' => $path,
      'file' => 'multichoice.theme.inc',
    ),
  );
}

/**
 * Implements hook_user_cancel().
 */
function multichoice_user_cancel($edit, $account, $method) {
  db_delete('quiz_multichoice_user_settings')
    ->condition('uid', $account->uid)
    ->execute();
}

Functions

Namesort descending Description
multichoice_quiz_question_config Implements hook_quiz_question_config().
multichoice_theme Implements hook_theme().
multichoice_user_cancel Implements hook_user_cancel().
quiz_multichoice_help Implements hook_help().