Skip to content
Permalink
Browse files

MDL-10048 General calendar view enhancements as per spec with regard …

…to event highlighting
  • Loading branch information
dwoolhead
dwoolhead committed Jun 13, 2007
1 parent edad8be commit bf9ae76c366c1b71ed2dd244e3dadadfc71d61c0
Showing with 8 additions and 6 deletions.
  1. +6 −4 calendar/lib.php
  2. +2 −2 calendar/view.php
@@ -62,6 +62,8 @@
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');
@@ -152,7 +154,7 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y
if (!empty($events)) {
foreach ($events as $event) {
if($event->courseid != 0 && $event->courseid != SITEID && $event->groupid == 0) {
$event->class = 'event_course'.array_search($event->courseid, $courses) % 3;
$event->class = 'event_course'.array_search($event->courseid, $courses) % CALENDAR_MAXCOURSES;
}
}
}
@@ -828,12 +830,12 @@ function calendar_filter_controls($type, $vars = NULL, $course = NULL, $courses
$fields = 'id, shortname';
$courseshortnames = get_records_select('course', $select, $sort, $fields, 0, 12);
for ($i = 0; $i < 3; $i++) {
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 += 3) {
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++;
}
@@ -1066,7 +1068,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) % 3;
$events[$event->id]->class = 'event_course'.array_search($event->courseid, $courses) % CALENDAR_MAXCOURSES;
}
else if($event->groupid) {
$typesbyday[$eventdaystart]['startgroup'] = true;
@@ -265,7 +265,7 @@ function calendar_show_day($d, $m, $y, $courses, $groups, $users) {
// 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) % 3;
$event->class = 'event_course'.array_search($event->courseid, $courses) % CALENDAR_MAXCOURSES;
}
if ($event->timestart >= $starttime && $event->timestart <= $endtime) { // Print it now
@@ -538,7 +538,7 @@ function calendar_show_upcoming_events($courses, $groups, $users, $futuredays, $
// 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) % 3;
$event->class = 'event_course'.array_search($event->courseid, $courses) % CALENDAR_MAXCOURSES;
}
calendar_print_event($event);

0 comments on commit bf9ae76

Please sign in to comment.
You can’t perform that action at this time.