Aligned SQL to conform to Moodle standards

This commit is contained in:
Mark Nelson 2015-03-11 01:22:44 -07:00
parent 8a55c96dab
commit 6821122c30
6 changed files with 44 additions and 47 deletions

View file

@ -304,8 +304,7 @@ function customcert_delete_page($pageid) {
SET pagenumber = pagenumber - 1
WHERE customcertid = :customcertid
AND pagenumber > :pagenumber";
$DB->execute($sql, array('customcertid' => $page->customcertid,
'pagenumber' => $page->pagenumber));
$DB->execute($sql, array('customcertid' => $page->customcertid, 'pagenumber' => $page->pagenumber));
}
/**
@ -407,17 +406,15 @@ function customcert_get_issues($customcertid, $groupmode, $cm, $page, $perpage)
$allparams = $conditionsparams + array('customcertid' => $customcertid);
// Return the issues.
return $DB->get_records_sql("SELECT u.*, ci.code, ci.timecreated
$sql = "SELECT u.*, ci.code, ci.timecreated
FROM {user} u
INNER JOIN {customcert_issues} ci
ON u.id = ci.userid
WHERE u.deleted = 0
AND ci.customcertid = :customcertid
$conditionssql
ORDER BY " . $DB->sql_fullname(),
$allparams,
$page * $perpage,
$perpage);
ORDER BY " . $DB->sql_fullname();
return $DB->get_records_sql($sql, $allparams, $page * $perpage, $perpage);
}
/**
@ -438,14 +435,14 @@ function customcert_get_number_of_issues($customcertid, $cm, $groupmode) {
$allparams = $conditionsparams + array('customcertid' => $customcertid);
// Return the number of issues.
return $DB->count_records_sql("SELECT COUNT(u.id) as count
$sql = "SELECT COUNT(u.id) as count
FROM {user} u
INNER JOIN {customcert_issues} ci
ON u.id = ci.userid
WHERE u.deleted = 0
AND ci.customcertid = :customcertid
$conditionssql",
$allparams);
$conditionssql";
return $DB->count_records_sql($sql, $allparams);
}
/**