]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-10084 propogate course id through calendar pages to ensure consistent display...
authordwoolhead <dwoolhead>
Fri, 22 Jun 2007 13:30:22 +0000 (13:30 +0000)
committerdwoolhead <dwoolhead>
Fri, 22 Jun 2007 13:30:22 +0000 (13:30 +0000)
calendar/lib.php
calendar/view.php

index 68202713f58a82248b1ae0ca2fb2e71c52597506..867b966d7adebf79fe382ecee514c0f02b40855f 100644 (file)
@@ -518,9 +518,13 @@ function calendar_print_event($event) {
     echo format_text($event->description, FORMAT_HTML);
     if (calendar_edit_event_allowed($event)) {
         echo '<div class="commands">';
+        $calendarcourseid = '';
+        if (!empty($event->calendarcourseid)) {
+            $calendarcourseid = '&amp;course='.$event->calendarcourseid;
+        }
         if (empty($event->cmid)) {
-            $editlink   = CALENDAR_URL.'event.php?action=edit&amp;id='.$event->id;
-            $deletelink = CALENDAR_URL.'event.php?action=delete&amp;id='.$event->id;
+            $editlink   = CALENDAR_URL.'event.php?action=edit&amp;id='.$event->id.$calendarcourseid;
+            $deletelink = CALENDAR_URL.'event.php?action=delete&amp;id='.$event->id.$calendarcourseid;
         } else {
             $editlink   = $CFG->wwwroot.'/course/mod.php?update='.$event->cmid.'&amp;return=true&amp;sesskey='.$USER->sesskey;
             $deletelink = $CFG->wwwroot.'/course/mod.php?delete='.$event->cmid.'&amp;sesskey='.$USER->sesskey;;
@@ -670,7 +674,7 @@ function calendar_top_controls($type, $data) {
             $nextlink = calendar_get_link_next(get_string('monthnext', 'access'), 'index.php?', 0, $nextmonth, $nextyear, $accesshide=true);
             $prevlink = calendar_get_link_previous(get_string('monthprev', 'access'), 'index.php?', 0, $prevmonth, $prevyear, true);
             $content .= "\n".'<div class="calendar-controls">'. $prevlink;
-            $content .= '<span class="hide"> | </span><span class="current"><a href="'.calendar_get_link_href(CALENDAR_URL.'view.php?view=month&amp;', 1, $data['m'], $data['y']).'">'.userdate($time, get_string('strftimemonthyear')).'</a></span>';
+            $content .= '<span class="hide"> | </span><span class="current"><a href="'.calendar_get_link_href(CALENDAR_URL.'view.php?view=month'.$courseid.'&amp;', 1, $data['m'], $data['y']).'">'.userdate($time, get_string('strftimemonthyear')).'</a></span>';
             $content .= '<span class="hide"> | </span>'. $nextlink ."\n";
             $content .= "<span class=\"clearer\"><!-- --></span></div>\n";
         break;
@@ -680,7 +684,7 @@ function calendar_top_controls($type, $data) {
             $nextlink = calendar_get_link_next(get_string('monthnext', 'access'), 'view.php?id='.$data['id'].'&amp;', 0, $nextmonth, $nextyear, $accesshide=true);
             $prevlink = calendar_get_link_previous(get_string('monthprev', 'access'), 'view.php?id='.$data['id'].'&amp;', 0, $prevmonth, $prevyear, true);
             $content .= "\n".'<div class="calendar-controls">'. $prevlink;
-            $content .= '<span class="hide"> | </span><span class="current"><a href="'.calendar_get_link_href(CALENDAR_URL.'view.php?view=month&amp;course='.$data['id'].'&amp;', 1, $data['m'], $data['y']).'">'.userdate($time, get_string('strftimemonthyear')).'</a></span>';
+            $content .= '<span class="hide"> | </span><span class="current"><a href="'.calendar_get_link_href(CALENDAR_URL.'view.php?view=month'.$courseid.'&amp;', 1, $data['m'], $data['y']).'">'.userdate($time, get_string('strftimemonthyear')).'</a></span>';
             $content .= '<span class="hide"> | </span>'. $nextlink ."\n";
             $content .= "<span class=\"clearer\"><!-- --></span></div>\n";
         break;
index b12d827eeac6e79a8fadac297f04e36f3161d0ca..7ecc0960f4909cba8614bfb0171d06b737e54039 100644 (file)
@@ -268,6 +268,7 @@ function calendar_show_day($d, $m, $y, $courses, $groups, $users, $courseid) {
             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