MDL-20700 coding style cleanup - cvs keywords removed, closign php tag removed, trail...
[moodle.git] / userpix / index.php
CommitLineData
474f6bfe 1<?php
dbaf630a 2 // This simple script displays all the users with pictures on one page.
0be6f678 3 // By default it is not linked anywhere on the site. If you want to
dbaf630a 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
474f6bfe 11 $PAGE->set_url(new moodle_url($CFG->wwwroot.'/userpix/index.php'));
12
dbaf630a 13 require_login();
14
15/// Remove the following three lines if you want everyone to access it
ef35441d 16 require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
dbaf630a 17
5d910388 18 if (!$users = $DB->get_records("user", array("picture"=>"1"), "lastaccess DESC", "id,firstname,lastname")) {
28800f02 19 print_error("nousers");
dbaf630a 20 }
0be6f678 21
dbaf630a 22 $title = get_string("users");
0be6f678 23
70f25518 24 $PAGE->navbar->add($title);
25 $PAGE->set_title($title);
26 $PAGE->set_heading($title);
27 echo $OUTPUT->header();
0be6f678 28
dbaf630a 29 foreach ($users as $user) {
e525e3d3 30 $fullname = fullname($user);
249ab0fd 31 echo "<a href=\"$CFG->wwwroot/user/view.php?id=$user->id&amp;course=1\" ".
e525e3d3 32 "title=\"$fullname\">";
5a254a29 33 require_once($CFG->libdir.'/filelib.php');
34 $userpictureurl = get_file_url($user->id.'/f1.jpg', null, 'user');
35 echo '<img src="'. $userpictureurl .'"'.
36 ' style="border:0px; width:100px; height:100px" alt="'.$fullname.'" />';
e525e3d3 37 echo "</a> \n";
dbaf630a 38 }
0be6f678 39
7e0d6675 40 echo $OUTPUT->footer();