7f999ccb |
1 | <?php // $Id$ |
2 | require_once $CFG->libdir.'/formslib.php'; |
3 | |
4 | class grade_import_form extends moodleform { |
5 | function definition (){ |
6 | $mform =& $this->_form; |
7 | |
8 | // course id needs to be passed for auth purposes |
9 | $mform->addElement('hidden', 'id', optional_param('id')); |
10 | |
11 | // file upload |
12 | $mform->addElement('file', 'userfile', get_string('file')); |
13 | $mform->addRule('userfile', null, 'required'); |
14 | |
15 | $this->add_action_buttons(false, get_string('uploadgrades')); |
16 | } |
17 | |
18 | function get_userfile_name(){ |
19 | if ($this->is_submitted() and $this->is_validated()) { |
20 | // return the temporary filename to process |
21 | return $this->_upload_manager->files['userfile']['tmp_name']; |
22 | }else{ |
23 | return NULL; |
24 | } |
25 | } |
26 | } |
27 | ?> |