Browse Source

Split out graded and ungraded sessions on students all courses list.

MOODLE_32_STABLE
Dan Marsden 7 years ago
parent
commit
25e3f42638
  1. 5
      lang/en/attendance.php
  2. 37
      renderer.php
  3. 2
      version.php

5
lang/en/attendance.php

@ -74,7 +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['averageattendancegraded'] = 'Average attendance';
$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';
@ -482,7 +482,8 @@ $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['graded'] = 'Graded sessions';
$string['ungraded'] = 'Ungraded sessions';
$string['unknowngroup'] = 'Unknown group'; $string['unknowngroup'] = 'Unknown group';
$string['update'] = 'Update'; $string['update'] = 'Update';
$string['usedefaultsubnet'] = 'Use default'; $string['usedefaultsubnet'] = 'Use default';

37
renderer.php

@ -924,7 +924,6 @@ class mod_attendance_renderer extends plugin_renderer_base {
$o .= construct_user_data_stat($userdata->summary->get_all_sessions_summary_for($userdata->user->id), $o .= construct_user_data_stat($userdata->summary->get_all_sessions_summary_for($userdata->user->id),
$userdata->pageparams->view); $userdata->pageparams->view);
} else { } else {
$prevcid = 0;
$table = new html_table(); $table = new html_table();
$table->head = array(get_string('course'), $table->head = array(get_string('course'),
get_string('pluginname', 'mod_attendance'), get_string('pluginname', 'mod_attendance'),
@ -934,6 +933,8 @@ class mod_attendance_renderer extends plugin_renderer_base {
$table->align = array('left', 'left', 'center', 'center', 'center'); $table->align = array('left', 'left', 'center', 'center', 'center');
$table->colclasses = array('colcourse', 'colatt', 'colsessionscompleted', $table->colclasses = array('colcourse', 'colatt', 'colsessionscompleted',
'colpointssessionscompleted', 'colpercentagesessionscompleted'); 'colpointssessionscompleted', 'colpercentagesessionscompleted');
$table2 = clone($table); // Duplicate table for ungraded sessions.
$totalattendance = 0; $totalattendance = 0;
$totalpercentage = 0; $totalpercentage = 0;
foreach ($userdata->coursesatts as $ca) { foreach ($userdata->coursesatts as $ca) {
@ -943,12 +944,7 @@ 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));
$attendanceurl = html_writer::link($attendanceurl, $ca->attname); $row->cells[] = 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);
@ -963,10 +959,14 @@ class mod_attendance_renderer extends plugin_renderer_base {
} }
} }
$table->data[] = $row; if (empty($ca->attgrade)) {
if ($usersummary->numtakensessions > 0 && !empty($ca->attgrade)) { $table2->data[] = $row;
$totalattendance++; } else {
$totalpercentage = $totalpercentage + format_float($usersummary->takensessionspercentage * 100); $table->data[] = $row;
if ($usersummary->numtakensessions > 0) {
$totalattendance++;
$totalpercentage = $totalpercentage + format_float($usersummary->takensessionspercentage * 100);
}
} }
} }
$row = new html_table_row(); $row = new html_table_row();
@ -985,7 +985,20 @@ class mod_attendance_renderer extends plugin_renderer_base {
$row->cells = array($col, $col2); $row->cells = array($col, $col2);
$table->data[] = $row; $table->data[] = $row;
$o .= html_writer::table($table); if (!empty($table2->data) && !empty($table->data)) {
// Print graded header if both tables are being shown.
$o .= html_writer::div("<h3>".get_string('graded', 'mod_attendance')."</h3>");
}
if (!empty($table->data)) {
// don't bother printing the table if no sessions are being shown.
$o .= html_writer::table($table);
}
if (!empty($table2->data)) {
// Don't print this if it doesn't contain any data.
$o .= html_writer::div("<h3>".get_string('ungraded', 'mod_attendance')."</h3>");
$o .= html_writer::table($table2);
}
} }
return $o; return $o;

2
version.php

@ -23,7 +23,7 @@
*/ */
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
$plugin->version = 2016121325; $plugin->version = 2016121326;
$plugin->requires = 2016111800; $plugin->requires = 2016111800;
$plugin->release = '3.2.18'; $plugin->release = '3.2.18';
$plugin->maturity = MATURITY_STABLE; $plugin->maturity = MATURITY_STABLE;

Loading…
Cancel
Save