From: jamiesensei Date: Thu, 1 May 2008 07:08:28 +0000 (+0000) Subject: MDL-13678 "Change default number of rows per page on quiz reports" Made a new constan... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=f33c438e5c5932e22d73b188d6bd434dcde886f6;p=moodle.git 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. --- diff --git a/mod/quiz/report.php b/mod/quiz/report.php index 4b24e6cd3d..5f244bf3c3 100644 --- a/mod/quiz/report.php +++ b/mod/quiz/report.php @@ -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 diff --git a/mod/quiz/report/analysis/report.php b/mod/quiz/report/analysis/report.php index dac42cf6ba..67fc709ab0 100644 --- a/mod/quiz/report/analysis/report.php +++ b/mod/quiz/report/analysis/report.php @@ -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 '
'; echo '
'; diff --git a/mod/quiz/report/grading/report.php b/mod/quiz/report/grading/report.php index de08bf6cd7..af40baf85e 100644 --- a/mod/quiz/report/grading/report.php +++ b/mod/quiz/report/grading/report.php @@ -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())) { diff --git a/mod/quiz/report/overview/report.php b/mod/quiz/report/overview/report.php index 650b58e9fc..f2868d7f25 100644 --- a/mod/quiz/report/overview/report.php +++ b/mod/quiz/report/overview/report.php @@ -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; diff --git a/mod/quiz/report/reportlib.php b/mod/quiz/report/reportlib.php new file mode 100644 index 0000000000..f08f332bb4 --- /dev/null +++ b/mod/quiz/report/reportlib.php @@ -0,0 +1,3 @@ + \ No newline at end of file