Browse Source

Exclude ungraded attendance activities from student all courses average.

MOODLE_34_STABLE
Dan Marsden 7 years ago
parent
commit
1fab8e9691
  1. 2
      lang/en/attendance.php
  2. 24
      renderer.php
  3. 4
      styles.css

2
lang/en/attendance.php

@ -74,6 +74,7 @@ If "Set unmarked at end of session" any students who have not marked their atten
$string['automarktask'] = 'Check for attendance sessions that require auto marking';
$string['autorecorded'] = 'system auto recorded';
$string['averageattendance'] = 'Average attendance';
$string['averageattendancegraded'] = 'Average attendance excluding ungraded';
$string['calclose'] = 'Close';
$string['caleventcreated'] = 'Calendar event for session successfully created';
$string['caleventdeleted'] = 'Calendar event for session successfully deleted';
@ -481,6 +482,7 @@ $string['to'] = 'to:';
$string['triggered'] = 'First notified';
$string['tuseremail'] = 'Email';
$string['tusername'] = 'Full name';
$string['ungraded'] = '(ungraded)';
$string['unknowngroup'] = 'Unknown group';
$string['update'] = 'Update';
$string['usedefaultsubnet'] = 'Use default';

24
renderer.php

@ -960,7 +960,12 @@ class mod_attendance_renderer extends plugin_renderer_base {
$attendanceurl = new moodle_url('/mod/attendance/view.php', array('id' => $ca->cmid,
'studentid' => $userdata->user->id,
'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();
if (isset($userdata->summary[$ca->attid])) {
$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;
if ($usersummary->numtakensessions > 0) {
if ($usersummary->numtakensessions > 0 && !empty($ca->attgrade)) {
$totalattendance++;
$totalpercentage = $totalpercentage + format_float($usersummary->takensessionspercentage * 100);
}
}
$row = new html_table_row();
$average = format_float($totalpercentage / $totalattendance).'%';
$col = new html_table_cell(get_string('averageattendance', 'mod_attendance'));
if (empty($totalattendance)) {
$average = '-';
} else {
$average = format_float($totalpercentage / $totalattendance).'%';
}
$col = new html_table_cell(get_string('averageattendancegraded', 'mod_attendance'));
$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;
$o .= html_writer::table($table);

4
styles.css

@ -190,6 +190,10 @@
font-size: x-large;
text-align: center;
}
.path-mod-attendance .ungraded {
font-size: smaller;
font-style: italic;
}
#page-mod-attendance-sessions .statusgroup .statusdesc {
margin-right: 12px;
}

Loading…
Cancel
Save