From: moodler Date: Wed, 11 Aug 2004 09:00:53 +0000 (+0000) Subject: FIxed some notices when installing Moodle fresh X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=675dbdd9f538adc4ede48faf84ca68e9b70bc95b;p=moodle.git FIxed some notices when installing Moodle fresh --- diff --git a/blocks/admin/block_admin.php b/blocks/admin/block_admin.php index 8991949278..12fc3238ca 100644 --- a/blocks/admin/block_admin.php +++ b/blocks/admin/block_admin.php @@ -23,10 +23,11 @@ class CourseBlock_admin extends MoodleBlock { $this->content->icons = array(); $this->content->footer = ''; - if($this->course->id == 1) { + if (empty($course)) { + $this->content = ''; + } else if ($this->course->category == 0) { $this->load_content_for_site(); - } - else { + } else { $this->load_content_for_course(); } diff --git a/blocks/calendar_month/block_calendar_month.php b/blocks/calendar_month/block_calendar_month.php index 6f9bbe3745..e10b4c821f 100644 --- a/blocks/calendar_month/block_calendar_month.php +++ b/blocks/calendar_month/block_calendar_month.php @@ -27,11 +27,9 @@ class CourseBlock_calendar_month extends MoodleBlock { $this->content->text = ''; $this->content->footer = ''; - if ($this->course === NULL) { - // Overrides: use no course at all + if (empty($this->course)) { // Overrides: use no course at all $courseshown = false; $filtercourse = array(); - } else { $courseshown = $this->course->id; $filtercourse = array($courseshown => 1); diff --git a/blocks/calendar_upcoming/block_calendar_upcoming.php b/blocks/calendar_upcoming/block_calendar_upcoming.php index 6eb8baff39..c1ed2ae726 100644 --- a/blocks/calendar_upcoming/block_calendar_upcoming.php +++ b/blocks/calendar_upcoming/block_calendar_upcoming.php @@ -19,23 +19,26 @@ class CourseBlock_calendar_upcoming extends MoodleBlock { require_once($CFG->dirroot.'/calendar/lib.php'); - if($this->content !== NULL) { + if ($this->content !== NULL) { return $this->content; } $this->content = New object; $this->content->text = ''; - $this->content->footer = '
'.get_string('gotocalendar', 'calendar').'...'; - $this->content->footer .= '
'.get_string('newevent', 'calendar').'...'; - if($this->course === NULL) { - // Overrides: use no course at all + if (empty($this->course)) { // Overrides: use no course at all $courseshown = false; $filtercourse = array(); - } - else { + $this->content->footer = ''; + } else { $courseshown = $this->course->id; $filtercourse = array($courseshown => 1); + $this->content->footer = '
'. + get_string('gotocalendar', 'calendar').'...'; + $this->content->footer .= '
'. + get_string('newevent', 'calendar').'...'; } // We 'll need this later diff --git a/blocks/course_summary/block_course_summary.php b/blocks/course_summary/block_course_summary.php index 0f60aade28..40d21b0cf1 100644 --- a/blocks/course_summary/block_course_summary.php +++ b/blocks/course_summary/block_course_summary.php @@ -23,6 +23,10 @@ class CourseBlock_course_summary extends MoodleBlock { return $this->content; } + if (empty($this->course)) { + return ''; + } + $this->content = New stdClass; $this->content->text = format_text($this->course->summary, FORMAT_HTML); if (isediting($this->course->id)) { diff --git a/blocks/news_items/block_news_items.php b/blocks/news_items/block_news_items.php index 7357713672..c9c81e2ac2 100644 --- a/blocks/news_items/block_news_items.php +++ b/blocks/news_items/block_news_items.php @@ -15,7 +15,12 @@ class CourseBlock_news_items extends MoodleBlock { function get_content() { global $CFG; - if($this->content !== NULL) { + if ($this->content !== NULL) { + return $this->content; + } + + if (empty($this->course)) { + $this->content = ''; return $this->content; } diff --git a/blocks/online_users/block_online_users.php b/blocks/online_users/block_online_users.php index 755eecf522..fc3f2a9cc3 100644 --- a/blocks/online_users/block_online_users.php +++ b/blocks/online_users/block_online_users.php @@ -37,10 +37,15 @@ class CourseBlock_online_users extends MoodleBlock { $timetoshowusers = $CFG->block_online_users_timetosee * 60; } - if($this->content !== NULL) { + if ($this->content !== NULL) { return $this->content; } + if (empty($this->course)) { + $this->content = ''; + return $this->content; + } + $this->content = New object; $this->content->text = ''; $this->content->footer = ''; diff --git a/blocks/participants/block_participants.php b/blocks/participants/block_participants.php index 31170e9f80..e107e842b6 100644 --- a/blocks/participants/block_participants.php +++ b/blocks/participants/block_participants.php @@ -11,7 +11,11 @@ class CourseBlock_participants extends MoodleBlock { function get_content() { global $USER, $CFG; - if($this->content !== NULL) { + if ($this->content !== NULL) { + return $this->content; + } + if (empty($this->course)) { + $this->content = ''; return $this->content; } diff --git a/blocks/recent_activity/block_recent_activity.php b/blocks/recent_activity/block_recent_activity.php index b767755600..03ee7a3767 100644 --- a/blocks/recent_activity/block_recent_activity.php +++ b/blocks/recent_activity/block_recent_activity.php @@ -10,7 +10,12 @@ class CourseBlock_recent_activity extends MoodleBlock { function get_content() { - if($this->content !== NULL) { + if ($this->content !== NULL) { + return $this->content; + } + + if (empty($this->course)) { + $this->content = ''; return $this->content; } diff --git a/blocks/search_forums/block_search_forums.php b/blocks/search_forums/block_search_forums.php index 4704430e4d..aee0be0b46 100644 --- a/blocks/search_forums/block_search_forums.php +++ b/blocks/search_forums/block_search_forums.php @@ -17,6 +17,11 @@ class CourseBlock_search_forums extends MoodleBlock { return $this->content; } + if (empty($this->course)) { + $this->content = ''; + return $this->content; + } + $this->content = New object; $this->content->text = ''; $this->content->footer = ''; diff --git a/blocks/section_links/block_section_links.php b/blocks/section_links/block_section_links.php index a3d8b7b54f..71dd045fb1 100644 --- a/blocks/section_links/block_section_links.php +++ b/blocks/section_links/block_section_links.php @@ -28,7 +28,12 @@ class CourseBlock_section_links extends MoodleBlock { $highlight = 0; - if($this->content !== NULL) { + if ($this->content !== NULL) { + return $this->content; + } + + if (empty($this->course)) { + $this->content = ''; return $this->content; }