Browse Source

Check group data exists before using group name.

MOODLE_29_STABLE
Dan Marsden 9 years ago
parent
commit
692353f697
  1. 6
      export.php
  2. 7
      renderer.php

6
export.php

@ -110,7 +110,11 @@ if ($formdata = $mform->get_data()) {
foreach ($reportdata->sessions as $sess) { foreach ($reportdata->sessions as $sess) {
$text = userdate($sess->sessdate, get_string('strftimedmyhm', 'attendance')); $text = userdate($sess->sessdate, get_string('strftimedmyhm', 'attendance'));
$text .= ' '; $text .= ' ';
$text .= $sess->groupid ? $reportdata->groups[$sess->groupid]->name : get_string('commonsession', 'attendance'); if (!empty($sess->groupid) && empty($reportdata->groups[$sess->groupid])) {
$text .= get_string('deletedgroup', 'attendance');
} else {
$text .= $sess->groupid ? $reportdata->groups[$sess->groupid]->name : get_string('commonsession', 'attendance');
}
$data->tabhead[] = $text; $data->tabhead[] = $text;
if (isset($formdata->includeremarks)) { if (isset($formdata->includeremarks)) {
$data->tabhead[] = ''; // Space for the remarks. $data->tabhead[] = ''; // Space for the remarks.

7
renderer.php

@ -867,7 +867,12 @@ class mod_attendance_renderer extends plugin_renderer_base {
} }
$sesstext .= html_writer::empty_tag('br'); $sesstext .= html_writer::empty_tag('br');
if ($sess->groupid) { if ($sess->groupid) {
$sesstext .= get_string('group') . ': ' . $reportdata->groups[$sess->groupid]->name; if (empty($reportdata->groups[$sess->groupid])) {
$sesstext .= get_string('deletedgroup', 'attendance');
} else {
$sesstext .= get_string('group') . ': ' . $reportdata->groups[$sess->groupid]->name;
}
} else { } else {
$sesstext .= get_string('commonsession', 'attendance'); $sesstext .= get_string('commonsession', 'attendance');
} }

Loading…
Cancel
Save