From: stronk7 Date: Thu, 24 Apr 2003 17:15:59 +0000 (+0000) Subject: Changed to show the hidden forums dimmed (bug #364) X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=3b0fb381eaf96703a66e0a5c872d88a394beac29;p=moodle.git Changed to show the hidden forums dimmed (bug #364) --- diff --git a/mod/forum/index.php b/mod/forum/index.php index 2c32923b46..090163d0f8 100644 --- a/mod/forum/index.php +++ b/mod/forum/index.php @@ -51,7 +51,15 @@ $table->align[] = "CENTER"; } - if ($forums = get_records("forum", "course", $id, "name ASC")) { + //Obtains all the forum data and visible field + if ($forums = get_records_sql("SELECT f.*,cm.visible as visible + FROM {$CFG->prefix}course_modules cm, + {$CFG->prefix}forum f + WHERE cm.course = '$id' AND + f.course = '$id' AND + f.id = cm.instance + ORDER BY name ASC")) + { foreach ($forums as $forum) { switch ($forum->type) { case "news": @@ -76,6 +84,15 @@ foreach ($generalforums as $forum) { $count = count_records("forum_discussions", "forum", "$forum->id"); + //Calculate the href + if (!$forum->visible) { + //Show dimmed if the mod is hidden + $tt_href = "id\">$forum->name"; + } else { + //Show normal if the mod is visible + $tt_href = "id\">$forum->name"; + } + if ($can_subscribe) { if (forum_is_forcesubscribed($forum->id)) { $sublink = get_string("yes"); @@ -89,11 +106,9 @@ } $sublink = "id\">$subscribed"; } - $table->data[] = array ("id\">$forum->name", - "$forum->intro", "$count", "$sublink"); + $table->data[] = array ($tt_href, "$forum->intro", "$count", "$sublink"); } else { - $table->data[] = array ("id\">$forum->name", - "$forum->intro", "$count"); + $table->data[] = array ($tt_href, "$forum->intro", "$count"); } } print_heading(get_string("generalforums", "forum")); @@ -122,7 +137,16 @@ if (!$forum->section) { // some forums are in the "0" section $forum->section = ""; } - + + //Calculate the href + if (!$forum->visible) { + //Show dimmed if the mod is hidden + $tt_href = "id\">$forum->name"; + } else { + //Show normal if the mod is visible + $tt_href = "id\">$forum->name"; + } + if ($can_subscribe) { if (forum_is_forcesubscribed($forum->id)) { $sublink = get_string("yes"); @@ -136,11 +160,9 @@ } $sublink = "id\">$subscribed"; } - $table->data[] = array ("$forum->section", "id\">$forum->name", - "$forum->intro", "$count", "$sublink"); + $table->data[] = array ("$forum->section", $tt_href, "$forum->intro", "$count", "$sublink"); } else { - $table->data[] = array ("$forum->section", "id\">$forum->name", - "$forum->intro", "$count"); + $table->data[] = array ("$forum->section", $tt_href, "$forum->intro", "$count"); } } print_heading(get_string("learningforums", "forum"));