Browse Source

Calculate the sum of statuses for all users in each session

Hi Dan,

Here is another patch the calculates the sum of statuses for all users in each session.

Please review and see if you can accept.

Nadav :-)
MOODLE_26_STABLE
Nadav Kavalerchik 11 years ago
parent
commit
3c3f90df08
  1. 21
      renderer.php

21
renderer.php

@ -812,6 +812,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