$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)));