]> git.mjollnir.org Git - moodle.git/commitdiff
Bug 6239 - Allow questions to have some teacher-supplied commentary.
authortjhunt <tjhunt>
Fri, 11 Aug 2006 14:59:18 +0000 (14:59 +0000)
committertjhunt <tjhunt>
Fri, 11 Aug 2006 14:59:18 +0000 (14:59 +0000)
While implementing this, I removed the ~100 lines of very similar code from the top of each question type's editquestion.html template, and moved this to a the function print_question_form_start() in the base class, which uses the template question/type/editquestionstart.html. This is described in more detail here: http://moodle.org/mod/forum/discuss.php?d=51590, and is why this patch makes the codebase 523 lines smaller.

39 files changed:
lang/en_utf8/help/quiz/commentary.html [new file with mode: 0644]
lang/en_utf8/help/quiz/questiontext.html [new file with mode: 0644]
lang/en_utf8/quiz.php
lib/questionlib.php
mod/quiz/db/mysql.php
mod/quiz/db/mysql.sql
mod/quiz/db/postgres7.php
mod/quiz/db/postgres7.sql
mod/quiz/defaults.php
mod/quiz/editlib.php
mod/quiz/lib.php
mod/quiz/locallib.php
mod/quiz/reviewoptions.html
mod/quiz/version.php
question/backuplib.php
question/editlib.php
question/format/xml/format.php
question/question.php
question/restorelib.php
question/type/calculated/editquestion.html
question/type/description/editquestion.html
question/type/editquestionend.html [new file with mode: 0644]
question/type/editquestionstart.html [new file with mode: 0644]
question/type/essay/editquestion.html
question/type/match/editquestion.html
question/type/match/questiontype.php
question/type/missingtype/editquestion.html
question/type/multianswer/editquestion.html
question/type/multichoice/editquestion.html
question/type/numerical/editquestion.html
question/type/question.html
question/type/questiontype.php
question/type/random/editquestion.html
question/type/random/editquestion.php
question/type/randomsamatch/editquestion.html
question/type/randomsamatch/editquestion.php
question/type/shortanswer/editquestion.html
question/type/truefalse/editquestion.html
theme/standard/styles_layout.css

diff --git a/lang/en_utf8/help/quiz/commentary.html b/lang/en_utf8/help/quiz/commentary.html
new file mode 100644 (file)
index 0000000..46e0b17
--- /dev/null
@@ -0,0 +1,14 @@
+<p align="center"><b>Question commentary</b></p>
+
+<p>Question commentary is some text that gets shown to the
+student after they have attempted the question. Unlike feedback, 
+which depends on the question type and what response the student gave,
+the same commentary text is shown to all students.</p>
+
+<p>You can control when commentary is shown to students using 
+the "Students may review:" check-boxes on the quiz editing form.</p>
+
+<p>You can use the commentary to give students some background
+to what knownledge the question was testing. Or to give them a 
+link to more information they can use if they did not understand the
+questions.</p>
\ No newline at end of file
diff --git a/lang/en_utf8/help/quiz/questiontext.html b/lang/en_utf8/help/quiz/questiontext.html
new file mode 100644 (file)
index 0000000..caa794a
--- /dev/null
@@ -0,0 +1,7 @@
+<p align="center"><b>Question text</b></p>
+
+<p>Different question types all display differently,
+but they all start with some text which is entered here.
+Depending on the question type, there may be more
+settings to control the rest of the question display 
+lower down this form.</p>
\ No newline at end of file
index 7f2233c7a5e4cb821ad15357f12eb92150c3ba77..38162bca45b09d915bf7d35328e35dc6e8b5d910 100644 (file)
@@ -83,6 +83,7 @@ $string['close'] = 'Close window';
 $string['closepreview'] = 'Close preview';
 $string['closereview'] = 'Close review';
 $string['comment'] = 'Comment';
+$string['commentary'] = 'Commentary';
 $string['commentorgrade'] = 'Make comment or override grade';
 $string['completedon'] = 'Completed on';
 $string['confirmclose'] = 'You are about to close this attempt. Once you close the attempt you will no longer be able to change your answers.';
@@ -257,6 +258,7 @@ $string['markall'] = 'Submit page';
 $string['marks'] = 'Marks';
 $string['match'] = 'Matching';
 $string['matchanswer'] = 'Matching answer';
+$string['matchanswerno'] = 'Matching answer $a';
 $string['matcherror'] = 'Grades do not match grade options - question skipped';
 $string['matchgrades'] = 'Match grades';
 $string['matchgradeserror'] = 'Error if grade not listed';
@@ -345,9 +347,11 @@ $string['questiondeleted'] = 'This question has been deleted. Please contact you
 $string['questioninuse'] = 'The question \'$a->questionname\' is currently being used in: <br />$a->quiznames<br />The question will not be deleted from these quizzes but only from the category list.';
 $string['questionname'] = 'Question name';
 $string['questionnametoolong'] = 'Question name too long at line $a (255 char. max). It has been truncated.';
+$string['questionno'] = 'Question $a';
 $string['questions'] = 'Questions';
 $string['questionsinuse'] = '(* Questions marked by an asterisk are already in use in some quizzes. These question will not be deleted from these quizzes but only from the category list.)';
 $string['questionsperpage'] = 'Questions per page';
+$string['questiontext'] = 'Question text';
 $string['questiontype'] = 'Question type $a';
 $string['questiontypesetupoptions'] = 'Setup options for question types:';
 $string['quizavailable'] = 'The quiz is available until: $a';
index 2d2496e85cae9ff29b0cdd47f5c8fe693135eac0..f772f04432c9cf601fa2c1ad0bed6129ca16078b 100644 (file)
@@ -59,6 +59,10 @@ define("ESSAY",         "essay");
  */
 define("QUESTION_NUMANS", "10");
 
+/**
+ * The options used when popping up a question preview window in Javascript.
+ */
+define('QUESTION_PREVIEW_POPUP_OPTIONS', "'scrollbars=yes,resizable=yes,width=700,height=540'");
 
 /**#@+
  * Option flags for ->optionflags
@@ -1560,4 +1564,4 @@ function default_export_filename($course,$category) {
     return $export_name;
 }
 
-?>
+?>
\ No newline at end of file
index 7c805511d59ec57ceb06aa2d24293ee14fe6c392..e801cec6df0c0964fec557d69a8e4fb6fed7d246 100644 (file)
@@ -5,6 +5,8 @@ function quiz_upgrade($oldversion) {
 // older versions to match current functionality
 
     global $CFG, $QTYPES, $db;
+    $success = true;
+    
     require_once("$CFG->dirroot/mod/quiz/locallib.php");
 
     if ($oldversion < 2002101800) {
@@ -1097,8 +1099,21 @@ function quiz_upgrade($oldversion) {
         execute_sql('DROP TABLE '.$CFG->prefix.'quiz_attemptonlast_datasets', false);
     }
 
+    if ($oldversion < 2006081000) {
+        // Add a column to the the question table to store the question commentary.
+        $success = $success && table_column('question', '', 'commentarytext', 'text', '', '', '', 'not null', 'image');
+
+        // Adjust the quiz review options so that commentary is displayed whenever feedback is.
+        $success = $success && execute_sql('UPDATE ' . $CFG->prefix . 'quiz SET review = ' .
+                '(review & ~' . QUIZ_REVIEW_COMMENTARY . ') | ' . // Clear any existing junk from the commenary bits.
+                '((review & ' . QUIZ_REVIEW_FEEDBACK . ') * 8)'); // Set the commentary bits to be the same as the feedback ones.
 
-    return true;
+        // Same adjustment to the defaults for new quizzes.
+        $success = $success && set_config('quiz_review', ($CFG->quiz_review & ~QUIZ_REVIEW_COMMENTARY) |
+                (($CFG->quiz_review & QUIZ_REVIEW_FEEDBACK) << 3));
+    }
+    
+    return $success;
 }
 
 ?>
index daff1d028aa0c6330deccf94ddd1424d50bea2d7..9f14122b3dc9d3d0b6cc6986c9aa85a1ee4833d2 100644 (file)
@@ -250,6 +250,7 @@ CREATE TABLE prefix_question (
   questiontext text NOT NULL,
   questiontextformat tinyint(2) NOT NULL default '0',
   image varchar(255) NOT NULL default '',
+  commentarytext text NOT NULL,
   defaultgrade int(10) unsigned NOT NULL default '1',
   penalty float NOT NULL default '0.1',
   qtype varchar(20) NOT NULL default '',
index d2793f8df0e7f65694e9fff702353d9813b8acd8..b02028342e69bd00d31d8b3793556ea71d913c2f 100644 (file)
@@ -5,6 +5,8 @@ function quiz_upgrade($oldversion) {
 // older versions to match current functionality
 
     global $CFG, $db;
+    $success = true;
+    
     include_once("$CFG->dirroot/mod/quiz/locallib.php");
 
     if ($oldversion < 2003010100) {
@@ -1419,8 +1421,22 @@ function quiz_upgrade($oldversion) {
 
     }
 
+    if ($oldversion < 2006081000) {
+        // Add a column to the the question table to store the question commentary.
+        $success = $success && table_column('question', '', 'commentarytext', 'text', '', '', '', 'not null', 'image');
+
+        // Adjust the quiz review options so that commentary is displayed whenever feedback is.
+        $success = $success && execute_sql('UPDATE ' . $CFG->prefix . 'quiz SET review = ' .
+                '(review & ~' . QUIZ_REVIEW_COMMENTARY . ') | ' . // Clear any existing junk from the commenary bits.
+                '((review & ' . QUIZ_REVIEW_FEEDBACK . ') * 8)'); // Set the commentary bits to be the same as the feedback ones.
 
-    return true;
+        // Same adjustment to the defaults for new quizzes.
+        $success = $success && set_config('quiz_review', ($CFG->quiz_review & ~QUIZ_REVIEW_COMMENTARY) |
+                (($CFG->quiz_review & QUIZ_REVIEW_FEEDBACK) << 3));
+    }
+    
+    
+    return $success;
 }
 
 ?>
index 483d330faa37d9ce06b7cb544c7efc9f47035562..4570aa5d49a90dce513df7d54ea9a49199c8a54c 100644 (file)
@@ -244,6 +244,7 @@ CREATE TABLE prefix_question (
   questiontext text NOT NULL default '',
   questiontextformat integer NOT NULL default '0',
   image varchar(255) NOT NULL default '',
+  commentarytext text NOT NULL default '',
   defaultgrade integer NOT NULL default '1',
   penalty real NOT NULL default '0.1',
   qtype varchar(20) NOT NULL default '0',
index cc865d20654d0474ccdc7d70ec764fbbd2a2cebb..cb80ab3b84bc33ce2877a1128646dc0854b9d14b 100644 (file)
@@ -4,7 +4,7 @@
 // It defines default values for any important configuration variables
 
    $defaults = array (
-       'quiz_review' => hexdec('ffffff'),
+       'quiz_review' => 0xffffff,
        'quiz_attemptonlast' => 0,
        'quiz_attempts' => 0,
        'quiz_grademethod' => '',
index ab7b9b0d27f603bed8857d6d931b8ebe15209c61..8c5c428e51d84268f3ad7b47c5b291f71cc44756 100644 (file)
@@ -267,15 +267,16 @@ function quiz_print_question_list($quiz, $allowdelete=true, $showbreaks=true, $r
 
         $context = $quiz->id ? '&amp;contextquiz='.$quiz->id : '';
         $quiz_id = $quiz->id ? '&amp;quizid=' . $quiz->id : '';
-        echo "<a title=\"$strpreview\" href=\"javascript:void(0)\" onClick=\"openpopup('/question/preview.php?id=$qnum$quiz_id','questionpreview','scrollbars=yes,resizable=yes,width=700,height=480', false)\">
-              <img src=\"$CFG->pixpath/t/preview.gif\" border=\"0\" alt=\"$strpreview\" /></a>";
+        echo "<a title=\"$strpreview\" href=\"javascript:void(0)\" onClick=\"openpopup('/question/preview.php?id=$qnum$quiz_id','questionpreview', " . 
+                QUESTION_PREVIEW_POPUP_OPTIONS . ", false)\">
+                <img src=\"$CFG->pixpath/t/preview.gif\" border=\"0\" alt=\"$strpreview\" /></a>";
         if ($canedit) {
             echo "<a title=\"$stredit\" href=\"$CFG->wwwroot/question/question.php?id=$qnum$context\">
-                  <img src=\"$CFG->pixpath/t/edit.gif\" border=\"0\" alt=\"$stredit\" /></a>";
+                    <img src=\"$CFG->pixpath/t/edit.gif\" border=\"0\" alt=\"$stredit\" /></a>";
         }
         if ($allowdelete) {
             echo "<a title=\"$strremove\" href=\"edit.php?delete=$count&amp;quizid=$quiz->id&amp;sesskey=$USER->sesskey\">
-                  <img src=\"$CFG->pixpath/t/removeright.gif\" border=\"0\" alt=\"$strremove\" /></a>";
+                    <img src=\"$CFG->pixpath/t/removeright.gif\" border=\"0\" alt=\"$strremove\" /></a>";
         }
 
         echo "</td></tr>";
index 34f6a0238f73c42172b27c02c7790735afc156b9..866416891ee1cca3a27ca69b4318195061c3788f 100644 (file)
@@ -22,25 +22,25 @@ require_once($CFG->libdir.'/questionlib.php');
 /**
  * The first 6 bits refer to the time immediately after the attempt
  */
-define('QUIZ_REVIEW_IMMEDIATELY', 64-1);
+define('QUIZ_REVIEW_IMMEDIATELY', 0x3f);
 /**
  * the next 6 bits refer to the time after the attempt but while the quiz is open
  */
-define('QUIZ_REVIEW_OPEN', 4096-64);
+define('QUIZ_REVIEW_OPEN', 0xfc0);
 /**
  * the final 6 bits refer to the time after the quiz closes
  */
-define('QUIZ_REVIEW_CLOSED', 262144-4096);
+define('QUIZ_REVIEW_CLOSED', 0x3f000);
 
 // within each group of 6 bits we determine what should be shown
-define('QUIZ_REVIEW_RESPONSES', 1+64+4096);    // Show responses
-define('QUIZ_REVIEW_SCORES', 2*4161);   // Show scores
-define('QUIZ_REVIEW_FEEDBACK', 4*4161); // Show feedback
-define('QUIZ_REVIEW_ANSWERS', 8*4161);  // Show correct answers
+define('QUIZ_REVIEW_RESPONSES',   1*0x1041); // Show responses
+define('QUIZ_REVIEW_SCORES',      2*0x1041); // Show scores
+define('QUIZ_REVIEW_FEEDBACK',    4*0x1041); // Show feedback
+define('QUIZ_REVIEW_ANSWERS',     8*0x1041); // Show correct answers
 // Some handling of worked solutions is already in the code but not yet fully supported
 // and not switched on in the user interface.
-define('QUIZ_REVIEW_SOLUTIONS', 16*4161);  // Show solutions
-// the 6th bit is as yet unused
+define('QUIZ_REVIEW_SOLUTIONS',  16*0x1041); // Show solutions
+define('QUIZ_REVIEW_COMMENTARY', 32*0x1041); // Show commentary
 /**#@-*/
 
 /**
@@ -671,6 +671,19 @@ function quiz_process_options(&$form) {
         unset($form->solutionsclosed);
     }
 
+    if (isset($form->commentaryimmediately)) {
+        $review += (QUIZ_REVIEW_COMMENTARY & QUIZ_REVIEW_IMMEDIATELY);
+        unset($form->solutionsimmediately);
+    }
+    if (isset($form->commentaryopen)) {
+        $review += (QUIZ_REVIEW_COMMENTARY & QUIZ_REVIEW_OPEN);
+        unset($form->solutionsopen);
+    }
+    if (isset($form->commentaryclosed)) {
+        $review += (QUIZ_REVIEW_COMMENTARY & QUIZ_REVIEW_CLOSED);
+        unset($form->solutionsclosed);
+    }
+
     $form->review = $review;
     $form->optionflags = $optionflags;
     
index 19deb52eb6c981b823411a4c3c630efdab9c2261..241f1f31eb6e422e9cd5f35f139a32428c5b8c4b 100644 (file)
@@ -459,6 +459,7 @@ function quiz_upgrade_states($attempt) {
     $questionlist = quiz_questions_in_quiz($attempt->layout);
     if ($questionlist and $states = get_records_select('question_states', "attempt = '$attempt->uniqueid' AND question IN ($questionlist)")) {
         foreach ($states as $state) {
+            $session = new stdClass;
             $session->newgraded = $state->id;
             $session->newest = $state->id;
             $session->questionid = $state->question;
@@ -474,8 +475,9 @@ function quiz_get_question_review($quiz, $question) {
     $strpreview = get_string('previewquestion', 'quiz');
     $context = $quiz->id ? '&amp;contextquiz='.$quiz->id : '';
     $quiz_id = $quiz->id ? '&amp;quizid=' . $quiz->id : '';
-    return "<a title=\"$strpreview\" href=\"javascript:void(0)\" onClick=\"openpopup('/question/preview.php?id=$qnum$quiz_id','questionpreview','scrollbars=yes,resizable=yes,width=700,height=480', false)\">
-          <img src=\"../../pix/t/preview.gif\" border=\"0\" alt=\"$strpreview\" /></a>";
+    return "<a title=\"$strpreview\" href=\"javascript:void(0)\" onClick=\"openpopup('/question/preview.php?id=$qnum$quiz_id','questionpreview', " .
+            QUESTION_PREVIEW_POPUP_OPTIONS . ", false)\">
+            <img src=\"../../pix/t/preview.gif\" border=\"0\" alt=\"$strpreview\" /></a>";
 }
 
 
@@ -486,6 +488,8 @@ function quiz_get_question_review($quiz, $question) {
  * @param object $state
  */
 function quiz_get_renderoptions($reviewoptions, $state) {
+    $options = new stdClass;
+    
     // Show the question in readonly (review) mode if the question is in
     // the closed state
     $options->readonly = question_state_is_closed($state);
@@ -499,6 +503,9 @@ function quiz_get_renderoptions($reviewoptions, $state) {
     // Show correct responses in readonly mode if the quiz allows it
     $options->correct_responses = $options->readonly && ($reviewoptions & QUIZ_REVIEW_ANSWERS & QUIZ_REVIEW_IMMEDIATELY);
 
+    // Show commentary if the question has been graded and the quiz allows it.
+    $options->commentary = question_state_is_graded($state) && ($reviewoptions & QUIZ_REVIEW_COMMENTARY & QUIZ_REVIEW_IMMEDIATELY);
+
     // Always show responses and scores
     $options->responses = true;
     $options->scores = true;
@@ -511,6 +518,8 @@ function quiz_get_renderoptions($reviewoptions, $state) {
 * Determine review options
 */
 function quiz_get_reviewoptions($quiz, $attempt, $isteacher=false) {
+
+    $options = new stdClass;
     $options->readonly = true;
     // Provide the links to the question review and comment script
     $options->questionreviewlink = '/mod/quiz/reviewquestion.php';
@@ -523,32 +532,28 @@ function quiz_get_reviewoptions($quiz, $attempt, $isteacher=false) {
         $options->feedback = true;
         $options->correct_responses = true;
         $options->solutions = false;
+        $options->commentary = true;
+        
         // Show a link to the comment box only for closed attempts
         if ($attempt->timefinish) {
             $options->questioncommentlink = '/mod/quiz/comment.php';
         }
-        return $options;
-    }
-    if (((time() - $attempt->timefinish) < 120) || $attempt->timefinish==0) {
-        $options->responses = ($quiz->review & QUIZ_REVIEW_IMMEDIATELY & QUIZ_REVIEW_RESPONSES) ? 1 : 0;
-        $options->scores = ($quiz->review & QUIZ_REVIEW_IMMEDIATELY & QUIZ_REVIEW_SCORES) ? 1 : 0;
-        $options->feedback = ($quiz->review & QUIZ_REVIEW_IMMEDIATELY & QUIZ_REVIEW_FEEDBACK) ? 1 : 0;
-        $options->correct_responses = ($quiz->review & QUIZ_REVIEW_IMMEDIATELY & QUIZ_REVIEW_ANSWERS) ? 1 : 0;
-        $options->solutions = ($quiz->review & QUIZ_REVIEW_IMMEDIATELY & QUIZ_REVIEW_SOLUTIONS) ? 1 : 0;
-    } else if (!$quiz->timeclose or time() < $quiz->timeclose) {
-        $options->responses = ($quiz->review & QUIZ_REVIEW_OPEN & QUIZ_REVIEW_RESPONSES) ? 1 : 0;
-        $options->scores = ($quiz->review & QUIZ_REVIEW_OPEN & QUIZ_REVIEW_SCORES) ? 1 : 0;
-        $options->feedback = ($quiz->review & QUIZ_REVIEW_OPEN & QUIZ_REVIEW_FEEDBACK) ? 1 : 0;
-        $options->correct_responses = ($quiz->review & QUIZ_REVIEW_OPEN & QUIZ_REVIEW_ANSWERS) ? 1 : 0;
-        $options->solutions = ($quiz->review & QUIZ_REVIEW_OPEN & QUIZ_REVIEW_SOLUTIONS) ? 1 : 0;
     } else {
-        $options->responses = ($quiz->review & QUIZ_REVIEW_CLOSED & QUIZ_REVIEW_RESPONSES) ? 1 : 0;
-        $options->scores = ($quiz->review & QUIZ_REVIEW_CLOSED & QUIZ_REVIEW_SCORES) ? 1 : 0;
-        $options->feedback = ($quiz->review & QUIZ_REVIEW_CLOSED & QUIZ_REVIEW_FEEDBACK) ? 1 : 0;
-        $options->correct_responses = ($quiz->review & QUIZ_REVIEW_CLOSED & QUIZ_REVIEW_ANSWERS) ? 1 : 0;
-        $options->solutions = ($quiz->review & QUIZ_REVIEW_CLOSED & QUIZ_REVIEW_SOLUTIONS) ? 1 : 0;
+        if (((time() - $attempt->timefinish) < 120) || $attempt->timefinish==0) {
+            $quiz_state_mask = QUIZ_REVIEW_IMMEDIATELY;
+        } else if (!$quiz->timeclose or time() < $quiz->timeclose) {
+            $quiz_state_mask = QUIZ_REVIEW_OPEN;
+        } else {
+            $quiz_state_mask = QUIZ_REVIEW_CLOSED;
+        }
+        $options->responses = ($quiz->review & $quiz_state_mask & QUIZ_REVIEW_RESPONSES) ? 1 : 0;
+        $options->scores = ($quiz->review & $quiz_state_mask & QUIZ_REVIEW_SCORES) ? 1 : 0;
+        $options->feedback = ($quiz->review & $quiz_state_mask & QUIZ_REVIEW_FEEDBACK) ? 1 : 0;
+        $options->correct_responses = ($quiz->review & $quiz_state_mask & QUIZ_REVIEW_ANSWERS) ? 1 : 0;
+        $options->solutions = ($quiz->review & $quiz_state_mask & QUIZ_REVIEW_SOLUTIONS) ? 1 : 0;
+        $options->commentary = ($quiz->review & $quiz_state_mask & QUIZ_REVIEW_COMMENTARY) ? 1 : 0;
     }
-
+    
     return $options;
 }
 ////////////////////////////////////////////////////////////////////////////////
index fabd755b8903aeb01b1994bf48707b02d67c46fc..ac3f5fc0f541f0fa4ab695e224426ebf85da060d 100644 (file)
@@ -16,6 +16,7 @@
       <td align="center"><?php print_string('feedback', 'quiz') ?></td>
       <td align="center"><?php print_string('answers', 'quiz') ?></td>
 <!--      <td align="center"><?php print_string('solutions', 'quiz') ?></td>-->
+      <td align="center"><?php print_string('commentary', 'quiz') ?></td>
       <td>
         <?php helpbutton("review2", get_string("allowreview","quiz"), "quiz"); ?>
       </td>
@@ -38,6 +39,9 @@
         <input type="checkbox" name="solutionsimmediately" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_SOLUTIONS & QUIZ_REVIEW_IMMEDIATELY) ? 'checked="checked"' : '' ?> />
       </td>
 -->
+      <td align="center">
+        <input type="checkbox" name="commentaryimmediately" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_COMMENTARY & QUIZ_REVIEW_IMMEDIATELY) ? 'checked="checked"' : '' ?> />
+      </td>
     </tr>
     <tr>
       <td align="center">
@@ -57,6 +61,9 @@
         <input type="checkbox" name="solutionsopen" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_SOLUTIONS & QUIZ_REVIEW_OPEN) ? 'checked="checked"' : '' ?> />
       </td>
 -->
+      <td align="center">
+        <input type="checkbox" name="commentaryopen" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_COMMENTARY & QUIZ_REVIEW_OPEN) ? 'checked="checked"' : '' ?> />
+      </td>
     </tr>
     <tr>
       <td align="center">
@@ -76,6 +83,9 @@
         <input type="checkbox" name="solutionsclosed" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_SOLUTIONS & QUIZ_REVIEW_CLOSED) ? 'checked="checked"' : '' ?> />
       </td>
 -->
+      <td align="center">
+        <input type="checkbox" name="commentaryclosed" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_COMMENTARY & QUIZ_REVIEW_CLOSED) ? 'checked="checked"' : '' ?> />
+      </td>
     </tr>
   </table>
 </td>
index 3791e7b2c798df7eb29befcb04026bb8c8d2cd07..eefc0afbfca25eccae2b8ff09615a7d2c676327e 100644 (file)
@@ -5,7 +5,7 @@
 //  This fragment is called by moodle_needs_upgrading() and /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2006080900;   // The (date) version of this module
+$module->version  = 2006081000;   // The (date) version of this module
 $module->requires = 2006080900;   // Requires this Moodle version
 $module->cron     = 0;            // How often should cron check this module (seconds)?
 
index 0127db089eaed10fcdd2be9d3e71ab679f4352b8..f4d9eedf6e225943678e680478e0cbaa83321ccc 100644 (file)
                 fwrite ($bf,full_tag("QUESTIONTEXT",6,false,$question->questiontext));
                 fwrite ($bf,full_tag("QUESTIONTEXTFORMAT",6,false,$question->questiontextformat));
                 fwrite ($bf,full_tag("IMAGE",6,false,$question->image));
+                fwrite ($bf,full_tag("COMMENTARYTEXT",6,false,$question->commentarytext));
                 fwrite ($bf,full_tag("DEFAULTGRADE",6,false,$question->defaultgrade));
                 fwrite ($bf,full_tag("PENALTY",6,false,$question->penalty));
                 fwrite ($bf,full_tag("QTYPE",6,false,$question->qtype));
index 33b3aefa39f95a13b0a91b1741e0a5667f5b135b..61cd688faa3004bcf741065856061e7854b79917 100644 (file)
@@ -339,18 +339,19 @@ function question_list($course, $categoryid, $quizid=0,
             echo "<a title=\"$straddtoquiz\" href=\"edit.php?addquestion=$question->id&amp;quizid=$quizid&amp;sesskey=$USER->sesskey\"><img
                   src=\"$CFG->pixpath/t/moveleft.gif\" border=\"0\" alt=\"$straddtoquiz\" /></a>&nbsp;";
         }
-        echo "<a title=\"$strpreview\" href=\"javascript:void();\" onClick=\"openpopup('/question/preview.php?id=$question->id&quizid=$quizid','$strpreview','scrollbars=yes,resizable=yes,width=700,height=480', false)\"><img
-              src=\"$CFG->pixpath/t/preview.gif\" border=\"0\" alt=\"$strpreview\" /></a>&nbsp;";
+        echo "<a title=\"$strpreview\" href=\"javascript:void();\" onClick=\"openpopup('/question/preview.php?id=$question->id&quizid=$quizid','$strpreview', " .
+                QUESTION_PREVIEW_POPUP_OPTIONS . ", false)\"><img
+                src=\"$CFG->pixpath/t/preview.gif\" border=\"0\" alt=\"$strpreview\" /></a>&nbsp;";
         if ($canedit) {
             echo "<a title=\"$stredit\" href=\"$CFG->wwwroot/question/question.php?id=$question->id\"><img
-                 src=\"$CFG->pixpath/t/edit.gif\" border=\"0\" alt=\"$stredit\" /></a>&nbsp;";
+                    src=\"$CFG->pixpath/t/edit.gif\" border=\"0\" alt=\"$stredit\" /></a>&nbsp;";
             // hide-feature
             if($question->hidden) {
                 echo "<a title=\"$strrestore\" href=\"edit.php?courseid=$course->id&amp;unhide=$question->id&amp;sesskey=$USER->sesskey\"><img
-                     src=\"$CFG->pixpath/t/restore.gif\" border=\"0\" alt=\"$strrestore\" /></a>";
+                        src=\"$CFG->pixpath/t/restore.gif\" border=\"0\" alt=\"$strrestore\" /></a>";
             } else {
                 echo "<a title=\"$strdelete\" href=\"edit.php?courseid=$course->id&amp;deleteselected=$question->id&amp;q$question->id=1\"><img
-                     src=\"$CFG->pixpath/t/delete.gif\" border=\"0\" alt=\"$strdelete\" /></a>";
+                        src=\"$CFG->pixpath/t/delete.gif\" border=\"0\" alt=\"$strdelete\" /></a>";
             }
         }
         echo "&nbsp;<input title=\"$strselect\" type=\"checkbox\" name=\"q$question->id\" value=\"1\" />";
index a756bd7bca183c7488c412f0f714d81ce96a4241..3897db14c5268efde72880fc38e08c2d7f5770df 100755 (executable)
@@ -82,6 +82,11 @@ class qformat_xml extends qformat_default {
             $image_base64 = stripslashes( trim( $question['#']['image_base64'][0]['#'] ) );
             $image = $this->importimagefile( $image, $image_base64 );
         }
+        if (array_key_exists('commentarytext', $question['#'])) {
+            $commentarytext = $this->import_text( $question['#']['commentarytext'][0]['#']['text'] );
+        } else {
+            $commentarytext = '';
+        }
         $penalty = $question['#']['penalty'][0]['#'];
 
         $qo = $this->defaultquestion();
@@ -89,6 +94,7 @@ class qformat_xml extends qformat_default {
         $qo->questiontext = $qtext;
         $qo->questiontextformat = $this->trans_format( $qformat );
         $qo->image = ((!empty($image)) ?  $image : '');
+        $qo->commentarytext = $commentarytext;
         $qo->penalty = $penalty;
 
         return $qo;
@@ -603,6 +609,7 @@ class qformat_xml extends qformat_default {
             $name_text = $this->writetext( $question->name );
             $qtformat = $this->get_format($question->questiontextformat);
             $question_text = $this->writetext( $question->questiontext );
+            $commentary_text = $this->writetext( $question->commentarytext );
             $expout .= "  <question type=\"$question_type\">\n";   
             $expout .= "    <name>$name_text</name>\n";
             $expout .= "    <questiontext format=\"$qtformat\">\n";
@@ -610,6 +617,9 @@ class qformat_xml extends qformat_default {
             $expout .= "    </questiontext>\n";   
             $expout .= "    <image>{$question->image}</image>\n";
             $expout .= $this->writeimage($question->image);
+            $expout .= "    <commentarytext>\n";
+            $expout .= $commentary_text;
+            $expout .= "    </commentarytext>\n";
             $expout .= "    <penalty>{$question->penalty}</penalty>\n";
             $expout .= "    <hidden>{$question->hidden}</hidden>\n";
         }
index 81c7aaceb9611663c54cd685d831cc1c34bf3777..2e669deee159055d21a63d9e36b5f6263a5d59b1 100644 (file)
     }
 
 
-    make_upload_directory("$course->id");    // Just in case
-    $coursefiles = get_directory_list("$CFG->dataroot/$course->id", $CFG->moddata);
-    foreach ($coursefiles as $filename) {
-        if (mimeinfo("icon", $filename) == "image.gif") {
-            $images["$filename"] = $filename;
-        }
-    }
-
     // Print the question editing form
 
     if (empty($question->id)) {
     if (!isset($question->defaultgrade)) {
         $question->defaultgrade = 1;
     }
+    if (empty($question->commentarytext)) {
+        $question->commentarytext = "";
+    }
 
     // Set up some Richtext editing if necessary
     if ($usehtmleditor = can_use_richtext_editor()) {
index 33249ed1977abedfbb1f4dfa9ff2a5a9d041ea04..a094e432174f5a0ced2088f0423213c6fdb14759 100644 (file)
             $question->questiontext = backup_todb($que_info['#']['QUESTIONTEXT']['0']['#']);
             $question->questiontextformat = backup_todb($que_info['#']['QUESTIONTEXTFORMAT']['0']['#']);
             $question->image = backup_todb($que_info['#']['IMAGE']['0']['#']);
+            if (array_key_exists('COMMENTARYTEXT', $que_info['#'])) {
+                $question->commentarytext = backup_todb($que_info['#']['COMMENTARYTEXT']['0']['#']);
+            } else {
+                $question->commentarytext = '';
+            }
             $question->defaultgrade = backup_todb($que_info['#']['DEFAULTGRADE']['0']['#']);
             $question->penalty = backup_todb($que_info['#']['PENALTY']['0']['#']);
             $question->qtype = backup_todb($que_info['#']['QTYPE']['0']['#']);
index 71b9c0b26d1d67d628fbaad7ebbe4d24e57335bc..22306d2df730de920f4b152756c6833312d9a5f9 100644 (file)
@@ -1,85 +1,6 @@
-<form name="theform" method="post" action="question.php">
-<center>
-<table cellpadding="5">
-<tr valign="top">
-    <td align="right"><b><?php  print_string("category", "quiz") ?>:</b></td>
-    <td align="left">
-    <?php   question_category_select_menu($course->id, true, true, $question->category); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("questionname", "quiz") ?>:</b></td>
-    <td align="left">
-        <input type="text" name="name" size="50" value="<?php  p($question->name) ?>" alt="<?php  print_string("questionname", "quiz") ?>" />
-        <?php  if (isset($err["name"])) formerr($err["name"]); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("question", "quiz") ?>:</b>
-    <br />
-    <br />
-    <br />
-    <span class="editorhelptext">
-    <?php
-           if ($usehtmleditor) {
-               helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
-           } else {
-               helpbutton("text", get_string("helptext"), "moodle", true, true);
-           }
-    ?>
-    </span>
-    </td>
-    <td align="left">
-        <?php  if (isset($err["questiontext"])) {
-               formerr($err["questiontext"]);
-               echo "<br />";
-           }
-
-           print_textarea($usehtmleditor, 20, 60, 630, 300, "questiontext", $question->questiontext);
-
-           if ($usehtmleditor) {   /// Trying this out for a while
-               echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'" />';
-           } else {
-               echo '<div align="right">';
-               print_string("formattexttype");
-               echo ":&nbsp;";
-               if (!isset($question->questiontextformat)) {
-                   $question->questiontextformat = FORMAT_MOODLE;
-               }
-               choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
-               helpbutton("textformat", get_string("helpformatting"));
-               echo "</div>";
-           }
-        ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("imagedisplay", "quiz") ?>:</b></td>
-    <td align="left">
-    <?php   if (empty($images)) {
-            print_string("noimagesyet");
-        } else {
-            choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
-        }
-    ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("defaultgrade", "quiz") ?>:</b></td>
-    <td align="left">
-        <input type="text" name="defaultgrade" size="3" value="<?php  p($question->defaultgrade) ?>" alt="<?php  print_string("defaultgrade", "quiz") ?>" />
-
-        <?php  if (isset($err["defaultgrade"])) formerr($err["defaultgrade"]); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("penaltyfactor", "quiz") ?>:</b></td>
-    <td align="left">
-        <input type="text" name="penalty" size="3" value="<?php  p($question->penalty) ?>" alt="<?php  print_string("penaltyfactor", "quiz") ?>" />
-        <?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
-        <?php  if (isset($err["penalty"])) formerr($err["penalty"]); ?>
-    </td>
-</tr>
+<?php
+$QTYPES[$question->qtype]->print_question_form_start($question, array(), $course, $usehtmleditor);
+?>
 <tr valign="top">
 <td align="right"><b><?php  print_string("correctanswerformula", "quiz") ?>:</b></td>
     <td align="left">
@@ -157,15 +78,12 @@ for ($i=1; $i<count($units); $i++) {
 </tr>
 <?php
 } /// END for
+
+$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
+$QTYPES[$question->qtype]->print_question_form_end($question,
+        'onclick="return determineMinAndMax();"',
+        '<input type="hidden" name="wizardpage" value="question" />');
 ?>
-</table>
-<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey; ?>" />
-<input type="hidden" name="id" value="<?php  p($question->id) ?>" />
-<input type="hidden" name="qtype" value="<?php  p($question->qtype) ?>" />
-<input type="hidden" name="wizardpage" value="question" />
-<input type="submit" onclick="return determineMinAndMax();"  value="<?php  print_string("savechanges") ?>" />
-</center>
-</form>
 <script language="javascript" type="text/javascript">
 function determineMinAndMax() {
     // This client-side script will determine the values for min and max
index 801631be07ce2ee435932404a485381bc11e12e5..4bd53b1c7245708bc4d9a9b775085bcf47bf51c2 100644 (file)
@@ -1,72 +1,5 @@
-<form name="theform" method="post" action="question.php">
-<center>
-<table cellpadding="5">
-<tr valign="top">
-    <td align="right"><b><?php  print_string("category", "quiz") ?>:</b></td>
-    <td align="left">
-    <?php   question_category_select_menu($course->id, true, true, $question->category); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("questionname", "quiz") ?>:</b></td>
-    <td align="left">
-        <input type="text" name="name" size="40" value="<?php  p($question->name) ?>" alt="<?php  print_string("questionname", "quiz") ?>" />
-        <?php  if (isset($err["name"])) formerr($err["name"]); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("question", "quiz") ?>:</b>
-    <br />
-    <br />
-    <br />
-    <font size="1">
-    <?php
-           if ($usehtmleditor) {
-               helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
-           } else {
-               helpbutton("text", get_string("helptext"), "moodle", true, true);
-           }
-    ?>
-    </font>
-    </td>
-    <td align="left">
-        <?php  if (isset($err["questiontext"])) {
-               formerr($err["questiontext"]); 
-               echo "<br />";
-           }
-           print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);
-           if ($usehtmleditor) {
-               echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'" />';
-           } else {
-               echo "<div align=\"right\">";
-               print_string("formattexttype");
-               echo ":&nbsp;";
-               if (!isset($question->questiontextformat)) {
-                   $question->questiontextformat = FORMAT_MOODLE;
-               }
-               choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
-               helpbutton("textformat", get_string("helpformatting"));
-               echo "</div>";
-           }
-        ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("imagedisplay", "quiz") ?>:</b></td>
-    <td align="left">
-    <?php   if (empty($images)) {
-            print_string("noimagesyet");
-        } else {
-            choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
-        }
-    ?>
-    </td>
-</tr>
-</table>
-<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey; ?>" />
-<input type="hidden" name="id" value="<?php  p($question->id) ?>" />
-<input type="hidden" name="qtype" value="<?php  p($question->qtype) ?>" />
-<input type="hidden" name="defaultgrade" value="0" />
-<input type="submit" value="<?php  print_string("savechanges") ?>" />
-</center>
-</form>
+<?php
+$QTYPES[$question->qtype]->print_question_form_start($question, array(), $course, $usehtmleditor,
+        array('defaultgrade', 'penalty'));
+$QTYPES[$question->qtype]->print_question_form_end($question);
+?>
diff --git a/question/type/editquestionend.html b/question/type/editquestionend.html
new file mode 100644 (file)
index 0000000..1ba6ee4
--- /dev/null
@@ -0,0 +1,26 @@
+  <tr valign="top">
+    <td colspan="2" align="center">
+      <input type="submit" <?php echo $submitscript ?> value="<?php print_string('savechanges') ?>" />
+      <?php
+      if ($question->id) {
+        ?>
+        <input type="submit" name="makecopy" <?php echo $submitscript ?> value="<?php print_string("makecopy", "quiz") ?>" /> 
+        <?php
+      }
+      ?>
+      <input type="submit" name="cancel" value="<?php print_string("cancel") ?>" />
+      <input type="hidden" name="sesskey" value="<?php p($USER->sesskey) ?>" />
+      <input type="hidden" name="id" value="<?php p($question->id) ?>" />
+      <input type="hidden" name="qtype" value="<?php p($question->qtype) ?>" />
+      <?php
+      echo $hiddenfields;
+      
+      // The following hidden field indicates that the versioning code should be turned on, i.e.,
+      // that old versions should be kept if necessary
+      ?>
+      <input type="hidden" name="versioning" value="on" />
+    </td>
+  </tr>
+</table>
+</center>
+</form>
diff --git a/question/type/editquestionstart.html b/question/type/editquestionstart.html
new file mode 100644 (file)
index 0000000..810c49b
--- /dev/null
@@ -0,0 +1,122 @@
+<form name="theform" method="post" action="question.php">
+<center>
+<table cellpadding="5">
+
+  <tr valign="top">
+    <td align="right"><b><?php print_string("category", "quiz") ?>:</b></td>
+    <td align="left">
+      <?php question_category_select_menu($course->id, true, true, $question->category); ?>
+    </td>
+  </tr>
+
+  <tr valign="top">
+    <td align="right"><b><?php print_string("questionname", "quiz") ?>:</b></td>
+    <td align="left">
+      <input type="text" name="name" size="50" value="<?php p($question->name) ?>" alt="<?php print_string("questionname", "quiz") ?>" />
+      <?php if (isset($err["name"])) formerr($err["name"]); ?>
+    </td>
+  </tr>
+
+  <tr valign="top">
+    <td align="right"><b><?php print_string("question", "quiz") ?>:</b>
+      <br /><br /><br />
+      <?php
+      helpbutton("questiontext", get_string("questiontext", "quiz"), "quiz", true, true);
+      echo '<br />';
+      if ($usehtmleditor) {
+        helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
+      } else {
+        helpbutton("text", get_string("helptext"), "moodle", true, true);
+      }
+      ?>
+    </td>
+    <td align="left">
+      <?php
+      if (isset($err["questiontext"])) {
+        formerr($err["questiontext"]);
+        echo "<br />";
+      }
+      print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);
+      if ($usehtmleditor) {
+        echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'" />';
+      } else {
+        echo "<div align=\"right\">";
+        print_string("formattexttype");
+        echo ":&nbsp;";
+        if (!isset($question->questiontextformat)) {
+          $question->questiontextformat = FORMAT_MOODLE;
+        }
+        choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
+        helpbutton("textformat", get_string("helpformatting"));
+        echo "</div>";
+      }
+      ?>
+    </td>
+  </tr>
+  
+  <?php 
+  if (!in_array('image', $hidefields)) {
+    ?>
+    <tr valign="top">
+      <td align="right"><b><?php print_string("imagedisplay", "quiz") ?>:</b></td>
+      <td align="left">
+        <?php
+        if (empty($images)) {
+          print_string("noimagesyet");
+        } else {
+          choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
+        }
+        ?>
+      </td>
+    </tr>
+    <?php 
+  }
+  
+  if (!in_array('defaultgrade', $hidefields)) {
+    ?>
+    <tr valign="top">
+      <td align="right"><b><?php print_string("defaultgrade", "quiz") ?>:</b></td>
+      <td align="left">
+        <input type="text" name="defaultgrade" size="3" value="<?php p($question->defaultgrade) ?>" alt="<?php print_string("defaultgrade", "quiz") ?>" />
+
+        <?php if (isset($err["defaultgrade"])) formerr($err["defaultgrade"]); ?>
+      </td>
+    </tr>
+    <?php 
+  }
+  
+  if (!in_array('penalty', $hidefields)) {
+    ?>
+    <tr valign="top">
+      <td align="right"><b><?php print_string("penaltyfactor", "quiz") ?>:</b></td>
+      <td align="left">
+        <input type="text" name="penalty" size="3" value="<?php p($question->penalty) ?>" alt="<?php print_string("penaltyfactor", "quiz") ?>" />
+        <?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
+        <?php if (isset($err["penalty"])) formerr($err["penalty"]); ?>
+      </td>
+    </tr>
+    <?php 
+  }
+  ?>
+
+  <tr valign="top">
+    <td align="right"><b><?php print_string("commentary", "quiz") ?>:</b>
+      <br /><br /><br />
+      <?php
+      helpbutton("commentary", get_string("commentary", "quiz"), "quiz", true, true);
+      ?>
+    </td>
+    <td align="left">
+      <?php
+      if (isset($err["commentarytext"])) {
+        formerr($err["commentarytext"]);
+        echo "<br />";
+      }
+      print_textarea(false, 10, 60, 630, 200, "commentarytext", $question->commentarytext);
+      ?>
+    </td>
+  </tr>
+  
+  <tr valign="top">
+    <td colspan="2">&nbsp;</td>
+  </tr>
\ No newline at end of file
index 682c4341b8d429609a51bfaba348d59ca76050f4..05a2958467097982d7d9a931a1aa6855507a4f44 100644 (file)
@@ -1,86 +1,6 @@
-<form name="theform" method="post" action="question.php">
-<center>
-<table cellpadding="5">
-<tr valign="top">
-    <td align="right">
-        <b><?php  print_string("category", "quiz") ?>:</b>
-    </td>
-    <td>
-        <?php question_category_select_menu($course->id, true, true, $question->category); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right">
-        <b><?php  print_string("questionname", "quiz") ?>:</b>
-    </td>
-    <td>
-        <input type="text" name="name" size="50" value="<?php  p($question->name) ?>" />
-        <?php  if (isset($err["name"])) formerr($err["name"]); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right">
-        <b><?php  print_string("question", "quiz") ?>:</b>
-        <br />
-        <br />
-        <br />
-        <font size="1">
-        <?php
-               if ($usehtmleditor) {
-                   helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
-               } else {
-                   helpbutton("text", get_string("helptext"), "moodle", true, true);
-               }
-        ?>
-        </font>
-    </td>
-    <td>
-        <?php
-            if (isset($err["questiontext"])) {
-                formerr($err["questiontext"]); 
-                echo "<br />";
-            }
-
-            print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);
-
-            if ($usehtmleditor) { 
-                echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'" />';
-            } else {
-                echo "<div align=\"right\">";
-                print_string("formattexttype");
-                echo ":&nbsp;";
-                if (!isset($question->questiontextformat)) {
-                    $question->questiontextformat = FORMAT_MOODLE;
-                }
-                choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
-                helpbutton("textformat", get_string("helpformatting"));
-                echo "</div>";
-            }
-        ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right">
-        <b><?php  print_string("imagedisplay", "quiz") ?>:</b>
-    </td>
-    <td>
-        <?php   
-            if (empty($images)) {
-                print_string("noimagesyet");
-            } else {
-                choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
-            }
-        ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("defaultgrade", "quiz") ?>:</b></td>
-    <td align="left">
-        <input type="text" name="defaultgrade" size="3" value="<?php  p($question->defaultgrade) ?>" alt="<?php  print_string("defaultgrade", "quiz") ?>" />
-
-        <?php  if (isset($err["defaultgrade"])) formerr($err["defaultgrade"]); ?>
-    </td>
-</tr>
+<?php
+$QTYPES[$question->qtype]->print_question_form_start($question, array(), $course, $usehtmleditor);
+?>
 <tr valign="top">
     <td align="right">
         <b><?php  print_string("feedback", "quiz") ?>:</b>
@@ -89,15 +9,9 @@
         <textarea name="feedback" rows="2" cols="50" wrap="virtual"><?php  p($options->answer->feedback) ?></textarea>
     </td>
 </tr>
-</table>
-<input type="hidden" name="fraction" value="0" />  <?php // dont think there would ever be a different value other than 1... ?>
 
 <?php
-    $QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
-    $QTYPES[$question->qtype]->print_question_form_end($question);
+$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
+$QTYPES[$question->qtype]->print_question_form_end($question, '',
+        '<input type="hidden" name="fraction" value="0" />'); // dont think there would ever be a different value other than 1...
 ?>
-
-</center>
-
-</form>
-
index ce3d01e9165367ed86c6f2c3917ee7f6bacea1b4..23c3a7696dd8b32876818d4a0bd2955b3aa9437a 100644 (file)
-<form name="theform" method="post" action="question.php">
-<center>
-<table cellpadding="5">
-<tr valign="top">
-    <td align="right"><b><?php  print_string("category", "quiz") ?>:</b></td>
+<?php
+$QTYPES[$question->qtype]->print_question_form_start($question, array(), $course, $usehtmleditor);
+?>
+  <tr valign="top">
+    <td align="right"><b><?php print_string("choices", "quiz") ?></b>:</td>
     <td align="left">
-    <?php   question_category_select_menu($course->id, true, true, $question->category); ?>
+      <div style="width: 30em">
+        <?php print_string("filloutthreequestions", "quiz") ?>
+      </div>
     </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("questionname", "quiz") ?>:</b></td>
+  </tr>
+  <tr valign="top">
+    <td align="right"><b><?php print_string("shuffle", "quiz") ?>:</b></td>
     <td align="left">
-        <input type="text" name="name" size="40" value="<?php  p($question->name) ?>" alt="<?php  print_string("questionname", "quiz") ?>" />
-        <?php  if (isset($err["name"])) formerr($err["name"]); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("question", "quiz") ?>:</b>
-    <br />
-    <br />
-    <br />
-    <font size="1">
     <?php
-           if ($usehtmleditor) {
-               helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
-           } else {
-               helpbutton("text", get_string("helptext"), "moodle", true, true);
-           }
+      choose_from_menu($yesnooptions, "shuffleanswers", "$options->shuffleanswers", "");
+      helpbutton("matchshuffle", get_string("shuffle","quiz"), "quiz");
     ?>
-    </font>
-    </td>
-    <td align="left">
-        <?php  if (isset($err["questiontext"])) {
-               formerr($err["questiontext"]);
-               echo "<br />";
-           }
-           print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);
-           if ($usehtmleditor) {
-               echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'" />';
-           } else {
-               echo "<div align=\"right\">";
-               print_string("formattexttype");
-               echo ":&nbsp;";
-               if (!isset($question->questiontextformat)) {
-                   $question->questiontextformat = FORMAT_MOODLE;
-               }
-               choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
-               helpbutton("textformat", get_string("helpformatting"));
-               echo "</div>";
-           }
-        ?>
     </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("imagedisplay", "quiz") ?>:</b></td>
-    <td align="left">
-    <?php   if (empty($images)) {
-            print_string("noimagesyet");
-        } else {
-            choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
-        }
-    ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("defaultgrade", "quiz") ?>:</b></td>
-    <td align="left">
-        <input type="text" name="defaultgrade" size="3" value="<?php  p($question->defaultgrade) ?>" alt="<?php  print_string("defaultgrade", "quiz") ?>" />
+  </tr>
+<?php
+for ($i=1; $i <= count($subquestions); $i++) {
+?>
+  <tr valign="top">
+    <td colspan="2">&nbsp;</td>
+  </tr>
 
-        <?php  if (isset($err["defaultgrade"])) formerr($err["defaultgrade"]); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("penaltyfactor", "quiz") ?>:</b></td>
+  <tr valign="top">
+    <td align="right"><b><?php print_string("questionno", "quiz", $i) ?>:</b></td>
     <td align="left">
-        <input type="text" name="penalty" size="3" value="<?php  p($question->penalty) ?>" alt="<?php  print_string("penaltyfactor", "quiz") ?>" />
-        <?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
-        <?php  if (isset($err["penalty"])) formerr($err["penalty"]); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("choices", "quiz") ?></b>:</td>
-    <td align="left"><?php  print_string("filloutthreequestions", "quiz") ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php print_string("shuffle", "quiz") ?>:</b></td>
-     <td align="left">
-    <?php
-        choose_from_menu($yesnooptions, "shuffleanswers", "$options->shuffleanswers", "");
-        helpbutton("matchshuffle", get_string("shuffle","quiz"), "quiz");
-     ?>
+      <textarea name="subquestions[]" rows="3" cols="50"><?php p($subquestions[$i-1]) ?></textarea>
     </td>
-</tr>
-<?php
-    for ($i=1; $i <= count($subquestions); $i++) {
-?>
-<tr valign="top">
-    <td align="right"><b><?php  echo get_string("question", "quiz")." $i";  ?> :</b></td>
+  </tr>
+
+  <tr valign="top">
+    <td align="right"><b><?php print_string("matchanswerno", "quiz", $i) ?>:</b></td>
     <td align="left">
-        <textarea name="subquestions[]" rows="5" cols="50"><?php  p($subquestions[$i-1]) ?></textarea>
-        <br />
-        <?php  echo get_string("matchanswer", "quiz")." $i";  ?>&nbsp;&nbsp;
-        <input type="text" name="subanswers[]" size="50" value="<?php  p($subanswers[$i-1]) ?>" alt="<?php  echo get_string("matchanswer", "quiz")." $i";  ?>" />
+      <input type="text" name="subanswers[]" size="50" value="<?php p($subanswers[$i-1]) ?>" alt="<?php print_string("matchanswerno", "quiz", $i) ?>" />
     </td>
-</tr>
+  </tr>
 <?php
-    }
+}
 
-    $QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
-    $QTYPES[$question->qtype]->print_question_form_end($question);
+$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
+$QTYPES[$question->qtype]->print_question_form_end($question);
 ?>
-</table>
-
-</center>
-</form>
index e1ba2a76beedd7a556eba5085ffa1e1bd9a2b7d8..17a1707a68eec4e2f0b0d43134cadfc08a7f2c21 100644 (file)
@@ -239,10 +239,6 @@ class question_match_qtype extends default_questiontype {
         $answerids      = array();
         $responses      = &$state->responses;
 
-        $formatoptions = new stdClass;
-        $formatoptions->noclean = true;
-        $formatoptions->para = false;
-
         // Prepare a list of answers, removing duplicates. 
         foreach ($subquestions as $subquestion) {
             foreach ($subquestion->options->answers as $ans) {
@@ -268,9 +264,8 @@ class question_match_qtype extends default_questiontype {
         $answers = draw_rand_array($answers, count($answers));
 
         // Print formulation
-        $questiontext = format_text($question->questiontext,
-                         $question->questiontextformat,
-                         $formatoptions, $cmoptions->course);
+        $questiontext = $this->format_text($question->questiontext,
+                $question->questiontextformat, $cmoptions);
         $image = get_question_image($question, $cmoptions->course);
 
         ///// Print the input controls //////
@@ -278,8 +273,8 @@ class question_match_qtype extends default_questiontype {
             if ($subquestion->questiontext) {
                 /// Subquestion text:
                 $a = new stdClass;
-                $a->text = format_text($subquestion->questiontext,
-                    $question->questiontextformat, $formatoptions, $cmoptions->course);
+                $a->text = $this->format_text($subquestion->questiontext,
+                        $question->questiontextformat, $cmoptions);
     
                 /// Drop-down list:
                 $menuname = $nameprefix.$subquestion->id;
index 85dfb37d681644d23232cebdcacf12e6b0e029a3..23cfade0d2a01995dec2272025f33b76fea495b7 100644 (file)
@@ -1,94 +1,12 @@
-<form name="theform" method="post" action="question.php">
-<center>
-<table cellpadding="5">
-
-  <tr valign="top">
-    <td align="right"><b><?php  print_string("category", "quiz") ?>:</b></td>
-    <td align="left">
-      <?php   question_category_select_menu($course->id, true, true, $question->category); ?>
-    </td>
-  </tr>
-
-  <tr valign="top">
-    <td align="right"><b><?php  print_string("questionname", "quiz") ?>:</b></td>
-    <td align="left">
-      <input type="text" name="name" size="40" value="<?php  p($question->name) ?>" alt="<?php print_string("questionname", "quiz") ?>" />
-      <?php  if (isset($err["name"])) formerr($err["name"]); ?>
-    </td>
-  </tr>
-
-  <tr valign="top">
-    <td align="right"><b><?php  print_string("question", "quiz") ?>:</b>
-      <br /><br /><br /><font size="1">
-      <?php
-           if ($usehtmleditor) {
-               helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
-           } else {
-               helpbutton("text", get_string("helptext"), "moodle", true, true);
-           }
-      ?>
-      </font>
-    </td>
-    <td align="left">
-      <?php
-          if (isset($err["questiontext"])) {
-              formerr($err["questiontext"]);
-              echo "<br />";
-          }
-          print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);
-          if ($usehtmleditor) {
-              echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'" />';
-          } else {
-              echo "<div align=\"right\">";
-              print_string("formattexttype");
-              echo ":&nbsp;";
-              if (!isset($question->questiontextformat)) {
-                  $question->questiontextformat = FORMAT_MOODLE;
-              }
-              choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
-              helpbutton("textformat", get_string("helpformatting"));
-              echo "</div>";
-          }
-      ?>
-    </td>
-  </tr>
-
-  <tr valign="top">
-    <td align="right"><b><?php  print_string("imagedisplay", "quiz") ?>:</b></td>
-    <td align="left">
-      <?php
-          if (empty($images)) {
-              print_string("noimagesyet");
-          } else {
-              choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
-          }
-      ?>
-    </td>
-  </tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("defaultgrade", "quiz") ?>:</b></td>
-    <td align="left">
-        <input type="text" name="defaultgrade" size="3" value="<?php  p($question->defaultgrade) ?>" alt="<?php  print_string("defaultgrade", "quiz") ?>" />
-
-        <?php  if (isset($err["defaultgrade"])) formerr($err["defaultgrade"]); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("penaltyfactor", "quiz") ?>:</b></td>
-    <td align="left">
-        <input type="text" name="penalty" size="3" value="<?php  p($question->penalty) ?>" alt="<?php  print_string("penaltyfactor", "quiz") ?>" />
-        <?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
-        <?php  if (isset($err["penalty"])) formerr($err["penalty"]); ?>
-    </td>
-</tr>
-
 <?php
-    for ($i=1; $i<=count($answers); $i++) {
-        if (!isset($answers[$i-1]->fraction)) {
-            $answers[$i-1]->answer = '';
-            $answers[$i-1]->fraction = 0;
-            $answers[$i-1]->feedback = '';
-        }
+$QTYPES[$question->qtype]->print_question_form_start($question, array(), $course, $usehtmleditor);
+
+for ($i=1; $i<=count($answers); $i++) {
+    if (!isset($answers[$i-1]->fraction)) {
+        $answers[$i-1]->answer = '';
+        $answers[$i-1]->fraction = 0;
+        $answers[$i-1]->feedback = '';
+    }
 ?>
 
   <tr valign="top">
   </tr>
 
 <?php
-    } /// End of loop, printing answers
-    $QTYPES['missingtype']->print_replacement_options($question, $course, $contextquiz);
-    $QTYPES['missingtype']->print_question_form_end($question);
-?>
-</table>
-
-</center>
-</form>
+} /// End of loop, printing answers
 
+$QTYPES['missingtype']->print_replacement_options($question, $course, $contextquiz);
+$QTYPES['missingtype']->print_question_form_end($question);
+?>
index 34a893f6cf4368068c89910cd8ca04d072454438..40979cd2b67eb2cae6e22125abd4e1768d4da092 100644 (file)
@@ -1,61 +1,7 @@
-<form name="theform" method="post"  action="question.php">
-<center>
-<table cellpadding="5">
-<tr valign="top">
-    <td align="right"><b><?php  print_string("category", "quiz") ?>:</b></td>
-    <td align="left">
-    <?php   question_category_select_menu($course->id, true, true, $question->category); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("questionname", "quiz") ?>:</b></td>
-    <td align="left">
-        <input type="text" name="name" size="40" value="<?php  p($question->name) ?>" alt="<?php  print_string("questionname", "quiz") ?>" />
-        <?php  if (isset($err["name"])) formerr($err["name"]); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("question", "quiz") ?>:</b></td>
-    <td align="left">
-        <?php  if (isset($err["questiontext"])) {
-               formerr($err["questiontext"]);
-               echo "<br />";
-           }
-           print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);
-           if ($usehtmleditor) {
-               helpbutton("richtext", get_string("helprichtext"), "moodle");
-           } else {
-               helpbutton("text", get_string("helptext"), "moodle");
-           }
-        ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("imagedisplay", "quiz") ?>:</b></td>
-    <td align="left">
-    <?php   if (empty($images)) {
-            print_string("noimagesyet");
-        } else {
-            choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
-        }
-    ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("penaltyfactor", "quiz") ?>:</b></td>
-    <td align="left">
-        <input type="text" name="penalty" size="3" value="<?php  p($question->penalty) ?>" alt="<?php  print_string("penaltyfactor", "quiz") ?>" />
-        <?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
-        <?php  if (isset($err["penalty"])) formerr($err["penalty"]); ?>
-    </td>
-</tr>
 <?php
-    $QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
-    $QTYPES[$question->qtype]->print_question_form_end($question);
+$QTYPES[$question->qtype]->print_question_form_start($question, array(), $course, $usehtmleditor,
+        array('defaultgrade'));
+$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
+$QTYPES[$question->qtype]->print_question_form_end($question, '',
+        '<input type="hidden" name="defaultgrade" value="' . s($question->defaultgrade) . '" />');
 ?>
-</table>
-
-<input type="hidden" name="defaultgrade" value="<?php  p($question->defaultgrade) ?>" />
-
-</center>
-</form>
index b8015d8c1fc63cc5d8b7bc97b9b08b1b45d5fad2..472fe062d36bf2ff76ed0af7550aee1087add80e 100644 (file)
@@ -1,86 +1,6 @@
-<form name="theform" method="post" action="question.php">
-<center>
-<table cellpadding="5">
-
-  <tr valign="top">
-    <td align="right"><b><?php  print_string("category", "quiz") ?>:</b></td>
-    <td align="left">
-      <?php   question_category_select_menu($course->id, true, true, $question->category); ?>
-    </td>
-  </tr>
-
-  <tr valign="top">
-    <td align="right"><b><?php  print_string("questionname", "quiz") ?>:</b></td>
-    <td align="left">
-      <input type="text" name="name" size="40" value="<?php  p($question->name) ?>" alt="<?php print_string("questionname", "quiz") ?>" />
-      <?php  if (isset($err["name"])) formerr($err["name"]); ?>
-    </td>
-  </tr>
-
-  <tr valign="top">
-    <td align="right"><b><?php  print_string("question", "quiz") ?>:</b>
-      <br /><br /><br /><font size="1">
-      <?php
-           if ($usehtmleditor) {
-               helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
-           } else {
-               helpbutton("text", get_string("helptext"), "moodle", true, true);
-           }
-      ?>
-      </font>
-    </td>
-    <td align="left">
-      <?php
-          if (isset($err["questiontext"])) {
-              formerr($err["questiontext"]);
-              echo "<br />";
-          }
-          print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);
-          if ($usehtmleditor) {
-              echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'" />';
-          } else {
-              echo "<div align=\"right\">";
-              print_string("formattexttype");
-              echo ":&nbsp;";
-              if (!isset($question->questiontextformat)) {
-                  $question->questiontextformat = FORMAT_MOODLE;
-              }
-              choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
-              helpbutton("textformat", get_string("helpformatting"));
-              echo "</div>";
-          }
-      ?>
-    </td>
-  </tr>
-
-  <tr valign="top">
-    <td align="right"><b><?php  print_string("imagedisplay", "quiz") ?>:</b></td>
-    <td align="left">
-      <?php
-          if (empty($images)) {
-              print_string("noimagesyet");
-          } else {
-              choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
-          }
-      ?>
-    </td>
-  </tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("defaultgrade", "quiz") ?>:</b></td>
-    <td align="left">
-        <input type="text" name="defaultgrade" size="3" value="<?php  p($question->defaultgrade) ?>" alt="<?php  print_string("defaultgrade", "quiz") ?>" />
-
-        <?php  if (isset($err["defaultgrade"])) formerr($err["defaultgrade"]); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("penaltyfactor", "quiz") ?>:</b></td>
-    <td align="left">
-        <input type="text" name="penalty" size="3" value="<?php  p($question->penalty) ?>" alt="<?php  print_string("penaltyfactor", "quiz") ?>" />
-        <?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
-        <?php  if (isset($err["penalty"])) formerr($err["penalty"]); ?>
-    </td>
-</tr>
+<?php
+$QTYPES[$question->qtype]->print_question_form_start($question, array(), $course, $usehtmleditor);
+?>
   <tr valign="top">
     <td align="right"><b><?php  print_string("answerhowmany", "quiz") ?>:</b></td>
     <td align="left">
   </tr>
 
 <?php
-    for ($i=1; $i<=count($answers); $i++) {
-        if (!isset($answers[$i-1]->fraction)) {
-            $answers[$i-1]->answer = '';
-            $answers[$i-1]->fraction = 0;
-            $answers[$i-1]->feedback = '';
-        }
+for ($i=1; $i<=count($answers); $i++) {
+    if (!isset($answers[$i-1]->fraction)) {
+        $answers[$i-1]->answer = '';
+        $answers[$i-1]->fraction = 0;
+        $answers[$i-1]->feedback = '';
+    }
 ?>
 
   <tr valign="top">
   </tr>
 
 <?php
-    } /// End of loop, printing answers
-    $QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
-    $QTYPES[$question->qtype]->print_question_form_end($question);
-?>
-</table>
-
-</center>
-</form>
+} /// End of loop, printing answers
 
+$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
+$QTYPES[$question->qtype]->print_question_form_end($question);
+?>
index e48dda35f993fd75d5c6d8c3b62590748ab2009b..ce48db9ec048ccce0caa673599658dcec8d4c392 100644 (file)
@@ -1,88 +1,7 @@
-<form name="theform" method="post" action="question.php">
-<center>
-<table cellpadding="5">
-<tr valign="top">
-    <td align="right"><b><?php print_string("category", "quiz") ?>:</b></td>
-    <td align="left">
-    <?php question_category_select_menu($course->id, true, true, $question->category); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php print_string("questionname", "quiz") ?>:</b></td>
-    <td align="left">
-        <input type="text" name="name" size="50" value="<?php p($question->name) ?>" alt="<?php print_string("questionname", "quiz") ?>" />
-        <?php if (isset($err["name"])) formerr($err["name"]); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php print_string("question", "quiz") ?>:</b>
-    <br />
-    <br />
-    <br />
-    <font size="1">
-    <?php
-           if ($usehtmleditor) {
-               helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
-           } else {
-               helpbutton("text", get_string("helptext"), "moodle", true, true);
-           }
-    ?>
-    </font>
-    </td>
-    <td align="left">
-        <?php if (isset($err["questiontext"])) {
-               formerr($err["questiontext"]);
-               echo "<br />";
-           }
-
-           print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);
-
-           if ($usehtmleditor) {
-               echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'" />';
-           } else {
-               echo "<div align=\"right\">";
-               print_string("formattexttype");
-               echo ":&nbsp;";
-               if (!isset($question->questiontextformat)) {
-                   $question->questiontextformat = FORMAT_MOODLE;
-               }
-               choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
-               helpbutton("textformat", get_string("helpformatting"));
-               echo "</div>";
-           }
-        ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php print_string("imagedisplay", "quiz") ?>:</b></td>
-    <td align="left">
-    <?php
-        if (empty($images)) {
-            print_string("noimagesyet");
-        } else {
-            choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
-        }
-    ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php print_string("defaultgrade", "quiz") ?>:</b></td>
-    <td align="left">
-        <input type="text" name="defaultgrade" size="3" value="<?php p($question->defaultgrade) ?>" alt="<?php print_string("defaultgrade", "quiz") ?>" />
-
-        <?php if (isset($err["defaultgrade"])) formerr($err["defaultgrade"]); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php print_string("penaltyfactor", "quiz") ?>:</b></td>
-    <td align="left">
-        <input type="text" name="penalty" size="3" value="<?php p($question->penalty) ?>" alt="<?php print_string("penaltyfactor", "quiz") ?>" />
-        <?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
-        <?php if (isset($err["penalty"])) formerr($err["penalty"]); ?>
-    </td>
-</tr>
-<!-- Answers. -->
 <?php
+$QTYPES[$question->qtype]->print_question_form_start($question, array(), $course, $usehtmleditor);
+
+// Answers.
     for ($i=1; $i<=count($answers); $i++) {
         $answer = $answers[$i-1];
 ?>
 </tr>
 <?php
     }
+// Units.
 ?>
-<!-- Units. -->
 <tr valign="top">
 <td align="right"><b><?php print_string("unit", "quiz") ?>:</b></td>
     <td align="left"><?php
@@ -166,9 +85,6 @@ for ($i = 1; $i < 6; $i++) {
 <?php
 } /// END for
 
-    $QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
-    $QTYPES[$question->qtype]->print_question_form_end($question);
+$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
+$QTYPES[$question->qtype]->print_question_form_end($question);
 ?>
-</table>
-</center>
-</form>
index fd58e422e7fab414c809545cb64aa6bb6247f01a..0e61c0de4743a86d38e2f2fda72cc87fd84a5cc8 100644 (file)
       ?>
     </div>
   <?php }
-            echo $commentlink;
+  echo $commentlink;
+  if ($commentary) { ?>
+    <div class="commentary">
+      <?php echo $commentary ?>
+    </div>
+  <?php }
   if ($history) { ?>
     <div class="history">
       <?php
index 2e005847d2fdfbd6723cafc16f429b64f9885fb3..ab2478fd1b51c39a1e19a2dd78b6e718f66abf72 100644 (file)
@@ -59,6 +59,12 @@ class default_questiontype {
             $question->image = $form->image;
         }
 
+        if (empty($form->commentarytext)) {
+            $question->commentarytext = '';
+        } else {
+            $question->commentarytext = trim($form->commentarytext);
+        }
+
         if (empty($question->name)) {
             $question->name = substr(strip_tags($question->questiontext), 0, 15);
             if (empty($question->name)) {
@@ -458,7 +464,9 @@ class default_questiontype {
         /* The default implementation should work for most question types
         provided the member functions it calls are overridden where required.
         The layout is determined by the template question.html */
+        
         global $CFG;
+        $isgraded = question_state_is_graded($state->last_graded);
 
         // For editing teachers print a link to an editing popup window
         $editlink = '';
@@ -468,10 +476,16 @@ class default_questiontype {
             $editlink = link_to_popup_window('/question/question.php?id='.$question->id, $stredit, $linktext, 450, 550, $stredit, '', true);
         }
 
+        $commentary = '';
+        if ($isgraded && $options->commentary) {
+            $commentary = $this->format_text($question->commentarytext,
+                    $question->questiontextformat, $cmoptions);
+        }
+
         $grade = '';
         if ($question->maxgrade and $options->scores) {
             if ($cmoptions->optionflags & QUESTION_ADAPTIVE) {
-                $grade = (!question_state_is_graded($state->last_graded)) ? '--/' : round($state->last_graded->grade, $cmoptions->decimalpoints).'/';
+                $grade = !$isgraded ? '--/' : round($state->last_graded->grade, $cmoptions->decimalpoints).'/';
             }
             $grade .= $question->maxgrade;
         }
@@ -506,7 +520,7 @@ class default_questiontype {
             }
             if (count($states) > 1) {
                 $strreviewquestion = get_string('reviewresponse', 'quiz');
-                unset($table);
+                $table = new stdClass;
                 $table->width = '100%';
                 if ($options->scores) {
                     $table->head  = array (
@@ -599,6 +613,7 @@ class default_questiontype {
         if (!empty($question->maxgrade) && $options->scores) {
             if (question_state_is_graded($state->last_graded)) {
                 // Display the grading details from the last graded state
+                $grade = new stdClass;
                 $grade->cur = round($state->last_graded->grade, $cmoptions->decimalpoints);
                 $grade->max = $question->maxgrade;
                 $grade->raw = round($state->last_graded->raw_grade, $cmoptions->decimalpoints);
@@ -987,24 +1002,71 @@ class default_questiontype {
         echo "</td></tr>\n";
     }
 
-    function print_question_form_end($question, $submitscript='') {
-    // This function is used at the end of the question edit forms in all question types
-    // It prints the submit, copy, and cancel buttons and the standard hidden form fields
-        global $USER;
-        echo '<tr valign="top">
-              <td colspan="2" align="center">
-              <input type="submit" '.$submitscript.' value="'.get_string('savechanges').'" /> ';
-        if ($question->id) {
-            echo '<input type="submit" name="makecopy" '.$submitscript.' value="'.get_string("makecopy", "quiz").'" /> ';
+    /**
+     * Print the start of the question editing form, including the question category,
+     * questionname, questiontext, image, defaultgrade, penalty and commentary fields.
+     * 
+     * Three of the fields, image, defaultgrade, penalty, are optional, and
+     * can be removed from the from using the $hidefields argument. 
+     * 
+     * @param object $question The question object that the form we are printing is for.
+     * @param array $err Array of optional error messages to display by each field.
+     *          Used when the form is being redisplayed after validation failed.
+     * @param object $course The course object for the course this question belongs to.
+     * @param boolean $usehtmleditor Whether the html editor should be used.
+     * @param array $hidefields An array which may contain the strings,
+     *          'image', 'defaultgrade' or 'penalty' to remove the corresponding field.
+     */
+    function print_question_form_start($question, $err, $course, $usehtmleditor, $hidefields = array()) {
+        global $CFG;
+
+        // If you edit this function, you also need to edit random/editquestion.html.
+        
+        if (!in_array('image', $hidefields)) {
+            make_upload_directory("$course->id");    // Just in case
+            $coursefiles = get_directory_list("$CFG->dataroot/$course->id", $CFG->moddata);
+            foreach ($coursefiles as $filename) {
+                if (mimeinfo("icon", $filename) == "image.gif") {
+                    $images["$filename"] = $filename;
+                }
+            }
         }
-        echo '<input type="submit" name="cancel" value="'.get_string("cancel").'" />
-              <input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />
-              <input type="hidden" name="id" value="'.$question->id.'" />
-              <input type="hidden" name="qtype" value="'.$question->qtype.'" />';
-        // The following hidden field indicates that the versioning code should be turned on, i.e.,
-        // that old versions should be kept if necessary
-        echo '<input type="hidden" name="versioning" value="on" />
-              </td></tr>';
+        
+        include('editquestionstart.html');
+    }
+    
+    /**
+     * Print the end of the question editing form, including the submit, copy,
+     * and cancel button, and the standard hidden fields like the sesskey and
+     * the question type.
+     * 
+     * @param object $question The question object that the form we are printing is for.
+     * @param string $submitscript Extra attributes, for example 'onsubmit="myfunction"',
+     *          that is added to the HTML of the submit button.
+     * @param string $hiddenfields Extra hidden fields (actually any HTML)
+     *          to be added at the end of the form.
+     */
+    function print_question_form_end($question, $submitscript = '', $hiddenfields = '') {
+        global $USER;
+        
+        // If you edit this function, you also need to edit random/editquestion.html.
+
+        include('editquestionend.html');
+    }
+    
+    /**
+     * Call format_text from weblib.php with the options appropriate to question types.
+     * 
+     * @param string $text the text to format.
+     * @param integer $text the type of text. Normally $question->questiontextformat.
+     * @param object $cmoptions the context the string is being displayed in. Only $cmoptions->course is used.
+     * @return string the formatted text.
+     */
+    function format_text($text, $textformat, $cmoptions) {
+        $formatoptions = new stdClass;
+        $formatoptions->noclean = true;
+        $formatoptions->para = false;
+        return format_text($text, $textformat, $formatoptions, $cmoptions->course);
     }
     
 /// BACKUP FUNCTIONS ////////////////////////////
index f79254d1812ebf35cfffef7bc7b7c082798f05d4..5a51a9325bc13479c68fa79cc2ed9d9784ae681c 100644 (file)
@@ -1,22 +1,22 @@
-<center>
 <form name="theform" method="post" action="question.php">
+<center>
 <table cellpadding="5">
+
 <tr valign="top">
     <td align="right"><b><?php  print_string("category", "quiz") ?>:</b></td>
     <td align="left">
     <?php   question_category_select_menu($course->id, true, true, $question->category); ?>
     </td>
 </tr>
+
 <tr valign="top">
     <td align="right"><b><?php  print_string("questionname", "quiz") ?>:</b></td>
     <td align="left">
-        <?php  if (empty($question->name)) {
-               $question->name = get_string("random", "quiz");
-           } ?>
-        <input type="text" name="name" size="40" value="<?php  p($question->name) ?>" alt="<?php  print_string("questionname", "quiz") ?>" />
+        <input type="text" name="name" size="50" value="<?php  p($question->name) ?>" alt="<?php  print_string("questionname", "quiz") ?>" />
         <?php  if (isset($err["name"])) formerr($err["name"]); ?>
     </td>
 </tr>
+
 <tr valign="top">
     <td align="right"><b><?php  print_string("recurse", "quiz") ?>:</b></td>
     <td align="left">
@@ -33,5 +33,5 @@
 <input type="hidden" name="id" value="<?php  p($question->id) ?>" />
 <input type="hidden" name="qtype" value="<?php  p($question->qtype) ?>" />
 <input type="submit" value="<?php  print_string("savechanges") ?>" />
-</form>
 </center>
+</form>
index 03e0ea2005cf0a65858e54fd9f7496dc45d3414e..b3a01cd90764cdc0a3850a3c5b626f799c55f97e 100644 (file)
@@ -1,6 +1,9 @@
 <?php // $Id$
 
+    if (empty($question->name)) {
+        $question->name = get_string("random", "quiz");
+    }
+    
     print_heading_with_help(get_string("editingrandom", "quiz"), "random", "quiz");
     require("$CFG->dirroot/question/type/random/editquestion.html");
-
 ?>
index 1f03ace3054574be4f0b33da78167c9775c2db07..d6fa04dc3a3f976db198fbdc811fa5077c5ee63d 100644 (file)
@@ -1,79 +1,7 @@
-<form name="theform" method="post" action="question.php">
-<center>
-<table cellpadding="5">
-<tr valign="top">
-    <td align="right"><b><?php  print_string("category", "quiz") ?>:</b></td>
-    <td align="left">
-    <?php echo $categories[$question->category]; ?>
-    <input type="hidden" name="category" value="<?php echo "$question->category"; ?>" />
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("questionname", "quiz") ?>:</b></td>
-    <td align="left">
-        <?php
-           if (empty($question->name)) {
-               $question->name =  get_string("randomsamatch", "quiz");
-           }
-        ?>
-        <input type="text" name="name" size="40" value="<?php  p($question->name) ?>" />
-        <?php  if (isset($err["name"])) formerr($err["name"]); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("introduction", "quiz") ?>:</b>
-    <br />
-    <font size="1">
-    <?php
-           if ($usehtmleditor) {
-               helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
-           } else {
-               helpbutton("text", get_string("helptext"), "moodle", true, true);
-           }
-    ?>
-    </font>
-    </td>
-    <td align="left">
-        <?php  if (isset($err["questiontext"])) {
-               formerr($err["questiontext"]);
-               echo "<br />";
-           }
-           if (empty($question->questiontext)) {
-               $question->questiontext =  get_string("randomsamatchintro", "quiz");
-           }
-           print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);
-           if ($usehtmleditor) {
-               echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'" />';
-           } else {
-               echo '<div align="right">';
-               print_string("formattexttype");
-               echo ":&nbsp;";
-               if (empty($question->questiontextformat)) {
-                   $question->questiontextformat = FORMAT_MOODLE;
-               }
-               choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
-               helpbutton("textformat", get_string("helpformatting"));
-               echo "</div>";
-           }
-        ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("defaultgrade", "quiz") ?>:</b></td>
-    <td align="left">
-        <input type="text" name="defaultgrade" size="3" value="<?php  p($question->defaultgrade) ?>" alt="<?php  print_string("defaultgrade", "quiz") ?>" />
-
-        <?php  if (isset($err["defaultgrade"])) formerr($err["defaultgrade"]); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("penaltyfactor", "quiz") ?>:</b></td>
-    <td align="left">
-        <input type="text" name="penalty" size="3" value="<?php  p($question->penalty) ?>" alt="<?php  print_string("penaltyfactor", "quiz") ?>" />
-        <?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
-        <?php  if (isset($err["penalty"])) formerr($err["penalty"]); ?>
-    </td>
-</tr>
+<?php
+$QTYPES[$question->qtype]->print_question_form_start($question, array(), $course, $usehtmleditor,
+        array('image'));
+?>
 <tr valign="top">
     <td align="right"><b><?php  print_string("randomsamatchnumber", "quiz") ?>:</b></td>
     <td align="left">
@@ -95,9 +23,6 @@
     </td>
 </tr>
 <?php
-    $QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
-    $QTYPES[$question->qtype]->print_question_form_end($question);
+$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
+$QTYPES[$question->qtype]->print_question_form_end($question);
 ?>
-</table>
-</center>
-</form>
index f39f7d2f14e3e17e9ddf222b722e25ec0596c56e..dca57b41da3928e6a558a55ef6d8b3cffaff5314 100644 (file)
@@ -8,6 +8,14 @@
     $numberavailable = count($saquestions);
     unset($saquestions);
 
+    if (empty($question->name)) {
+        $question->name =  get_string("randomsamatch", "quiz");
+    }
+
+    if (empty($question->questiontext)) {
+        $question->questiontext =  get_string("randomsamatchintro", "quiz");
+    }
+
     $yesnooptions = array();
     $yesnooptions[0] = get_string("no");
     $yesnooptions[1] = get_string("yes");
index 2a7040d4ef0a898aefa751754a296c80583a7b18..1e1acb49f7a3999f6a7ec2157a30b7bcfacd0b0e 100644 (file)
@@ -1,69 +1,8 @@
-<form name="theform" method="post" action="question.php">
-<center>
-<table cellpadding="5">
-<tr valign="top">
-    <td align="right"><b><?php  print_string("category", "quiz") ?>:</b></td>
-    <td align="left">
-    <?php   question_category_select_menu($course->id, true, true, $question->category); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("questionname", "quiz") ?>:</b></td>
-    <td align="left">
-        <input type="text" name="name" size="50" value="<?php  p($question->name) ?>" alt="<?php  print_string("questionname", "quiz") ?>" />
-        <?php  if (isset($err["name"])) formerr($err["name"]); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("question", "quiz") ?>:</b>
-    <br />
-    <br />
-    <br />
-    <font size="1">
-    <?php
-           if ($usehtmleditor) {
-               helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
-           } else {
-               helpbutton("text", get_string("helptext"), "moodle", true, true);
-           }
-    ?>
-    </font>
-    </td>
-    <td align="left">
-        <?php  if (isset($err["questiontext"])) {
-               formerr($err["questiontext"]);
-               echo "<br />";
-           }
-           print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);
-           if ($usehtmleditor) {
-               echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'" />';
-           } else {
-               echo "<div align=\"right\">";
-               print_string("formattexttype");
-               echo ":&nbsp;";
-               if (!isset($question->questiontextformat)) {
-                   $question->questiontextformat = FORMAT_MOODLE;
-               }
-               choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
-               helpbutton("textformat", get_string("helpformatting"));
-               echo "</div>";
-           }
-        ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("imagedisplay", "quiz") ?>:</b></td>
-    <td align="left">
-    <?php   if (empty($images)) {
-            print_string("noimagesyet");
-        } else {
-            choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
-        }
-    ?>
-    </td>
-</tr>
+<?php
+$QTYPES[$question->qtype]->print_question_form_start($question, array(), $course, $usehtmleditor);
+?>
 <tr valign="top">
-    <td align="right"><b><?php  print_string("casesensitive", "quiz") ?>:</b></td>
+    <td align="right"><b><?php print_string("casesensitive", "quiz") ?>:</b></td>
     <td align="left">
     <?php
         unset($menu);
     </td>
 </tr>
 <tr valign="top">
-    <td align="right"><b><?php  print_string("defaultgrade", "quiz") ?>:</b></td>
-    <td align="left">
-        <input type="text" name="defaultgrade" size="3" value="<?php  p($question->defaultgrade) ?>" alt="<?php  print_string("defaultgrade", "quiz") ?>" />
-
-        <?php  if (isset($err["defaultgrade"])) formerr($err["defaultgrade"]); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("penaltyfactor", "quiz") ?>:</b></td>
-    <td align="left">
-        <input type="text" name="penalty" size="3" value="<?php  p($question->penalty) ?>" alt="<?php  print_string("penaltyfactor", "quiz") ?>" />
-        <?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
-        <?php  if (isset($err["penalty"])) formerr($err["penalty"]); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("correctanswers", "quiz") ?></b>:</td>
+    <td align="right"><b><?php print_string("correctanswers", "quiz") ?></b>:</td>
     <td align="left">
-        <?php  print_string("filloutoneanswer", "quiz") ?>
+        <div style="width: 35em">
+            <?php print_string("filloutoneanswer", "quiz") ?>
+        </div>
     </td>
 </tr>
 <?php
     for ($i=1; $i<=count($answers); $i++) {
 ?>
 <tr valign="top">
-    <td align="right"><b><?php  echo get_string("answer", "quiz")." $i";  ?>:</b></td>
+    <td align="right"><b><?php echo get_string("answer", "quiz")." $i";  ?>:</b></td>
     <td align="left">
         <?php
             if ($answers[$i-1]->answer === '') {
     </td>
 </tr>
 <tr valign="top">
-    <td align="right"><b><?php  print_string("feedback", "quiz") ?>:</b></td>
+    <td align="right"><b><?php print_string("feedback", "quiz") ?>:</b></td>
     <td align="left">
         <textarea name="feedback[]" rows="2" cols="50"><?php  p($feedbacktext) ?></textarea>
     </td>
 </tr>
 <?php
     }
+
+$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
+$QTYPES[$question->qtype]->print_question_form_end($question);
 ?>
-<?php
-    $QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
-    $QTYPES[$question->qtype]->print_question_form_end($question);
-?>
-</table>
-</center>
-</form>
index f9acc56659cafe214e82ee10cd1d85e6a1af634f..1ae0c378a9138fb7dd6072a2349bc594c3a389f0 100644 (file)
@@ -1,83 +1,6 @@
-<form name="theform" method="post" action="question.php">
-<center>
-<table cellpadding="5">
-<tr valign="top">
-    <td align="right"><b><?php  print_string("category", "quiz") ?>:</b></td>
-    <td align="left">
-    <?php   question_category_select_menu($course->id, true, true, $question->category); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("questionname", "quiz") ?>:</b></td>
-    <td align="left">
-        <input type="text" name="name" size="50" value="<?php  p($question->name) ?>" alt="<?php  print_string("questionname", "quiz") ?>"/>
-        <?php  if (isset($err["name"])) formerr($err["name"]); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("question", "quiz") ?>:</b>
-    <br />
-    <br />
-    <br />
-    <font size="1">
-    <?php
-           if ($usehtmleditor) {
-               helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
-           } else {
-               helpbutton("text", get_string("helptext"), "moodle", true, true);
-           }
-    ?>
-    </font>
-    </td>
-    <td align="left">
-        <?php  if (isset($err["questiontext"])) {
-               formerr($err["questiontext"]);
-               echo "<br />";
-           }
-           print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);
-           if ($usehtmleditor) {
-               echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'" />';
-           } else {
-               echo "<div align=\"right\">";
-               print_string("formattexttype");
-               echo ":&nbsp;";
-               if (!isset($question->questiontextformat)) {
-                   $question->questiontextformat = FORMAT_MOODLE;
-               }
-               choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
-               helpbutton("textformat", get_string("helpformatting"));
-               echo "</div>";
-           }
-        ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("imagedisplay", "quiz") ?>:</b></td>
-    <td align="left">
-    <?php   if (empty($images)) {
-            print_string("noimagesyet");
-        } else {
-            choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
-        }
-    ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("defaultgrade", "quiz") ?>:</b></td>
-    <td align="left">
-        <input type="text" name="defaultgrade" size="3" value="<?php  p($question->defaultgrade) ?>" alt="<?php  print_string("defaultgrade", "quiz") ?>" />
-
-        <?php  if (isset($err["defaultgrade"])) formerr($err["defaultgrade"]); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php  print_string("penaltyfactor", "quiz") ?>:</b></td>
-    <td align="left">
-        <input type="text" name="penalty" size="3" value="<?php  p($question->penalty) ?>" alt="<?php  print_string("penaltyfactor", "quiz") ?>" />
-        <?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
-        <?php  if (isset($err["penalty"])) formerr($err["penalty"]); ?>
-    </td>
-</tr>
+<?php
+$QTYPES[$question->qtype]->print_question_form_start($question, array(), $course, $usehtmleditor);
+?>
 <tr valign="top">
     <td align="right"><b><?php  print_string("correctanswer", "quiz") ?>:</b></td>
     <td align="left">
     </td>
 </tr>
 <?php
-    $QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
-    $QTYPES[$question->qtype]->print_question_form_end($question);
+$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
+$QTYPES[$question->qtype]->print_question_form_end($question);
 ?>
-</table>
-
-</center>
-</form>
index dbf69a370491448636b56d248e3967b53cf8cd0a..7f8763f99e6f27aad2032b7a0e74f433dbe4d17a 100644 (file)
@@ -1239,6 +1239,7 @@ body#message-messages {
 .que .grading,
 .que .comment,
 .que .commentlink,
+.que .commentary,
 .que .history {
   float: right;
   margin: 5px;