53
53
$mform->setDefault('delimiter_name', 'comma');
56
$choices = textlib::get_encodings();
56
$choices = core_text::get_encodings();
57
57
$mform->addElement('select', 'encoding', get_string('encoding', 'tool_uploaduser'), $choices);
58
58
$mform->setDefault('encoding', 'UTF-8');
237
237
$mform->addElement('select', 'autosubscribe', get_string('autosubscribe'), $choices);
238
238
$mform->setDefault('autosubscribe', 1);
240
$editors = editors_get_enabled();
241
if (count($editors) > 1) {
243
$choices['0'] = get_string('texteditor');
244
$choices['1'] = get_string('htmleditor');
245
$mform->addElement('select', 'htmleditor', get_string('textediting'), $choices);
246
$mform->setDefault('htmleditor', 1);
248
$mform->addElement('hidden', 'htmleditor');
249
$mform->setDefault('htmleditor', 1);
250
$mform->setType('htmleditor', PARAM_INT);
253
$mform->addElement('text', 'city', get_string('city'), 'maxlength="100" size="25"');
240
$mform->addElement('text', 'city', get_string('city'), 'maxlength="120" size="25"');
254
241
$mform->setType('city', PARAM_TEXT);
255
242
if (empty($CFG->defaultcity)) {
256
243
$mform->setDefault('city', $templateuser->city);
258
245
$mform->setDefault('city', $CFG->defaultcity);
260
$mform->addRule('city', get_string('required'), 'required');
262
$mform->addElement('select', 'country', get_string('selectacountry'), get_string_manager()->get_list_of_countries());
248
$choices = get_string_manager()->get_list_of_countries();
249
$choices = array(''=>get_string('selectacountry').'...') + $choices;
250
$mform->addElement('select', 'country', get_string('selectacountry'), $choices);
263
251
if (empty($CFG->country)) {
264
252
$mform->setDefault('country', $templateuser->country);
287
275
$mform->setType('url', PARAM_URL);
288
276
$mform->setAdvanced('url');
290
$mform->addElement('text', 'idnumber', get_string('idnumber'), 'maxlength="64" size="25"');
278
$mform->addElement('text', 'idnumber', get_string('idnumber'), 'maxlength="255" size="25"');
291
279
$mform->setType('idnumber', PARAM_NOTAGS);
293
$mform->addElement('text', 'institution', get_string('institution'), 'maxlength="40" size="25"');
281
$mform->addElement('text', 'institution', get_string('institution'), 'maxlength="255" size="25"');
294
282
$mform->setType('institution', PARAM_TEXT);
295
283
$mform->setDefault('institution', $templateuser->institution);
297
$mform->addElement('text', 'department', get_string('department'), 'maxlength="30" size="25"');
285
$mform->addElement('text', 'department', get_string('department'), 'maxlength="255" size="25"');
298
286
$mform->setType('department', PARAM_TEXT);
299
287
$mform->setDefault('department', $templateuser->department);
306
294
$mform->setType('phone2', PARAM_NOTAGS);
307
295
$mform->setAdvanced('phone2');
309
$mform->addElement('text', 'address', get_string('address'), 'maxlength="70" size="25"');
297
$mform->addElement('text', 'address', get_string('address'), 'maxlength="255" size="25"');
310
298
$mform->setType('address', PARAM_TEXT);
311
299
$mform->setAdvanced('address');
388
376
// look for other required data
389
377
if ($optype != UU_USER_UPDATE) {
390
if (!in_array('firstname', $columns)) {
391
$errors['uutype'] = get_string('missingfield', 'error', 'firstname');
394
if (!in_array('lastname', $columns)) {
395
if (isset($errors['uutype'])) {
396
$errors['uutype'] = '';
398
$errors['uutype'] = ' ';
378
$requiredusernames = useredit_get_required_name_fields();
380
foreach ($requiredusernames as $requiredusername) {
381
if (!in_array($requiredusername, $columns)) {
382
$missing[] = get_string('missingfield', 'error', $requiredusername);;
400
$errors['uutype'] .= get_string('missingfield', 'error', 'lastname');
386
$errors['uutype'] = implode('<br />', $missing);
403
388
if (!in_array('email', $columns) and empty($data['email'])) {
404
389
$errors['email'] = get_string('requiredtemplate', 'tool_uploaduser');