moodle/mod/quiz/config.html

407 lines
14 KiB
HTML

<?php
require_once($CFG->dirroot . '/mod/quiz/locallib.php');
if (!isset($form->timeopen)) {
$form->timeopen = "";
}
if (!isset($form->timeclose)) {
$form->timeclose = "";
}
if (!isset($form->attempts)) {
$form->attempts = $CFG->quiz_attempts;
}
if (!isset($form->attemptonlast)) {
$form->attemptonlast = $CFG->quiz_attemptonlast;
}
if (!isset($form->grademethod)) {
$form->grademethod = $CFG->quiz_grademethod;
}
if (!isset($form->decimalpoints)) {
$form->decimalpoints = $CFG->quiz_decimalpoints;
}
if (!isset($form->review)) {
$form->review = $CFG->quiz_review;
}
if (!isset($form->questionsperpage)) {
$form->questionsperpage = $CFG->quiz_questionsperpage;
}
if (!isset($form->shufflequestions)) {
$form->shufflequestions = $CFG->quiz_shufflequestions;
}
if (!isset($form->shuffleanswers)) {
$form->shuffleanswers = $CFG->quiz_shuffleanswers;
}
if (!isset($form->grade)) {
$form->grade = $CFG->quiz_maximumgrade;
}
if (!isset($form->questions)) {
$form->questions = "";
}
if (!isset($form->password)) {
$form->password = $CFG->quiz_password;
}
if (!isset($form->subnet)) {
$form->subnet = $CFG->quiz_subnet;
}
if (!isset($form->timelimit)) {
$form->timelimit = $CFG->quiz_timelimit;
}
if (!isset($form->popup)) {
$form->popup = $CFG->quiz_popup;
}
if (!isset($form->optionflags)) {
$form->optionflags = $CFG->quiz_optionflags;
}
if (!isset($form->penaltyscheme)) {
$form->penaltyscheme = $CFG->quiz_penaltyscheme;
}
if (!isset($form->maximumgrade)) {
$form->maximumgrade = $CFG->quiz_maximumgrade;
}
?>
<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 ?>" />
<!-- Table of default values -->
<?php
// the following are used for drop-down menus
$yesnooptions = array();
$yesnooptions[0] = get_string("no");
$yesnooptions[1] = get_string("yes");
$attemptoptions = array();
$attemptoptions[0] = get_string("attemptsunlimited", "quiz");
$attemptoptions[1] = "1 ".strtolower(get_string("attempt", "quiz"));
for ($i=2;$i<=6;$i++) {
$attemptoptions[$i] = "$i ".strtolower(get_string("attempts", "quiz"));
}
?>
<table cellpadding="9" cellspacing="0" align="center">
<tr valign="top">
<th align="right">&nbsp;</th>
<th align="left">
<?php print_string('sitedefault'); ?>
</th>
<th align="center">
<?php print_string('advancedsettings'); helpbutton("advancedsettings"); ?>
</th>
</tr>
<tr valign="top">
<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" : "") ?> />
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string('questionsperpage', 'quiz') ?>:</b></td>
<td>
<?php
$perpage= array();
for ($i=0; $i<=50; ++$i) {
$perpage[$i] = $i;
}
$perpage[0] = get_string('allinone', 'quiz');
choose_from_menu($perpage, 'questionsperpage', $form->questionsperpage, '');
helpbutton('questionsperpage', get_string('questionsperpage'), 'quiz');
?>
</td>
<td align="center">
<input type="hidden" name="fix_questionsperpage" value="0" />
<input type="checkbox" name="fix_questionsperpage" value="1" <?php p($CFG->quiz_fix_questionsperpage ? "checked" : "") ?> />
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("shufflequestions", "quiz") ?>:</b></td>
<td>
<?php
choose_from_menu ($yesnooptions, "shufflequestions", $form->shufflequestions, "", "", "");
helpbutton("shufflequestions", get_string("shufflequestions","quiz"), "quiz");
?>
</td>
<td align="center">
<input type="hidden" name="fix_shufflequestions" value="0" />
<input type="checkbox" name="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
choose_from_menu ($yesnooptions, "shuffleanswers", $form->shuffleanswers, "", "", "");
helpbutton("attempts", get_string("attemptsallowed","quiz"), "quiz");
?>
</td>
<td align="center">
<input type="hidden" name="fix_shuffleanswers" value="0" />
<input type="checkbox" name="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, "attempts", $form->attempts, "", "", "");
helpbutton("attempts", get_string("attemptsallowed","quiz"), "quiz");
?>
</td>
<td align="center">
<input type="hidden" name="fix_attempts" value="0" />
<input type="checkbox" name="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
choose_from_menu ($yesnooptions, "attemptonlast", $form->attemptonlast, "", "", "");
helpbutton("repeatattempts", get_string("eachattemptbuildsonthelast", "quiz"), "quiz");
?>
</td>
<td align="center">
<input type="hidden" name="fix_attemptonlast" value="0" />
<input type="checkbox" name="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, "grademethod", $form->grademethod, "", "", "");
helpbutton("grademethod", get_string("grademethod","quiz"), "quiz");
?>
</td>
<td align="center">
<input type="hidden" name="fix_grademethod" value="0" />
<input type="checkbox" name="fix_grademethod" value="1" <?php p($CFG->quiz_fix_grademethod ? "checked" : "") ?> />
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("adaptive", "quiz") ?>:</b></td>
<td>
<?php
choose_from_menu($yesnooptions, "adaptive", ($CFG->quiz_optionflags & QUIZ_ADAPTIVE) ? 1 : 0, "");
helpbutton("adaptive", get_string("adaptive","quiz"), "quiz");
?>
</td>
<td align="center">
<input type="hidden" name="fix_adaptive" value="0" />
<input type="checkbox" name="fix_adaptive" value="1" <?php p($CFG->quiz_fix_adaptive ? "checked" : "") ?> />
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("penaltyscheme", "quiz") ?>:</b></td>
<td>
<?php
choose_from_menu($yesnooptions, "penaltyscheme", "$form->penaltyscheme", "");
helpbutton("penaltyscheme", get_string("penaltyscheme","quiz"), "quiz");
?>
</td>
<td align="center">
<input type="hidden" name="fix_penaltyscheme" value="0" />
<input type="checkbox" name="fix_penaltyscheme" value="1" <?php p($CFG->quiz_fix_penaltyscheme ? "checked" : "") ?> />
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("decimalpoints", "quiz") ?>:</b></td>
<td>
<?php
unset($options);
$options[0] = '0';
$options[1] = '1';
$options[2] = '2';
$options[3] = '3';
choose_from_menu ($options, "decimalpoints", $form->decimalpoints, "", "", "");
helpbutton("decimalpoints", get_string("decimalpoints","quiz"), "quiz");
?>
</td>
<td align="center">
<input type="hidden" name="fix_decimalpoints" value="0" />
<input type="checkbox" name="fix_decimalpoints" value="1" <?php p($CFG->quiz_fix_decimalpoints ? "checked" : "") ?> />
</td>
</tr>
<tr valign="top">
<?php include($CFG->dirroot . '/mod/quiz/reviewoptions.html'); ?>
<td align="center">
<input type="hidden" name="fix_review" value="0" />
<input type="checkbox" name="fix_review" value="1" <?php p($CFG->quiz_fix_review ? "checked" : "") ?> />
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("popup", "quiz") ?>:</b></td>
<td>
<?php
choose_from_menu ($yesnooptions, "popup", $form->popup, "", "", "");
helpbutton("popup", get_string("popup","quiz"), "quiz");
?>
</td>
<td align="center">
<input type="hidden" name="fix_popup" value="0" />
<input type="checkbox" name="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="password" size="20" value="<?php p($form->password) ?>" />
<?php helpbutton("requirepassword", get_string("requirepassword", "quiz"), "quiz"); ?>
</td>
<td align="center">
<input type="hidden" name="fix_password" value="0" />
<input type="checkbox" name="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="subnet" size="20" value="<?php p($form->subnet) ?>" />
<?php helpbutton("requiresubnet", get_string("requiresubnet", "quiz"), "quiz"); ?>
</td>
<td align="center">
<input type="hidden" name="fix_subnet" value="0" />
<input type="checkbox" name="fix_subnet" value="1" <?php p($CFG->quiz_fix_subnet ? "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, "maximumgrade", $form->maximumgrade, "", "", "");
helpbutton("maxgrade", get_string("maximumgrade"), "quiz");
?>
</td>
<!-- Can't hide this setting, it always shows up on edit.php
<td align="center">
<input type="hidden" name="fix_maximumgrade" value="0" />
<input type="checkbox" name="fix_maximumgrade" value="1" <?php p($CFG->quiz_fix_maximumgrade ? "checked" : "") ?> />
</td>
-->
</tr>
<tr>
<td colspan="3" align="center">
<input type="hidden" name="module" value="quiz" />
<input type="submit" value="<?php print_string("savechanges") ?>" />
</td>
</tr>
<!-- Table of config options -->
<?php
$table_created = false; // used to make sure that table is only created when needed
$submitbutton = false;
// Include the options from each question type
foreach ($QUIZ_QTYPES as $type) {
$options = $type->get_config_options();
if ($options) {
// Temporary code
if (!$table_created) {
echo '<tr><td colspan="3"><table cellpadding="9" cellspacing="0" align="center">';
echo '<tr><th colspan="3">';
print_heading(get_string('questiontypesetupoptions', 'quiz'));
echo "</th></tr>\n";
$table_created = true;
}
$typename = $type->name();
$strtype = get_string($typename, 'quiz');
echo "<tr valign=\"top\">\n";
echo '<td colspan="3" align="center"><b>' . $strtype . "</b></td>\n";
echo "</tr>\n";
foreach ($options as $option) {
if (!isset($option->name)) {
continue;
}
echo "<tr valign=\"top\">\n";
if (!empty($option->link)) {
echo '<td colspan="3" align="center"><a href="' . s($CFG->wwwroot) . '/mod/quiz/questiontypes/' . s($typename) . '/' . s($option->link) . '?sesskey=' . s(rawurlencode($USER->sesskey)) . '">' . get_string($option->name, 'quiz') . "</a></td>\n";
}
else {
if (!isset($option->code)) {
$option->code = '';
}
echo '<td align="right"><b>';
print_string($option->name, 'quiz');
echo ":</b></td>\n";
echo '<td>' . $option->code . "</td>\n";
if (empty($option->help)) {
echo "<td></td>\n";
}
else {
echo '<td align="left">' . get_string($option->help, 'quiz') . "</td>\n";
}
$submitbutton = 'true';
}
echo "</tr>\n";
}
}
}
if ($table_created) {
echo '</table></td></tr>';
}
if ($submitbutton) {
?>
<tr>
<td colspan="3" align="center">
<input type="submit" value="<?php print_string("savechanges") ?>" />
</td>
</tr>
<?php } ?>
</table>
</form>
<script type="text/javascript">
<?php
if (!$form->timelimit) echo "lockoptions('form','timelimitenable', timelimititems);";
?>
</script>