get_string('missingformula', 'quiz');
}
if ($formulaerrors =
- quiz_qtype_calculated_find_formula_errors($answer)) {
+ qtype_calculated_find_formula_errors($answer)) {
$calculatedmessages[] = $formulaerrors;
}
if (! isset($form->tolerance[$key])) {
}
foreach ($numericalquestion->options->answers as $key => $answer) {
$answer = &$numericalquestion->options->answers[$key]; // for PHP 4.x
- $correctanswer = quiz_qtype_calculated_calculate_answer(
+ $correctanswer = qtype_calculated_calculate_answer(
$answer->answer, $state->options->dataset, $answer->tolerance,
$answer->tolerancetype, $answer->correctanswerlength,
$answer->correctanswerformat, $unit->unit);
$delimiter = ': ';
$virtualqtype = $this->get_virtual_qtype();
foreach ($answers as $answer) {
- $calculated = quiz_qtype_calculated_calculate_answer(
+ $calculated = qtype_calculated_calculate_answer(
$answer->answer, $data, $answer->tolerance,
$answer->tolerancetype, $answer->correctanswerlength,
$answer->correctanswerformat, $unit);
$unit = $virtualqtype->get_default_numerical_unit($question);
foreach ($question->options->answers as $answer) {
if (((int) $answer->fraction) === 1) {
- $answernumerical = quiz_qtype_calculated_calculate_answer(
+ $answernumerical = qtype_calculated_calculate_answer(
$answer->answer, $state->options->dataset, $answer->tolerance,
$answer->tolerancetype, $answer->correctanswerlength,
$answer->correctanswerformat, $unit->unit);
function substitute_variables($str, $dataset) {
$formula = parent::substitute_variables($str, $dataset);
- if ($error = quiz_qtype_calculated_find_formula_errors($formula)) {
+ if ($error = qtype_calculated_find_formula_errors($formula)) {
return $error;
}
/// Calculate the correct answer
// The following adds the questiontype to the menu of types shown to teachers
$QTYPE_MENU['calculated'] = get_string("calculated", "quiz");
-function quiz_qtype_calculated_calculate_answer($formula, $individualdata,
+function qtype_calculated_calculate_answer($formula, $individualdata,
$tolerance, $tolerancetype, $answerlength, $answerformat='1', $unit='') {
/// The return value has these properties:
/// ->answer the correct answer
}
-function quiz_qtype_calculated_find_formula_errors($formula) {
+function qtype_calculated_find_formula_errors($formula) {
/// Validates the formula submitted from the question edit page.
/// Returns false if everything is alright.
/// Otherwise it constructs an error message
// and it therefore often sticks to some kind of odd behaviour
//
-class quiz_description_qtype extends default_questiontype {
+class description_qtype extends default_questiontype {
function name() {
return 'description';
//// INITIATION - Without this line the question type is not in use... ///
//////////////////////////////////////////////////////////////////////////
// define("DESCRIPTION", "7"); // already defined in questionlib.php
-$QTYPES['description']= new quiz_description_qtype();
+$QTYPES['description']= new description_qtype();
// The following adds the questiontype to the menu of types shown to teachers
$QTYPE_MENU['description'] = get_string("description", "quiz");
$subquestion->questiontext = $questiontext;
$subquestion->answertext = $answertext;
if (!update_record("question_match_sub", $subquestion)) {
- $result->error = "Could not insert quiz match subquestion! (id=$subquestion->id)";
+ $result->error = "Could not insert match subquestion! (id=$subquestion->id)";
return $result;
}
} else {
$subquestion->questiontext = $questiontext;
$subquestion->answertext = $answertext;
if (!$subquestion->id = insert_record("question_match_sub", $subquestion)) {
- $result->error = "Could not insert quiz match subquestion!";
+ $result->error = "Could not insert match subquestion!";
return $result;
}
}
$options->subquestions = implode(",",$subquestions);
$options->shuffleanswers = $question->shuffleanswers;
if (!update_record("question_match", $options)) {
- $result->error = "Could not update quiz match options! (id=$options->id)";
+ $result->error = "Could not update match options! (id=$options->id)";
return $result;
}
} else {
$options->subquestions = implode(",",$subquestions);
$options->shuffleanswers = $question->shuffleanswers;
if (!insert_record("question_match", $options)) {
- $result->error = "Could not insert quiz match options!";
+ $result->error = "Could not insert match options!";
return $result;
}
}
// the wrapped shortanswer questions.
//if ($options->feedback
// && !empty($subquestion->options->answers[$responses[$key]]->feedback)) {
- // quiz_print_comment($subquestion->options->answers[$responses[$key]]->feedback);
+ // print_comment($subquestion->options->answers[$responses[$key]]->feedback);
//}
$anss[] = clone($a);
///
/// QUESTION TYPE CLASS //////////////////
-class quiz_embedded_cloze_qtype extends default_questiontype {
+class embedded_cloze_qtype extends default_questiontype {
function name() {
return 'multianswer';
notify("Unable to get options for questiontype {$wrapped->qtype} (id={$wrapped->id})");
}
// for wrapped questions the maxgrade is always equal to the defaultgrade,
- // there is no entry in the quiz_question_instances table for them
+ // there is no entry in the question_instances table for them
$wrapped->maxgrade = $wrapped->defaultgrade;
$question->options->questions[$sequence[$wrapped->id]] = clone($wrapped); // ??? Why do we need a clone here?
}
function save_question($authorizedquestion, $form, $course) {
- $question = quiz_qtype_multianswer_extract_question ($form->questiontext);
+ $question = qtype_multianswer_extract_question ($form->questiontext);
if (isset($authorizedquestion->id)) {
$question->id = $authorizedquestion->id;
$question->version = $form->version = $authorizedquestion->version;
//////////////////////////////////////////////////////////////////////////
//// INITIATION - Without this line the question type is not in use... ///
//////////////////////////////////////////////////////////////////////////
-$QTYPES['multianswer']= new quiz_embedded_cloze_qtype();
+$QTYPES['multianswer']= new embedded_cloze_qtype();
// The following adds the questiontype to the menu of types shown to teachers
$QTYPE_MENU['multianswer'] = get_string("multianswer", "quiz");
/////////////////////////////////////////////////////////////
-function quiz_qtype_multianswer_extract_question($text) {
+function qtype_multianswer_extract_question($text) {
////////////////////////////////////////////////
//// Define some constants first. It is not the
-//// pattern commonly used in quiz/questiontypes.
+//// pattern commonly used in questiontypes.
//// The reason is that it has been moved here from
-//// quiz/format/multianswer/format.php
+//// question/format/multianswer/format.php
////////////////////////////////////////////////
* Includes configuration settings for the question type on the quiz admin
* page
*
+ * TODO: It makes no sense any longer to do the admin for question types
+ * from the quiz admin page. This should be changed.
* Returns an array of objects describing the options for the question type
* to be included on the quiz module admin page.
* Configuration options can be included by setting the following fields in
/**
* Prints a table of course modules in which the question is used
*
+ * TODO: This should be made quiz-independent
+ *
* This function is used near the end of the question edit forms in all question types
* It prints the table of quizzes in which the question is used
* containing checkboxes to allow the teacher to replace the old question version
//////////////
/// QUESTION TYPE CLASS //////////////////
-class quiz_random_qtype extends default_questiontype {
+class random_qtype extends default_questiontype {
var $excludedtypes = array('random', 'randomsamatch', 'essay', 'description');
//////////////////////////////////////////////////////////////////////////
//// INITIATION - Without this line the question type is not in use... ///
//////////////////////////////////////////////////////////////////////////
-// define("RANDOM", "4"); // already defined in questionlib.php
-$QTYPES[RANDOM]= new quiz_random_qtype();
+$QTYPES[RANDOM]= new random_qtype();
?>