You are here

function qformat_default::defaultquestion in Quiz 6.6

Same name and namespace in other branches
  1. 6.5 includes/moodle/question/format.php \qformat_default::defaultquestion()

return an "empty" question Somewhere to specify question parameters that are not handled by import but are required db fields. This should not be overridden.

Return value

object default question

21 calls to qformat_default::defaultquestion()
qformat_aiken::readquestions in includes/moodle/question/format/aiken/format.php
Parses an array of lines into an array of questions, where each item is a question object as defined by readquestion(). Questions are defined as anything between blank lines.
qformat_blackboard::process_essay in includes/moodle/question/format/blackboard/format.php
qformat_blackboard::process_fib in includes/moodle/question/format/blackboard/format.php
qformat_blackboard::process_ma in includes/moodle/question/format/blackboard/format.php
qformat_blackboard::process_matching in includes/moodle/question/format/blackboard/format.php

... See full list

File

includes/moodle/question/format.php, line 487

Class

qformat_default
Base class for question import and export formats.

Code

function defaultquestion() {
  global $CFG;
  $question = new stdClass();
  $question->shuffleanswers = $CFG->quiz_shuffleanswers;
  $question->defaultgrade = 1;
  $question->image = "";
  $question->usecase = 0;
  $question->multiplier = array();
  $question->generalfeedback = '';
  $question->correctfeedback = '';
  $question->partiallycorrectfeedback = '';
  $question->incorrectfeedback = '';
  $question->answernumbering = 'abc';
  $question->penalty = 0.1;
  $question->length = 1;

  // this option in case the questiontypes class wants
  // to know where the data came from
  $question->export_process = true;
  $question->import_process = true;
  return $question;
}