PageRenderTime 47ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/tag/edit_form.php

https://bitbucket.org/synergylearning/campusconnect
PHP | 78 lines | 29 code | 17 blank | 32 comment | 3 complexity | 459a2795a36f770c09b1d883aa9ee3d4 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, LGPL-3.0, GPL-3.0, LGPL-2.1, Apache-2.0, BSD-3-Clause, AGPL-3.0
  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. * @package core_tag
  18. * @category tag
  19. * @copyright 2007 Luiz Cruz <luiz.laydner@gmail.com>
  20. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  21. */
  22. if (!defined('MOODLE_INTERNAL')) {
  23. die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
  24. }
  25. require_once($CFG->dirroot.'/lib/formslib.php');
  26. /**
  27. * Defines the form for editing tags
  28. *
  29. * @package core_tag
  30. * @category tag
  31. * @copyright 2007 Luiz Cruz <luiz.laydner@gmail.com>
  32. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  33. */
  34. class tag_edit_form extends moodleform {
  35. /**
  36. * Overrides the abstract moodleform::definition method for defining what the form that is to be
  37. * presented to the user.
  38. */
  39. function definition () {
  40. $mform =& $this->_form;
  41. $mform->addElement('header', 'tag', get_string('description','tag'));
  42. $mform->addElement('hidden', 'id');
  43. $mform->setType('id', PARAM_INT);
  44. $systemcontext = context_system::instance();
  45. if (has_capability('moodle/tag:manage', $systemcontext)) {
  46. $mform->addElement('text', 'rawname', get_string('name', 'tag'),
  47. 'maxlength="'.TAG_MAX_LENGTH.'" size="'.TAG_MAX_LENGTH.'"');
  48. $mform->setType('rawname', PARAM_NOTAGS);
  49. }
  50. $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'));
  53. }
  54. $mform->addElement('html', '<br/><div id="relatedtags-autocomplete-container">');
  55. $mform->addElement('textarea', 'relatedtags', get_string('relatedtags','tag'), 'cols="50" rows="3"');
  56. $mform->setType('relatedtags', PARAM_TAGLIST);
  57. $mform->addElement('html', '<div id="relatedtags-autocomplete"></div>');
  58. $mform->addElement('html', '</div>');
  59. $this->add_action_buttons(false, get_string('updatetag', 'tag'));
  60. }
  61. }