From 8a2c41aa28b7cfa5b415263e262dd83fb9b2949d Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Wed, 30 Jan 2013 08:59:11 +0800 Subject: [PATCH] MDL-25853 calendar: Fixed broken previous/next links --- calendar/lib.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/calendar/lib.php b/calendar/lib.php index a637eae0cc2..597644669de 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -729,7 +729,7 @@ function calendar_get_events($tstart, $tend, $users, $groups, $courses, $withdur * @return string $content return available control for the calender in html */ function calendar_top_controls($type, $data) { - global $CFG; + global $CFG, $PAGE; $content = ''; if(!isset($data['d'])) { $data['d'] = 1; @@ -752,6 +752,7 @@ function calendar_top_controls($type, $data) { $data['m'] = $date['mon']; $data['y'] = $date['year']; + $urlbase = $PAGE->url; //Accessibility: calendar block controls, replaced with
. //$nexttext = link_arrow_right(get_string('monthnext', 'access'), $url='', $accesshide=true); @@ -761,8 +762,8 @@ function calendar_top_controls($type, $data) { case 'frontpage': list($prevmonth, $prevyear) = calendar_sub_month($data['m'], $data['y']); list($nextmonth, $nextyear) = calendar_add_month($data['m'], $data['y']); - $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); + $nextlink = calendar_get_link_next(get_string('monthnext', 'access'), $urlbase, 0, $nextmonth, $nextyear, true); + $prevlink = calendar_get_link_previous(get_string('monthprev', 'access'), $urlbase, 0, $prevmonth, $prevyear, true); $calendarlink = calendar_get_link_href(new moodle_url(CALENDAR_URL.'view.php', array('view'=>'month')), 1, $data['m'], $data['y']); if (!empty($data['id'])) { @@ -788,8 +789,8 @@ function calendar_top_controls($type, $data) { case 'course': list($prevmonth, $prevyear) = calendar_sub_month($data['m'], $data['y']); list($nextmonth, $nextyear) = calendar_add_month($data['m'], $data['y']); - $nextlink = calendar_get_link_next(get_string('monthnext', 'access'), 'view.php?id='.$data['id'].'&', 0, $nextmonth, $nextyear, $accesshide=true); - $prevlink = calendar_get_link_previous(get_string('monthprev', 'access'), 'view.php?id='.$data['id'].'&', 0, $prevmonth, $prevyear, true); + $nextlink = calendar_get_link_next(get_string('monthnext', 'access'), $urlbase, 0, $nextmonth, $nextyear, true); + $prevlink = calendar_get_link_previous(get_string('monthprev', 'access'), $urlbase, 0, $prevmonth, $prevyear, true); $calendarlink = calendar_get_link_href(new moodle_url(CALENDAR_URL.'view.php', array('view'=>'month')), 1, $data['m'], $data['y']); if (!empty($data['id'])) {