3 if (!defined('MOODLE_INTERNAL')) {
4 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
7 require_once($CFG->dirroot
.'/lib/formslib.php');
9 class tag_edit_form
extends moodleform
{
11 function definition () {
13 $mform =& $this->_form
;
15 $mform->addElement('header', 'tag', get_string('description','tag'));
17 $mform->addElement('hidden', 'id');
18 $mform->setType('id', PARAM_INT
);
20 $systemcontext = get_context_instance(CONTEXT_SYSTEM
);
22 if (has_capability('moodle/tag:manage', $systemcontext)) {
23 $mform->addElement('text', 'rawname', get_string('name', 'tag'),
24 'maxlength="'.TAG_MAX_LENGTH
.'" size="'.TAG_MAX_LENGTH
.'"');
27 $mform->addElement('editor', 'description_editor', get_string('description', 'tag'), null, $this->_customdata
['editoroptions']);
29 if (has_capability('moodle/tag:manage', $systemcontext)) {
30 $mform->addElement('checkbox', 'tagtype', get_string('officialtag', 'tag'));
33 $mform->addElement('html', '<br/><div id="relatedtags-autocomplete-container">');
34 $mform->addElement('textarea', 'relatedtags', get_string('relatedtags','tag'), 'cols="50" rows="3"');
35 $mform->setType('relatedtags', PARAM_TAGLIST
);
36 $mform->addElement('html', '<div id="relatedtags-autocomplete"></div>');
37 $mform->addElement('html', '</div>');
39 $this->add_action_buttons(false, get_string('updatetag', 'tag'));