[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/tag/ -> edit_form.php (source)

   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  
  18  /**
  19   * @package    core_tag
  20   * @category   tag
  21   * @copyright  2007 Luiz Cruz <[email protected]>
  22   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  
  25  if (!defined('MOODLE_INTERNAL')) {
  26      die('Direct access to this script is forbidden.');    ///  It must be included from a Moodle page
  27  }
  28  
  29  require_once($CFG->dirroot.'/lib/formslib.php');
  30  
  31  /**
  32   * Defines the form for editing tags
  33   *
  34   * @package    core_tag
  35   * @category   tag
  36   * @copyright  2007 Luiz Cruz <[email protected]>
  37   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  38   */
  39  class tag_edit_form extends moodleform {
  40  
  41      /**
  42       * Overrides the abstract moodleform::definition method for defining what the form that is to be
  43       * presented to the user.
  44       */
  45      function definition () {
  46  
  47          $mform =& $this->_form;
  48  
  49          $mform->addElement('header', 'tag', get_string('description','tag'));
  50  
  51          $mform->addElement('hidden', 'id');
  52          $mform->setType('id', PARAM_INT);
  53  
  54          $systemcontext   = context_system::instance();
  55  
  56          if (has_capability('moodle/tag:manage', $systemcontext)) {
  57              $mform->addElement('text', 'rawname', get_string('name', 'tag'),
  58                      'maxlength="'.TAG_MAX_LENGTH.'" size="'.TAG_MAX_LENGTH.'"');
  59              $mform->setType('rawname', PARAM_NOTAGS);
  60          }
  61  
  62          $mform->addElement('editor', 'description_editor', get_string('description', 'tag'), null, $this->_customdata['editoroptions']);
  63  
  64          if (has_capability('moodle/tag:manage', $systemcontext)) {
  65             $mform->addElement('checkbox', 'tagtype', get_string('officialtag', 'tag'));
  66          }
  67  
  68          $mform->addElement('html', '<br/><div id="relatedtags-autocomplete-container">');
  69          $mform->addElement('textarea', 'relatedtags', get_string('relatedtags','tag'), 'cols="50" rows="3"');
  70          $mform->setType('relatedtags', PARAM_TAGLIST);
  71          $mform->addElement('html', '<div id="relatedtags-autocomplete"></div>');
  72          $mform->addElement('html', '</div>');
  73  
  74          $this->add_action_buttons(false, get_string('updatetag', 'tag'));
  75  
  76      }
  77  
  78  }


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1