mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 08:55:15 +02:00
MDL-60422 core_calendar: do not lose track of the selected course
This commit is contained in:
parent
849405177f
commit
72c4cacfa3
@ -239,7 +239,7 @@ class calendar_day_exporter extends exporter {
|
||||
*/
|
||||
protected function get_course_filter_selector(renderer_base $output) {
|
||||
$langstr = get_string('upcomingeventsfor', 'calendar');
|
||||
return $output->course_filter_selector($this->url, $langstr);
|
||||
return $output->course_filter_selector($this->url, $langstr, $this->calendar->course->id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,7 +151,7 @@ class calendar_upcoming_exporter extends exporter {
|
||||
*/
|
||||
protected function get_course_filter_selector(renderer_base $output) {
|
||||
$langstr = get_string('upcomingeventsfor', 'calendar');
|
||||
return $output->course_filter_selector($this->url, $langstr);
|
||||
return $output->course_filter_selector($this->url, $langstr, $this->calendar->course->id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
3
calendar/classes/external/month_exporter.php
vendored
3
calendar/classes/external/month_exporter.php
vendored
@ -231,7 +231,8 @@ class month_exporter extends exporter {
|
||||
*/
|
||||
protected function get_course_filter_selector(renderer_base $output) {
|
||||
$content = '';
|
||||
$content .= $output->course_filter_selector($this->url, get_string('detailedmonthviewfor', 'calendar'));
|
||||
$content .= $output->course_filter_selector($this->url, get_string('detailedmonthviewfor', 'calendar'),
|
||||
$this->calendar->course->id);
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
@ -237,10 +237,11 @@ class core_calendar_renderer extends plugin_renderer_base {
|
||||
*
|
||||
* @param moodle_url $returnurl The URL that the user should be taken too upon selecting a course.
|
||||
* @param string $label The label to use for the course select.
|
||||
* @param int $courseid The id of the course to be selected.
|
||||
* @return string
|
||||
*/
|
||||
public function course_filter_selector(moodle_url $returnurl, $label=null) {
|
||||
global $USER, $SESSION, $CFG;
|
||||
public function course_filter_selector(moodle_url $returnurl, $label = null, $courseid = null) {
|
||||
global $CFG;
|
||||
|
||||
if (!isloggedin() or isguestuser()) {
|
||||
return '';
|
||||
@ -261,7 +262,9 @@ class core_calendar_renderer extends plugin_renderer_base {
|
||||
$courseoptions[$course->id] = format_string($course->shortname, true, array('context' => $coursecontext));
|
||||
}
|
||||
|
||||
if ($this->page->course->id !== SITEID) {
|
||||
if ($courseid) {
|
||||
$selected = $courseid;
|
||||
} else if ($this->page->course->id !== SITEID) {
|
||||
$selected = $this->page->course->id;
|
||||
} else {
|
||||
$selected = '';
|
||||
|
Loading…
x
Reference in New Issue
Block a user