mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 04:30:15 +01:00
Merge branch 'MDL-73236-M41v2' of https://github.com/sbourget/moodle
This commit is contained in:
commit
9eafcc2b41
@ -100,6 +100,10 @@ class myprofile implements renderable, templatable {
|
||||
$data->useraddress = format_string($USER->address);
|
||||
}
|
||||
|
||||
if (!empty($this->config->display_idnumber) && !empty($USER->idnumber)) {
|
||||
$data->useridnumber = s($USER->idnumber);
|
||||
}
|
||||
|
||||
if (!empty($this->config->display_firstaccess) && !empty($USER->firstaccess)) {
|
||||
$data->userfirstaccess = userdate($USER->firstaccess);
|
||||
}
|
||||
|
@ -85,6 +85,13 @@ class block_myprofile_edit_form extends block_edit_form {
|
||||
$mform->setDefault('config_display_address', '0');
|
||||
}
|
||||
|
||||
$mform->addElement('selectyesno', 'config_display_idnumber', get_string('display_idnumber', 'block_myprofile'));
|
||||
if (isset($this->block->config->display_idnumber)) {
|
||||
$mform->setDefault('config_display_idnumber', $this->block->config->display_idnumber);
|
||||
} else {
|
||||
$mform->setDefault('config_display_idnumber', '0');
|
||||
}
|
||||
|
||||
$mform->addElement('selectyesno', 'config_display_firstaccess', get_string('display_firstaccess', 'block_myprofile'));
|
||||
if (isset($this->block->config->display_firstaccess)) {
|
||||
$mform->setDefault('config_display_firstaccess', $this->block->config->display_firstaccess);
|
||||
|
@ -30,6 +30,7 @@ $string['display_city'] = 'Display city';
|
||||
$string['display_email'] = 'Display email';
|
||||
$string['display_phone1'] = 'Display phone';
|
||||
$string['display_phone2'] = 'Display mobile phone';
|
||||
$string['display_idnumber'] = 'Display ID number';
|
||||
$string['display_institution'] = 'Display institution';
|
||||
$string['display_address'] = 'Display address';
|
||||
$string['display_firstaccess'] = 'Display first access';
|
||||
|
@ -37,6 +37,7 @@
|
||||
* userphone2
|
||||
* userinstitution
|
||||
* useraddress
|
||||
* useridnumber
|
||||
* userfirstaccess
|
||||
* userlastaccess
|
||||
* usercurrentlogin
|
||||
@ -53,6 +54,7 @@
|
||||
"userphone2": "123456789",
|
||||
"userinstitution": "Institution",
|
||||
"useraddress": "Address",
|
||||
"useridnumber": "12345",
|
||||
"userfirstaccess": "Friday, 6 July 2018, 9:03 AM",
|
||||
"userlastaccess": "Wednesday, 26 September 2018, 8:05 AM",
|
||||
"usercurrentlogin": "Wednesday, 26 September 2018, 7:17 AM",
|
||||
@ -112,6 +114,12 @@
|
||||
{{ useraddress }}
|
||||
</div>
|
||||
{{/useraddress}}
|
||||
{{#useridnumber}}
|
||||
<div class="myprofileitem idnumber">
|
||||
<span>{{#str}} idnumber {{/str}}:</span>
|
||||
{{{ useridnumber }}}
|
||||
</div>
|
||||
{{/useridnumber}}
|
||||
{{#userfirstaccess}}
|
||||
<div class="myprofileitem firstaccess">
|
||||
<span>{{#str}} firstaccess {{/str}}: </span>
|
||||
|
@ -212,3 +212,22 @@ Feature: The logged in user block allows users to view their profile information
|
||||
| Display last IP | Yes |
|
||||
And I press "Save changes"
|
||||
And I should see "IP:" in the "Logged in user" "block"
|
||||
|
||||
Scenario: Configure the logged in user block to show / hide the users idnumber
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email | idnumber |
|
||||
| teacher1 | Teacher | One | teacher1@example.com | ID12345 |
|
||||
And I log in as "teacher1"
|
||||
And I turn editing mode on
|
||||
When I add the "Logged in user" block
|
||||
And I configure the "Logged in user" block
|
||||
And I set the following fields to these values:
|
||||
| Display ID number | No |
|
||||
And I press "Save changes"
|
||||
Then I should see "Teacher One" in the "Logged in user" "block"
|
||||
And I should not see "ID number:" in the "Logged in user" "block"
|
||||
And I configure the "Logged in user" block
|
||||
And I set the following fields to these values:
|
||||
| Display ID number | Yes |
|
||||
And I press "Save changes"
|
||||
And I should see "ID number:" in the "Logged in user" "block"
|
||||
|
Loading…
x
Reference in New Issue
Block a user