id); $isteacher = isteacher($course->id); add_to_log($course->id, "user", "view all", "index.php?id=$course->id", ""); $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"); $string->day = get_string("day"); $string->days = get_string("days"); $string->hour = get_string("hour"); $string->hours = get_string("hours"); $string->min = get_string("min"); $string->mins = get_string("mins"); $string->sec = get_string("sec"); $string->secs = get_string("secs"); $string->all = get_string("all"); $countries = get_list_of_countries(); $loggedinas = "

".user_login_string($course, $USER)."

"; $showteachers = ($page == 0 and $sort == "lastaccess" and $dir == "desc"); if ($showteachers) { $participantslink = get_string("participants"); } else { $participantslink = "id\">".get_string("participants").""; } if ($course->category) { print_header("$course->shortname: ".get_string("participants"), "$course->fullname", "id>$course->shortname -> ". "$participantslink", "", "", true, " ", $loggedinas); } else { print_header("$course->shortname: ".get_string("participants"), "$course->fullname", "$participantslink", "", "", true, " ", $loggedinas); } if ($showteachers) { 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, $countries); } } } } if ($sort == "lastaccess") { $dsort = "s.timeaccess"; } else { $dsort = "u.$sort"; } $students = get_course_students($course->id, $dsort, $dir, $page*$perpage, $perpage, $firstinitial, $lastinitial); $totalcount = $matchcount = count_records("user_students", "course", $course->id); echo "

$totalcount $course->students

"; if (($CFG->longtimenosee < 500) and (!$page) and ($sort == "lastaccess")) { echo "

("; print_string("unusedaccounts","",$CFG->longtimenosee); echo ")

"; } /// Print paging bars if necessary if ($totalcount > $perpage) { $alphabet = explode(',', get_string('alphabet')); /// Bar of first initials echo "

"; echo get_string("firstname")." : "; if ($firstinitial) { echo " id&sort=firstname&dir=ASC&". "perpage=$perpage&lastinitial=$lastinitial\">$string->all "; } else { echo " $string->all "; } foreach ($alphabet as $letter) { if ($letter == $firstinitial) { echo " $letter "; } else { echo " id&sort=firstname&dir=ASC&". "perpage=$perpage&lastinitial=$lastinitial&firstinitial=$letter\">$letter "; } } echo "
"; /// Bar of last initials echo get_string("lastname")." : "; if ($lastinitial) { echo " id&sort=lastname&dir=ASC&". "perpage=$perpage&firstinitial=$firstinitial\">$string->all "; } else { echo " $string->all "; } foreach ($alphabet as $letter) { if ($letter == $lastinitial) { echo " $letter "; } else { echo " id&sort=lastname&dir=ASC&". "perpage=$perpage&firstinitial=$firstinitial&lastinitial=$letter\">$letter "; } } echo "

"; echo "
"; $matchcount = count_course_students($course, "", $firstinitial, $lastinitial); print_paging_bar($matchcount, $page, $perpage, "index.php?id=$course->id&sort=$sort&dir=$dir&perpage=$perpage&firstinitial=$firstinitial&lastinitial=$lastinitial&"); } if ($matchcount == 0) { print_heading(get_string("nostudentsfound", "", $course->students)); } if (0 < $matchcount and $matchcount < USER_SMALL_CLASS) { // Print simple listing foreach ($students as $student) { print_user($student, $course, $string, $countries); } } else if ($matchcount > 0) { // Print one big table with abbreviated info $columns = array("firstname", "lastname", "city", "country", "lastaccess"); foreach ($columns as $column) { $colname[$column] = get_string($column); if ($sort != $column) { $columnicon = ""; if ($column == "lastaccess") { $columndir = "desc"; } else { $columndir = "asc"; } } else { $columndir = $dir == "asc" ? "desc":"asc"; if ($column == "lastaccess") { $columnicon = $dir == "asc" ? "up":"down"; } else { $columnicon = $dir == "asc" ? "down":"up"; } $columnicon = " pixpath/t/$columnicon.gif\" />"; } $$column = "id&sort=$column&dir=$columndir\">".$colname["$column"]."$columnicon"; } foreach ($students as $key => $student) { $students[$key]->country = $countries[$student->country]; } if ($sort == "country") { // Need to re-sort by full country name, not code foreach ($students as $student) { $sstudents[$student->id] = $student->country; } asort($sstudents); foreach ($sstudents as $key => $value) { $nstudents[] = $students[$key]; } $students = $nstudents; } $table->head = array (" ", "$firstname / $lastname", $city, $country, $lastaccess); $table->align = array ("LEFT", "LEFT", "LEFT", "LEFT", "LEFT"); $table->size = array ("10", "*", "*", "*", "*"); $table->size = array ("10", "*", "*", "*", "*"); $table->cellpadding = 4; $table->cellspacing = 0; foreach ($students as $student) { if ($student->lastaccess) { $lastaccess = format_time(time() - $student->lastaccess, $string); } else { $lastaccess = $string->never; } if ($showall and $numstudents > USER_LARGE_CLASS) { // Don't show pictures $picture = ""; } else { $picture = print_user_picture($student->id, $course->id, $student->picture, false, true); } $fullname = fullname($student, $isteacher); $table->data[] = array ($picture, "wwwroot/user/view.php?id=$student->id&course=$course->id\">$fullname", "$student->city", "$student->country", "$lastaccess"); } print_table($table); print_paging_bar($matchcount, $page, $perpage, "index.php?id=$course->id&sort=$sort&dir=$dir&perpage=$perpage&firstinitial=$firstinitial&lastinitial=$lastinitial&"); if ($perpage != 99999) { echo "

"; echo "id&sort=$sort&dir=$dir&perpage=99999\">".get_string("showall", "", $totalcount).""; echo "

"; } } print_footer($course); ?>