]> git.mjollnir.org Git - moodle.git/commitdiff
mod/quiz: replace $db->Concat() with sql_concat()
authormartinlanghoff <martinlanghoff>
Tue, 26 Sep 2006 05:05:10 +0000 (05:05 +0000)
committermartinlanghoff <martinlanghoff>
Tue, 26 Sep 2006 05:05:10 +0000 (05:05 +0000)
mod/quiz/report/grading/report.php
mod/quiz/report/overview/report.php

index a95729865a6d5389d46a2d2b62519b8710b53403..774cc9f9f3ea0128295fb551ce88b3dd8de3c2eb 100644 (file)
@@ -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.') ';
index 73609b7926cdf96d1a808e4abc921ced0e55afdc..bc45b31fe8261bcf18c88d4d43d31160fdbed288 100644 (file)
@@ -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) {