Browse Source

Replace deprecated function calls.

40-behatfixes
Dan Marsden 4 years ago
parent
commit
44c213bd07
  1. 4
      classes/form/export.php
  2. 3
      classes/form/tempmerge.php
  3. 2
      classes/structure.php
  4. 8
      locallib.php
  5. 4
      messageselect.php

4
classes/form/export.php

@ -60,7 +60,9 @@ class export extends \moodleform {
}
// Restrict the export to the selected users.
$namefields = get_all_user_name_fields(true, 'u');
$userfieldsapi = \core_user\fields::for_name();
$namefields = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
$allusers = get_enrolled_users($modcontext, 'mod/attendance:canbelisted', 0, 'u.id,'.$namefields);
$userlist = array();
foreach ($allusers as $user) {

3
classes/form/tempmerge.php

@ -43,7 +43,8 @@ class tempmerge extends \moodleform {
global $COURSE;
$context = \context_course::instance($COURSE->id);
$namefields = get_all_user_name_fields(true, 'u');
$userfieldsapi = \core_user\fields::for_name();
$namefields = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
$students = get_enrolled_users($context, 'mod/attendance:canbelisted', 0, 'u.id,'.$namefields.',u.email',
'u.lastname, u.firstname', 0, 0, true);
$partarray = array();

2
classes/structure.php

@ -909,7 +909,7 @@ class mod_attendance_structure {
'picture' => 0,
'type' => 'temporary',
);
$allfields = get_all_user_name_fields();
$allfields = \core_user\fields::get_name_fields();
if (!empty($CFG->showuseridentity)) {
$allfields = array_merge($allfields, explode(',', $CFG->showuseridentity));
}

8
locallib.php

@ -1010,9 +1010,9 @@ function attendance_get_users_to_notify($courseids = array(), $orderby = '', $al
// Exclude warnings that have already sent the max num.
$having .= ' AND n.maxwarn > COUNT(DISTINCT ns.id) ';
}
$unames = get_all_user_name_fields(true).',';
$unames2 = get_all_user_name_fields(true, 'u').',';
$userfieldsapi = \core_user\fields::for_name();
$unames = $userfieldsapi->get_sql('', false, '', '', false)->selects.',';
$unames2 = $userfieldsapi->get_sql('u', false, '', '', false)->selects.',';
if (!empty($CFG->showuseridentity)) {
$extrafields = explode(',', $CFG->showuseridentity);
@ -1089,7 +1089,7 @@ function attendance_template_variables($record) {
'/%maxpoints%/' => $record->maxpoints,
'/%percent%/' => $record->percent,
);
$extrauserfields = get_all_user_name_fields();
$extrauserfields = \core_user\fields::get_name_fields();
foreach ($extrauserfields as $extra) {
$templatevars['/%'.$extra.'%/'] = $record->$extra;
}

4
messageselect.php

@ -80,7 +80,9 @@ $messagebody = $SESSION->emailselect[$id]['messagebody'];
$count = 0;
if ($data = data_submitted()) {
require_sesskey();
$namefields = get_all_user_name_fields(true);
$userfieldsapi = \core_user\fields::for_name();
$namefields = $userfieldsapi->get_sql('', false, '', '', false)->selects;
foreach ($data as $k => $v) {
if (preg_match('/^(user|teacher)(\d+)$/', $k, $m)) {
if (!array_key_exists($m[2], $SESSION->emailto[$id])) {

Loading…
Cancel
Save