"MDL-8642, setting of auto scrolling"
[moodle-linuxchix.git] / user / profile / index_field_form.php
blob781c7afaa452bd0ec12214059a584d5aff5b1f65
1 <?php //$Id$
3 require_once($CFG->dirroot.'/lib/formslib.php');
5 class field_form extends moodleform {
7 var $field;
9 /// Define the form
10 function definition () {
11 global $CFG;
13 $mform =& $this->_form;
15 /// Everything else is dependant on the data type
16 $datatype = $this->_customdata;
17 require_once($CFG->dirroot.'/user/profile/field/'.$datatype.'/define.class.php');
18 $newfield = 'profile_define_'.$datatype;
19 $this->field = new $newfield();
21 $strrequired = get_string('required');
23 /// Add some extra hidden fields
24 $mform->addElement('hidden', 'id');
25 $mform->addElement('hidden', 'action', 'editfield');
26 $mform->addElement('hidden', 'datatype', $datatype);
28 $this->field->define_form($mform);
30 $this->add_action_buttons(true);
34 /// alter definition based on existing or submitted data
35 function definition_after_data () {
36 $mform =& $this->_form;
37 $this->field->define_after_data($mform);
41 /// perform some moodle validation
42 function validation($data, $files) {
43 return $this->field->define_validate($data, $files);