// 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
// 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;
$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);
}
- 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">';
// 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())) {
// 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;