]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-10048, revert some changes in courses regaring coloring of courses
authortoyomoyo <toyomoyo>
Tue, 9 Oct 2007 04:02:43 +0000 (04:02 +0000)
committertoyomoyo <toyomoyo>
Tue, 9 Oct 2007 04:02:43 +0000 (04:02 +0000)
calendar/lib.php
calendar/view.php
theme/standard/styles_color.css
theme/standard/styles_layout.css

index a0f03139359e33341afe678a7a563e5ce41704cf..5474d8e96ba5249e2499a2cca32fc2468a339c45 100644 (file)
@@ -62,8 +62,6 @@ define ('CALENDAR_URL', $CFG->wwwroot.'/calendar/');
 define ('CALENDAR_TF_24', '%H:%M');
 define ('CALENDAR_TF_12', '%I:%M %p');
 
-define ('CALENDAR_MAXCOURSES', 3);
-
 $CALENDARDAYS = array('sunday','monday','tuesday','wednesday','thursday','friday','saturday');
 
 
@@ -153,9 +151,6 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y
     // Set event course class for course events
     if (!empty($events)) {
         foreach ($events as $eventid => $event) {
-            if($event->courseid != 0 && $event->courseid != SITEID && $event->groupid == 0) {
-                $event->class = 'event_course'.array_search($event->courseid, $courses) % CALENDAR_MAXCOURSES;
-            }
             if (!empty($event->modulename)) {
                 $cm = get_coursemodule_from_instance($event->modulename, $event->instance);
                 if (!groups_course_module_visible($cm)) {
@@ -519,20 +514,7 @@ function calendar_print_event($event) {
 
     echo '</td></tr>';
     echo '<tr><td class="side">&nbsp;</td>';
-
-    // If event has a class set then add it to the event <td> tag
-    $eventclass='';
-    if (!empty($event->class)) {
-        $eventclass = ' '.$event->class;
-    }
-
-    if (isset($event->cssclass)) {
-        $eclass = $event->cssclass.$eventclass;
-    } else {
-        $eclass = $eventclass;
-    }
-
-    echo '<td class="description '.$eclass.'">';
+    echo '<td class="description '.$event->cssclass.'">';
     echo format_text($event->description, FORMAT_HTML);
     if (calendar_edit_event_allowed($event)) {
         echo '<div class="commands">';
@@ -793,101 +775,46 @@ function calendar_filter_controls($type, $vars = NULL, $course = NULL, $courses
         $content .= '<td style="width: 11px;"><img src="'.$CFG->pixpath.'/t/show.gif" class="iconsmall" alt="'.get_string('show').'" title="'.get_string('tt_showglobal', 'calendar').'" style="cursor:pointer" onclick="location.href='."'".CALENDAR_URL.'set.php?var=showglobal'.$getvars."'".'" /></td>';
         $content .= '<td><a href="'.CALENDAR_URL.'set.php?var=showglobal'.$getvars.'" title="'.get_string('tt_showglobal', 'calendar').'">'.get_string('global', 'calendar').'</a></td>'."\n";
     }
-    $tr = '';
+    if($SESSION->cal_show_course) {
+        $content .= '<td class="event_course" style="width: 11px;"><img src="'.$CFG->pixpath.'/t/hide.gif" class="iconsmall" alt="'.get_string('hide').'" /></td>';
+        $content .= '<td><a href="'.CALENDAR_URL.'set.php?var=showcourses'.$getvars.'" title="'.get_string('tt_hidecourse', 'calendar').'">'.get_string('courseevents', 'calendar').'</a></td>'."\n";
+    }
+    else {
+        $content .= '<td style="width: 11px;"><img src="'.$CFG->pixpath.'/t/show.gif" class="iconsmall" alt="'.get_string('hide').'" /></td>';
+        $content .= '<td><a href="'.CALENDAR_URL.'set.php?var=showcourses'.$getvars.'" title="'.get_string('tt_showcourse', 'calendar').'">'.get_string('courseevents', 'calendar').'</a></td>'."\n";
+    }
 
-    if(!empty($USER->id) && !isguest()) {
 
-        $content .= $tr;
-        $tr = $tr ? '' : "</tr>\n<tr>";
+    if(!empty($USER->id) && !isguest()) {
+        $content .= "</tr>\n<tr>";
 
         if($groupevents) {
-
             // This course MIGHT have group events defined, so show the filter
             if($SESSION->cal_show_groups) {
-                $content .= '<td class="eventskey event_group" style="width: 11px;"><img src="'.$CFG->pixpath.'/t/hide.gif" class="iconsmall" alt="'.get_string('hide').'" title="'.get_string('tt_hidegroups', 'calendar').'" style="cursor:pointer" onclick="location.href='."'".CALENDAR_URL.'set.php?var=showgroups'.$getvars."'".'" /></td>';
-                $content .= '<td><a href="'.CALENDAR_URL.'set.php?var=showgroups'.$getvars.'" title="'.get_string('tt_hidegroups', 'calendar').'">'.get_string('group', 'calendar').'</a></td>'."\n";
+                $content .= '<td class="event_group" style="width: 11px;"><img src="'.$CFG->pixpath.'/t/hide.gif" class="iconsmall" alt="'.get_string('hide').'" /></td>';
+                $content .= '<td><a href="'.CALENDAR_URL.'set.php?var=showgroups'.$getvars.'" title="'.get_string('tt_hidegroups', 'calendar').'">'.get_string('groupevents', 'calendar').'</a></td>'."\n";
             } else {
-                $content .= '<td style="width: 11px;"><img src="'.$CFG->pixpath.'/t/show.gif" class="iconsmall" alt="'.get_string('show').'" title="'.get_string('tt_showgroups', 'calendar').'" style="cursor:pointer" onclick="location.href='."'".CALENDAR_URL.'set.php?var=showgroups'.$getvars."'".'" /></td>';
-                $content .= '<td><a href="'.CALENDAR_URL.'set.php?var=showgroups'.$getvars.'" title="'.get_string('tt_showgroups', 'calendar').'">'.get_string('group', 'calendar').'</a></td>'."\n";
+                $content .= '<td style="width: 11px;"><img src="'.$CFG->pixpath.'/t/show.gif" class="iconsmall" alt="'.get_string('show').'" /></td>';
+                $content .= '<td><a href="'.CALENDAR_URL.'set.php?var=showgroups'.$getvars.'" title="'.get_string('tt_showgroups', 'calendar').'">'.get_string('groupevents', 'calendar').'</a></td>'."\n";
+            }
+            if ($SESSION->cal_show_user) {
+                $content .= '<td class="event_user" style="width: 11px;"><img src="'.$CFG->pixpath.'/t/hide.gif" class="iconsmall" alt="'.get_string('hide').'" /></td>';
+                $content .= '<td><a href="'.CALENDAR_URL.'set.php?var=showuser'.$getvars.'" title="'.get_string('tt_hideuser', 'calendar').'">'.get_string('userevents', 'calendar').'</a></td>'."\n";
+            } else {
+                $content .= '<td style="width: 11px;"><img src="'.$CFG->pixpath.'/t/show.gif" class="iconsmall" alt="'.get_string('show').'" /></td>';
+                $content .= '<td><a href="'.CALENDAR_URL.'set.php?var=showuser'.$getvars.'" title="'.get_string('tt_showuser', 'calendar').'">'.get_string('userevents', 'calendar').'</a></td>'."\n";
             }
-        } else {
 
+        } else {
             // This course CANNOT have group events, so lose the filter
             $content .= '<td style="width: 11px;"></td><td>&nbsp;</td>'."\n";
-        }
-
-        $content .= $tr;
-        $tr = $tr ? '' : "</tr>\n<tr>";
 
-        if ($SESSION->cal_show_user) {
-            $content .= '<td class="eventskey event_user" style="width: 11px;"><img src="'.$CFG->pixpath.'/t/hide.gif" class="iconsmall" alt="'.get_string('hide').'" title="'.get_string('tt_hideuser', 'calendar').'" style="cursor:pointer" onclick="location.href='."'".CALENDAR_URL.'set.php?var=showuser'.$getvars."'".'" /></td>';
-            $content .= '<td><a href="'.CALENDAR_URL.'set.php?var=showuser'.$getvars.'" title="'.get_string('tt_hideuser', 'calendar').'">'.get_string('user', 'calendar').'</a></td>'."\n";
-        } else {
-            $content .= '<td style="width: 11px;"><img src="'.$CFG->pixpath.'/t/show.gif" class="iconsmall" alt="'.get_string('show').'" title="'.get_string('tt_showuser', 'calendar').'" style="cursor:pointer" onclick="location.href='."'".CALENDAR_URL.'set.php?var=showuser'.$getvars."'".'" /></td>';
-            $content .= '<td><a href="'.CALENDAR_URL.'set.php?var=showuser'.$getvars.'" title="'.get_string('tt_showuser', 'calendar').'">'.get_string('user', 'calendar').'</a></td>'."\n";
-        }
-    }
-
-    // Remove global SITE ID from courses array as do not want to display this
-    if (!empty($courses)) {
-        $key = array_search(SITEID, $courses);
-        if ($key !== false) {
-            unset($courses[$key]);
-        }
-    }
-
-    if (empty($courses) || count($courses) == 1) {
-
-        // If not multiple courses then just display default single course colour highlighting
-        $content .= $tr;
-        $tr = $tr ? '' : "</tr>\n<tr>";
-
-        if($SESSION->cal_show_course) {
-            $content .= '<td class="eventskey event_course" style="width: 11px;"><img src="'.$CFG->pixpath.'/t/hide.gif" class="iconsmall" alt="'.get_string('hide').'" title="'.get_string('tt_hidecourse', 'calendar').'" style="cursor:pointer" onclick="location.href='."'".CALENDAR_URL.'set.php?var=showcourses'.$getvars."'".'" /></td>';
-            $content .= '<td><a href="'.CALENDAR_URL.'set.php?var=showcourses'.$getvars.'" title="'.get_string('tt_hidecourse', 'calendar').'">'.get_string('course', 'calendar').'</a></td>'."\n";
-        }
-        else {
-            $content .= '<td style="width: 11px;"><img src="'.$CFG->pixpath.'/t/show.gif" class="iconsmall" alt="'.get_string('hide').'" title="'.get_string('tt_showcourse', 'calendar').'" style="cursor:pointer" onclick="location.href='."'".CALENDAR_URL.'set.php?var=showcourses'.$getvars."'".'" /></td>';
-            $content .= '<td><a href="'.CALENDAR_URL.'set.php?var=showcourses'.$getvars.'" title="'.get_string('tt_showcourse', 'calendar').'">'.get_string('course', 'calendar').'</a></td>'."\n";
-        }
-    } else {
-
-        // Otherwise display list of course shortnames and relevant colours
-        // Get list of course shortnames (Limit to 12 for now - who would have more than that?)
-        $select = 'id in ('.implode(',', $courses).')';
-        $sort = 'id';
-        $fields = 'id, shortname';
-        $courseshortnames = get_records_select('course', $select, $sort, $fields, 0, 12);
-
-        for ($i = 0; $i < CALENDAR_MAXCOURSES; $i++) {
-
-            // Concatenate shortnames if there are more than 3 courses
-            $strshortnames = '';
-            $n = 0;
-            for ($j = $i; $j < count($courses); $j += CALENDAR_MAXCOURSES) {
-                $strshortnames .= ', <a title="" href="'.$CFG->wwwroot.'/course/view.php?id='.$courses[$j].'">'.(!empty($courseshortnames[$courses[$j]]->shortname) ? $courseshortnames[$courses[$j]]->shortname : $courses[$j]).'</a>';
-                $n++;
-            }
-
-            if ($n) {
-
-                $content .= $tr;
-                $tr = $tr ? '' : "</tr>\n<tr>";
-
-                if ($n < 2) {
-                    $strcourse = get_string('course', 'calendar');
-                } else {
-                    $strcourse = get_string('courses', 'calendar');
-                }
-
-                if($SESSION->cal_show_course) {
-                    $content .= '<td class="eventskey event_course'.$i.'" style="width: 11px;"><img src="'.$CFG->pixpath.'/t/hide.gif" class="iconsmall" alt="'.get_string('hide').'" title="'.get_string('tt_hidecourse', 'calendar').'" style="cursor:pointer" onclick="location.href='."'".CALENDAR_URL.'set.php?var=showcourses'.$getvars."'".'" /></td>';
-                    $content .= '<td><a href="'.CALENDAR_URL.'set.php?var=showcourses'.$getvars.'" title="'.get_string('tt_hidecourse', 'calendar').'">'.$strcourse.'</a>: '.substr($strshortnames, 2).'</td>'."\n";
-                }
-                else {
-                    $content .= '<td style="width: 11px;"><img src="'.$CFG->pixpath.'/t/show.gif" class="iconsmall" alt="'.get_string('hide').'" title="'.get_string('tt_showcourse', 'calendar').'" style="cursor:pointer" onclick="location.href='."'".CALENDAR_URL.'set.php?var=showcourses'.$getvars."'".'" /></td>';
-                    $content .= '<td><a href="'.CALENDAR_URL.'set.php?var=showcourses'.$getvars.'" title="'.get_string('tt_showcourse', 'calendar').'">'.$strcourse.'</a>: '.substr($strshortnames, 2).'</td>'."\n";
-                }
+            if($SESSION->cal_show_user) {
+                $content .= '<td class="event_user" style="width: 11px;"><img src="'.$CFG->pixpath.'/t/hide.gif" class="iconsmall" alt="'.get_string('hide').'" /></td>';
+                $content .= '<td><a href="'.CALENDAR_URL.'set.php?var=showuser'.$getvars.'" title="'.get_string('tt_hideuser', 'calendar').'">'.get_string('userevents', 'calendar').'</a></td>'."\n";
+            } else {
+                $content .= '<td style="width: 11px;"><img src="'.$CFG->pixpath.'/t/show.gif" class="iconsmall" alt="'.get_string('show').'" /></td>';
+                $content .= '<td><a href="'.CALENDAR_URL.'set.php?var=showuser'.$getvars.'" title="'.get_string('tt_showuser', 'calendar').'">'.get_string('userevents', 'calendar').'</a></td>'."\n";
             }
         }
     }
@@ -1103,7 +1030,7 @@ function calendar_events_by_day($events, $month, $year, &$eventsbyday, &$duratio
             else if($event->courseid != 0 && $event->courseid != SITEID && $event->groupid == 0) {
                 $typesbyday[$eventdaystart]['startcourse'] = true;
                 // Set event class for course event
-                $events[$event->id]->class = 'event_course'.array_search($event->courseid, $courses) % CALENDAR_MAXCOURSES;
+                //$events[$event->id]->class = 'event_course';
             }
             else if($event->groupid) {
                 $typesbyday[$eventdaystart]['startgroup'] = true;
index d45f055e20fb159a269730b7fec785aad39086f2..3e382199cc655b0de5188c0b80619d5291f64226 100644 (file)
@@ -268,10 +268,6 @@ function calendar_show_day($d, $m, $y, $courses, $groups, $users, $courseid) {
         // First, print details about events that start today
         foreach ($events as $event) {
 
-            // Set event course class if a course event
-            if($event->courseid != 0 && $event->courseid != SITEID && $event->groupid == 0) {
-                $event->class = 'event_course'.array_search($event->courseid, $courses) % CALENDAR_MAXCOURSES;
-            }
             $event->calendarcourseid = $courseid;
 
             if ($event->timestart >= $starttime && $event->timestart <= $endtime) {  // Print it now
@@ -451,6 +447,15 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users, $course
 
         // Special visual fx if an event is defined
         if(isset($eventsbyday[$day])) {
+            if(isset($typesbyday[$day]['startglobal'])) {       
+                   $class .= ' event_global';   
+               } else if(isset($typesbyday[$day]['startcourse'])) {     
+                   $class .= ' event_course';   
+               } else if(isset($typesbyday[$day]['startgroup'])) {      
+                  $class .= ' event_group';     
+               } else if(isset($typesbyday[$day]['startuser'])) {       
+                   $class .= ' event_user';     
+               }    
             if(count($eventsbyday[$day]) == 1) {
                 $title = get_string('oneevent', 'calendar');
             }
@@ -522,6 +527,55 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users, $course
 
     echo "</table>\n"; // Tabular display of days ends
 
+       // OK, now for the filtering display     
+            echo '<div class="filters"><table><tr>';    
+                
+            // Global events    
+            if($SESSION->cal_show_global) {     
+                echo '<td class="event_global" style="width: 8px;"></td><td><strong>'.get_string('globalevents', 'calendar').':</strong> ';     
+                echo get_string('shown', 'calendar').' (<a href="'.CALENDAR_URL.'set.php?var=showglobal&amp;'.$getvars.'">'.get_string('clickhide', 'calendar').'</a>)</td>'."\n";      
+            }   
+            else {      
+                echo '<td style="width: 8px;"></td><td><strong>'.get_string('globalevents', 'calendar').':</strong> ';          
+                echo get_string('hidden', 'calendar').' (<a href="'.CALENDAR_URL.'set.php?var=showglobal&amp;'.$getvars.'">'.get_string('clickshow', 'calendar').'</a>)</td>'."\n";     
+            }   
+                
+            // Course events    
+            if(!empty($SESSION->cal_show_course)) {     
+                echo '<td class="event_course" style="width: 8px;"></td><td><strong>'.get_string('courseevents', 'calendar').':</strong> ';     
+                echo get_string('shown', 'calendar').' (<a href="'.CALENDAR_URL.'set.php?var=showcourses&amp;'.$getvars.'">'.get_string('clickhide', 'calendar').'</a>)</td>'."\n";     
+            }   
+            else {      
+                echo '<td style="width: 8px;"></td><td><strong>'.get_string('courseevents', 'calendar').':</strong> ';          
+                echo get_string('hidden', 'calendar').' (<a href="'.CALENDAR_URL.'set.php?var=showcourses&amp;'.$getvars.'">'.get_string('clickshow', 'calendar').'</a>)</td>'."\n";    
+            }   
+                
+            echo "</tr>\n";     
+                
+            if(!empty($USER->id) && !isguest()) {       
+                echo '<tr>';    
+                // Group events         
+                if($SESSION->cal_show_groups) {         
+                    echo '<td class="event_group" style="width: 8px;"></td><td><strong>'.get_string('groupevents', 'calendar').':</strong> ';   
+                    echo get_string('shown', 'calendar').' (<a href="'.CALENDAR_URL.'set.php?var=showgroups&amp;'.$getvars.'">'.get_string('clickhide', 'calendar').'</a>)</td>'."\n";          
+                }       
+                else {          
+                    echo '<td style="width: 8px;"></td><td><strong>'.get_string('groupevents', 'calendar').':</strong> ';       
+                    echo get_string('hidden', 'calendar').' (<a href="'.CALENDAR_URL.'set.php?var=showgroups&amp;'.$getvars.'">'.get_string('clickshow', 'calendar').'</a>)</td>'."\n";         
+                }       
+                // User events          
+                if($SESSION->cal_show_user) {   
+                    echo '<td class="event_user" style="width: 8px;"></td><td><strong>'.get_string('userevents', 'calendar').':</strong> ';     
+                    echo get_string('shown', 'calendar').' (<a href="'.CALENDAR_URL.'set.php?var=showuser&amp;'.$getvars.'">'.get_string('clickhide', 'calendar').'</a>)</td>'."\n";    
+                }       
+                else {          
+                    echo '<td style="width: 8px;"></td><td><strong>'.get_string('userevents', 'calendar').':</strong> ';        
+                    echo get_string('hidden', 'calendar').' (<a href="'.CALENDAR_URL.'set.php?var=showuser&amp;'.$getvars.'">'.get_string('clickshow', 'calendar').'</a>)</td>'."\n";   
+                }       
+                echo "</tr>\n";         
+            }   
+                
+            echo '</table></div>';
 }
 
 function calendar_show_upcoming_events($courses, $groups, $users, $futuredays, $maxevents, $courseid) {
@@ -553,12 +607,6 @@ function calendar_show_upcoming_events($courses, $groups, $users, $futuredays, $
 
         echo '<div class="eventlist">';
         foreach ($events as $event) {
-
-            // Set event course class if a course event
-            if($event->courseid != 0 && $event->courseid != SITEID && $event->groupid == 0) {
-                $event->class = 'event_course'.array_search($event->courseid, $courses) % CALENDAR_MAXCOURSES;
-            }
-
             calendar_print_event($event);
         }
         echo '</div>';
index 0a157220b96abff9b1251ea720a7b9019ca2d985..1a5f703d5103a6826beffef7d76c2374b8b6ace6 100644 (file)
@@ -479,26 +479,6 @@ table.minicalendar {
   background-color:#FFD3BD;
 }
 
-#calendar .event_course0,
-.minicalendar .event_course0,
-.block_calendar_month .event_course0 {
-  border-color:#FFD3BD !important; /* #EEC2AC */
-  background-color:#FFD3BD;
-}
-
-#calendar .event_course1,
-.minicalendar .event_course1,
-.block_calendar_month .event_course1 {
-  border-color:#99CCFF !important; /* #EEC2AC */
-  background-color:#99CCFF;
-}
-
-#calendar .event_course2,
-.minicalendar .event_course2,
-.block_calendar_month .event_course2 {
-  border-color:#FFFFCC !important; /* #EEC2AC */
-  background-color:#FFFFCC;
-}
 
 #calendar .event_group,
 .minicalendar .event_group,
index ad269529d296e2a4f36d5da9d2d27b9a6eab570e..40e54537f7ecbff863e5b920ce74e7f91d708a0f 100644 (file)
@@ -1621,16 +1621,10 @@ table.minicalendar th {
 
 #calendar .event_global,
 #calendar .event_course,
-#calendar .event_course0,
-#calendar .event_course1,
-#calendar .event_course2,
 #calendar .event_group,
 #calendar .event_user,
 .minicalendar .event_global,
 .minicalendar .event_course,
-.minicalendar .event_course0,
-.minicalendar .event_course1,
-.minicalendar .event_course2,
 .minicalendar .event_group,
 .minicalendar .event_user {
   border:2px solid !important;
@@ -1638,16 +1632,10 @@ table.minicalendar th {
 
 #calendar .duration_global,
 #calendar .duration_course,
-#calendar .duration_course0,
-#calendar .duration_course1,
-#calendar .duration_course2,
 #calendar .duration_group,
 #calendar .duration_user,
 .minicalendar .duration_global,
 .minicalendar .duration_course,
-.minicalendar .duration_course0,
-.minicalendar .duration_course1,
-.minicalendar .duration_course2,
 .minicalendar .duration_group,
 .minicalendar .duration_user
 {