mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 18:06:51 +02:00
MDL-31405 Assignment: Fixed date in reset to be called for every assignment
This commit is contained in:
parent
f8eff10319
commit
e63515ba93
5 changed files with 56 additions and 9 deletions
|
@ -5140,18 +5140,24 @@ function remove_course_contents($courseid, $showfeedback = true, array $options
|
|||
* @param array $fields array of date fields from mod table
|
||||
* @param int $timeshift time difference
|
||||
* @param int $courseid
|
||||
* @param int $modid (Optional) passed if specific mod instance in course needs to be updated.
|
||||
* @return bool success
|
||||
*/
|
||||
function shift_course_mod_dates($modname, $fields, $timeshift, $courseid) {
|
||||
function shift_course_mod_dates($modname, $fields, $timeshift, $courseid, $modid = 0) {
|
||||
global $CFG, $DB;
|
||||
include_once($CFG->dirroot.'/mod/'.$modname.'/lib.php');
|
||||
|
||||
$return = true;
|
||||
$params = array($timeshift, $courseid);
|
||||
foreach ($fields as $field) {
|
||||
$updatesql = "UPDATE {".$modname."}
|
||||
SET $field = $field + ?
|
||||
WHERE course=? AND $field<>0";
|
||||
$return = $DB->execute($updatesql, array($timeshift, $courseid)) && $return;
|
||||
if ($modid) {
|
||||
$updatesql .= ' AND id=?';
|
||||
$params[] = $modid;
|
||||
}
|
||||
$return = $DB->execute($updatesql, $params) && $return;
|
||||
}
|
||||
|
||||
$refreshfunction = $modname.'_refresh_events';
|
||||
|
|
|
@ -47,6 +47,8 @@ information provided here is intended especially for developers.
|
|||
backups which supports both compression formats; get_file_packer('application/vnd.moodle.backup').
|
||||
* New optional parameter to stored_file::get_content_file_handle to open file handle with 'gzopen' instead
|
||||
of 'fopen' to read gzip-compressed files if required.
|
||||
* shift_course_mod_dates() has been modified to accept optional mod instance id. If mod instance id is passed then
|
||||
dates changed will happen only on specific module instance and not on all instances of that module in course.
|
||||
|
||||
DEPRECATIONS:
|
||||
Various previously deprecated functions have now been altered to throw DEBUG_DEVELOPER debugging notices
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue