]> git.mjollnir.org Git - moodle.git/commitdiff
FIxed some notices when installing Moodle fresh
authormoodler <moodler>
Wed, 11 Aug 2004 09:00:53 +0000 (09:00 +0000)
committermoodler <moodler>
Wed, 11 Aug 2004 09:00:53 +0000 (09:00 +0000)
blocks/admin/block_admin.php
blocks/calendar_month/block_calendar_month.php
blocks/calendar_upcoming/block_calendar_upcoming.php
blocks/course_summary/block_course_summary.php
blocks/news_items/block_news_items.php
blocks/online_users/block_online_users.php
blocks/participants/block_participants.php
blocks/recent_activity/block_recent_activity.php
blocks/search_forums/block_search_forums.php
blocks/section_links/block_section_links.php

index 89919492783719f663432dc4cdabc3d2921b7d4f..12fc3238ca0bb371452a2979e6b1c8781de468ef 100644 (file)
@@ -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();
         }
 
index 6f9bbe3745ca5747e4ad882167ce8931d0298180..e10b4c821f7b513aad6d88cfdc41b65cbea18860 100644 (file)
@@ -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);
index 6eb8baff39177ab582fa26c627a5efffcb04cdd0..c1ed2ae726ff37314071031a6198929e436d1174 100644 (file)
@@ -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 = '<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 === 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 = '<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>...';
         }
 
         // We 'll need this later
index 0f60aade28953ee45a64d8cea255531780d6febc..40d21b0cf1d43bd52408e6ace15c67c8c8336c8e 100644 (file)
@@ -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)) {
index 735771367234b45a8ad85e9450fa65d30ccced4b..c9c81e2ac2a96b4e5c94c3ab0112ab37bc914665 100644 (file)
@@ -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;
         }
 
index 755eecf52292d80d1ebb414a823613030657fdf7..fc3f2a9cc3be747def9dd813ad459f932b50040f 100644 (file)
@@ -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 = '';
index 31170e9f805df9b8252dbac9f615da8ed788541c..e107e842b6a9fe8a0fcd7073c138882137ff77b8 100644 (file)
@@ -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;
         }
 
index b7677556000a1c37f83b785eab2744aa04eda2de..03ee7a3767bc6720ea68f1a19bc15bb528125756 100644 (file)
@@ -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;
         }
 
index 4704430e4da055401c8ab5348e424b8388b50033..aee0be0b4658e85f649a897e8257583a876da86d 100644 (file)
@@ -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 = '';
index a3d8b7b54fe0a5ca5b059e812d0ac103c407ba9f..71dd045fb14649b35c047db6bcd1d858cb748b3f 100644 (file)
@@ -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;
         }