Skip to content

Commit

Permalink
MDL-47077 report_participation: fixed pagination in groups
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Hemelryk committed Oct 19, 2014
1 parent b49de5d commit d5ae34a
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions report/participation/index.php
Expand Up @@ -37,7 +37,7 @@
$action = optional_param('action', '', PARAM_ALPHA);
$page = optional_param('page', 0, PARAM_INT); // which page to show
$perpage = optional_param('perpage', DEFAULT_PAGE_SIZE, PARAM_INT); // how many per page
$currentgroup = optional_param('group', 0, PARAM_INT); // Get the active group.
$currentgroup = optional_param('group', null, PARAM_INT); // Get the active group.

$url = new moodle_url('/report/participation/index.php', array('id'=>$id));
if ($roleid !== 0) $url->param('roleid');
Expand Down Expand Up @@ -128,8 +128,15 @@
// Print first controls.
report_participation_print_filter_form($course, $timefrom, $minlog, $action, $roleid, $instanceid);

$baseurl = $CFG->wwwroot.'/report/participation/index.php?id='.$course->id.'&roleid='
.$roleid.'&instanceid='.$instanceid.'&timefrom='.$timefrom.'&action='.$action.'&perpage='.$perpage;
$baseurl = new moodle_url('/report/participation/index.php', array(
'id' => $course->id,
'roleid' => $roleid,
'instanceid' => $instanceid,
'timefrom' => $timefrom,
'action' => $action,
'perpage' => $perpage,
'group' => $currentgroup
));
$select = groups_allgroups_course_menu($course, $baseurl, true, $currentgroup);

// User cannot see any group.
Expand Down Expand Up @@ -341,10 +348,15 @@
$table->print_html();

if ($perpage == SHOW_ALL_PAGE_SIZE) {
echo '<div id="showall"><a href="'.$baseurl.'&amp;perpage='.DEFAULT_PAGE_SIZE.'">'.get_string('showperpage', '', DEFAULT_PAGE_SIZE).'</a></div>'."\n";
}
else if ($matchcount > 0 && $perpage < $matchcount) {
echo '<div id="showall"><a href="'.$baseurl.'&amp;perpage='.SHOW_ALL_PAGE_SIZE.'">'.get_string('showall', '', $matchcount).'</a></div>'."\n";
$perpageurl = new moodle_url($baseurl, array('perpage' => DEFAULT_PAGE_SIZE));
echo html_writer::start_div('', array('id' => 'showall'));
echo html_writer::link($perpageurl, get_string('showperpage', '', DEFAULT_PAGE_SIZE));
echo html_writer::end_div();
} else if ($matchcount > 0 && $perpage < $matchcount) {
$perpageurl = new moodle_url($baseurl, array('perpage' => SHOW_ALL_PAGE_SIZE));
echo html_writer::start_div('', array('id' => 'showall'));
echo html_writer::link($perpageurl, get_string('showall', '', $matchcount));
echo html_writer::end_div();
}

echo '<div class="selectbuttons">';
Expand Down

0 comments on commit d5ae34a

Please sign in to comment.