The teacher now can choose whether to see the advanced quiz
options or not. This is handled as in the resource module. The "Show advanced options" button is only shown if the admin has chosen to declare some of the options as advanced. There are now 4 review options as suggested by Martin in http://moodle.org/mod/forum/discuss.php?d=16709 Provides separate buttons "Update this quiz" and "Edit questions", see http://moodle.org/mod/forum/discuss.php?d=16708. To make this possible edit.php can now be called with a quiz id and it saves its data itself rather than relying on mod.php. mod.html now has a "Save changes" and a "Save changes and edit questions" button. "Attempt quiz now" button gets a different language string for re-attempts. This is currently set to "Re-attempt quiz". After viewing the feedback for an attempt the "Continue" button leads back to the course homepage, as requested in bugs 1224 and 1976. If there is no feedback the user is brought straight to quiz/view.php.
This commit is contained in:
+10
-2
@@ -76,7 +76,11 @@
|
||||
error($return, "view.php?id=$course->id");
|
||||
}
|
||||
|
||||
$SESSION->returnpage = "$CFG->wwwroot/mod/$mod->modulename/view.php?id=$mod->coursemodule";
|
||||
if (isset($mod->redirect)) {
|
||||
$SESSION->returnpage = $mod->redirecturl;
|
||||
} else {
|
||||
$SESSION->returnpage = "$CFG->wwwroot/mod/$mod->modulename/view.php?id=$mod->coursemodule";
|
||||
}
|
||||
|
||||
add_to_log($course->id, "course", "update mod",
|
||||
"../mod/$mod->modulename/view.php?id=$mod->coursemodule",
|
||||
@@ -128,7 +132,11 @@
|
||||
error("Could not update the course module with the correct section");
|
||||
}
|
||||
|
||||
$SESSION->returnpage = "$CFG->wwwroot/mod/$mod->modulename/view.php?id=$mod->coursemodule";
|
||||
if (isset($mod->redirect)) {
|
||||
$SESSION->returnpage = $mod->redirecturl;
|
||||
} else {
|
||||
$SESSION->returnpage = "$CFG->wwwroot/mod/$mod->modulename/view.php?id=$mod->coursemodule";
|
||||
}
|
||||
|
||||
add_to_log($course->id, "course", "add mod",
|
||||
"../mod/$mod->modulename/view.php?id=$mod->coursemodule",
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<p align="center"><b>Hide options</b></p>
|
||||
|
||||
<p>If you tick these boxes then the corresponding options will be
|
||||
hidden from the teacher by default. However the teacher can access
|
||||
these options by choosing "<?php
|
||||
print_string('showadvancedsettings'); ?>" on the quiz setup
|
||||
page.</p>
|
||||
@@ -0,0 +1,5 @@
|
||||
<p align="center"><b>Allow review</b></p>
|
||||
|
||||
<p>This option controls whether and when students will be able to
|
||||
review their past attempts at this quiz.</p>
|
||||
|
||||
+3
-1
@@ -62,6 +62,7 @@ $string['administrators'] = 'Administrators';
|
||||
$string['administratorsall'] = 'All administrators';
|
||||
$string['administratorsandteachers'] = 'Administrators and teachers';
|
||||
$string['advancedfilter'] = 'Advanced search';
|
||||
$string['advancedsettings'] = 'Advanced settings';
|
||||
$string['again'] = 'again';
|
||||
$string['all'] = 'All';
|
||||
$string['allactivities'] = 'All activities';
|
||||
@@ -474,7 +475,6 @@ $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';
|
||||
@@ -570,6 +570,7 @@ $string['hiddensections'] = 'Hidden sections';
|
||||
$string['hiddensectionscollapsed'] = 'Hidden sections are shown in collapsed form';
|
||||
$string['hiddensectionsinvisible'] = 'Hidden sections are completely invisible';
|
||||
$string['hide'] = 'Hide';
|
||||
$string['hideadvancedsettings'] = 'Hide advanced settings';
|
||||
$string['hidepicture'] = 'Hide picture';
|
||||
$string['hidesettings'] = 'Hide settings';
|
||||
$string['hits'] = 'Hits';
|
||||
@@ -928,6 +929,7 @@ $string['shortname'] = 'Short name';
|
||||
$string['shortnametaken'] = 'Short name is already used for another course ($a)';
|
||||
$string['shortsitename'] = 'Short name for site (eg single word)';
|
||||
$string['show'] = 'Show';
|
||||
$string['showadvancedsettings'] = 'Show advanced settings';
|
||||
$string['showall'] = 'Show all $a';
|
||||
$string['showallcourses'] = 'Show all courses';
|
||||
$string['showalltopics'] = 'Show all topics';
|
||||
|
||||
@@ -211,11 +211,16 @@ $string['randomsamatchcreate'] = 'Create Random Short-Answer Matching questions'
|
||||
$string['randomsamatchintro'] = 'For each of the following questions, select the matching answer from the menu.';
|
||||
$string['randomsamatchnumber'] = 'Number of questions to select';
|
||||
$string['readytosend'] = 'You are about to send your whole quiz to be graded. Are you sure you want to continue?';
|
||||
$string['reattemptquiz'] = 'Re-attempt quiz';
|
||||
$string['recentlyaddedquestion'] = 'Recently added question!';
|
||||
$string['regrade'] = 'Regrade all attempts';
|
||||
$string['regradecomplete'] = 'All attempts have been regraded';
|
||||
$string['regradecount'] = '$a->changed out of $a->attempt grades were changed';
|
||||
$string['relative'] = 'Relative';
|
||||
$string['reviewnever'] = 'Never allow review';
|
||||
$string['reviewafter'] = 'Allow review after quiz is closed';
|
||||
$string['reviewbefore'] = 'Allow review while quiz is open';
|
||||
$string['reviewalways'] = 'Allow review at any time';
|
||||
$string['remove'] = 'Remove';
|
||||
$string['rename'] = 'Rename';
|
||||
$string['report'] = 'Reports';
|
||||
@@ -232,6 +237,7 @@ $string['requiresubnet'] = 'Require network address';
|
||||
$string['reuseifpossible'] = 'reuse previously removed';
|
||||
$string['review'] = 'Review';
|
||||
$string['save'] = 'Save';
|
||||
$string['saveandedit'] = 'Save changes and edit questions';
|
||||
$string['savegrades'] = 'Save grades';
|
||||
$string['savemyanswers'] = 'Save my answers';
|
||||
$string['savequiz'] = 'Save this whole quiz';
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
}
|
||||
|
||||
|
||||
/// BEGIN EDIT Get time limit if any.
|
||||
/// Get time limit if any.
|
||||
|
||||
$timelimit = $quiz->timelimit * 60;
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
if($timelimit and $timerstartvalue <= 0) {
|
||||
$timerstartvalue = 1;
|
||||
}
|
||||
/// END EDIT
|
||||
|
||||
$timenow = time();
|
||||
$available = ($quiz->timeopen < $timenow and $timenow < $quiz->timeclose) || isteacher($course->id);
|
||||
|
||||
@@ -202,6 +202,11 @@
|
||||
if (! quiz_save_best_grade($quiz, $USER->id)) {
|
||||
error("Sorry! Could not calculate your best grade!");
|
||||
}
|
||||
|
||||
if (empty($quiz->popup) and !$quiz->feedback) {
|
||||
// No need to stop on this page, go directly to view.php
|
||||
redirect('view.php?q='.$quiz->id);
|
||||
}
|
||||
|
||||
$strgrade = get_string("grade");
|
||||
$strscore = get_string("score", "quiz");
|
||||
|
||||
@@ -9,7 +9,7 @@ if (!empty($quiz->popup)) {
|
||||
<!--
|
||||
|
||||
document.write('<input type="button" value="<?php print_string('continue') ?>" '+
|
||||
'onclick="javascript: window.opener.location.href=\'view.php?id=<?php echo $cm->id ?>\'; '+
|
||||
'onclick="javascript: window.opener.location.href=\'../../course/view.php?id=<?php echo $course->id ?>\'; '+
|
||||
'window.close();" />');
|
||||
// -->
|
||||
</script>
|
||||
@@ -19,7 +19,7 @@ document.write('<input type="button" value="<?php print_string('continue') ?>" '
|
||||
|
||||
<?php
|
||||
} else {
|
||||
print_single_button("view.php", array( 'id' => $cm->id ), get_string('continue'));
|
||||
print_single_button("../../course/view.php", array( 'id' => $course->id ), get_string('continue'));
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<?php print_string('sitedefault'); ?>
|
||||
</th>
|
||||
<th align="center">
|
||||
<?php print_string('fix'); helpbutton("fixdefaults"); ?>
|
||||
<?php print_string('hide'); helpbutton("hideoptions"); ?>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
@@ -150,11 +150,13 @@
|
||||
<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");
|
||||
$reviewoptions = array();
|
||||
$reviewoptions[0] = get_string('reviewnever', 'quiz');
|
||||
$reviewoptions[1] = get_string('reviewafter', 'quiz');
|
||||
$reviewoptions[2] = get_string('reviewbefore', 'quiz');
|
||||
$reviewoptions[3] = get_string('reviewalways', 'quiz');
|
||||
choose_from_menu ($reviewoptions, "quiz_allowreview", $CFG->quiz_allowreview, "", "", "");
|
||||
helpbutton("review2", get_string("allowreview","quiz"), "quiz");
|
||||
?>
|
||||
</td>
|
||||
<td align="center">
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// It defines default values for any important configuration variables
|
||||
|
||||
$defaults = array (
|
||||
'quiz_allowreview' => 0,
|
||||
'quiz_allowreview' => 1,
|
||||
'quiz_attemptonlast' => 0,
|
||||
'quiz_attempts' => 0,
|
||||
'quiz_grademethod' => '',
|
||||
|
||||
+42
-6
@@ -6,6 +6,7 @@
|
||||
require_login();
|
||||
|
||||
optional_variable($courseid);
|
||||
optional_variable($quizid);
|
||||
|
||||
if (empty($destination)) {
|
||||
$destination = "";
|
||||
@@ -13,7 +14,7 @@
|
||||
|
||||
$modform = data_submitted($destination);
|
||||
|
||||
if ($modform and !empty($modform->course)) { // form submitted from mod.html
|
||||
if ($modform and !empty($modform->course)) { // data submitted
|
||||
|
||||
$modform->name = trim($modform->name);
|
||||
|
||||
@@ -27,6 +28,15 @@
|
||||
|
||||
$SESSION->modform = $modform; // Save the form in the current session
|
||||
|
||||
} else if ($quizid) {
|
||||
if (! $modform = get_record('quiz', 'id', $quizid)) {
|
||||
error("The required quiz doesn't exist");
|
||||
}
|
||||
|
||||
$modform->instance = $modform->id;
|
||||
|
||||
$SESSION->modform = $modform; // Save the form in the current session
|
||||
|
||||
} else if ($courseid) { // Page retrieve through "Edit Questions" link - no quiz selected
|
||||
$modform->course = $courseid;
|
||||
unset($modform->instance);
|
||||
@@ -35,7 +45,9 @@
|
||||
|
||||
} else {
|
||||
if (!isset($SESSION->modform)) {
|
||||
error("You have used this page incorrectly!");
|
||||
// We currently also get here after editing a question by
|
||||
// following the edit link on the review page. Perhaps that should be fixed.
|
||||
error('');
|
||||
}
|
||||
|
||||
$modform = $SESSION->modform;
|
||||
@@ -60,6 +72,10 @@
|
||||
|
||||
|
||||
// Now, check for commands on this page and modify variables as necessary
|
||||
|
||||
if (isset($cancel)) {
|
||||
redirect('view.php?q='.$modform->instance);
|
||||
}
|
||||
|
||||
if (!empty($up)) { /// Move the given question up a slot
|
||||
$questions = explode(",", $modform->questions);
|
||||
@@ -147,6 +163,25 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($save)) { // Save the list of questions and grades in the database and return
|
||||
|
||||
//If caller is correct, $SESSION->sesskey must exist and coincide
|
||||
if (empty($SESSION->sesskey) or !confirm_sesskey($SESSION->sesskey)) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
//Unset this, check done
|
||||
unset($SESSION->sesskey);
|
||||
|
||||
quiz_update_instance($modform);
|
||||
$coursemodule = get_coursemodule_from_instance('quiz', $modform->instance);
|
||||
add_to_log($course->id, 'quiz', 'editquestions',
|
||||
"view.php?id=$coursemodule",
|
||||
"$modform->instance", $coursemodule);
|
||||
redirect('view.php?q='.$modform->instance);
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
if (!empty($cat)) { //-----------------------------------------------------------
|
||||
$modform->category = $cat;
|
||||
@@ -204,11 +239,12 @@
|
||||
}
|
||||
notify("$strattemptsexist<br /><a href=\"report.php?id=$cm->id\">$strviewallanswers ($usercount $strusers)</a>");
|
||||
}
|
||||
|
||||
|
||||
$SESSION->sesskey = !empty($USER->id) ? $USER->sesskey : '';
|
||||
?>
|
||||
<form name="theform" method="post" action=<?php echo $modform->destination ?>>
|
||||
<input type="hidden" name="course" value="<?php p($modform->course) ?>" />
|
||||
<input type="submit" value="<?php print_string("savequiz", "quiz") ?>" />
|
||||
<form method="post" action="edit.php">
|
||||
<input type="hidden" name="sesskey" value="save" />
|
||||
<input type="submit" name="save" value="<?php print_string("savequiz", "quiz") ?>" />
|
||||
<input type="submit" name="cancel" value="<?php print_string("cancel") ?>" />
|
||||
</form>
|
||||
</center>
|
||||
|
||||
+22
-9
@@ -43,6 +43,9 @@ define("QUIZ_MAX_NUMBER_ANSWERS", "10");
|
||||
|
||||
define("QUIZ_MAX_EVENT_LENGTH", "432000"); // 5 days maximum
|
||||
|
||||
define('QUIZ_REVIEW_AFTER', 1);
|
||||
define('QUIZ_REVIEW_BEFORE', 2);
|
||||
|
||||
$QUIZ_QTYPES= array();
|
||||
|
||||
/// QUIZ_QTYPES INITIATION //////////////////
|
||||
@@ -337,9 +340,15 @@ function quiz_add_instance($quiz) {
|
||||
if (!$quiz->id = insert_record("quiz", $quiz)) {
|
||||
return false; // some error occurred
|
||||
}
|
||||
|
||||
if (isset($quiz->optionsettingspref)) {
|
||||
set_user_preference('quiz_optionsettingspref', $quiz->optionsettingspref);
|
||||
}
|
||||
|
||||
// The grades for every question in this quiz are stored in an array
|
||||
if ($quiz->grades) {
|
||||
// (because this is currently only called from mod.html there are not
|
||||
// going to be any grades, but we will leave this code here just in case)
|
||||
if (isset($quiz->grades)) {
|
||||
foreach ($quiz->grades as $question => $grade) {
|
||||
if ($question) {
|
||||
unset($questiongrade);
|
||||
@@ -390,7 +399,7 @@ function quiz_add_instance($quiz) {
|
||||
|
||||
function quiz_update_instance($quiz) {
|
||||
/// Given an object containing all the necessary data,
|
||||
/// (defined by the form in mod.html) this function
|
||||
/// (defined by the form in mod.html or edit.php) this function
|
||||
/// will update an existing instance with new data.
|
||||
|
||||
global $SESSION;
|
||||
@@ -398,23 +407,28 @@ function quiz_update_instance($quiz) {
|
||||
unset($SESSION->modform);
|
||||
|
||||
$quiz->timemodified = time();
|
||||
$quiz->timeopen = make_timestamp($quiz->openyear, $quiz->openmonth, $quiz->openday,
|
||||
$quiz->openhour, $quiz->openminute, 0);
|
||||
$quiz->timeclose = make_timestamp($quiz->closeyear, $quiz->closemonth, $quiz->closeday,
|
||||
$quiz->closehour, $quiz->closeminute, 0);
|
||||
if (isset($quiz->openyear)) { // this would not be set if we come from edit.php
|
||||
$quiz->timeopen = make_timestamp($quiz->openyear, $quiz->openmonth, $quiz->openday,
|
||||
$quiz->openhour, $quiz->openminute, 0);
|
||||
$quiz->timeclose = make_timestamp($quiz->closeyear, $quiz->closemonth, $quiz->closeday,
|
||||
$quiz->closehour, $quiz->closeminute, 0);
|
||||
}
|
||||
$quiz->id = $quiz->instance;
|
||||
|
||||
if (!update_record("quiz", $quiz)) {
|
||||
return false; // some error occurred
|
||||
}
|
||||
|
||||
if (isset($quiz->optionsettingspref)) {
|
||||
set_user_preference('quiz_optionsettingspref', $quiz->optionsettingspref);
|
||||
}
|
||||
|
||||
// The grades for every question in this quiz are stored in an array
|
||||
// Insert or update records as appropriate
|
||||
|
||||
$existing = get_records("quiz_question_grades", "quiz", $quiz->id, "", "question,grade,id");
|
||||
|
||||
if ($quiz->grades) {
|
||||
if (isset($quiz->grades)) { // this will not be set if we come from mod.html
|
||||
foreach ($quiz->grades as $question => $grade) {
|
||||
if ($question) {
|
||||
unset($questiongrade);
|
||||
@@ -473,8 +487,6 @@ function quiz_update_instance($quiz) {
|
||||
add_event($event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1234,6 +1246,7 @@ function quiz_gradesmenu_options($defaultgrade) {
|
||||
|
||||
function quiz_print_question_list($questionlist, $grades) {
|
||||
// Prints a list of quiz questions in a small layout form with knobs
|
||||
// returns sum of maximum grades
|
||||
// $questionlist is comma-separated list
|
||||
// $grades is an array of corresponding grades
|
||||
|
||||
|
||||
+279
-91
@@ -1,9 +1,38 @@
|
||||
<!-- 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. -->
|
||||
|
||||
<!-- 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>
|
||||
|
||||
<?php
|
||||
require_once("$CFG->dirroot/mod/quiz/lib.php");
|
||||
|
||||
// Ensure that all form variables are initialized
|
||||
if (!isset($form->name)) {
|
||||
$form->name = "";
|
||||
}
|
||||
@@ -58,11 +87,40 @@
|
||||
if (!isset($form->popup)) {
|
||||
$form->popup = $CFG->quiz_popup;
|
||||
}
|
||||
|
||||
$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
|
||||
$reviewoptions = array();
|
||||
$reviewoptions[0] = get_string('reviewnever', 'quiz');
|
||||
$reviewoptions[1] = get_string('reviewafter', 'quiz');
|
||||
$reviewoptions[2] = get_string('reviewbefore', 'quiz');
|
||||
$reviewoptions[3] = get_string('reviewalways', 'quiz');
|
||||
|
||||
$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"));
|
||||
}
|
||||
|
||||
$grades = array();
|
||||
for ($i=100; $i>=1; $i--) {
|
||||
$grades[$i] = $i;
|
||||
}
|
||||
$grades[0] = get_string("nograde");
|
||||
?>
|
||||
|
||||
|
||||
<form name="form" method="post" action="../mod/quiz/edit.php">
|
||||
<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">
|
||||
@@ -124,9 +182,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php if ($CFG->quiz_fix_timelimit) { ?>
|
||||
<input type="hidden" name="timelimit" value="<?php p($form->timelimit) ?>">
|
||||
<?php } else { ?>
|
||||
<?php if (!$CFG->quiz_fix_timelimit) { ?>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("timelimit", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
@@ -138,71 +194,48 @@
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($CFG->quiz_fix_shufflequestions) { ?>
|
||||
<input type="hidden" name="shufflequestions" value="<?php p($form->shufflequestions) ?>">
|
||||
<?php } else { ?>
|
||||
<?php if (!$CFG->quiz_fix_shufflequestions) { ?>
|
||||
<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", "");
|
||||
choose_from_menu($yesnooptions, "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 { ?>
|
||||
<?php if (!$CFG->quiz_fix_shuffleanswers) { ?>
|
||||
<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", "");
|
||||
choose_from_menu($yesnooptions, "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 { ?>
|
||||
<?php if (!$CFG->quiz_fix_attempts) { ?>
|
||||
<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", "");
|
||||
choose_from_menu($attemptoptions, "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 { ?>
|
||||
<?php if (!$CFG->quiz_fix_attemptonlast) { ?>
|
||||
<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",
|
||||
choose_from_menu($yesnooptions, "attemptonlast",
|
||||
"$form->attemptonlast", "");
|
||||
helpbutton("repeatattempts",
|
||||
get_string("eachattemptbuildsonthelast", "quiz"),
|
||||
@@ -212,18 +245,11 @@
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($CFG->quiz_fix_grademethod) { ?>
|
||||
<input type="hidden" name="grademethod" value="<?php p($form->grademethod) ?>">
|
||||
<?php } else { ?>
|
||||
<?php if (!$CFG->quiz_fix_grademethod) { ?>
|
||||
<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");
|
||||
?>
|
||||
@@ -231,69 +257,47 @@
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($CFG->quiz_fix_showfeedback) { ?>
|
||||
<input type="hidden" name="feedback" value="<?php p($form->feedback) ?>">
|
||||
<?php } else { ?>
|
||||
<?php if (!$CFG->quiz_fix_showfeedback) { ?>
|
||||
<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", "");
|
||||
choose_from_menu($yesnooptions, "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 { ?>
|
||||
<?php if (!$CFG->quiz_fix_showanswer) { ?>
|
||||
<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", "");
|
||||
choose_from_menu($yesnooptions, "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 { ?>
|
||||
<?php if (!$CFG->quiz_fix_allowreview) { ?>
|
||||
<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");
|
||||
choose_from_menu($reviewoptions, "review", "$form->review", "");
|
||||
helpbutton("review2", 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 { ?>
|
||||
<?php if (!$CFG->quiz_fix_maximumgrade) { ?>
|
||||
<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");
|
||||
?>
|
||||
@@ -301,26 +305,19 @@
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($CFG->quiz_fix_popup) { ?>
|
||||
<input type="hidden" name="popup" value="<?php p($form->popup) ?>">
|
||||
<?php } else { ?>
|
||||
<?php if (!$CFG->quiz_fix_popup) { ?>
|
||||
<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", "");
|
||||
choose_from_menu($yesnooptions, "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 { ?>
|
||||
<?php if (!$CFG->quiz_fix_password) { ?>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("requirepassword", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
@@ -330,9 +327,7 @@
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($CFG->quiz_fix_subnet) { ?>
|
||||
<input type="hidden" name="subnet" value="<?php p($form->subnet) ?>">
|
||||
<?php } else { ?>
|
||||
<?php if (!$CFG->quiz_fix_subnet) { ?>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("requiresubnet", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
@@ -341,9 +336,195 @@
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
</table>
|
||||
<input type="hidden" name="questions" value="<?php p($form->questions) ?>" />
|
||||
|
||||
|
||||
|
||||
<!-- Now comes a copy of the above but enclosed in a div with id optionsettings and with
|
||||
the conditions reversed, so that it shows exactly the options that are usually hidden.
|
||||
The variable $fix is set to 1 if there is at least one fixed option.
|
||||
The visibility of this div is controlled by javascript. -->
|
||||
|
||||
<div id="optionsettings">
|
||||
|
||||
<?php print_heading(get_string('advancedsettings')); ?>
|
||||
|
||||
<table cellpadding="5">
|
||||
|
||||
<?php if ($CFG->quiz_fix_timelimit) { $fix = 1; ?>
|
||||
<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) { $fix = 1; ?>
|
||||
<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>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($CFG->quiz_fix_shuffleanswers) { $fix = 1; ?>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("shuffleanswers", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
choose_from_menu($yesnooptions, "shuffleanswers", "$form->shuffleanswers", "");
|
||||
helpbutton("shuffleanswers", get_string("shuffleanswers","quiz"), "quiz");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($CFG->quiz_fix_attempts) { $fix = 1; ?>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("attemptsallowed", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
choose_from_menu($attemptoptions, "attempts", "$form->attempts", "");
|
||||
helpbutton("attempts", get_string("attemptsallowed","quiz"), "quiz");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($CFG->quiz_fix_attemptonlast) { $fix = 1; ?>
|
||||
<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>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($CFG->quiz_fix_grademethod) { $fix = 1; ?>
|
||||
<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>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($CFG->quiz_fix_showfeedback) { $fix = 1; ?>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("showfeedback", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
choose_from_menu($yesnooptions, "feedback", "$form->feedback", "");
|
||||
helpbutton("feedback", get_string("showfeedback","quiz"), "quiz");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($CFG->quiz_fix_showanswer) { $fix = 1; ?>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("showcorrectanswer", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
choose_from_menu($yesnooptions, "correctanswers", "$form->correctanswers", "");
|
||||
helpbutton("correctanswers", get_string("showcorrectanswer","quiz"), "quiz");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($CFG->quiz_fix_allowreview) { $fix = 1; ?>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("allowreview", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
choose_from_menu($reviewoptions, "review", "$form->review", "");
|
||||
helpbutton("review", get_string("allowreview","quiz"), "quiz");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($CFG->quiz_fix_maximumgrade) { $fix = 1; ?>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("maximumgrade") ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
choose_from_menu($grades, "grade", "$form->grade", "");
|
||||
helpbutton("maxgrade", get_string("maximumgrade"), "quiz");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($CFG->quiz_fix_popup) { $fix = 1; ?>
|
||||
<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>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($CFG->quiz_fix_password) { $fix = 1; ?>
|
||||
<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) { $fix = 1; ?>
|
||||
<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>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Now show the button that the teacher can use to display and override the settings that were
|
||||
fixed by the admin. -->
|
||||
<?php if ($fix) { ?>
|
||||
<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 />
|
||||
<?php } else { ?>
|
||||
<input type="hidden" value="hide settings" id="optionsettingsbutton" />
|
||||
<input type="hidden" name="optionsettingspref" id="optionsettingspref"
|
||||
value="0" />
|
||||
<?php } ?>
|
||||
<br />
|
||||
|
||||
<!-- these hidden variables are always the same -->
|
||||
<input type="hidden" name="course" value="<?php p($form->course) ?>" />
|
||||
<input type="hidden" name="coursemodule" value="<?php p($form->coursemodule) ?>" />
|
||||
@@ -352,7 +533,14 @@
|
||||
<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="hidden" name="destination" value="<?php echo "$CFG->wwwroot/course/mod.php" ?>" />
|
||||
<input type="submit" value="<?php print_string("continue") ?>" />
|
||||
<input type="submit" value="<?php print_string("savechanges") ?>" />
|
||||
<!-- provide an additional button to edit questions -->
|
||||
<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') ?>" />
|
||||
<input type="submit" name="cancel" value="<?php print_string("cancel") ?>" />
|
||||
</center>
|
||||
</form>
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
showhide('optionsettings', true);
|
||||
</script>
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
|
||||
<input type="hidden" name="questiontext" value="---" />
|
||||
|
||||
<input type="hidden" name="questiontextformat" value="0" />
|
||||
|
||||
|
||||
<input type="hidden" name="id" value="<?php p($question->id) ?>" />
|
||||
|
||||
+4
-1
@@ -46,9 +46,12 @@
|
||||
if (!$quiz->review) {
|
||||
error(get_string("noreview", "quiz"));
|
||||
}
|
||||
if (time() < $quiz->timeclose) {
|
||||
if (time() < $quiz->timeclose and $quiz->review == QUIZ_REVIEW_AFTER) {
|
||||
error(get_string("noreviewuntil", "quiz", userdate($quiz->timeclose)));
|
||||
}
|
||||
if (time() > $quiz->timeclose and $quiz->review == QUIZ_REVIEW_BEFORE) {
|
||||
error(get_string("noreview", "quiz"));
|
||||
}
|
||||
if ($attempt->userid != $USER->id) {
|
||||
error("This is not your attempt!");
|
||||
}
|
||||
|
||||
+33
-6
@@ -34,6 +34,11 @@
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
|
||||
// if no questions have been set up yet redirect to edit.php
|
||||
if (!$quiz->questions and isteacheredit($course->id)) {
|
||||
redirect('edit.php?quizid='.$quiz->id);
|
||||
}
|
||||
|
||||
add_to_log($course->id, "quiz", "view", "view.php?id=$cm->id", $quiz->id, $cm->id);
|
||||
|
||||
@@ -44,10 +49,20 @@
|
||||
|
||||
$strquizzes = get_string("modulenameplural", "quiz");
|
||||
$strquiz = get_string("modulename", "quiz");
|
||||
$stredit = get_string('editquestions', 'quiz');
|
||||
if (isteacheredit($course->id)) {
|
||||
$buttons = "<table><tr><td><form target=\"$CFG->framename\" method=\"get\" action=\"edit.php\">".
|
||||
"<input type=\"hidden\" name=\"quizid\" value=\"$quiz->id\" />".
|
||||
"<input type=\"submit\" value=\"$stredit\" /></form></td><td>".
|
||||
update_module_button($cm->id, $course->id, $strquiz).
|
||||
'</td></tr></table>';
|
||||
} else {
|
||||
$buttons = '';
|
||||
}
|
||||
|
||||
print_header_simple("$quiz->name", "",
|
||||
"<a href=\"index.php?id=$course->id\">$strquizzes</a> -> $quiz->name",
|
||||
"", "", true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm));
|
||||
"", "", true, $buttons, navmenu($course, $cm));
|
||||
|
||||
if (isteacher($course->id)) {
|
||||
$attemptcount = count_records_select("quiz_attempts", "quiz = '$quiz->id' AND timefinish > 0");
|
||||
@@ -118,17 +133,17 @@
|
||||
if ($attemptgrade == $mygrade) {
|
||||
$attemptgrade = "<span class=\"highlight\">$attemptgrade</span>";
|
||||
}
|
||||
if (!$available and $quiz->review) {
|
||||
if (quiz_review_allowed($quiz)) {
|
||||
$attemptgrade = "<a href=\"review.php?q=$quiz->id&attempt=$attempt->id\">$attemptgrade</a>";
|
||||
$attempt->attempt = "<a href=\"review.php?q=$quiz->id&attempt=$attempt->id\">$attempt->attempt</a>";
|
||||
$attempt->attempt = "<a href=\"review.php?q=$quiz->id&attempt=$attempt->id\">#$attempt->attempt</a>";
|
||||
}
|
||||
$table->data[] = array( $attempt->attempt,
|
||||
format_time($attempt->timefinish - $attempt->timestart),
|
||||
userdate($attempt->timefinish),
|
||||
$attemptgrade);
|
||||
} else { // No grades are being used
|
||||
if (!$available and $quiz->review) {
|
||||
$attempt->attempt = "<a href=\"review.php?q=$quiz->id&attempt=$attempt->id\">$attempt->attempt</a>";
|
||||
if (quiz_review_allowed($quiz)) {
|
||||
$attempt->attempt = "<a href=\"review.php?q=$quiz->id&attempt=$attempt->id\">#$attempt->attempt</a>";
|
||||
}
|
||||
$table->data[] = array( $attempt->attempt,
|
||||
format_time($attempt->timefinish - $attempt->timestart),
|
||||
@@ -176,8 +191,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Finish the page
|
||||
print_footer($course);
|
||||
|
||||
function quiz_review_allowed($quiz) {
|
||||
if (!$quiz->review) {
|
||||
return false;
|
||||
}
|
||||
if ((time() < $quiz->timeclose) and ($quiz->review == QUIZ_REVIEW_AFTER)) {
|
||||
return false;
|
||||
}
|
||||
if ((time() > $quiz->timeclose) and ($quiz->review == QUIZ_REVIEW_BEFORE)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -3,12 +3,13 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
|
||||
$window = (!empty($quiz->popup)) ? 'quizpopup' : '_self';
|
||||
$windowoptions = ($window == '_self') ? '' : "left=0, top=0, height='+window.screen.height+', width='+window.screen.width+', channelmode=yes, fullscreen=yes, scrollbars=yes, resizeable=no, directories=no, toolbar=no, titlebar=no, location=no, status=no, menubar=no";
|
||||
$buttontext = ($numattempts) ? get_string('reattemptquiz', 'quiz') : get_string('attemptquiznow', 'quiz');
|
||||
|
||||
?>
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
<!--
|
||||
document.write('<input type="button" value="<?php print_string('attemptquiznow', 'quiz') ?>" '+
|
||||
document.write('<input type="button" value="<?php echo $buttontext ?>" '+
|
||||
'onclick="javascript: <?php if ($quiz->timelimit) echo "if (confirm(\\'$strconfirmstartattempt\\'))"; ?> '+
|
||||
'window.open(\'attempt.php?id=<?php echo $cm->id ?>\', \'<?php echo $window ?>\', \'<?php echo $windowoptions ?>\'); " />');
|
||||
// -->
|
||||
@@ -16,4 +17,3 @@ document.write('<input type="button" value="<?php print_string('attemptquiznow',
|
||||
<noscript>
|
||||
<strong><?php print_string('noscript', 'quiz'); ?></strong>
|
||||
</noscript>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user