. require_once($CFG->dirroot.'/mod/apply/item/apply_item_form_class.php'); class apply_textfield_form extends apply_item_form { protected $type = "textfield"; public function definition() { global $OUTPUT; $item = $this->_customdata['item']; $common = $this->_customdata['common']; $positionlist = $this->_customdata['positionlist']; $position = $this->_customdata['position']; $mform =& $this->_form; $mform->addElement('header', 'general', get_string($this->type, 'apply')); $mform->addElement('advcheckbox', 'required', get_string('required', 'apply'), '' , null , array(0, 1)); $mform->setType('required', PARAM_INT); $mform->addElement('text', 'name', get_string('item_name', 'apply'), array('size'=>APPLY_ITEM_NAME_TEXTBOX_SIZE, 'maxlength'=>255)); $mform->addElement('text', 'label', get_string('item_label', 'apply'), array('size'=>APPLY_ITEM_LABEL_TEXTBOX_SIZE,'maxlength'=>255)); $mform->addHelpButton('label', 'item_label', 'apply'); $mform->setType('label', PARAM_TEXT); $mform->addElement('select', 'itemsize', get_string('textfield_size', 'apply').' ', array_slice(range(0, 255), 5, 255, true)); $mform->setDefault('itemsize', 30); $mform->setType('itemsize', PARAM_INT); $mform->addElement('select', 'itemmaxlength', get_string('textfield_maxlength', 'apply'), array_slice(range(0, 255), 5, 255, true)); $mform->setDefault('itemmaxlength', 30); $mform->setType('itemmaxlength', PARAM_INT); $mform->addElement('text', 'outside_style', get_string('outside_style', 'apply'), array('size'=>APPLY_ITEM_STYLE_TEXTBOX_SIZE, 'maxlength'=>255)); $mform->addHelpButton('outside_style', 'outside_style', 'apply'); $mform->setDefault('outside_style', get_string('outside_style_default', 'apply')); $mform->setType('outside_style', PARAM_TEXT); $mform->addElement('text', 'item_style', get_string('item_style', 'apply'), array('size'=>APPLY_ITEM_STYLE_TEXTBOX_SIZE, 'maxlength'=>255)); $mform->addHelpButton('item_style', 'item_style', 'apply'); $mform->setDefault('item_style', get_string('item_style_default', 'apply')); $mform->setType('item_style', PARAM_TEXT); parent::definition(); $this->set_data($item); } public function get_data() { if (!$item = parent::get_data()) { return false; } $item->presentation = $item->itemsize.APPLY_TEXTFIELD_SEP.$item->itemmaxlength. APPLY_TEXTFIELD_SEP.$item->outside_style.APPLY_TEXTFIELD_SEP.$item->item_style; return $item; } }