From 30f26ee34dfc53d958d76d8a63444b75eba1a0c7 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Thu, 3 Sep 2020 15:01:55 +1200 Subject: [PATCH] Allow id number to be enabled/disabled in export form. --- export_form.php | 7 ++++--- settings.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/export_form.php b/export_form.php index 3f2928d..51bdb7b 100644 --- a/export_form.php +++ b/export_form.php @@ -104,10 +104,11 @@ class mod_attendance_export_form extends moodleform { $ident = array(); $checkedfields = array(); - $ident[] =& $mform->createElement('checkbox', 'id', '', get_string('studentid', 'attendance')); - $checkedfields['ident[id]'] = true; - $adminsetfields = get_config('attendance', 'customexportfields'); + if (in_array('id', explode(',', $adminsetfields))) { + $ident[] =& $mform->createElement('checkbox', 'id', '', get_string('studentid', 'attendance')); + $checkedfields['ident[id]'] = true; + } $extrafields = get_extra_user_fields($modcontext); foreach ($extrafields as $field) { diff --git a/settings.php b/settings.php index 433448e..5b7b52c 100644 --- a/settings.php +++ b/settings.php @@ -106,7 +106,7 @@ if ($ADMIN->fulltree) { get_string('enablewarnings', 'attendance'), get_string('enablewarnings_desc', 'attendance'), 0)); - $fields = array(); + $fields = array('id' => get_string('studentid', 'attendance')); $customfields = profile_get_custom_fields(); foreach ($customfields as $field) { $fields[$field->shortname] = $field->name;