diff --git a/course/topics.php b/course/topics.php index 7863037505e91..346e099b2ff06 100644 --- a/course/topics.php +++ b/course/topics.php @@ -67,6 +67,9 @@ $modicon = array(); if ($modtype) { foreach ($modtype as $modname => $modfullname) { + if ($modname == "discuss") { + continue; // Covered by forum + } $moddata[] = "id\">".$modfullname."s"; $modicon[] = "\"$modfullname\""; } diff --git a/course/weeks.php b/course/weeks.php index 00a0d55621561..47f03a251e069 100644 --- a/course/weeks.php +++ b/course/weeks.php @@ -50,6 +50,9 @@ $modicon = array(); if ($modtype) { foreach ($modtype as $modname => $modfullname) { + if ($modname == "discuss") { + continue; // Covered by forum + } $moddata[] = "id\">".$modfullname."s"; $modicon[] = "\"$modfullname\""; } diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 370e7a0278e75..84f2def616bdd 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -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 "
"; - - print_simple_box_start("CENTER","","#FFFFFF",0); - echo "\n"; + print_simple_box_start("CENTER", "80%", "#FFFFFF", 0); + echo "
\n"; if ($table->head) { echo ""; diff --git a/mod/choice/index.php b/mod/choice/index.php index 56cf165d8728a..b5a3ebc677bb0 100644 --- a/mod/choice/index.php +++ b/mod/choice/index.php @@ -66,6 +66,7 @@ "$aa"); } } + echo "
"; print_table($table); print_footer($course); diff --git a/mod/forum/index.php b/mod/forum/index.php index dcb04a6ca4857..29b966a16984b 100644 --- a/mod/forum/index.php +++ b/mod/forum/index.php @@ -32,25 +32,35 @@ $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) { @@ -69,22 +79,13 @@ "$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) { @@ -103,10 +104,8 @@ "$count"); } } - if ($table) { - print_heading("Forums about course content"); - print_table($table); - } + print_heading("Course content"); + print_table($table); } echo "
"; diff --git a/mod/journal/index.php b/mod/journal/index.php index 94bf8fdbd3a0f..41517f72ca0d2 100644 --- a/mod/journal/index.php +++ b/mod/journal/index.php @@ -64,6 +64,7 @@ } } + echo "
"; print_table($table); print_footer($course); diff --git a/mod/survey/index.php b/mod/survey/index.php index 71f4d6d186c9d..4232ac7e2753c 100644 --- a/mod/survey/index.php +++ b/mod/survey/index.php @@ -48,6 +48,7 @@ } } + echo "
"; print_table($table); print_footer($course);