|
@ -599,23 +599,23 @@ class mod_attendance_renderer extends plugin_renderer_base { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Render statusdropdown |
|
|
* get statusdropdown |
|
|
* |
|
|
* |
|
|
* @param string $preference |
|
|
* @return \single_select |
|
|
* @return string |
|
|
|
|
|
*/ |
|
|
*/ |
|
|
private function render_statusdropdown($preference) { |
|
|
private function statusdropdown() { |
|
|
if ($preference == 'unselected') { |
|
|
$pref = get_user_preferences('mod_attendance_statusdropdown'); |
|
|
return " <select id='setallstatus-select'> |
|
|
if (empty($pref)) { |
|
|
<option value='all'>".get_string('statusall', 'attendance')."</option> |
|
|
$pref = 'unselected'; |
|
|
<option selected value='unselected'>".get_string('statusunselected', 'attendance')."</option> |
|
|
|
|
|
</select>"; |
|
|
|
|
|
} else { |
|
|
|
|
|
return " <select id='setallstatus-select'> |
|
|
|
|
|
<option selected value='all'>".get_string('statusall', 'attendance')."</option> |
|
|
|
|
|
<option value='unselected'>".get_string('statusunselected', 'attendance')."</option> |
|
|
|
|
|
</select>"; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
$options = array('all' => get_string('statusall', 'attendance'), |
|
|
|
|
|
'unselected' => get_string('statusunselected', 'attendance')); |
|
|
|
|
|
|
|
|
|
|
|
$select = new \single_select(new \moodle_url('/'), 'setallstatus-select', $options, |
|
|
|
|
|
$pref, null, 'setallstatus-select'); |
|
|
|
|
|
$select->label = get_string('setallstatuses', 'attendance'); |
|
|
|
|
|
|
|
|
|
|
|
return $select; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -653,7 +653,14 @@ class mod_attendance_renderer extends plugin_renderer_base { |
|
|
$PAGE->requires->js_amd_inline(" |
|
|
$PAGE->requires->js_amd_inline(" |
|
|
require(['jquery'], function($) { |
|
|
require(['jquery'], function($) { |
|
|
$('#checkstatus".$st->id."').click(function(e) { |
|
|
$('#checkstatus".$st->id."').click(function(e) { |
|
|
|
|
|
if ($('select[name=\"setallstatus-select\"] option:selected').val() == 'all') { |
|
|
$('#attendancetakeform').find('.st".$st->id."').prop('checked', true); |
|
|
$('#attendancetakeform').find('.st".$st->id."').prop('checked', true); |
|
|
|
|
|
M.util.set_user_preference('mod_attendance_statusdropdown','all'); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
$('#attendancetakeform').find('input:indeterminate.st".$st->id."').prop('checked', true); |
|
|
|
|
|
M.util.set_user_preference('mod_attendance_statusdropdown','unselected'); |
|
|
|
|
|
} |
|
|
e.preventDefault(); |
|
|
e.preventDefault(); |
|
|
}); |
|
|
}); |
|
|
});"); |
|
|
});"); |
|
@ -672,9 +679,7 @@ class mod_attendance_renderer extends plugin_renderer_base { |
|
|
$row->cells[] = ''; |
|
|
$row->cells[] = ''; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$selectmenu = $this->render_statusdropdown(get_user_preferences('mod_attendance_statusdropdown')); |
|
|
$cell = new html_table_cell(html_writer::div($this->output->render($this->statusdropdown()), 'setallstatuses')); |
|
|
$cell = new html_table_cell(html_writer::div(get_string('setallstatuses', 'attendance'). |
|
|
|
|
|
$selectmenu, 'setallstatuses')); |
|
|
|
|
|
$cell->colspan = 2; |
|
|
$cell->colspan = 2; |
|
|
$row->cells[] = $cell; |
|
|
$row->cells[] = $cell; |
|
|
foreach ($takedata->statuses as $st) { |
|
|
foreach ($takedata->statuses as $st) { |
|
@ -690,7 +695,7 @@ class mod_attendance_renderer extends plugin_renderer_base { |
|
|
$PAGE->requires->js_amd_inline(" |
|
|
$PAGE->requires->js_amd_inline(" |
|
|
require(['jquery'], function($) { |
|
|
require(['jquery'], function($) { |
|
|
$('#radiocheckstatus".$st->id."').click(function(e) { |
|
|
$('#radiocheckstatus".$st->id."').click(function(e) { |
|
|
if ($('#setallstatus-select').val() == 'all') { |
|
|
if ($('select[name=\"setallstatus-select\"] option:selected').val() == 'all') { |
|
|
$('#attendancetakeform').find('.st".$st->id."').prop('checked', true); |
|
|
$('#attendancetakeform').find('.st".$st->id."').prop('checked', true); |
|
|
M.util.set_user_preference('mod_attendance_statusdropdown','all'); |
|
|
M.util.set_user_preference('mod_attendance_statusdropdown','all'); |
|
|
} |
|
|
} |
|
@ -756,11 +761,8 @@ class mod_attendance_renderer extends plugin_renderer_base { |
|
|
$table->attributes['class'] = 'generaltable takegrid'; |
|
|
$table->attributes['class'] = 'generaltable takegrid'; |
|
|
$table->headspan = $takedata->pageparams->gridcols; |
|
|
$table->headspan = $takedata->pageparams->gridcols; |
|
|
|
|
|
|
|
|
$selectmenu = $this->render_statusdropdown(get_user_preferences('mod_attendance_statusdropdown')); |
|
|
|
|
|
|
|
|
|
|
|
$head = array(); |
|
|
$head = array(); |
|
|
$head[] = html_writer::div(get_string('setallstatuses', 'attendance'). |
|
|
$head[] = html_writer::div($this->output->render($this->statusdropdown()), 'setallstatuses'); |
|
|
$selectmenu, 'setallstatuses'); |
|
|
|
|
|
foreach ($takedata->statuses as $st) { |
|
|
foreach ($takedata->statuses as $st) { |
|
|
$head[] = html_writer::link("#", $st->acronym, array('id' => 'checkstatus'.$st->id, |
|
|
$head[] = html_writer::link("#", $st->acronym, array('id' => 'checkstatus'.$st->id, |
|
|
'title' => get_string('setallstatusesto', 'attendance', $st->description))); |
|
|
'title' => get_string('setallstatusesto', 'attendance', $st->description))); |
|
@ -768,7 +770,7 @@ class mod_attendance_renderer extends plugin_renderer_base { |
|
|
$PAGE->requires->js_amd_inline(" |
|
|
$PAGE->requires->js_amd_inline(" |
|
|
require(['jquery'], function($) { |
|
|
require(['jquery'], function($) { |
|
|
$('#checkstatus".$st->id."').click(function(e) { |
|
|
$('#checkstatus".$st->id."').click(function(e) { |
|
|
if ($('#setallstatus-select').val() == 'unselected') { |
|
|
if ($('select[name=\"setallstatus-select\"] option:selected').val() == 'unselected') { |
|
|
$('#attendancetakeform').find('input:indeterminate.st".$st->id."').prop('checked', true); |
|
|
$('#attendancetakeform').find('input:indeterminate.st".$st->id."').prop('checked', true); |
|
|
M.util.set_user_preference('mod_attendance_statusdropdown','unselected'); |
|
|
M.util.set_user_preference('mod_attendance_statusdropdown','unselected'); |
|
|
} |
|
|
} |
|
|