2001-11-22 06:23:56 +00:00
|
|
|
<?PHP // $Id$
|
|
|
|
|
|
|
|
// Lists all the users within a given course
|
|
|
|
|
|
|
|
require("../config.php");
|
2002-06-05 05:37:55 +00:00
|
|
|
require("../lib/countries.php");
|
2001-11-22 06:23:56 +00:00
|
|
|
require("lib.php");
|
|
|
|
|
|
|
|
require_variable($id); //course
|
2002-09-21 05:42:16 +00:00
|
|
|
optional_variable($sort, "u.lastaccess"); //how to sort students
|
|
|
|
optional_variable($dir,"ASC"); //how to sort students
|
2001-11-22 06:23:56 +00:00
|
|
|
|
|
|
|
if (! $course = get_record("course", "id", $id)) {
|
|
|
|
error("Course ID is incorrect");
|
|
|
|
}
|
|
|
|
|
|
|
|
require_login($course->id);
|
|
|
|
|
2002-05-31 09:15:36 +00:00
|
|
|
add_to_log($course->id, "user", "view all", "index.php?id=$course->id", "");
|
2001-11-22 06:23:56 +00:00
|
|
|
|
|
|
|
if ($course->category) {
|
2002-07-04 07:52:06 +00:00
|
|
|
print_header("$course->shortname: ".get_string("participants"), "$course->fullname",
|
|
|
|
"<A HREF=../course/view.php?id=$course->id>$course->shortname</A> -> ".
|
|
|
|
get_string("participants"), "");
|
2001-11-22 06:23:56 +00:00
|
|
|
} else {
|
2002-07-04 07:52:06 +00:00
|
|
|
print_header("$course->shortname: ".get_string("participants"), "$course->fullname",
|
|
|
|
get_string("participants"), "");
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
|
|
|
|
2002-08-06 09:21:14 +00:00
|
|
|
$string->email = get_string("email");
|
|
|
|
$string->location = get_string("location");
|
|
|
|
$string->lastaccess = get_string("lastaccess");
|
|
|
|
$string->activity = get_string("activity");
|
|
|
|
$string->unenrol = get_string("unenrol");
|
|
|
|
$string->loginas = get_string("loginas");
|
|
|
|
$string->fullprofile = get_string("fullprofile");
|
2002-09-08 03:34:12 +00:00
|
|
|
$string->role = get_string("role");
|
|
|
|
$string->never = get_string("never");
|
2002-09-21 05:42:16 +00:00
|
|
|
$string->name = get_string("name");
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2002-07-29 06:53:09 +00:00
|
|
|
if ( $teachers = get_course_teachers($course->id)) {
|
2002-09-08 03:24:38 +00:00
|
|
|
echo "<H2 align=center>$course->teachers</H2>";
|
2001-11-22 06:23:56 +00:00
|
|
|
foreach ($teachers as $teacher) {
|
2002-09-01 14:30:39 +00:00
|
|
|
if ($teacher->authority > 0) { // Don't print teachers with no authority
|
|
|
|
print_user($teacher, $course, $string);
|
|
|
|
}
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-09-21 05:42:16 +00:00
|
|
|
if ($students = get_course_students($course->id, "$sort $dir")) {
|
2002-09-20 15:40:20 +00:00
|
|
|
$numstudents = count($students);
|
|
|
|
echo "<H2 align=center>$numstudents $course->students</H2>";
|
2002-09-21 05:42:16 +00:00
|
|
|
if ($numstudents < 30) {
|
2002-09-20 15:40:20 +00:00
|
|
|
foreach ($students as $student) {
|
|
|
|
print_user($student, $course, $string);
|
|
|
|
}
|
2002-09-21 05:42:16 +00:00
|
|
|
} else { // Print one big table with abbreviated info
|
|
|
|
if ($dir == "ASC") {
|
|
|
|
$dir = "DESC";
|
|
|
|
} else {
|
|
|
|
$dir = "ASC";
|
|
|
|
}
|
|
|
|
$table->head = array (" ",
|
|
|
|
"<A HREF=\"index.php?id=$course->id&sort=u.firstname&dir=$dir\">$string->name</A>",
|
|
|
|
"<A HREF=\"index.php?id=$course->id&sort=u.country&dir=$dir\">$string->location</A>",
|
|
|
|
"<A HREF=\"index.php?id=$course->id&sort=u.lastaccess&dir=$dir\">$string->lastaccess</A>");
|
|
|
|
$table->align = array ("LEFT", "LEFT", "LEFT", "LEFT");
|
|
|
|
$table->size = array ("35", "*", "*", "*");
|
|
|
|
|
2002-09-20 15:40:20 +00:00
|
|
|
foreach ($students as $student) {
|
2002-09-21 05:42:16 +00:00
|
|
|
if ($student->lastaccess) {
|
|
|
|
$lastaccess = userdate($student->lastaccess);
|
|
|
|
$lastaccess .= "  (".format_time(time() - $student->lastaccess).")";
|
|
|
|
} else {
|
|
|
|
$lastaccess = $string->never;
|
|
|
|
}
|
|
|
|
|
|
|
|
$table->data[] = array (print_user_picture($student->id, $course->id, $student->picture, false, true),
|
|
|
|
"<B> <A HREF=\"$CFG->wwwroot/user/view.php?id=$student->id&course=$course->id\">$student->firstname $student->lastname</A></B>",
|
|
|
|
"$student->city, ".$COUNTRIES["$student->country"],
|
|
|
|
"$lastaccess");
|
2002-09-20 15:40:20 +00:00
|
|
|
}
|
2002-09-21 05:42:16 +00:00
|
|
|
print_table($table, 2, 0);
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
2002-06-05 05:54:47 +00:00
|
|
|
}
|
2001-11-22 06:23:56 +00:00
|
|
|
|
|
|
|
print_footer($course);
|
|
|
|
|
|
|
|
?>
|