From c668a63213c069c5c84e681e6dd8b8dfbf9fbea8 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Tue, 2 May 2017 14:56:32 +1200 Subject: [PATCH] Fixes #258 add link to take attendance on student overview report. --- renderer.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/renderer.php b/renderer.php index d1539ed..7e77b61 100644 --- a/renderer.php +++ b/renderer.php @@ -919,6 +919,9 @@ class mod_attendance_renderer extends plugin_renderer_base { * @return string */ private function construct_user_sessions_log(attendance_user_data $userdata) { + global $OUTPUT; + $context = context_module::instance($userdata->filtercontrols->cm->id); + $table = new html_table(); $table->attributes['class'] = 'generaltable attwidth boxaligncenter'; $table->head = array( @@ -933,6 +936,9 @@ class mod_attendance_renderer extends plugin_renderer_base { ); $table->align = array('', '', '', 'left', 'left', 'center', 'center', 'center'); $table->size = array('1px', '1px', '1px', '1px', '*', '*', '1px', '*'); + if (has_capability('mod/attendance:takeattendances', $context)) { + $table->head[] = get_string('action'); + } $statussetmaxpoints = attendance_get_statusset_maxpoints($userdata->statuses); @@ -985,6 +991,15 @@ class mod_attendance_renderer extends plugin_renderer_base { } } + if (has_capability('mod/attendance:takeattendances', $context)) { + $params = array('id' => $userdata->filtercontrols->cm->id, + 'sessionid' => $sess->id, + 'grouptype' => $sess->groupid); + $url = new moodle_url('/mod/attendance/take.php', $params); + $icon = $OUTPUT->pix_icon('redo', get_string('changeattendance', 'attendance'), 'attendance'); + $row->cells[] = html_writer::link($url, $icon); + } + $table->data[] = $row; }