Permalink
Browse files

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

…into MOODLE_22_STABLE
  • Loading branch information...
2 parents 4921fb4 + a77b489 commit 7f96df6222e9fb1500843beafdffee410e5f96c2 Sam Hemelryk committed Dec 7, 2011
Showing with 8 additions and 8 deletions.
  1. +8 −8 mod/scorm/report/basic/report.php
View
16 mod/scorm/report/basic/report.php
@@ -84,7 +84,7 @@ function display($scorm, $cm, $course, $download) {
$nostudents = true;
$allowedlist = '';
} else {
- $allowedlist = join(',', array_keys($students));
+ $allowedlist = array_keys($students);
}
} else {
// all users who can attempt scoes and who are in the currently selected group
@@ -93,7 +93,7 @@ function display($scorm, $cm, $course, $download) {
$nostudents = true;
$groupstudents = array();
}
- $allowedlist = join(',', array_keys($groupstudents));
+ $allowedlist = array_keys($groupstudents);
}
if ( !$nostudents ) {
@@ -269,7 +269,8 @@ function display($scorm, $cm, $course, $download) {
header("Pragma: public");
echo implode("\t", $headers)." \n";
}
-
+ $params = array();
+ list($usql, $params) = $DB->get_in_or_equal($allowedlist, SQL_PARAMS_NAMED);
// Construct the SQL
$select = 'SELECT DISTINCT '.$DB->sql_concat('u.id', '\'#\'', 'COALESCE(st.attempt, 0)').' AS uniqueid, ';
$select .= 'st.scormid AS scormid, st.attempt AS attempt, ' .
@@ -282,23 +283,22 @@ function display($scorm, $cm, $course, $download) {
switch ($attemptsmode) {
case SCORM_REPORT_ATTEMPTS_STUDENTS_WITH:
// Show only students with attempts
- $where = ' WHERE u.id IN (' .$allowedlist. ') AND st.userid IS NOT NULL';
+ $where = ' WHERE u.id ' .$usql. ' AND st.userid IS NOT NULL';
break;
case SCORM_REPORT_ATTEMPTS_STUDENTS_WITH_NO:
// Show only students without attempts
- $where = ' WHERE u.id IN (' .$allowedlist. ') AND st.userid IS NULL';
+ $where = ' WHERE u.id ' .$usql. ' AND st.userid IS NULL';
break;
case SCORM_REPORT_ATTEMPTS_ALL_STUDENTS:
// Show all students with or without attempts
- $where = ' WHERE u.id IN (' .$allowedlist. ') AND (st.userid IS NOT NULL OR st.userid IS NULL)';
+ $where = ' WHERE u.id ' .$usql. ' AND (st.userid IS NOT NULL OR st.userid IS NULL)';
break;
}
$countsql = 'SELECT COUNT(DISTINCT('.$DB->sql_concat('u.id', '\'#\'', 'COALESCE(st.attempt, 0)').')) AS nbresults, ';
$countsql .= 'COUNT(DISTINCT('.$DB->sql_concat('u.id', '\'#\'', 'st.attempt').')) AS nbattempts, ';
$countsql .= 'COUNT(DISTINCT(u.id)) AS nbusers ';
$countsql .= $from.$where;
- $params = array();
if (!$download) {
$sort = $table->get_sql_sort();
@@ -321,7 +321,7 @@ function display($scorm, $cm, $course, $download) {
}
if (!empty($countsql)) {
- $count = $DB->get_record_sql($countsql);
+ $count = $DB->get_record_sql($countsql, $params);
$totalinitials = $count->nbresults;
if ($twhere) {
$countsql .= ' AND '.$twhere;

0 comments on commit 7f96df6

Please sign in to comment.