See Release Notes
Long Term Support Release
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 * This file defines the main tool registration configuration form 19 * 20 * @package mod_lti 21 * @copyright 2014 Vital Source Technologies http://vitalsource.com 22 * @author Stephen Vickers 23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 */ 25 26 defined('MOODLE_INTERNAL') || die; 27 28 require_once($CFG->libdir.'/formslib.php'); 29 require_once($CFG->dirroot.'/mod/lti/locallib.php'); 30 31 /** 32 * The mod_lti_register_types_form class. 33 * 34 * @package mod_lti 35 * @since Moodle 2.8 36 * @copyright 2014 Vital Source Technologies http://vitalsource.com 37 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 38 */ 39 class mod_lti_register_types_form extends moodleform { 40 41 /** 42 * Set up the form definition. 43 */ 44 public function definition() { 45 global $CFG; 46 47 $mform =& $this->_form; 48 49 $mform->addElement('header', 'setup', get_string('registration_options', 'lti')); 50 51 // Tool Provider name. 52 53 $strrequired = get_string('required'); 54 $mform->addElement('text', 'lti_registrationname', get_string('registrationname', 'lti')); 55 $mform->setType('lti_registrationname', PARAM_TEXT); 56 $mform->addHelpButton('lti_registrationname', 'registrationname', 'lti'); 57 $mform->addRule('lti_registrationname', $strrequired, 'required', null, 'client'); 58 59 // Registration URL. 60 61 $mform->addElement('text', 'lti_registrationurl', get_string('registrationurl', 'lti'), array('size' => '64')); 62 $mform->setType('lti_registrationurl', PARAM_URL); 63 $mform->addHelpButton('lti_registrationurl', 'registrationurl', 'lti'); 64 $mform->addRule('lti_registrationurl', $strrequired, 'required', null, 'client'); 65 66 // LTI Capabilities. 67 68 $options = array_keys(lti_get_capabilities()); 69 natcasesort($options); 70 $attributes = array( 'multiple' => 1, 'size' => min(count($options), 10) ); 71 $mform->addElement('select', 'lti_capabilities', get_string('capabilities', 'lti'), 72 array_combine($options, $options), $attributes); 73 $mform->setType('lti_capabilities', PARAM_TEXT); 74 $mform->addHelpButton('lti_capabilities', 'capabilities', 'lti'); 75 $mform->addRule('lti_capabilities', $strrequired, 'required', null, 'client'); 76 77 // LTI Services. 78 79 $services = lti_get_services(); 80 $options = array(); 81 foreach ($services as $service) { 82 $options[$service->get_id()] = $service->get_name(); 83 } 84 $attributes = array( 'multiple' => 1, 'size' => min(count($options), 10) ); 85 $mform->addElement('select', 'lti_services', get_string('services', 'lti'), $options, $attributes); 86 $mform->setType('lti_services', PARAM_TEXT); 87 $mform->addHelpButton('lti_services', 'services', 'lti'); 88 $mform->addRule('lti_services', $strrequired, 'required', null, 'client'); 89 90 $mform->addElement('hidden', 'toolproxyid'); 91 $mform->setType('toolproxyid', PARAM_INT); 92 93 $tab = optional_param('tab', '', PARAM_ALPHAEXT); 94 $mform->addElement('hidden', 'tab', $tab); 95 $mform->setType('tab', PARAM_ALPHAEXT); 96 97 $courseid = optional_param('course', 1, PARAM_INT); 98 $mform->addElement('hidden', 'course', $courseid); 99 $mform->setType('course', PARAM_INT); 100 101 // Add standard buttons, common to all modules. 102 103 $this->add_action_buttons(); 104 } 105 106 /** 107 * Set up rules for disabling fields. 108 */ 109 public function disable_fields() { 110 111 $mform =& $this->_form; 112 113 $mform->disabledIf('lti_registrationurl', null); 114 $mform->disabledIf('lti_capabilities', null); 115 $mform->disabledIf('lti_services', null); 116 117 } 118 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body