Browse Source

Hide option to automark if standard log store disabled.

MOODLE_33_STABLE
Dan Marsden 7 years ago
parent
commit
6d53ae24a6
  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->addElement('checkbox', 'studentscanmark', '', get_string('studentscanmark', 'attendance'));
$mform->addHelpButton('studentscanmark', 'studentscanmark', 'attendance'); $mform->addHelpButton('studentscanmark', 'studentscanmark', 'attendance');
$options = array( $options = attendance_get_automarkoptions();
ATTENDANCE_AUTOMARK_DISABLED => get_string('noautomark', 'attendance'),
ATTENDANCE_AUTOMARK_ALL => get_string('automarkall', 'attendance'),
ATTENDANCE_AUTOMARK_CLOSE => get_string('automarkclose', 'attendance'));
$mform->addElement('select', 'automark', get_string('automark', 'attendance'), $options); $mform->addElement('select', 'automark', get_string('automark', 'attendance'), $options);
$mform->setType('automark', PARAM_INT); $mform->setType('automark', PARAM_INT);

15
locallib.php

@ -870,3 +870,18 @@ function attendance_session_get_highest_status(mod_attendance_structure $att, $a
} }
return $highestavailablestatus->id; 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', $settings->add(new admin_setting_configcheckbox('attendance/studentscanmark_default',
get_string('studentscanmark', 'attendance'), '', 0)); get_string('studentscanmark', 'attendance'), '', 0));
$options = array( $options = attendance_get_automarkoptions();
ATTENDANCE_AUTOMARK_DISABLED => get_string('noautomark', 'attendance'),
ATTENDANCE_AUTOMARK_ALL => get_string('automarkall', 'attendance'),
ATTENDANCE_AUTOMARK_CLOSE => get_string('automarkclose', 'attendance'));
$settings->add(new admin_setting_configselect('attendance/automark_default', $settings->add(new admin_setting_configselect('attendance/automark_default',
get_string('automark', 'attendance'), '', 0, $options)); 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->addElement('checkbox', 'studentscanmark', '', get_string('studentscanmark', 'attendance'));
$mform->addHelpButton('studentscanmark', 'studentscanmark', 'attendance'); $mform->addHelpButton('studentscanmark', 'studentscanmark', 'attendance');
$options2 = array( $options2 = attendance_get_automarkoptions();
ATTENDANCE_AUTOMARK_DISABLED => get_string('noautomark', 'attendance'),
ATTENDANCE_AUTOMARK_ALL => get_string('automarkall', 'attendance'),
ATTENDANCE_AUTOMARK_CLOSE => get_string('automarkclose', 'attendance'));
$mform->addElement('select', 'automark', get_string('automark', 'attendance'), $options2); $mform->addElement('select', 'automark', get_string('automark', 'attendance'), $options2);
$mform->setType('automark', PARAM_INT); $mform->setType('automark', PARAM_INT);

Loading…
Cancel
Save