Commit | Line | Data |
---|---|---|
6831c7cd CS |
1 | <?php |
2 | ||
3 | require_once(dirname(__FILE__) . "/../../config.php"); | |
4 | require_once($CFG->dirroot . '/mod/lti/locallib.php'); | |
5 | ||
6 | $courseid = required_param('course', PARAM_INT); | |
7 | ||
8 | require_login($courseid, false); | |
9 | ||
10 | $action = required_param('action', PARAM_TEXT); | |
11 | ||
12 | $response = new stdClass(); | |
13 | ||
14 | switch($action){ | |
15 | case 'find_tool_config': | |
16 | $toolurl = required_param('toolurl', PARAM_RAW); | |
17 | ||
18 | $tool = lti_get_tool_by_url_match($toolurl, $courseid); | |
19 | ||
20 | if(!empty($tool)){ | |
21 | $response->toolid = $tool->id; | |
22 | $response->toolname = htmlspecialchars($tool->name); | |
23 | } | |
24 | ||
25 | break; | |
26 | } | |
27 | ||
28 | echo json_encode($response); | |
29 | ||
30 | die; |