|
@ -703,6 +703,7 @@ class mod_attendance_renderer extends plugin_renderer_base { |
|
|
* @return string |
|
|
* @return string |
|
|
*/ |
|
|
*/ |
|
|
protected function render_attendance_take_grid(attendance_take_data $takedata) { |
|
|
protected function render_attendance_take_grid(attendance_take_data $takedata) { |
|
|
|
|
|
global $PAGE; |
|
|
$table = new html_table(); |
|
|
$table = new html_table(); |
|
|
for ($i = 0; $i < $takedata->pageparams->gridcols; $i++) { |
|
|
for ($i = 0; $i < $takedata->pageparams->gridcols; $i++) { |
|
|
$table->align[] = 'center'; |
|
|
$table->align[] = 'center'; |
|
@ -712,8 +713,16 @@ class mod_attendance_renderer extends plugin_renderer_base { |
|
|
$table->headspan = $takedata->pageparams->gridcols; |
|
|
$table->headspan = $takedata->pageparams->gridcols; |
|
|
$head = array(); |
|
|
$head = array(); |
|
|
foreach ($takedata->statuses as $st) { |
|
|
foreach ($takedata->statuses as $st) { |
|
|
$head[] = html_writer::link("javascript:select_all_in(null, 'st" . $st->id . "', null);", $st->acronym, |
|
|
$head[] = html_writer::link("#", $st->acronym, array('id' => 'checkstatus'.$st->id, |
|
|
array('title' => get_string('setallstatusesto', 'attendance', $st->description))); |
|
|
'title' => get_string('setallstatusesto', 'attendance', $st->description))); |
|
|
|
|
|
// JS to select all radios of this status and prevent default behaviour of # link. |
|
|
|
|
|
$PAGE->requires->js_amd_inline(" |
|
|
|
|
|
require(['jquery'], function($) { |
|
|
|
|
|
$('#checkstatus".$st->id."').click(function(e) { |
|
|
|
|
|
$('#attendancetakeform').find('.st".$st->id."').prop('checked', true); |
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
}); |
|
|
|
|
|
});"); |
|
|
} |
|
|
} |
|
|
$table->head[] = implode(' ', $head); |
|
|
$table->head[] = implode(' ', $head); |
|
|
|
|
|
|
|
|