Merge branch 'MDL-59528-master' of git://github.com/junpataleta/moodle

This commit is contained in:
Andrew Nicols
2017-07-24 13:29:58 +08:00
4 changed files with 13 additions and 1 deletions
+5
View File
@@ -201,6 +201,11 @@ class user_picture implements renderable {
*/
public $visibletoscreenreaders = true;
/**
* @var bool Whether to include the fullname in the user picture link.
*/
public $includefullname = false;
/**
* User picture constructor.
*
+6
View File
@@ -2368,6 +2368,7 @@ class core_renderer extends renderer_base {
* - alttext=true (add image alt attribute)
* - class = image class attribute (default 'userpicture')
* - visibletoscreenreaders=true (whether to be visible to screen readers)
* - includefullname=false (whether to include the user's full name together with the user picture)
* @return string HTML fragment
*/
public function user_picture(stdClass $user, array $options = null) {
@@ -2425,6 +2426,11 @@ class core_renderer extends renderer_base {
// get the image html output fisrt
$output = html_writer::empty_tag('img', $attributes);
// Show fullname together with the picture when desired.
if ($userpicture->includefullname) {
$output .= fullname($userpicture->user);
}
// then wrap it in link if needed
if (!$userpicture->link) {
return $output;
+1
View File
@@ -24,6 +24,7 @@ information provided here is intended especially for developers.
used to perform implicit validation of submitted values - without the need to explicitly add the validation rules to
every form. The method should accept a single parameter with the submitted value. It should return a string with the
eventual validation error, or an empty value if the validation passes.
* New user_picture attribute $includefullname to determine whether to include the user's full name with the user's picture.
=== 3.3.1 ===
+1 -1
View File
@@ -206,7 +206,7 @@ class participants_table extends \table_sql {
public function col_fullname($data) {
global $OUTPUT;
return $OUTPUT->user_picture($data, array('size' => 35, 'courseid' => $this->course->id)) . ' ' . fullname($data);
return $OUTPUT->user_picture($data, array('size' => 35, 'courseid' => $this->course->id, 'includefullname' => true));
}
/**