Removed usaged of deprecated functions (#423)

This commit is contained in:
Mark Nelson 2021-05-27 21:37:50 +08:00
parent 1a6d370d3f
commit 0208efa585
4 changed files with 32 additions and 22 deletions

View file

@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
Note - All hash comments refer to the issue number. Eg. #169 refers to https://github.com/mdjnelson/moodle-mod_customcert/issues/169.
## [3.11.1] - 2021-XX-YY
### Fixed
- Usage of deprecated functions (#423)
## [3.10.1] - 2021-XX-YY
### Added

View file

@ -270,8 +270,11 @@ class certificate {
$allparams = $conditionsparams + array('customcertid' => $customcertid);
// Return the issues.
$extrafields = get_extra_user_fields(\context_module::instance($cm->id));
$ufields = \user_picture::fields('u', $extrafields);
$context = \context_module::instance($cm->id);
$extrafields = \core_user\fields::for_identity($context)->get_required_fields();
$ufields = \core_user\fields::for_userpic()->including(...$extrafields);
$ufields = $ufields->get_sql('u', false, '','', false)->selects;
$sql = "SELECT $ufields, ci.id as issueid, ci.code, ci.timecreated
FROM {user} u
INNER JOIN {customcert_issues} ci

View file

@ -66,7 +66,7 @@ class report_table extends \table_sql {
parent::__construct('mod_customcert_report_table');
$context = \context_module::instance($cm->id);
$extrafields = get_extra_user_fields($context);
$extrafields = \core_user\fields::for_identity($context)->get_required_fields();
$columns = [];
$columns[] = 'fullname';
@ -79,7 +79,7 @@ class report_table extends \table_sql {
$headers = [];
$headers[] = get_string('fullname');
foreach ($extrafields as $extrafield) {
$headers[] = get_user_field_name($extrafield);
$headers[] = \core_user\fields::get_display_name($extrafield);
}
$headers[] = get_string('receiveddate', 'customcert');
$headers[] = get_string('code', 'customcert');

View file

@ -24,6 +24,8 @@
namespace customcertelement_userfield;
use core_user\fields;
defined('MOODLE_INTERNAL') || die();
/**
@ -43,24 +45,24 @@ class element extends \mod_customcert\element {
public function render_form_elements($mform) {
// Get the user profile fields.
$userfields = array(
'firstname' => get_user_field_name('firstname'),
'lastname' => get_user_field_name('lastname'),
'username' => get_user_field_name('username'),
'email' => get_user_field_name('email'),
'city' => get_user_field_name('city'),
'country' => get_user_field_name('country'),
'url' => get_user_field_name('url'),
'icq' => get_user_field_name('icq'),
'skype' => get_user_field_name('skype'),
'aim' => get_user_field_name('aim'),
'yahoo' => get_user_field_name('yahoo'),
'msn' => get_user_field_name('msn'),
'idnumber' => get_user_field_name('idnumber'),
'institution' => get_user_field_name('institution'),
'department' => get_user_field_name('department'),
'phone1' => get_user_field_name('phone1'),
'phone2' => get_user_field_name('phone2'),
'address' => get_user_field_name('address')
'firstname' => fields::get_display_name('firstname'),
'lastname' => fields::get_display_name('lastname'),
'username' => fields::get_display_name('username'),
'email' => fields::get_display_name('email'),
'city' => fields::get_display_name('city'),
'country' => fields::get_display_name('country'),
'url' => fields::get_display_name('url'),
'icq' => fields::get_display_name('icq'),
'skype' => fields::get_display_name('skype'),
'aim' => fields::get_display_name('aim'),
'yahoo' => fields::get_display_name('yahoo'),
'msn' => fields::get_display_name('msn'),
'idnumber' => fields::get_display_name('idnumber'),
'institution' => fields::get_display_name('institution'),
'department' => fields::get_display_name('department'),
'phone1' => fields::get_display_name('phone1'),
'phone2' => fields::get_display_name('phone2'),
'address' => fields::get_display_name('address')
);
// Get the user custom fields.
$arrcustomfields = \availability_profile\condition::get_custom_profile_fields();