Permalink
Browse files

Merge branch 'MDL-62618-35' of git://github.com/mickhawkins/moodle in…

…to MOODLE_35_STABLE
  • Loading branch information...
dmonllao committed Jul 11, 2018
2 parents 4dec82b + 7501216 commit 8b2ae944424a5a849a3324d2b864229186a4fb1f
Showing with 42 additions and 33 deletions.
  1. +3 −2 lib/outputrenderers.php
  2. +33 −27 lib/tablelib.php
  3. +3 −2 mod/forum/lib.php
  4. +2 −1 user/classes/participants_table.php
  5. +1 −1 user/lib.php
@@ -2496,12 +2496,13 @@ protected function render_user_picture(user_picture $userpicture) {
global $CFG, $DB;
$user = $userpicture->user;
$canviewfullnames = has_capability('moodle/site:viewfullnames', context_system::instance());
if ($userpicture->alttext) {
if (!empty($user->imagealt)) {
$alt = $user->imagealt;
} else {
$alt = get_string('pictureof', '', fullname($user));
$alt = get_string('pictureof', '', fullname($user, $canviewfullnames));
}
} else {
$alt = '';
@@ -2533,7 +2534,7 @@ protected function render_user_picture(user_picture $userpicture) {
// Show fullname together with the picture when desired.
if ($userpicture->includefullname) {
$output .= fullname($userpicture->user);
$output .= fullname($userpicture->user, $canviewfullnames);
}
// then wrap it in link if needed
@@ -1221,44 +1221,50 @@ function print_headers() {
switch ($column) {
case 'fullname':
// Check the full name display for sortable fields.
$nameformat = $CFG->fullnamedisplay;
if ($nameformat == 'language') {
$nameformat = get_string('fullnamedisplay');
}
$requirednames = order_in_string(get_all_user_name_fields(), $nameformat);
// Check the full name display for sortable fields.
if (has_capability('moodle/site:viewfullnames', context_system::instance())) {
$nameformat = $CFG->alternativefullnameformat;
} else {
$nameformat = $CFG->fullnamedisplay;
}
if (!empty($requirednames)) {
if ($this->is_sortable($column)) {
// Done this way for the possibility of more than two sortable full name display fields.
$this->headers[$index] = '';
foreach ($requirednames as $name) {
$sortname = $this->sort_link(get_string($name),
$name, $primarysortcolumn === $name, $primarysortorder);
$this->headers[$index] .= $sortname . ' / ';
}
$helpicon = '';
if (isset($this->helpforheaders[$index])) {
$helpicon = $OUTPUT->render($this->helpforheaders[$index]);
if ($nameformat == 'language') {
$nameformat = get_string('fullnamedisplay');
}
$requirednames = order_in_string(get_all_user_name_fields(), $nameformat);
if (!empty($requirednames)) {
if ($this->is_sortable($column)) {
// Done this way for the possibility of more than two sortable full name display fields.
$this->headers[$index] = '';
foreach ($requirednames as $name) {
$sortname = $this->sort_link(get_string($name),
$name, $primarysortcolumn === $name, $primarysortorder);
$this->headers[$index] .= $sortname . ' / ';
}
$helpicon = '';
if (isset($this->helpforheaders[$index])) {
$helpicon = $OUTPUT->render($this->helpforheaders[$index]);
}
$this->headers[$index] = substr($this->headers[$index], 0, -3). $helpicon;
}
$this->headers[$index] = substr($this->headers[$index], 0, -3). $helpicon;
}
}
break;
case 'userpic':
// do nothing, do not display sortable links
break;
default:
if ($this->is_sortable($column)) {
$helpicon = '';
if (isset($this->helpforheaders[$index])) {
$helpicon = $OUTPUT->render($this->helpforheaders[$index]);
if ($this->is_sortable($column)) {
$helpicon = '';
if (isset($this->helpforheaders[$index])) {
$helpicon = $OUTPUT->render($this->helpforheaders[$index]);
}
$this->headers[$index] = $this->sort_link($this->headers[$index],
$column, $primarysortcolumn == $column, $primarysortorder) . $helpicon;
}
$this->headers[$index] = $this->sort_link($this->headers[$index],
$column, $primarysortcolumn == $column, $primarysortorder) . $helpicon;
}
}
$attributes = array(
@@ -3819,6 +3819,7 @@ function forum_print_discussion_header(&$post, $forum, $group = -1, $datestring
$post->subject = format_string($post->subject,true);
$canviewfullnames = has_capability('moodle/site:viewfullnames', $modcontext);
$timeddiscussion = !empty($CFG->forum_enabletimedposts) && ($post->timestart || $post->timeend);
$timedoutsidewindow = '';
if ($timeddiscussion && ($post->timestart > time() || ($post->timeend != 0 && $post->timeend < time()))) {
@@ -3856,7 +3857,7 @@ function forum_print_discussion_header(&$post, $forum, $group = -1, $datestring
echo '</span>';
// User name
echo '<div class="media-body">';
$fullname = fullname($postuser, has_capability('moodle/site:viewfullnames', $modcontext));
$fullname = fullname($postuser, $canviewfullnames);
echo '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$post->userid.'&amp;course='.$forum->course.'">'.$fullname.'</a>';
echo '</div>';
echo '</div>';
@@ -3924,7 +3925,7 @@ function forum_print_discussion_header(&$post, $forum, $group = -1, $datestring
// In QA forums we check that the user can view participants.
if ($forum->type !== 'qanda' || $canviewparticipants) {
echo '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$post->usermodified.'&amp;course='.$forum->course.'">'.
fullname($usermodified).'</a><br />';
fullname($usermodified, $canviewfullnames).'</a><br />';
$parenturl = (empty($post->lastpostid)) ? '' : '&amp;parent='.$post->lastpostid;
}
@@ -366,7 +366,8 @@ public function col_status($data) {
$enrolstatusoutput = '';
$canreviewenrol = has_capability('moodle/course:enrolreview', $this->context);
if ($canreviewenrol) {
$fullname = fullname($data);
$canviewfullnames = has_capability('moodle/site:viewfullnames', $this->context);
$fullname = fullname($data, $canviewfullnames);
$coursename = format_string($this->course->fullname, true, array('context' => $this->context));
require_once($CFG->dirroot . '/enrol/locallib.php');
$manager = new \course_enrolment_manager($PAGE, $this->course);
@@ -335,7 +335,7 @@ function user_get_user_details($user, $course = null, array $userfields = array(
$userdetails['lastname'] = $user->lastname;
}
}
$userdetails['fullname'] = fullname($user);
$userdetails['fullname'] = fullname($user, $canviewfullnames);
if (in_array('customfields', $userfields)) {
$categories = profile_get_user_fields_with_data_by_category($user->id);

0 comments on commit 8b2ae94

Please sign in to comment.