Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'MDL-28588-m22' of git://github.com/ankitagarwal/moodle …

…into MOODLE_22_STABLE
  • Loading branch information...
commit 7f96df6222e9fb1500843beafdffee410e5f96c2 2 parents 4921fb4 + a77b489
Sam Hemelryk samhemelryk authored

Showing 1 changed file with 8 additions and 8 deletions. Show diff stats Hide diff stats

  1. +8 8 mod/scorm/report/basic/report.php
16 mod/scorm/report/basic/report.php
@@ -84,7 +84,7 @@ function display($scorm, $cm, $course, $download) {
84 84 $nostudents = true;
85 85 $allowedlist = '';
86 86 } else {
87   - $allowedlist = join(',', array_keys($students));
  87 + $allowedlist = array_keys($students);
88 88 }
89 89 } else {
90 90 // all users who can attempt scoes and who are in the currently selected group
@@ -93,7 +93,7 @@ function display($scorm, $cm, $course, $download) {
93 93 $nostudents = true;
94 94 $groupstudents = array();
95 95 }
96   - $allowedlist = join(',', array_keys($groupstudents));
  96 + $allowedlist = array_keys($groupstudents);
97 97 }
98 98
99 99 if ( !$nostudents ) {
@@ -269,7 +269,8 @@ function display($scorm, $cm, $course, $download) {
269 269 header("Pragma: public");
270 270 echo implode("\t", $headers)." \n";
271 271 }
272   -
  272 + $params = array();
  273 + list($usql, $params) = $DB->get_in_or_equal($allowedlist, SQL_PARAMS_NAMED);
273 274 // Construct the SQL
274 275 $select = 'SELECT DISTINCT '.$DB->sql_concat('u.id', '\'#\'', 'COALESCE(st.attempt, 0)').' AS uniqueid, ';
275 276 $select .= 'st.scormid AS scormid, st.attempt AS attempt, ' .
@@ -282,15 +283,15 @@ function display($scorm, $cm, $course, $download) {
282 283 switch ($attemptsmode) {
283 284 case SCORM_REPORT_ATTEMPTS_STUDENTS_WITH:
284 285 // Show only students with attempts
285   - $where = ' WHERE u.id IN (' .$allowedlist. ') AND st.userid IS NOT NULL';
  286 + $where = ' WHERE u.id ' .$usql. ' AND st.userid IS NOT NULL';
286 287 break;
287 288 case SCORM_REPORT_ATTEMPTS_STUDENTS_WITH_NO:
288 289 // Show only students without attempts
289   - $where = ' WHERE u.id IN (' .$allowedlist. ') AND st.userid IS NULL';
  290 + $where = ' WHERE u.id ' .$usql. ' AND st.userid IS NULL';
290 291 break;
291 292 case SCORM_REPORT_ATTEMPTS_ALL_STUDENTS:
292 293 // Show all students with or without attempts
293   - $where = ' WHERE u.id IN (' .$allowedlist. ') AND (st.userid IS NOT NULL OR st.userid IS NULL)';
  294 + $where = ' WHERE u.id ' .$usql. ' AND (st.userid IS NOT NULL OR st.userid IS NULL)';
294 295 break;
295 296 }
296 297
@@ -298,7 +299,6 @@ function display($scorm, $cm, $course, $download) {
298 299 $countsql .= 'COUNT(DISTINCT('.$DB->sql_concat('u.id', '\'#\'', 'st.attempt').')) AS nbattempts, ';
299 300 $countsql .= 'COUNT(DISTINCT(u.id)) AS nbusers ';
300 301 $countsql .= $from.$where;
301   - $params = array();
302 302
303 303 if (!$download) {
304 304 $sort = $table->get_sql_sort();
@@ -321,7 +321,7 @@ function display($scorm, $cm, $course, $download) {
321 321 }
322 322
323 323 if (!empty($countsql)) {
324   - $count = $DB->get_record_sql($countsql);
  324 + $count = $DB->get_record_sql($countsql, $params);
325 325 $totalinitials = $count->nbresults;
326 326 if ($twhere) {
327 327 $countsql .= ' AND '.$twhere;

0 comments on commit 7f96df6

Please sign in to comment.
Something went wrong with that request. Please try again.