Skip to content

Commit

Permalink
Slight formatting tweaks (forum index)
Browse files Browse the repository at this point in the history
  • Loading branch information
martin committed Jul 20, 2002
1 parent 71fb963 commit 37b1551
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 35 deletions.
3 changes: 3 additions & 0 deletions course/topics.php
Expand Up @@ -67,6 +67,9 @@
$modicon = array(); $modicon = array();
if ($modtype) { if ($modtype) {
foreach ($modtype as $modname => $modfullname) { 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>"; $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\">"; $modicon[] = "<IMG SRC=\"../mod/$modname/icon.gif\" HEIGHT=16 WIDTH=16 ALT=\"$modfullname\">";
} }
Expand Down
3 changes: 3 additions & 0 deletions course/weeks.php
Expand Up @@ -50,6 +50,9 @@
$modicon = array(); $modicon = array();
if ($modtype) { if ($modtype) {
foreach ($modtype as $modname => $modfullname) { 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>"; $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\">"; $modicon[] = "<IMG SRC=\"../mod/$modname/icon.gif\" HEIGHT=16 WIDTH=16 ALT=\"$modfullname\">";
} }
Expand Down
8 changes: 3 additions & 5 deletions lib/moodlelib.php
Expand Up @@ -131,7 +131,7 @@ function print_table($table) {
// $table->align is an array of column alignments // $table->align is an array of column alignments
// $table->data[] is an array of arrays containing the data. // $table->data[] is an array of arrays containing the data.


if ( $table->align) { if ($table->align) {
foreach ($table->align as $key => $aa) { foreach ($table->align as $key => $aa) {
if ($aa) { if ($aa) {
$align[$key] = "ALIGN=\"$aa\""; $align[$key] = "ALIGN=\"$aa\"";
Expand All @@ -141,10 +141,8 @@ function print_table($table) {
} }
} }


echo "<BR>"; print_simple_box_start("CENTER", "80%", "#FFFFFF", 0);

echo "<TABLE WIDTH=100% BORDER=0 valign=top align=center cellpadding=10 cellspacing=1>\n";
print_simple_box_start("CENTER","","#FFFFFF",0);
echo "<TABLE BORDER=0 valign=top align=center cellpadding=10 cellspacing=1>\n";


if ($table->head) { if ($table->head) {
echo "<TR>"; echo "<TR>";
Expand Down
1 change: 1 addition & 0 deletions mod/choice/index.php
Expand Up @@ -66,6 +66,7 @@
"$aa"); "$aa");
} }
} }
echo "<BR>";
print_table($table); print_table($table);


print_footer($course); print_footer($course);
Expand Down
59 changes: 29 additions & 30 deletions mod/forum/index.php
Expand Up @@ -32,25 +32,35 @@


$can_subscribe = (isstudent($course->id) || isteacher($course->id) || isadmin()); $can_subscribe = (isstudent($course->id) || isteacher($course->id) || isadmin());
if ($can_subscribe) { if ($can_subscribe) {
$newtable->head = array ("Forum", "Description", "Topics", "Subscribed"); $table->head = array ("Forum", "Description", "Topics", "Subscribed");
} else { } 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")) { if ($forums = get_records("forum", "course", $id, "name ASC")) {
$table = $newtable;
foreach ($forums as $forum) { foreach ($forums as $forum) {
if ($forum->type == "teacher") { switch ($forum->type) {
if (!isteacher($course->id)) { case "discussion":
continue; 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"); $count = count_records("discuss", "forum", "$forum->id");


if ($can_subscribe) { if ($can_subscribe) {
Expand All @@ -69,22 +79,13 @@
"$count"); "$count");
} }
} }
if ($table) { print_heading("General Forums");
print_heading("General Forums"); print_table($table);
print_table($table); unset($table->data);
$table = $newtable; }
}

foreach ($forums as $forum) {
if ($forum->type == "teacher") {
if (!isteacher($course->id)) {
continue;
}
}
if ($forum->type != "eachuser" and $forum->type != "discussion") {
continue;
}


if ($contentforums) {
foreach ($contentforums as $forum) {
$count = count_records("discuss", "forum", "$forum->id"); $count = count_records("discuss", "forum", "$forum->id");


if ($can_subscribe) { if ($can_subscribe) {
Expand All @@ -103,10 +104,8 @@
"$count"); "$count");
} }
} }
if ($table) { print_heading("Course content");
print_heading("Forums about course content"); print_table($table);
print_table($table);
}
} }


echo "<DIV ALIGN=CENTER>"; echo "<DIV ALIGN=CENTER>";
Expand Down
1 change: 1 addition & 0 deletions mod/journal/index.php
Expand Up @@ -64,6 +64,7 @@
} }
} }


echo "<BR>";
print_table($table); print_table($table);


print_footer($course); print_footer($course);
Expand Down
1 change: 1 addition & 0 deletions mod/survey/index.php
Expand Up @@ -48,6 +48,7 @@
} }
} }


echo "<BR>";
print_table($table); print_table($table);
print_footer($course); print_footer($course);


Expand Down

0 comments on commit 37b1551

Please sign in to comment.