From: skodak Date: Sat, 5 Jul 2008 20:57:35 +0000 (+0000) Subject: MDL-12505 do not leak separate groups info in advanced search user selection and... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=4692da473fa9ac8a9295972b1c9de10b7c755ca6;p=moodle.git MDL-12505 do not leak separate groups info in advanced search user selection and other fixes; merged from MOODLE_19_STABLE --- diff --git a/course/recent.php b/course/recent.php index 30de12596f..04a2bfbd10 100644 --- a/course/recent.php +++ b/course/recent.php @@ -171,7 +171,7 @@ case 'datedesc' : usort($activities, 'compare_activities_by_time_desc'); break; case 'dateasc' : usort($activities, 'compare_activities_by_time_asc'); break; case 'default' : - default : $detail = false; $sortby = 'default'; + default : $detail = false; $param->sortby = 'default'; } @@ -190,17 +190,18 @@ foreach ($activities as $key => $activity) { - // peak at next activity. If it's another section, don't print this one! - // this means there are no activities in the current section - if (($activity->type == 'section') && - (($activity_count == ($key + 1)) || - ($activities[$key+1]->type == 'section'))) { - - continue; - + if ($activity->type == 'section') { + if ($param->sortby != 'default') { + continue; // no section if ordering by date + } + if ($activity_count == ($key + 1) or $activities[$key+1]->type == 'section') { + // peak at next activity. If it's another section, don't print this one! + // this means there are no activities in the current section + continue; + } } - if (($activity->type == 'section') && ($sortby == 'default')) { + if (($activity->type == 'section') && ($param->sortby == 'default')) { if ($inbox) { print_simple_box_end(); print_spacer(30); @@ -211,7 +212,7 @@ } else if ($activity->type == 'activity') { - if ($sortby == 'default') { + if ($param->sortby == 'default') { $cm = $modinfo->cms[$activity->cmid]; if ($cm->visible) { diff --git a/course/recent_form.php b/course/recent_form.php index 17be91a983..dde3dbe45c 100644 --- a/course/recent_form.php +++ b/course/recent_form.php @@ -27,7 +27,14 @@ class recent_form extends moodleform { $options[$guest->id] = fullname($guest); } - if ($courseusers = get_users_by_capability($context, 'moodle/course:view', 'u.id, u.firstname, u.lastname', 'lastname ASC, firstname DESC')) { + if (groups_get_course_groupmode($COURSE) == SEPARATEGROUPS) { + $groups = groups_get_user_groups($COURSE->id); + $groups = $groups[0]; + } else { + $groups = ''; + } + + if ($courseusers = get_users_by_capability($context, 'moodle/course:view', 'u.id, u.firstname, u.lastname', 'lastname ASC, firstname DESC', '', '', $groups)) { foreach ($courseusers as $courseuser) { $options[$courseuser->id] = fullname($courseuser, $viewfullnames); }