Merge branch 'wip-mdl-31405-m25' of git://github.com/rajeshtaneja/moodle into MOODLE_25_STABLE
This commit is contained in:
@@ -82,6 +82,18 @@ function assign_reset_userdata($data) {
|
||||
$status = array_merge($status, $assignment->reset_userdata($data));
|
||||
}
|
||||
}
|
||||
// Updating dates - shift may be negative too.
|
||||
$componentstr = get_string('modulenameplural', 'assign');
|
||||
|
||||
if ($data->timeshift) {
|
||||
shift_course_mod_dates('assign',
|
||||
array('duedate', 'allowsubmissionsfromdate', 'cutoffdate'),
|
||||
$data->timeshift,
|
||||
$data->courseid);
|
||||
$status[] = array('component' => $componentstr,
|
||||
'item' => get_string('datechanged'),
|
||||
'error' => false);
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
||||
|
||||
@@ -706,16 +706,6 @@ class assign {
|
||||
assign_reset_gradebook($data->courseid);
|
||||
}
|
||||
}
|
||||
// Updating dates - shift may be negative too.
|
||||
if ($data->timeshift) {
|
||||
shift_course_mod_dates('assign',
|
||||
array('duedate', 'allowsubmissionsfromdate', 'cutoffdate'),
|
||||
$data->timeshift,
|
||||
$data->courseid);
|
||||
$status[] = array('component'=>$componentstr,
|
||||
'item'=>get_string('datechanged'),
|
||||
'error'=>false);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
@@ -239,12 +239,23 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase {
|
||||
$data->courseid = $this->course->id;
|
||||
$data->timeshift = 24*60*60;
|
||||
$this->setUser($this->editingteachers[0]);
|
||||
$assign->reset_userdata($data);
|
||||
assign_reset_userdata($data);
|
||||
$this->assertEquals(false, $assign->has_submissions_or_grades());
|
||||
|
||||
// Reload the instance data.
|
||||
$instance = $DB->get_record('assign', array('id'=>$assign->get_instance()->id));
|
||||
$this->assertEquals($now + 24*60*60, $instance->duedate);
|
||||
|
||||
// Create another assignment and make sure both get reset.
|
||||
$assignduedate = $instance->duedate;
|
||||
$assign2 = $this->create_instance(array('assignsubmission_onlinetext_enabled' => 1,
|
||||
'duedate' => $now));
|
||||
$data->timeshift = 4*24*60*60;
|
||||
assign_reset_userdata($data);
|
||||
$instance = $DB->get_record('assign', array('id' => $assign->get_instance()->id));
|
||||
$this->assertEquals($assignduedate + 4*24*60*60, $instance->duedate);
|
||||
$instance2 = $DB->get_record('assign', array('id' => $assign2->get_instance()->id));
|
||||
$this->assertEquals($now + 4*24*60*60, $instance2->duedate);
|
||||
}
|
||||
|
||||
public function test_plugin_settings() {
|
||||
|
||||
+16
-7
@@ -2369,13 +2369,6 @@ class assignment_base {
|
||||
assignment_reset_gradebook($data->courseid, $this->type);
|
||||
}
|
||||
}
|
||||
|
||||
/// 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;
|
||||
}
|
||||
|
||||
@@ -3888,6 +3881,22 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user