mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Merging patch for improved calendar block behavior from MOODLE_14_STABLE.
This commit is contained in:
parent
f971d5021e
commit
de79ec4550
2 changed files with 27 additions and 3 deletions
|
@ -24,12 +24,24 @@ class CourseBlock_calendar_month extends MoodleBlock {
|
|||
$this->content->footer = '';
|
||||
|
||||
if (empty($this->course)) { // Overrides: use no course at all
|
||||
|
||||
$courseshown = false;
|
||||
$filtercourse = array();
|
||||
|
||||
} else {
|
||||
|
||||
$courseshown = $this->course->id;
|
||||
|
||||
if($this->course->id == SITEID) {
|
||||
// Being displayed at site level. This will cause the filter to fall back to auto-detecting
|
||||
// the list of courses it will be grabbing events from.
|
||||
$filtercourse = NULL;
|
||||
}
|
||||
else {
|
||||
// Forcibly filter events to include only those from the particular course we are in.
|
||||
$filtercourse = array($courseshown => 1);
|
||||
}
|
||||
}
|
||||
|
||||
// We 'll need this later
|
||||
calendar_set_referring_course($courseshown);
|
||||
|
|
|
@ -23,18 +23,30 @@ class CourseBlock_calendar_upcoming extends MoodleBlock {
|
|||
$this->content->text = '';
|
||||
|
||||
if (empty($this->course)) { // Overrides: use no course at all
|
||||
|
||||
$courseshown = false;
|
||||
$filtercourse = array();
|
||||
$this->content->footer = '';
|
||||
|
||||
} else {
|
||||
|
||||
$courseshown = $this->course->id;
|
||||
$filtercourse = array($courseshown => 1);
|
||||
$this->content->footer = '<br /><a href="'.$CFG->wwwroot.
|
||||
'/calendar/view.php?view=upcoming&course='.$this->course->id.'">'.
|
||||
get_string('gotocalendar', 'calendar').'</a>...';
|
||||
$this->content->footer .= '<br /><a href="'.$CFG->wwwroot.
|
||||
'/calendar/event.php?action=new&course='.$this->course->id.'">'.
|
||||
get_string('newevent', 'calendar').'</a>...';
|
||||
|
||||
if($this->course->id == SITEID) {
|
||||
// Being displayed at site level. This will cause the filter to fall back to auto-detecting
|
||||
// the list of courses it will be grabbing events from.
|
||||
$filtercourse = NULL;
|
||||
}
|
||||
else {
|
||||
// Forcibly filter events to include only those from the particular course we are in.
|
||||
$filtercourse = array($courseshown => 1);
|
||||
}
|
||||
}
|
||||
|
||||
// We 'll need this later
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue