Skip to content

Commit

Permalink
mod/quiz: remove deprecated sql_paging_limit(), use offset, limit par…
Browse files Browse the repository at this point in the history
…ameters
  • Loading branch information
martinlanghoff committed Sep 26, 2006
1 parent 1e7368e commit 1ad5c63
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
8 changes: 1 addition & 7 deletions mod/quiz/report/grading/report.php
Expand Up @@ -240,14 +240,8 @@ function view_question($quiz, $question) {
$total = count_records_sql('SELECT COUNT(DISTINCT('.sql_concat('u.id', '\'#\'', $db->IfNull('qa.attempt', '0')).')) '.$from.$where);
$table->pagesize(10, $total);

// this is for getting the correct records for a given page
if($table->get_page_start() !== '' && $table->get_page_size() !== '') {
$limit = ' '.sql_paging_limit($table->get_page_start(), $table->get_page_size());
} else {
$limit = '';
}
// get the attempts and process them
if ($attempts = get_records_sql($select.$from.$where.$sort.$limit)) {
if ($attempts = get_records_sql($select.$from.$where.$sort,$table->get_page_start(), $table->get_page_size())) {
foreach($attempts as $attempt) {

$picture = print_user_picture($attempt->userid, $quiz->course, $attempt->picture, false, true);
Expand Down
10 changes: 2 additions & 8 deletions mod/quiz/report/overview/report.php
Expand Up @@ -94,7 +94,6 @@ function display($quiz, $cm, $course) {
if ($download) {
$filename = clean_filename("$course->shortname ".format_string($quiz->name,true));
$sort = '';
$limit = '';
}

// Define table columns
Expand Down Expand Up @@ -339,12 +338,6 @@ function display($quiz, $cm, $course) {
$pagesize = 10;
}
$table->pagesize($pagesize, $total);

if($table->get_page_start() !== '' && $table->get_page_size() !== '') {
$limit = ' '.sql_paging_limit($table->get_page_start(), $table->get_page_size());
} else {
$limit = '';
}
}

// If there is feedback, include it in the query.
Expand All @@ -357,7 +350,8 @@ function display($quiz, $cm, $course) {

// Fetch the attempts
if (!empty($from)) { // if we're in the site course and displaying no attempts, it makes no sense to do the query.
$attempts = get_records_sql($select.$from.$where.$sort.$limit);
$attempts = get_records_sql($select.$from.$where.$sort,
$table->get_page_start(), $table->get_page_size());
} else {
$attempts = array();
}
Expand Down

0 comments on commit 1ad5c63

Please sign in to comment.