Browse Source

Merge pull request #28 from nadavkav/patch-4

Calculate the sum of statuses for all users in each session
MOODLE_26_STABLE
Dan Marsden 11 years ago
parent
commit
1936284948
  1. 21
      renderer.php

21
renderer.php

@ -825,6 +825,27 @@ class mod_attendance_renderer extends plugin_renderer_base {
$table->data[] = $row; $table->data[] = $row;
} }
// Calculate the sum of statuses for each user
$statrow = new html_table_row();
$statrow->cells[] = '';
$statrow->cells[] = get_string('summary');
foreach ($reportdata->sessions as $sess) {
$sessionstats = array();
foreach ($reportdata->users as $user) {
foreach($reportdata->statuses as $status) {
if ($reportdata->sessionslog[$user->id][$sess->id]->statusid == $status->id) $sessionstats[$status->id]++;
}
}
$statsoutput = '<br/>';
foreach($reportdata->statuses as $status) {
$statsoutput .= "$status->description:".$sessionstats[$status->id]." <br/>";
}
$statrow->cells[] = $statsoutput;
}
$table->data[] = $statrow;
return html_writer::table($table); return html_writer::table($table);
} }

Loading…
Cancel
Save