dirroot.'/lib/formslib.php'); class test_form extends moodleform { function definition() { $mform = $this->_form; $mform->addElement('hidden', 'justanid', 0); $mform->setType('justanid', PARAM_INT); $attributes = array(); $attributes['id'] = 'id_01'; $attributes['class'] = 'customclass indent-1 character_text'; $mform->addElement('text', 'character', 'value', $attributes); $mform->setType('character', PARAM_TEXT); $attributes = array(); $attributes['id'] = 'id_02'; $attributes['class'] = 'customclass indent-2 select_select'; $labels = array('north', 'west', 'south', 'est'); $mform->addElement('select', 'select', 'Please choose a direction', $labels, $attributes); $elementgroup = array(); $attributes = array(); $mform->addElement('static', 'rate_static', 'Rate the following drinks:'); $labels = array('--', '-', '+', '++'); $attributes['id'] = 'id_03_00'; $attributes['class'] = 'customclass indent-3 rate_select'; $mform->addElement('select', 'rate_01', 'Coffee', $labels, $attributes); $attributes['id'] = 'id_03_01'; $mform->addElement('select', 'rate_02', 'Water', $labels, $attributes); $attributes['id'] = 'id_03_02'; $mform->addElement('select', 'rate_03', 'Milk', $labels, $attributes); $elementgroup = array(); $attributes = array(); $attributes['id'] = 'id_04_1'; $attributes['class'] = 'customclass indent-4 radiobutton_radio'; $elementgroup[] = $mform->createElement('radio', 'radio_04_00', '', 'top', 't', $attributes); $attributes['id'] = 'id_04_2'; $attributes['class'] = 'customclass radiobutton_radio'; $elementgroup[] = $mform->createElement('radio', 'radio_04_01', '', 'left', 'l', $attributes); $attributes['id'] = 'id_04_3'; $attributes['class'] = 'customclass radiobutton_radio'; $elementgroup[] = $mform->createElement('radio', 'radio_04_02', '', 'bottom', 'b', $attributes); $attributes['id'] = 'id_04_4'; $attributes['class'] = 'customclass radiobutton_radio'; $elementgroup[] = $mform->createElement('radio', 'radio_04_03', '', 'right', 'r', $attributes); $separator = ' '; $mform->addGroup($elementgroup, 'radio_04_group', 'Please choose a direction', $separator, false); $elementgroup = array(); $attributes = array(); $attributes['id'] = 'id_05'; $attributes['class'] = 'customclass indent-5 checkbox_check'; $attributes['id'] = 'id_05_1'; $elementgroup[] = $mform->createElement('radio', 'radio_05_00', '', 'top', 't', $attributes); $attributes['id'] = 'id_05_2'; $elementgroup[] = $mform->createElement('radio', 'radio_05_01', '', 'left', 'l', $attributes); $attributes['id'] = 'id_05_3'; $elementgroup[] = $mform->createElement('radio', 'radio_05_02', '', 'bottom', 'b', $attributes); $attributes['id'] = 'id_05_4'; $elementgroup[] = $mform->createElement('radio', 'radio_05_03', '', 'right', 'r', $attributes); $separator = '
'; $mform->addGroup($elementgroup, 'radio_05_group', 'Please choose a direction', $separator, false); $elementgroup = array(); $attributes = array(); $attributes['id'] = 'id_06_1'; $attributes['class'] = 'customclass indent-6 radiobutton_radio'; $elementgroup[] = $mform->createElement('checkbox', 'check_06_00', '', 'top', 't', $attributes); $attributes['id'] = 'id_06_2'; $attributes['class'] = 'customclass radiobutton_radio'; $elementgroup[] = $mform->createElement('checkbox', 'check_06_01', '', 'left', 'l', $attributes); $attributes['id'] = 'id_06_3'; $attributes['class'] = 'customclass radiobutton_radio'; $elementgroup[] = $mform->createElement('checkbox', 'check_06_02', '', 'bottom', 'b', $attributes); $attributes['id'] = 'id_06_4'; $attributes['class'] = 'customclass radiobutton_radio'; $elementgroup[] = $mform->createElement('checkbox', 'check_06_03', '', 'right', 'r', $attributes); $separator = ' '; $mform->addGroup($elementgroup, 'check_06_group', 'Please choose a direction', $separator, false); $elementgroup = array(); $attributes = array(); $attributes['id'] = 'id_07'; $attributes['class'] = 'customclass indent-7 checkbox_check'; $attributes['id'] = 'id_07_1'; $elementgroup[] = $mform->createElement('checkbox', 'check_07_00', '', 'top', 't', $attributes); $attributes['id'] = 'id_07_2'; $elementgroup[] = $mform->createElement('checkbox', 'check_07_01', '', 'left', 'l', $attributes); $attributes['id'] = 'id_07_3'; $elementgroup[] = $mform->createElement('checkbox', 'check_07_02', '', 'bottom', 'b', $attributes); $attributes['id'] = 'id_07_4'; $elementgroup[] = $mform->createElement('checkbox', 'check_07_03', '', 'right', 'r', $attributes); $separator = '
'; $mform->addGroup($elementgroup, 'check_07_group', 'Please choose a direction', $separator, false); $attributes = array(); $attributes['id'] = 'id_08'; $attributes['class'] = 'customclass indent-8 textarea_textarea'; $labels = array('north', 'west', 'south', 'est'); $mform->addElement('textarea', 'textarea', 'Describe yourself', $labels, $attributes); $attributes = array(); $attributes['id'] = 'id_09'; $attributes['class'] = 'customclass indent-9 textarea_editor'; $labels = array('north', 'west', 'south', 'est'); $editoroptions = array('trusttext' => true, 'subdirs' => true, 'maxfiles' => EDITOR_UNLIMITED_FILES); $mform->addElement('editor', 'editor', 'Describe yourself', $attributes, $editoroptions); $attributes = array(); $attributes['id'] = 'id_10'; $attributes['class'] = 'customclass indent-10 fileupload_fileupload'; $attributes['maxbytes'] = 1024; $attributes['accepted_types'] = 'pdf'; $attributes['subdirs'] = false; $attributes['maxfiles'] = 1; $mform->addElement('filemanager', 'fileupload_fileupload', 'Describe yourself', null, $attributes); $buttonarray = array(); $buttonarray[] = $mform->createElement('submit', 'save', 'save'); $buttonarray[] = $mform->createElement('cancel', 'cancel', 'cancel'); $mform->addGroup($buttonarray, 'buttonarr', '', array(' '), false); $mform->setType('buttonar', PARAM_RAW); } } // =================== $PAGE->set_context(context_system::instance()); $PAGE->set_url('/mform_code.php'); $PAGE->set_title('mform_code'); $mform = new test_form(new moodle_url('/mform_code.php'), array(), 'post', '', array('id' => 'userentry')); if ($mform->is_cancelled()) { } if ($data = $mform->get_data()) { } echo $OUTPUT->header(); $mform->display(); echo $OUTPUT->footer();