Merge branch 'MDL-27515_m19' of git://github.com/rwijaya/moodle into MOODLE_19_STABLE
[moodle.git] / userpix / index.php
blob6564de27fa21f3ccfcf6e376e6a5e51ec82190c3
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)
9 include('../config.php');
11 require_login();
13 /// Remove the following three lines if you want everyone to access it
14 require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
16 if (!$users = get_records("user", "picture", "1", "lastaccess DESC", "id,firstname,lastname")) {
17 error("no users!");
20 $title = get_string("users");
22 print_header($title, $title, build_navigation(array(array('name' => $title, 'link' => null, 'type' => 'misc'))));
24 foreach ($users as $user) {
25 $fullname = fullname($user);
26 echo "<a href=\"$CFG->wwwroot/user/view.php?id=$user->id&amp;course=1\" ".
27 "title=\"$fullname\">";
28 require_once($CFG->libdir.'/filelib.php');
29 $userpictureurl = get_file_url($user->id.'/f1.jpg', null, 'user');
30 echo '<img src="'. $userpictureurl .'"'.
31 ' style="border:0px; width:100px; height:100px" alt="'.$fullname.'" />';
32 echo "</a> \n";
35 print_footer();