Browse Source

Fixes #258 add link to take attendance on student overview report.

MOODLE_32_STABLE
Dan Marsden 8 years ago
parent
commit
c668a63213
  1. 15
      renderer.php

15
renderer.php

@ -919,6 +919,9 @@ class mod_attendance_renderer extends plugin_renderer_base {
* @return string * @return string
*/ */
private function construct_user_sessions_log(attendance_user_data $userdata) { 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 = new html_table();
$table->attributes['class'] = 'generaltable attwidth boxaligncenter'; $table->attributes['class'] = 'generaltable attwidth boxaligncenter';
$table->head = array( $table->head = array(
@ -933,6 +936,9 @@ 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->size = array('1px', '1px', '1px', '1px', '*', '*', '1px', '*'); $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); $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; $table->data[] = $row;
} }

Loading…
Cancel
Save