Browse Source

Modify John's patch slightly - move some things around.

nwp90-nwp90-allsessionsreport
Dan Marsden 4 years ago
parent
commit
c598e0139b
  1. 10
      export_form.php
  2. 9
      lang/en/attendance.php
  3. 32
      settings.php

10
export_form.php

@ -103,11 +103,11 @@ class mod_attendance_export_form extends moodleform {
$ident = array();
$checkedfields = array();
$adminsetfields = get_config('attendance', 'defaultexportfields');
if (in_array('id', explode(',', $adminsetfields))) {
$ident[] =& $mform->createElement('checkbox', 'id', '', get_string('studentid', 'attendance'));
$checkedfields['ident[id]'] = true;
}
$ident[] =& $mform->createElement('checkbox', 'id', '', get_string('studentid', 'attendance'));
$checkedfields['ident[id]'] = true;
$adminsetfields = get_config('attendance', 'customexportfields');
$extrafields = get_extra_user_fields($modcontext);
foreach ($extrafields as $field) {

9
lang/en/attendance.php

@ -131,6 +131,8 @@ The sessions begin on the date of the base session and continue until the \'repe
$string['createonesession'] = 'Create one session for the course';
$string['csvdelimiter'] = 'CSV delimiter';
$string['currentlyselectedusers'] = 'Currently selected users';
$string['customexportfields'] = 'Export custom user profile fields';
$string['customexportfields_help'] = 'Extra custom user profile fields to expose in the export report.';
$string['date'] = 'Date';
$string['days'] = 'Days';
$string['defaultdisplaymode'] = 'Default display mode';
@ -614,9 +616,4 @@ $string['warningthreshold'] = 'Warning threshold';
$string['warningupdated'] = 'Updated warnings';
$string['week'] = 'week(s)';
$string['weeks'] = 'Weeks';
$string['youcantdo'] = 'You can\'t do anything';
$string['defaultexportsettings'] = 'Default export settings';
$string['defaultexportsettings_help'] = 'These settings define the defaults for sessions export';
$string['defaultexportfields'] = 'Default export fields';
$string['defaultexportfields_help'] = 'Fields that can be used to identify student in export report (If you are seeing less options than expected, please check show user identity in User policies).';
$string['youcantdo'] = 'You can\'t do anything';

32
settings.php

@ -27,6 +27,7 @@ defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
require_once(dirname(__FILE__).'/lib.php');
require_once(dirname(__FILE__).'/locallib.php');
require_once($CFG->dirroot . '/user/profile/lib.php');
$tabmenu = attendance_print_settings_tabs();
@ -105,6 +106,18 @@ if ($ADMIN->fulltree) {
get_string('enablewarnings', 'attendance'),
get_string('enablewarnings_desc', 'attendance'), 0));
$fields = array();
$customfields = profile_get_custom_fields();
foreach ($customfields as $field) {
$fields[$field->shortname] = $field->name;
}
$settings->add(new admin_setting_configmultiselect('attendance/customexportfields',
new lang_string('customexportfields', 'attendance'),
new lang_string('customexportfields_help', 'attendance'),
array('id'), $fields)
);
$name = new lang_string('mobilesettings', 'mod_attendance');
$description = new lang_string('mobilesettings_help', 'mod_attendance');
$settings->add(new admin_setting_heading('mobilesettings', $name, $description));
@ -191,23 +204,4 @@ if ($ADMIN->fulltree) {
$settings->add(new admin_setting_configtextarea('attendance/emailcontent',
get_string('emailcontent', 'attendance'), get_string('emailcontent_help', 'attendance'),
get_string('emailcontent_default', 'attendance'), PARAM_RAW));
$name = new lang_string('defaultexportsettings', 'mod_attendance');
$description = new lang_string('defaultexportsettings_help', 'mod_attendance');
$settings->add(new admin_setting_heading('defaultexportsettings', $name, $description));
$fields = array('id' => get_string('studentid', 'attendance'));
require_once($CFG->dirroot . '/user/profile/lib.php');
$customfields = profile_get_custom_fields();
foreach ($customfields as $field) {
$fields[$field->shortname] = $field->name;
}
$settings->add(new admin_setting_configmultiselect('attendance/defaultexportfields',
new lang_string('defaultexportfields', 'attendance'),
new lang_string('defaultexportfields_help', 'attendance'),
array('id'), $fields)
);
}

Loading…
Cancel
Save