You are here

matching.module in Quiz 6.6

Matching question type for quiz module

Allows the creation of matching questions, which associate one term with another

File

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

/**
 * @file
 * Matching question type for quiz module
 *
 * Allows the creation of matching questions, which associate one term
 * with another
 */

/**
 * Implementation of hook_node().
 */

/*
function matching_node_info() {
  return array('matching' => array('name' => t('matching'), 'base' => 'matching'));
}*/

/**
 * Implementation of hook_help().
 */
function matching_help($path, $args) {
  switch ($path) {
    case 'admin/modules#description':
      return t('Matching question type for quiz module.');
    case 'node/add#matching':
    case 'admin/help#matching':
      return t('A question type for the quiz module: allows you to create matching type questions, which connect terms with one another.');
    default:
      break;
  }
}

/**
 * Implementation of hook_menu().
 */
function matching_menu() {
  $items['admin/quiz/matching'] = array(
    'title' => t('Matching configuration'),
    'description' => t('Configure Matching questions for users.'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'matching_admin_settings_form',
    ),
    'access arguments' => array(
      QUIZ_PERM_ADMIN_CONFIG,
    ),
    'type' => MENU_NORMAL_ITEM,
  );
  return $items;
}

/**
 * Implementation of hook_quiz_question_info().
 */
function matching_quiz_question_info() {
  return array(
    'matching' => array(
      'name' => 'Matching',
      'description' => 'Matching question type for quiz module. A question type for the quiz module: allows you to create matching type questions, which connect terms with one another.',
      'question provider' => 'MatchingQuestion',
      'response provider' => 'MatchingResponse',
      'module' => 'quiz_question',
    ),
  );
}

/**
 * Implementation of hook_autoload_info().
 */
function matching_autoload_info() {
  return array(
    'MatchingQuestion' => array(
      'file' => 'matching.classes.inc',
    ),
    'MatchingResponse' => array(
      'file' => 'matching.classes.inc',
    ),
  );
}

/**
 * Implementation of hook_theme().
 */
function matching_theme() {
  return array(
    'matching_question' => array(
      //'arguments' => array('question' => NULL, 'show_points' => NULL, 'show_feedback' => NULL),
      'file' => 'matching.theme.inc',
    ),
  );
}

/*
// Temporary holding place for list_questions hook
function matching_list_questions() {
  return array();
}
*/

/*
 * @function
 * To generate a list of short answer questions node
 * @return
 * array containing nid as key and title as value
 */
function matching_questions_list() {
  $questions = array();
  $type = 'matching';
  $sql = "SELECT nid, title FROM {node} WHERE type = '%s'";
  $results = db_query($sql, $type);
  while ($result = db_fetch_object($results)) {
    $questions[$result->nid] = check_plain($result->title);
  }
  return $questions;
}

Functions

Namesort descending Description
matching_autoload_info Implementation of hook_autoload_info().
matching_help Implementation of hook_help().
matching_menu Implementation of hook_menu().
matching_questions_list
matching_quiz_question_info Implementation of hook_quiz_question_info().
matching_theme Implementation of hook_theme().