From 27176468fead277af442142440cd2d3d209e206f Mon Sep 17 00:00:00 2001 From: martinlanghoff Date: Tue, 26 Sep 2006 05:05:10 +0000 Subject: [PATCH] mod/quiz: replace $db->Concat() with sql_concat() --- mod/quiz/report/grading/report.php | 6 +++--- mod/quiz/report/overview/report.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mod/quiz/report/grading/report.php b/mod/quiz/report/grading/report.php index a95729865a..774cc9f9f3 100644 --- a/mod/quiz/report/grading/report.php +++ b/mod/quiz/report/grading/report.php @@ -217,7 +217,7 @@ class quiz_report extends quiz_default_report { $table->setup(); // this sql is a join of the attempts table and the user table. I do this so I can sort by user name and attempt number (not id) - $select = 'SELECT '.$db->Concat('u.id', '\'#\'', $db->IfNull('qa.attempt', '0')).' AS userattemptid, qa.id AS attemptid, qa.uniqueid, qa.attempt, qa.timefinish, u.id AS userid, u.firstname, u.lastname, u.picture '; + $select = 'SELECT '.sql_concat('u.id', '\'#\'', $db->IfNull('qa.attempt', '0')).' AS userattemptid, qa.id AS attemptid, qa.uniqueid, qa.attempt, qa.timefinish, u.id AS userid, u.firstname, u.lastname, u.picture '; $from = 'FROM '.$CFG->prefix.'user u LEFT JOIN '.$CFG->prefix.'quiz_attempts qa ON (u.id = qa.userid AND qa.quiz = '.$quiz->id.') '; $where = 'WHERE u.id IN ('.$userids.') '; $where .= 'AND '.$db->IfNull('qa.attempt', '0').' != 0 '; @@ -237,7 +237,7 @@ class quiz_report extends quiz_default_report { } // set up the pagesize - $total = count_records_sql('SELECT COUNT(DISTINCT('.$db->Concat('u.id', '\'#\'', $db->IfNull('qa.attempt', '0')).')) '.$from.$where); + $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 @@ -330,7 +330,7 @@ class quiz_report extends quiz_default_report { $userids = implode(',', array_keys($users)); // this sql joins the attempts table and the user table - $select = 'SELECT '.$db->Concat('u.id', '\'#\'', $db->IfNull('qa.attempt', '0')).' AS userattemptid, + $select = 'SELECT '.sql_concat('u.id', '\'#\'', $db->IfNull('qa.attempt', '0')).' AS userattemptid, qa.id AS attemptid, qa.uniqueid, qa.attempt, qa.timefinish, qa.preview, u.id AS userid, u.firstname, u.lastname, u.picture '; $from = 'FROM '.$CFG->prefix.'user u LEFT JOIN '.$CFG->prefix.'quiz_attempts qa ON (u.id = qa.userid AND qa.quiz = '.$quiz->id.') '; diff --git a/mod/quiz/report/overview/report.php b/mod/quiz/report/overview/report.php index 73609b7926..bc45b31fe8 100644 --- a/mod/quiz/report/overview/report.php +++ b/mod/quiz/report/overview/report.php @@ -243,7 +243,7 @@ class quiz_report extends quiz_default_report { $contextlists = get_related_contexts_string(get_context_instance(CONTEXT_COURSE, $course->id)); // Construct the SQL - $select = 'SELECT '.$db->Concat('u.id', '\'#\'', $db->IfNull('qa.attempt', '0')).' AS uniqueid, '. + $select = 'SELECT '.sql_concat('u.id', '\'#\'', $db->IfNull('qa.attempt', '0')).' AS uniqueid, '. 'qa.uniqueid as attemptuniqueid, qa.id AS attempt, u.id AS userid, u.firstname, u.lastname, u.picture, '. 'qa.sumgrades, qa.timefinish, qa.timestart, qa.timefinish - qa.timestart AS duration '; if ($course->id != SITEID) { // this is too complicated, so just do it for each of the four cases. @@ -279,12 +279,12 @@ class quiz_report extends quiz_default_report { $where = ' WHERE qa.quiz = '.$quiz->id.' AND qa.preview = 0'; } // noattempts = 2 means we want all students, with or without attempts } - $countsql = 'SELECT COUNT(DISTINCT('.$db->Concat('u.id', '\'#\'', $db->IfNull('qa.attempt', '0')).')) '.$from.$where; + $countsql = 'SELECT COUNT(DISTINCT('.sql_concat('u.id', '\'#\'', $db->IfNull('qa.attempt', '0')).')) '.$from.$where; } else { if (empty($noattempts)) { $from = 'FROM '.$CFG->prefix.'user u JOIN '.$CFG->prefix.'quiz_attempts qa ON u.id = qa.userid '; $where = ' WHERE qa.quiz = '.$quiz->id.' AND qa.preview = 0'; - $countsql = 'SELECT COUNT(DISTINCT('.$db->Concat('u.id', '\'#\'', $db->IfNull('qa.attempt', '0')).')) '.$from.$where; + $countsql = 'SELECT COUNT(DISTINCT('.sql_concat('u.id', '\'#\'', $db->IfNull('qa.attempt', '0')).')) '.$from.$where; } } if (!$download) { -- 2.39.5