Replaced the last php variables in SQL statements with param
This commit is contained in:
parent
cbc2c0e7ca
commit
f5fa94d199
|
@ -411,10 +411,10 @@ class associationservice extends \external_api {
|
|||
LEFT JOIN {cohort_members} cm ON u.id = cm.userid
|
||||
LEFT JOIN {local_treestudyplan_cohort} tc ON cm.cohortid = tc.cohort_id
|
||||
LEFT JOIN {local_treestudyplan_user} tu ON u.id = tu.user_id
|
||||
WHERE tc.studyplan_id = {$studyplan->id()}
|
||||
OR tu.studyplan_id = {$studyplan->id()}
|
||||
WHERE tc.studyplan_id = :studyplanid
|
||||
OR tu.studyplan_id = :studyplanidtoo
|
||||
ORDER BY u.lastname, u.firstname";
|
||||
$rs = $DB->get_recordset_sql($sql);
|
||||
$rs = $DB->get_recordset_sql($sql,["studyplanid" => $studyplan->id(), "studyplanidtoo" => $studyplan->id()]);
|
||||
|
||||
foreach ($rs as $u) {
|
||||
$users[] = self::make_user_model($u);
|
||||
|
|
|
@ -31,13 +31,13 @@ class assign_scanner extends scanner_base {
|
|||
JOIN {assign} a ON a.id = asgn_sub.assignment
|
||||
LEFT JOIN {assign_grades} ag ON ag.assignment = asgn_sub.assignment AND ag.userid = asgn_sub.userid
|
||||
AND asgn_sub.attemptnumber = ag.attemptnumber
|
||||
WHERE a.id = {$this->gi->iteminstance}
|
||||
WHERE a.id = :iteminstance
|
||||
AND asgn_sub.status = 'submitted'
|
||||
AND asgn_sub.userid > 0
|
||||
AND a.grade <> 0 AND (ag.id IS NULL OR asgn_sub.timemodified >= ag.timemodified)
|
||||
";
|
||||
|
||||
return $DB->get_fieldset_sql($sql);
|
||||
return $DB->get_fieldset_sql($sql,['iteminstance' => $this->gi->iteminstance]);
|
||||
}
|
||||
|
||||
protected function get_graded_users() {
|
||||
|
@ -45,9 +45,9 @@ class assign_scanner extends scanner_base {
|
|||
$sql = "SELECT DISTINCT g.userid
|
||||
FROM {grade_grades} g
|
||||
LEFT JOIN {grade_items} gi on g.itemid = gi.id
|
||||
WHERE gi.itemmodule = 'assign' AND gi.iteminstance = {$this->gi->iteminstance}
|
||||
WHERE gi.itemmodule = 'assign' AND gi.iteminstance = :iteminstance
|
||||
AND g.finalgrade IS NOT NULL"; // MAy turn out to be needed, dunno.
|
||||
return $DB->get_fieldset_sql($sql);
|
||||
return $DB->get_fieldset_sql($sql,['iteminstance' => $this->gi->iteminstance]);
|
||||
}
|
||||
|
||||
public function count_ungraded($courseuserids = []) {
|
||||
|
|
|
@ -37,9 +37,9 @@ class quiz_scanner extends scanner_base {
|
|||
FROM {question_attempt_steps} qas
|
||||
JOIN {question_attempts} qna ON qas.questionattemptid = qna.id
|
||||
JOIN {quiz_attempts} qza ON qna.questionusageid = qza.uniqueid
|
||||
WHERE qas.state = 'needsgrading' AND qza.quiz = {$this->gi->iteminstance}";
|
||||
WHERE qas.state = 'needsgrading' AND qza.quiz = :iteminstance";
|
||||
|
||||
$rs = $DB->get_recordset_sql($sql);
|
||||
$rs = $DB->get_recordset_sql($sql,['iteminstance' => $this->gi->iteminstance]);
|
||||
$submissions = [];
|
||||
foreach ($rs as $r) {
|
||||
// Now, check if .
|
||||
|
@ -69,10 +69,10 @@ class quiz_scanner extends scanner_base {
|
|||
$sql = "SELECT DISTINCT g.userid
|
||||
FROM {grade_grades} g
|
||||
LEFT JOIN {grade_items} gi on g.itemid = gi.id
|
||||
WHERE gi.itemmodule = 'quiz' AND gi.iteminstance = {$this->gi->iteminstance}
|
||||
WHERE gi.itemmodule = 'quiz' AND gi.iteminstance = :iteminstance
|
||||
AND g.finalgrade IS NOT NULL"; // MAy turn out to be needed, dunno.
|
||||
|
||||
$graded = $DB->get_fieldset_sql($sql);
|
||||
$graded = $DB->get_fieldset_sql($sql,['iteminstance' => $this->gi->iteminstance]);
|
||||
|
||||
if (count($courseuserids) > 0) {
|
||||
$graded = array_intersect($graded, $courseuserids);
|
||||
|
|
|
@ -25,6 +25,13 @@ $plugin->component = 'local_treestudyplan'; // Recommended since 2.0.2 (MDL-260
|
|||
$plugin->version = 2023082101; // YYYYMMDDHH (year, month, day, iteration).
|
||||
$plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11).
|
||||
|
||||
$plugin->release = "1.0.0";
|
||||
$plugin->maturity = MATURITY_RC;
|
||||
// Supported from Moodle 3.11 to 4.1 (4.2 not yet tested)/
|
||||
$plugin->supported = [ 311, 401 ];
|
||||
|
||||
$plugin->dependencies = [
|
||||
'theme_boost' => 2019052000,
|
||||
];
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user