Removed some more references to quiz from the questiontype code.

This commit is contained in:
gustav_delius 2006-03-22 21:51:33 +00:00
parent fe9b5cfd0b
commit 7518b645b9
6 changed files with 27 additions and 24 deletions

View file

@ -169,7 +169,7 @@ class question_calculated_qtype extends question_dataset_dependent_questiontype
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])) {
@ -231,7 +231,7 @@ class question_calculated_qtype extends question_dataset_dependent_questiontype
}
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);
@ -502,7 +502,7 @@ class question_calculated_qtype extends question_dataset_dependent_questiontype
$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);
@ -574,7 +574,7 @@ class question_calculated_qtype extends question_dataset_dependent_questiontype
$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);
@ -586,7 +586,7 @@ class question_calculated_qtype extends question_dataset_dependent_questiontype
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
@ -708,7 +708,7 @@ $QTYPES['calculated']= new question_calculated_qtype();
// 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
@ -802,7 +802,7 @@ function quiz_qtype_calculated_calculate_answer($formula, $individualdata,
}
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

View file

@ -11,7 +11,7 @@
// 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';
@ -70,7 +70,7 @@ class quiz_description_qtype extends default_questiontype {
//// 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");

View file

@ -48,7 +48,7 @@ class question_match_qtype extends default_questiontype {
$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 {
@ -62,7 +62,7 @@ class question_match_qtype extends default_questiontype {
$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;
}
}
@ -86,7 +86,7 @@ class question_match_qtype extends default_questiontype {
$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 {
@ -95,7 +95,7 @@ class question_match_qtype extends default_questiontype {
$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;
}
}
@ -267,7 +267,7 @@ class question_match_qtype extends default_questiontype {
// 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);

View file

@ -13,7 +13,7 @@
///
/// QUESTION TYPE CLASS //////////////////
class quiz_embedded_cloze_qtype extends default_questiontype {
class embedded_cloze_qtype extends default_questiontype {
function name() {
return 'multianswer';
@ -39,7 +39,7 @@ class quiz_embedded_cloze_qtype extends default_questiontype {
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?
@ -106,7 +106,7 @@ class quiz_embedded_cloze_qtype extends default_questiontype {
}
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;
@ -583,7 +583,7 @@ class quiz_embedded_cloze_qtype extends default_questiontype {
//////////////////////////////////////////////////////////////////////////
//// 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");
@ -597,13 +597,13 @@ $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
////////////////////////////////////////////////

View file

@ -819,6 +819,8 @@ class default_questiontype {
* 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
@ -877,6 +879,8 @@ class default_questiontype {
/**
* 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

View file

@ -5,7 +5,7 @@
//////////////
/// QUESTION TYPE CLASS //////////////////
class quiz_random_qtype extends default_questiontype {
class random_qtype extends default_questiontype {
var $excludedtypes = array('random', 'randomsamatch', 'essay', 'description');
@ -237,7 +237,6 @@ class quiz_random_qtype extends default_questiontype {
//////////////////////////////////////////////////////////////////////////
//// 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();
?>