Permalink
Browse files

MDL-33822 SCORM Interactions report - fix formatting of empty cells.

  • Loading branch information...
1 parent f5fe536 commit 751f5b0ae938b88fea93759e29b3c1149844f620 @leblangi leblangi committed with Sam Hemelryk Jul 5, 2012
Showing with 6 additions and 5 deletions.
  1. +6 −5 mod/scorm/report/interactions/report.php
@@ -185,6 +185,7 @@ function display($scorm, $cm, $course, $download) {
$countsql .= $from.$where;
$attempts = $DB->get_records_sql($select.$from.$where, $params);
$questioncount = get_scorm_question_count($scorm->id);
+ $nbmaincolumns = count($columns);
for($id = 0; $id < $questioncount; $id++) {
if ($displayoptions['qtext']) {
$columns[] = 'question' . $id;
@@ -476,9 +477,7 @@ function display($scorm, $cm, $course, $download) {
$row[] = $score;
}
// interaction data
- $i=0;
- $element='cmi.interactions_'.$i.'.id';
- while(isset($trackdata->$element)) {
+ for ($i=0; $i < $questioncount; $i++) {
if ($displayoptions['qtext']) {
$element='cmi.interactions_'.$i.'.id';
if (isset($trackdata->$element)) {
@@ -513,8 +512,6 @@ function display($scorm, $cm, $course, $download) {
$row[] = '&nbsp;';
}
}
- $i++;
- $element = 'cmi.interactions_'.$i.'.id';
}
//---end of interaction data*/
} else {
@@ -525,6 +522,10 @@ function display($scorm, $cm, $course, $download) {
} else {
$row[] = $strstatus;
}
+ // complete the empty cells
+ for ($i=0; $i < count($columns) - $nbmaincolumns; $i++) {
+ $row[] = '&nbsp;';
+ }
}
}
}

0 comments on commit 751f5b0

Please sign in to comment.