weekly release 2.3dev
[moodle.git] / tag / edit_form.php
CommitLineData
18ec15e8 1<?php
c933a060 2
000ebd5c
DM
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.
14//
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/>.
17
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
23 */
24
bfebaf64
MD
25if (!defined('MOODLE_INTERNAL')) {
26 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
27}
28
c933a060 29require_once($CFG->dirroot.'/lib/formslib.php');
30
31class tag_edit_form extends moodleform {
32
7e6e76a6 33 function definition () {
c933a060 34
7e6e76a6 35 $mform =& $this->_form;
d4be9d6d 36
c933a060 37 $mform->addElement('header', 'tag', get_string('description','tag'));
d4be9d6d 38
c933a060 39 $mform->addElement('hidden', 'id');
d18e0fe6 40 $mform->setType('id', PARAM_INT);
d4be9d6d 41
7e6e76a6 42 $systemcontext = get_context_instance(CONTEXT_SYSTEM);
43
44 if (has_capability('moodle/tag:manage', $systemcontext)) {
6bfe7aac 45 $mform->addElement('text', 'rawname', get_string('name', 'tag'),
7e6e76a6 46 'maxlength="'.TAG_MAX_LENGTH.'" size="'.TAG_MAX_LENGTH.'"');
47 }
48
8bdc9cac 49 $mform->addElement('editor', 'description_editor', get_string('description', 'tag'), null, $this->_customdata['editoroptions']);
d4be9d6d 50
603443b5 51 if (has_capability('moodle/tag:manage', $systemcontext)) {
6bfe7aac 52 $mform->addElement('checkbox', 'tagtype', get_string('officialtag', 'tag'));
603443b5 53 }
54
c933a060 55 $mform->addElement('html', '<br/><div id="relatedtags-autocomplete-container">');
56 $mform->addElement('textarea', 'relatedtags', get_string('relatedtags','tag'), 'cols="50" rows="3"');
0d626493 57 $mform->setType('relatedtags', PARAM_TAGLIST);
c933a060 58 $mform->addElement('html', '<div id="relatedtags-autocomplete"></div>');
18ec15e8 59 $mform->addElement('html', '</div>');
d4be9d6d 60
c933a060 61 $this->add_action_buttons(false, get_string('updatetag', 'tag'));
d4be9d6d 62
c933a060 63 }
64
65}