From: skodak Date: Mon, 1 Dec 2008 22:06:33 +0000 (+0000) Subject: MDL-17486 added option to make my courses list in user profile hidden X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=53bd22559d1c70f7e5fd0088e2180a6d609453d1;p=moodle.git MDL-17486 added option to make my courses list in user profile hidden --- diff --git a/admin/settings/users.php b/admin/settings/users.php index 3f9c7b81cc..43a99d802f 100644 --- a/admin/settings/users.php +++ b/admin/settings/users.php @@ -161,7 +161,8 @@ if ($hassiteconfig 'yahooid' => get_string('yahooid'), 'aimid' => get_string('aimid'), 'msnid' => get_string('msnid'), - 'lastaccess' => get_string('lastaccess')))); + 'lastaccess' => get_string('lastaccess'), + 'mycourses' => get_string('mycourses')))); $temp->add(new admin_setting_configmulticheckbox('extrauserselectorfields', get_string('extrauserselectorfields', 'admin'), get_string('configextrauserselectorfields', 'admin'), array('email' => '1'), diff --git a/user/view.php b/user/view.php index 1bda459fed..1809e60ff4 100644 --- a/user/view.php +++ b/user/view.php @@ -321,33 +321,35 @@ 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->category) { - if ($mycourse->id != $course->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"'; + if (!isset($hiddenfields['mycourses'])) { + if ($mycourses = get_my_courses($user->id, null, null, false, 21)) { + $shown=0; + $courselisting = ''; + foreach ($mycourses as $mycourse) { + if ($mycourse->category) { + if ($mycourse->id != $course->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 .= "wwwroot}/user/view.php?id={$user->id}&course={$mycourse->id}\" $class >" + . format_string($mycourse->fullname) . ", "; + } + else { + $courselisting .= format_string($mycourse->fullname) . ", "; } - $courselisting .= "wwwroot}/user/view.php?id={$user->id}&course={$mycourse->id}\" $class >" - . format_string($mycourse->fullname) . ", "; } - else { - $courselisting .= format_string($mycourse->fullname) . ", "; + $shown++; + if($shown==20) { + $courselisting.= "..."; + break; } } - $shown++; - if($shown==20) { - $courselisting.= "..."; - break; - } + print_row(get_string('courses').':', rtrim($courselisting,', ')); } - print_row(get_string('courses').':', rtrim($courselisting,', ')); } if (!isset($hiddenfields['lastaccess'])) {