MDL-21198 improved/simplified $OUTPUT->user_picture() + regression fixes, performance fixes and detected performance problems when printing user avatars
This commit is contained in:
@@ -45,7 +45,7 @@ class block_messages extends block_base {
|
||||
foreach ($users as $user) {
|
||||
$timeago = format_time(time() - $user->lastaccess);
|
||||
$this->content->text .= '<li class="listentry"><div class="user"><a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.SITEID.'" title="'.$timeago.'">';
|
||||
$this->content->text .= $OUTPUT->user_picture(moodle_user_picture::make($user, SITEID));
|
||||
$this->content->text .= $OUTPUT->user_picture($user, array('courseid'=>SITEID)); //TODO: user might not have capability to view frontpage profile :-(
|
||||
$this->content->text .= fullname($user).'</a></div>';
|
||||
$this->content->text .= '<div class="message"><a href="'.$CFG->wwwroot.'/message/discussion.php?id='.$user->id.'" onclick="this.target=\'message_'.$user->id.'\'; return openpopup(\'/message/discussion.php?id='.$user->id.'\', \'message_'.$user->id.'\', \'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500\', 0);"><img class="iconsmall" src="'.$OUTPUT->pix_url('t/message') . '" alt="" /> '.$user->count.'</a>';
|
||||
$this->content->text .= '</div></li>';
|
||||
|
||||
@@ -140,16 +140,14 @@ class block_online_users extends block_base {
|
||||
foreach ($users as $user) {
|
||||
$this->content->text .= '<li class="listentry">';
|
||||
$timeago = format_time(time() - $user->lastaccess); //bruno to calculate correctly on frontpage
|
||||
$userpic = moodle_user_picture::make($user, $this->page->course->id);
|
||||
$userpic->size = 16;
|
||||
|
||||
if ($user->username == 'guest') {
|
||||
$this->content->text .= '<div class="user">'.$OUTPUT->user_picture($userpic);
|
||||
$this->content->text .= '<div class="user">'.$OUTPUT->user_picture($user, array('size'=>16));
|
||||
$this->content->text .= get_string('guestuser').'</div>';
|
||||
|
||||
} else {
|
||||
$this->content->text .= '<div class="user"><a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$this->page->course->id.'" title="'.$timeago.'">';
|
||||
$this->content->text .= '<div class="user">'.$OUTPUT->user_picture($userpic);
|
||||
$this->content->text .= '<div class="user">'.$OUTPUT->user_picture($user, array('size'=>16));
|
||||
$this->content->text .= $user->fullname.'</a></div>';
|
||||
}
|
||||
if ($canshowicon and ($USER->id != $user->id) and $user->username != 'guest') { // Only when logged in and messaging active etc
|
||||
|
||||
+1
-1
@@ -138,7 +138,7 @@ class blog_entry {
|
||||
|
||||
$picturecell = new html_table_cell();
|
||||
$picturecell->add_classes('picture left');
|
||||
$picturecell->text = $OUTPUT->user_picture(moodle_user_picture::make($user, SITEID));
|
||||
$picturecell->text = $OUTPUT->user_picture($user);
|
||||
|
||||
$table->head[] = $picturecell;
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ class grade_report_grader_ajax extends grade_report_grader {
|
||||
// Student name and link
|
||||
$user_pic = null;
|
||||
if ($showuserimage) {
|
||||
$user_pic = '<div class="userpic">' . $OUTPUT->user_picture(moodle_user_picture::make($user, $this->courseid)) . '</div>';
|
||||
$user_pic = '<div class="userpic">' . $OUTPUT->user_picture($user) . '</div>';
|
||||
}
|
||||
|
||||
$studentrowhtml .= '<tr class="r'.$this->rowcount++ . $row_classes[$this->rowcount % 2] . '">'
|
||||
|
||||
@@ -601,7 +601,7 @@ class grade_report_grader extends grade_report {
|
||||
$usercell->add_action('click', 'yui_set_row');
|
||||
|
||||
if ($showuserimage) {
|
||||
$usercell->text = $OUTPUT->container($OUTPUT->user_picture(moodle_user_picture::make($user, $this->courseid)), 'userpic');
|
||||
$usercell->text = $OUTPUT->container($OUTPUT->user_picture($user), 'userpic');
|
||||
}
|
||||
|
||||
$usercell->text .= $OUTPUT->link(html_link::make(new moodle_url($CFG->wwwroot.'/user/view.php', array('id' => $user->id, 'course' => $this->course->id)), fullname($user)));
|
||||
|
||||
+2
-8
@@ -396,11 +396,7 @@ EOD;
|
||||
$user->lastname = $c->lastname;
|
||||
$user->imagealt = $c->imagealt;
|
||||
$c->content = format_text($c->content, $c->format);
|
||||
$userpic = moodle_user_picture::make($user, $this->course->id);
|
||||
$userpic->link = true;
|
||||
$userpic->size = 18;
|
||||
$userpic->alttext = true;
|
||||
$c->avatar = $OUTPUT->user_picture($userpic);
|
||||
$c->avatar = $OUTPUT->user_picture($user, array('size'=>18));
|
||||
if (($USER->id == $c->userid) || !empty($candelete)) {
|
||||
$c->delete = true;
|
||||
}
|
||||
@@ -485,9 +481,7 @@ EOD;
|
||||
$newcmt->time = userdate($now, get_string('strftimerecent', 'langconfig'));
|
||||
$newcmt->username = fullname($USER);
|
||||
$newcmt->content = format_text($newcmt->content);
|
||||
$userpic = moodle_user_picture::make($USER, $this->course->id);
|
||||
$userpic->size = 16;
|
||||
$newcmt->avatar = $OUTPUT->user_picture($userpic);
|
||||
$newcmt->avatar = $OUTPUT->user_picture($user, array('size'=>16));
|
||||
return $newcmt;
|
||||
} else {
|
||||
throw new comment_exception('dbupdatefailed');
|
||||
|
||||
+11
-14
@@ -2661,26 +2661,23 @@ function print_file_picture($path, $courseid=0, $height='', $width='', $link='',
|
||||
* @return string|void String or nothing, depending on $return.
|
||||
*/
|
||||
function print_user_picture($user, $courseid, $picture=NULL, $size=0, $return=false, $link=true, $target='', $alttext=true) {
|
||||
global $CFG, $DB, $OUTPUT;
|
||||
global $OUTPUT;
|
||||
|
||||
debugging('print_user_picture() has been deprecated. Please change your code to use $OUTPUT->user_picture($user, $courseid).');
|
||||
debugging('print_user_picture() has been deprecated. Please change your code to use $OUTPUT->user_picture($user, array(\'courseid\'=>$courseid).');
|
||||
|
||||
$userpic = new moodle_user_picture();
|
||||
$userpic->user = $user;
|
||||
$userpic->courseid = $courseid;
|
||||
$userpic->size = $size;
|
||||
$userpic->link = $link;
|
||||
$userpic->alttext = $alttext;
|
||||
|
||||
if (!empty($picture)) {
|
||||
$userpic->image->src = $picture;
|
||||
if (!is_object($user)) {
|
||||
$userid = $user;
|
||||
$user = new object();
|
||||
$user->id = $userid;
|
||||
}
|
||||
|
||||
if (!empty($target)) {
|
||||
$userpic->add_action(new popup_action('click', new moodle_url($target)));
|
||||
if (empty($user->picture) and $picture) {
|
||||
$user->picture = $picture;
|
||||
}
|
||||
|
||||
$output = $OUTPUT->user_picture($userpic);
|
||||
$options = array('size'=>$size, 'link'=>$link, 'alttext'=>$alttext, 'courseid'=>$courseid, 'popup'=>!empty($target));
|
||||
|
||||
$output = $OUTPUT->user_picture($user, $options);
|
||||
|
||||
if ($return) {
|
||||
return $output;
|
||||
|
||||
+53
-81
@@ -1367,7 +1367,7 @@ class html_image extends labelled_html_component {
|
||||
throw new coding_exception('html_image requires a $src value (moodle_url).');
|
||||
}
|
||||
|
||||
$this->add_class('image');
|
||||
$this->add_class('image'); //TODO. remove this like somehow
|
||||
parent::prepare($output, $page, $target);
|
||||
}
|
||||
|
||||
@@ -1817,43 +1817,38 @@ class moodle_paging_bar extends moodle_html_component {
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since Moodle 2.0
|
||||
*/
|
||||
class moodle_user_picture extends moodle_html_component {
|
||||
class user_picture extends html_image {
|
||||
/**
|
||||
* @var mixed $user A userid or a user object with at least fields id, picture, imagealrt, firstname and lastname set.
|
||||
* @var mixed $user A user object with at least fields id, picture, imagealt, firstname and lastname set.
|
||||
*/
|
||||
public $user;
|
||||
/**
|
||||
* @var int $courseid The course id. Used when constructing the link to the user's profile.
|
||||
* @var int $courseid The course id. Used when constructing the link to the user's profile,
|
||||
* page course id used if not specified.
|
||||
*/
|
||||
public $courseid;
|
||||
/**
|
||||
* @var html_image $image A custom image used as the user picture.
|
||||
* @var bool $link add course profile link to image
|
||||
*/
|
||||
public $image;
|
||||
/**
|
||||
* @var mixed $url False: picture not enclosed in a link. True: default link. moodle_url: custom link.
|
||||
*/
|
||||
public $url;
|
||||
public $link = true;
|
||||
/**
|
||||
* @var int $size Size in pixels. Special values are (true/1 = 100px) and (false/0 = 35px) for backward compatibility
|
||||
*/
|
||||
public $size;
|
||||
public $size = 35;
|
||||
/**
|
||||
* @var boolean $alttext add non-blank alt-text to the image. (Default true, set to false for purely
|
||||
* @var boolean $alttext add non-blank alt-text to the image.
|
||||
* Default true, set to false when image alt just duplicates text in screenreaders.
|
||||
*/
|
||||
public $alttext = true;
|
||||
/**
|
||||
* @var boolean $popup Whether or not to open the link in a popup window
|
||||
* @var boolean $popup Whether or not to open the link in a popup window.
|
||||
*/
|
||||
public $popup = false;
|
||||
|
||||
/**
|
||||
* Constructor: sets up the other components in case they are needed
|
||||
* @return void
|
||||
* @var link to profile if link requested
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->image = new html_image();
|
||||
}
|
||||
public $url;
|
||||
|
||||
/**
|
||||
* @see lib/moodle_html_component#prepare()
|
||||
@@ -1863,55 +1858,52 @@ class moodle_user_picture extends moodle_html_component {
|
||||
global $CFG, $DB;
|
||||
|
||||
if (empty($this->user)) {
|
||||
throw new coding_exception('A moodle_user_picture object must have a $user object before being rendered.');
|
||||
throw new coding_exception('A user_picture object must have a $user object before being rendered.');
|
||||
}
|
||||
|
||||
if (empty($this->user->id)) {
|
||||
throw new coding_exception('User id missing in $user object.');
|
||||
}
|
||||
|
||||
if (empty($this->courseid)) {
|
||||
throw new coding_exception('A moodle_user_picture object must have a courseid value before being rendered.');
|
||||
}
|
||||
|
||||
if (!($this->image instanceof html_image)) {
|
||||
debugging('moodle_user_picture::image must be an instance of html_image', DEBUG_DEVELOPER);
|
||||
$courseid = $page->course->id;
|
||||
} else {
|
||||
$courseid = $this->courseid;
|
||||
}
|
||||
|
||||
// only touch the DB if we are missing data and complain loudly...
|
||||
$needrec = false;
|
||||
// only touch the DB if we are missing data...
|
||||
if (is_object($this->user)) {
|
||||
// Note - both picture and imagealt _can_ be empty
|
||||
// what we are trying to see here is if they have been fetched
|
||||
// from the DB. We should use isset() _except_ that some installs
|
||||
// have those fields as nullable, and isset() will return false
|
||||
// on null. The only safe thing is to ask array_key_exists()
|
||||
// which works on objects. property_exists() isn't quite
|
||||
// what we want here...
|
||||
if (! (array_key_exists('picture', $this->user)
|
||||
&& ($this->alttext && array_key_exists('imagealt', $this->user)
|
||||
|| (isset($this->user->firstname) && isset($this->user->lastname)))) ) {
|
||||
|
||||
if (!array_key_exists('picture', $this->user)) {
|
||||
$needrec = true;
|
||||
debugging('Missing picture property in $user object, this is a performance problem that needs to be fixed by a developer.', DEBUG_DEVELOPER);
|
||||
}
|
||||
if ($this->alttext) {
|
||||
if (!array_key_exists('firstname', $this->user) || !array_key_exists('lastname', $this->user) || !array_key_exists('imagealt', $this->user)) {
|
||||
$needrec = true;
|
||||
$this->user = $this->user->id;
|
||||
debugging('Missing firstname, lastname or imagealt property in $user object, this is a performance problem that needs to be fixed by a developer.', DEBUG_DEVELOPER);
|
||||
}
|
||||
}
|
||||
|
||||
if ($needrec) {
|
||||
$this->user = $DB->get_record('user', array('id'=>$this->user->id), 'id, firstname, lastname, imagealt');
|
||||
}
|
||||
|
||||
if ($this->alttext) {
|
||||
if (!empty($user->imagealt)) {
|
||||
$this->alt = $user->imagealt;
|
||||
} else {
|
||||
$this->alt = get_string('pictureof', '', fullname($this->user));
|
||||
}
|
||||
} else {
|
||||
if ($this->alttext) {
|
||||
// we need firstname, lastname, imagealt, can't escape...
|
||||
$needrec = true;
|
||||
} else {
|
||||
$userobj = new StdClass; // fake it to save DB traffic
|
||||
$userobj->id = $this->user;
|
||||
$userobj->picture = $this->image->src;
|
||||
$this->user = clone($userobj);
|
||||
unset($userobj);
|
||||
}
|
||||
}
|
||||
if ($needrec) {
|
||||
$this->user = $DB->get_record('user', array('id' => $this->user), 'id,firstname,lastname,imagealt');
|
||||
$this->alt = HTML_ATTR_EMPTY;
|
||||
}
|
||||
|
||||
if ($this->url === true) {
|
||||
$this->url = new moodle_url('/user/view.php', array('id' => $this->user->id, 'course' => $this->courseid));
|
||||
}
|
||||
|
||||
if (!empty($this->url) && $this->popup) {
|
||||
$this->add_action(new popup_action('click', $this->url));
|
||||
if ($this->link) {
|
||||
$this->url = new moodle_url('/user/view.php', array('id' => $this->user->id, 'course' => $courseid));
|
||||
} else {
|
||||
$this->url = null;
|
||||
$this->popup = false;
|
||||
}
|
||||
|
||||
if (empty($this->size)) {
|
||||
@@ -1927,42 +1919,22 @@ class moodle_user_picture extends moodle_html_component {
|
||||
}
|
||||
|
||||
if (!empty($this->size)) {
|
||||
$this->image->width = $this->size;
|
||||
$this->image->height = $this->size;
|
||||
$this->width = $this->size;
|
||||
$this->height = $this->size;
|
||||
}
|
||||
|
||||
$this->add_class('userpicture');
|
||||
|
||||
if (empty($this->image->src) && !empty($this->user->picture)) {
|
||||
$this->image->src = $this->user->picture;
|
||||
}
|
||||
|
||||
if (!empty($this->image->src)) {
|
||||
if (!empty($this->user->picture)) {
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
$this->image->src = new moodle_url(get_file_url($this->user->id.'/'.$file.'.jpg', null, 'user'));
|
||||
$this->src = new moodle_url(get_file_url($this->user->id.'/'.$file.'.jpg', null, 'user'));
|
||||
} else { // Print default user pictures (use theme version if available)
|
||||
$this->add_class('defaultuserpic');
|
||||
$this->image->src = $output->pix_url('u/' . $file);
|
||||
}
|
||||
|
||||
if ($this->alttext) {
|
||||
if (!empty($this->user->imagealt)) {
|
||||
$this->image->alt = $this->user->imagealt;
|
||||
} else {
|
||||
// No alt text when there is nothing useful (accessibility)
|
||||
$this->image->alt = HTML_ATTR_EMPTY;
|
||||
}
|
||||
$this->src = $output->pix_url('u/' . $file);
|
||||
}
|
||||
|
||||
parent::prepare($output, $page, $target);
|
||||
}
|
||||
|
||||
public static function make($user, $courseid) {
|
||||
$userpic = new moodle_user_picture();
|
||||
$userpic->user = $user;
|
||||
$userpic->courseid = $courseid;
|
||||
return $userpic;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+41
-38
@@ -1177,58 +1177,61 @@ class core_renderer extends renderer_base {
|
||||
*
|
||||
* This method can be used in two ways:
|
||||
* <pre>
|
||||
* // Option 1:
|
||||
* $userpic = new moodle_user_picture();
|
||||
* // Set properties of $userpic
|
||||
* $OUTPUT->user_picture($userpic);
|
||||
*
|
||||
* // Option 2: (shortcut for simple cases)
|
||||
* // Option 1: (shortcut for simple cases, preferred way)
|
||||
* // $user has come from the DB and has fields id, picture, imagealt, firstname and lastname
|
||||
* $OUTPUT->user_picture($user, $COURSE->id);
|
||||
* $OUTPUT->user_picture($user, array('popup'=>true));
|
||||
*
|
||||
* // Option 2: (not recommended)
|
||||
* $userpic = new user_picture();
|
||||
* // Set properties of $userpic
|
||||
* $userpic->user = $user;
|
||||
* $userpic->popup = true;
|
||||
* $OUTPUT->user_picture($userpic);
|
||||
* </pre>
|
||||
*
|
||||
* @param object $userpic Object with at least fields id, picture, imagealt, firstname, lastname
|
||||
* If any of these are missing, or if a userid is passed, the database is queried. Avoid this
|
||||
* @param object $user_or_userpicture Object with at least fields id, picture, imagealt, firstname, lastname
|
||||
* If any of these are missing, the database is queried. Avoid this
|
||||
* if at all possible, particularly for reports. It is very bad for performance.
|
||||
* A moodle_user_picture object is a better parameter.
|
||||
* @param int $courseid courseid Used when constructing the link to the user's profile. Required if $userpic
|
||||
* is not a moodle_user_picture object
|
||||
* @param array $options associative array with user picture options, used only if not a user_picture object,
|
||||
* options are:
|
||||
* - courseid=$this->page->course->id (course id of user profile in link)
|
||||
* - size=35 (size of image)
|
||||
* - link=true (make image clickable - the link leads to user profile)
|
||||
* - popup=false (open in popup)
|
||||
* - alttext=true (add image alt attribute)
|
||||
* @return string HTML fragment
|
||||
*/
|
||||
public function user_picture($userpic, $courseid=null) {
|
||||
// Instantiate a moodle_user_picture object if $user is not already one
|
||||
if (!($userpic instanceof moodle_user_picture)) {
|
||||
if (empty($courseid)) {
|
||||
throw new coding_exception('Called $OUTPUT->user_picture with a $user object but no $courseid.');
|
||||
}
|
||||
public function user_picture(stdClass $user_or_userpicture, array $options = null) {
|
||||
|
||||
if ($user_or_userpicture instanceof user_picture) {
|
||||
// we need a clone because prepare() should not be called repeatedly
|
||||
$userpic = clone($user_or_userpicture);
|
||||
|
||||
$user = $userpic;
|
||||
$userpic = new moodle_user_picture();
|
||||
$userpic->user = $user;
|
||||
$userpic->courseid = $courseid;
|
||||
} else {
|
||||
$userpic = clone($userpic);
|
||||
$userpic = new user_picture();
|
||||
$userpic->user = $user_or_userpicture;
|
||||
$options = (array)$options;
|
||||
$allowed = array('courseid', 'size', 'link', 'popup', 'alttext');
|
||||
foreach ($allowed as $key) {
|
||||
if (array_key_exists($key, $options)) {
|
||||
$userpic->$key = $options[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$userpic->prepare($this, $this->page, $this->target);
|
||||
|
||||
$output = $this->image($userpic->image);
|
||||
// get the image html output fisrt, then wrap it in link if needed
|
||||
$output = $this->image($userpic);
|
||||
|
||||
if (!empty($userpic->url)) {
|
||||
$actions = $userpic->get_actions();
|
||||
if ($userpic->popup && !empty($actions)) {
|
||||
$link = new html_link();
|
||||
$link->url = $userpic->url;
|
||||
$link->text = fullname($userpic->user);
|
||||
$link->title = fullname($userpic->user);
|
||||
|
||||
foreach ($actions as $action) {
|
||||
$link->add_action($action);
|
||||
}
|
||||
$output = $this->link_to_popup($link, $userpic->image);
|
||||
} else {
|
||||
$output = $this->link(prepare_url($userpic->url), $output);
|
||||
if ($userpic->link) {
|
||||
$link = new html_link();
|
||||
$link->url = $userpic->url;
|
||||
$link->text = $output;
|
||||
if ($userpic->popup) {
|
||||
$link->add_action(new popup_action('click', $userpic->url));
|
||||
}
|
||||
$output = $this->link($link);
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
||||
@@ -879,7 +879,7 @@ class core_renderer_test extends UnitTestCase {
|
||||
$user->picture = false;
|
||||
$user->imagealt = false;
|
||||
$user->id = 1;
|
||||
$userpic = new moodle_user_picture();
|
||||
$userpic = new user_picture();
|
||||
$userpic->user = $user;
|
||||
$userpic->courseid = 1;
|
||||
$userpic->url = true;
|
||||
|
||||
@@ -166,10 +166,7 @@
|
||||
|
||||
echo '<div class="message-discussion-noframes">';
|
||||
echo '<div id="userinfo">';
|
||||
$userpic = moodle_user_picture::make($user, SITEID);
|
||||
$userpic->size = 48;
|
||||
$userpic->link = true;
|
||||
echo $OUTPUT->user_picture($userpic);
|
||||
echo $OUTPUT->user_picture($user, array('size'=>48, 'courseid'=>SITEID));
|
||||
echo '<div class="name"><h1>'.$userfullname.'</h1></div>';
|
||||
echo '<div class="commands"><ul>';
|
||||
if ($contact = $DB->get_record('message_contacts', array('userid'=>$USER->id, 'contactid'=>$user->id))) {
|
||||
|
||||
+2
-8
@@ -81,10 +81,7 @@ echo $OUTPUT->header();
|
||||
echo $OUTPUT->box_start('center');
|
||||
echo '<table align="center" cellpadding="10"><tr>';
|
||||
echo '<td align="center">';
|
||||
$userpic = moodle_user_picture::make($user1, SITEID);
|
||||
$userpic->size = 100;
|
||||
$userpic->link = true;
|
||||
echo $OUTPUT->user_picture($userpic).'<br />';
|
||||
echo $OUTPUT->user_picture($user1, array('size'=>100, 'courseid'=>SITEID)).'<br />';
|
||||
echo fullname($user1);
|
||||
echo '</td>';
|
||||
echo '<td align="center">';
|
||||
@@ -92,10 +89,7 @@ echo '<img src="'.$CFG->wwwroot.'/pix/t/left.gif" alt="'.get_string('from').'" /
|
||||
echo '<img src="'.$CFG->wwwroot.'/pix/t/right.gif" alt="'.get_string('to').'" />';
|
||||
echo '</td>';
|
||||
echo '<td align="center">';
|
||||
$userpic = moodle_user_picture::make($user2, SITEID);
|
||||
$userpic->size = 100;
|
||||
$userpic->link = true;
|
||||
echo $OUTPUT->user_picture($userpic).'<br />';
|
||||
echo $OUTPUT->user_picture($user2, array('size'=>100, 'courseid'=>SITEID)).'<br />';
|
||||
echo fullname($user2);
|
||||
echo '</td>';
|
||||
echo '</tr></table>';
|
||||
|
||||
+4
-13
@@ -354,10 +354,7 @@ function message_print_search_results($frm) {
|
||||
$strhistory = message_history_link($user->id, 0, true, '', '', 'icon');
|
||||
|
||||
echo '<tr><td class="pix">';
|
||||
$userpic = moodle_user_picture::make($user, SITEID);
|
||||
$userpic->size = 20;
|
||||
$userpic->link = true;
|
||||
echo $OUTPUT->user_picture($userpic);
|
||||
echo $OUTPUT->user_picture($user, array('size'=>20, 'courseid'=>SITEID));
|
||||
echo '</td>';
|
||||
echo '<td class="contact">';
|
||||
$popupoptions = array(
|
||||
@@ -529,14 +526,11 @@ function message_print_search_results($frm) {
|
||||
|
||||
function message_print_user ($user=false, $iscontact=false, $isblocked=false) {
|
||||
global $USER, $OUTPUT;
|
||||
$userpic = moodle_user_picture::make($USER, SITEID);
|
||||
$userpic->size = 20;
|
||||
$userpic->link = true;
|
||||
|
||||
if ($user === false) {
|
||||
echo $OUTPUT->user_picture($userpic);
|
||||
echo $OUTPUT->user_picture($USER, array('size'=>20, 'courseid'=>SITEID));
|
||||
} else {
|
||||
echo $OUTPUT->user_picture($userpic);
|
||||
echo $OUTPUT->user_picture($USE, array('size'=>20, 'courseid'=>SITEID));
|
||||
echo ' ';
|
||||
if ($iscontact) {
|
||||
message_contact_link($user->id, 'remove');
|
||||
@@ -1072,10 +1066,7 @@ function message_print_contactlist_user($contact, $incontactlist = true){
|
||||
$strhistory = message_history_link($contact->id, 0, true, '', '', 'icon');
|
||||
|
||||
echo '<tr><td class="pix">';
|
||||
$userpic = moodle_user_picture::make($contact, SITEID);
|
||||
$userpic->size = 20;
|
||||
$userpic->link = true;
|
||||
echo $OUTPUT->user_picture($userpic);
|
||||
echo $OUTPUT->user_picture($contact, array('size'=>20, 'courseid'=>SITEID));
|
||||
echo '</td>';
|
||||
echo '<td class="contact">';
|
||||
|
||||
|
||||
+1
-4
@@ -90,10 +90,7 @@ $PAGE->set_pagelayout('popup');
|
||||
echo $OUTPUT->header();
|
||||
echo '<table width="100%" cellpadding="0" cellspacing="0"><tr>';
|
||||
echo '<td width="100">';
|
||||
$userpic = moodle_user_picture::make($user, SITEID);
|
||||
$userpic->size = 48;
|
||||
$userpic->link = true;
|
||||
echo $OUTPUT->user_picture($userpic) .'</td>';
|
||||
echo $OUTPUT->user_picture($user, array('size'=>48, 'courseid'=>SITEID)) .'</td>';
|
||||
echo '<td valign="middle" align="center">';
|
||||
|
||||
echo '<div class="name">'.fullname($user).'</div>';
|
||||
|
||||
@@ -299,7 +299,7 @@ class assignment_base {
|
||||
echo '<tr>';
|
||||
echo '<td class="left picture">';
|
||||
if ($teacher) {
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($teacher, $this->course->id));
|
||||
echo $OUTPUT->user_picture($teacher);
|
||||
}
|
||||
echo '</td>';
|
||||
echo '<td class="topic">';
|
||||
@@ -947,7 +947,7 @@ class assignment_base {
|
||||
global $USER;
|
||||
$teacher = $USER;
|
||||
}
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($teacher, $this->course->id));
|
||||
echo $OUTPUT->user_picture($teacher);
|
||||
echo '</td>';
|
||||
echo '<td class="content">';
|
||||
echo '<form id="submitform" action="submissions.php" method="post">';
|
||||
@@ -1040,7 +1040,7 @@ class assignment_base {
|
||||
///End of teacher info row, Start of student info row
|
||||
echo '<tr>';
|
||||
echo '<td class="picture user">';
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($user, $this->course->id));
|
||||
echo $OUTPUT->user_picture($user);
|
||||
echo '</td>';
|
||||
echo '<td class="topic">';
|
||||
echo '<div class="from">';
|
||||
@@ -1259,7 +1259,7 @@ class assignment_base {
|
||||
|
||||
/// Calculate user status
|
||||
$auser->status = ($auser->timemarked > 0) && ($auser->timemarked >= $auser->timemodified);
|
||||
$picture = $OUTPUT->user_picture(moodle_user_picture::make($auser, $course->id));
|
||||
$picture = $OUTPUT->user_picture($auser);
|
||||
|
||||
if (empty($auser->submissionid)) {
|
||||
$auser->grade = -1; //no submission yet
|
||||
@@ -2889,7 +2889,7 @@ function assignment_print_recent_mod_activity($activity, $courseid, $detail, $mo
|
||||
echo '<table border="0" cellpadding="3" cellspacing="0" class="assignment-recent">';
|
||||
|
||||
echo "<tr><td class=\"userpicture\" valign=\"top\">";
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($activity->user, $courseid));
|
||||
echo $OUTPUT->user_picture($activity->user);
|
||||
echo "</td><td>";
|
||||
|
||||
if ($detail) {
|
||||
|
||||
@@ -116,7 +116,7 @@ class assignment_upload extends assignment_base {
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td class="left picture">';
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($teacher, $this->course->id));
|
||||
echo $OUTPUT->user_picture($teacher);
|
||||
echo '</td>';
|
||||
echo '<td class="topic">';
|
||||
echo '<div class="from">';
|
||||
|
||||
+1
-1
@@ -281,7 +281,7 @@ EOD;
|
||||
$popuppar = '\'/user/view.php?id='.$userinfo['user']->id.'&course='.$userinfo['courseid'].'\',\'user'.$userinfo['chatuser']->id.'\',\'\'';
|
||||
echo '<tr><td width="35">';
|
||||
echo '<a target="_new" onclick="return openpopup('.$popuppar.');" href="'.$CFG->wwwroot.'/user/view.php?id='.$userinfo['chatuser']->id.'&course='.$userinfo['courseid'].'">';
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($userinfo['user'], 0));
|
||||
echo $OUTPUT->user_picture($userinfo['user'], array('courseid'=>$userinfo['courseid']));
|
||||
echo "</a></td><td valign=\"center\">";
|
||||
echo "<p><font size=\"1\">";
|
||||
echo fullname($userinfo['user'])."<br />";
|
||||
|
||||
@@ -120,9 +120,7 @@ echo '<h1>'.get_string('participants').'</h1>';
|
||||
echo '<div id="participants"><ul>';
|
||||
foreach($chatusers as $chu) {
|
||||
echo '<li>';
|
||||
$userpic = moodle_user_picture::make($chu->id, $course->id);
|
||||
$userpic->size = 24;
|
||||
echo $OUTPUT->user_picture($userpic);
|
||||
echo $OUTPUT->user_picture($chu, array('size'=>24, 'courseid'=>$course->id));
|
||||
echo '<div class="userinfo">';
|
||||
echo fullname($chu).' ';
|
||||
if ($idle = time() - $chu->lastmessageping) {
|
||||
|
||||
@@ -91,7 +91,7 @@ foreach ($chatusers as $chatuser) {
|
||||
$idle = $min.':'.$sec;
|
||||
echo '<tr><td width="35">';
|
||||
echo "<a target=\"_blank\" onClick=\"return openpopup('/user/view.php?id=$chatuser->id&course=$courseid','user$chatuser->id','');\" href=\"$CFG->wwwroot/user/view.php?id=$chatuser->id&course=$courseid\">";
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($chatuser, $courseid));
|
||||
echo $OUTPUT->user_picture($chatuser, array('courseid'=>$courseid));
|
||||
echo '</a></td><td valign="center">';
|
||||
echo '<p><font size="1">';
|
||||
echo fullname($chatuser).'<br />';
|
||||
|
||||
+3
-10
@@ -775,14 +775,7 @@ function chat_format_message_manually($message, $courseid, $sender, $currentuser
|
||||
$USER->timezone = $tz;
|
||||
$message->strtime = userdate($message->timestamp, get_string('strftimemessage', 'chat'), $tz);
|
||||
|
||||
$userpic = new moodle_user_picture();
|
||||
$userpic->user = $sender;
|
||||
$userpic->courseid = $courseid;
|
||||
$userpic->size = false;
|
||||
$userpic->link = false;
|
||||
$userpic->alttext = true;
|
||||
$userpic->image->src = $sender->picture;
|
||||
$message->picture = $OUTPUT->user_picture($userpic);
|
||||
$message->picture = $OUTPUT->user_picture($sender, array('size'=>false, 'courseid'=>$courseid, 'link'=>false));
|
||||
|
||||
if ($courseid) {
|
||||
$message->picture = "<a onclick=\"window.open('$CFG->wwwroot/user/view.php?id=$sender->id&course=$courseid')\" href=\"$CFG->wwwroot/user/view.php?id=$sender->id&course=$courseid\">$message->picture</a>";
|
||||
@@ -945,7 +938,7 @@ function chat_format_message_theme ($message, $courseid, $currentuser, $theme =
|
||||
}
|
||||
|
||||
$message->strtime = userdate($message->timestamp, get_string('strftimemessage', 'chat'), $tz);
|
||||
$message->picture = $OUTPUT->user_picture(moodle_user_picture::make($sender, $courseid));
|
||||
$message->picture = $OUTPUT->user_picture($sender, array('courseid'=>$courseid));
|
||||
|
||||
$message->picture = "<a target='_blank' href=\"$CFG->wwwroot/user/view.php?id=$sender->id&course=$courseid\">$message->picture</a>";
|
||||
|
||||
@@ -1076,7 +1069,7 @@ function chat_format_userlist($users, $course) {
|
||||
$item = array();
|
||||
$item['name'] = fullname($user);
|
||||
$item['url'] = $CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$course->id;
|
||||
$item['picture'] = $OUTPUT->user_picture(moodle_user_picture::make($user, $COURSE->id));
|
||||
$item['picture'] = $OUTPUT->user_picture($user);
|
||||
$item['id'] = $user->id;
|
||||
$result[] = $item;
|
||||
}
|
||||
|
||||
+1
-1
@@ -212,7 +212,7 @@
|
||||
arsort($sessionusers);
|
||||
foreach ($sessionusers as $sessionuser => $usermessagecount) {
|
||||
if ($user = $DB->get_record('user', array('id'=>$sessionuser))) {
|
||||
$OUTPUT->user_picture(moodle_user_picture::make($user, $course->id));
|
||||
$OUTPUT->user_picture($user, array('courseid'=>$course->id));
|
||||
echo ' '.fullname($user, true); // XXX TODO use capability instead of true
|
||||
echo " ($usermessagecount)<br />";
|
||||
}
|
||||
|
||||
+1
-1
@@ -178,7 +178,7 @@
|
||||
$lastping = $timenow - $chatuser->lastmessageping;
|
||||
echo '<tr><td class="chatuserimage">';
|
||||
echo "<a href=\"$CFG->wwwroot/user/view.php?id=$chatuser->id&course=$chat->course\">";
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($chatuser, $COURSE->id));
|
||||
echo $OUTPUT->user_picture($chatuser);
|
||||
echo '</a></td><td class="chatuserdetails">';
|
||||
echo '<p>';
|
||||
echo fullname($chatuser).'<br />';
|
||||
|
||||
+2
-2
@@ -477,7 +477,7 @@ function choice_show_results($choice, $course, $cm, $allresponses, $forcepublish
|
||||
foreach ($allresponses[0] as $user) {
|
||||
echo "<tr>";
|
||||
echo "<td class=\"picture\">";
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($user->id, $course->id));
|
||||
echo $OUTPUT->user_picture($user, array('courseid'=>$course->id));
|
||||
echo "</td><td class=\"fullname\">";
|
||||
echo "<a href=\"$CFG->wwwroot/user/view.php?id=$user->id&course=$course->id\">";
|
||||
echo fullname($user, $hascapfullnames);
|
||||
@@ -503,7 +503,7 @@ function choice_show_results($choice, $course, $cm, $allresponses, $forcepublish
|
||||
echo '<input type="checkbox" name="attemptid[]" value="'. $user->id. '" />';
|
||||
}
|
||||
echo '</td><td class="picture">';
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($user->id, $course->id));
|
||||
echo $OUTPUT->user_picture($user, array('courseid'=>$course->id));
|
||||
echo '</td><td class="fullname">';
|
||||
echo "<a href=\"$CFG->wwwroot/user/view.php?id=$user->id&course=$course->id\">";
|
||||
echo fullname($user, $hascapfullnames);
|
||||
|
||||
+1
-3
@@ -73,9 +73,7 @@ if (!$ratings = data_get_ratings($record->id, $sqlsort)) {
|
||||
echo '<tr class="forumpostheader">';
|
||||
}
|
||||
echo '<td class="picture">';
|
||||
$userpic = moodle_user_picture::make($rating, $data->course);
|
||||
$userpic->link = true;
|
||||
echo $OUTPUT->user_picture($userpic);
|
||||
echo $OUTPUT->user_picture($rating, array('courseid'=>$data->course));
|
||||
echo '</td>';
|
||||
echo '<td class="author">' . $OUTPUT->link($CFG->wwwroot.'/user/view.php?id='.$rating->id.'&course='.$data->course, fullname($rating)) . '</td>';
|
||||
echo '<td style="white-space:nowrap" align="center" class="rating">'.$scalemenu[$rating->rating].'</td>';
|
||||
|
||||
@@ -323,7 +323,7 @@ function feedback_print_recent_mod_activity($activity, $courseid, $detail, $modn
|
||||
echo '<table border="0" cellpadding="3" cellspacing="0" class="forum-recent">';
|
||||
|
||||
echo "<tr><td class=\"userpicture\" valign=\"top\">";
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($activity->user, $courseid));
|
||||
echo $OUTPUT->user_picture($activity->user, array('courseid'=>$courseid));
|
||||
echo "</td><td>";
|
||||
|
||||
if ($detail) {
|
||||
|
||||
@@ -145,7 +145,7 @@ if($do_show == 'showentries'){
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td align="left">
|
||||
<?php echo $OUTPUT->user_picture(moodle_user_picture::make($student, $course->id));?>
|
||||
<?php echo $OUTPUT->user_picture($student, array('courseid'=>$course->id));?>
|
||||
</td>
|
||||
<td align="left">
|
||||
<?php echo fullname($student);?>
|
||||
|
||||
+4
-4
@@ -3141,7 +3141,7 @@ function forum_make_mail_post($course, $cm, $forum, $discussion, $post, $userfro
|
||||
$output = '<table border="0" cellpadding="3" cellspacing="0" class="forumpost">';
|
||||
|
||||
$output .= '<tr class="header"><td width="35" valign="top" class="picture left">';
|
||||
$output .= $OUTPUT->user_picture(moodle_user_picture::make($userfrom, $course->id));
|
||||
$output .= $OUTPUT->user_picture($userfrom, array('courseid'=>$course->id));
|
||||
$output .= '</td>';
|
||||
|
||||
if ($post->parent) {
|
||||
@@ -3359,7 +3359,7 @@ function forum_print_post($post, $discussion, $forum, &$cm, $course, $ownpost=fa
|
||||
$postuser->picture = $post->picture;
|
||||
|
||||
echo '<tr class="header"><td class="picture left">';
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($postuser, $course->id));
|
||||
echo $OUTPUT->user_picture($postuser, array('courseid'=>$course->id));
|
||||
echo '</td>';
|
||||
|
||||
if ($post->parent) {
|
||||
@@ -3668,7 +3668,7 @@ function forum_print_discussion_header(&$post, $forum, $group=-1, $datestring=""
|
||||
$postuser->picture = $post->picture;
|
||||
|
||||
echo '<td class="picture">';
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($postuser, $forum->course));
|
||||
echo $OUTPUT->user_picture($postuser, array('courseid'=>$forum->course));
|
||||
echo "</td>\n";
|
||||
|
||||
// User name
|
||||
@@ -6193,7 +6193,7 @@ function forum_print_recent_mod_activity($activity, $courseid, $detail, $modname
|
||||
echo '<table border="0" cellpadding="3" cellspacing="0" class="forum-recent">';
|
||||
|
||||
echo "<tr><td class=\"userpicture\" valign=\"top\">";
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($activity->user, $courseid));
|
||||
echo $OUTPUT->user_picture($activity->user, array('courseid'=>$courseid));
|
||||
echo "</td><td class=\"$class\">";
|
||||
|
||||
echo '<div class="title">';
|
||||
|
||||
@@ -93,7 +93,7 @@ class mod_forum_renderer extends plugin_renderer_base {
|
||||
$table->tablealign = 'center';
|
||||
$table->data = array();
|
||||
foreach ($users as $user) {
|
||||
$table->data[] = array($this->output->user_picture(moodle_user_picture::make($user, $course->id)), fullname($user), $user->email);
|
||||
$table->data[] = array($this->output->user_picture($user, array('courseid'=>$course->id)), fullname($user), $user->email);
|
||||
}
|
||||
$output .= $this->output->table($table);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ if (!$ratings = forum_get_ratings($post->id, $sqlsort)) {
|
||||
foreach ($ratings as $rating) {
|
||||
echo '<tr class="forumpostheader">';
|
||||
echo "<td>";
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($rating, $forum->course));
|
||||
echo $OUTPUT->user_picture($rating, array('courseid'=>$forum->course));
|
||||
echo '</td><td>'.fullname($rating).'</td>';
|
||||
echo '<td style="white-space:nowrap" align="center" class="rating">'.$scalemenu[$rating->rating]."</td>";
|
||||
echo '<td style="white-space:nowrap" align="center" class="time">'.userdate($rating->time)."</td>";
|
||||
|
||||
@@ -15,7 +15,7 @@ function glossary_show_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode='',
|
||||
|
||||
//Use this function to show author's image
|
||||
//Comments: Configuration not supported
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($user, $course->id));
|
||||
echo $OUTPUT->user_picture($user, array('courseid'=>$course->id));
|
||||
|
||||
//Line separator to show this template fine. :-)
|
||||
echo '<br />';
|
||||
|
||||
@@ -13,7 +13,7 @@ function glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode
|
||||
echo '<tr valign="top">';
|
||||
echo '<td class="left picture">';
|
||||
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($user, $course->id));
|
||||
echo $OUTPUT->user_picture($user, array('courseid'=>$course->id));
|
||||
|
||||
echo '</td>';
|
||||
echo '<th class="entryheader">';
|
||||
|
||||
@@ -13,7 +13,7 @@ function glossary_show_entry_fullwithauthor($course, $cm, $glossary, $entry, $mo
|
||||
echo '<tr valign="top">';
|
||||
|
||||
echo '<td class="picture">';
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($user, $course->id));
|
||||
echo $OUTPUT->user_picture($user, array('courseid'=>$course->id));
|
||||
echo '</td>';
|
||||
|
||||
echo '<th class="entryheader">';
|
||||
|
||||
@@ -75,9 +75,7 @@ if (!$ratings = glossary_get_ratings($entry->id, $sqlsort)) {
|
||||
echo '<tr>';
|
||||
}
|
||||
echo '<td class="picture">';
|
||||
$userpic = moodle_user_picture::make($rating, $glossary->course);
|
||||
$userpic->link = true;
|
||||
echo $OUTPUT->user_picture($userpic);
|
||||
echo $OUTPUT->user_picture($rating, array('courseid'=>$glossary->course));
|
||||
echo '</td>';
|
||||
echo '<td class="author"><a href="'.$CFG->wwwroot.'/user/view.php?id='.$rating->id.'&course='.$glossary->course.'">'.fullname($rating).'</a></td>';
|
||||
echo '<td style="white-space:nowrap" align="center" class="rating">'.$scalemenu[$rating->rating].'</td>';
|
||||
|
||||
@@ -446,7 +446,7 @@ if ($allentries) {
|
||||
echo '<th align="left">';
|
||||
|
||||
$user = $DB->get_record("user", array("id"=>$entry->userid));
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($user, $course->id));
|
||||
echo $OUTPUT->user_picture($user, array('courseid'=>$course->id));
|
||||
$pivottoshow = fullname($user, has_capability('moodle/site:viewfullnames', get_context_instance(CONTEXT_COURSE, $course->id)));
|
||||
} else {
|
||||
echo '<th >';
|
||||
|
||||
+1
-1
@@ -1258,7 +1258,7 @@ function hotpot_print_recent_mod_activity($activity, $course, $detail=false) {
|
||||
print '<table border="0" cellpadding="3" cellspacing="0">';
|
||||
|
||||
print '<tr><td'.$bgcolor.' class="forumpostpicture" width="35" valign="top">';
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($activity->user, $course));
|
||||
echo $OUTPUT->user_picture($activity->user, array('courseid'=>$course));
|
||||
print '</td><td width="100%"><font size="2">';
|
||||
|
||||
if ($detail) {
|
||||
|
||||
@@ -48,7 +48,10 @@ class hotpot_report extends hotpot_default_report {
|
||||
$picture = '';
|
||||
$name = fullname($u);
|
||||
if ($is_html) {
|
||||
$picture = $OUTPUT->user_picture(moodle_user_picture::make($u->userid, $course->id));
|
||||
//grrrr
|
||||
$usr = clone($u);
|
||||
$u->id = $u->userid;
|
||||
$picture = $OUTPUT->user_picture($usr, array('courseid'=>$course->id));
|
||||
$name = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$u->userid.'&course='.$course->id.'">'.$name.'</a>';
|
||||
}
|
||||
$grade = isset($user->grade) && $user->grade<>' ' ? $user->grade : $spacer;
|
||||
|
||||
@@ -57,7 +57,7 @@ class hotpot_report extends hotpot_default_report {
|
||||
$picture = '';
|
||||
$name = fullname($u);
|
||||
if ($is_html) {
|
||||
$picture = $OUTPUT->user_picture(moodle_user_picture::make($u, $course->id));
|
||||
$picture = $OUTPUT->user_picture($u, array('courseid'=>$course->id));
|
||||
$name = $OUTPUT->link($CFG->wwwroot.'/user/view.php?id='.$u->userid.'&course='.$course->id, $name);
|
||||
}
|
||||
if (isset($user->grade)) {
|
||||
|
||||
@@ -347,7 +347,7 @@ switch ($mode) {
|
||||
$url = new moodle_url($CFG->wwwroot.'/mod/lesson/essay.php', array('id'=>$cm->id,'mode'=>'email','userid'=>$userid,'sesskey'=>sesskey()));
|
||||
$emaillink = $OUTPUT->link(html_link::make($url, get_string('emailgradedessays', 'lesson')));
|
||||
|
||||
$table->data[] = array($OUTPUT->user_picture(moodle_user_picture::make($users[$userid], $course->id)).$studentname, implode("<br />", $essaylinks), $emaillink);
|
||||
$table->data[] = array($OUTPUT->user_picture($users[$userid], array('courseid'=>$course->id)).$studentname, implode("<br />", $essaylinks), $emaillink);
|
||||
}
|
||||
|
||||
// email link for all users
|
||||
|
||||
@@ -506,7 +506,7 @@ if ($action == 'reportoverview') {
|
||||
|
||||
$gradeinfo = lesson_grade($lesson, $try, $user->id);
|
||||
|
||||
$table->data[] = array(get_string('name').':', $OUTPUT->user_picture(moodle_user_picture::make($user, $course->id)).fullname($user, true));
|
||||
$table->data[] = array(get_string('name').':', $OUTPUT->user_picture($user, array('courseid'=>$course->id)).fullname($user, true));
|
||||
$table->data[] = array(get_string("timetaken", "lesson").":", format_time($timetotake));
|
||||
$table->data[] = array(get_string("completed", "lesson").":", userdate($completed));
|
||||
$table->data[] = array(get_string('rawgrade', 'lesson').':', $gradeinfo->earned.'/'.$gradeinfo->total);
|
||||
|
||||
@@ -1062,7 +1062,7 @@ abstract class quiz_nav_panel_base {
|
||||
$user = $DB->get_record('user', array('id' => $this->attemptobj->get_userid()));
|
||||
$output = '';
|
||||
$output .= '<div id="user-picture" class="clearfix">';
|
||||
$output .= $OUTPUT->user_picture(moodle_user_picture::make($user, $this->attemptobj->get_courseid()));
|
||||
$output .= $OUTPUT->user_picture($user, array('courseid'=>$this->attemptobj->get_courseid()));
|
||||
$output .= ' ' . fullname($user);
|
||||
$output .= '</div>';
|
||||
return $output;
|
||||
|
||||
+1
-1
@@ -839,7 +839,7 @@ function quiz_print_recent_mod_activity($activity, $courseid, $detail, $modnames
|
||||
echo '<table border="0" cellpadding="3" cellspacing="0" class="forum-recent">';
|
||||
|
||||
echo "<tr><td class=\"userpicture\" valign=\"top\">";
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($activity->user, $courseid));
|
||||
echo $OUTPUT->user_picture($activity->user, array('courseid'=>$courseid));
|
||||
echo "</td><td>";
|
||||
|
||||
if ($detail) {
|
||||
|
||||
@@ -296,7 +296,9 @@ class quiz_grading_report extends quiz_default_report {
|
||||
$table->add_separator();
|
||||
foreach($attempts as $attempt) {
|
||||
|
||||
$picture = $OUTPUT->user_picture(moodle_user_picture::make($attempt->userid, $quiz->course));
|
||||
//TODO: this is a performance problem, fetch user info elsewhere!!
|
||||
$user = (object)array('id'=>$attempt->userid);
|
||||
$picture = $OUTPUT->user_picture($user, array('courseid'=>$quiz->course));
|
||||
|
||||
// link to student profile
|
||||
$userlink = "<a href=\"$CFG->wwwroot/user/view.php?id=$attempt->userid&course=$quiz->course\">".
|
||||
|
||||
@@ -123,7 +123,7 @@ class quiz_report_overview_table extends table_sql {
|
||||
$user->firstname = $attempt->firstname;
|
||||
$user->imagealt = $attempt->imagealt;
|
||||
$user->picture = $attempt->picture;
|
||||
return $OUTPUT->user_picture(moodle_user_picture::make($user, $COURSE->id));
|
||||
return $OUTPUT->user_picture($user);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ class quiz_report_responses_table extends table_sql {
|
||||
$user->firstname = $attempt->firstname;
|
||||
$user->imagealt = $attempt->imagealt;
|
||||
$user->picture = $attempt->picture;
|
||||
return $OUTPUT->user_picture(moodle_user_picture::make($user, $COURSE->id));
|
||||
return $OUTPUT->user_picture($user);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -148,7 +148,7 @@
|
||||
if (!$attemptobj->get_quiz()->showuserpicture && $attemptobj->get_userid() <> $USER->id) {
|
||||
/// If showuserpicture is true, the picture is shown elsewhere, so don't repeat it.
|
||||
$student = $DB->get_record('user', array('id' => $attemptobj->get_userid()));
|
||||
$picture = $OUTPUT->user_picture(moodle_user_picture::make($student, $attemptobj->get_courseid()));
|
||||
$picture = $OUTPUT->user_picture($student, array('courseid'=>$attemptobj->get_courseid()));
|
||||
$rows[] = '<tr><th scope="row" class="cell">' . $picture . '</th><td class="cell"><a href="' .
|
||||
$CFG->wwwroot . '/user/view.php?id=' . $student->id . '&course=' . $attemptobj->get_courseid() . '">' .
|
||||
fullname($student, true) . '</a></td></tr>';
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
if ($attemptobj->get_userid() <> $USER->id) {
|
||||
// Print user picture and name
|
||||
$student = $DB->get_record('user', array('id' => $attemptobj->get_userid()));
|
||||
$picture = $OUTPUT->user_picture(moodle_user_picture::make($student, $attemptobj->get_courseid()));
|
||||
$picture = $OUTPUT->user_picture($student, array('courseid'=>$attemptobj->get_courseid()));
|
||||
$rows[] = '<tr><th scope="row" class="cell">' . $picture . '</th><td class="cell"><a href="' .
|
||||
$CFG->wwwroot . '/user/view.php?id=' . $student->id . '&course=' . $attemptobj->get_courseid() . '">' .
|
||||
fullname($student, true) . '</a></td></tr>';
|
||||
|
||||
@@ -174,9 +174,9 @@
|
||||
if (has_capability('mod/scorm:deleteresponses',$contextmodule)) {
|
||||
$row[] = '<input type="checkbox" name="attemptid[]" value="'. $scouser->userid . ':' . $a . '" />';
|
||||
}
|
||||
$userpic = moodle_user_picture::make($scouser->userid, $course->id);
|
||||
$userpic->image->src = $userdata->picture;
|
||||
$row[] = $OUTPUT->user_picture($userpic);
|
||||
//TODO: fetch the user details elsewhere - this is a performance problem!!
|
||||
$user = (object)array('id'=>$scouser->id);
|
||||
$row[] = $OUTPUT->user_picture($user, array('courseid'=>$course->id));
|
||||
$row[] = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$scouser->userid.'&course='.$course->id.'">'.
|
||||
fullname($userdata).'</a>';
|
||||
$row[] = '<a href="report.php?a='.$scorm->id.'&user='.$scouser->userid.'&attempt='.$a.'">'.$a.'</a>';
|
||||
@@ -228,9 +228,7 @@
|
||||
if (!empty($userdata)) {
|
||||
echo $OUTPUT->box_start('generalbox boxaligncenter');
|
||||
echo '<div class="mdl-align">'."\n";
|
||||
$userpic = moodle_user_picture::make($user, $course->id);
|
||||
$userpic->image->src = $userdata->picture;
|
||||
echo $OUTPUT->user_picture($userpic);
|
||||
echo $OUTPUT->user_picture($user, array('courseid'=>$course->id));
|
||||
echo "<a href=\"$CFG->wwwroot/user/view.php?id=$user&course=$course->id\">".
|
||||
"$userdata->firstname $userdata->lastname</a><br />";
|
||||
echo get_string('attempt','scorm').': '.$attempt;
|
||||
@@ -292,9 +290,7 @@
|
||||
//print_heading(format_string($sco->title));
|
||||
echo $OUTPUT->heading('<a href="'.$CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&mode=browse&scoid='.$sco->id.'" target="_new">'.format_string($sco->title).'</a>');
|
||||
echo '<div class="mdl-align">'."\n";
|
||||
$userpic = moodle_user_picture::make($user, $course->id);
|
||||
$userpic->image->src = $userdata->picture;
|
||||
echo $OUTPUT->user_picture($userpic);
|
||||
echo $OUTPUT->user_picture($user, array('courseid'=>$course->id));
|
||||
echo "<a href=\"$CFG->wwwroot/user/view.php?id=$user&course=$course->id\">".
|
||||
"$userdata->firstname $userdata->lastname</a><br />";
|
||||
$scoreview = '';
|
||||
|
||||
+1
-1
@@ -470,7 +470,7 @@ function survey_print_all_responses($cmid, $results, $courseid) {
|
||||
$table->size = array (35, "", "" );
|
||||
|
||||
foreach ($results as $a) {
|
||||
$table->data[] = array($OUTPUT->user_picture(moodle_user_picture::make($a, $courseid)),
|
||||
$table->data[] = array($OUTPUT->user_picture($a, array('courseid'=>$courseid)),
|
||||
$OUTPUT->link("report.php?action=student&student=$a->id&id=$cmid", fullname($a)),
|
||||
userdate($a->time));
|
||||
}
|
||||
|
||||
@@ -351,10 +351,8 @@
|
||||
} else {
|
||||
$answer2 = " ";
|
||||
}
|
||||
$userpic = moodle_user_picture::make($a, $course->id);
|
||||
$userpic->link = true;
|
||||
$table->data[] = array(
|
||||
$OUTPUT->user_picture($userpic),
|
||||
$OUTPUT->user_picture($a, array('courseid'=>$course->id)),
|
||||
"<a href=\"report.php?id=$id&action=student&student=$a->userid\">".fullname($a)."</a>",
|
||||
userdate($a->time),
|
||||
$answer1, $answer2);
|
||||
@@ -402,7 +400,7 @@
|
||||
}
|
||||
|
||||
echo "<p <p class=\"centerpara\">";
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($user->id, $course->id));
|
||||
echo $OUTPUT->user_picture($user, array('courseid'=>$course->id));
|
||||
echo "</p>";
|
||||
|
||||
$questions = $DB->get_records_list("survey_questions", "id", explode(',', $survey->questions));
|
||||
|
||||
@@ -1281,9 +1281,7 @@ function ewiki_page_info($id, &$data, $action) {
|
||||
if (!isset($COURSE->id)) {
|
||||
$COURSE->id = SITEID;
|
||||
}
|
||||
$userpic = moodle_user_picture::make($user->id, $COURSE->id);
|
||||
$userpic->link = true;
|
||||
$picture = $OUTPUT->user_picture($userpic);
|
||||
$picture = $OUTPUT->user_picture($user);
|
||||
$value = $picture . $OUTPUT->link("$CFG->wwwroot/user/view.php?id=$user->id&course=$COURSE->id", fullname($user));
|
||||
} else {
|
||||
continue;
|
||||
|
||||
@@ -348,9 +348,7 @@ function ewiki_entry_downloads($row, $show_section=0, $fullinfo=false) {
|
||||
if (!isset($course->id)) {
|
||||
$course->id = 1;
|
||||
}
|
||||
$userpic = moodle_user_picture::make($user->id, $course->id);
|
||||
$userpic->link = true;
|
||||
$picture = $OUTPUT->user_picture($userpic);
|
||||
$picture = $OUTPUT->user_picture($user, array('courseid'=>$course->id));
|
||||
$value = $picture . $OUTPUT->link("$CFG->wwwroot/user/view.php?id=$user->id&course=$course->id", fullname($user));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -189,7 +189,7 @@ function note_print($note, $detail = NOTES_SHOW_FULL) {
|
||||
if ($detail & NOTES_SHOW_HEAD) {
|
||||
echo '<div class="header">';
|
||||
echo '<div class="user">';
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($user, $note->courseid));
|
||||
echo $OUTPUT->user_picture($user, array('courseid'=>$note->courseid));
|
||||
echo fullname($user) . '</div>';
|
||||
echo '<div class="info">' .
|
||||
get_string('bynameondate', 'notes', $authoring) .
|
||||
|
||||
+3
-1
@@ -343,7 +343,9 @@
|
||||
foreach ($hits as $listing) {
|
||||
|
||||
if ($listing->doctype == 'user'){ // A special handle for users
|
||||
$icon = $OUTPUT->user_picture(moodle_user_picture($listing->userid, 0));
|
||||
//TODO: this is a performance problem, fetch data elsewhere
|
||||
$user = (object)array('id'=>$listing->userid);
|
||||
$icon = $OUTPUT->user_picture($user);
|
||||
} else {
|
||||
$iconpath = $OUTPUT->pix_url('icon', $listing->doctype);
|
||||
$icon = "<img align=\"top\" src=\"".$iconpath."\" class=\"activityicon\" alt=\"\"/>";
|
||||
|
||||
+1
-3
@@ -79,9 +79,7 @@ class user_edit_form extends moodleform {
|
||||
if (!empty($CFG->gdversion)) {
|
||||
$image_el =& $mform->getElement('currentpicture');
|
||||
if ($user and $user->picture) {
|
||||
$userpic = moodle_user_picture::make($user, SITEID);
|
||||
$userpic->size = 64;
|
||||
$image_el->setValue($OUTPUT->user_picture($userpic));
|
||||
$image_el->setValue($OUTPUT->user_picture($user, array('courseid'=>SITEID, 'size'=>64)));
|
||||
} else {
|
||||
$image_el->setValue(get_string('none'));
|
||||
}
|
||||
|
||||
@@ -104,9 +104,7 @@ class user_editadvanced_form extends moodleform {
|
||||
if (!empty($CFG->gdversion)) {
|
||||
$image_el =& $mform->getElement('currentpicture');
|
||||
if ($user and $user->picture) {
|
||||
$userpic = moodle_user_picture::make($user, SITEID);
|
||||
$userpic->alttext = true;
|
||||
$image_el->setValue($OUTPUT->user_picture($userpic));
|
||||
$image_el->setValue($OUTPUT->user_picture($user, array('courseid'=>SITEID)));
|
||||
} else {
|
||||
$image_el->setValue(get_string('none'));
|
||||
}
|
||||
|
||||
+2
-4
@@ -766,7 +766,7 @@
|
||||
$row->cells[0] = new html_table_cell();
|
||||
$row->cells[0]->add_class('left side');
|
||||
|
||||
$row->cells[0]->text = $OUTPUT->user_picture(moodle_user_picture::make($user, $course->id));
|
||||
$row->cells[0]->text = $OUTPUT->user_picture($user, array('courseid'=>$course->id));
|
||||
$row->cells[1] = new html_table_cell();
|
||||
$row->cells[1]->add_class('content');
|
||||
|
||||
@@ -913,9 +913,7 @@
|
||||
$profilelink = '<strong>'.fullname($user).'</strong>';
|
||||
}
|
||||
|
||||
$userpic = moodle_user_picture::make($user, $course->id);
|
||||
$userpic->link = $piclink;
|
||||
$data = array ($OUTPUT->user_picture($userpic), $profilelink . $hidden);
|
||||
$data = array ($OUTPUT->user_picture($user, array('courseid'=>$course->id)), $profilelink . $hidden);
|
||||
|
||||
if ($mode === MODE_BRIEF && !isset($hiddenfields['city'])) {
|
||||
$data[] = $user->city;
|
||||
|
||||
+1
-3
@@ -235,9 +235,7 @@ if (is_mnet_remote_user($user)) {
|
||||
echo '<table width="80%" class="userinfobox" summary="">';
|
||||
echo '<tr>';
|
||||
echo '<td class="side">';
|
||||
$userpic = moodle_user_picture::make($user, $course->id);
|
||||
$userpic->size = 100;
|
||||
echo $OUTPUT->user_picture($userpic);
|
||||
echo $OUTPUT->user_picture($user, array('courseid'=>$course->id, 'size'=>100));
|
||||
echo '</td><td class="content">';
|
||||
|
||||
// Print the description
|
||||
|
||||
Reference in New Issue
Block a user