weekly release 4.0dev
[moodle.git] / userpix / index.php
CommitLineData
474f6bfe 1<?php
edfd6a5e
PS
2 // This simple script displays all the users with pictures on one page.
3 // By default it is not linked anywhere on the site. If you want to
4 // make it available you should link it in yourself from somewhere.
5 // Remember also to comment or delete the lines restricting access
6 // to administrators only (see below)
dbaf630a 7
8
edfd6a5e 9require('../config.php');
dbaf630a 10
edfd6a5e 11$PAGE->set_url('/userpix/index.php');
474f6bfe 12
edfd6a5e 13require_login();
dbaf630a 14
15/// Remove the following three lines if you want everyone to access it
43731030 16$syscontext = context_system::instance();
2b9cc35e 17require_capability('moodle/site:config', $syscontext);
edfd6a5e
PS
18
19$title = get_string("users");
2b9cc35e 20$PAGE->set_context($syscontext);
edfd6a5e
PS
21$PAGE->navbar->add($title);
22$PAGE->set_title($title);
23$PAGE->set_heading($title);
24echo $OUTPUT->header();
25
987e5545 26$rs = $DB->get_recordset_select("user", "deleted = 0 AND picture > 0", array(), "lastaccess DESC",
5e72715e 27 implode(',', \core_user\fields::get_picture_fields()));
edfd6a5e 28foreach ($rs as $user) {
14f9bad3 29 $fullname = s(fullname($user));
edfd6a5e
PS
30 echo "<a href=\"$CFG->wwwroot/user/view.php?id=$user->id&amp;course=1\" ".
31 "title=\"$fullname\">";
edfd6a5e
PS
32 echo $OUTPUT->user_picture($user);
33 echo "</a> \n";
34}
35$rs->close();
36
37echo $OUTPUT->footer();