]> git.mjollnir.org Git - moodle.git/commitdiff
New quiz config page to allow admin to set defaults and hide options on the quiz...
authorgustav_delius <gustav_delius>
Thu, 23 Dec 2004 07:09:33 +0000 (07:09 +0000)
committergustav_delius <gustav_delius>
Thu, 23 Dec 2004 07:09:33 +0000 (07:09 +0000)
lang/en/help/fixdefaults.html [new file with mode: 0644]
lang/en/moodle.php
lib/adminlib.php
lib/weblib.php
mod/quiz/config.html [new file with mode: 0644]
mod/quiz/defaults.php [new file with mode: 0644]
mod/quiz/mod.html

diff --git a/lang/en/help/fixdefaults.html b/lang/en/help/fixdefaults.html
new file mode 100644 (file)
index 0000000..1fd1429
--- /dev/null
@@ -0,0 +1 @@
+<p align="center"><b>Fix site defaults</b></p> <p>If you check these boxes then the default value that you choose here will be fixed for all new instances. The setup screen that the teacher sees will be simplified because it will not display the option. </p> 
\ No newline at end of file
index 41c65c2c5e62641f76eee2ef06059cd1299134b4..a5272f0a7e4c3ff74c6c2cd6ea342ba4b7fee8c6 100644 (file)
@@ -461,6 +461,7 @@ $string['existingcoursedeleting'] = 'Existing course, deleting it first';
 $string['existingcreators'] = 'Existing course creators';
 $string['existingstudents'] = 'Enrolled students';
 $string['existingteachers'] = 'Existing teachers';
+$string['explanation'] = 'Explanation';
 $string['failedloginattempts'] = '$a->attempts failed logins since your last login';
 $string['failedloginattemptsall'] = '$a->attempts failed logins for $a->accounts accounts';
 $string['feedback'] = 'Feedback';
@@ -473,6 +474,7 @@ $string['findmorecourses'] = 'Find more courses...';
 $string['firstdayofweek'] = '0';
 $string['firstname'] = 'First name';
 $string['firsttime'] = 'Is this your first time here?';
+$string['fix'] = 'Fix';
 $string['followingoptional'] = 'The following items are optional';
 $string['followingrequired'] = 'The following items are required';
 $string['force'] = 'Force';
@@ -942,6 +944,7 @@ $string['showtheselogs'] = 'Show these logs';
 $string['since'] = 'Since';
 $string['sincelast'] = ' since last login';
 $string['site'] = 'Site';
+$string['sitedefault'] = 'Site Default';
 $string['siteerrors'] = 'Site errors';
 $string['sitefiles'] = 'Site files';
 $string['sitelogs'] = 'Site logs';
index 72003ef8d4bdee9f6263841d9830e25b54847443..c19d1f34eb26468a3c358fdb570230aaff85ed0d 100644 (file)
@@ -213,6 +213,17 @@ function upgrade_activity_modules($return) {
                 error($module->name .' tables could NOT be set up successfully!');
             }
         }
+        
+        if ( is_readable($fullmod .'/defaults.php')) {
+            // Insert default values for any important configuration variables
+            include_once($fullmod .'/defaults.php'); 
+            foreach ($defaults as $name => $value) {
+                if (!isset($CFG->$name)) {
+                    $CFG->$name = $value;
+                    set_config($name, $value);
+                }
+            }
+        }
     }
 
     if (!empty($updated_modules)) {
index b845c7e96865324a18ea60e650cd59d84e4a7d52..64369eaaf5b5bc06556806e839ee04201bd66ba4 100644 (file)
@@ -2880,7 +2880,7 @@ function print_time_selector($hour, $minute, $currenttime=0, $step=5) {
  * @param string $unit ?
  * @todo Finish documenting this function
  */
-function print_timer_selector($timelimit = 0, $unit = '') {
+function print_timer_selector($timelimit = 0, $unit = '', $name = 'timelimit') {
 
     global $CFG;
 
@@ -2894,7 +2894,7 @@ function print_timer_selector($timelimit = 0, $unit = '') {
     for ($i=1; $i<=$maxvalue; $i++) {
         $minutes[$i] = $i.$unit;
     }
-    choose_from_menu($minutes, 'timelimit', $timelimit, get_string('none'));
+    choose_from_menu($minutes, $name, $timelimit, get_string('none'));
 }
 
 /**
diff --git a/mod/quiz/config.html b/mod/quiz/config.html
new file mode 100644 (file)
index 0000000..d26a22f
--- /dev/null
@@ -0,0 +1,233 @@
+<form method="post" action="module.php" name="form">
+<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>">
+
+<table cellpadding="9" cellspacing="0" >
+
+<tr valign="top">
+  <th align="right">&nbsp;</th>
+  <th align="left">
+    <?php print_string('sitedefault'); ?>
+  </th>
+  <th align="center">
+    <?php print_string('fix'); helpbutton("fixdefaults"); ?>
+  </th>
+</tr>    
+
+<tr valign="top">
+  <td align="right"><b><?php print_string("timelimit", "quiz") ?>:</b></td>
+  <td>
+    <?php 
+      print_timer_selector($CFG->quiz_timelimit, get_string("minutes","quiz"), 'quiz_timelimit');
+      helpbutton("timelimit", get_string("quiztimer","quiz"), "quiz");
+    ?>
+  </td>
+  <td align="center">
+    <input type="hidden" name="quiz_fix_timelimit" value="0">
+    <input type="checkbox" name="quiz_fix_timelimit" value="1" <?php p($CFG->quiz_fix_timelimit ? "checked" : "") ?> />
+  </td>
+</tr>
+
+<tr valign="top">
+  <td align="right"><b><?php print_string("shufflequestions", "quiz") ?>:</b></td>
+  <td>
+    <?php
+       unset($options);
+       $options[0] = get_string("no");
+       $options[1] = get_string("yes");
+       choose_from_menu ($options, "quiz_shufflequestions", $CFG->quiz_shufflequestions, "", "", "");
+       helpbutton("shufflequestions", get_string("shufflequestions","quiz"), "quiz");
+    ?>
+  </td>
+  <td align="center">
+    <input type="hidden" name="quiz_fix_shufflequestions" value="0">
+    <input type="checkbox" name="quiz_fix_shufflequestions" value="1" <?php p($CFG->quiz_fix_shufflequestions ? "checked" : "") ?> />
+  </td>
+</tr>
+
+<tr valign="top">
+  <td align="right"><b><?php print_string("shuffleanswers", "quiz") ?>:</b></td>
+  <td>
+    <?php
+       unset($options);
+       $options[0] = get_string("no");
+       $options[1] = get_string("yes");
+       choose_from_menu ($options, "quiz_shuffleanswers", $CFG->quiz_shuffleanswers, "", "", "");
+       helpbutton("attempts", get_string("attemptsallowed","quiz"), "quiz");
+    ?>
+  </td>
+  <td align="center">
+    <input type="hidden" name="quiz_fix_shuffleanswers" value="0">
+    <input type="checkbox" name="quiz_fix_shuffleanswers" value="1" <?php p($CFG->quiz_fix_shuffleanswers ? "checked" : "") ?> />
+  </td>
+</tr>
+
+<tr valign="top">
+  <td align="right"><b><?php print_string("attemptsallowed", "quiz") ?>:</b></td>
+  <td>
+    <?php
+        unset($options);
+        $options[0] = get_string("attemptsunlimited", "quiz");
+        $options[1] = "1 ".strtolower(get_string("attempt", "quiz"));
+        for ($i=2;$i<=6;$i++) {
+            $options[$i] = "$i ".strtolower(get_string("attempts", "quiz"));
+        }
+        choose_from_menu ($options, "quiz_attempts", $CFG->quiz_attempts, "", "", "");
+        helpbutton("attempts", get_string("attemptsallowed","quiz"), "quiz");
+    ?>
+  </td>
+  <td align="center">
+    <input type="hidden" name="quiz_fix_attempts" value="0">
+    <input type="checkbox" name="quiz_fix_attempts" value="1" <?php p($CFG->quiz_fix_attempts ? "checked" : "") ?> />
+  </td>
+</tr>
+
+<tr valign="top">
+  <td align="right"><b><?php print_string("eachattemptbuildsonthelast", "quiz") ?>:</b></td>
+  <td>
+    <?php
+       unset($options);
+       $options[0] = get_string("no");
+       $options[1] = get_string("yes");
+       choose_from_menu ($options, "quiz_attemptonlast", $CFG->quiz_attemptonlast, "", "", "");
+       helpbutton("repeatattempts", get_string("eachattemptbuildsonthelast", "quiz"), "quiz");
+    ?>
+  </td>
+  <td align="center">
+    <input type="hidden" name="quiz_fix_attemptonlast" value="0">
+    <input type="checkbox" name="quiz_fix_attemptonlast" value="1" <?php p($CFG->quiz_fix_attemptonlast ? "checked" : "") ?> />
+  </td>
+</tr>
+
+<tr valign="top">
+  <td align="right"><b><?php print_string("grademethod", "quiz") ?>:</b></td>
+  <td>
+    <?php
+       choose_from_menu ($QUIZ_GRADE_METHOD, "quiz_grademethod", $CFG->quiz_grademethod, "", "", "");
+       helpbutton("grademethod", get_string("grademethod","quiz"), "quiz");
+    ?>
+  </td>
+  <td align="center">
+    <input type="hidden" name="quiz_fix_grademethod" value="0">
+    <input type="checkbox" name="quiz_fix_grademethod" value="1" <?php p($CFG->quiz_fix_grademethod ? "checked" : "") ?> />
+  </td>
+</tr>
+
+<tr valign="top">
+  <td align="right"><b><?php print_string("showfeedback", "quiz") ?>:</b></td>
+  <td>
+    <?php
+       unset($options);
+       $options[0] = get_string("no");
+       $options[1] = get_string("yes");
+       choose_from_menu ($options, "quiz_showfeedback", $CFG->quiz_showfeedback, "", "", "");
+       helpbutton("feedback", get_string("showfeedback","quiz"), "quiz");
+    ?>
+  </td>
+  <td align="center">
+    <input type="hidden" name="quiz_fix_showfeedback" value="0">
+    <input type="checkbox" name="quiz_fix_showfeedback" value="1" <?php p($CFG->quiz_fix_showfeedback ? "checked" : "") ?> />
+  </td>
+</tr>
+
+<tr valign="top">
+  <td align="right"><b><?php print_string("showcorrectanswer", "quiz") ?>:</b></td>
+  <td>
+    <?php
+       unset($options);
+       $options[0] = get_string("no");
+       $options[1] = get_string("yes");
+       choose_from_menu ($options, "quiz_showanswer", $CFG->quiz_showanswer, "", "", "");
+       helpbutton("correctanswers", get_string("showcorrectanswer","quiz"), "quiz");
+    ?>
+  </td>
+  <td align="center">
+    <input type="hidden" name="quiz_fix_showanswer" value="0">
+    <input type="checkbox" name="quiz_fix_showanswer" value="1" <?php p($CFG->quiz_fix_showanswer ? "checked" : "") ?> />
+  </td>
+</tr>
+
+<tr valign="top">
+  <td align="right"><b><?php print_string("allowreview", "quiz") ?>:</b></td>
+  <td>
+    <?php
+       unset($options);
+       $options[0] = get_string("no");
+       $options[1] = get_string("yes");
+       choose_from_menu ($options, "quiz_allowreview", $CFG->quiz_allowreview, "", "", "");
+       helpbutton("review", get_string("allowreview","quiz"), "quiz");
+    ?>
+  </td>
+  <td align="center">
+    <input type="hidden" name="quiz_fix_allowreview" value="0">
+    <input type="checkbox" name="quiz_fix_allowreview" value="1" <?php p($CFG->quiz_fix_allowreview ? "checked" : "") ?> />
+  </td>
+</tr>
+
+<tr valign="top">
+  <td align="right"><b><?php print_string("maximumgrade") ?>:</b></td>
+  <td>
+    <?php
+       unset($grades);
+        for ($i=100; $i>=1; $i--) {
+            $grades[$i] = $i;
+        }
+        $grades[0] = get_string("nograde");
+       choose_from_menu ($grades, "quiz_maximumgrade", $CFG->quiz_maximumgrade, "", "", "");
+       helpbutton("maxgrade", get_string("maximumgrade"), "quiz");
+    ?>
+  </td>
+  <td align="center">
+    <input type="hidden" name="quiz_fix_maximumgrade" value="0">
+    <input type="checkbox" name="quiz_fix_maximumgrade" value="1" <?php p($CFG->quiz_fix_maximumgrade ? "checked" : "") ?> />
+  </td>
+</tr>
+
+<tr valign="top">
+  <td align="right"><b><?php print_string("popup", "quiz") ?>:</b></td>
+  <td>
+    <?php
+       unset($options);
+       $options[0] = get_string("no");
+       $options[1] = get_string("yes");
+       choose_from_menu ($options, "quiz_popup", $CFG->quiz_popup, "", "", "");
+       helpbutton("popup", get_string("popup","quiz"), "quiz");
+    ?>
+  </td>
+  <td align="center">
+    <input type="hidden" name="quiz_fix_popup" value="0">
+    <input type="checkbox" name="quiz_fix_popup" value="1" <?php p($CFG->quiz_fix_popup ? "checked" : "") ?> />
+  </td>
+</tr>
+
+<tr valign="top">
+  <td align="right"><b><?php print_string("requirepassword", "quiz") ?>:</b></td>
+  <td>
+    <input type="text" name="quiz_password" size="20" value="<?php p($CFG->quiz_password) ?>" />
+    <?php helpbutton("requirepassword", get_string("requirepassword", "quiz"), "quiz"); ?>
+  </td>
+  <td align="center">
+    <input type="hidden" name="quiz_fix_password" value="0">
+    <input type="checkbox" name="quiz_fix_password" value="1" <?php p($CFG->quiz_fix_password ? "checked" : "") ?> />
+  </td>
+</tr>
+
+<tr valign="top">
+  <td align="right"><b><?php print_string("requiresubnet", "quiz") ?>:</b></td>
+  <td>
+    <input type="text" name="quiz_subnet" size="20" value="<?php p($CFG->quiz_subnet) ?>" />
+    <?php helpbutton("requiresubnet", get_string("requiresubnet", "quiz"), "quiz"); ?>
+  </td>
+  <td align="center">
+    <input type="hidden" name="quiz_fix_subnet" value="0">
+    <input type="checkbox" name="quiz_fix_subnet" value="1" <?php p($CFG->quiz_fix_subnet ? "checked" : "") ?> />
+  </td>
+</tr>
+
+<tr>
+  <td colspan="3" align="center">
+    <input type="submit" value="<?php print_string("savechanges") ?>" />
+  </td>
+</tr>
+</table>
+
+</form>
diff --git a/mod/quiz/defaults.php b/mod/quiz/defaults.php
new file mode 100644 (file)
index 0000000..8adf770
--- /dev/null
@@ -0,0 +1,36 @@
+<?php // $Id$
+
+// This file is generally only included from upgrade_activity_modules()
+// It defines default values for any important configuration variables
+
+   $defaults = array (
+       'quiz_allowreview' => 0,
+       'quiz_attemptonlast' => 0,
+       'quiz_attempts' => 0,
+       'quiz_grademethod' => '',
+       'quiz_maximumgrade' => 0,
+       'quiz_password' => '',
+       'quiz_popup' => 0,
+       'quiz_showanswer' => '',
+       'quiz_showfeedback' => '',
+       'quiz_shuffleanswers' => 1,
+       'quiz_shufflequestions' => 0,
+       'quiz_subnet' => '',
+       'quiz_timelimit' => 0,
+       
+       'quiz_fix_allowreview' => 0,
+       'quiz_fix_attemptonlast' => 0,
+       'quiz_fix_attempts' => 0,
+       'quiz_fix_grademethod' => 0,
+       'quiz_fix_maximumgrade' => 0,
+       'quiz_fix_password' => 0,
+       'quiz_fix_popup' => 0,
+       'quiz_fix_showanswer' => 0,
+       'quiz_fix_showfeedback' => 0,
+       'quiz_fix_shuffleanswers' => 0,
+       'quiz_fix_shufflequestions' => 0,
+       'quiz_fix_subnet' => 0,
+       'quiz_fix_timelimit' => 0
+    );
+
+?>
index ebb5496191ae4a1b40c23bc636a636fe1b7a0814..e194679113c824ed8d24f2025144276823e1ffc5 100644 (file)
         $form->timeclose = "";
     }
     if (!isset($form->attempts)) {
-        $form->attempts = 0;
+        $form->attempts = $CFG->quiz_attempts;
     }
     if (!isset($form->attemptonlast)) {
-        $form->attemptonlast = 0;
+        $form->attemptonlast = $CFG->quiz_attemptonlast;
     }
     if (!isset($form->grademethod)) {
-        $form->grademethod = "";
+        $form->grademethod = $CFG->quiz_grademethod;
     }
     if (!isset($form->feedback)) {
-        $form->feedback = "";
+        $form->feedback = $CFG->quiz_showfeedback;
     }
     if (!isset($form->correctanswers)) {
-        $form->correctanswers = "";
+        $form->correctanswers = $CFG->quiz_showanswer;
     }
     if (!isset($form->review)) {
-        $form->review = 0;
+        $form->review = $CFG->quiz_allowreview;
     }
     if (!isset($form->shufflequestions)) {
-        $form->shufflequestions = 0;
+        $form->shufflequestions = $CFG->quiz_shufflequestions;
     }
     if (!isset($form->shuffleanswers)) {
-        $form->shuffleanswers = 1;
+        $form->shuffleanswers = $CFG->quiz_shuffleanswers;
     }
     if (!isset($form->grade)) {
-        $form->grade = 0;
+        $form->grade = $CFG->quiz_maximumgrade;
     }
     if (!isset($form->questions)) {
         $form->questions = "";
     }
     if (!isset($form->password)) {
-        $form->password = "";
+        $form->password = $CFG->quiz_password;
     }
     if (!isset($form->subnet)) {
-        $form->subnet = "";
+        $form->subnet = $CFG->quiz_subnet;
     }
     if (!isset($form->timelimit)) {
-        $form->timelimit = 0;
+        $form->timelimit = $CFG->quiz_timelimit;
     }
     if (!isset($form->popup)) {
-        $form->popup = 0;
+        $form->popup = $CFG->quiz_popup;
     }
 ?>
 
 
-
 <form name="form" method="post" action="../mod/quiz/edit.php">
 <center>
 <table cellpadding="5">
+
 <tr valign="top">
     <td align="right"><b><?php print_string("name") ?>:</b></td>
     <td>
         <input type="text" name="name" size="40" value="<?php p($form->name) ?>" />
     </td>
 </tr>
+
 <tr valign="top">
     <td align="right"><b><?php print_string("introduction", "quiz") ?>:</b>
       <br />
@@ -94,6 +95,7 @@
         ?>
     </td>
 </tr>
+
 <tr valign="top">
     <td align="right"><b><?php print_string("quizopen", "quiz") ?>:</b></td>
     <td>
      ?>
     </td>
 </tr>
+
 <tr valign="top">
     <td align="right"><b><?php print_string("quizclose", "quiz") ?>:</b></td>
     <td>
      ?>
     </td>
 </tr>
-<tr valign="top">
-    <td align="right"><b><?php print_string("timelimit", "quiz") ?>:</b></td>
-    <td>
-    <?php
-        print_timer_selector($form->timelimit, get_string("minutes","quiz"));
-        helpbutton("timelimit", get_string("quiztimer","quiz"), "quiz");
-    ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php print_string("shufflequestions", "quiz") ?>:</b></td>
-    <td>
-    <?php
-        $options = array();
-        $options[0] = get_string("no");
-        $options[1] = get_string("yes");
-        choose_from_menu($options, "shufflequestions", "$form->shufflequestions", "");
-        helpbutton("shufflequestions", get_string("shufflequestions","quiz"), "quiz");
-     ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php print_string("shuffleanswers", "quiz") ?>:</b></td>
-    <td>
-    <?php
-        $options = array();
-        $options[0] = get_string("no");
-        $options[1] = get_string("yes");
-        choose_from_menu($options, "shuffleanswers", "$form->shuffleanswers", "");
-        helpbutton("shuffleanswers", get_string("shuffleanswers","quiz"), "quiz");
-     ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php print_string("attemptsallowed", "quiz") ?>:</b></td>
-    <td>
-    <?php
-        $options = array();
-        $options[0] = get_string("attemptsunlimited", "quiz");
-        $options[1] = "1 ".strtolower(get_string("attempt", "quiz"));
-        for ($i=2;$i<=6;$i++) {
-            $options[$i] = "$i ".strtolower(get_string("attempts", "quiz"));
-        }
-        choose_from_menu($options, "attempts", "$form->attempts", "");
-        helpbutton("attempts", get_string("attemptsallowed","quiz"), "quiz");
-     ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php print_string("eachattemptbuildsonthelast", "quiz") ?>:</b></td>
-    <td>
-    <?php
-        $options = array();
-        $options[0] = get_string("no");
-        $options[1] = get_string("yes");
-        choose_from_menu($options, "attemptonlast",
-                         "$form->attemptonlast", "");
-        helpbutton("repeatattempts",
-                   get_string("eachattemptbuildsonthelast", "quiz"),
-                   "quiz");
-    ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php print_string("grademethod", "quiz") ?>:</b></td>
-    <td>
-    <?php
-        $options = array();
-        $options[1] = get_string("gradehighest", "quiz");
-        $options[2] = get_string("gradeaverage", "quiz");
-        $options[3] = get_string("attemptfirst", "quiz");
-        $options[4] = get_string("attemptlast", "quiz");
-        choose_from_menu($QUIZ_GRADE_METHOD, "grademethod", "$form->grademethod", "");
-        helpbutton("grademethod", get_string("grademethod","quiz"), "quiz");
-     ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php print_string("showfeedback", "quiz") ?>:</b></td>
-    <td>
-    <?php
-        $options = array();
-        $options[0] = get_string("no");
-        $options[1] = get_string("yes");
-        choose_from_menu($options, "feedback", "$form->feedback", "");
-        helpbutton("feedback", get_string("showfeedback","quiz"), "quiz");
-     ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php print_string("showcorrectanswer", "quiz") ?>:</b></td>
-    <td>
-    <?php
-        $options = array();
-        $options[0] = get_string("no");
-        $options[1] = get_string("yes");
-        choose_from_menu($options, "correctanswers", "$form->correctanswers", "");
-        helpbutton("correctanswers", get_string("showcorrectanswer","quiz"), "quiz");
-     ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php print_string("allowreview", "quiz") ?>:</b></td>
-    <td>
-    <?php
-        $options = array();
-        $options[0] = get_string("no");
-        $options[1] = get_string("yes");
-        choose_from_menu($options, "review", "$form->review", "");
-        helpbutton("review", get_string("allowreview","quiz"), "quiz");
-     ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php print_string("maximumgrade") ?>:</b></td>
-    <td>
-    <?php
-        for ($i=100; $i>=1; $i--) {
-            $grades[$i] = $i;
-        }
-        $grades[0] = get_string("nograde");
 
-        choose_from_menu($grades, "grade", "$form->grade", "");
-        helpbutton("maxgrade", get_string("maximumgrade"), "quiz");
-     ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php print_string("popup", "quiz") ?>:</b></td>
-    <td>
-    <?php
-        $options = array();
-        $options[0] = get_string("no");
-        $options[1] = get_string("yes");
-        choose_from_menu($options, "popup", "$form->popup", "");
-        helpbutton("popup", get_string("popup","quiz"), "quiz");
-     ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php print_string("requirepassword", "quiz") ?>:</b></td>
-    <td>
-        <input type="text" name="password" size="40" value="<?php p($form->password) ?>" />
-        <?php helpbutton("requirepassword", get_string("requirepassword", "quiz"), "quiz"); ?>
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><b><?php print_string("requiresubnet", "quiz") ?>:</b></td>
-    <td>
-        <input type="text" name="subnet" size="40" value="<?php p($form->subnet) ?>" />
-        <?php helpbutton("requiresubnet", get_string("requiresubnet", "quiz"), "quiz"); ?>
-    </td>
-</tr>
+<?php if ($CFG->quiz_fix_timelimit) { ?>
+    <input type="hidden" name="timelimit" value="<?php p($form->timelimit) ?>">
+<?php } else { ?>
+    <tr valign="top">
+        <td align="right"><b><?php print_string("timelimit", "quiz") ?>:</b></td>
+        <td>
+        <?php
+            print_timer_selector($form->timelimit, get_string("minutes","quiz"));
+            helpbutton("timelimit", get_string("quiztimer","quiz"), "quiz");
+        ?>
+        </td>
+    </tr>
+<?php } ?>
+
+<?php if ($CFG->quiz_fix_shufflequestions) { ?>
+    <input type="hidden" name="shufflequestions" value="<?php p($form->shufflequestions) ?>">
+<?php } else { ?>
+    <tr valign="top">
+        <td align="right"><b><?php print_string("shufflequestions", "quiz") ?>:</b></td>
+        <td>
+        <?php
+            $options = array();
+            $options[0] = get_string("no");
+            $options[1] = get_string("yes");
+            choose_from_menu($options, "shufflequestions", "$form->shufflequestions", "");
+            helpbutton("shufflequestions", get_string("shufflequestions","quiz"), "quiz");
+         ?>
+        </td>
+    </tr>
+<?php } ?>
+
+<?php if ($CFG->quiz_fix_shuffleanswers) { ?>
+    <input type="hidden" name="shuffleanswers" value="<?php p($form->shuffleanswers) ?>">
+<?php } else { ?>
+    <tr valign="top">
+        <td align="right"><b><?php print_string("shuffleanswers", "quiz") ?>:</b></td>
+        <td>
+        <?php
+            $options = array();
+            $options[0] = get_string("no");
+            $options[1] = get_string("yes");
+            choose_from_menu($options, "shuffleanswers", "$form->shuffleanswers", "");
+            helpbutton("shuffleanswers", get_string("shuffleanswers","quiz"), "quiz");
+         ?>
+        </td>
+    </tr>
+<?php } ?>
+
+<?php if ($CFG->quiz_fix_attempts) { ?>
+    <input type="hidden" name="attempts" value="<?php p($form->attempts) ?>">
+<?php } else { ?>
+    <tr valign="top">
+        <td align="right"><b><?php print_string("attemptsallowed", "quiz") ?>:</b></td>
+        <td>
+        <?php
+            $options = array();
+            $options[0] = get_string("attemptsunlimited", "quiz");
+            $options[1] = "1 ".strtolower(get_string("attempt", "quiz"));
+            for ($i=2;$i<=6;$i++) {
+                $options[$i] = "$i ".strtolower(get_string("attempts", "quiz"));
+            }
+            choose_from_menu($options, "attempts", "$form->attempts", "");
+            helpbutton("attempts", get_string("attemptsallowed","quiz"), "quiz");
+         ?>
+        </td>
+    </tr>
+<?php } ?>
+
+<?php if ($CFG->quiz_fix_attemptonlast) { ?>
+    <input type="hidden" name="attemptonlast" value="<?php p($form->attemptonlast) ?>">
+<?php } else { ?>
+    <tr valign="top">
+        <td align="right"><b><?php print_string("eachattemptbuildsonthelast", "quiz") ?>:</b></td>
+        <td>
+        <?php
+            $options = array();
+            $options[0] = get_string("no");
+            $options[1] = get_string("yes");
+            choose_from_menu($options, "attemptonlast",
+                             "$form->attemptonlast", "");
+            helpbutton("repeatattempts",
+                       get_string("eachattemptbuildsonthelast", "quiz"),
+                       "quiz");
+        ?>
+        </td>
+    </tr>
+<?php } ?>
+
+<?php if ($CFG->quiz_fix_grademethod) { ?>
+    <input type="hidden" name="grademethod" value="<?php p($form->grademethod) ?>">
+<?php } else { ?>
+    <tr valign="top">
+        <td align="right"><b><?php print_string("grademethod", "quiz") ?>:</b></td>
+        <td>
+        <?php
+            $options = array();
+            $options[1] = get_string("gradehighest", "quiz");
+            $options[2] = get_string("gradeaverage", "quiz");
+            $options[3] = get_string("attemptfirst", "quiz");
+            $options[4] = get_string("attemptlast", "quiz");
+            choose_from_menu($QUIZ_GRADE_METHOD, "grademethod", "$form->grademethod", "");
+            helpbutton("grademethod", get_string("grademethod","quiz"), "quiz");
+         ?>
+        </td>
+    </tr>
+<?php } ?>
+
+<?php if ($CFG->quiz_fix_showfeedback) { ?>
+    <input type="hidden" name="feedback" value="<?php p($form->feedback) ?>">
+<?php } else { ?>
+    <tr valign="top">
+        <td align="right"><b><?php print_string("showfeedback", "quiz") ?>:</b></td>
+        <td>
+        <?php
+            $options = array();
+            $options[0] = get_string("no");
+            $options[1] = get_string("yes");
+            choose_from_menu($options, "feedback", "$form->feedback", "");
+            helpbutton("feedback", get_string("showfeedback","quiz"), "quiz");
+         ?>
+        </td>
+    </tr>
+<?php } ?>
+
+<?php if ($CFG->quiz_fix_showanswer) { ?>
+    <input type="hidden" name="correctanswers" value="<?php p($form->correctanswers) ?>">
+<?php } else { ?>
+    <tr valign="top">
+        <td align="right"><b><?php print_string("showcorrectanswer", "quiz") ?>:</b></td>
+        <td>
+        <?php
+            $options = array();
+            $options[0] = get_string("no");
+            $options[1] = get_string("yes");
+            choose_from_menu($options, "correctanswers", "$form->correctanswers", "");
+            helpbutton("correctanswers", get_string("showcorrectanswer","quiz"), "quiz");
+         ?>
+        </td>
+    </tr>
+<?php } ?>
+
+<?php if ($CFG->quiz_fix_allowreview) { ?>
+    <input type="hidden" name="review" value="<?php p($form->review) ?>">
+<?php } else { ?>
+    <tr valign="top">
+        <td align="right"><b><?php print_string("allowreview", "quiz") ?>:</b></td>
+        <td>
+        <?php
+            $options = array();
+            $options[0] = get_string("no");
+            $options[1] = get_string("yes");
+            choose_from_menu($options, "review", "$form->review", "");
+            helpbutton("review", get_string("allowreview","quiz"), "quiz");
+         ?>
+        </td>
+    </tr>
+<?php } ?>
+
+<?php if ($CFG->quiz_fix_maximumgrade) { ?>
+    <input type="hidden" name="grade" value="<?php p($form->grade) ?>">
+<?php } else { ?>
+    <tr valign="top">
+        <td align="right"><b><?php print_string("maximumgrade") ?>:</b></td>
+        <td>
+        <?php
+            for ($i=100; $i>=1; $i--) {
+                $grades[$i] = $i;
+            }
+            $grades[0] = get_string("nograde");
+    
+            choose_from_menu($grades, "grade", "$form->grade", "");
+            helpbutton("maxgrade", get_string("maximumgrade"), "quiz");
+         ?>
+        </td>
+    </tr>
+<?php } ?>
+
+<?php if ($CFG->quiz_fix_popup) { ?>
+    <input type="hidden" name="popup" value="<?php p($form->popup) ?>">
+<?php } else { ?>
+    <tr valign="top">
+        <td align="right"><b><?php print_string("popup", "quiz") ?>:</b></td>
+        <td>
+        <?php
+            $options = array();
+            $options[0] = get_string("no");
+            $options[1] = get_string("yes");
+            choose_from_menu($options, "popup", "$form->popup", "");
+            helpbutton("popup", get_string("popup","quiz"), "quiz");
+         ?>
+        </td>
+    </tr>
+<?php } ?>
+
+<?php if ($CFG->quiz_fix_password) { ?>
+    <input type="hidden" name="password" value="<?php p($form->password) ?>">
+<?php } else { ?>
+    <tr valign="top">
+        <td align="right"><b><?php print_string("requirepassword", "quiz") ?>:</b></td>
+        <td>
+            <input type="text" name="password" size="40" value="<?php p($form->password) ?>" />
+            <?php helpbutton("requirepassword", get_string("requirepassword", "quiz"), "quiz"); ?>
+        </td>
+    </tr>
+<?php } ?>
+
+<?php if ($CFG->quiz_fix_subnet) { ?>
+    <input type="hidden" name="subnet" value="<?php p($form->subnet) ?>">
+<?php } else { ?>
+    <tr valign="top">
+        <td align="right"><b><?php print_string("requiresubnet", "quiz") ?>:</b></td>
+        <td>
+            <input type="text" name="subnet" size="40" value="<?php p($form->subnet) ?>" />
+            <?php helpbutton("requiresubnet", get_string("requiresubnet", "quiz"), "quiz"); ?>
+        </td>
+    </tr>
+<?php } ?>
     
 </table>
 <input type="hidden" name="questions"     value="<?php p($form->questions) ?>" />