Permalink
Browse files

fix hotpot reports to handle new group structure in Moodle 1.8 (MDL-8…

…944)
  • Loading branch information...
gbateson
gbateson committed Mar 17, 2007
1 parent b139c82 commit 843808a9d8935c881420ceec26ddc349de99eb81
Showing with 7 additions and 6 deletions.
  1. +7 −6 mod/hotpot/report.php
View
@@ -51,7 +51,7 @@
// assemble array of form data
$formdata = array(
'mode' => $mode,
- 'reportusers' => has_capability('mod/hotpot:viewreport',$modulecontext) ? optional_param('reportusers', get_user_preferences('hotpot_reportusers', 'allusers'), PARAM_ALPHA) : 'this',
+ 'reportusers' => has_capability('mod/hotpot:viewreport',$modulecontext) ? optional_param('reportusers', get_user_preferences('hotpot_reportusers', 'allusers'), PARAM_ALPHANUM) : 'this',
'reportattempts' => optional_param('reportattempts', get_user_preferences('hotpot_reportattempts', 'all'), PARAM_ALPHA),
'reportformat' => optional_param('reportformat', 'htm', PARAM_ALPHA),
'reportshowlegend' => optional_param('reportshowlegend', get_user_preferences('hotpot_reportshowlegend', '0'), PARAM_INT),
@@ -83,12 +83,13 @@
// check for groups
if (preg_match('/^group(\d*)$/', $formdata['reportusers'], $matches)) {
+ $formdata['reportusers'] = 'group';
+ $formdata['reportgroupid'] = 0;
// validate groupid
- if (is_numeric($matches[1]) && get_field('groups', 'courseid', 'id', $matches[1])===$course->id) {
- $formdata['reportusers'] = 'group';
- $formdata['reportgroupid'] = $matches[1];
- } else {
- $formdata['reportgroupid'] = 0; // groupid is invalid
+ if ($groups = groups_get_groups_names($course->id)) {
+ if (isset($groups[$matches[1]])) {
+ $formdata['reportgroupid'] = $matches[1];
+ }
}
}

0 comments on commit 843808a

Please sign in to comment.