mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 00:16:46 +02:00
just amended some of the set_defaults stuff
This commit is contained in:
parent
5c11b818ec
commit
3c19571fed
1 changed files with 9 additions and 15 deletions
|
@ -17,12 +17,11 @@ class user_edit_form extends moodleform {
|
||||||
|
|
||||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
$systemcontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||||
$userupdate = has_capability('moodle/user:update', $systemcontext);
|
$userupdate = has_capability('moodle/user:update', $systemcontext);
|
||||||
|
|
||||||
$strrequired = get_string('required');
|
$strrequired = get_string('required');
|
||||||
|
|
||||||
|
|
||||||
/// Add some extra hidden fields
|
/// Add some extra hidden fields
|
||||||
$mform->addElement('hidden', 'id', $user->id);
|
$mform->addElement('hidden', 'id');
|
||||||
$mform->addElement('hidden', 'course', $course->id);
|
$mform->addElement('hidden', 'course', $course->id);
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,7 +39,7 @@ class user_edit_form extends moodleform {
|
||||||
$mform->setDefault('username', '');
|
$mform->setDefault('username', '');
|
||||||
$mform->addRule('username', $strrequired, 'required', null, 'client');
|
$mform->addRule('username', $strrequired, 'required', null, 'client');
|
||||||
} else {
|
} else {
|
||||||
$mform->addElement('hidden', 'username', $user->username);
|
$mform->addElement('hidden', 'username');
|
||||||
}
|
}
|
||||||
|
|
||||||
$modules = get_list_of_plugins("auth");
|
$modules = get_list_of_plugins("auth");
|
||||||
|
@ -61,9 +60,6 @@ class user_edit_form extends moodleform {
|
||||||
$newpasswordgrp[] = &MoodleQuickForm::createElement('static', 'newpasswordtext', '', '('.get_string('leavetokeep').')');
|
$newpasswordgrp[] = &MoodleQuickForm::createElement('static', 'newpasswordtext', '', '('.get_string('leavetokeep').')');
|
||||||
$mform->addGroup($newpasswordgrp, 'newpasswordgrp', get_string('newpassword'),' ',false);
|
$mform->addGroup($newpasswordgrp, 'newpasswordgrp', get_string('newpassword'),' ',false);
|
||||||
$mform->setType('newpassword', PARAM_MULTILANG);
|
$mform->setType('newpassword', PARAM_MULTILANG);
|
||||||
if (isset($user->newpassword)) {
|
|
||||||
$mform->setDefault('newpassword', $user->newpassword);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$adminself and $userauth->can_change_password()) {
|
if (!$adminself and $userauth->can_change_password()) {
|
||||||
if (get_user_preferences('auth_forcepasswordchange', NULL, $user->id)) {
|
if (get_user_preferences('auth_forcepasswordchange', NULL, $user->id)) {
|
||||||
|
@ -176,13 +172,14 @@ class user_edit_form extends moodleform {
|
||||||
$mform->setType('city', PARAM_MULTILANG);
|
$mform->setType('city', PARAM_MULTILANG);
|
||||||
$mform->addRule('city', $strrequired, 'required', null, 'client');
|
$mform->addRule('city', $strrequired, 'required', null, 'client');
|
||||||
|
|
||||||
if (!$user->country and $CFG->country) {
|
|
||||||
$user->country = $CFG->country;
|
|
||||||
}
|
|
||||||
$choices = get_list_of_countries();
|
$choices = get_list_of_countries();
|
||||||
$mform->addElement('select', 'country', get_string('selectacountry'), $choices);
|
$mform->addElement('select', 'country', get_string('selectacountry'), $choices);
|
||||||
$mform->setType('country', PARAM_ALPHA);
|
$mform->setType('country', PARAM_ALPHA);
|
||||||
$mform->addRule('country', $strrequired, 'required', null, 'client');
|
$mform->addRule('country', $strrequired, 'required', null, 'client');
|
||||||
|
if ($CFG->country) {
|
||||||
|
$mform->setDefault('country', $CFG->country);
|
||||||
|
}
|
||||||
|
|
||||||
$choices = get_list_of_timezones();
|
$choices = get_list_of_timezones();
|
||||||
$choices['99'] = get_string('serverlocaltime');
|
$choices['99'] = get_string('serverlocaltime');
|
||||||
|
@ -195,11 +192,9 @@ class user_edit_form extends moodleform {
|
||||||
|
|
||||||
$choices = array();
|
$choices = array();
|
||||||
if ($choices = get_list_of_languages()) {
|
if ($choices = get_list_of_languages()) {
|
||||||
if (!$user->lang) {
|
|
||||||
$user->lang = $CFG->lang;
|
|
||||||
}
|
|
||||||
$mform->addElement('select', 'lang', get_string('preferredlanguage'), $choices);
|
$mform->addElement('select', 'lang', get_string('preferredlanguage'), $choices);
|
||||||
$mform->setType('lang', PARAM_FILE);
|
$mform->setType('lang', PARAM_FILE);
|
||||||
|
$mform->setDefault('lang', $CFG->lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($CFG->allowuserthemes)) {
|
if (!empty($CFG->allowuserthemes)) {
|
||||||
|
@ -305,7 +300,6 @@ class user_edit_form extends moodleform {
|
||||||
if ($userupdate) {
|
if ($userupdate) {
|
||||||
$fields = get_user_fieldnames();
|
$fields = get_user_fieldnames();
|
||||||
$freezefields = array();
|
$freezefields = array();
|
||||||
|
|
||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
$configvariable = 'field_lock_' . $field;
|
$configvariable = 'field_lock_' . $field;
|
||||||
if (isset($authplugin->config->{$configvariable}) and
|
if (isset($authplugin->config->{$configvariable}) and
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue