MDL-14589 user icons now stored in file storage pool
[moodle.git] / userpix / index.php
1 <?php
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)
9 require('../config.php');
11 $PAGE->set_url('/userpix/index.php');
13 require_login();
15 /// Remove the following three lines if you want everyone to access it
16 require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
18 $title = get_string("users");
20 $PAGE->navbar->add($title);
21 $PAGE->set_title($title);
22 $PAGE->set_heading($title);
23 echo $OUTPUT->header();
25 $rs = $DB->get_recordset_select("user", "deleted = 0 AND picture > 0", array(), "lastaccess DESC", user_picture::fields());
26 foreach ($rs as $user) {
27     $fullname = fullname($user);
28     echo "<a href=\"$CFG->wwwroot/user/view.php?id=$user->id&amp;course=1\" ".
29          "title=\"$fullname\">";
30     require_once($CFG->libdir.'/filelib.php');
31     echo $OUTPUT->user_picture($user);
32     echo "</a> \n";
33 }
34 $rs->close();
36 echo $OUTPUT->footer();