]> git.mjollnir.org Git - moodle.git/commitdiff
Don't show news at all if 0 newsitems was selected in course settings
authormartin <martin>
Sun, 11 Aug 2002 14:05:27 +0000 (14:05 +0000)
committermartin <martin>
Sun, 11 Aug 2002 14:05:27 +0000 (14:05 +0000)
course/topics.php
course/weeks.php

index d4ccaa49be1ce1181c5d56093642e96bed7e54c2..3e9426ebad3202766a4791e2b502858f82c65658 100644 (file)
 
     // Print all the news items.
 
-    if ($news = forum_get_course_forum($course->id, "news")) {
-        print_simple_box(get_string("latestnews"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
-        print_simple_box_start("CENTER", "100%", "#FFFFFF", 3, 0);
-        echo "<FONT SIZE=1>";
-        forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "DESC", false);
-        echo "</FONT>";
-        print_simple_box_end();
+    if ($course->newsitems) {
+        if ($news = forum_get_course_forum($course->id, "news")) {
+            print_simple_box(get_string("latestnews"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
+            print_simple_box_start("CENTER", "100%", "#FFFFFF", 3, 0);
+            echo "<FONT SIZE=1>";
+            forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "DESC", false);
+            echo "</FONT>";
+            print_simple_box_end();
+        }
+        echo "<BR>";
     }
-    echo "<BR>";
     
     // Print all the recent activity
     print_simple_box(get_string("recentactivity"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
index fc2031d27f05302ca6a6656755bb84e9b385c516..a371152c0c4b25563292ff73c3b316513278c82a 100644 (file)
 
     // Print all the news items.
 
-    if ($news = forum_get_course_forum($course->id, "news")) {
-        print_simple_box(get_string("latestnews"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
-        print_simple_box_start("CENTER", "100%", "#FFFFFF", 3, 0);
-        echo "<FONT SIZE=1>";
-        forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "DESC", false);
-        echo "</FONT>";
-        print_simple_box_end();
+    if ($course->newsitems) {
+        if ($news = forum_get_course_forum($course->id, "news")) {
+            print_simple_box(get_string("latestnews"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
+            print_simple_box_start("CENTER", "100%", "#FFFFFF", 3, 0);
+            echo "<FONT SIZE=1>";
+            forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "DESC", false);
+            echo "</FONT>";
+            print_simple_box_end();
+        }
+        echo "<BR>";
     }
-    echo "<BR>";
     
     // Print all the recent activity
     print_simple_box(get_string("recentactivity"), $align="CENTER", $width="100%", $color="$THEME->cellheading");