Browse files

Improving the behavior of the two calendar blocks when they are displ…

…ayed

at the site front page. See http://moodle.org/mod/forum/discuss.php?d=12149
  • Loading branch information...
1 parent 472b9e4 commit 75c45044bbec9c913ae8db47bc5869e83ca83c0f defacer committed Sep 7, 2004
View
14 blocks/calendar_month/block_calendar_month.php
@@ -24,11 +24,23 @@ function get_content() {
$this->content->footer = '';
if (empty($this->course)) { // Overrides: use no course at all
+
$courseshown = false;
$filtercourse = array();
+
} else {
+
$courseshown = $this->course->id;
- $filtercourse = array($courseshown => 1);
+
+ 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
View
16 blocks/calendar_upcoming/block_calendar_upcoming.php
@@ -22,19 +22,31 @@ function get_content() {
$this->content = New object;
$this->content->text = '';
- if (empty($this->course)) { // Overrides: use no course at all
+ 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&amp;course='.$this->course->id.'">'.
get_string('gotocalendar', 'calendar').'</a>...';
$this->content->footer .= '<br /><a href="'.$CFG->wwwroot.
'/calendar/event.php?action=new&amp;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

0 comments on commit 75c4504

Please sign in to comment.