MDL-51427 user: correctly use strings for phone1 and phone2

Thanks to Olumuyiwa Taiwo for original patch

AMOS BEGIN
  CPY [phone,core],[phone1,core]
AMOS END
This commit is contained in:
Marina Glancy 2015-09-16 13:10:10 +08:00
parent f495510548
commit 70fb46c87f
10 changed files with 11 additions and 15 deletions

View File

@ -146,8 +146,6 @@ function print_auth_lock_options($auth, $user_fields, $helptext, $retrieveopts,
// If custom field then pick name from database.
$fieldshortname = str_replace('profile_field_', '', $fieldname);
$fieldname = $customfieldname[$fieldshortname]->name;
} elseif (preg_match('/^(.+?)(\d+)$/', $fieldname, $matches)) {
$fieldname = get_string($matches[1]) . ' ' . $matches[2];
} elseif ($fieldname == 'url') {
$fieldname = get_string('webpage');
} else {

View File

@ -185,7 +185,7 @@ if ($hassiteconfig
new lang_string('showuseridentity_desc', 'admin'), array('email' => 1), array(
'idnumber' => new lang_string('idnumber'),
'email' => new lang_string('email'),
'phone1' => new lang_string('phone'),
'phone1' => new lang_string('phone1'),
'phone2' => new lang_string('phone2'),
'department' => new lang_string('department'),
'institution' => new lang_string('institution'),

View File

@ -290,7 +290,7 @@ class admin_uploaduser_form2 extends moodleform {
$mform->setType('department', PARAM_TEXT);
$mform->setDefault('department', $templateuser->department);
$mform->addElement('text', 'phone1', get_string('phone'), 'maxlength="20" size="25"');
$mform->addElement('text', 'phone1', get_string('phone1'), 'maxlength="20" size="25"');
$mform->setType('phone1', PARAM_NOTAGS);
$mform->setAdvanced('phone1');

View File

@ -127,13 +127,13 @@ class block_myprofile extends block_base {
if(!empty($this->config->display_phone1) && !empty($USER->phone1)) {
$this->content->text .= '<div class="myprofileitem phone1">';
$this->content->text .= get_string('phone').': ' . s($USER->phone1);
$this->content->text .= get_string('phone1').': ' . s($USER->phone1);
$this->content->text .= '</div>';
}
if(!empty($this->config->display_phone2) && !empty($USER->phone2)) {
$this->content->text .= '<div class="myprofileitem phone2">';
$this->content->text .= get_string('phone').': ' . s($USER->phone2);
$this->content->text .= get_string('phone2').': ' . s($USER->phone2);
$this->content->text .= '</div>';
}

View File

@ -34,8 +34,8 @@ $string['display_skype'] = 'Display Skype';
$string['display_yahoo'] = 'Display Yahoo';
$string['display_aim'] = 'Display AIM';
$string['display_msn'] = 'Display MSN';
$string['display_phone1'] = 'Display phone number 1';
$string['display_phone2'] = 'Display phone number 2';
$string['display_phone1'] = 'Display phone';
$string['display_phone2'] = 'Display mobile phone';
$string['display_institution'] = 'Display institution';
$string['display_address'] = 'Display address';
$string['display_firstaccess'] = 'Display first access';

View File

@ -1427,6 +1427,7 @@ $string['perpagea'] = 'Per page: {$a}';
$string['personal'] = 'Personal';
$string['personalprofile'] = 'Personal profile';
$string['phone'] = 'Phone';
$string['phone1'] = 'Phone';
$string['phone2'] = 'Mobile phone';
$string['phpinfo'] = 'PHP info';
$string['pictureof'] = 'Picture of {$a}';

View File

@ -3547,9 +3547,6 @@ function get_extra_user_fields_sql($context, $alias='', $prefix='', $already = a
function get_user_field_name($field) {
// Some fields have language strings which are not the same as field name.
switch ($field) {
case 'phone1' : {
return get_string('phone');
}
case 'url' : {
return get_string('webpage');
}

View File

@ -175,7 +175,7 @@ function core_myprofile_navigation(core_user\output\myprofile\tree $tree, $user,
}
if (isset($identityfields['phone1']) && $user->phone1) {
$node = new core_user\output\myprofile\node('contact', 'phone1', get_string('phone'), null, null, $user->phone1);
$node = new core_user\output\myprofile\node('contact', 'phone1', get_string('phone1'), null, null, $user->phone1);
$tree->add_node($node);
}

View File

@ -421,8 +421,8 @@ function url_get_variable_options($config) {
'userfullname' => get_string('fullnameuser'),
'useremail' => get_string('email'),
'usericq' => get_string('icqnumber'),
'userphone1' => get_string('phone').' 1',
'userphone2' => get_string('phone2').' 2',
'userphone1' => get_string('phone1'),
'userphone2' => get_string('phone2'),
'userinstitution' => get_string('institution'),
'userdepartment' => get_string('department'),
'useraddress' => get_string('address'),

View File

@ -430,7 +430,7 @@ function useredit_shared_definition(&$mform, $editoroptions, $filemanageroptions
$mform->addElement('text', 'department', get_string('department'), 'maxlength="255" size="25"');
$mform->setType('department', PARAM_TEXT);
$mform->addElement('text', 'phone1', get_string('phone'), 'maxlength="20" size="25"');
$mform->addElement('text', 'phone1', get_string('phone1'), 'maxlength="20" size="25"');
$mform->setType('phone1', PARAM_NOTAGS);
$mform->addElement('text', 'phone2', get_string('phone2'), 'maxlength="20" size="25"');