|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 // This file is part of Moodle - http://moodle.org/ 00004 // 00005 // Moodle is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // Moodle is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00017 00025 if (!defined('MOODLE_INTERNAL')) { 00026 die('Direct access to this script is forbidden.'); 00027 } 00028 00029 require_once($CFG->dirroot.'/lib/formslib.php'); 00030 00031 class tag_edit_form extends moodleform { 00032 00033 function definition () { 00034 00035 $mform =& $this->_form; 00036 00037 $mform->addElement('header', 'tag', get_string('description','tag')); 00038 00039 $mform->addElement('hidden', 'id'); 00040 $mform->setType('id', PARAM_INT); 00041 00042 $systemcontext = get_context_instance(CONTEXT_SYSTEM); 00043 00044 if (has_capability('moodle/tag:manage', $systemcontext)) { 00045 $mform->addElement('text', 'rawname', get_string('name', 'tag'), 00046 'maxlength="'.TAG_MAX_LENGTH.'" size="'.TAG_MAX_LENGTH.'"'); 00047 } 00048 00049 $mform->addElement('editor', 'description_editor', get_string('description', 'tag'), null, $this->_customdata['editoroptions']); 00050 00051 if (has_capability('moodle/tag:manage', $systemcontext)) { 00052 $mform->addElement('checkbox', 'tagtype', get_string('officialtag', 'tag')); 00053 } 00054 00055 $mform->addElement('html', '<br/><div id="relatedtags-autocomplete-container">'); 00056 $mform->addElement('textarea', 'relatedtags', get_string('relatedtags','tag'), 'cols="50" rows="3"'); 00057 $mform->setType('relatedtags', PARAM_TAGLIST); 00058 $mform->addElement('html', '<div id="relatedtags-autocomplete"></div>'); 00059 $mform->addElement('html', '</div>'); 00060 00061 $this->add_action_buttons(false, get_string('updatetag', 'tag')); 00062 00063 } 00064 00065 }