Skip to content
Permalink
Browse files

Merge branch 'MDL-29662' of git://github.com/timhunt/moodle

  • Loading branch information...
stronk7 committed Sep 3, 2012
2 parents 5087a95 + 2079c73 commit b448cf475e3fa40066057e80a08c4a3b5eaeb0a1
Showing with 18 additions and 2 deletions.
  1. +1 −1 lib/moodlelib.php
  2. +17 −1 mod/quiz/lib.php
@@ -4818,7 +4818,7 @@ function shift_course_mod_dates($modname, $fields, $timeshift, $courseid) {
foreach ($fields as $field) {
$updatesql = "UPDATE {".$modname."}
SET $field = $field + ?
WHERE course=? AND $field<>0 AND $field<>0";
WHERE course=? AND $field<>0";
$return = $DB->execute($updatesql, array($timeshift, $courseid)) && $return;
}
@@ -1150,8 +1150,14 @@ function quiz_update_events($quiz, $override = null) {
$addopen = empty($current->id) || !empty($current->timeopen);
$addclose = empty($current->id) || !empty($current->timeclose);
if (!empty($quiz->coursemodule)) {
$cmid = $quiz->coursemodule;
} else {
$cmid = get_coursemodule_from_instance('quiz', $quiz->id, $courseid)->id;
}
$event = new stdClass();
$event->description = format_module_intro('quiz', $quiz, $quiz->coursemodule);
$event->description = format_module_intro('quiz', $quiz, $cmid);
// Events module won't show user events when the courseid is nonzero.
$event->courseid = ($userid) ? 0 : $quiz->course;
$event->groupid = $groupid;
@@ -1341,8 +1347,18 @@ function quiz_reset_userdata($data) {
// Updating dates - shift may be negative too.
if ($data->timeshift) {
$DB->execute("UPDATE {quiz_overrides}
SET timeopen = timeopen + ?
WHERE quiz IN (SELECT id FROM {quiz} WHERE course = ?)
AND timeopen <> 0", array($data->timeshift, $data->courseid));
$DB->execute("UPDATE {quiz_overrides}
SET timeclose = timeclose + ?
WHERE quiz IN (SELECT id FROM {quiz} WHERE course = ?)
AND timeclose <> 0", array($data->timeshift, $data->courseid));
shift_course_mod_dates('quiz', array('timeopen', 'timeclose'),
$data->timeshift, $data->courseid);
$status[] = array(
'component' => $componentstr,
'item' => get_string('openclosedatesupdated', 'quiz'),

0 comments on commit b448cf4

Please sign in to comment.
You can’t perform that action at this time.