mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
Modified the function. Now it accepts a courseid to restrict the check
to assignments belonging to one exact course. if not specified all assignments in site are checked (old approach). This function in used by restore_refresh_events() to recalculate module events. Perhaps it should become a standard function in NEWMODULE to allow new modules implement it. Ciao :-)
This commit is contained in:
parent
df9a165ecc
commit
9c48354deb
1 changed files with 12 additions and 3 deletions
|
@ -96,12 +96,21 @@ function assignment_delete_instance($id) {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function assignment_refresh_events() {
|
function assignment_refresh_events($courseid = 0) {
|
||||||
// This standard function will check all instances of this module
|
// This standard function will check all instances of this module
|
||||||
// and make sure there are up-to-date events created for each of them.
|
// and make sure there are up-to-date events created for each of them.
|
||||||
|
// If courseid = 0, then every assignment event in the site is checked, else
|
||||||
|
// only assignment events belonging to the course specified are checked.
|
||||||
|
// This function is used, in its new format, by restore_refresh_events()
|
||||||
|
|
||||||
if (! $assignments = get_records("assignment")) {
|
if ($courseid == 0) {
|
||||||
return true;
|
if (! $assignments = get_records("assignment")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (! $assignments = get_records("assignment", "course", $courseid)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($assignments as $assignment) {
|
foreach ($assignments as $assignment) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue