|
@ -960,7 +960,12 @@ class mod_attendance_renderer extends plugin_renderer_base { |
|
|
$attendanceurl = new moodle_url('/mod/attendance/view.php', array('id' => $ca->cmid, |
|
|
$attendanceurl = new moodle_url('/mod/attendance/view.php', array('id' => $ca->cmid, |
|
|
'studentid' => $userdata->user->id, |
|
|
'studentid' => $userdata->user->id, |
|
|
'view' => ATT_VIEW_ALL)); |
|
|
'view' => ATT_VIEW_ALL)); |
|
|
$row->cells[] = html_writer::link($attendanceurl, $ca->attname); |
|
|
$attendanceurl = html_writer::link($attendanceurl, $ca->attname); |
|
|
|
|
|
if (empty($ca->attgrade)) { |
|
|
|
|
|
$attendanceurl .= " ". html_writer::span(get_string('ungraded', 'mod_attendance'), |
|
|
|
|
|
'ungraded'); |
|
|
|
|
|
} |
|
|
|
|
|
$row->cells[] = $attendanceurl; |
|
|
$usersummary = new stdClass(); |
|
|
$usersummary = new stdClass(); |
|
|
if (isset($userdata->summary[$ca->attid])) { |
|
|
if (isset($userdata->summary[$ca->attid])) { |
|
|
$usersummary = $userdata->summary[$ca->attid]->get_all_sessions_summary_for($userdata->user->id); |
|
|
$usersummary = $userdata->summary[$ca->attid]->get_all_sessions_summary_for($userdata->user->id); |
|
@ -976,16 +981,25 @@ class mod_attendance_renderer extends plugin_renderer_base { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
$table->data[] = $row; |
|
|
$table->data[] = $row; |
|
|
if ($usersummary->numtakensessions > 0) { |
|
|
if ($usersummary->numtakensessions > 0 && !empty($ca->attgrade)) { |
|
|
$totalattendance++; |
|
|
$totalattendance++; |
|
|
$totalpercentage = $totalpercentage + format_float($usersummary->takensessionspercentage * 100); |
|
|
$totalpercentage = $totalpercentage + format_float($usersummary->takensessionspercentage * 100); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
$row = new html_table_row(); |
|
|
$row = new html_table_row(); |
|
|
|
|
|
if (empty($totalattendance)) { |
|
|
|
|
|
$average = '-'; |
|
|
|
|
|
} else { |
|
|
$average = format_float($totalpercentage / $totalattendance).'%'; |
|
|
$average = format_float($totalpercentage / $totalattendance).'%'; |
|
|
$col = new html_table_cell(get_string('averageattendance', 'mod_attendance')); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$col = new html_table_cell(get_string('averageattendancegraded', 'mod_attendance')); |
|
|
$col->attributes['class'] = 'averageattendance'; |
|
|
$col->attributes['class'] = 'averageattendance'; |
|
|
$row->cells = array($col, '', '', '', $average); |
|
|
$col->colspan = 4; |
|
|
|
|
|
|
|
|
|
|
|
$col2 = new html_table_cell($average); |
|
|
|
|
|
$col2->style = 'text-align: center'; |
|
|
|
|
|
$row->cells = array($col, $col2); |
|
|
$table->data[] = $row; |
|
|
$table->data[] = $row; |
|
|
|
|
|
|
|
|
$o .= html_writer::table($table); |
|
|
$o .= html_writer::table($table); |
|
|