mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-13678 "Change default number of rows per page on quiz reports" Made a new constant to say how many attempts / questions to list per page by default.
This commit is contained in:
parent
1a084d1541
commit
f33c438e5c
@ -2,8 +2,9 @@
|
||||
|
||||
// This script uses installed report plugins to print quiz reports
|
||||
|
||||
require_once("../../config.php");
|
||||
require_once("locallib.php");
|
||||
require_once('../../config.php');
|
||||
require_once($CFG->dirroot.'/mod/quiz/locallib.php');
|
||||
require_once($CFG->dirroot.'/mod/quiz/report/reportlib.php');
|
||||
|
||||
$id = optional_param('id',0,PARAM_INT); // Course Module ID, or
|
||||
$q = optional_param('q',0,PARAM_INT); // quiz ID
|
||||
|
@ -32,18 +32,21 @@ class quiz_report extends quiz_default_report {
|
||||
|
||||
// set Table and Analysis stats options
|
||||
if(!isset($SESSION->quiz_analysis_table)) {
|
||||
$SESSION->quiz_analysis_table = array('attemptselection' => 0, 'lowmarklimit' => 0, 'pagesize' => 10);
|
||||
$SESSION->quiz_analysis_table = array('attemptselection' => 0, 'lowmarklimit' => 0, 'pagesize' => QUIZ_REPORT_DEFAULT_PAGE_SIZE);
|
||||
}
|
||||
|
||||
foreach($SESSION->quiz_analysis_table as $option => $value) {
|
||||
$urlparam = optional_param($option, NULL);
|
||||
$urlparam = optional_param($option, NULL, PARAM_INT);
|
||||
if($urlparam === NULL) {
|
||||
$$option = $value;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$$option = $SESSION->quiz_analysis_table[$option] = $urlparam;
|
||||
}
|
||||
}
|
||||
if (!isset($pagesize) || ((int)$pagesize < 1) ){
|
||||
$pagesize = QUIZ_REPORT_DEFAULT_PAGE_SIZE;
|
||||
}
|
||||
|
||||
|
||||
$scorelimit = $quiz->sumgrades * $lowmarklimit/ 100;
|
||||
|
||||
@ -323,9 +326,6 @@ class quiz_report extends quiz_default_report {
|
||||
$format_options->newlines = false;
|
||||
|
||||
// Now it is time to page the data, simply slice the keys in the array
|
||||
if (!isset($pagesize) || ((int)$pagesize < 1) ){
|
||||
$pagesize = 10;
|
||||
}
|
||||
$table->pagesize($pagesize, count($questions));
|
||||
$start = $table->get_page_start();
|
||||
$pagequestions = array_slice(array_keys($questions), $start, $pagesize);
|
||||
@ -381,7 +381,7 @@ class quiz_report extends quiz_default_report {
|
||||
}
|
||||
|
||||
|
||||
function print_options_form($quiz, $cm, $attempts, $lowlimit=0, $pagesize=10) {
|
||||
function print_options_form($quiz, $cm, $attempts, $lowlimit=0, $pagesize=QUIZ_REPORT_DEFAULT_PAGE_SIZE) {
|
||||
global $CFG, $USER;
|
||||
echo '<div class="controls">';
|
||||
echo '<form id="options" action="report.php" method="post">';
|
||||
|
@ -254,7 +254,7 @@ class quiz_report extends quiz_default_report {
|
||||
|
||||
// set up the pagesize
|
||||
$total = count_records_sql('SELECT COUNT(DISTINCT('.sql_concat('u.id', '\'#\'', $db->IfNull('qa.attempt', '0')).')) '.$from.$where);
|
||||
$table->pagesize(10, $total);
|
||||
$table->pagesize(QUIZ_REPORT_DEFAULT_PAGE_SIZE, $total);
|
||||
|
||||
// get the attempts and process them
|
||||
if ($attempts = get_records_sql($select.$from.$where.$sort,$table->get_page_start(), $table->get_page_size())) {
|
||||
|
@ -68,10 +68,10 @@ class quiz_report extends quiz_default_report {
|
||||
// Set table options
|
||||
$noattempts = optional_param('noattempts', 0, PARAM_INT);
|
||||
$detailedmarks = optional_param('detailedmarks', 0, PARAM_INT);
|
||||
$pagesize = optional_param('pagesize', 10, PARAM_INT);
|
||||
$pagesize = optional_param('pagesize', 0, PARAM_INT);
|
||||
$reporturl = $CFG->wwwroot.'/mod/quiz/report.php?mode=overview';
|
||||
if ($pagesize < 1) {
|
||||
$pagesize = 10;
|
||||
$pagesize = QUIZ_REPORT_DEFAULT_PAGE_SIZE;
|
||||
}
|
||||
if (!$reviewoptions->scores) {
|
||||
$detailedmarks = 0;
|
||||
|
3
mod/quiz/report/reportlib.php
Normal file
3
mod/quiz/report/reportlib.php
Normal file
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
define('QUIZ_REPORT_DEFAULT_PAGE_SIZE', 30);
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user