moodle/mod/quiz/mod.html
defacer 9173a5671c Searching around in the langfile, it seems that these are the correct
strings for the helpbuttons' title attribute. I added the first helpbutton
back in as well (exists in 1.5.3+ but not in HEAD???).
2005-11-23 21:16:47 +00:00

606 lines
22 KiB
HTML

<!-- This page defines the form to create or edit an instance of this module -->
<!-- It is used from /course/mod.php. The whole instance is available as $form. -->
<?php
require_once("$CFG->dirroot/mod/quiz/locallib.php");
/// Ensure that all form variables are initialized
if (!isset($form->name)) {
$form->name = "";
}
if (!isset($form->intro)) {
$form->intro = "";
}
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 (empty($form->timedue)) {
$form->timedue = "";
}
$fix = 0; // This will later be set to 1 if some of the variables have been fixed by the admin.
// 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"));
}
?>
<script type="text/javascript" language="javascript">
var dueitems = ['dueday','duemonth','dueyear','duehour', 'dueminute'];
var availableitems = ['availableday','availablemonth','availableyear','availablehour', 'availableminute'];
var timelimititems = ['timelimit'];
</script>
<form name="form" method="post" action="mod.php">
<center>
<!-- Now comes a table with all the options that have not been fixed by the admin -->
<table cellpadding="5">
<tr valign="top">
<td align="right"><b><?php print_string("name") ?>:</b></td>
<td align="left">
<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 /><br />
<?php
if ($usehtmleditor) {
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
} else {
helpbutton("text", get_string("helptext"), "moodle", true, true);
echo '<br />';
emoticonhelpbutton("form", "description");
echo '<br />';
}
?>
</td>
<td align="left">
<?php
print_textarea($usehtmleditor, 20, 50, 680, 400, "intro", $form->intro);
?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("availabledate","assignment") ?>:</b></td>
<td align="left">
<input name="availableenable" type="checkbox" value="1" alt="<?php print_string('availabledate', 'assignment') ?>" onclick="return lockoptions('form', 'availableenable', availableitems)" <?php if ($form->timeopen) echo 'checked="checked"' ?> />
<?php
print_date_selector("availableday", "availablemonth", "availableyear", $form->timeopen);
echo "&nbsp;-&nbsp;";
print_time_selector("availablehour", "availableminute", $form->timeopen);
helpbutton('timeopen', get_string('quizopens', 'quiz'), 'quiz');
?>
<input type="hidden" name="havailableday" value="0" />
<input type="hidden" name="havailablemonth" value="0" />
<input type="hidden" name="havailableyear" value="0" />
<input type="hidden" name="havailablehour" value="0" />
<input type="hidden" name="havailableminute" value="0" />
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("duedate", "assignment") ?>:</b></td>
<td align="left">
<input name="dueenable" type="checkbox" value="1" alt="<?php print_string('duedate', 'assignment') ?>" onclick="return lockoptions('form', 'dueenable', dueitems)" <?php if ($form->timeclose) echo 'checked="checked"' ?> />
<?php
print_date_selector("dueday", "duemonth", "dueyear", $form->timeclose);
echo "&nbsp;-&nbsp;";
print_time_selector("duehour", "dueminute", $form->timeclose);
helpbutton('timeopen', get_string('quizcloses', 'quiz'), 'quiz');
?>
<input type="hidden" name="hdueday" value="0" />
<input type="hidden" name="hduemonth" value="0" />
<input type="hidden" name="hdueyear" value="0" />
<input type="hidden" name="hduehour" value="0" />
<input type="hidden" name="hdueminute" value="0" />
</td>
</tr>
<?php if (!$CFG->quiz_fix_timelimit) { ?>
<tr valign="top">
<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 ? $form->timelimit : '') ?>" />
<?php
print_string('minutes');
helpbutton("timelimit", get_string("quiztimer","quiz"), "quiz");
?>
<input type="hidden" name="htimelimit" value="0" />
</td>
</tr>
<?php } else $fix=1 ?>
<?php if (!$CFG->quiz_fix_questionsperpage) { ?>
<tr valign="top">
<td align="right"><b><?php print_string('questionsperpage', 'quiz') ?>:</b></td>
<td align="left">
<?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'), 'quiz');
?>
</td>
</tr>
<?php } else $fix=1 ?>
<?php if (!$CFG->quiz_fix_shufflequestions) { ?>
<tr valign="top">
<td align="right"><b><?php print_string("shufflequestions", "quiz") ?>:</b></td>
<td align="left">
<?php
choose_from_menu($yesnooptions, "shufflequestions", "$form->shufflequestions", "");
helpbutton("shufflequestions", get_string("shufflequestions","quiz"), "quiz");
?>
</td>
</tr>
<?php } else $fix=1 ?>
<?php if (!$CFG->quiz_fix_shuffleanswers) { ?>
<tr valign="top">
<td align="right"><b><?php print_string("shuffleanswers", "quiz") ?>:</b></td>
<td align="left">
<?php
choose_from_menu($yesnooptions, "shuffleanswers", "$form->shuffleanswers", "");
helpbutton("shuffleanswers", get_string("shuffleanswers","quiz"), "quiz");
?>
</td>
</tr>
<?php } else $fix=1 ?>
<?php if (!$CFG->quiz_fix_attempts) { ?>
<tr valign="top">
<td align="right"><b><?php print_string("attemptsallowed", "quiz") ?>:</b></td>
<td align="left">
<?php
choose_from_menu($attemptoptions, "attempts", "$form->attempts", "");
helpbutton("attempts", get_string("attemptsallowed","quiz"), "quiz");
?>
</td>
</tr>
<?php } else $fix=1 ?>
<?php if (!$CFG->quiz_fix_attemptonlast) { ?>
<tr valign="top">
<td align="right"><b><?php print_string("eachattemptbuildsonthelast", "quiz") ?>:</b></td>
<td align="left">
<?php
choose_from_menu($yesnooptions, "attemptonlast",
"$form->attemptonlast", "");
helpbutton("repeatattempts",
get_string("eachattemptbuildsonthelast", "quiz"),
"quiz");
?>
</td>
</tr>
<?php } else $fix=1 ?>
<?php if (!$CFG->quiz_fix_grademethod) { ?>
<tr valign="top">
<td align="right"><b><?php print_string("grademethod", "quiz") ?>:</b></td>
<td align="left">
<?php
choose_from_menu($QUIZ_GRADE_METHOD, "grademethod", "$form->grademethod", "");
helpbutton("grademethod", get_string("grademethod","quiz"), "quiz");
?>
</td>
</tr>
<?php } else $fix=1 ?>
<?php if (!$CFG->quiz_fix_adaptive) { ?>
<tr valign="top">
<td align="right"><b><?php print_string("adaptive", "quiz") ?>:</b></td>
<td align="left">
<?php
choose_from_menu($yesnooptions, "adaptive", ($form->optionflags & QUIZ_ADAPTIVE) ? 1 : 0, "");
helpbutton("adaptive", get_string("adaptive","quiz"), "quiz");
?>
</td>
</tr>
<?php } else $fix=1 ?>
<?php if (!$CFG->quiz_fix_penaltyscheme) { ?>
<tr valign="top">
<td align="right"><b><?php print_string("penaltyscheme", "quiz") ?>:</b></td>
<td align="left">
<?php
choose_from_menu($yesnooptions, "penaltyscheme", "$form->penaltyscheme", "");
helpbutton("penaltyscheme", get_string("penaltyscheme","quiz"), "quiz");
?>
</td>
</tr>
<?php } ?>
<?php if (!$CFG->quiz_fix_decimalpoints) { ?>
<tr valign="top">
<td align="right"><b><?php print_string("decimalpoints", "quiz") ?>:</b></td>
<td align="left">
<?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>
</tr>
<?php } else $fix=1 ?>
<?php if (!$CFG->quiz_fix_review) {
echo '<tr valign="top">';
include($CFG->dirroot . '/mod/quiz/reviewoptions.html');
echo '</tr>';
} else $fix=1 ?>
<?php if (!$CFG->quiz_fix_popup) { ?>
<tr valign="top">
<td align="right"><b><?php print_string("popup", "quiz") ?>:</b></td>
<td align="left">
<?php
choose_from_menu($yesnooptions, "popup", "$form->popup", "");
helpbutton("popup", get_string("popup","quiz"), "quiz");
?>
</td>
</tr>
<?php } else $fix=1 ?>
<?php if (!$CFG->quiz_fix_password) { ?>
<tr valign="top">
<td align="right"><b><?php print_string("requirepassword", "quiz") ?>:</b></td>
<td align="left">
<input type="text" name="password" size="40" value="<?php p($form->password) ?>" />
<?php helpbutton("requirepassword", get_string("requirepassword", "quiz"), "quiz"); ?>
</td>
</tr>
<?php } else $fix=1 ?>
<?php if (!$CFG->quiz_fix_subnet) { ?>
<tr valign="top">
<td align="right"><b><?php print_string("requiresubnet", "quiz") ?>:</b></td>
<td align="left">
<input type="text" name="subnet" size="40" value="<?php p($form->subnet) ?>" />
<?php helpbutton("requiresubnet", get_string("requiresubnet", "quiz"), "quiz"); ?>
</td>
</tr>
<?php } else $fix=1 ?>
<?php print_standard_coursemodule_settings($form); ?>
<?php if ($fix) { ?>
<tr>
<td align="right"><b><?php print_string('advancedsettings') ?>:</b>
<!-- Some javascript to allow for the hiding of advanced options
This code was derived from mod.html in the resource module -->
<script language="javascript" type="text/javascript">
function showhide (id, set) {
divobj = document.getElementById(id);
butobj = document.getElementById(id+'button');
prefobj = document.getElementById(id+'pref');
if (set == true) {
if (prefobj.value == '1') {
divobj.style.display = 'block';
butobj.value = '<?php print_string("hideadvancedsettings") ?>';
} else {
divobj.style.display = 'none';
butobj.value = '<?php print_string("showadvancedsettings") ?>...';
}
} else {
if (prefobj.value == '1') {
divobj.style.display = 'none';
butobj.value = '<?php print_string("showadvancedsettings") ?>...';
prefobj.value = '0';
} else {
divobj.style.display = 'block';
butobj.value = '<?php print_string("hideadvancedsettings") ?>';
prefobj.value = '1';
}
}
}
</script>
</td>
<td align="left">
<input type="button" value="hide settings" id="optionsettingsbutton" onclick="javascript: return showhide('optionsettings');" />
<input type="hidden" name="optionsettingspref" id="optionsettingspref" value="<?php echo get_user_preferences('quiz_optionsettingspref', 0); ?>" />
<br />
</td>
</tr>
<!-- Now comes a copy of the options fields in a div with id optionsettings and with
the conditions reversed, so that it shows exactly the options that are usually hidden.
The visibility of this div is controlled by javascript. -->
<tr><td colspan="2">
<div id="optionsettings">
<table align="center">
<?php if ($CFG->quiz_fix_timelimit) { ?>
<tr valign="top">
<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 ? $form->timelimit : '') ?>" />
<?php
print_string('minutes');
helpbutton("timelimit", get_string("quiztimer","quiz"), "quiz");
?>
<input type="hidden" name="htimelimit" value="0" />
</td>
</tr>
<?php } ?>
<?php if ($CFG->quiz_fix_questionsperpage) { ?>
<tr valign="top">
<td align="right"><b><?php print_string('questionsperpage', 'quiz') ?>:</b></td>
<td align="left">
<?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>
</tr>
<?php } ?>
<?php if ($CFG->quiz_fix_shufflequestions) { ?>
<tr valign="top">
<td align="right"><b><?php print_string("shufflequestions", "quiz") ?>:</b></td>
<td align="left">
<?php
choose_from_menu($yesnooptions, "shufflequestions", "$form->shufflequestions", "");
helpbutton("shufflequestions", get_string("shufflequestions","quiz"), "quiz");
?>
</td>
</tr>
<?php } ?>
<?php if ($CFG->quiz_fix_shuffleanswers) { ?>
<tr valign="top">
<td align="right"><b><?php print_string("shuffleanswers", "quiz") ?>:</b></td>
<td align="left">
<?php
choose_from_menu($yesnooptions, "shuffleanswers", "$form->shuffleanswers", "");
helpbutton("shuffleanswers", get_string("shuffleanswers","quiz"), "quiz");
?>
</td>
</tr>
<?php } ?>
<?php if ($CFG->quiz_fix_attempts) { ?>
<tr valign="top">
<td align="right"><b><?php print_string("attemptsallowed", "quiz") ?>:</b></td>
<td align="left">
<?php
choose_from_menu($attemptoptions, "attempts", "$form->attempts", "");
helpbutton("attempts", get_string("attemptsallowed","quiz"), "quiz");
?>
</td>
</tr>
<?php } ?>
<?php if ($CFG->quiz_fix_attemptonlast) { ?>
<tr valign="top">
<td align="right"><b><?php print_string("eachattemptbuildsonthelast", "quiz") ?>:</b></td>
<td align="left">
<?php
choose_from_menu($yesnooptions, "attemptonlast",
"$form->attemptonlast", "");
helpbutton("repeatattempts",
get_string("eachattemptbuildsonthelast", "quiz"),
"quiz");
?>
</td>
</tr>
<?php } ?>
<?php if ($CFG->quiz_fix_grademethod) { ?>
<tr valign="top">
<td align="right"><b><?php print_string("grademethod", "quiz") ?>:</b></td>
<td align="left">
<?php
choose_from_menu($QUIZ_GRADE_METHOD, "grademethod", "$form->grademethod", "");
helpbutton("grademethod", get_string("grademethod","quiz"), "quiz");
?>
</td>
</tr>
<?php } ?>
<?php if ($CFG->quiz_fix_adaptive) { $fix = 1; ?>
<tr valign="top">
<td align="right"><b><?php print_string("adaptive", "quiz") ?>:</b></td>
<td align="left">
<?php
choose_from_menu($yesnooptions, "adaptive", ($form->optionflags & QUIZ_ADAPTIVE) ? 1 : 0, "");
helpbutton("adaptive", get_string("adaptive","quiz"), "quiz");
?>
</td>
</tr>
<?php } ?>
<?php if ($CFG->quiz_fix_penaltyscheme) { $fix = 1; ?>
<tr valign="top">
<td align="right"><b><?php print_string("penaltyscheme", "quiz") ?>:</b></td>
<td align="left">
<?php
choose_from_menu($yesnooptions, "penaltyscheme", "$form->penaltyscheme", "");
helpbutton("penaltyscheme", get_string("penaltyscheme","quiz"), "quiz");
?>
</td>
</tr>
<?php } ?>
<?php if ($CFG->quiz_fix_decimalpoints) { ?>
<tr valign="top">
<td align="right"><b><?php print_string("decimalpoints", "quiz") ?>:</b></td>
<td align="left">
<?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>
</tr>
<?php } ?>
<?php if ($CFG->quiz_fix_review) {
echo '<tr valign="top">';
include($CFG->dirroot . '/mod/quiz/reviewoptions.html');
echo '</tr>';
} ?>
<?php if ($CFG->quiz_fix_popup) { ?>
<tr valign="top">
<td align="right"><b><?php print_string("popup", "quiz") ?>:</b></td>
<td align="left">
<?php
choose_from_menu($yesnooptions, "popup", "$form->popup", "");
helpbutton("popup", get_string("popup","quiz"), "quiz");
?>
</td>
</tr>
<?php } ?>
<?php if ($CFG->quiz_fix_password) { ?>
<tr valign="top">
<td align="right"><b><?php print_string("requirepassword", "quiz") ?>:</b></td>
<td align="left">
<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) { ?>
<tr valign="top">
<td align="right"><b><?php print_string("requiresubnet", "quiz") ?>:</b></td>
<td align="left">
<input type="text" name="subnet" size="40" value="<?php p($form->subnet) ?>" />
<?php helpbutton("requiresubnet", get_string("requiresubnet", "quiz"), "quiz"); ?>
</td>
</tr>
<?php } ?>
</table>
<script language="javascript" type="text/javascript">
showhide('optionsettings', true);
</script>
</div></td></tr>
<?php } ?>
</table>
<br />
<input type="hidden" name="grade" value="<?php echo $form->grade; ?>" />
<!-- these hidden variables are always the same -->
<input type="hidden" name="course" value="<?php p($form->course) ?>" />
<input type="hidden" name="sesskey" value="<?php p($form->sesskey) ?>" />
<input type="hidden" name="coursemodule" value="<?php p($form->coursemodule) ?>" />
<input type="hidden" name="section" value="<?php p($form->section) ?>" />
<input type="hidden" name="module" value="<?php p($form->module) ?>" />
<input type="hidden" name="modulename" value="<?php p($form->modulename) ?>" />
<input type="hidden" name="instance" value="<?php p($form->instance) ?>" />
<input type="hidden" name="mode" value="<?php p($form->mode) ?>" />
<input type="submit" value="<?php print_string("savechanges") ?>" />
<!-- provide an additional button to edit questions -->
<?php if ($form->instance) { ?>
<input type="hidden" name="redirecturl" value="<?php p("$CFG->wwwroot/mod/quiz/edit.php?quizid=$form->instance") ?>" />
<input type="submit" name="redirect" value="<?php print_string('saveandedit', 'quiz') ?>" />
<?php } ?>
<input type="submit" name="cancel" value="<?php print_string("cancel") ?>" />
</center>
</form>
<script type="text/javascript">
<?php
if (!$form->timeclose) echo "lockoptions('form','dueenable', dueitems);";
if (!$form->timeopen) echo "lockoptions('form','availableenable', availableitems);";
if (!$form->timelimit) echo "lockoptions('form','timelimitenable', timelimititems);";
?>
</script>