Differences Between: [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]
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 * Form for editing tours. 19 * 20 * @package tool_usertours 21 * @copyright 2016 Andrew Nicols <andrew@nicols.co.uk> 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 namespace tool_usertours\local\forms; 26 27 defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); 28 29 require_once($CFG->libdir . '/formslib.php'); 30 31 use \tool_usertours\helper; 32 33 /** 34 * Form for editing tours. 35 * 36 * @copyright 2016 Andrew Nicols <andrew@nicols.co.uk> 37 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 38 */ 39 class edittour extends \moodleform { 40 /** 41 * @var tool_usertours\tour $tour 42 */ 43 protected $tour; 44 45 /** 46 * Create the edit tour form. 47 * 48 * @param tour $tour The tour being editted. 49 */ 50 public function __construct(\tool_usertours\tour $tour) { 51 $this->tour = $tour; 52 53 parent::__construct($tour->get_edit_link()); 54 } 55 56 /** 57 * Form definition. 58 */ 59 public function definition() { 60 $mform = $this->_form; 61 62 // ID of existing tour. 63 $mform->addElement('hidden', 'id'); 64 $mform->setType('id', PARAM_INT); 65 66 // Name of the tour. 67 $mform->addElement('text', 'name', get_string('name', 'tool_usertours')); 68 $mform->addRule('name', get_string('required'), 'required', null, 'client'); 69 $mform->setType('name', PARAM_TEXT); 70 71 // Admin-only descriptions. 72 $mform->addElement('textarea', 'description', get_string('description', 'tool_usertours')); 73 $mform->setType('description', PARAM_RAW); 74 75 // Application. 76 $mform->addElement('text', 'pathmatch', get_string('pathmatch', 'tool_usertours')); 77 $mform->setType('pathmatch', PARAM_RAW); 78 $mform->addHelpButton('pathmatch', 'pathmatch', 'tool_usertours'); 79 80 $mform->addElement('checkbox', 'enabled', get_string('tourisenabled', 'tool_usertours')); 81 82 // Configuration. 83 $this->tour->add_config_to_form($mform); 84 85 // Filters. 86 $mform->addElement('header', 'filters', get_string('filter_header', 'tool_usertours')); 87 $mform->addElement('static', 'filterhelp', '', get_string('filter_help', 'tool_usertours')); 88 89 foreach (helper::get_all_filters() as $filterclass) { 90 $filterclass::add_filter_to_form($mform); 91 } 92 93 $this->add_action_buttons(); 94 } 95 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body