MDL-28735 calendar: Fixing issues with course selection dropdown
authorAnkit Agarwal <ankit@moodle.com>
Mon, 23 Apr 2012 06:58:39 +0000 (14:58 +0800)
committerAnkit Agarwal <ankit@moodle.com>
Mon, 23 Apr 2012 07:10:35 +0000 (15:10 +0800)
calendar/renderer.php
calendar/set.php
calendar/view.php

index 4fe8301..a2f8a7b 100644 (file)
@@ -135,7 +135,9 @@ class core_calendar_renderer extends plugin_renderer_base {
      * @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'));
     }
 
     /**
index 2633369..c02069e 100644 (file)
@@ -45,8 +45,13 @@ require_sesskey();
 
 $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));
 
index 31c3ee2..fbad9e0 100644 (file)
@@ -127,7 +127,7 @@ switch($view) {
         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;