Skip to content
Permalink
Browse files

Respect role names for logged students. MDL-16569 ; merged from 19_ST…

…ABLE.

Credit goes to Otakar Šprdlík
  • Loading branch information...
stronk7
stronk7 committed Sep 18, 2008
1 parent 00fed72 commit 165d25cc35a2c8f7063cbec6d40293ea6f685b7d
Showing with 12 additions and 0 deletions.
  1. +12 −0 course/lib.php
@@ -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>';

0 comments on commit 165d25c

Please sign in to comment.
You can’t perform that action at this time.