]> git.mjollnir.org Git - moodle.git/commitdiff
Slight formatting tweaks (forum index)
authormartin <martin>
Sat, 20 Jul 2002 18:20:19 +0000 (18:20 +0000)
committermartin <martin>
Sat, 20 Jul 2002 18:20:19 +0000 (18:20 +0000)
course/topics.php
course/weeks.php
lib/moodlelib.php
mod/choice/index.php
mod/forum/index.php
mod/journal/index.php
mod/survey/index.php

index 7863037505e91b5260bd7968a55b2881acdc84a9..346e099b2ff068da6ff2a7c4ba72148c4032467c 100644 (file)
@@ -67,6 +67,9 @@
     $modicon = array();
     if ($modtype) {
         foreach ($modtype as $modname => $modfullname) {
+            if ($modname == "discuss") {
+                continue;  // Covered by forum
+            }
             $moddata[] = "<A HREF=\"../mod/$modname/index.php?id=$course->id\">".$modfullname."s</A>";
             $modicon[] = "<IMG SRC=\"../mod/$modname/icon.gif\" HEIGHT=16 WIDTH=16 ALT=\"$modfullname\">";
         }
index 00a0d556215610e14edbd5d09dcf2411089ce5f1..47f03a251e069af8424cf2bee2a5c74d7a27244e 100644 (file)
@@ -50,6 +50,9 @@
     $modicon = array();
     if ($modtype) {
         foreach ($modtype as $modname => $modfullname) {
+            if ($modname == "discuss") {
+                continue;  // Covered by forum
+            }
             $moddata[] = "<A HREF=\"../mod/$modname/index.php?id=$course->id\">".$modfullname."s</A>";
             $modicon[] = "<IMG SRC=\"../mod/$modname/icon.gif\" HEIGHT=16 WIDTH=16 ALT=\"$modfullname\">";
         }
index 370e7a0278e75343ce5d30b35c68df3dfd3b9d71..84f2def616bdd155ebd3dc5e8a077da378689d53 100644 (file)
@@ -131,7 +131,7 @@ function print_table($table) {
 //     $table->align     is an array of column alignments
 //     $table->data[]    is an array of arrays containing the data.
 
-    if ( $table->align) {
+    if ($table->align) {
         foreach ($table->align as $key => $aa) {
             if ($aa) {
                 $align[$key] = "ALIGN=\"$aa\"";
@@ -141,10 +141,8 @@ function print_table($table) {
         }
     }
 
-    echo "<BR>";
-
-    print_simple_box_start("CENTER","","#FFFFFF",0);
-    echo "<TABLE BORDER=0 valign=top align=center cellpadding=10 cellspacing=1>\n";
+    print_simple_box_start("CENTER", "80%", "#FFFFFF", 0);
+    echo "<TABLE WIDTH=100% BORDER=0 valign=top align=center cellpadding=10 cellspacing=1>\n";
 
     if ($table->head) {
         echo "<TR>";
index 56cf165d8728af503132fc4a22a4ceaaf395582f..b5a3ebc677bb04ad2aa42b2a9958fa5ea4ed0d72 100644 (file)
@@ -66,6 +66,7 @@
                                     "$aa");
         }
     }
+    echo "<BR>";
     print_table($table);
 
     print_footer($course);
index dcb04a6ca485702dac77a6ba52d8339ae334d77a..29b966a16984bd72fbcb533803d5935906ce784a 100644 (file)
 
     $can_subscribe = (isstudent($course->id) || isteacher($course->id) || isadmin());
     if ($can_subscribe) {
-        $newtable->head = array ("Forum", "Description", "Topics", "Subscribed");
+        $table->head = array ("Forum", "Description", "Topics", "Subscribed");
     } else {
-        $newtable->head = array ("Forum", "Description", "Topics");
+        $table->head = array ("Forum", "Description", "Topics");
     }
-    $newtable->align = array ("LEFT", "LEFT", "CENTER", "CENTER");
+    $table->align = array ("LEFT", "LEFT", "CENTER", "CENTER");
 
 
     if ($forums = get_records("forum", "course", $id, "name ASC")) {
-        $table = $newtable;
         foreach ($forums as $forum) {
-            if ($forum->type == "teacher") {
-                if (!isteacher($course->id)) {
-                    continue;
-                }
+            switch ($forum->type) {
+                case "discussion":
+                case "general":
+                case "eachuser":
+                    $contentforums[] = $forum;
+                    break;
+                case "teacher": 
+                    if (isteacher($course->id)) {
+                        $generalforums[] = $forum;
+                    }
+                    break;
+                default:
+                    $generalforums[] = $forum;
+                    break;
             }
-            if ($forum->type == "eachuser" or $forum->type == "discussion") {
-                continue;    // Display these later on.
-            }       
+        }
+    }
 
+    if ($generalforums) {
+        foreach ($generalforums as $forum) {
             $count = count_records("discuss", "forum", "$forum->id");
 
             if ($can_subscribe) {
                                   "$count");
             }
         }
-        if ($table) {
-            print_heading("General Forums");
-            print_table($table);
-            $table = $newtable;
-        }
-
-        foreach ($forums as $forum) {
-            if ($forum->type == "teacher") {
-                if (!isteacher($course->id)) {
-                    continue;
-                }
-            }
-            if ($forum->type != "eachuser" and $forum->type != "discussion") {
-                continue;
-            }       
+        print_heading("General Forums");
+        print_table($table);
+        unset($table->data);
+    } 
 
+    if ($contentforums) {
+        foreach ($contentforums as $forum) {
             $count = count_records("discuss", "forum", "$forum->id");
 
             if ($can_subscribe) {
                                   "$count");
             }
         }
-        if ($table) {
-            print_heading("Forums about course content");
-            print_table($table);
-        }
+        print_heading("Course content");
+        print_table($table);
     }
 
     echo "<DIV ALIGN=CENTER>";
index 94bf8fdbd3a0f1793b6fd8fe5f3d9a18b2c426bd..41517f72ca0d2925504e4078ac87bc89d7f49d85 100644 (file)
@@ -64,6 +64,7 @@
         }
     }
 
+    echo "<BR>";
     print_table($table);
 
     print_footer($course);
index 71f4d6d186c9def9a9902d0bb187cea32cdbfa1a..4232ac7e2753c18d8db0596d394e8d094c46db20 100644 (file)
@@ -48,6 +48,7 @@
         }
     }
 
+    echo "<BR>";
     print_table($table);
     print_footer($course);