From: moodler Date: Mon, 24 May 2004 03:39:05 +0000 (+0000) Subject: Fixes to icons in upcoming events and popups X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=41d30a8e528e99e0888e5dd9bf9f1a8f195333f4;p=moodle.git Fixes to icons in upcoming events and popups --- diff --git a/calendar/lib.php b/calendar/lib.php index d4d5f86d82..380233d2cd 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -168,12 +168,29 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y // OverLib popup $popupcontent = ''; foreach($eventsbyday[$day] as $eventid) { - if(!empty($events[$eventid]->modulename)) { - $popupcontent .= '
modpixpath.'/'.$events[$eventid]->modulename.'/icon.gif\\\' style=\\\'vertical-align: middle; margin-right: 4px;\\\' alt=\\\''.$events[$eventid]->modulename.'\\\' />'.addslashes(htmlspecialchars($events[$eventid]->name)).'
'; + if (!isset($events[$eventid])) { + continue; } - else { - $popupcontent .= '
pixpath.'/c/event.gif\\\' style=\\\'vertical-align: middle; margin-right: 4px;\\\' alt=\\\'\\\' />'.addslashes(htmlspecialchars($events[$eventid]->name)).'
'; + $event = $events[$eventid]; + + if(!empty($event->modulename)) { + $popupicon = $CFG->modpixpath.'/'.$event->modulename.'/icon.gif'; + $popupalt = $event->modulename; + + } else if ($event->courseid == 1) { // Site event + $popupicon = $CFG->pixpath.'/c/site.gif'; + $popupalt = ''; + } else if ($event->courseid > 1 and empty($event->groupid)) { // Course event + $popupicon = $CFG->pixpath.'/c/course.gif'; + $popupalt = ''; + } else if ($event->groupid) { // Group event + $popupicon = $CFG->pixpath.'/c/group.gif'; + $popupalt = ''; + } else if ($event->userid) { // User event + $popupicon = $CFG->pixpath.'/c/user.gif'; + $popupalt = ''; } + $popupcontent .= '
\\\''.$popupalt.'\\\''.addslashes(htmlspecialchars($event->name)).'
'; } $popupcaption = get_string('eventsfor', 'calendar', userdate($events[$eventid]->timestart, get_string('strftimedayshort'))); @@ -349,7 +366,7 @@ function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxeve $output[$outkey] = $event; // Grab the whole raw event by default // Now we know how to display the time, we have to see how to display the event - if(!empty($event->modulename)) { + if(!empty($event->modulename)) { // Activity event // The module name is set. I will assume that it has to be displayed, and // also that it is an automatically-generated event. And of course that the @@ -377,32 +394,28 @@ function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxeve - } else if($event->courseid == 1) { + } else if($event->courseid == 1) { // Site event $output[$outkey]->icon = ''; $output[$outkey]->time = $eventtime; - } else if($event->courseid > 1) { - // Course event + } else if($event->courseid > 1 and !$event->groupid) { // Course event calendar_get_course_cached($coursecache, $event->courseid); $output[$outkey]->icon = ''; $output[$outkey]->time = $eventtime; - $output[$outkey]->description = $event->description; $output[$outkey]->courselink = ''.$coursecache[$event->courseid]->fullname.''; - } else if($event->groupid) { - // Group event + } else if ($event->groupid) { // Group event $output[$outkey]->icon = ''; $output[$outkey]->time = $eventtime; - } else if($event->userid) { - // User event + } else if($event->userid) { // User event $output[$outkey]->icon = ''; $output[$outkey]->time = $eventtime; }