Merge branch 'MDL-26365' of git://github.com/timhunt/moodle
[moodle.git] / tag / edit_form.php
blobf1e828620ccd742457471d7602211b39d1da3814
1 <?php
3 // This file is part of Moodle - http://moodle.org/
4 //
5 // Moodle is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // Moodle is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 /**
19 * @package core
20 * @subpackage tag
21 * @copyright 2007 Luiz Cruz <luiz.laydner@gmail.com>
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 if (!defined('MOODLE_INTERNAL')) {
26 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
29 require_once($CFG->dirroot.'/lib/formslib.php');
31 class tag_edit_form extends moodleform {
33 function definition () {
35 $mform =& $this->_form;
37 $mform->addElement('header', 'tag', get_string('description','tag'));
39 $mform->addElement('hidden', 'id');
40 $mform->setType('id', PARAM_INT);
42 $systemcontext = get_context_instance(CONTEXT_SYSTEM);
44 if (has_capability('moodle/tag:manage', $systemcontext)) {
45 $mform->addElement('text', 'rawname', get_string('name', 'tag'),
46 'maxlength="'.TAG_MAX_LENGTH.'" size="'.TAG_MAX_LENGTH.'"');
49 $mform->addElement('editor', 'description_editor', get_string('description', 'tag'), null, $this->_customdata['editoroptions']);
51 if (has_capability('moodle/tag:manage', $systemcontext)) {
52 $mform->addElement('checkbox', 'tagtype', get_string('officialtag', 'tag'));
55 $mform->addElement('html', '<br/><div id="relatedtags-autocomplete-container">');
56 $mform->addElement('textarea', 'relatedtags', get_string('relatedtags','tag'), 'cols="50" rows="3"');
57 $mform->setType('relatedtags', PARAM_TAGLIST);
58 $mform->addElement('html', '<div id="relatedtags-autocomplete"></div>');
59 $mform->addElement('html', '</div>');
61 $this->add_action_buttons(false, get_string('updatetag', 'tag'));