From 72db494ea8ce915d1093cc4ba148ce0b1c9e81db Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Thu, 22 Mar 2018 20:27:32 +1300 Subject: [PATCH] add setting to allow sessiont description to show in report. --- lang/en/attendance.php | 2 ++ renderer.php | 19 ++++++++++++++----- settings.php | 4 ++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/lang/en/attendance.php b/lang/en/attendance.php index 4cc1330..5a6d625 100644 --- a/lang/en/attendance.php +++ b/lang/en/attendance.php @@ -422,6 +422,8 @@ $string['showdefaults'] = 'Show defaults'; $string['showduration'] = 'Show duration'; $string['showextrauserdetails'] = 'Show extra user details'; $string['showsessiondetails'] = 'Show session details'; +$string['showsessiondescriptiononreport'] = 'Show session description in report'; +$string['showsessiondescriptiononreport_desc'] = 'Show the session description in the attendance report listing.'; $string['somedisabledstatus'] = '(Some options have been removed as the session has started.)'; $string['sortedgrid'] = 'Sorted grid'; $string['sortedlist'] = 'Sorted list'; diff --git a/renderer.php b/renderer.php index 2a98624..5721c38 100644 --- a/renderer.php +++ b/renderer.php @@ -1505,18 +1505,27 @@ class mod_attendance_renderer extends plugin_renderer_base { 'mod/attendance:changeattendances' ); if (is_null($sess->lasttaken) and has_any_capability($capabilities, $reportdata->att->context)) { - $sesstext = html_writer::link($reportdata->url_take($sess->id, $sess->groupid), $sesstext); + $sesstext = html_writer::link($reportdata->url_take($sess->id, $sess->groupid), $sesstext, + array('class' => 'attendancereporttakelink')); + } + $sesstext .= html_writer::empty_tag('br', array('class' => 'attendancereportseparator')); + if (!empty($sess->description) && + !empty(get_config('attendance', 'showsessiondescriptiononreport'))) { + $sesstext .= html_writer::tag('small', format_text($sess->description), + array('class' => 'attendancereportcommon')); } - $sesstext .= html_writer::empty_tag('br'); if ($sess->groupid) { if (empty($reportdata->groups[$sess->groupid])) { - $sesstext .= html_writer::tag('small', get_string('deletedgroup', 'attendance')); + $sesstext .= html_writer::tag('small', get_string('deletedgroup', 'attendance'), + array('class' => 'attendancereportgroup')); } else { - $sesstext .= html_writer::tag('small', $reportdata->groups[$sess->groupid]->name); + $sesstext .= html_writer::tag('small', $reportdata->groups[$sess->groupid]->name, + array('class' => 'attendancereportgroup')); } } else { - $sesstext .= html_writer::tag('small', get_string('commonsession', 'attendance')); + $sesstext .= html_writer::tag('small', get_string('commonsession', 'attendance'), + array('class' => 'attendancereportcommon')); } $row->cells[] = $this->build_header_cell($sesstext, false, true, null, null, false); diff --git a/settings.php b/settings.php index 1c6a14e..dd3d102 100644 --- a/settings.php +++ b/settings.php @@ -78,6 +78,10 @@ if ($ADMIN->fulltree) { get_string('multisessionexpanded', 'attendance'), get_string('multisessionexpanded_desc', 'attendance'), 0)); + $settings->add(new admin_setting_configcheckbox('attendance/showsessiondescriptiononreport', + get_string('showsessiondescriptiononreport', 'attendance'), + get_string('showsessiondescriptiononreport_desc', 'attendance'), 0)); + $settings->add(new admin_setting_configcheckbox('attendance/studentrecordingexpanded', get_string('studentrecordingexpanded', 'attendance'), get_string('studentrecordingexpanded_desc', 'attendance'), 1));