]> git.mjollnir.org Git - moodle.git/commitdiff
Merged AS keyword fixes from stable MDL-7207
authormoodler <moodler>
Wed, 25 Oct 2006 09:04:25 +0000 (09:04 +0000)
committermoodler <moodler>
Wed, 25 Oct 2006 09:04:25 +0000 (09:04 +0000)
12 files changed:
auth/ldap/lib.php
mod/data/filter.php
mod/data/lib.php
mod/forum/lib.php
mod/glossary/filter.php
mod/hotpot/attempt.php
mod/hotpot/db/update_to_v2.php
mod/hotpot/index.php
mod/hotpot/lib.php
mod/hotpot/report.php
mod/quiz/backuplib.php
mod/survey/lib.php

index 7f4dbbe1a14b351b128318b557db6fd75e18a99c..ccf96dfe90ca2b8eb71737c671443e7d12513f51 100644 (file)
@@ -551,7 +551,7 @@ function auth_sync_users ($bulk_insert_records = 1000, $do_updates=1) {
         
     }
     if ( $do_updates && !(empty($updatekeys)) ) { // run updates only if relevant
-        $users = get_records_sql('SELECT u.username, u.id FROM ' . $CFG->prefix . 'user  AS u WHERE u.deleted=0 and u.auth=\'' . AUTH_LDAP_NAME . '\'' );
+        $users = get_records_sql('SELECT u.username, u.id FROM ' . $CFG->prefix . 'user  u WHERE u.deleted=0 and u.auth=\'' . AUTH_LDAP_NAME . '\'' );
         if (!empty($users)) {
             print "User entries to update: ". count($users). "\n";
             
index e8f6e8bb7023344ff6df16c076a168042b75eb4c..2030eb70b8d2dcfb6acc2c4bd35a79bbe9772ff2 100644 (file)
                    'dr.id AS recordid, ' .
                    'dc.content AS content, ' .
                    'd.id AS dataid ' .
-                        'FROM '.$CFG->prefix.'data AS d, ' .
-                        $CFG->prefix.'data_fields AS df, ' .
-                        $CFG->prefix.'data_records AS dr, ' .
-                        $CFG->prefix.'data_content AS dc ' .
+                        'FROM '.$CFG->prefix.'data d, ' .
+                        $CFG->prefix.'data_fields df, ' .
+                        $CFG->prefix.'data_records dr, ' .
+                        $CFG->prefix.'data_content dc ' .
                             "WHERE (d.course = '$courseid' or d.course = '".SITEID."')" .
                             'AND d.id = df.dataid ' .
                             'AND df.id = dc.fieldid ' .
index ff1c3d6844532f279aa06c3ae73c196e9d4112d0..d045931b84af8dec5a8be0aea032a4daa18f829e 100755 (executable)
@@ -1225,11 +1225,11 @@ function data_fieldname_exists($name, $dataid, $fieldid=0) {
 
     $LIKE = sql_ilike();
     if ($fieldid) { 
-        return record_exists_sql("SELECT * from {$CFG->prefix}data_fields AS df 
+        return record_exists_sql("SELECT * from {$CFG->prefix}data_fields df 
                                   WHERE df.name $LIKE '$name' AND df.dataid = $dataid
                                     AND ((df.id < $fieldid) OR (df.id > $fieldid))");
     } else {
-        return record_exists_sql("SELECT * from {$CFG->prefix}data_fields AS df 
+        return record_exists_sql("SELECT * from {$CFG->prefix}data_fields df 
                                   WHERE df.name $LIKE '$name' AND df.dataid = $dataid");
     }
 }
index d317f17d0fb81f2651bf75e19a3f6487bac0e9ae..f4500cdcf950b6731cdb542fbf21367cce7f1c0f 100644 (file)
@@ -1147,8 +1147,8 @@ function forum_get_readable_forums($userid, $courseid=0) {
                                 cm.id AS cmid,
                                 cm.visible AS cmvisible,
                                 cm.groupmode AS cmgroupmode
-                           FROM {$CFG->prefix}course_modules AS cm,
-                                {$CFG->prefix}forum AS f
+                           FROM {$CFG->prefix}course_modules cm,
+                                {$CFG->prefix}forum f
                           WHERE cm.instance = f.id
                             AND cm.course = {$course->id}
                             AND cm.module = {$forummod->id}
@@ -2878,8 +2878,8 @@ function forum_discussions_user_has_posted_in($forumid, $userid) {
 
     $haspostedsql = "SELECT DISTINCT(d.id) AS id,
                             d.*
-                       FROM {$CFG->prefix}forum_posts AS p,
-                            {$CFG->prefix}forum_discussions AS d
+                       FROM {$CFG->prefix}forum_posts p,
+                            {$CFG->prefix}forum_discussions d
                       WHERE p.discussion = d.id
                         AND d.forum = $forumid
                         AND p.userid = $userid";
index 5175dc3a2fc407623228b4285bf3398575b76767..a96013b75ec115b3c0eeb796d013a170ddd5578f 100644 (file)
@@ -55,8 +55,8 @@ function glossary_filter($courseid, $text) {
     
         $aliases = get_records_sql('SELECT ga.id, ge.glossaryid, ga.alias as concept, ge.concept as originalconcept, 
                                            casesensitive, 0 AS category, fullmatch 
-                                      FROM '.$CFG->prefix.'glossary_alias AS ga, 
-                                           '.$CFG->prefix.'glossary_entries AS ge
+                                      FROM '.$CFG->prefix.'glossary_alias ga, 
+                                           '.$CFG->prefix.'glossary_entries ge
                                      WHERE ga.entryid = ge.id
                                        AND ge.glossaryid IN ('.$glossarylist.')
                                        AND ge.usedynalink != 0 
index 6d55baf32c2d80803f78401f5e532cd03fd24216..3b8ffd32dabbc5089b5b00bbe01e9e39b111a648 100644 (file)
@@ -434,9 +434,9 @@ function hotpot_set_attempt_details(&$attempt) {
             SELECT
                 r.*
             FROM
-                {$CFG->prefix}hotpot_attempts AS a,
-                {$CFG->prefix}hotpot_questions AS q,
-                {$CFG->prefix}hotpot_responses AS r
+                {$CFG->prefix}hotpot_attempts a,
+                {$CFG->prefix}hotpot_questions q,
+                {$CFG->prefix}hotpot_responses r
             WHERE
                 a.clickreportid = $attempt->clickreportid AND
                 a.id = r.attempt AND
index e5857be1b12ebe6d760e53c40e34a02c78635854..41f1dcc3343ea45ef15cbf3940e1cb91e2b2adbf 100644 (file)
@@ -119,7 +119,7 @@ function hotpot_remove_orphans($secondarytable, $secondarykeyfield, $primarytabl
         SELECT 
             t2.$secondarykeyfield, t2.$secondarykeyfield
         FROM 
-            {$CFG->prefix}$secondarytable AS t2 LEFT JOIN {$CFG->prefix}$primarytable AS t1 
+            {$CFG->prefix}$secondarytable t2 LEFT JOIN {$CFG->prefix}$primarytable t1 
             ON (t2.$secondarykeyfield = t1.id)
         WHERE 
             t1.$primarykeyfield IS NULL
@@ -355,7 +355,7 @@ function hotpot_update_to_v2_1() {
                 $sql = "
                     INSERT INTO {$CFG->prefix}$table (attempt, details) 
                     SELECT a.id AS attempt, a.details AS details
-                        FROM {$CFG->prefix}hotpot_attempts AS a
+                        FROM {$CFG->prefix}hotpot_attempts a
                         WHERE 
                             a.details IS NOT NULL AND a.details <> ''
                             AND a.details LIKE '<?xml%' AND a.details LIKE '%</hpjsresult>'
index 15633818209a729f1c2394e4efdaad89afe19bb8..14acf5571deeab6a92df90d60675d019b7ad0643 100644 (file)
     $start = microtime();
 
     // get total number of attempts, users and details for these hotpots
-    $tables = "{$CFG->prefix}hotpot_attempts AS a";
+    $tables = "{$CFG->prefix}hotpot_attempts a";
     $fields = "
         a.hotpot AS hotpot,
         COUNT(DISTINCT a.clickreportid) AS attemptcount,
     $usejoin = 0;
     if (has_capability('mod/hotpot:grade', get_context_instance(CONTEXT_SYSTEM, SITEID)) && $usejoin) {
         // join attempts table and details table
-        $tables .= ",{$CFG->prefix}hotpot_details AS d";
+        $tables .= ",{$CFG->prefix}hotpot_details d";
         $fields .= ',COUNT(DISTINCT d.id) AS detailcount';
         $select .= " AND a.id=d.attempt";
 
index e5bea03dfc2a3e9e248a5b0c202b23db113a6626..6cdeaf602fa3351d88a3b8c57362f539d18f694f 100644 (file)
@@ -759,10 +759,10 @@ function hotpot_get_all_instances_in_course($modulename, $course) {
             cs.visible AS sectionvisible,
             thismodule.*
         FROM
-            {$CFG->prefix}course_modules AS cm,
-            {$CFG->prefix}course_sections AS cs,
-            {$CFG->prefix}modules AS m,
-            {$CFG->prefix}$modulename AS thismodule
+            {$CFG->prefix}course_modules cm,
+            {$CFG->prefix}course_sections cs,
+            {$CFG->prefix}modules m,
+            {$CFG->prefix}$modulename thismodule
         WHERE
             m.name = '$modulename' AND
             m.id = cm.module AND
@@ -963,8 +963,8 @@ function hotpot_print_recent_activity($course, $isteacher, $timestart) {
             h.name AS name,
             COUNT(*) AS count_attempts
         FROM
-            {$CFG->prefix}hotpot AS h,
-            {$CFG->prefix}hotpot_attempts AS a
+            {$CFG->prefix}hotpot h,
+            {$CFG->prefix}hotpot_attempts a
         WHERE
             h.course = $course->id
             AND h.id = a.hotpot
@@ -1021,10 +1021,10 @@ function hotpot_get_recent_mod_activity(&$activities, &$index, $sincetime, $cour
             cm.instance, cm.section,
             u.firstname, u.lastname, u.picture
         FROM
-            {$CFG->prefix}hotpot_attempts AS a,
-            {$CFG->prefix}hotpot AS h,
-            {$CFG->prefix}course_modules AS cm,
-            {$CFG->prefix}user AS u
+            {$CFG->prefix}hotpot_attempts a,
+            {$CFG->prefix}hotpot h,
+            {$CFG->prefix}course_modules cm,
+            {$CFG->prefix}user u
         WHERE
             a.timefinish > '$sincetime'
             AND a.id = a.clickreportid
index 471d87919e93135c897a86e7881e1df2f39a80be..c4899b224b6cf63edb2d29065ca5d17b9550f1de 100644 (file)
     }
 
     // database table and selection conditions
-    $table = "{$CFG->prefix}hotpot_attempts AS a";
+    $table = "{$CFG->prefix}hotpot_attempts a";
     $select = "a.hotpot=$hotpot->id AND a.userid IN ($user_ids)";
     if ($mode!='overview') {
         $select .= ' AND a.status<>'.HOTPOT_STATUS_INPROGRESS;
     if ($select) {
         // add user information to SQL query
         $select .= ' AND a.userid = u.id';
-        $table .= ", {$CFG->prefix}user AS u";
+        $table .= ", {$CFG->prefix}user u";
         $order = "u.lastname, a.attempt, a.timefinish";
         // get the attempts (at last!)
         $attempts = get_records_sql("SELECT $fields FROM $table WHERE $select ORDER BY $order");
@@ -462,8 +462,8 @@ function hotpot_print_report_selector(&$course, &$hotpot, &$formdata) {
         SELECT 
             u.id, u.firstname, u.lastname
         FROM 
-            {$CFG->prefix}user AS u,
-            {$CFG->prefix}hotpot_attempts AS ha
+            {$CFG->prefix}user u,
+            {$CFG->prefix}hotpot_attempts ha
         WHERE
             u.id = ha.userid AND ha.hotpot=$hotpot->id
         ORDER BY
index 121d483796276d51de39d658a33eb6a3c5c7f4ef..8e50fbd34aa9200a0f379adafc8c8e030a62bb86 100644 (file)
@@ -94,8 +94,8 @@
         // Now we look for random questions that can use questions from subcategories
         // because we will have to add these subcategories
         $sql = "SELECT t.id, t.category 
-                  FROM {$CFG->prefix}quiz_question_instances AS g,
-                       {$CFG->prefix}question AS t
+                  FROM {$CFG->prefix}quiz_question_instances g,
+                       {$CFG->prefix}question t
                        $from
                  WHERE $where t.id = g.question
                    AND t.qtype = '".RANDOM."'
                                  WHERE g.quiz = $instanceid");
     }
 
-?>
\ No newline at end of file
+?>
index 263c364f9c3185d7f9ef062580476623e7bd6032..3fd30277c44ea4c2bc5ba32ad03689dba6bf10c4 100644 (file)
@@ -217,7 +217,7 @@ function survey_get_responses($surveyid, $groupid) {
     global $CFG;
 
     if ($groupid) {
-        $groupsdb = ", {$CFG->prefix}groups_members AS gm";
+        $groupsdb = ", {$CFG->prefix}groups_members gm";
         $groupsql = "AND gm.groupid = $groupid AND u.id = gm.userid";
     } else {
         $groupsdb = "";
@@ -226,8 +226,8 @@ function survey_get_responses($surveyid, $groupid) {
 
     return get_records_sql("SELECT MAX(a.time) as time, 
                                    u.id, u.firstname, u.lastname, u.picture
-                              FROM {$CFG->prefix}survey_answers AS a, 
-                                   {$CFG->prefix}user AS u   $groupsdb
+                              FROM {$CFG->prefix}survey_answers a, 
+                                   {$CFG->prefix}user u   $groupsdb
                              WHERE a.survey = $surveyid 
                                    AND a.userid = u.id $groupsql
                           GROUP BY u.id, u.firstname, u.lastname, u.picture