Browse Source

Support multi-lang in user profile fields.

nwp90-nwp90-allsessionsreport
Dan Marsden 4 years ago
parent
commit
efa2388df9
  1. 4
      export.php
  2. 2
      settings.php

4
export.php

@ -105,7 +105,7 @@ if ($formdata = $mform->get_data()) {
} else if (in_array($opt, array_column($customfields, 'shortname'))) { } else if (in_array($opt, array_column($customfields, 'shortname'))) {
foreach ($customfields as $customfield) { foreach ($customfields as $customfield) {
if ($opt == $customfield->shortname) { if ($opt == $customfield->shortname) {
$data->tabhead[] = $customfield->name; $data->tabhead[] = format_string($customfield->name, true, array('context' => $context));
} }
} }
} else { } else {
@ -169,7 +169,7 @@ if ($formdata = $mform->get_data()) {
foreach (array_keys($formdata->ident) as $opt) { foreach (array_keys($formdata->ident) as $opt) {
if (in_array($opt, array_column($customfields, 'shortname'))) { if (in_array($opt, array_column($customfields, 'shortname'))) {
if (isset($user->profile[$opt])) { if (isset($user->profile[$opt])) {
$data->table[$i][] = $user->profile[$opt]; $data->table[$i][] = format_string($user->profile[$opt], true, array('context' => $context));
} else { } else {
$data->table[$i][] = ''; $data->table[$i][] = '';
} }

2
settings.php

@ -109,7 +109,7 @@ if ($ADMIN->fulltree) {
$fields = array('id' => get_string('studentid', 'attendance')); $fields = array('id' => get_string('studentid', 'attendance'));
$customfields = profile_get_custom_fields(); $customfields = profile_get_custom_fields();
foreach ($customfields as $field) { foreach ($customfields as $field) {
$fields[$field->shortname] = $field->name; $fields[$field->shortname] = format_string($field->name);
} }
$settings->add(new admin_setting_configmultiselect('attendance/customexportfields', $settings->add(new admin_setting_configmultiselect('attendance/customexportfields',

Loading…
Cancel
Save