Removed usage of table aliases with "as" as per MDL-10808

This commit is contained in:
moodler 2007-08-11 14:28:36 +00:00
parent e2c8fe7b09
commit 871ab9a3e2
4 changed files with 8 additions and 8 deletions

View file

@ -416,7 +416,7 @@ class question_category_object {
$cat->name = $newname; $cat->name = $newname;
$cat->info = $newinfo; $cat->info = $newinfo;
//never move category where it is the default //never move category where it is the default
if (1 != count_records_sql("SELECT count(*) FROM {$CFG->prefix}question_categories as c1, {$CFG->prefix}question_categories as c2 WHERE c2.id = $updateid AND c1.contextid = c2.contextid")){ if (1 != count_records_sql("SELECT count(*) FROM {$CFG->prefix}question_categories c1, {$CFG->prefix}question_categories c2 WHERE c2.id = $updateid AND c1.contextid = c2.contextid")){
if ($oldcat->contextid == $tocontextid){ // not moving contexts if ($oldcat->contextid == $tocontextid){ // not moving contexts
$cat->parent = $parentid; $cat->parent = $parentid;
if (!update_record("question_categories", $cat)) { if (!update_record("question_categories", $cat)) {

View file

@ -17,7 +17,7 @@ class question_category_edit_form extends moodleform {
$questioncategoryel = $mform->addElement('questioncategory', 'parent', get_string('parent', 'quiz'), $questioncategoryel = $mform->addElement('questioncategory', 'parent', get_string('parent', 'quiz'),
array('contexts'=>$contexts, 'top'=>true, 'currentcat'=>$currentcat, 'nochildrenof'=>$currentcat)); array('contexts'=>$contexts, 'top'=>true, 'currentcat'=>$currentcat, 'nochildrenof'=>$currentcat));
$mform->setType('parent', PARAM_SEQUENCE); $mform->setType('parent', PARAM_SEQUENCE);
if (1 == count_records_sql("SELECT count(*) FROM {$CFG->prefix}question_categories as c1, {$CFG->prefix}question_categories as c2 WHERE c2.id = $currentcat AND c1.contextid = c2.contextid")){ if (1 == count_records_sql("SELECT count(*) FROM {$CFG->prefix}question_categories c1, {$CFG->prefix}question_categories c2 WHERE c2.id = $currentcat AND c1.contextid = c2.contextid")){
$mform->hardFreeze('parent'); $mform->hardFreeze('parent');
} }

View file

@ -114,8 +114,8 @@ function question_make_default_categories($contexts) {
function question_can_delete_cat($todelete){ function question_can_delete_cat($todelete){
global $CFG; global $CFG;
$record = get_record_sql("SELECT count(*) as count, c1.contextid as contextid FROM {$CFG->prefix}question_categories as c1, $record = get_record_sql("SELECT count(*) as count, c1.contextid as contextid FROM {$CFG->prefix}question_categories c1,
{$CFG->prefix}question_categories as c2 WHERE c2.id = $todelete {$CFG->prefix}question_categories c2 WHERE c2.id = $todelete
AND c1.contextid = c2.contextid GROUP BY c1.contextid"); AND c1.contextid = c2.contextid GROUP BY c1.contextid");
$contextid = $record->contextid; $contextid = $record->contextid;
$count = $record->count; $count = $record->count;

View file

@ -102,8 +102,8 @@ function question_delete_unused_random(){
$tofix = array(); $tofix = array();
$result = true; $result = true;
//delete all 'random' questions that are not been used in a quiz. //delete all 'random' questions that are not been used in a quiz.
if ($qqis = get_records_sql("SELECT q.* FROM {$CFG->prefix}question as q LEFT JOIN ". if ($qqis = get_records_sql("SELECT q.* FROM {$CFG->prefix}question q LEFT JOIN ".
"({$CFG->prefix}quiz_question_instances as qqi) ". "({$CFG->prefix}quiz_question_instances qqi) ".
"ON (q.id = qqi.question) WHERE q.qtype='random' AND qqi.question IS NULL")){ "ON (q.id = qqi.question) WHERE q.qtype='random' AND qqi.question IS NULL")){
$qqilist = join(array_keys($qqis), ','); $qqilist = join(array_keys($qqis), ',');
$result = $result && delete_records_select('question', "id IN ($qqilist)"); $result = $result && delete_records_select('question', "id IN ($qqilist)");
@ -118,7 +118,7 @@ function question_cwqpfs_to_update($categories = null){
//any cats with questions picking from subcats? //any cats with questions picking from subcats?
if (!$cwqpfs = get_records_sql_menu("SELECT DISTINCT qc.id, 1 ". if (!$cwqpfs = get_records_sql_menu("SELECT DISTINCT qc.id, 1 ".
"FROM {$CFG->prefix}question as q, {$CFG->prefix}question_categories as qc ". "FROM {$CFG->prefix}question q, {$CFG->prefix}question_categories qc ".
"WHERE q.qtype='random' AND qc.id = q.category AND q.questiontext = 1")){ "WHERE q.qtype='random' AND qc.id = q.category AND q.questiontext = 1")){
return array(); return array();
} else { } else {