MDL-10876:
[moodle.git] / userpix / index.php
CommitLineData
dbaf630a 1<?php // $Id$
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)
7
8
9 include('../config.php');
10
11 require_login();
12
13/// Remove the following three lines if you want everyone to access it
329f40b0 14 require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
dbaf630a 15
dbaf630a 16 if (!$users = get_records("user", "picture", "1", "lastaccess DESC", "id,firstname,lastname")) {
17 error("no users!");
18 }
19
20 $title = get_string("users");
21
22 print_header($title, $title, $title);
23
24 foreach ($users as $user) {
e525e3d3 25 $fullname = fullname($user);
26 echo "<a href=\"$CFG->wwwroot/user/view.php?id=$user->id&amp;course=1\"".
27 "title=\"$fullname\">";
28 if ($CFG->slasharguments) { // Use this method if possible for better caching
29 echo '<img src="'. $CFG->wwwroot .'/user/pix.php/'.$user->id.'/f1.jpg"'.
ff8889d8 30 ' style="border:0px; width:100px; height:100px" alt="'.$fullname.'" />';
e525e3d3 31 } else {
32 echo '<img src="'. $CFG->wwwroot .'/user/pix.php?file=/'. $user->id .'/f1.jpg"'.
ff8889d8 33 ' style="border:0px; width:100px; height:100px" alt="'.$fullname.'" />';
e525e3d3 34 }
35 echo "</a> \n";
dbaf630a 36 }
37
38 print_footer();
05f53652 39
40?>