You are here

truefalse.module in Quiz 6.4

TrueFalse question type for quiz module

Allows the creation of "True or False" questions

File

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

/**
 * @file
 * TrueFalse question type for quiz module
 *
 * Allows the creation of "True or False" questions
 */

/**
 * Implementation of hook_help().
 */
function truefalse_help($path, $args) {
  switch ($path) {
    case 'admin/modules#description':
      return t('TrueFalse question type for the quiz module.');
    case 'node/add#truefalse':
    case 'admin/help#truefalse':
      return t('A question type for the quiz module. A simplified version of multichoice where "true" and "false" are the alternatives.');
    default:
      break;
  }
}

/**
 * Implementation of hook_quiz_question_info().
 */
function truefalse_quiz_question_info() {
  return array(
    'truefalse' => array(
      'name' => t('True/false question'),
      'description' => t('Quiz questions that allow a user to select "true" or "false" as his response to a statement.'),
      'question provider' => 'TrueFalseQuestion',
      'response provider' => 'TrueFalseResponse',
      'module' => 'quiz_question',
    ),
  );
}

/**
 * Implementation of the quiz_question hook_config
 */
function truefalse_config() {
  return FALSE;
}

/**
 * Implementation of hook_autoload_info().
 */
function truefalse_autoload_info() {
  return array(
    'TrueFalseQuestion' => array(
      'file' => 'truefalse.classes.inc',
    ),
    'TrueFalseResponse' => array(
      'file' => 'truefalse.classes.inc',
    ),
  );
}

/**
 * Implementation of hook_theme().
 */
function truefalse_theme() {
  return array(
    'truefalse_answering_form' => array(
      'arguments' => array(
        'form' => NULL,
      ),
      'path' => drupal_get_path('module', 'truefalse') . '/theme',
      'template' => 'truefalse-answering-form',
    ),
    'truefalse_response' => array(
      'arguments' => array(
        'metadata' => array(),
        'data' => array(),
      ),
    ),
  );
}

/**
 * Theme the response part of the response report
 *
 * @param $metadata
 *  Can be used as a table header
 * @param $data
 *  Can be used as table rows
 */
function theme_truefalse_response($metadata, $data) {
  return theme('table', $metadata, $data);
}

Functions

Namesort descending Description
theme_truefalse_response Theme the response part of the response report
truefalse_autoload_info Implementation of hook_autoload_info().
truefalse_config Implementation of the quiz_question hook_config
truefalse_help Implementation of hook_help().
truefalse_quiz_question_info Implementation of hook_quiz_question_info().
truefalse_theme Implementation of hook_theme().