|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 if (!defined('MOODLE_INTERNAL')) { 00004 die('Direct access to this script is forbidden.'); 00005 } 00006 00007 require_once($CFG->dirroot.'/lib/formslib.php'); 00008 00009 class field_form extends moodleform { 00010 00011 var $field; 00012 00014 function definition () { 00015 global $CFG; 00016 00017 $mform =& $this->_form; 00018 00020 $datatype = $this->_customdata; 00021 require_once($CFG->dirroot.'/user/profile/field/'.$datatype.'/define.class.php'); 00022 $newfield = 'profile_define_'.$datatype; 00023 $this->field = new $newfield(); 00024 00025 $strrequired = get_string('required'); 00026 00028 $mform->addElement('hidden', 'id'); 00029 $mform->setType('id', PARAM_INT); 00030 $mform->addElement('hidden', 'action', 'editfield'); 00031 $mform->setType('action', PARAM_ACTION); 00032 $mform->addElement('hidden', 'datatype', $datatype); 00033 $mform->setType('datatype', PARAM_ALPHA); 00034 00035 $this->field->define_form($mform); 00036 00037 $this->add_action_buttons(true); 00038 } 00039 00040 00042 function definition_after_data () { 00043 $mform =& $this->_form; 00044 $this->field->define_after_data($mform); 00045 } 00046 00047 00049 function validation($data, $files) { 00050 return $this->field->define_validate($data, $files); 00051 } 00052 00053 function editors() { 00054 return $this->field->define_editors(); 00055 } 00056 } 00057 00058