Removed the restriction that the quiz timelimit has to be less than the session timeout

This commit is contained in:
gustav_delius 2005-08-26 18:47:24 +00:00
parent 9235fb7977
commit c0bbeb675a
3 changed files with 35 additions and 24 deletions

View File

@ -60,6 +60,11 @@
}
?>
<script type="text/javascript" language="javascript">
var timelimititems = ['timelimit'];
</script>
<form method="post" action="module.php" name="form">
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
@ -94,13 +99,16 @@
</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"), 'timelimit');
helpbutton("timelimit", get_string("quiztimer","quiz"), "quiz");
?>
</td>
<td align="right"><b><?php print_string("timelimit", "quiz") ?>:</b></td>
<td>
<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"' ?> />
<input type="text" name="timelimit" size="3" value="<?php p($form->timelimit ? $form->timelimit : '') ?>" />
<?php
print_string('minutes');
helpbutton("timelimit", get_string("quiztimer","quiz"), "quiz");
?>
<input type="hidden" name="htimelimit" value="0" />
</td>
<td align="center">
<input type="hidden" name="fix_timelimit" value="0" />
<input type="checkbox" name="fix_timelimit" value="1" <?php p($CFG->quiz_fix_timelimit ? "checked" : "") ?> />
@ -403,3 +411,8 @@
</form>
<script type="text/javascript">
<?php
if (!$form->timelimit) echo "lockoptions('form','timelimitenable', timelimititems);";
?>
</script>

View File

@ -43,11 +43,6 @@ function quiz_add_instance($quiz) {
$quiz->availableminute);
}
// The following similarly implements the time limit check box
if (empty($quiz->timelimitenable) or $quiz->timelimit < 1) {
$quiz->timelimit = 0;
}
if (empty($quiz->name)) {
if (empty($quiz->intro)) {
$quiz->name = get_string('modulename', 'quiz');
@ -138,11 +133,6 @@ function quiz_update_instance($quiz) {
$quiz->availableminute);
}
// The following similarly implements the time limit check box
if (empty($quiz->timelimitenable) or $quiz->timelimit < 1) {
$quiz->timelimit = 0;
}
$quiz->id = $quiz->instance;
if (!update_record("quiz", $quiz)) {
@ -760,6 +750,11 @@ function quiz_process_options(&$form) {
$form->review = $review;
$form->optionflags = $optionflags;
// The following implements the time limit check box
if (empty($form->timelimitenable) or $form->timelimit < 1) {
$form->timelimit = 0;
}
}

View File

@ -164,7 +164,7 @@
<td align="right"><b><?php print_string("timelimit", "quiz") ?>:</b></td>
<td align="left">
<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"' ?> />
<input type="text" name="timelimit" size="3" value="<?php p($form->timelimit) ?>" />
<input type="text" name="timelimit" size="3" value="<?php p($form->timelimit ? $form->timelimit : '') ?>" />
<?php
print_string('minutes');
helpbutton("timelimit", get_string("quiztimer","quiz"), "quiz");
@ -392,11 +392,14 @@
<?php if ($CFG->quiz_fix_timelimit) { ?>
<tr valign="top">
<td align="right"><b><?php print_string("timelimit", "quiz") ?>:</b></td>
<td align="left">
<?php
print_timer_selector($form->timelimit, get_string("minutes","quiz"));
helpbutton("timelimit", get_string("quiztimer","quiz"), "quiz");
?>
<td align="left">
<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"' ?> />
<input type="text" name="timelimit" size="3" value="<?php p($form->timelimit ? $form->timelimit : '') ?>" />
<?php
print_string('minutes');
helpbutton("timelimit", get_string("quiztimer","quiz"), "quiz");
?>
<input type="hidden" name="htimelimit" value="0" />
</td>
</tr>
<?php } ?>
@ -598,4 +601,4 @@
if (!$form->timeopen) echo "lockoptions('form','availableenable', availableitems);";
if (!$form->timelimit) echo "lockoptions('form','timelimitenable', timelimititems);";
?>
</script
</script>