]> git.mjollnir.org Git - moodle.git/commitdiff
Changed to show the hidden forums dimmed (bug #364)
authorstronk7 <stronk7>
Thu, 24 Apr 2003 17:15:59 +0000 (17:15 +0000)
committerstronk7 <stronk7>
Thu, 24 Apr 2003 17:15:59 +0000 (17:15 +0000)
mod/forum/index.php

index 2c32923b465e264ed5bed20941f7e543005bf722..090163d0f8d4ac0f13805576851ed4b27a39bab2 100644 (file)
         $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":
         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 = "<A class=\"dimmed\" HREF=\"view.php?f=$forum->id\">$forum->name</A>";
+            } else {
+            //Show normal if the mod is visible
+                $tt_href = "<A HREF=\"view.php?f=$forum->id\">$forum->name</A>";
+            }
+
             if ($can_subscribe) {
                 if (forum_is_forcesubscribed($forum->id)) {
                     $sublink = get_string("yes");
                     }
                     $sublink = "<A TITLE=\"$subtitle\" HREF=\"subscribe.php?id=$forum->id\">$subscribed</A>";
                 }
-                $table->data[] = array ("<A HREF=\"view.php?f=$forum->id\">$forum->name</A>", 
-                                        "$forum->intro", "$count", "$sublink");
+                $table->data[] = array ($tt_href, "$forum->intro", "$count", "$sublink");
             } else {
-                $table->data[] = array ("<A HREF=\"view.php?f=$forum->id\">$forum->name</A>", 
-                                        "$forum->intro", "$count");
+                $table->data[] = array ($tt_href, "$forum->intro", "$count");
             }
         }
         print_heading(get_string("generalforums", "forum"));
                 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 = "<A class=\"dimmed\" HREF=\"view.php?f=$forum->id\">$forum->name</A>";
+                } else {
+                //Show normal if the mod is visible
+                    $tt_href = "<A HREF=\"view.php?f=$forum->id\">$forum->name</A>";
+                }
+
                 if ($can_subscribe) {
                     if (forum_is_forcesubscribed($forum->id)) {
                         $sublink = get_string("yes");
                         }
                         $sublink = "<A TITLE=\"$subtitle\" HREF=\"subscribe.php?id=$forum->id\">$subscribed</A>";
                     }
-                    $table->data[] = array ("$forum->section", "<A HREF=\"view.php?f=$forum->id\">$forum->name</A>", 
-                                            "$forum->intro", "$count", "$sublink");
+                    $table->data[] = array ("$forum->section", $tt_href, "$forum->intro", "$count", "$sublink");
                 } else {
-                    $table->data[] = array ("$forum->section", "<A HREF=\"view.php?f=$forum->id\">$forum->name</A>", 
-                                            "$forum->intro", "$count");
+                    $table->data[] = array ("$forum->section", $tt_href, "$forum->intro", "$count");
                 }
             }
             print_heading(get_string("learningforums", "forum"));