Skip to content
Permalink
Browse files

course/lib: print_course() bugfix when $rusers is empty

  • Loading branch information...
martinlanghoff
martinlanghoff committed Sep 19, 2007
1 parent 3cdf0dd commit 431cad0d62c3429a294a4588d9b0c79b3ed90521
Showing with 10 additions and 6 deletions.
  1. +10 −6 course/lib.php
@@ -1814,13 +1814,17 @@ function print_course($course) {
$coursemanagerroles = split(',', $managerroles);
$canseehidden = has_capability('moodle/role:viewhiddenassigns', $context);
$rusers = get_role_users($coursemanagerroles, $context,
true, '', 'r.sortorder ASC, u.lastname ASC', $canseehidden) ;
foreach ($rusers as $teacher) {
$fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context));
$namesarray[] = format_string($teacher->rolename).': <a href="'.$CFG->wwwroot.'/user/view.php?id='.
$teacher->id.'&amp;course='.SITEID.'">'.$fullname.'</a>';
true, '', 'r.sortorder ASC, u.lastname ASC', $canseehidden);
if (is_array($rusers) && count($rusers)) {
$canviewfullnames = has_capability('moodle/site:viewfullnames', $context);
foreach ($rusers as $teacher) {
$fullname = fullname($teacher, $canviewfullnames);
$namesarray[] = format_string($teacher->rolename)
. ': <a href="'.$CFG->wwwroot.'/user/view.php?id='.$teacher->id.'&amp;course='.SITEID.'">'
. $fullname . '</a>';
}
}
if (!empty($namesarray)) {
echo "<ul class=\"teachers\">\n<li>";
echo implode('</li><li>', $namesarray);

0 comments on commit 431cad0

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