A couple bugfixes related to instructor defined tools
[moodle.git] / mod / lti / ajax.php
CommitLineData
6831c7cd
CS
1<?php
2
3require_once(dirname(__FILE__) . "/../../config.php");
4require_once($CFG->dirroot . '/mod/lti/locallib.php');
5
6$courseid = required_param('course', PARAM_INT);
7
8require_login($courseid, false);
9
10$action = required_param('action', PARAM_TEXT);
11
12$response = new stdClass();
13
14switch($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
28echo json_encode($response);
29
30die;