2 // This file is part of Moodle - http://moodle.org/
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.
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.
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/>.
18 * This page allows the configuration of external tools that meet the LTI specification.
21 * @copyright 2015 Ryan Wyllie <ryan@moodle.com>
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26 require_once('../../config.php');
27 require_once($CFG->libdir
.'/adminlib.php');
28 require_once($CFG->dirroot
.'/mod/lti/lib.php');
29 require_once($CFG->dirroot
.'/mod/lti/locallib.php');
31 $cartridgeurl = optional_param('cartridgeurl', '', PARAM_URL
);
33 // No guest autologin.
34 require_login(0, false);
35 admin_externalpage_setup('ltitoolconfigure');
38 $type = new stdClass();
39 $data = new stdClass();
40 $type->state
= LTI_TOOL_STATE_CONFIGURED
;
41 $data->lti_coursevisible
= 1;
42 lti_load_type_from_cartridge($cartridgeurl, $data);
43 lti_add_type($type, $data);
46 $pageurl = new moodle_url('/mod/lti/toolconfigure.php');
47 $PAGE->set_url($pageurl);
48 $PAGE->set_title(get_string('toolregistration', 'mod_lti'));
49 $PAGE->requires
->string_for_js('success', 'moodle');
50 $PAGE->requires
->string_for_js('error', 'moodle');
51 $PAGE->requires
->string_for_js('successfullycreatedtooltype', 'mod_lti');
52 $PAGE->requires
->string_for_js('failedtocreatetooltype', 'mod_lti');
53 $output = $PAGE->get_renderer('mod_lti');
55 echo $output->header();
57 $page = new \mod_lti\output\tool_configure_page
();
58 echo $output->render($page);
60 echo $output->footer();