MDL-9627 - moving uploaduser to formslib

This commit is contained in:
poltawski
2007-05-02 09:33:56 +00:00
parent 7c8a963f7b
commit 0a5dffccd7
2 changed files with 50 additions and 49 deletions
+34
View File
@@ -0,0 +1,34 @@
<?php
require_once $CFG->libdir.'/formslib.php';
class admin_uploaduser_form extends moodleform {
function definition (){
$mform =& $this->_form;
$mform->addElement('file', 'userfile', get_string('file'));
$mform->addRule('userfile', null, 'required');
$mform->addElement('header', 'settingsheader', get_string('settings'));
$passwordopts = array( 0 => get_string('infilefield', 'auth'),
1 => get_string('createpasswordifneeded', 'auth'),
);
$mform->addElement('select', 'createpassword', get_string('passwordhandling', 'auth'), $passwordopts);
$mform->addElement('selectyesno', 'updateaccounts', get_string('updateaccounts', 'admin'));
$mform->addElement('selectyesno', 'allowrenames', get_string('allowrenames', 'admin'));
$this->add_action_buttons(false, get_string('uploadusers'));
}
function get_userfile_name(){
if ($this->is_submitted() and $this->is_validated()) {
// return the temporary filename to process
return $this->_upload_manager->files['userfile']['tmp_name'];
}else{
return NULL;
}
}
}
?>