MDL-78251 tiny: Reduce use of UI for setting test expectations
[moodle.git] / mod / lti / toolconfigure.php
blob2b7bc00bc232c5fea34c6df4e5cf24c26b5feba0
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.
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/>.
17 /**
18 * This page allows the configuration of external tools that meet the LTI specification.
20 * @package mod_lti
21 * @copyright 2015 Ryan Wyllie <ryan@moodle.com>
22 * @author Ryan Wyllie
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');
37 if ($cartridgeurl) {
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("{$SITE->shortname}: " . 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();