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:<BR><A HREF=\"$CFG->wwwroot/course/$log->url\">$modname</A>");
- 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:<BR><A HREF=\"$CFG->wwwroot/course/$log->url\">$modname</A>");
- }
- 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:<BR><A HREF=\"$CFG->wwwroot/course/$log->url\">$modname</A>");
+ 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:<BR><A HREF=\"$CFG->wwwroot/course/$log->url\">$modname</A>");
+ }
+ 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;
+ }
}
}
}