}
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";
'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 ' .
$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");
}
}
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}
$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";
$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
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
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
$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>'
$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";
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
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
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
}
// 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");
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
// 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
+?>
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 = "";
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