From 9c48354debbb374d18f456a248af839e8d530edb Mon Sep 17 00:00:00 2001 From: stronk7 Date: Fri, 9 Apr 2004 23:55:02 +0000 Subject: [PATCH] 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 :-) --- mod/assignment/lib.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index a59aadc04b..15f7fb7dcc 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -96,12 +96,21 @@ function assignment_delete_instance($id) { return $result; } -function assignment_refresh_events() { +function assignment_refresh_events($courseid = 0) { // This standard function will check all instances of this module // 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")) { - return true; + if ($courseid == 0) { + if (! $assignments = get_records("assignment")) { + return true; + } + } else { + if (! $assignments = get_records("assignment", "course", $courseid)) { + return true; + } } foreach ($assignments as $assignment) { -- 2.39.5