]> git.mjollnir.org Git - moodle.git/commitdiff
Fix for bug 1449
authormoodler <moodler>
Mon, 24 May 2004 01:44:48 +0000 (01:44 +0000)
committermoodler <moodler>
Mon, 24 May 2004 01:44:48 +0000 (01:44 +0000)
Hidden events are now never shown.

There is a new parameter in calendar_sql_where which can show them if necessary.

calendar/lib.php

index b5e47c5f8ca498b33702e6a14a2da8665e956a36..d4d5f86d820a6e570b04fa293a0991eb88185b76 100644 (file)
@@ -412,7 +412,7 @@ function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxeve
     return $output;
 }
 
-function calendar_sql_where($tstart, $tend, $users, $groups, $courses, $withduration = true) {
+function calendar_sql_where($tstart, $tend, $users, $groups, $courses, $withduration=true, $ignorehidden=true) {
     $whereclause = '';
     // Quick test
     if(is_bool($users) && is_bool($groups) && is_bool($courses)) {
@@ -464,6 +464,12 @@ function calendar_sql_where($tstart, $tend, $users, $groups, $courses, $withdura
         if(!empty($whereclause)) $whereclause .= ' OR';
         $whereclause .= ' groupid = 0 AND courseid != 0';
     }
+
+    if ($ignorehidden) {
+        if (!empty($whereclause)) $whereclause .= ' AND';
+        $whereclause .= ' visible = 1';
+    }
+
     if($withduration) {
         $timeclause = 'timestart + timeduration >= '.$tstart.' AND timestart <= '.$tend;
     }