From db6395b25a8b83ccc5b0a429b4c4893c26387a8d Mon Sep 17 00:00:00 2001 From: martin <martin> Date: Sun, 11 Aug 2002 14:05:27 +0000 Subject: [PATCH] Don't show news at all if 0 newsitems was selected in course settings --- course/topics.php | 18 ++++++++++-------- course/weeks.php | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/course/topics.php b/course/topics.php index d4ccaa49be..3e9426ebad 100644 --- a/course/topics.php +++ b/course/topics.php @@ -193,15 +193,17 @@ // 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"); diff --git a/course/weeks.php b/course/weeks.php index fc2031d27f..a371152c0c 100644 --- a/course/weeks.php +++ b/course/weeks.php @@ -185,15 +185,17 @@ // 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"); -- 2.39.5