2 require_once $CFG->libdir
.'/formslib.php';
4 class admin_uploaduser_form
extends moodleform
{
5 function definition (){
6 $mform =& $this->_form
;
8 $mform->addElement('file', 'userfile', get_string('file'));
9 $mform->addRule('userfile', null, 'required');
11 $mform->addElement('header', 'settingsheader', get_string('settings'));
13 $passwordopts = array( 0 => get_string('infilefield', 'auth'),
14 1 => get_string('createpasswordifneeded', 'auth'),
17 $mform->addElement('select', 'createpassword', get_string('passwordhandling', 'auth'), $passwordopts);
19 $mform->addElement('selectyesno', 'updateaccounts', get_string('updateaccounts', 'admin'));
20 $mform->addElement('selectyesno', 'allowrenames', get_string('allowrenames', 'admin'));
22 $this->add_action_buttons(false, get_string('uploadusers'));
25 function get_userfile_name(){
26 if ($this->is_submitted() and $this->is_validated()) {
27 // return the temporary filename to process
28 return $this->_upload_manager
->files
['userfile']['tmp_name'];