Skip to content
Browse files

Added ability for teacher to see subscribers for each forum

  • Loading branch information...
1 parent 731bc13 commit bffb106d502f3c2e0f102f8c30a4bb48c022d8a6 martin committed Jul 14, 2002
Showing with 71 additions and 2 deletions.
  1. +64 −0 mod/forum/subscribers.php
  2. +7 −2 mod/forum/view.php
View
64 mod/forum/subscribers.php
@@ -0,0 +1,64 @@
+<?PHP // $Id$
+
+ require("../../config.php");
+ require("lib.php");
+
+ require_variable($id); // forum
+
+ if (! $forum = get_record("forum", "id", $id)) {
+ error("Forum ID is incorrect");
+ }
+
+ if (! $course = get_record("course", "id", $forum->course)) {
+ error("Could not find this course!");
+ }
+
+ require_login($course->id);
+
+ if (!isteacher($course->id)) {
+ error("This page is for teachers only");
+ }
+
+ unset($SESSION->fromdiscuss);
+
+ add_to_log($course->id, "forum", "view subscribers", "subscribers.php?id=$forum->id", "");
+
+ $strsubscribers = get_string("subscribers", "forum");
+ $strforums = get_string("forums", "forum");
+
+ if ($course->category) {
+ $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->
+ <A HREF=\"index.php?id=$course->id\">$strforums</A> ->
+ <A HREF=\"view.php?f=$forum->id\">$forum->name</A> -> $strsubscribers";
+ } else {
+ $navigation = "<A HREF=\"index.php?id=$course->id\">$strforums</A> ->
+ <A HREF=\"view.php?f=$forum->id\">$forum->name</A> -> $strsubscribers";
+ }
+
+ print_header("$course->shortname: $strsubscribers", "$course->fullname", "$navigation");
+
+ $subscribers = get_records_sql("SELECT u.* FROM user u, user_students us, user_teachers ut,
+ forum_subscriptions fs
+ WHERE fs.forum = '$forum->id' AND fs.user = u.id AND
+ (fs.user = us.user OR fs.user = ut.user)
+ GROUP BY u.id
+ ORDER BY u.firstname");
+
+ if (! $subscribers) {
+ print_heading("No subscribers yet");
+ } else {
+ print_heading("Subscribers to '$forum->name'");
+ echo "<TABLE ALIGN=CENTER>";
+ foreach ($subscribers as $subscriber) {
+ echo "<TR><TD>";
+ print_user_picture($subscriber->id, $course->id, $subscriber->picture);
+ echo "</TD><TD>";
+ echo "$subscriber->firstname $subscriber->lastname";
+ echo "</TD></TR>";
+ }
+ echo "</TABLE>";
+ }
+
+ print_footer($course);
+
+?>
View
9 mod/forum/view.php
@@ -36,6 +36,8 @@
require_login($course->id);
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->
<A HREF=\"index.php?id=$course->id\">Forums</A> ->";
+ } else {
+ $navigation = "<A HREF=\"index.php?id=$course->id\">Forums</A> ->";
}
if ($forum->type == "teacher") {
@@ -53,11 +55,14 @@
if ($USER) {
$SESSION->fromdiscuss = "$FULLME";
if (is_subscribed($USER->id, $forum->id)) {
- $subtext = "Unsubscribe from this forum";
+ $subtext = "Unsubscribe me from this forum";
} else {
- $subtext = "Subscribe to this forum";
+ $subtext = "Subscribe me to this forum";
}
echo "<DIV ALIGN=RIGHT><FONT SIZE=1><A HREF=\"subscribe.php?id=$forum->id\">$subtext</A></FONT></DIV>";
+ if (isteacher($course->id)) {
+ echo "<DIV ALIGN=RIGHT><FONT SIZE=1><A HREF=\"subscribers.php?id=$forum->id\">Show subscribers</A></FONT></DIV>";
+ }
}
print_simple_box(text_to_html($forum->intro), "CENTER");

0 comments on commit bffb106

Please sign in to comment.
Something went wrong with that request. Please try again.