1 | <?php |
||
2 | /* For licensing terms, see /license.txt */ |
||
3 | |||
4 | session_cache_limiter('none'); |
||
5 | |||
6 | require_once __DIR__.'/../inc/global.inc.php'; |
||
7 | |||
8 | $questionId = isset($_GET['question_id']) ? (int) $_GET['question_id'] : 0; |
||
9 | $exerciseId = isset($_GET['exe_id']) ? (int) $_GET['exe_id'] : 0; |
||
10 | $courseId = isset($_GET['course_id']) ? (int) $_GET['course_id'] : 0; |
||
11 | $courseInfo = api_get_course_info_by_id($courseId); |
||
12 | |||
13 | if (empty($courseInfo)) { |
||
14 | return ''; |
||
15 | } |
||
16 | |||
17 | $objQuestion = Question::read($questionId, $courseInfo); |
||
18 | $documentPath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'; |
||
19 | $picturePath = $documentPath.'/images'; |
||
20 | $pictureSize = getimagesize($picturePath.'/'.$objQuestion->getPictureFilename()); |
||
21 | $pictureWidth = $pictureSize[0]; |
||
22 | $pictureHeight = $pictureSize[1]; |
||
23 | |||
24 | $data = [ |
||
25 | 'use' => 'user', |
||
26 | 'image' => [ |
||
27 | 'path' => $objQuestion->selectPicturePath(), |
||
28 | 'width' => $pictureSize[0], |
||
29 | 'height' => $pictureSize[1], |
||
30 | ], |
||
31 | 'answers' => [ |
||
32 | 'paths' => [], |
||
33 | 'texts' => [], |
||
34 | ], |
||
35 | ]; |
||
36 | |||
37 | $questionAttempt = Event::getQuestionAttemptByExeIdAndQuestion($exerciseId, $questionId); |
||
0 ignored issues
–
show
|
|||
38 | |||
39 | if (!empty($questionAttempt['answer'])) { |
||
40 | $answers = explode('|', $questionAttempt['answer']); |
||
41 | foreach ($answers as $answer) { |
||
42 | $parts = explode(')(', $answer); |
||
43 | $typeProperties = array_shift($parts); |
||
44 | $properties = explode(';', $typeProperties); |
||
45 | |||
46 | switch ($properties[0]) { |
||
47 | case 'P': |
||
48 | $points = []; |
||
49 | foreach ($parts as $partPoint) { |
||
50 | $points[] = Geometry::decodePoint($partPoint); |
||
51 | } |
||
52 | $data['answers']['paths'][] = [ |
||
53 | 'color' => $properties[1] ?? '#FF0000', |
||
54 | 'points' => $points, |
||
55 | ]; |
||
56 | break; |
||
57 | case 'T': |
||
58 | $text = [ |
||
59 | 'text' => array_shift($parts), |
||
60 | 'color' => $properties[1] ?? '#FF0000', |
||
61 | 'fontSize' => $properties[2] ?? '20', |
||
62 | ]; |
||
63 | |||
64 | $data['answers']['texts'][] = $text + Geometry::decodePoint($parts[0]); |
||
65 | break; |
||
66 | } |
||
67 | } |
||
68 | } |
||
69 | |||
70 | header('Content-Type: application/json'); |
||
71 | |||
72 | echo json_encode($data); |
||
73 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.