Browse Source

Fix #217 - hide percentage/points columns when no grade is set.

MOODLE_31_STABLE
Dan Marsden 8 years ago
parent
commit
c4fa8a6a85
  1. 64
      renderer.php

64
renderer.php

@ -897,34 +897,38 @@ class mod_attendance_renderer extends plugin_renderer_base {
$table->align[] = 'center'; $table->align[] = 'center';
$table->size[] = '1px'; $table->size[] = '1px';
$table->head[] = get_string('points', 'attendance'); if (!empty($reportdata->att->grade)) {
$table->align[] = 'center'; $table->head[] = get_string('points', 'attendance');
$table->size[] = '1px';
$table->head[] = get_string('percentage', 'attendance');
$table->align[] = 'center';
$table->size[] = '1px';
if ($reportdata->pageparams->view == ATT_VIEW_SUMMARY) {
$table->head[] = get_string('sessionstotal', 'attendance');
$table->align[] = 'center'; $table->align[] = 'center';
$table->size[] = '1px'; $table->size[] = '1px';
$table->head[] = get_string('pointsallsessions', 'attendance'); $table->head[] = get_string('percentage', 'attendance');
$table->align[] = 'center'; $table->align[] = 'center';
$table->size[] = '1px'; $table->size[] = '1px';
}
$table->head[] = get_string('percentageallsessions', 'attendance'); if ($reportdata->pageparams->view == ATT_VIEW_SUMMARY) {
$table->head[] = get_string('sessionstotal', 'attendance');
$table->align[] = 'center'; $table->align[] = 'center';
$table->size[] = '1px'; $table->size[] = '1px';
$table->head[] = get_string('maxpossiblepoints', 'attendance'); if (!empty($reportdata->att->grade)) {
$table->align[] = 'center'; $table->head[] = get_string('pointsallsessions', 'attendance');
$table->size[] = '1px'; $table->align[] = 'center';
$table->size[] = '1px';
$table->head[] = get_string('maxpossiblepercentage', 'attendance'); $table->head[] = get_string('percentageallsessions', 'attendance');
$table->align[] = 'center'; $table->align[] = 'center';
$table->size[] = '1px'; $table->size[] = '1px';
$table->head[] = get_string('maxpossiblepoints', 'attendance');
$table->align[] = 'center';
$table->size[] = '1px';
$table->head[] = get_string('maxpossiblepercentage', 'attendance');
$table->align[] = 'center';
$table->size[] = '1px';
}
} }
if ($bulkmessagecapability) { // Display the table header for bulk messaging. if ($bulkmessagecapability) { // Display the table header for bulk messaging.
@ -948,19 +952,23 @@ class mod_attendance_renderer extends plugin_renderer_base {
$usersummary = $reportdata->summary->get_taken_sessions_summary_for($user->id); $usersummary = $reportdata->summary->get_taken_sessions_summary_for($user->id);
} }
$row->cells[] = $usersummary->numtakensessions; $row->cells[] = $usersummary->numtakensessions;
$row->cells[] = format_float($usersummary->takensessionspoints, 1, true, true) . ' / ' . if (!empty($reportdata->att->grade)) {
format_float($usersummary->takensessionsmaxpoints, 1, true, true); $row->cells[] = format_float($usersummary->takensessionspoints, 1, true, true) . ' / ' .
$row->cells[] = format_float($usersummary->takensessionspercentage * 100) . '%'; format_float($usersummary->takensessionsmaxpoints, 1, true, true);
$row->cells[] = format_float($usersummary->takensessionspercentage * 100) . '%';
}
if ($reportdata->pageparams->view == ATT_VIEW_SUMMARY) { if ($reportdata->pageparams->view == ATT_VIEW_SUMMARY) {
$row->cells[] = $usersummary->numallsessions; $row->cells[] = $usersummary->numallsessions;
$row->cells[] = format_float($usersummary->takensessionspoints, 1, true, true) . ' / ' . if (!empty($reportdata->att->grade)) {
format_float($usersummary->allsessionsmaxpoints, 1, true, true); $row->cells[] = format_float($usersummary->takensessionspoints, 1, true, true) . ' / ' .
$row->cells[] = format_float($usersummary->allsessionspercentage * 100) . '%'; format_float($usersummary->allsessionsmaxpoints, 1, true, true);
$row->cells[] = format_float($usersummary->allsessionspercentage * 100) . '%';
$row->cells[] = format_float($usersummary->maxpossiblepoints, 1, true, true) . ' / ' .
format_float($usersummary->allsessionsmaxpoints, 1, true, true); $row->cells[] = format_float($usersummary->maxpossiblepoints, 1, true, true) . ' / ' .
$row->cells[] = format_float($usersummary->maxpossiblepercentage * 100) . '%'; format_float($usersummary->allsessionsmaxpoints, 1, true, true);
$row->cells[] = format_float($usersummary->maxpossiblepercentage * 100) . '%';
}
} }
if ($bulkmessagecapability) { // Create the checkbox for bulk messaging. if ($bulkmessagecapability) { // Create the checkbox for bulk messaging.

Loading…
Cancel
Save