Merge branch 'MDL-50799-master' of git://github.com/merrill-oakland/moodle
authorDan Poltawski <dan@moodle.com>
Mon, 13 Jul 2015 15:08:23 +0000 (16:08 +0100)
committerDan Poltawski <dan@moodle.com>
Mon, 13 Jul 2015 15:08:23 +0000 (16:08 +0100)
question/classes/bank/view.php
question/editlib.php

index 98ba1f7..04e076d 100644 (file)
@@ -715,8 +715,13 @@ class view {
         echo $OUTPUT->render($pagingbar);
         if ($totalnumber > DEFAULT_QUESTIONS_PER_PAGE) {
             if ($perpage == DEFAULT_QUESTIONS_PER_PAGE) {
-                $url = new \moodle_url('edit.php', array_merge($pageurl->params(), array('qperpage' => 1000)));
-                $showall = '<a href="'.$url.'">'.get_string('showall', 'moodle', $totalnumber).'</a>';
+                $url = new \moodle_url('edit.php', array_merge($pageurl->params(),
+                        array('qperpage' => MAXIMUM_QUESTIONS_PER_PAGE)));
+                if ($totalnumber > MAXIMUM_QUESTIONS_PER_PAGE) {
+                    $showall = '<a href="'.$url.'">'.get_string('showperpage', 'moodle', MAXIMUM_QUESTIONS_PER_PAGE).'</a>';
+                } else {
+                    $showall = '<a href="'.$url.'">'.get_string('showall', 'moodle', $totalnumber).'</a>';
+                }
             } else {
                 $url = new \moodle_url('edit.php', array_merge($pageurl->params(),
                                               array('qperpage' => DEFAULT_QUESTIONS_PER_PAGE)));
index ff7800d..922bc67 100644 (file)
@@ -31,6 +31,7 @@ defined('MOODLE_INTERNAL') || die();
 require_once($CFG->libdir . '/questionlib.php');
 
 define('DEFAULT_QUESTIONS_PER_PAGE', 20);
+define('MAXIMUM_QUESTIONS_PER_PAGE', 1000);
 
 function get_module_from_cmid($cmid) {
     global $CFG, $DB;