Permalink
Browse files

MDL-25853 calendar: Fixed broken previous/next links

  • Loading branch information...
1 parent b3778a0 commit 769c73ae6c37902d3c6afcf6c0a16d9f78cb29db @FMCorz FMCorz committed Jan 30, 2013
Showing with 6 additions and 5 deletions.
  1. +6 −5 calendar/lib.php
View
11 calendar/lib.php
@@ -798,7 +798,7 @@ function calendar_get_events_by_id($eventids) {
* @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;
@@ -821,6 +821,7 @@ function calendar_top_controls($type, $data) {
$data['m'] = $date['mon'];
$data['y'] = $date['year'];
+ $urlbase = $PAGE->url;
//Accessibility: calendar block controls, replaced <table> with <div>.
//$nexttext = link_arrow_right(get_string('monthnext', 'access'), $url='', $accesshide=true);
@@ -830,8 +831,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'])) {
@@ -857,8 +858,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'].'&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);
+ $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'])) {

0 comments on commit 769c73a

Please sign in to comment.