Permalink
Browse files

MDL-28735 calendar: Fixing issues with course selection dropdown

  • Loading branch information...
1 parent bd44a3b commit f91b7ae26be4220963d8cef8114f64a4ca53ed5d @ankitagarwal ankitagarwal committed Apr 23, 2012
Showing with 11 additions and 4 deletions.
  1. +3 −1 calendar/renderer.php
  2. +7 −2 calendar/set.php
  3. +1 −1 calendar/view.php
View
4 calendar/renderer.php
@@ -135,7 +135,9 @@ public function complete_layout() {
* @return string
*/
public function fake_block_filters($courseid, $day, $month, $year, $view, $courses) {
- return html_writer::tag('div', calendar_filter_controls($this->page->url), array('class'=>'calendar_filters filters'));
+ $returnurl = $this->page->url;
+ $returnurl->param('course', $courseid);
+ return html_writer::tag('div', calendar_filter_controls($returnurl), array('class'=>'calendar_filters filters'));
}
/**
View
9 calendar/set.php
@@ -45,8 +45,13 @@
$var = required_param('var', PARAM_ALPHA);
$return = clean_param(base64_decode(required_param('return', PARAM_RAW)), PARAM_URL);
-
-$url = new moodle_url('/calendar/set.php', array('return'=>base64_encode($return),'var'=>$var, 'sesskey'=>sesskey()));
+$courseid = optional_param('id', -1, PARAM_INT);
+if ($courseid != -1) {
+ $return = new moodle_url($return, array('course' => $courseid));
+} else {
+ $return = new moodle_url($return);
+}
+$url = new moodle_url('/calendar/set.php', array('return'=>base64_encode($return->out(false)), 'course' => $courseid, 'var'=>$var, 'sesskey'=>sesskey()));
$PAGE->set_url($url);
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
View
2 calendar/view.php
@@ -127,7 +127,7 @@
echo $renderer->show_day($calendar);
break;
case 'month':
- echo $renderer->show_month_detailed($calendar);
+ echo $renderer->show_month_detailed($calendar, $url);
break;
case 'upcoming':
$defaultlookahead = CALENDAR_DEFAULT_UPCOMING_LOOKAHEAD;

0 comments on commit f91b7ae

Please sign in to comment.