Browse Source

Convert to using new user field apis

40-behatfixes
Dan Marsden 4 years ago
parent
commit
c32a53a592
  1. 2
      classes/form/export.php
  2. 7
      classes/structure.php
  3. 2
      renderer.php

2
classes/form/export.php

@ -111,7 +111,7 @@ class export extends \moodleform {
$checkedfields['ident[id]'] = true;
}
$extrafields = get_extra_user_fields($modcontext);
$extrafields = \core_user\fields::for_identity($modcontext)->get_required_fields();
foreach ($extrafields as $field) {
$ident[] =& $mform->createElement('checkbox', $field, '', get_string( $field));
$mform->setType($field, PARAM_NOTAGS);

7
classes/structure.php

@ -802,11 +802,8 @@ class mod_attendance_structure {
global $DB;
$fields = array('username' , 'idnumber' , 'institution' , 'department', 'city', 'country');
// Get user identity fields if required - doesn't return original $fields array.
$extrafields = get_extra_user_fields($this->context, $fields);
$fields = array_merge($fields, $extrafields);
$userfields = user_picture::fields('u', $fields);
$userf = \core_user\fields::for_identity($this->context)->with_userpic()->excluding(...$fields);
$userfields = $userf->get_sql('u', false, '', 'id', false)->selects;
if (empty($this->pageparams->sort)) {
$this->pageparams->sort = ATT_SORT_DEFAULT;

2
renderer.php

@ -2134,7 +2134,7 @@ class mod_attendance_renderer extends plugin_renderer_base {
$rows = array();
$bulkmessagecapability = has_capability('moodle/course:bulkmessaging', $this->page->context);
$extrafields = get_extra_user_fields($reportdata->att->context);
$extrafields = \core_user\fields::for_identity($reportdata->att->context)->get_required_fields();
$showextrauserdetails = $reportdata->pageparams->showextrauserdetails;
$params = $reportdata->pageparams->get_significant_params();
$text = get_string('users');

Loading…
Cancel
Save