Commit | Line | Data |
---|---|---|
6831c7cd | 1 | <?php |
61eb12d4 CS |
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 | * MRTODO: Brief description of this file | |
19 | * | |
20 | * @package mod | |
21 | * @subpackage xml | |
22 | * @copyright 2011 onwards MRTODO | |
23 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | |
24 | */ | |
6831c7cd CS |
25 | |
26 | require_once(dirname(__FILE__) . "/../../config.php"); | |
27 | require_once($CFG->dirroot . '/mod/lti/locallib.php'); | |
28 | ||
29 | $courseid = required_param('course', PARAM_INT); | |
30 | ||
31 | require_login($courseid, false); | |
32 | ||
33 | $action = required_param('action', PARAM_TEXT); | |
34 | ||
35 | $response = new stdClass(); | |
36 | ||
37 | switch($action){ | |
38 | case 'find_tool_config': | |
39 | $toolurl = required_param('toolurl', PARAM_RAW); | |
40 | ||
41 | $tool = lti_get_tool_by_url_match($toolurl, $courseid); | |
42 | ||
43 | if(!empty($tool)){ | |
44 | $response->toolid = $tool->id; | |
45 | $response->toolname = htmlspecialchars($tool->name); | |
16e8f130 | 46 | $response->tooldomain = htmlspecialchars($tool->tooldomain); |
6831c7cd CS |
47 | } |
48 | ||
49 | break; | |
50 | } | |
51 | ||
52 | echo json_encode($response); | |
53 | ||
61eb12d4 | 54 | die; |