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)
1  2 
question/classes/bank/view.php

@@@ -664,11 -664,6 +664,11 @@@ class view 
              $showquestiontext = false, $addcontexts = array()) {
          global $CFG, $DB, $OUTPUT;
  
 +        // This function can be moderately slow with large question counts and may time out.
 +        // We probably do not want to raise it to unlimited, so randomly picking 5 minutes.
 +        // Note: We do not call this in the loop because quiz ob_ captures this function (see raise() PHP doc).
 +        \core_php_time_limit::raise(300);
 +
          $category = $this->get_current_category($categoryandcontext);
  
          $strselectall = get_string('selectall');
          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)));