You are here

interface QuizQuestion in Quiz 6.3

Same name and namespace in other branches
  1. 6.6 question_types/quiz_question/quiz_question.core.inc \QuizQuestion
  2. 6.5 question_types/quiz_question/quiz_question.core.inc \QuizQuestion

A Quiz Question. There should be an implementation of this interface for every question type support by Quiz.

Hierarchy

Expanded class hierarchy of QuizQuestion

All classes that implement QuizQuestion

File

question_types/quiz_question/quiz_question.core.inc, line 35
Classes used in the Quiz Question module.

View source
interface QuizQuestion {

  /**
   * Construct a new quiz question.
   */
  public function __construct($node);

  /**
   * Responsible for handling insert/update of question-specific data.
   * This is typically called from within the Node API, so there is no need
   * to save the node. This function is only responsible for saving data
   * specific to the implement ation.
   *
   * The $is_new flag is set to TRUE whenever the node is being initially
   * created.
   *
   * A save function is required to handle the following three situations:
   * - A new node is created ($is_new is TRUE)
   * - A new node *revision* is created ($is_new is NOT set, because the
   *   node itself is not new).
   * - An existing node revision is modified.
   *
   * @param $is_new
   *  TRUE when the node is initially created.
   */
  public function save($is_new = FALSE);

  /**
   * Provides validation for question before it is created.
   *
   * When a new question is created and initially submited, this is
   * called to validate that the settings are acceptible.
   *
   * @param $node
   *  The node storing the question.
   * @param $form
   *  The processed form.
   */
  public function validate($node, &$form);

  /**
   * Deletes a question from the database.
   *
   * @param $only_this_version
   *  If the $only_this_version flag is TRUE, then only the particular
   *  nid/vid combo should be deleted. Otherwise, all questions with the
   *  current nid can be deleted.
   */
  public function delete($only_this_version = FALSE);

  /**
   * Retrieve information relevant for viewing the node.
   * This data is generally added to the node's extra field.
   */
  public function view();

  /**
   * Retrieve information about the question and add it to the node.
   */
  public function load();

  /**
   * Get the form that will be displayed to the test-taking user.
   *
   * @param $node
   *  The question node.
   * @param $context
   *  The form context.
   * @return
   *  Must return a FAPI array.
   */
  public function getQuestionForm($node, $context = NULL);

  /**
   * Get the form that contains admin settings for this question type.
   *
   * @return
   *  Must return a FAPI array.
   */
  public function getAdminForm($edit = NULL);

  /**
   * Get the form used to create a new question.
   * @return
   *  Must return a FAPI array.
   */
  public function getCreationForm($edit);

  /**
   * Get the maximum possible score for this question.
   */
  public function getMaximumScore();

}

Members

Namesort descending Modifiers Type Description Overrides
QuizQuestion::delete public function Deletes a question from the database. 5
QuizQuestion::getAdminForm public function Get the form that contains admin settings for this question type. 5
QuizQuestion::getCreationForm public function Get the form used to create a new question. 5
QuizQuestion::getMaximumScore public function Get the maximum possible score for this question. 5
QuizQuestion::getQuestionForm public function Get the form that will be displayed to the test-taking user. 5
QuizQuestion::load public function Retrieve information about the question and add it to the node. 5
QuizQuestion::save public function Responsible for handling insert/update of question-specific data. This is typically called from within the Node API, so there is no need to save the node. This function is only responsible for saving data specific to the implement ation. 5
QuizQuestion::validate public function Provides validation for question before it is created. 5
QuizQuestion::view public function Retrieve information relevant for viewing the node. This data is generally added to the node's extra field. 5
QuizQuestion::__construct public function Construct a new quiz question. 5