mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 00:16:46 +02:00
Changed listing of forums
This commit is contained in:
parent
88ef865e6a
commit
71fb963094
3 changed files with 49 additions and 6 deletions
|
@ -7,7 +7,7 @@ CREATE TABLE forum (
|
||||||
course int(10) unsigned NOT NULL default '0',
|
course int(10) unsigned NOT NULL default '0',
|
||||||
type enum('discussion','news','general','social','eachuser','teacher') NOT NULL default 'general',
|
type enum('discussion','news','general','social','eachuser','teacher') NOT NULL default 'general',
|
||||||
name varchar(255) NOT NULL default '',
|
name varchar(255) NOT NULL default '',
|
||||||
intro tinytext NOT NULL,
|
intro mediumtext NOT NULL,
|
||||||
open tinyint(1) unsigned NOT NULL default '0',
|
open tinyint(1) unsigned NOT NULL default '0',
|
||||||
assessed tinyint(1) unsigned NOT NULL default '0',
|
assessed tinyint(1) unsigned NOT NULL default '0',
|
||||||
timemodified int(10) unsigned NOT NULL default '0',
|
timemodified int(10) unsigned NOT NULL default '0',
|
||||||
|
|
|
@ -32,19 +32,25 @@
|
||||||
|
|
||||||
$can_subscribe = (isstudent($course->id) || isteacher($course->id) || isadmin());
|
$can_subscribe = (isstudent($course->id) || isteacher($course->id) || isadmin());
|
||||||
if ($can_subscribe) {
|
if ($can_subscribe) {
|
||||||
$table->head = array ("Forum", "Description", "Topics", "Subscribed");
|
$newtable->head = array ("Forum", "Description", "Topics", "Subscribed");
|
||||||
} else {
|
} else {
|
||||||
$table->head = array ("Forum", "Description", "Topics");
|
$newtable->head = array ("Forum", "Description", "Topics");
|
||||||
}
|
}
|
||||||
$table->align = array ("LEFT", "LEFT", "CENTER", "CENTER");
|
$newtable->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") {
|
if ($forum->type == "teacher") {
|
||||||
if (!isteacher($course->id)) {
|
if (!isteacher($course->id)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($forum->type == "eachuser" or $forum->type == "discussion") {
|
||||||
|
continue; // Display these later on.
|
||||||
|
}
|
||||||
|
|
||||||
$count = count_records("discuss", "forum", "$forum->id");
|
$count = count_records("discuss", "forum", "$forum->id");
|
||||||
|
|
||||||
if ($can_subscribe) {
|
if ($can_subscribe) {
|
||||||
|
@ -63,9 +69,46 @@
|
||||||
"$count");
|
"$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;
|
||||||
|
}
|
||||||
|
|
||||||
|
$count = count_records("discuss", "forum", "$forum->id");
|
||||||
|
|
||||||
|
if ($can_subscribe) {
|
||||||
|
if (is_subscribed($USER->id, $forum->id)) {
|
||||||
|
$subscribed = "YES";
|
||||||
|
} else {
|
||||||
|
$subscribed = "NO";
|
||||||
|
}
|
||||||
|
$table->data[] = array ("<A HREF=\"view.php?f=$forum->id\">$forum->name</A>",
|
||||||
|
"$forum->intro",
|
||||||
|
"$count",
|
||||||
|
"<A HREF=\"subscribe.php?id=$forum->id\">$subscribed</A>");
|
||||||
|
} else {
|
||||||
|
$table->data[] = array ("<A HREF=\"view.php?f=$forum->id\">$forum->name</A>",
|
||||||
|
"$forum->intro",
|
||||||
|
"$count");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($table) {
|
||||||
|
print_heading("Forums about course content");
|
||||||
|
print_table($table);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print_table($table);
|
|
||||||
echo "<DIV ALIGN=CENTER>";
|
echo "<DIV ALIGN=CENTER>";
|
||||||
print_discussion_search_form($course, $search);
|
print_discussion_search_form($course, $search);
|
||||||
echo "</DIV>";
|
echo "</DIV>";
|
||||||
|
|
|
@ -106,7 +106,7 @@ function get_course_discussion_forum($courseid) {
|
||||||
$forum->course = $courseid;
|
$forum->course = $courseid;
|
||||||
$forum->type = "discussion";
|
$forum->type = "discussion";
|
||||||
$forum->name = "Course Discussion";
|
$forum->name = "Course Discussion";
|
||||||
$forum->intro= "Discussions about course content";
|
$forum->intro= "General discussions about course topics";
|
||||||
$forum->open = 0;
|
$forum->open = 0;
|
||||||
$forum->assessed = 1;
|
$forum->assessed = 1;
|
||||||
$forum->timemodified = time();
|
$forum->timemodified = time();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue