$form->addRule('competences', get_lang('ThisFieldIsRequired'), 'required'); } if (api_get_setting('extendedprofile_registration', 'mydiplomas') == 'true' && api_get_setting('extendedprofile_registrationrequired', 'mydiplomas') == 'true') { $form->addRule('diplomas', get_lang('ThisFieldIsRequired'), 'required'); } if (api_get_setting('extendedprofile_registration', 'myteach') == 'true' && api_get_setting('extendedprofile_registrationrequired', 'myteach') == 'true') { $form->addRule('teach', get_lang('ThisFieldIsRequired'), 'required'); } if (api_get_setting('extendedprofile_registration', 'mypersonalopenarea') == 'true' && api_get_setting('extendedprofile_registrationrequired', 'mypersonalopenarea') == 'true') { $form->addRule('openarea', get_lang('ThisFieldIsRequired'), 'required'); } } // EXTRA FIELDS $extra_data = UserManager::get_extra_user_data(api_get_user_id(), true); $extraField = new ExtraField('user'); $extraField->set_extra_fields_in_form($form, $extra_data, 'registration', false, null); } if (isset($_SESSION['user_language_choice']) && $_SESSION['user_language_choice'] != '') { $defaults['language'] = $_SESSION['user_language_choice']; } else { $defaults['language'] = api_get_setting('platformLanguage'); } if (!empty($_GET['username'])) { $defaults['username'] = Security::remove_XSS($_GET['username']); } if (!empty($_GET['email'])) { $defaults['email'] = Security::remove_XSS($_GET['email']); } if (!empty($_GET['phone'])) { $defaults['phone'] = Security::remove_XSS($_GET['phone']); }
$group[] = $form->createElement('radio', 'send_mail', null, get_lang('No'), 0); $form->addGroup($group, 'mail', get_lang('SendMailToNewUser'), ' ', false); // Registration Date $form->addElement('static', 'registration_date', get_lang('RegistrationDate'), $user_data['registration_date']); // Expiration Date $form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0); $group = array(); $group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('On'), 1); $group[] = $form->createElement('datepicker', 'expiration_date', null, array('form_name' => $form->getAttribute('name'), 'onchange' => 'javascript: enable_expiration_date();')); $form->addGroup($group, 'max_member_group', null, '', false); // Active account or inactive account $form->addElement('radio', 'active', get_lang('ActiveAccount'), get_lang('Active'), 1); $form->addElement('radio', 'active', '', get_lang('Inactive'), 0); // EXTRA FIELDS $extraField = new ExtraField('user'); $return_params = $extraField->set_extra_fields_in_form($form, $extra_data, 'user_edit', true, $user_id); $jquery_ready_content = $return_params['jquery_ready_content']; // the $jquery_ready_content variable collects all functions that will be load in the $(document).ready javascript function $htmlHeadXtra[] = '<script> $(document).ready(function(){ ' . $jquery_ready_content . ' }); </script>'; // Submit button $form->addElement('style_submit_button', 'submit', get_lang('ModifyInformation'), 'class="save"'); // Set default values $user_data['reset_password'] = 0; $expiration_date = $user_data['expiration_date']; if ($expiration_date == '0000-00-00 00:00:00') { $user_data['radio_expiration_date'] = 0; $user_data['expiration_date'] = array();
$group = array(); $group[] = $form->createElement('radio', 'send_mail', null, get_lang('Yes'), 1); $group[] = $form->createElement('radio', 'send_mail', null, get_lang('No'), 0); $form->addGroup($group, 'mail', get_lang('SendMailToNewUser'), ' '); // Expiration Date $form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0); $group = array(); $group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('On'), 1); $group[] = $form->createElement('datepicker', 'expiration_date', null, array('form_name' => $form->getAttribute('name'), 'onchange' => 'javascript: enable_expiration_date();')); $form->addGroup($group, 'max_member_group', null, '', false); // Active account or inactive account $form->addElement('radio', 'active', get_lang('ActiveAccount'), get_lang('Active'), 1); $form->addElement('radio', 'active', '', get_lang('Inactive'), 0); $extra_data = UserManager::get_extra_user_data(0, true); $extraField = new ExtraField('user'); $return_params = $extraField->set_extra_fields_in_form($form, $extra_data, 'user_add', false, null); $jquery_ready_content = $return_params['jquery_ready_content']; // the $jquery_ready_content variable collects all functions that will be load in the $(document).ready javascript function $htmlHeadXtra[] = '<script> $(document).ready(function(){ ' . $jquery_ready_content . ' }); </script>'; // Set default values $defaults['mail']['send_mail'] = 0; $defaults['password']['password_auto'] = 1; $defaults['active'] = 1; $defaults['expiration_date'] = array(); $days = api_get_setting('account_valid_duration'); $time = strtotime('+' . $days . ' day'); $defaults['expiration_date']['d'] = date('d', $time);
} // PASSWORD, if auth_source is platform if (is_platform_authentication() && api_is_profile_editable() && api_get_setting('profile', 'password') == 'true') { $form->addElement('password', 'password0', array(get_lang('Pass'), get_lang('Enter2passToChange')), array('size' => 40)); $form->addElement('password', 'password1', get_lang('NewPass'), array('size' => 40)); $form->addElement('password', 'password2', get_lang('Confirmation'), array('size' => 40)); // user must enter identical password twice so we can prevent some user errors $form->addRule(array('password1', 'password2'), get_lang('PassTwo'), 'compare'); if (CHECK_PASS_EASY_TO_FIND) { $form->addRule('password1', get_lang('CurrentPasswordEmptyOrIncorrect'), 'callback', 'api_check_password'); } } // EXTRA FIELDS $extra_data = UserManager::get_extra_user_data(api_get_user_id(), true); $extraField = new ExtraField('user'); $return_params = $extraField->set_extra_fields_in_form($form, $extra_data, 'profile', false, api_get_user_id()); $jquery_ready_content = $return_params['jquery_ready_content']; // the $jquery_ready_content variable collects all functions that will be load in the $(document).ready javascript function $htmlHeadXtra[] = '<script> $(document).ready(function(){ ' . $jquery_ready_content . ' }); </script>'; if (api_get_setting('profile', 'apikeys') == 'true') { $form->addElement('html', '<div id="div_api_key">'); $form->addElement('text', 'api_key_generate', get_lang('MyApiKey'), array('size' => 40, 'id' => 'id_api_key_generate')); $form->addElement('html', '</div>'); $form->addElement('button', 'generate_api_key', get_lang('GenerateApiKey'), array('id' => 'id_generate_api_key', 'onclick' => 'generate_open_id_form()')); //generate_open_id_form() } // SUBMIT