id);
add_to_log($course->id, "user", "view all", "index.php?id=$course->id", "");
if ($course->category) {
print_header("$course->shortname: ".get_string("participants"), "$course->fullname",
"id>$course->shortname -> ".
get_string("participants"), "");
} else {
print_header("$course->shortname: ".get_string("participants"), "$course->fullname",
get_string("participants"), "");
}
$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");
$string->role = get_string("role");
$string->never = get_string("never");
$string->name = get_string("name");
if ( $teachers = get_course_teachers($course->id)) {
echo "
$course->teachers
";
foreach ($teachers as $teacher) {
if ($teacher->authority > 0) { // Don't print teachers with no authority
print_user($teacher, $course, $string);
}
}
}
if ($students = get_course_students($course->id, "$sort $dir")) {
$numstudents = count($students);
echo "$numstudents $course->students
";
if ($numstudents < $USER_SMALL_CLASS) {
foreach ($students as $student) {
print_user($student, $course, $string);
}
} else { // Print one big table with abbreviated info
if ($sort == "u.firstname") {
$name = "$string->name";
$location = "id&sort=u.country&dir=ASC\">$string->location";
$lastaccess = "id&sort=u.lastaccess&dir=DESC\">$string->lastaccess";
} else if ($sort == "u.country") {
$name = "id&sort=u.firstname&dir=ASC\">$string->name";
$location = "$string->location";
$lastaccess = "id&sort=u.lastaccess&dir=DESC\">$string->lastaccess";
} else {
$name = "id&sort=u.firstname&dir=ASC\">$string->name";
$location = "id&sort=u.country&dir=ASC\">$string->location";
$lastaccess = "$string->lastaccess";
}
$table->head = array (" ", $name, $location, $lastaccess);
$table->align = array ("LEFT", "LEFT", "LEFT", "LEFT");
$table->size = array ("35", "*", "*", "*");
foreach ($students as $student) {
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),
"wwwroot/user/view.php?id=$student->id&course=$course->id\">$student->firstname $student->lastname",
"$student->city, ".$COUNTRIES["$student->country"]."",
"$lastaccess");
}
print_table($table, 2, 0);
}
}
print_footer($course);
?>