dirroot.'/lib/formslib.php'); class test_form extends moodleform { function definition() { $mform = $this->_form; $options = array('Nord', 'South', 'East', 'Ovest', ); $mform->addElement('select', 'selectitemname', 'Choose me', $options); $mform->setDefault('selectitemname', '3'); $attachmentoptions = array('maxbytes' => 1024*1024, 'accepted_types' => '*', 'subdirs' => false, 'maxfiles' => 1); $mform->addElement('filemanager', 'filemanageritemname', 'Upload your avatar', null); $this->add_action_buttons(); } } // =================== $PAGE->set_context(context_system::instance()); $PAGE->set_url('/test_form.php'); $PAGE->set_title('test_form'); $customdata = null; $method = 'post'; $target = ''; $attributes = null; $editable = true; $mform = new test_form(new moodle_url('/test_form.php'), $customdata, $method, $target, $attributes, $editable); if ($mform->is_cancelled()) { } if ($data = $mform->get_data()) { } echo $OUTPUT->header(); $mform->display(); echo $OUTPUT->footer();