mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Due date and start date are now optional, as requested in bug 867 and bug 3635
This commit is contained in:
parent
a61a956c65
commit
bb52d44c6a
9 changed files with 175 additions and 91 deletions
|
@ -365,7 +365,7 @@
|
|||
/// Check access to quiz page
|
||||
|
||||
// check the quiz times
|
||||
if (($timestamp < $quiz->timeopen || $timestamp > $quiz->timeclose)) {
|
||||
if ($timestamp < $quiz->timeopen || ($quiz->timeclose and $timestamp > $quiz->timeclose)) {
|
||||
if ($isteacher) {
|
||||
notify(get_string('notavailabletostudents', 'quiz'));
|
||||
} else {
|
||||
|
@ -473,7 +473,7 @@
|
|||
echo "</form>\n";
|
||||
|
||||
|
||||
$secondsleft = $quiz->timeclose - time();
|
||||
$secondsleft = ($quiz->timeclose ? $quiz->timeclose : 999999999999) - time();
|
||||
// If time limit is set include floating timer.
|
||||
if ($quiz->timelimit > 0) {
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
$currentsection = $quiz->section;
|
||||
}
|
||||
|
||||
$closequiz = userdate($quiz->timeclose);
|
||||
$closequiz = $quiz->timeclose ? userdate($quiz->timeclose) : '';
|
||||
|
||||
if (isteacher($course->id)) {
|
||||
if ($usercount = count_records_select('quiz_attempts', "quiz = '$quiz->id' AND preview = '0'", 'COUNT(DISTINCT userid)')) {
|
||||
|
|
|
@ -26,10 +26,22 @@ function quiz_add_instance($quiz) {
|
|||
|
||||
$quiz->created = time();
|
||||
$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);
|
||||
// The following is adapted from the assignment module
|
||||
if (empty($quiz->dueenable)) {
|
||||
$quiz->timeclose = 0;
|
||||
} else {
|
||||
$quiz->timeclose = make_timestamp($quiz->dueyear, $quiz->duemonth,
|
||||
$quiz->dueday, $quiz->duehour,
|
||||
$quiz->dueminute);
|
||||
}
|
||||
if (empty($quiz->availableenable)) {
|
||||
$quiz->timeopen = 0;
|
||||
$quiz->preventlate = 0;
|
||||
} else {
|
||||
$quiz->timeopen = make_timestamp($quiz->availableyear, $quiz->availablemonth,
|
||||
$quiz->availableday, $quiz->availablehour,
|
||||
$quiz->availableminute);
|
||||
}
|
||||
|
||||
if (empty($quiz->name)) {
|
||||
if (empty($quiz->intro)) {
|
||||
|
@ -50,35 +62,48 @@ function quiz_add_instance($quiz) {
|
|||
|
||||
delete_records('event', 'modulename', 'quiz', 'instance', $quiz->id); // Just in case
|
||||
|
||||
$event = NULL;
|
||||
$event->name = $quiz->name;
|
||||
unset($event);
|
||||
$event->description = $quiz->intro;
|
||||
$event->courseid = $quiz->course;
|
||||
$event->groupid = 0;
|
||||
$event->userid = 0;
|
||||
$event->modulename = 'quiz';
|
||||
$event->instance = $quiz->id;
|
||||
$event->eventtype = 'open';
|
||||
$event->timestart = $quiz->timeopen;
|
||||
$event->visible = instance_is_visible('quiz', $quiz);
|
||||
|
||||
if ($quiz->timeclose and $quiz->timeopen) {
|
||||
// we have both a start and an end date
|
||||
$event->eventtype = 'open';
|
||||
$event->timeduration = ($quiz->timeclose - $quiz->timeopen);
|
||||
|
||||
if ($event->timeduration > QUIZ_MAX_EVENT_LENGTH) { /// Long durations create two events
|
||||
$event2 = $event;
|
||||
|
||||
$event->name .= ' ('.get_string('quizopens', 'quiz').')';
|
||||
$event->name = $quiz->name.' ('.get_string('quizopens', 'quiz').')';
|
||||
$event->timeduration = 0;
|
||||
|
||||
$event2->timestart = $quiz->timeclose;
|
||||
$event2->eventtype = 'close';
|
||||
$event2->timeduration = 0;
|
||||
$event2->name .= ' ('.get_string('quizcloses', 'quiz').')';
|
||||
|
||||
add_event($event2);
|
||||
}
|
||||
|
||||
add_event($event);
|
||||
|
||||
$event->timestart = $quiz->timeclose;
|
||||
$event->eventtype = 'close';
|
||||
$event->name = $quiz->name.' ('.get_string('quizcloses', 'quiz').')';
|
||||
unset($event->id);
|
||||
add_event($event);
|
||||
} else { // single event with duration
|
||||
$event->name = $quiz->name;
|
||||
add_event($event);
|
||||
}
|
||||
} elseif ($quiz->timeopen) { // only an open date
|
||||
$event->name = $quiz->name.' ('.get_string('quizopens', 'quiz').')';
|
||||
$event->eventtype = 'open';
|
||||
$event->timeduration = 0;
|
||||
add_event($event);
|
||||
} elseif ($quiz->timeclose) { // only a closing date
|
||||
$event->name = $quiz->name.' ('.get_string('quizcloses', 'quiz').')';
|
||||
$event->timestart = $quiz->timeclose;
|
||||
$event->eventtype = 'close';
|
||||
$event->timeduration = 0;
|
||||
}
|
||||
|
||||
return $quiz->id;
|
||||
}
|
||||
|
||||
|
@ -91,12 +116,23 @@ function quiz_update_instance($quiz) {
|
|||
quiz_process_options($quiz);
|
||||
|
||||
$quiz->timemodified = time();
|
||||
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);
|
||||
// The following is adapted from the assignment module
|
||||
if (empty($quiz->dueenable)) {
|
||||
$quiz->timeclose = 0;
|
||||
} else {
|
||||
$quiz->timeclose = make_timestamp($quiz->dueyear, $quiz->duemonth,
|
||||
$quiz->dueday, $quiz->duehour,
|
||||
$quiz->dueminute);
|
||||
}
|
||||
if (empty($quiz->availableenable)) {
|
||||
$quiz->timeopen = 0;
|
||||
$quiz->preventlate = 0;
|
||||
} else {
|
||||
$quiz->timeopen = make_timestamp($quiz->availableyear, $quiz->availablemonth,
|
||||
$quiz->availableday, $quiz->availablehour,
|
||||
$quiz->availableminute);
|
||||
}
|
||||
|
||||
$quiz->id = $quiz->instance;
|
||||
|
||||
if (!update_record("quiz", $quiz)) {
|
||||
|
@ -125,9 +161,11 @@ function quiz_update_instance($quiz) {
|
|||
$event->userid = 0;
|
||||
$event->modulename = 'quiz';
|
||||
$event->instance = $quiz->id;
|
||||
$event->eventtype = 'open';
|
||||
$event->timestart = $quiz->timeopen;
|
||||
$event->visible = instance_is_visible('quiz', $quiz);
|
||||
if ($quiz->timeclose and $quiz->timeopen) {
|
||||
// we have both a start and an end date
|
||||
$event->eventtype = 'open';
|
||||
$event->timeduration = ($quiz->timeclose - $quiz->timeopen);
|
||||
|
||||
if ($event->timeduration > QUIZ_MAX_EVENT_LENGTH) { /// Long durations create two events
|
||||
|
@ -145,6 +183,17 @@ function quiz_update_instance($quiz) {
|
|||
$event->name = $quiz->name;
|
||||
add_event($event);
|
||||
}
|
||||
} elseif ($quiz->timeopen) { // only an open date
|
||||
$event->name = $quiz->name.' ('.get_string('quizopens', 'quiz').')';
|
||||
$event->eventtype = 'open';
|
||||
$event->timeduration = 0;
|
||||
add_event($event);
|
||||
} elseif ($quiz->timeclose) { // only a closing date
|
||||
$event->name = $quiz->name.' ('.get_string('quizcloses', 'quiz').')';
|
||||
$event->timestart = $quiz->timeclose;
|
||||
$event->eventtype = 'close';
|
||||
$event->timeduration = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -394,6 +394,30 @@ function quiz_calculate_best_attempt($quiz, $attempts) {
|
|||
|
||||
/// OTHER QUIZ FUNCTIONS ////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Print a box with quiz start and due dates
|
||||
*
|
||||
* @param object $quiz
|
||||
*/
|
||||
function quiz_view_dates($quiz) {
|
||||
if (!$quiz->timeopen && !$quiz->timeclose) {
|
||||
return;
|
||||
}
|
||||
|
||||
print_simple_box_start('center', '', '', '', 'generalbox', 'dates');
|
||||
echo '<table>';
|
||||
if ($quiz->timeopen) {
|
||||
echo '<tr><td class="c0">'.get_string('availabledate','assignment').':</td>';
|
||||
echo ' <td class="c1">'.userdate($quiz->timeopen).'</td></tr>';
|
||||
}
|
||||
if ($quiz->timeclose) {
|
||||
echo '<tr><td class="c0">'.get_string('duedate','assignment').':</td>';
|
||||
echo ' <td class="c1">'.userdate($quiz->timeclose).'</td></tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
print_simple_box_end();
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of names of quizzes a question appears in
|
||||
*
|
||||
|
|
|
@ -64,6 +64,9 @@
|
|||
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.
|
||||
|
||||
|
@ -81,7 +84,10 @@
|
|||
}
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
var dueitems = ['dueday','duemonth','dueyear','duehour', 'dueminute'];
|
||||
var availableitems = ['availableday','availablemonth','availableyear','availablehour', 'availableminute'];
|
||||
</script>
|
||||
|
||||
<form name="form" method="post" action="mod.php">
|
||||
|
||||
|
@ -117,31 +123,38 @@
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("quizopen", "quiz") ?>:</b></td>
|
||||
<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
|
||||
if (!$form->timeopen and $course->format == "weeks") {
|
||||
$form->timeopen = $course->startdate + (($form->section - 1) * 608400);
|
||||
}
|
||||
print_date_selector("openday", "openmonth", "openyear", $form->timeopen);
|
||||
print_time_selector("openhour", "openminute", $form->timeopen);
|
||||
helpbutton("timeopen", get_string("quizopen","quiz"), "quiz");
|
||||
print_date_selector("availableday", "availablemonth", "availableyear", $form->timeopen);
|
||||
echo " - ";
|
||||
print_time_selector("availablehour", "availableminute", $form->timeopen);
|
||||
?>
|
||||
<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("quizclose", "quiz") ?>:</b></td>
|
||||
<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
|
||||
if (!$form->timeclose and $course->format == "weeks") {
|
||||
$form->timeclose = $course->startdate + (($form->section) * 608400);
|
||||
}
|
||||
print_date_selector("closeday", "closemonth", "closeyear", $form->timeclose);
|
||||
print_time_selector("closehour", "closeminute", $form->timeclose);
|
||||
helpbutton("timeopen", get_string("quizclose","quiz"), "quiz");
|
||||
print_date_selector("dueday", "duemonth", "dueyear", $form->timeclose);
|
||||
echo " - ";
|
||||
print_time_selector("duehour", "dueminute", $form->timeclose);
|
||||
helpbutton("timeopen", get_string("timeclose","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>
|
||||
|
||||
|
@ -575,4 +588,9 @@
|
|||
</center>
|
||||
</form>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<?php
|
||||
if (!$form->timeclose) echo "lockoptions('form','dueenable', dueitems);";
|
||||
if (!$form->timeopen) echo "lockoptions('form','availableenable', availableitems);";
|
||||
?>
|
||||
</script
|
||||
|
|
|
@ -197,7 +197,7 @@ function quiz_get_states(&$questions, $cmoptions, $attempt) {
|
|||
" AND n.questionid IN ($questionlist)";
|
||||
$gradedstates = get_records_sql($sql);
|
||||
|
||||
// loop through all questions, restore the states, and set the last_graded states
|
||||
// loop through all questions and set the last_graded states
|
||||
foreach ($ids as $i) {
|
||||
if (isset($states[$i])) {
|
||||
quiz_restore_state($questions[$i], $states[$i]);
|
||||
|
@ -205,14 +205,15 @@ function quiz_get_states(&$questions, $cmoptions, $attempt) {
|
|||
quiz_restore_state($questions[$i], $gradedstates[$i]);
|
||||
$states[$i]->last_graded = $gradedstates[$i];
|
||||
} else {
|
||||
error('No graded state could be found!');
|
||||
$states[$i]->last_graded = clone($states[$i]);
|
||||
$states[$i]->last_graded->responses = array('' => '');
|
||||
}
|
||||
} else {
|
||||
// Create a new state object
|
||||
if ($cmoptions->attemptonlast and $attempt->attempt > 1) {
|
||||
if ($quiz->attemptonlast and $attempt->attempt > 1 and !$attempt->preview) {
|
||||
// build on states from last attempt
|
||||
if (empty($lastattemptid)) {
|
||||
$lastattemptid = get_field('quiz_attempts', 'uniqueid', 'quiz', $attempt->quiz, 'userid', $attempt->userid, 'attempt', $attempt->attempt-1);
|
||||
if (!$lastattemptid = get_field('quiz_attempts', 'uniqueid', 'quiz', $attempt->quiz, 'userid', $attempt->userid, 'attempt', $attempt->attempt-1)) {
|
||||
error('Could not find previous attempt to build on');
|
||||
}
|
||||
// Load the last graded state for the question
|
||||
$sql = "SELECT $statefields".
|
||||
|
@ -221,7 +222,9 @@ function quiz_get_states(&$questions, $cmoptions, $attempt) {
|
|||
" WHERE s.id = n.newgraded".
|
||||
" AND n.attemptid = '$lastattemptid'".
|
||||
" AND n.questionid = '$i'";
|
||||
$states[$i] = get_record_sql($sql);
|
||||
if (!$states[$i] = get_record_sql($sql)) {
|
||||
error('Could not find state for previous attempt to build on');
|
||||
}
|
||||
quiz_restore_state($questions[$i], $states[$i]);
|
||||
$states[$i]->attempt = $attempt->uniqueid;
|
||||
$states[$i]->question = (int) $i;
|
||||
|
@ -232,16 +235,8 @@ function quiz_get_states(&$questions, $cmoptions, $attempt) {
|
|||
$states[$i]->raw_grade = '';
|
||||
$states[$i]->penalty = '';
|
||||
$states[$i]->sumpenalty = '0.0';
|
||||
$states[$i]->last_graded = new object;
|
||||
$states[$i]->last_graded->attempt = $attempt->uniqueid;
|
||||
$states[$i]->last_graded->question = (int) $i;
|
||||
$states[$i]->last_graded->seq_number = 0;
|
||||
$states[$i]->last_graded->timestamp = $attempt->timestart;
|
||||
$states[$i]->last_graded->event = ($attempt->timefinish) ? QUIZ_EVENTCLOSE : QUIZ_EVENTOPEN;
|
||||
$states[$i]->last_graded->grade = '';
|
||||
$states[$i]->last_graded->raw_grade = '';
|
||||
$states[$i]->last_graded->penalty = '';
|
||||
$states[$i]->last_graded->sumpenalty = '0.0';
|
||||
$states[$i]->changed = true;
|
||||
$states[$i]->last_graded = clone($states[$i]);
|
||||
$states[$i]->last_graded->responses = array('' => '');
|
||||
|
||||
} else {
|
||||
|
@ -278,8 +273,7 @@ function quiz_get_states(&$questions, $cmoptions, $attempt) {
|
|||
* Creates the run-time fields for the states
|
||||
*
|
||||
* Extends the state objects for a question by calling
|
||||
* {@link restore_session_and_responses()} or it creates a new one by
|
||||
* calling {@link create_session_and_responses()}
|
||||
* {@link restore_session_and_responses()}
|
||||
* @return boolean Represents success or failure
|
||||
* @param object $question The question for which the state is needed
|
||||
* @param object $state The state as loaded from the database
|
||||
|
@ -343,7 +337,6 @@ function quiz_save_question_session(&$question, &$state) {
|
|||
$new->attemptid = $state->attempt;
|
||||
$new->questionid = $question->id;
|
||||
$new->newest = $state->id;
|
||||
$new->newgraded = $state->id;
|
||||
$new->sumpenalty = $state->sumpenalty;
|
||||
if (!insert_record('quiz_newest_states', $new)) {
|
||||
error('Could not insert entry in quiz_newest_states');
|
||||
|
@ -745,7 +738,7 @@ function quiz_apply_penalty_and_timelimit(&$question, &$state, $attempt, $cmopti
|
|||
}
|
||||
|
||||
// deal with closing time
|
||||
if ($state->timestamp > ($cmoptions->timeclose + 60)) { // allowing 1 minute lateness
|
||||
if ($cmoptions->timeclose and $state->timestamp > ($cmoptions->timeclose + 60)) { // allowing 1 minute lateness
|
||||
$state->grade = 0;
|
||||
}
|
||||
|
||||
|
@ -902,7 +895,7 @@ function quiz_get_reviewoptions($cmoptions, $attempt, $isteacher=false) {
|
|||
$options->feedback = ($cmoptions->review & QUIZ_REVIEW_IMMEDIATELY & QUIZ_REVIEW_FEEDBACK) ? 1 : 0;
|
||||
$options->correct_responses = ($cmoptions->review & QUIZ_REVIEW_IMMEDIATELY & QUIZ_REVIEW_ANSWERS) ? 1 : 0;
|
||||
$options->solutions = ($cmoptions->review & QUIZ_REVIEW_IMMEDIATELY & QUIZ_REVIEW_SOLUTIONS) ? 1 : 0;
|
||||
} else if (time() < $cmoptions->timeclose) {
|
||||
} else if (!$cmoptions->timeclose or time() < $cmoptions->timeclose) {
|
||||
$options->responses = ($cmoptions->review & QUIZ_REVIEW_OPEN & QUIZ_REVIEW_RESPONSES) ? 1 : 0;
|
||||
$options->scores = ($cmoptions->review & QUIZ_REVIEW_OPEN & QUIZ_REVIEW_SCORES) ? 1 : 0;
|
||||
$options->feedback = ($cmoptions->review & QUIZ_REVIEW_OPEN & QUIZ_REVIEW_FEEDBACK) ? 1 : 0;
|
||||
|
|
|
@ -50,10 +50,10 @@
|
|||
redirect('view.php?q='.$quiz->id);
|
||||
}
|
||||
if ((time() - $attempt->timefinish) > 120) { // always allow review right after attempt
|
||||
if (time() < $quiz->timeclose and !($quiz->review & QUIZ_REVIEW_OPEN)) {
|
||||
if ((!$quiz->timeclose or time() < $quiz->timeclose) and !($quiz->review & QUIZ_REVIEW_OPEN)) {
|
||||
redirect('view.php?q='.$quiz->id, get_string("noreviewuntil", "quiz", userdate($quiz->timeclose)));
|
||||
}
|
||||
if (time() >= $quiz->timeclose and !($quiz->review & QUIZ_REVIEW_CLOSED)) {
|
||||
if ($quiz->timeclose and time() >= $quiz->timeclose and !($quiz->review & QUIZ_REVIEW_CLOSED)) {
|
||||
redirect('view.php?q='.$quiz->id, get_string("noreview", "quiz"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,10 +70,10 @@
|
|||
error(get_string("noreview", "quiz"));
|
||||
}
|
||||
if ((time() - $attempt->timefinish) > 120) { // always allow review right after attempt
|
||||
if (time() < $quiz->timeclose and !($quiz->review & QUIZ_REVIEW_OPEN)) {
|
||||
if (!$quiz->timeclose or time() < $quiz->timeclose and !($quiz->review & QUIZ_REVIEW_OPEN)) {
|
||||
error(get_string("noreviewuntil", "quiz", userdate($quiz->timeclose)));
|
||||
}
|
||||
if (time() >= $quiz->timeclose and !($quiz->review & QUIZ_REVIEW_CLOSED)) {
|
||||
if ($quiz->timeclose and time() >= $quiz->timeclose and !($quiz->review & QUIZ_REVIEW_CLOSED)) {
|
||||
error(get_string("noreview", "quiz"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
|
||||
echo '<td id="middle-column">';
|
||||
|
||||
$available = ($quiz->timeopen < $timenow and $timenow < $quiz->timeclose) || $isteacher;
|
||||
$available = ($quiz->timeopen < $timenow and ($timenow < $quiz->timeclose or !$quiz->timeclose)) || $isteacher;
|
||||
|
||||
// Print the main part of the page
|
||||
|
||||
|
@ -102,7 +102,7 @@
|
|||
if ($quiz->timelimit) {
|
||||
echo "<p align=\"center\">".get_string("quiztimelimit","quiz", format_time($quiz->timelimit * 60))."</p>";
|
||||
}
|
||||
echo "<p align=\"center\">".get_string("quizavailable", "quiz", userdate($quiz->timeclose));
|
||||
quiz_view_dates($quiz);
|
||||
} else if ($timenow < $quiz->timeopen) {
|
||||
echo "<p align=\"center\">".get_string("quiznotavailable", "quiz", userdate($quiz->timeopen));
|
||||
} else {
|
||||
|
@ -222,7 +222,7 @@
|
|||
$datecompleted .= '</noscript>';
|
||||
} else { // attempt was not completed but is also not available any more.
|
||||
$timetaken = format_time($quiz->timeclose - $attempt->timestart);
|
||||
$datecompleted = userdate($quiz->timeclose);
|
||||
$datecompleted = $quiz->timeclose ? userdate($quiz->timeclose) : '';
|
||||
}
|
||||
|
||||
/// prepare strings for attempt number, mark and grade
|
||||
|
@ -313,10 +313,10 @@
|
|||
if (!($quiz->review & QUIZ_REVIEW_RESPONSES)) {
|
||||
return false;
|
||||
}
|
||||
if ((time() < $quiz->timeclose) and !($quiz->review & QUIZ_REVIEW_OPEN)) {
|
||||
if ((!$quiz->timeclose or time() < $quiz->timeclose) and !($quiz->review & QUIZ_REVIEW_OPEN)) {
|
||||
return false;
|
||||
}
|
||||
if ((time() > $quiz->timeclose) and !($quiz->review & QUIZ_REVIEW_CLOSED)) {
|
||||
if (($quiz->timeclose and time() > $quiz->timeclose) and !($quiz->review & QUIZ_REVIEW_CLOSED)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue