Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: bffb106d50
Fetching contributors…

Cannot retrieve contributors at this time

file 64 lines (49 sloc) 2.28 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 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);

?>
Something went wrong with that request. Please try again.