]> git.mjollnir.org Git - moodle.git/commitdiff
Avoid showing course updates (add, update, delete) about hidden mods. Bug #367
authorstronk7 <stronk7>
Fri, 25 Apr 2003 23:17:53 +0000 (23:17 +0000)
committerstronk7 <stronk7>
Fri, 25 Apr 2003 23:17:53 +0000 (23:17 +0000)
course/lib.php

index 357e896af0af638e1e4936263c71f88c057f5496..c869bc056191663e281fa4ebd646d5677f191028 100644 (file)
@@ -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:<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;
+                    }
                 }
             }
         }