From b3cc742cf99479464678ea09cb9720920348e139 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Fri, 25 Apr 2003 23:17:53 +0000 Subject: [PATCH] Avoid showing course updates (add, update, delete) about hidden mods. Bug #367 --- course/lib.php | 50 +++++++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/course/lib.php b/course/lib.php index 357e896af0..c869bc0561 100644 --- a/course/lib.php +++ b/course/lib.php @@ -346,27 +346,35 @@ function print_recent_activity($course) { if ($log->action == "add mod" or $log->action == "update mod" or $log->action == "delete mod") { $info = split(" ", $log->info); $modname = get_field($info[0], "name", "id", $info[1]); - - switch ($log->action) { - case "add mod": - $stradded = get_string("added", "moodle", get_string("modulename", $info[0])); - $changelist["$log->info"] = array ("operation" => "add", "text" => "$stradded:
wwwroot/course/$log->url\">$modname"); - break; - case "update mod": - $strupdated = get_string("updated", "moodle", get_string("modulename", $info[0])); - if (empty($changelist["$log->info"])) { - $changelist["$log->info"] = array ("operation" => "update", "text" => "$strupdated:
wwwroot/course/$log->url\">$modname"); - } - break; - case "delete mod": - if (!empty($changelist["$log->info"]["operation"]) and - $changelist["$log->info"]["operation"] == "add") { - $changelist["$log->info"] = NULL; - } else { - $strdeleted = get_string("deletedactivity", "moodle", get_string("modulename", $info[0])); - $changelist["$log->info"] = array ("operation" => "delete", "text" => $strdeleted); - } - break; + //Create a temp valid module structure (course,id) + $tempmod->course = $log->course; + $tempmod->id = $info[1]; + //Obtain the visible property from the instance + $modvisible = instance_is_visible($info[0],$tempmod); + + //Only if the mod is visible + if ($modvisible) { + switch ($log->action) { + case "add mod": + $stradded = get_string("added", "moodle", get_string("modulename", $info[0])); + $changelist["$log->info"] = array ("operation" => "add", "text" => "$stradded:
wwwroot/course/$log->url\">$modname"); + break; + case "update mod": + $strupdated = get_string("updated", "moodle", get_string("modulename", $info[0])); + if (empty($changelist["$log->info"])) { + $changelist["$log->info"] = array ("operation" => "update", "text" => "$strupdated:
wwwroot/course/$log->url\">$modname"); + } + break; + case "delete mod": + if (!empty($changelist["$log->info"]["operation"]) and + $changelist["$log->info"]["operation"] == "add") { + $changelist["$log->info"] = NULL; + } else { + $strdeleted = get_string("deletedactivity", "moodle", get_string("modulename", $info[0])); + $changelist["$log->info"] = array ("operation" => "delete", "text" => $strdeleted); + } + break; + } } } } -- 2.39.5