Skip to content

Commit

Permalink
Removed usage of table aliases with "as" as per MDL-10808
Browse files Browse the repository at this point in the history
  • Loading branch information
moodler committed Aug 11, 2007
1 parent e2c8fe7 commit 871ab9a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion question/category_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ function update_category($updateid, $newparent, $newname, $newinfo) {
$cat->name = $newname;
$cat->info = $newinfo;
//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
$cat->parent = $parentid;
if (!update_record("question_categories", $cat)) {
Expand Down
2 changes: 1 addition & 1 deletion question/category_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function definition() {
$questioncategoryel = $mform->addElement('questioncategory', 'parent', get_string('parent', 'quiz'),
array('contexts'=>$contexts, 'top'=>true, 'currentcat'=>$currentcat, 'nochildrenof'=>$currentcat));
$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');
}

Expand Down
6 changes: 3 additions & 3 deletions question/editlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ function question_make_default_categories($contexts) {

function question_can_delete_cat($todelete){
global $CFG;
$record = get_record_sql("SELECT count(*) as count, c1.contextid as contextid FROM {$CFG->prefix}question_categories as c1,
{$CFG->prefix}question_categories as c2 WHERE c2.id = $todelete
$record = get_record_sql("SELECT count(*) as count, c1.contextid as contextid FROM {$CFG->prefix}question_categories c1,
{$CFG->prefix}question_categories c2 WHERE c2.id = $todelete
AND c1.contextid = c2.contextid GROUP BY c1.contextid");
$contextid = $record->contextid;
$count = $record->count;
Expand Down Expand Up @@ -935,4 +935,4 @@ function require_login_in_context($contextorid = null){
require_login();
}
}
?>
?>
6 changes: 3 additions & 3 deletions question/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ function question_delete_unused_random(){
$tofix = array();
$result = true;
//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 ".
"({$CFG->prefix}quiz_question_instances as qqi) ".
if ($qqis = get_records_sql("SELECT q.* FROM {$CFG->prefix}question q LEFT JOIN ".
"({$CFG->prefix}quiz_question_instances qqi) ".
"ON (q.id = qqi.question) WHERE q.qtype='random' AND qqi.question IS NULL")){
$qqilist = join(array_keys($qqis), ',');
$result = $result && delete_records_select('question', "id IN ($qqilist)");
Expand All @@ -118,7 +118,7 @@ function question_cwqpfs_to_update($categories = null){

//any cats with questions picking from subcats?
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")){
return array();
} else {
Expand Down

0 comments on commit 871ab9a

Please sign in to comment.