From 37b155148db88f403b1af9b5d9869c4fa675dad8 Mon Sep 17 00:00:00 2001 From: martin Date: Sat, 20 Jul 2002 18:20:19 +0000 Subject: [PATCH] Slight formatting tweaks (forum index) --- course/topics.php | 3 +++ course/weeks.php | 3 +++ lib/moodlelib.php | 8 +++--- mod/choice/index.php | 1 + mod/forum/index.php | 59 +++++++++++++++++++++---------------------- mod/journal/index.php | 1 + mod/survey/index.php | 1 + 7 files changed, 41 insertions(+), 35 deletions(-) diff --git a/course/topics.php b/course/topics.php index 7863037505..346e099b2f 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 00a0d55621..47f03a251e 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 370e7a0278..84f2def616 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 56cf165d87..b5a3ebc677 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 dcb04a6ca4..29b966a169 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 94bf8fdbd3..41517f72ca 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 71f4d6d186..4232ac7e27 100644 --- a/mod/survey/index.php +++ b/mod/survey/index.php @@ -48,6 +48,7 @@ } } + echo "
"; print_table($table); print_footer($course); -- 2.39.5