From: gustav_delius Date: Wed, 22 Mar 2006 21:51:33 +0000 (+0000) Subject: Removed some more references to quiz from the questiontype code. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=7518b645b93754fbf30df1593184df366d1d8b0b;p=moodle.git Removed some more references to quiz from the questiontype code. --- diff --git a/question/questiontypes/calculated/questiontype.php b/question/questiontypes/calculated/questiontype.php index c1623f1289..b3332f84e5 100644 --- a/question/questiontypes/calculated/questiontype.php +++ b/question/questiontypes/calculated/questiontype.php @@ -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 diff --git a/question/questiontypes/description/questiontype.php b/question/questiontypes/description/questiontype.php index d8921d54d7..c9bdc72e08 100644 --- a/question/questiontypes/description/questiontype.php +++ b/question/questiontypes/description/questiontype.php @@ -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"); diff --git a/question/questiontypes/match/questiontype.php b/question/questiontypes/match/questiontype.php index 32a3ad45c5..6fb82961d9 100644 --- a/question/questiontypes/match/questiontype.php +++ b/question/questiontypes/match/questiontype.php @@ -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); diff --git a/question/questiontypes/multianswer/questiontype.php b/question/questiontypes/multianswer/questiontype.php index f34308130e..eed44afd3a 100644 --- a/question/questiontypes/multianswer/questiontype.php +++ b/question/questiontypes/multianswer/questiontype.php @@ -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 //////////////////////////////////////////////// diff --git a/question/questiontypes/questiontype.php b/question/questiontypes/questiontype.php index 84cf838f34..d246d0d1d7 100644 --- a/question/questiontypes/questiontype.php +++ b/question/questiontypes/questiontype.php @@ -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 diff --git a/question/questiontypes/random/questiontype.php b/question/questiontypes/random/questiontype.php index 71c48dc6f1..b9ba733f3e 100644 --- a/question/questiontypes/random/questiontype.php +++ b/question/questiontypes/random/questiontype.php @@ -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(); ?>