From 797040cdb38dd100078eced83f85c76ed809221f Mon Sep 17 00:00:00 2001 From: Joseph Baxter Date: Fri, 3 Oct 2014 16:50:31 +0100 Subject: [PATCH] CONTRIB-5286 added drop down to show all rows or the set limit --- renderer.php | 12 +++++++++++- take.php | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/renderer.php b/renderer.php index 13191ef..3645fd4 100644 --- a/renderer.php +++ b/renderer.php @@ -404,7 +404,8 @@ class mod_attendance_renderer extends plugin_renderer_base { } $controls .= html_writer::tag('span', "Page {$takedata->pageparams->page} of $numberofpages", array('class' => 'attbtn')); if ($takedata->pageparams->page < $numberofpages) { - $controls .= html_writer::link($takedata->url(array('page' => $takedata->pageparams->page + 1)), $this->output->rarrow()); + $controls .= html_writer::link($takedata->url(array('page' => $takedata->pageparams->page + 1, + 'perpage' => $takedata->pageparams->perpage)), $this->output->rarrow()); } } @@ -424,6 +425,15 @@ class mod_attendance_renderer extends plugin_renderer_base { $select->class = 'singleselect inline'; $controls .= $this->output->render($select); + if ($takedata->pageparams->viewmode == att_take_page_params::SORTED_LIST) { + $options = array( + 0 => get_string('donotusepaging', 'attendance'), + get_config('attendance', 'resultsperpage') => get_config('attendance', 'resultsperpage')); + $select = new single_select($takedata->url(), 'perpage', $options, $takedata->pageparams->perpage, null); + $select->class = 'singleselect inline'; + $controls .= $this->output->render($select); + } + if ($takedata->pageparams->viewmode == att_take_page_params::SORTED_GRID) { $options = array (1 => '1 '.get_string('column', 'attendance'), '2 '.get_string('columns', 'attendance'), '3 '.get_string('columns', 'attendance'), '4 '.get_string('columns', 'attendance'), diff --git a/take.php b/take.php index 4452927..e5efed5 100644 --- a/take.php +++ b/take.php @@ -35,7 +35,7 @@ $pageparams->copyfrom = optional_param('copyfrom', null, PARAM_INT); $pageparams->viewmode = optional_param('viewmode', null, PARAM_INT); $pageparams->gridcols = optional_param('gridcols', null, PARAM_INT); $pageparams->page = optional_param('page', 1, PARAM_INT); -$pageparams->perpage = get_config('attendance', 'resultsperpage'); +$pageparams->perpage = optional_param('perpage', get_config('attendance', 'resultsperpage'), PARAM_INT); $cm = get_coursemodule_from_id('attendance', $id, 0, false, MUST_EXIST); $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);