@@ -6,7 +6,7 @@ |
||
6 | 6 | 'jpeg' => 'image/jpeg', |
7 | 7 | 'bmp' => 'image/bmp', |
8 | 8 | 'webp' => 'image/webp', |
9 | - 'pdf' => 'application/pdf' |
|
9 | + 'pdf' => 'application/pdf' |
|
10 | 10 | ); |
11 | 11 | |
12 | 12 | ?> |
13 | 13 | \ No newline at end of file |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php |
2 | - // You must first create a file "savefile_config.php" in this extensions directory and do whatever |
|
3 | - // checking of user credentials, etc. that you wish; otherwise anyone will be able to post SVG |
|
4 | - // files to your server which may cause disk space or possibly security problems |
|
5 | - require('savefile_config.php'); |
|
6 | - if (!isset($_POST['output_svg'])) { |
|
7 | - print "You must supply output_svg"; |
|
8 | - exit; |
|
9 | - } |
|
10 | - $svg = $_POST['output_svg']; |
|
11 | - $filename = (isset($_POST['filename']) && !empty($_POST['filename']) ? preg_replace('@[\\\\/:*?"<>|]@u', '_', $_POST['filename']) : 'saved') . '.svg'; // These characters are indicated as prohibited by Windows |
|
2 | + // You must first create a file "savefile_config.php" in this extensions directory and do whatever |
|
3 | + // checking of user credentials, etc. that you wish; otherwise anyone will be able to post SVG |
|
4 | + // files to your server which may cause disk space or possibly security problems |
|
5 | + require('savefile_config.php'); |
|
6 | + if (!isset($_POST['output_svg'])) { |
|
7 | + print "You must supply output_svg"; |
|
8 | + exit; |
|
9 | + } |
|
10 | + $svg = $_POST['output_svg']; |
|
11 | + $filename = (isset($_POST['filename']) && !empty($_POST['filename']) ? preg_replace('@[\\\\/:*?"<>|]@u', '_', $_POST['filename']) : 'saved') . '.svg'; // These characters are indicated as prohibited by Windows |
|
12 | 12 | |
13 | - $fh = fopen($filename, 'w') or die("Can't open file"); |
|
14 | - fwrite($fh, $svg); |
|
15 | - fclose($fh); |
|
13 | + $fh = fopen($filename, 'w') or die("Can't open file"); |
|
14 | + fwrite($fh, $svg); |
|
15 | + fclose($fh); |
|
16 | 16 | ?> |
@@ -16,19 +16,19 @@ discard block |
||
16 | 16 | //get all files and folders |
17 | 17 | $scan_files = []; |
18 | 18 | if (is_dir($user_disk_path)) { |
19 | - $scan_files = scandir($user_disk_path); |
|
19 | + $scan_files = scandir($user_disk_path); |
|
20 | 20 | } |
21 | 21 | //get all svg and png files |
22 | 22 | $accepted_extensions = array('.svg', '.png'); |
23 | 23 | |
24 | 24 | if (is_array($scan_files) && count($scan_files) > 0) { |
25 | - foreach ($scan_files as & $file) { |
|
26 | - $slideshow_extension = strrchr($file, '.'); |
|
27 | - $slideshow_extension = strtolower($slideshow_extension); |
|
28 | - if (in_array($slideshow_extension, $accepted_extensions)) { |
|
29 | - $png_svg_files[] =$file; |
|
30 | - } |
|
31 | - } |
|
25 | + foreach ($scan_files as & $file) { |
|
26 | + $slideshow_extension = strrchr($file, '.'); |
|
27 | + $slideshow_extension = strtolower($slideshow_extension); |
|
28 | + if (in_array($slideshow_extension, $accepted_extensions)) { |
|
29 | + $png_svg_files[] =$file; |
|
30 | + } |
|
31 | + } |
|
32 | 32 | } |
33 | 33 | $style = '<style>'; |
34 | 34 | $style .= '@import "'.api_get_path(WEB_CSS_PATH).'base.css";'; |
@@ -47,23 +47,23 @@ discard block |
||
47 | 47 | echo '<h2>'.get_lang('SocialNetwork').': '.get_lang('MyFiles').'</h2>'; |
48 | 48 | |
49 | 49 | if (!empty($png_svg_files)) { |
50 | - echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>'; |
|
51 | - echo '<ul>'; |
|
52 | - foreach($png_svg_files as $filename) { |
|
53 | - $image = $user_disk_path.$filename; |
|
50 | + echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>'; |
|
51 | + echo '<ul>'; |
|
52 | + foreach($png_svg_files as $filename) { |
|
53 | + $image = $user_disk_path.$filename; |
|
54 | 54 | |
55 | - if (strpos($filename, "svg")){ |
|
56 | - $new_sizes['width'] = 60; |
|
57 | - $new_sizes['height'] = 60; |
|
58 | - } else { |
|
59 | - $new_sizes = api_resize_image($image, 60, 60); |
|
60 | - } |
|
55 | + if (strpos($filename, "svg")){ |
|
56 | + $new_sizes['width'] = 60; |
|
57 | + $new_sizes['height'] = 60; |
|
58 | + } else { |
|
59 | + $new_sizes = api_resize_image($image, 60, 60); |
|
60 | + } |
|
61 | 61 | |
62 | - echo '<li style="display:inline; padding:8px;"><a href="'.$user_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$user_web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>'; |
|
63 | - } |
|
64 | - echo '</ul>'; |
|
62 | + echo '<li style="display:inline; padding:8px;"><a href="'.$user_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$user_web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>'; |
|
63 | + } |
|
64 | + echo '</ul>'; |
|
65 | 65 | } else { |
66 | - Display::display_warning_message(get_lang('NoSVGImages')); |
|
66 | + Display::display_warning_message(get_lang('NoSVGImages')); |
|
67 | 67 | } |
68 | 68 | ?> |
69 | 69 | </body> |
@@ -23,22 +23,22 @@ discard block |
||
23 | 23 | $array_to_search = is_array($docs_and_folders) ? $docs_and_folders : array(); |
24 | 24 | |
25 | 25 | if (count($array_to_search) > 0) { |
26 | - while (list($key) = each($array_to_search)) { |
|
27 | - $all_files[] = basename($array_to_search[$key]['path']); |
|
28 | - } |
|
26 | + while (list($key) = each($array_to_search)) { |
|
27 | + $all_files[] = basename($array_to_search[$key]['path']); |
|
28 | + } |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | //get all svg and png files |
32 | 32 | $accepted_extensions = array('.svg', '.png'); |
33 | 33 | |
34 | 34 | if (is_array($all_files) && count($all_files) > 0) { |
35 | - foreach ($all_files as & $file) { |
|
36 | - $slideshow_extension = strrchr($file, '.'); |
|
37 | - $slideshow_extension = strtolower($slideshow_extension); |
|
38 | - if (in_array($slideshow_extension, $accepted_extensions)) { |
|
39 | - $png_svg_files[] =$file; |
|
40 | - } |
|
41 | - } |
|
35 | + foreach ($all_files as & $file) { |
|
36 | + $slideshow_extension = strrchr($file, '.'); |
|
37 | + $slideshow_extension = strtolower($slideshow_extension); |
|
38 | + if (in_array($slideshow_extension, $accepted_extensions)) { |
|
39 | + $png_svg_files[] =$file; |
|
40 | + } |
|
41 | + } |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | $disk_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document/images/gallery/'; |
@@ -57,24 +57,24 @@ discard block |
||
57 | 57 | <?php |
58 | 58 | echo '<h2>'.get_lang('Course').': '.$course_info['name'].'</h2>'; |
59 | 59 | if (!empty($png_svg_files)) { |
60 | - echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>'; |
|
61 | - echo '<ul>'; |
|
62 | - foreach($png_svg_files as $filename) { |
|
63 | - $image=$disk_path.$filename; |
|
64 | - |
|
65 | - if (strpos($filename, "svg")){ |
|
66 | - $new_sizes['width'] = 60; |
|
67 | - $new_sizes['height'] = 60; |
|
68 | - } |
|
69 | - else { |
|
70 | - $new_sizes = api_resize_image($image, 60, 60); |
|
71 | - } |
|
72 | - |
|
73 | - echo '<li style="display:inline; padding:8px;"><a href="'.$web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>'; |
|
74 | - } |
|
75 | - echo '</ul>'; |
|
60 | + echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>'; |
|
61 | + echo '<ul>'; |
|
62 | + foreach($png_svg_files as $filename) { |
|
63 | + $image=$disk_path.$filename; |
|
64 | + |
|
65 | + if (strpos($filename, "svg")){ |
|
66 | + $new_sizes['width'] = 60; |
|
67 | + $new_sizes['height'] = 60; |
|
68 | + } |
|
69 | + else { |
|
70 | + $new_sizes = api_resize_image($image, 60, 60); |
|
71 | + } |
|
72 | + |
|
73 | + echo '<li style="display:inline; padding:8px;"><a href="'.$web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>'; |
|
74 | + } |
|
75 | + echo '</ul>'; |
|
76 | 76 | } else { |
77 | - Display::display_warning_message(get_lang('NoSVGImagesInImagesGalleryPath')); |
|
77 | + Display::display_warning_message(get_lang('NoSVGImagesInImagesGalleryPath')); |
|
78 | 78 | } |
79 | 79 | ?> |
80 | 80 | </body> |
@@ -17,25 +17,25 @@ discard block |
||
17 | 17 | */ |
18 | 18 | class ExerciseShowFunctions |
19 | 19 | { |
20 | - /** |
|
21 | - * Shows the answer to a fill-in-the-blanks question, as HTML |
|
20 | + /** |
|
21 | + * Shows the answer to a fill-in-the-blanks question, as HTML |
|
22 | 22 | * @param int $feedbackType |
23 | - * @param string $answer |
|
24 | - * @param int $id Exercise ID |
|
25 | - * @param int $questionId Question ID |
|
23 | + * @param string $answer |
|
24 | + * @param int $id Exercise ID |
|
25 | + * @param int $questionId Question ID |
|
26 | 26 | * @param int $resultsDisabled |
27 | 27 | * @param string $originalStudentAnswer |
28 | 28 | * |
29 | - * @return void |
|
30 | - */ |
|
31 | - public static function display_fill_in_blanks_answer( |
|
32 | - $feedbackType, |
|
33 | - $answer, |
|
34 | - $id, |
|
35 | - $questionId, |
|
36 | - $resultsDisabled, |
|
37 | - $originalStudentAnswer = '', |
|
38 | - $showTotalScoreAndUserChoices |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public static function display_fill_in_blanks_answer( |
|
32 | + $feedbackType, |
|
33 | + $answer, |
|
34 | + $id, |
|
35 | + $questionId, |
|
36 | + $resultsDisabled, |
|
37 | + $originalStudentAnswer = '', |
|
38 | + $showTotalScoreAndUserChoices |
|
39 | 39 | ) { |
40 | 40 | $answerHTML = FillBlanks::getHtmlDisplayForAnswer($answer, $resultsDisabled, $showTotalScoreAndUserChoices); |
41 | 41 | if (strpos($originalStudentAnswer, 'font color') !== false) { |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | </tr> |
65 | 65 | <?php |
66 | 66 | } |
67 | - } |
|
67 | + } |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Shows the answer to a calculated question, as HTML |
@@ -105,20 +105,20 @@ discard block |
||
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | - /** |
|
109 | - * Shows the answer to a free-answer question, as HTML |
|
110 | - * @param string Answer text |
|
111 | - * @param int Exercise ID |
|
112 | - * @param int Question ID |
|
113 | - * @return void |
|
114 | - */ |
|
115 | - public static function display_free_answer( |
|
116 | - $feedback_type, |
|
117 | - $answer, |
|
118 | - $exe_id, |
|
119 | - $questionId, |
|
120 | - $questionScore = null, |
|
121 | - $results_disabled = 0 |
|
108 | + /** |
|
109 | + * Shows the answer to a free-answer question, as HTML |
|
110 | + * @param string Answer text |
|
111 | + * @param int Exercise ID |
|
112 | + * @param int Question ID |
|
113 | + * @return void |
|
114 | + */ |
|
115 | + public static function display_free_answer( |
|
116 | + $feedback_type, |
|
117 | + $answer, |
|
118 | + $exe_id, |
|
119 | + $questionId, |
|
120 | + $questionScore = null, |
|
121 | + $results_disabled = 0 |
|
122 | 122 | ) { |
123 | 123 | $comments = Event::get_comments($exe_id, $questionId); |
124 | 124 | |
@@ -136,17 +136,17 @@ discard block |
||
136 | 136 | echo '</tr>'; |
137 | 137 | } |
138 | 138 | } |
139 | - } |
|
139 | + } |
|
140 | 140 | |
141 | 141 | /** |
142 | - * @param $feedback_type |
|
143 | - * @param $answer |
|
144 | - * @param $id |
|
145 | - * @param $questionId |
|
146 | - * @param null $nano |
|
147 | - * @param int $results_disabled |
|
142 | + * @param $feedback_type |
|
143 | + * @param $answer |
|
144 | + * @param $id |
|
145 | + * @param $questionId |
|
146 | + * @param null $nano |
|
147 | + * @param int $results_disabled |
|
148 | 148 | */ |
149 | - public static function display_oral_expression_answer($feedback_type, $answer, $id, $questionId, $fileUrl = null, $results_disabled = 0) |
|
149 | + public static function display_oral_expression_answer($feedback_type, $answer, $id, $questionId, $fileUrl = null, $results_disabled = 0) |
|
150 | 150 | { |
151 | 151 | if (isset($fileUrl)) { |
152 | 152 | echo ' |
@@ -184,8 +184,8 @@ discard block |
||
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
187 | - /** |
|
188 | - * Displays the answer to a hotspot question |
|
187 | + /** |
|
188 | + * Displays the answer to a hotspot question |
|
189 | 189 | * @param int $feedback_type |
190 | 190 | * @param int $answerId |
191 | 191 | * @param string $answer |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * @param int $resultsDisabled |
195 | 195 | * @param int $orderColor |
196 | 196 | */ |
197 | - public static function display_hotspot_answer( |
|
197 | + public static function display_hotspot_answer( |
|
198 | 198 | $feedback_type, |
199 | 199 | $answerId, |
200 | 200 | $answer, |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | } |
218 | 218 | } |
219 | 219 | |
220 | - $hotspot_colors = array( |
|
220 | + $hotspot_colors = array( |
|
221 | 221 | "", // $i starts from 1 on next loop (ugly fix) |
222 | 222 | "#4271B5", |
223 | 223 | "#FE8E16", |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | "#F7BDE2" |
235 | 235 | ); |
236 | 236 | |
237 | - ?> |
|
237 | + ?> |
|
238 | 238 | <table class="data_table"> |
239 | 239 | <tr> |
240 | 240 | <td class="text-center" width="5%"> |
@@ -246,10 +246,10 @@ discard block |
||
246 | 246 | <td class="text-left" width="10%"> |
247 | 247 | <?php |
248 | 248 | if (!$hide_expected_answer) { |
249 | - $my_choice = $studentChoice ? get_lang('Correct') : get_lang('Fault'); |
|
250 | - echo $my_choice; |
|
249 | + $my_choice = $studentChoice ? get_lang('Correct') : get_lang('Fault'); |
|
250 | + echo $my_choice; |
|
251 | 251 | } |
252 | - ?> |
|
252 | + ?> |
|
253 | 253 | </td> |
254 | 254 | <?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> |
255 | 255 | <td class="text-left" width="60%"> |
@@ -257,29 +257,29 @@ discard block |
||
257 | 257 | if ($studentChoice) { |
258 | 258 | echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
259 | 259 | } |
260 | - ?> |
|
260 | + ?> |
|
261 | 261 | </td> |
262 | 262 | <?php } else { ?> |
263 | 263 | <td class="text-left" width="60%"> </td> |
264 | 264 | <?php } ?> |
265 | 265 | </tr> |
266 | 266 | <?php |
267 | - } |
|
268 | - |
|
269 | - /** |
|
270 | - * Display the answers to a multiple choice question |
|
271 | - * @param int $feedback_type Feedback type |
|
272 | - * @param integer Answer type |
|
273 | - * @param integer Student choice |
|
274 | - * @param string Textual answer |
|
275 | - * @param string Comment on answer |
|
276 | - * @param string Correct answer comment |
|
277 | - * @param integer Exercise ID |
|
278 | - * @param integer Question ID |
|
279 | - * @param boolean Whether to show the answer comment or not |
|
280 | - * @return void |
|
281 | - */ |
|
282 | - public static function display_unique_or_multiple_answer( |
|
267 | + } |
|
268 | + |
|
269 | + /** |
|
270 | + * Display the answers to a multiple choice question |
|
271 | + * @param int $feedback_type Feedback type |
|
272 | + * @param integer Answer type |
|
273 | + * @param integer Student choice |
|
274 | + * @param string Textual answer |
|
275 | + * @param string Comment on answer |
|
276 | + * @param string Correct answer comment |
|
277 | + * @param integer Exercise ID |
|
278 | + * @param integer Question ID |
|
279 | + * @param boolean Whether to show the answer comment or not |
|
280 | + * @return void |
|
281 | + */ |
|
282 | + public static function display_unique_or_multiple_answer( |
|
283 | 283 | $feedback_type, |
284 | 284 | $answerType, |
285 | 285 | $studentChoice, |
@@ -307,14 +307,14 @@ discard block |
||
307 | 307 | } |
308 | 308 | |
309 | 309 | $icon = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio':'checkbox'; |
310 | - $icon .= $studentChoice?'_on':'_off'; |
|
311 | - $icon .= '.gif'; |
|
310 | + $icon .= $studentChoice?'_on':'_off'; |
|
311 | + $icon .= '.gif'; |
|
312 | 312 | |
313 | - $iconAnswer = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio':'checkbox'; |
|
314 | - $iconAnswer .= $answerCorrect?'_on':'_off'; |
|
315 | - $iconAnswer .= '.gif'; |
|
313 | + $iconAnswer = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio':'checkbox'; |
|
314 | + $iconAnswer .= $answerCorrect?'_on':'_off'; |
|
315 | + $iconAnswer .= '.gif'; |
|
316 | 316 | |
317 | - ?> |
|
317 | + ?> |
|
318 | 318 | <tr> |
319 | 319 | <td width="5%"> |
320 | 320 | <?php echo Display::return_icon($icon); ?> |
@@ -328,39 +328,39 @@ discard block |
||
328 | 328 | </td> |
329 | 329 | <td width="40%"> |
330 | 330 | <?php |
331 | - echo $answer; |
|
332 | - ?> |
|
331 | + echo $answer; |
|
332 | + ?> |
|
333 | 333 | </td> |
334 | 334 | |
335 | 335 | <?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> |
336 | 336 | <td width="20%"> |
337 | 337 | <?php |
338 | 338 | if ($studentChoice) { |
339 | - if ($answerCorrect) { |
|
339 | + if ($answerCorrect) { |
|
340 | 340 | $color = 'green'; |
341 | - //echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
|
342 | - } else { |
|
341 | + //echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
|
342 | + } else { |
|
343 | 343 | $color = 'black'; |
344 | 344 | //echo '<span style="font-weight: bold; color: #FF0000;">'.nl2br($answerComment).'</span>'; |
345 | - } |
|
346 | - if ($hide_expected_answer) { |
|
347 | - $color = ''; |
|
348 | - } |
|
345 | + } |
|
346 | + if ($hide_expected_answer) { |
|
347 | + $color = ''; |
|
348 | + } |
|
349 | 349 | echo '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>'; |
350 | - } |
|
351 | - ?> |
|
350 | + } |
|
351 | + ?> |
|
352 | 352 | </td> |
353 | 353 | <?php |
354 | - if ($ans==1) { |
|
355 | - $comm = Event::get_comments($id,$questionId); |
|
356 | - } |
|
357 | - ?> |
|
354 | + if ($ans==1) { |
|
355 | + $comm = Event::get_comments($id,$questionId); |
|
356 | + } |
|
357 | + ?> |
|
358 | 358 | <?php } else { ?> |
359 | 359 | <td> </td> |
360 | 360 | <?php } ?> |
361 | 361 | </tr> |
362 | 362 | <?php |
363 | - } |
|
363 | + } |
|
364 | 364 | |
365 | 365 | /** |
366 | 366 | * Display the answers to a multiple choice question |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | if (isset($new_options[$studentChoice])) { |
414 | 414 | echo get_lang($new_options[$studentChoice]['name']); |
415 | 415 | } else { |
416 | - echo '-'; |
|
416 | + echo '-'; |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | ?> |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | <td width="5%"> |
422 | 422 | <?php |
423 | 423 | |
424 | - //Expected choice |
|
424 | + //Expected choice |
|
425 | 425 | if (!$hide_expected_answer) { |
426 | 426 | if (isset($new_options[$answerCorrect])) { |
427 | 427 | echo get_lang($new_options[$answerCorrect]['name']); |
@@ -447,8 +447,8 @@ discard block |
||
447 | 447 | } |
448 | 448 | |
449 | 449 | if ($hide_expected_answer) { |
450 | - $color = ''; |
|
451 | - } |
|
450 | + $color = ''; |
|
451 | + } |
|
452 | 452 | |
453 | 453 | echo '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>'; |
454 | 454 | } |
@@ -466,19 +466,19 @@ discard block |
||
466 | 466 | <?php |
467 | 467 | } |
468 | 468 | |
469 | - /** |
|
470 | - * Display the answers to a multiple choice question |
|
471 | - * |
|
472 | - * @param integer Answer type |
|
473 | - * @param integer Student choice |
|
474 | - * @param string Textual answer |
|
475 | - * @param string Comment on answer |
|
476 | - * @param string Correct answer comment |
|
477 | - * @param integer Exercise ID |
|
478 | - * @param integer Question ID |
|
479 | - * @param boolean Whether to show the answer comment or not |
|
480 | - * @return void |
|
481 | - */ |
|
469 | + /** |
|
470 | + * Display the answers to a multiple choice question |
|
471 | + * |
|
472 | + * @param integer Answer type |
|
473 | + * @param integer Student choice |
|
474 | + * @param string Textual answer |
|
475 | + * @param string Comment on answer |
|
476 | + * @param string Correct answer comment |
|
477 | + * @param integer Exercise ID |
|
478 | + * @param integer Question ID |
|
479 | + * @param boolean Whether to show the answer comment or not |
|
480 | + * @return void |
|
481 | + */ |
|
482 | 482 | public static function display_multiple_answer_combination_true_false( |
483 | 483 | $feedback_type, |
484 | 484 | $answerType, |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | <tr> |
510 | 510 | <td width="5%"> |
511 | 511 | <?php |
512 | - //Your choice |
|
512 | + //Your choice |
|
513 | 513 | $question = new MultipleAnswerCombinationTrueFalse(); |
514 | 514 | if (isset($question->options[$studentChoice])) { |
515 | 515 | echo $question->options[$studentChoice]; |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | </td> |
521 | 521 | <td width="5%"> |
522 | 522 | <?php |
523 | - //Expected choice |
|
523 | + //Expected choice |
|
524 | 524 | if (!$hide_expected_answer) { |
525 | 525 | if (isset($question->options[$answerCorrect])) { |
526 | 526 | echo $question->options[$answerCorrect]; |
@@ -545,14 +545,14 @@ discard block |
||
545 | 545 | <?php |
546 | 546 | //@todo replace this harcoded value |
547 | 547 | if ($studentChoice) { |
548 | - $color = "black"; |
|
548 | + $color = "black"; |
|
549 | 549 | if ($studentChoice == $answerCorrect) { |
550 | 550 | $color = "green"; |
551 | 551 | } |
552 | - //echo '<span style="font-weight: bold; color: #000;">'.nl2br($answerComment).'</span>'; |
|
552 | + //echo '<span style="font-weight: bold; color: #000;">'.nl2br($answerComment).'</span>'; |
|
553 | 553 | if ($hide_expected_answer) { |
554 | 554 | $color = ''; |
555 | - } |
|
555 | + } |
|
556 | 556 | echo '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>'; |
557 | 557 | } |
558 | 558 | ?> |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | // We exit here if there is no valid $_GET parameter |
45 | 45 | if (!isset($_GET['survey_id']) || !is_numeric($_GET['survey_id'])) { |
46 | 46 | api_not_allowed(true, Display::return_message(get_lang('InvallidSurvey'), 'error', false)); |
47 | - exit; |
|
47 | + exit; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | // Getting the survey information |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | |
54 | 54 | if (empty($survey_data)) { |
55 | 55 | api_not_allowed(true, Display::return_message(get_lang('InvallidSurvey'), 'error', false)); |
56 | - exit; |
|
56 | + exit; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | $urlname = strip_tags($survey_data['title']); |
60 | 60 | if (api_is_allowed_to_edit()) { |
61 | - // Breadcrumbs |
|
62 | - $interbreadcrumb[] = array( |
|
61 | + // Breadcrumbs |
|
62 | + $interbreadcrumb[] = array( |
|
63 | 63 | 'url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq(), |
64 | 64 | 'name' => get_lang('SurveyList') |
65 | 65 | ); |
@@ -86,57 +86,57 @@ discard block |
||
86 | 86 | $counter_question = 0; |
87 | 87 | // Only a course admin is allowed to preview a survey: you are a course admin |
88 | 88 | if (api_is_course_admin() || |
89 | - (api_is_course_admin() && $_GET['isStudentView'] == 'true') || |
|
90 | - api_is_allowed_to_session_edit(false, true) |
|
89 | + (api_is_course_admin() && $_GET['isStudentView'] == 'true') || |
|
90 | + api_is_allowed_to_session_edit(false, true) |
|
91 | 91 | ) { |
92 | - // Survey information |
|
93 | - echo '<div id="survey_title">'.$survey_data['survey_title'].'</div>'; |
|
94 | - echo '<div id="survey_subtitle">'.$survey_data['survey_subtitle'].'</div>'; |
|
92 | + // Survey information |
|
93 | + echo '<div id="survey_title">'.$survey_data['survey_title'].'</div>'; |
|
94 | + echo '<div id="survey_subtitle">'.$survey_data['survey_subtitle'].'</div>'; |
|
95 | 95 | |
96 | - // Displaying the survey introduction |
|
97 | - if (!isset($_GET['show'])) { |
|
96 | + // Displaying the survey introduction |
|
97 | + if (!isset($_GET['show'])) { |
|
98 | 98 | if (!empty($survey_data['survey_introduction'])) { |
99 | 99 | echo '<div id="survey_content" class="survey_content">'.$survey_data['survey_introduction'].'</div>'; |
100 | 100 | } |
101 | - $limit = 0; |
|
102 | - } |
|
101 | + $limit = 0; |
|
102 | + } |
|
103 | 103 | |
104 | - // Displaying the survey thanks message |
|
105 | - if (isset($_POST['finish_survey'])) { |
|
106 | - Display::display_confirmation_message(get_lang('SurveyFinished')); |
|
104 | + // Displaying the survey thanks message |
|
105 | + if (isset($_POST['finish_survey'])) { |
|
106 | + Display::display_confirmation_message(get_lang('SurveyFinished')); |
|
107 | 107 | echo $survey_data['survey_thanks']; |
108 | - Display :: display_footer(); |
|
109 | - exit; |
|
110 | - } |
|
108 | + Display :: display_footer(); |
|
109 | + exit; |
|
110 | + } |
|
111 | 111 | |
112 | 112 | $questions = array(); |
113 | 113 | |
114 | - if (isset($_GET['show'])) { |
|
115 | - // Getting all the questions for this page and add them to a |
|
116 | - // multidimensional array where the first index is the page. |
|
117 | - // as long as there is no pagebreak fount we keep adding questions to the page |
|
118 | - $questions_displayed = array(); |
|
119 | - $paged_questions = array(); |
|
120 | - $counter = 0; |
|
121 | - $sql = "SELECT * FROM $table_survey_question |
|
114 | + if (isset($_GET['show'])) { |
|
115 | + // Getting all the questions for this page and add them to a |
|
116 | + // multidimensional array where the first index is the page. |
|
117 | + // as long as there is no pagebreak fount we keep adding questions to the page |
|
118 | + $questions_displayed = array(); |
|
119 | + $paged_questions = array(); |
|
120 | + $counter = 0; |
|
121 | + $sql = "SELECT * FROM $table_survey_question |
|
122 | 122 | WHERE c_id = $course_id AND survey_id = '".intval($survey_id)."' |
123 | 123 | ORDER BY sort ASC"; |
124 | - $result = Database::query($sql); |
|
124 | + $result = Database::query($sql); |
|
125 | 125 | $questions_exists = true; |
126 | 126 | if (Database::num_rows($result)) { |
127 | - while ($row = Database::fetch_array($result)) { |
|
128 | - if ($row['type'] == 'pagebreak') { |
|
129 | - $counter++; |
|
130 | - } else { |
|
131 | - $paged_questions[$counter][] = $row['question_id']; |
|
132 | - } |
|
133 | - } |
|
127 | + while ($row = Database::fetch_array($result)) { |
|
128 | + if ($row['type'] == 'pagebreak') { |
|
129 | + $counter++; |
|
130 | + } else { |
|
131 | + $paged_questions[$counter][] = $row['question_id']; |
|
132 | + } |
|
133 | + } |
|
134 | 134 | } else { |
135 | 135 | $questions_exists = false; |
136 | 136 | } |
137 | 137 | |
138 | - if (array_key_exists($_GET['show'], $paged_questions)) { |
|
139 | - $sql = "SELECT |
|
138 | + if (array_key_exists($_GET['show'], $paged_questions)) { |
|
139 | + $sql = "SELECT |
|
140 | 140 | survey_question.question_id, |
141 | 141 | survey_question.survey_id, |
142 | 142 | survey_question.survey_question, |
@@ -158,75 +158,75 @@ discard block |
||
158 | 158 | survey_question.c_id = $course_id |
159 | 159 | ORDER BY survey_question.sort, survey_question_option.sort ASC"; |
160 | 160 | |
161 | - $result = Database::query($sql); |
|
162 | - $question_counter_max = Database::num_rows($result); |
|
163 | - $limit = 0; |
|
164 | - while ($row = Database::fetch_array($result)) { |
|
165 | - // If the type is not a pagebreak we store it in the $questions array |
|
166 | - if ($row['type'] != 'pagebreak') { |
|
167 | - $questions[$row['sort']]['question_id'] = $row['question_id']; |
|
168 | - $questions[$row['sort']]['survey_id'] = $row['survey_id']; |
|
169 | - $questions[$row['sort']]['survey_question'] = $row['survey_question']; |
|
170 | - $questions[$row['sort']]['display'] = $row['display']; |
|
171 | - $questions[$row['sort']]['type'] = $row['type']; |
|
172 | - $questions[$row['sort']]['options'][intval($row['option_sort'])] = $row['option_text']; |
|
173 | - $questions[$row['sort']]['maximum_score'] = $row['max_value']; |
|
174 | - } else { |
|
175 | - // If the type is a pagebreak we are finished loading the questions for this page |
|
176 | - break; |
|
177 | - } |
|
178 | - $counter_question++; |
|
179 | - } |
|
180 | - } |
|
181 | - } |
|
182 | - |
|
183 | - // Selecting the maximum number of pages |
|
184 | - $sql = "SELECT * FROM $table_survey_question |
|
161 | + $result = Database::query($sql); |
|
162 | + $question_counter_max = Database::num_rows($result); |
|
163 | + $limit = 0; |
|
164 | + while ($row = Database::fetch_array($result)) { |
|
165 | + // If the type is not a pagebreak we store it in the $questions array |
|
166 | + if ($row['type'] != 'pagebreak') { |
|
167 | + $questions[$row['sort']]['question_id'] = $row['question_id']; |
|
168 | + $questions[$row['sort']]['survey_id'] = $row['survey_id']; |
|
169 | + $questions[$row['sort']]['survey_question'] = $row['survey_question']; |
|
170 | + $questions[$row['sort']]['display'] = $row['display']; |
|
171 | + $questions[$row['sort']]['type'] = $row['type']; |
|
172 | + $questions[$row['sort']]['options'][intval($row['option_sort'])] = $row['option_text']; |
|
173 | + $questions[$row['sort']]['maximum_score'] = $row['max_value']; |
|
174 | + } else { |
|
175 | + // If the type is a pagebreak we are finished loading the questions for this page |
|
176 | + break; |
|
177 | + } |
|
178 | + $counter_question++; |
|
179 | + } |
|
180 | + } |
|
181 | + } |
|
182 | + |
|
183 | + // Selecting the maximum number of pages |
|
184 | + $sql = "SELECT * FROM $table_survey_question |
|
185 | 185 | WHERE |
186 | 186 | c_id = $course_id AND |
187 | 187 | type='".Database::escape_string('pagebreak')."' AND |
188 | 188 | survey_id='".intval($survey_id)."'"; |
189 | - $result = Database::query($sql); |
|
190 | - $numberofpages = Database::num_rows($result) + 1; |
|
191 | - |
|
192 | - // Displaying the form with the questions |
|
193 | - if (isset($_GET['show'])) { |
|
194 | - $show = (int)$_GET['show'] + 1; |
|
195 | - } else { |
|
196 | - $show = 0; |
|
197 | - } |
|
198 | - |
|
199 | - $url = api_get_self().'?survey_id='.Security::remove_XSS($survey_id).'&show='.$show; |
|
200 | - $form = new FormValidator('question', 'post', $url); |
|
201 | - |
|
202 | - if (is_array($questions) && count($questions) > 0) { |
|
203 | - foreach ($questions as $key => & $question) { |
|
204 | - $ch_type = 'ch_'.$question['type']; |
|
205 | - /** @var survey_question $display */ |
|
206 | - $display = new $ch_type; |
|
207 | - $form->addHtml('<div class="survey_question_wrapper"><div class="survey_question">'); |
|
208 | - $form->addHtml($question['survey_question']); |
|
209 | - $display->render($form, $question); |
|
210 | - $form->addHtml('</div></div>'); |
|
211 | - } |
|
212 | - } |
|
213 | - |
|
214 | - if (($show < $numberofpages) || (!$_GET['show'] && count($questions) > 0)) { |
|
189 | + $result = Database::query($sql); |
|
190 | + $numberofpages = Database::num_rows($result) + 1; |
|
191 | + |
|
192 | + // Displaying the form with the questions |
|
193 | + if (isset($_GET['show'])) { |
|
194 | + $show = (int)$_GET['show'] + 1; |
|
195 | + } else { |
|
196 | + $show = 0; |
|
197 | + } |
|
198 | + |
|
199 | + $url = api_get_self().'?survey_id='.Security::remove_XSS($survey_id).'&show='.$show; |
|
200 | + $form = new FormValidator('question', 'post', $url); |
|
201 | + |
|
202 | + if (is_array($questions) && count($questions) > 0) { |
|
203 | + foreach ($questions as $key => & $question) { |
|
204 | + $ch_type = 'ch_'.$question['type']; |
|
205 | + /** @var survey_question $display */ |
|
206 | + $display = new $ch_type; |
|
207 | + $form->addHtml('<div class="survey_question_wrapper"><div class="survey_question">'); |
|
208 | + $form->addHtml($question['survey_question']); |
|
209 | + $display->render($form, $question); |
|
210 | + $form->addHtml('</div></div>'); |
|
211 | + } |
|
212 | + } |
|
213 | + |
|
214 | + if (($show < $numberofpages) || (!$_GET['show'] && count($questions) > 0)) { |
|
215 | 215 | if ($show == 0) { |
216 | - $form->addButton('next_survey_page', get_lang('StartSurvey'), 'arrow-right', 'success', 'large'); |
|
216 | + $form->addButton('next_survey_page', get_lang('StartSurvey'), 'arrow-right', 'success', 'large'); |
|
217 | 217 | } else { |
218 | - $form->addButton('next_survey_page', get_lang('NextQuestion'), 'arrow-right'); |
|
218 | + $form->addButton('next_survey_page', get_lang('NextQuestion'), 'arrow-right'); |
|
219 | 219 | } |
220 | - } |
|
221 | - if ($show >= $numberofpages && $_GET['show'] || (isset($_GET['show']) && count($questions) == 0)) { |
|
222 | - if ($questions_exists == false) { |
|
223 | - echo '<p>'.get_lang('ThereAreNotQuestionsForthisSurvey').'</p>'; |
|
224 | - } |
|
225 | - $form->addButton('finish_survey', get_lang('FinishSurvey'), 'arrow-right'); |
|
226 | - } |
|
227 | - $form->display(); |
|
220 | + } |
|
221 | + if ($show >= $numberofpages && $_GET['show'] || (isset($_GET['show']) && count($questions) == 0)) { |
|
222 | + if ($questions_exists == false) { |
|
223 | + echo '<p>'.get_lang('ThereAreNotQuestionsForthisSurvey').'</p>'; |
|
224 | + } |
|
225 | + $form->addButton('finish_survey', get_lang('FinishSurvey'), 'arrow-right'); |
|
226 | + } |
|
227 | + $form->display(); |
|
228 | 228 | } else { |
229 | - Display :: display_error_message(get_lang('NotAllowed'), false); |
|
229 | + Display :: display_error_message(get_lang('NotAllowed'), false); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | Display :: display_footer(); |
@@ -94,12 +94,12 @@ |
||
94 | 94 | */ |
95 | 95 | protected $assignedLastUser; |
96 | 96 | |
97 | - /** |
|
98 | - * @var Status |
|
99 | - * |
|
100 | - * @ORM\ManyToOne(targetEntity="Chamilo\TicketBundle\Entity\Status") |
|
101 | - * @ORM\JoinColumn(name="status_id", referencedColumnName="id") |
|
102 | - **/ |
|
97 | + /** |
|
98 | + * @var Status |
|
99 | + * |
|
100 | + * @ORM\ManyToOne(targetEntity="Chamilo\TicketBundle\Entity\Status") |
|
101 | + * @ORM\JoinColumn(name="status_id", referencedColumnName="id") |
|
102 | + **/ |
|
103 | 103 | protected $status; |
104 | 104 | |
105 | 105 | /** |
@@ -56,7 +56,7 @@ |
||
56 | 56 | */ |
57 | 57 | protected $filename; |
58 | 58 | |
59 | - /** |
|
59 | + /** |
|
60 | 60 | * @var integer |
61 | 61 | * |
62 | 62 | * @ORM\Column(name="size", type="integer", nullable=false, unique=false) |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | // When creating a new course this settings are added to the course |
12 | 12 | public $course_settings = array( |
13 | - array( |
|
13 | + array( |
|
14 | 14 | 'name' => 'course_block_pre_footer', |
15 | 15 | 'type' => 'textarea' |
16 | 16 | ), |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
69 | - * @param string $region |
|
70 | - * @return string |
|
71 | - */ |
|
69 | + * @param string $region |
|
70 | + * @return string |
|
71 | + */ |
|
72 | 72 | public function renderRegion($region) |
73 | 73 | { |
74 | 74 | $content = ''; |