CONTRIB-5286 added drop down to show all rows or the set limit
authorJoseph Baxter <joseph.baxter@nottingham.ac.uk>
Fri, 3 Oct 2014 15:50:31 +0000 (16:50 +0100)
committerJoseph Baxter <joseph.baxter@nottingham.ac.uk>
Fri, 3 Oct 2014 15:51:01 +0000 (16:51 +0100)
renderer.php
take.php

index 13191ef..3645fd4 100644 (file)
@@ -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'),
index 4452927..e5efed5 100644 (file)
--- 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);