]> git.mjollnir.org Git - moodle.git/commitdiff
Removed some more references to quiz from the questiontype code.
authorgustav_delius <gustav_delius>
Wed, 22 Mar 2006 21:51:33 +0000 (21:51 +0000)
committergustav_delius <gustav_delius>
Wed, 22 Mar 2006 21:51:33 +0000 (21:51 +0000)
question/questiontypes/calculated/questiontype.php
question/questiontypes/description/questiontype.php
question/questiontypes/match/questiontype.php
question/questiontypes/multianswer/questiontype.php
question/questiontypes/questiontype.php
question/questiontypes/random/questiontype.php

index c1623f1289c5869b4b8ccf78874f2e1d112bef01..b3332f84e592f5415c1b2cde366e73c878a4650e 100644 (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
index d8921d54d728d68cf4e6b48d4746418dc8039bb9..c9bdc72e089ac4a6c246d2d8a7b5ff4e86eabd88 100644 (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");
 
index 32a3ad45c578e12781d7940c7f3213cbb31ffcf4..6fb82961d9b69165082881aae168b531e9817e22 100644 (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);
index f34308130e20cdba3ca18e3b8483eed831af69e9..eed44afd3a0fd4b100f8f5d645b10e909188954a 100644 (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
 ////////////////////////////////////////////////
 
 
index 84cf838f3442669aac69395d8d45ff5e777f9d6c..d246d0d1d76564fc14b411c9e44c9f027dea0606 100644 (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
index 71c48dc6f18fb4bdd269a5c888669d84fbaff94b..b9ba733f3ebcda7a086ea8ba175f8a99ae69fcae 100644 (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();
 
 ?>