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. 22
      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['automarktask'] = 'Check for attendance sessions that require auto marking';
$string['autorecorded'] = 'system auto recorded'; $string['autorecorded'] = 'system auto recorded';
$string['averageattendance'] = 'Average attendance'; $string['averageattendance'] = 'Average attendance';
$string['averageattendancegraded'] = 'Average attendance excluding ungraded';
$string['calclose'] = 'Close'; $string['calclose'] = 'Close';
$string['caleventcreated'] = 'Calendar event for session successfully created'; $string['caleventcreated'] = 'Calendar event for session successfully created';
$string['caleventdeleted'] = 'Calendar event for session successfully deleted'; $string['caleventdeleted'] = 'Calendar event for session successfully deleted';
@ -481,6 +482,7 @@ $string['to'] = 'to:';
$string['triggered'] = 'First notified'; $string['triggered'] = 'First notified';
$string['tuseremail'] = 'Email'; $string['tuseremail'] = 'Email';
$string['tusername'] = 'Full name'; $string['tusername'] = 'Full name';
$string['ungraded'] = '(ungraded)';
$string['unknowngroup'] = 'Unknown group'; $string['unknowngroup'] = 'Unknown group';
$string['update'] = 'Update'; $string['update'] = 'Update';
$string['usedefaultsubnet'] = 'Use default'; $string['usedefaultsubnet'] = 'Use default';

22
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, $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);

4
styles.css

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

Loading…
Cancel
Save