Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Respect role names for logged students. MDL-16569 ; merged from 19_ST…
…ABLE.

Credit goes to Otakar Šprdlík
  • Loading branch information
stronk7 committed Sep 18, 2008
1 parent 00fed72 commit 165d25c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions course/lib.php
Expand Up @@ -2018,8 +2018,20 @@ function print_course($course) {
true, '', 'r.sortorder ASC, u.lastname ASC', $canseehidden);
if (is_array($rusers) && count($rusers)) {
$canviewfullnames = has_capability('moodle/site:viewfullnames', $context);

/// Rename some of the role names if needed
if (isset($context)) {
$aliasnames = $DB->get_records('role_names', array('contextid'=>$context->id), '', 'roleid,contextid,name');
}

foreach ($rusers as $teacher) {
$fullname = fullname($teacher, $canviewfullnames);

/// Apply role names
if (isset($aliasnames[$teacher->roleid])) {
$teacher->rolename = $aliasnames[$teacher->roleid]->name;
}

$namesarray[] = format_string($teacher->rolename)
. ': <a href="'.$CFG->wwwroot.'/user/view.php?id='.$teacher->id.'&amp;course='.SITEID.'">'
. $fullname . '</a>';
Expand Down

0 comments on commit 165d25c

Please sign in to comment.