Browse Source

Hide option to automark if standard log store disabled.

MOODLE_34_STABLE
Dan Marsden 7 years ago
parent
commit
db93178214
  1. 5
      add_form.php
  2. 15
      locallib.php
  3. 5
      settings.php
  4. 5
      update_form.php

5
add_form.php

@ -186,10 +186,7 @@ class mod_attendance_add_form extends moodleform {
$mform->addElement('checkbox', 'studentscanmark', '', get_string('studentscanmark', 'attendance'));
$mform->addHelpButton('studentscanmark', 'studentscanmark', 'attendance');
$options = array(
ATTENDANCE_AUTOMARK_DISABLED => get_string('noautomark', 'attendance'),
ATTENDANCE_AUTOMARK_ALL => get_string('automarkall', 'attendance'),
ATTENDANCE_AUTOMARK_CLOSE => get_string('automarkclose', 'attendance'));
$options = attendance_get_automarkoptions();
$mform->addElement('select', 'automark', get_string('automark', 'attendance'), $options);
$mform->setType('automark', PARAM_INT);

15
locallib.php

@ -869,4 +869,19 @@ function attendance_session_get_highest_status(mod_attendance_structure $att, $a
return false;
}
return $highestavailablestatus->id;
}
/**
* Get available automark options.
*
* @return array
*/
function attendance_get_automarkoptions() {
$options = array();
$options[ATTENDANCE_AUTOMARK_DISABLED] = get_string('noautomark', 'attendance');
if (strpos(get_config('tool_log', 'enabled_stores'), 'logstore_standard') !== false) {
$options[ATTENDANCE_AUTOMARK_ALL] = get_string('automarkall', 'attendance');
}
$options[ATTENDANCE_AUTOMARK_CLOSE] = get_string('automarkclose', 'attendance');
return $options;
}

5
settings.php

@ -107,10 +107,7 @@ if ($ADMIN->fulltree) {
$settings->add(new admin_setting_configcheckbox('attendance/studentscanmark_default',
get_string('studentscanmark', 'attendance'), '', 0));
$options = array(
ATTENDANCE_AUTOMARK_DISABLED => get_string('noautomark', 'attendance'),
ATTENDANCE_AUTOMARK_ALL => get_string('automarkall', 'attendance'),
ATTENDANCE_AUTOMARK_CLOSE => get_string('automarkclose', 'attendance'));
$options = attendance_get_automarkoptions();
$settings->add(new admin_setting_configselect('attendance/automark_default',
get_string('automark', 'attendance'), '', 0, $options));

5
update_form.php

@ -112,10 +112,7 @@ class mod_attendance_update_form extends moodleform {
$mform->addElement('checkbox', 'studentscanmark', '', get_string('studentscanmark', 'attendance'));
$mform->addHelpButton('studentscanmark', 'studentscanmark', 'attendance');
$options2 = array(
ATTENDANCE_AUTOMARK_DISABLED => get_string('noautomark', 'attendance'),
ATTENDANCE_AUTOMARK_ALL => get_string('automarkall', 'attendance'),
ATTENDANCE_AUTOMARK_CLOSE => get_string('automarkclose', 'attendance'));
$options2 = attendance_get_automarkoptions();
$mform->addElement('select', 'automark', get_string('automark', 'attendance'), $options2);
$mform->setType('automark', PARAM_INT);

Loading…
Cancel
Save