With get_my_courses() properly filtering out not vievable

courses for the user requesting the list, perfomr proper dimming
of not visible courses. Backported from HEAD. MDL-12855
This commit is contained in:
stronk7
2008-04-17 18:35:12 +00:00
parent 42fd1a8187
commit 30e04e5e2a
+9 -3
View File
@@ -306,14 +306,20 @@
/// Print the Custom User Fields
profile_display_fields($user->id);
if ($mycourses = get_my_courses($user->id, null, null, false, 21)) {
$shown=0;
$courselisting = '';
foreach ($mycourses as $mycourse) {
if ($mycourse->visible and $mycourse->category) {
if ($mycourse->category) {
if ($mycourse->id != $course->id){
$courselisting .= "<a href=\"$CFG->wwwroot/user/view.php?id=$user->id&amp;course=$mycourse->id\">"
$class = '';
if ($mycourse->visible == 0) {
// get_my_courses will filter courses $USER cannot see
// if we get one with visible 0 it just means it's hidden
// ... but not from $USER
$class = 'class="dimmed"';
}
$courselisting .= "<a href=\"{$CFG->wwwroot}/user/view.php?id={$user->id}&amp;course={$mycourse->id}\" $class >"
. format_string($mycourse->fullname) . "</a>, ";
}
else {