MDL-21233 moodle_url improvemewnts, code simplification, more diagnostics; fixed...
[moodle.git] / userpix / upgrade.php
CommitLineData
474f6bfe 1<?php
0f363686 2 // This script updates all users picturesi to remove black border.
3
4
5 include('../config.php');
6 include('../lib/gdlib.php');
7
a6855934 8 $PAGE->set_url('/userpix/upgrade.php');
474f6bfe 9
0f363686 10 require_login();
11
ef35441d 12 require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
0be6f678 13
5d910388 14 if (!$users = $DB->get_records("user", array("picture"=>"1"), "lastaccess DESC", "id,firstname,lastname")) {
28800f02 15 print_error('nousers');
0f363686 16 }
0be6f678 17
0f363686 18 $title = get_string("users");
0be6f678 19
70f25518 20 $PAGE->navbar->add($title);
21 $PAGE->set_title($title);
22 $PAGE->set_heading($title);
23 echo $OUTPUT->header();
0be6f678 24
0f363686 25 foreach ($users as $user) {
26 upgrade_profile_image($user->id);
27 $fullname = fullname($user);
28 echo "<a href=\"$CFG->wwwroot/user/view.php?id=$user->id&amp;course=1\"".
29 "title=\"$fullname\">";
5a254a29 30 require_once($CFG->libdir.'/filelib.php');
31 $userpictureurl = get_file_url($user->id.'/f1.jpg', null, 'user');
32 echo '<img src="'. $userpictureurl .'"'.
33 ' style="border:0px; width:100px; height:100px" alt="'.$fullname.'" />';
0f363686 34 echo "</a> \n";
35 }
0be6f678 36
7e0d6675 37 echo $OUTPUT->footer();