forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 23
如果编写一个module(4)—— mod_form.php
50573750 edited this page Dec 18, 2011
·
1 revision
#如果编写一个module(4)—— mod_form.php
##这个是在向课程中添加mod时,出现的页面。 `
dirroot.'/course/moodleform_mod.php'); //一个form作为主要的内容。 class mod_gboard_mod_form extends moodleform_mod { //以下是form的形式,请参考formlib的内容进行分析。 public function definition() { $mform = $this->_form; $mform->addElement('header', 'general', get_string('general', 'form')); $mform->addElement('text', 'name', get_string('gboardname', 'gboard'), array('size'=>'64')); if (!empty($CFG->formatstringstriptags)) { $mform->setType('name', PARAM_TEXT); } else { $mform->setType('name', PARAM_CLEAN); } $mform->addRule('name', null, 'required', null, 'client'); $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); $mform->addHelpButton('name', 'gboardname', 'gboard'); $this->add_intro_editor(); $mform->addElement('header', 'gboardfieldset', get_string('gboardfieldset', 'gboard')); $this->standard_coursemodule_elements(); $this->add_action_buttons(); } } ?>`