2 require_once($CFG->dirroot
. '/mod/quiz/locallib.php');
4 if (!isset($form->timeopen
)) {
7 if (!isset($form->timeclose
)) {
10 if (!isset($form->attempts
)) {
11 $form->attempts
= $CFG->quiz_attempts
;
13 if (!isset($form->attemptonlast
)) {
14 $form->attemptonlast
= $CFG->quiz_attemptonlast
;
16 if (!isset($form->grademethod
)) {
17 $form->grademethod
= $CFG->quiz_grademethod
;
19 if (!isset($form->decimalpoints
)) {
20 $form->decimalpoints
= $CFG->quiz_decimalpoints
;
22 if (!isset($form->review
)) {
23 $form->review
= $CFG->quiz_review
;
25 if (!isset($form->questionsperpage
)) {
26 $form->questionsperpage
= $CFG->quiz_questionsperpage
;
28 if (!isset($form->shufflequestions
)) {
29 $form->shufflequestions
= $CFG->quiz_shufflequestions
;
31 if (!isset($form->shuffleanswers
)) {
32 $form->shuffleanswers
= $CFG->quiz_shuffleanswers
;
34 if (!isset($form->grade
)) {
35 $form->grade
= $CFG->quiz_maximumgrade
;
37 if (!isset($form->questions
)) {
38 $form->questions
= "";
40 if (!isset($form->password
)) {
41 $form->password
= $CFG->quiz_password
;
43 if (!isset($form->subnet
)) {
44 $form->subnet
= $CFG->quiz_subnet
;
46 if (!isset($form->timelimit
)) {
47 $form->timelimit
= $CFG->quiz_timelimit
;
49 if (!isset($form->popup
)) {
50 $form->popup
= $CFG->quiz_popup
;
52 if (!isset($form->optionflags
)) {
53 $form->optionflags
= $CFG->quiz_optionflags
;
55 if (!isset($form->penaltyscheme
)) {
56 $form->penaltyscheme
= $CFG->quiz_penaltyscheme
;
58 if (!isset($form->maximumgrade
)) {
59 $form->maximumgrade
= $CFG->quiz_maximumgrade
;
61 //enforced delay attempt between quiz
62 if (!isset($form->delay1
)) {
63 $form->delay1
= $CFG->quiz_delay1
;
65 if (!isset($form->delay2
)) {
66 $form->delay2
= $CFG->quiz_delay2
;
68 //enforced time delay between quiz attempts add-on
69 $timedelayoptions = array();
70 $timedelayoptions[0] = get_string('none');
71 $timedelayoptions[1800] = get_string('numminutes', '', 30);
72 $timedelayoptions[3600] = get_string('numminutes', '', 60);
73 for($i=2; $i<=23; $i++
) {
75 $timedelayoptions[$seconds] = get_string('numhours', '', $i);
77 $timedelayoptions[86400] = get_string('numhours', '', 24);
78 for($i=2; $i<=7; $i++
) {
80 $timedelayoptions[$seconds] = get_string('numdays', '', $i);
84 <script type=
"text/javascript">
86 var timelimititems
= ['timelimit'];
90 <form method=
"post" action=
"module.php" id=
"form">
92 <input type=
"hidden" name=
"sesskey" value=
"<?php echo $USER->sesskey ?>" />
94 <!-- Table of
default values
-->
97 // the following are used for drop-down menus
99 $yesnooptions = array();
100 $yesnooptions[0] = get_string("no");
101 $yesnooptions[1] = get_string("yes");
103 $attemptoptions = array();
104 $attemptoptions[0] = get_string("attemptsunlimited", "quiz");
105 $attemptoptions[1] = "1 ".moodle_strtolower(get_string("attempt", "quiz"));
106 for ($i=2;$i<=6;$i++
) {
107 $attemptoptions[$i] = "$i ".moodle_strtolower(get_string("attempts", "quiz"));
112 <table cellpadding=
"9" cellspacing=
"0">
115 <th align=
"right" scope=
"col"> </th>
116 <th align=
"left" scope=
"col">
117 <?php print_string('sitedefault'); ?>
119 <th align=
"center" scope=
"col">
120 <?php print_string('advancedsettings'); helpbutton("advancedsettings"); ?>
125 <td align=
"right"><b><?php print_string("timelimit", "quiz") ?>:
</b></td>
127 <input name=
"timelimitenable" type=
"checkbox" value=
"1" alt=
"<?php print_string('timelimit', 'quiz') ?>" onclick
="return lockoptions('form', 'timelimitenable', timelimititems)" <?php
if ($form->timelimit
) echo 'checked="checked"' ?> />
128 <input type=
"text" name=
"timelimit" size=
"3" value=
"<?php p($form->timelimit ? $form->timelimit : '') ?>" />
130 print_string('minutes');
131 helpbutton("timelimit", get_string("quiztimer","quiz"), "quiz");
133 <input type=
"hidden" name=
"htimelimit" value=
"0" />
136 <input type=
"hidden" name=
"fix_timelimit" value=
"0" />
137 <input type=
"checkbox" name=
"fix_timelimit" value=
"1" <?php echo $CFG->quiz_fix_timelimit ?
'checked="checked"' : ''; ?> />
142 <td align=
"right"><b><?php print_string('questionsperpage', 'quiz') ?>:
</b></td>
146 for ($i=0; $i<=50; ++
$i) {
149 $perpage[0] = get_string('allinone', 'quiz');
151 choose_from_menu($perpage, 'questionsperpage', $form->questionsperpage
, '');
152 helpbutton('questionsperpage', get_string('questionsperpage'), 'quiz');
156 <input type=
"hidden" name=
"fix_questionsperpage" value=
"0" />
157 <input type=
"checkbox" name=
"fix_questionsperpage" value=
"1" <?php echo $CFG->quiz_fix_questionsperpage ?
'checked="checked"' : ''; ?> />
162 <td align=
"right"><b><?php print_string("shufflequestions", "quiz") ?>:
</b></td>
165 choose_from_menu ($yesnooptions, "shufflequestions", $form->shufflequestions
, "", "", "");
166 helpbutton("shufflequestions", get_string("shufflequestions","quiz"), "quiz");
170 <input type=
"hidden" name=
"fix_shufflequestions" value=
"0" />
171 <input type=
"checkbox" name=
"fix_shufflequestions" value=
"1" <?php echo $CFG->quiz_fix_shufflequestions ?
'checked="checked"' : ''; ?> />
176 <td align=
"right"><b><?php print_string("shufflewithin", "quiz") ?>:
</b></td>
179 choose_from_menu ($yesnooptions, "shuffleanswers", $form->shuffleanswers
, "", "", "");
180 helpbutton("shufflewithin", get_string("shufflewithin","quiz"), "quiz");
184 <input type=
"hidden" name=
"fix_shuffleanswers" value=
"0" />
185 <input type=
"checkbox" name=
"fix_shuffleanswers" value=
"1" <?php echo $CFG->quiz_fix_shuffleanswers ?
'checked="checked"' : ''; ?> />
190 <td align=
"right"><b><?php print_string("attemptsallowed", "quiz") ?>:
</b></td>
194 $options[0] = get_string("attemptsunlimited", "quiz");
195 $options[1] = "1 ".strtolower(get_string("attempt", "quiz"));
196 for ($i=2;$i<=6;$i++
) {
197 $options[$i] = "$i ".strtolower(get_string("attempts", "quiz"));
199 choose_from_menu ($options, "attempts", $form->attempts
, "", "", "");
200 helpbutton("attempts", get_string("attemptsallowed","quiz"), "quiz");
204 <input type=
"hidden" name=
"fix_attempts" value=
"0" />
205 <input type=
"checkbox" name=
"fix_attempts" value=
"1" <?php echo $CFG->quiz_fix_attempts ?
'checked="checked"' : ''; ?> />
210 <td align=
"right"><b><?php print_string("eachattemptbuildsonthelast", "quiz") ?>:
</b></td>
213 choose_from_menu ($yesnooptions, "attemptonlast", $form->attemptonlast
, "", "", "");
214 helpbutton("repeatattempts", get_string("eachattemptbuildsonthelast", "quiz"), "quiz");
218 <input type=
"hidden" name=
"fix_attemptonlast" value=
"0" />
219 <input type=
"checkbox" name=
"fix_attemptonlast" value=
"1" <?php echo $CFG->quiz_fix_attemptonlast ?
'checked="checked"' : ''; ?> />
224 <td align=
"right"><b><?php print_string("grademethod", "quiz") ?>:
</b></td>
227 choose_from_menu ($QUIZ_GRADE_METHOD, "grademethod", $form->grademethod
, "", "", "");
228 helpbutton("grademethod", get_string("grademethod","quiz"), "quiz");
232 <input type=
"hidden" name=
"fix_grademethod" value=
"0" />
233 <input type=
"checkbox" name=
"fix_grademethod" value=
"1" <?php echo $CFG->quiz_fix_grademethod ?
'checked="checked"' : ''; ?> />
238 <td align=
"right"><b><?php print_string("adaptive", "quiz") ?>:
</b></td>
241 choose_from_menu($yesnooptions, "adaptive", ($CFG->quiz_optionflags
& QUESTION_ADAPTIVE
) ?
1 : 0, "");
242 helpbutton("adaptive", get_string("adaptive","quiz"), "quiz");
246 <input type=
"hidden" name=
"fix_adaptive" value=
"0" />
247 <input type=
"checkbox" name=
"fix_adaptive" value=
"1" <?php echo $CFG->quiz_fix_adaptive ?
'checked="checked"' : ''; ?> />
252 <td align=
"right"><b><?php print_string("penaltyscheme", "quiz") ?>:
</b></td>
255 choose_from_menu($yesnooptions, "penaltyscheme", "$form->penaltyscheme", "");
256 helpbutton("penaltyscheme", get_string("penaltyscheme","quiz"), "quiz");
260 <input type=
"hidden" name=
"fix_penaltyscheme" value=
"0" />
261 <input type=
"checkbox" name=
"fix_penaltyscheme" value=
"1" <?php echo $CFG->quiz_fix_penaltyscheme ?
'checked="checked"' : ''; ?> />
266 <td align=
"right"><b><?php print_string("decimaldigits", "quiz") ?>:
</b></td>
274 choose_from_menu ($options, "decimalpoints", $form->decimalpoints
, "", "", "");
275 helpbutton("decimalpoints", get_string("decimaldigits","quiz"), "quiz");
279 <input type=
"hidden" name=
"fix_decimalpoints" value=
"0" />
280 <input type=
"checkbox" name=
"fix_decimalpoints" value=
"1" <?php echo $CFG->quiz_fix_decimalpoints ?
'checked="checked"' : ''; ?> />
286 <?php include($CFG->dirroot
. '/mod/quiz/reviewoptions.html'); ?>
288 <input type=
"hidden" name=
"fix_review" value=
"0" />
289 <input type=
"checkbox" name=
"fix_review" value=
"1" <?php echo $CFG->quiz_fix_review ?
'checked="checked"' : ''; ?> />
294 <td align=
"right"><b><?php print_string("popup", "quiz") ?>:
</b></td>
297 choose_from_menu ($yesnooptions, "popup", $form->popup
, "", "", "");
298 helpbutton("popup", get_string("popup","quiz"), "quiz");
302 <input type=
"hidden" name=
"fix_popup" value=
"0" />
303 <input type=
"checkbox" name=
"fix_popup" value=
"1" <?php echo $CFG->quiz_fix_popup ?
'checked="checked"' : ''; ?> />
308 <td align=
"right"><b><?php print_string('delay1', 'quiz') ?>:
</b></td>
311 choose_from_menu($timedelayoptions, 'delay1', $form->delay1
, "", "", "" );
312 helpbutton('timedelay1', get_string('delay1','quiz'), 'quiz');
316 <input type=
"hidden" name=
"fix_delay1" value=
"0" />
317 <input type=
"checkbox" name=
"fix_delay1" value=
"1" <?php echo $CFG->quiz_fix_delay1 ?
'checked="checked"' : ''; ?> />
322 <td align=
"right"><b><?php print_string('delay2', 'quiz') ?>:
</b></td>
325 choose_from_menu($timedelayoptions, 'delay2', $form->delay2
, "", "", "");
326 helpbutton('timedelay2', get_string('delay2','quiz'), 'quiz');
330 <input type=
"hidden" name=
"fix_delay2" value=
"0" />
331 <input type=
"checkbox" name=
"fix_delay2" value=
"1" <?php echo $CFG->quiz_fix_delay2 ?
'checked="checked"' : ''; ?> />
336 <td align=
"right"><b><?php print_string("requirepassword", "quiz") ?>:
</b></td>
338 <input type=
"text" name=
"password" size=
"20" value=
"<?php p($form->password) ?>" />
339 <?php
helpbutton("requirepassword", get_string("requirepassword", "quiz"), "quiz"); ?>
342 <input type=
"hidden" name=
"fix_password" value=
"0" />
343 <input type=
"checkbox" name=
"fix_password" value=
"1" <?php echo $CFG->quiz_fix_password ?
'checked="checked"' : ''; ?> />
348 <td align=
"right"><b><?php print_string("requiresubnet", "quiz") ?>:
</b></td>
350 <input type=
"text" name=
"subnet" size=
"20" value=
"<?php p($form->subnet) ?>" />
351 <?php
helpbutton("requiresubnet", get_string("requiresubnet", "quiz"), "quiz"); ?>
354 <input type=
"hidden" name=
"fix_subnet" value=
"0" />
355 <input type=
"checkbox" name=
"fix_subnet" value=
"1" <?php echo $CFG->quiz_fix_subnet ?
'checked="checked"' : ''; ?> />
361 <td align=
"right"><b><?php print_string("maximumgrade") ?>:
</b></td>
365 for ($i=100; $i>=1; $i--) {
368 $grades[0] = get_string("nograde");
369 choose_from_menu ($grades, "maximumgrade", $form->maximumgrade
, "", "", "");
370 helpbutton("maxgrade", get_string("maximumgrade"), "quiz");
373 <!-- Can't hide this setting, it always shows up on edit.php
375 <input type="hidden" name="fix_maximumgrade" value="0" />
376 <input type="checkbox" name="fix_maximumgrade" value="1" <?php echo $CFG->quiz_fix_maximumgrade ? 'checked="checked"' : ''; ?> />
382 <td colspan="3" align="center">
383 <input type="hidden" name="module" value="quiz" />
384 <input type="submit" value="<?php print_string("savechanges") ?>" />
392 <script type="text/javascript">
394 if (!$form->timelimit) echo "lockoptions('form','timelimitenable', timelimititems);";