From: martin Date: Sun, 11 Aug 2002 14:05:27 +0000 (+0000) Subject: Don't show news at all if 0 newsitems was selected in course settings X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=db6395b25a8b83ccc5b0a429b4c4893c26387a8d;p=moodle.git Don't show news at all if 0 newsitems was selected in course settings --- 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 ""; - forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "DESC", false); - echo ""; - 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 ""; + forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "DESC", false); + echo ""; + print_simple_box_end(); + } + echo "
"; } - echo "
"; // 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 ""; - forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "DESC", false); - echo ""; - 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 ""; + forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "DESC", false); + echo ""; + print_simple_box_end(); + } + echo "
"; } - echo "
"; // Print all the recent activity print_simple_box(get_string("recentactivity"), $align="CENTER", $width="100%", $color="$THEME->cellheading");