MDL-31405 Assignment: Fixed date in reset to be called for every assignment

This commit is contained in:
Rajesh Taneja 2013-10-14 12:07:46 +08:00
parent f8eff10319
commit e63515ba93
5 changed files with 56 additions and 9 deletions

View file

@ -2368,12 +2368,6 @@ class assignment_base {
}
}
/// updating dates - shift may be negative too
if ($data->timeshift) {
shift_course_mod_dates('assignment', array('timedue', 'timeavailable'), $data->timeshift, $data->courseid);
$status[] = array('component'=>$componentstr, 'item'=>get_string('datechanged').': '.$typestr, 'error'=>false);
}
return $status;
}
@ -3886,6 +3880,23 @@ function assignment_reset_userdata($data) {
$status = array_merge($status, $ass->reset_userdata($data));
}
// Updating dates - shift may be negative too.
if ($data->timeshift) {
$plugintypestrkey = 'type'.$this->type;
if (get_string_manager()->string_exists($plugintypestrkey, 'assignment')) {
$typestr = get_string_manager()->get_string($plugintypestrkey, 'assignment');
} else {
$typestr = get_string_manager()->get_string($plugintypestrkey, 'assignment_'.$this->type);
}
shift_course_mod_dates('assignment',
array('timedue', 'timeavailable'),
$data->timeshift,
$data->courseid);
$status[] = array('component' => get_string('modulenameplural', 'assignment'),
'item' => get_string('datechanged').': '.$typestr,
'error' => false);
}
return $status;
}