@@ -132,38 +132,38 @@ discard block |
||
132 | 132 | */ |
133 | 133 | function my_rename($file_path, $new_file_name) { |
134 | 134 | |
135 | - $save_dir = getcwd(); |
|
136 | - $path = dirname($file_path); |
|
137 | - $old_file_name = basename($file_path); |
|
138 | - $new_file_name = api_replace_dangerous_char($new_file_name); |
|
135 | + $save_dir = getcwd(); |
|
136 | + $path = dirname($file_path); |
|
137 | + $old_file_name = basename($file_path); |
|
138 | + $new_file_name = api_replace_dangerous_char($new_file_name); |
|
139 | 139 | |
140 | - // If no extension, take the old one |
|
141 | - if ((strpos($new_file_name, '.') === false) && ($dotpos = strrpos($old_file_name, '.'))) { |
|
142 | - $new_file_name .= substr($old_file_name, $dotpos); |
|
143 | - } |
|
140 | + // If no extension, take the old one |
|
141 | + if ((strpos($new_file_name, '.') === false) && ($dotpos = strrpos($old_file_name, '.'))) { |
|
142 | + $new_file_name .= substr($old_file_name, $dotpos); |
|
143 | + } |
|
144 | 144 | |
145 | - // Note: still possible: 'xx.yy' -rename-> '.yy' -rename-> 'zz' |
|
146 | - // This is useful for folder names, where otherwise '.' would be sticky |
|
145 | + // Note: still possible: 'xx.yy' -rename-> '.yy' -rename-> 'zz' |
|
146 | + // This is useful for folder names, where otherwise '.' would be sticky |
|
147 | 147 | |
148 | - // Extension PHP is not allowed, change to PHPS |
|
149 | - $new_file_name = php2phps($new_file_name); |
|
148 | + // Extension PHP is not allowed, change to PHPS |
|
149 | + $new_file_name = php2phps($new_file_name); |
|
150 | 150 | |
151 | - if ($new_file_name == $old_file_name) { |
|
152 | - return $old_file_name; |
|
153 | - } |
|
151 | + if ($new_file_name == $old_file_name) { |
|
152 | + return $old_file_name; |
|
153 | + } |
|
154 | 154 | |
155 | - if (strtolower($new_file_name) != strtolower($old_file_name) && check_name_exist($path.'/'.$new_file_name)) { |
|
156 | - return false; |
|
157 | - } |
|
158 | - // On a Windows server, it would be better not to do the above check |
|
159 | - // because it succeeds for some new names resembling the old name. |
|
160 | - // But on Unix/Linux the check must be done because rename overwrites. |
|
155 | + if (strtolower($new_file_name) != strtolower($old_file_name) && check_name_exist($path.'/'.$new_file_name)) { |
|
156 | + return false; |
|
157 | + } |
|
158 | + // On a Windows server, it would be better not to do the above check |
|
159 | + // because it succeeds for some new names resembling the old name. |
|
160 | + // But on Unix/Linux the check must be done because rename overwrites. |
|
161 | 161 | |
162 | - chdir($path); |
|
163 | - $res = rename($old_file_name, $new_file_name) ? $new_file_name : false; |
|
164 | - chdir($save_dir); |
|
162 | + chdir($path); |
|
163 | + $res = rename($old_file_name, $new_file_name) ? $new_file_name : false; |
|
164 | + chdir($save_dir); |
|
165 | 165 | |
166 | - return $res; |
|
166 | + return $res; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $file_name = basename($source); |
186 | 186 | // move onto self illegal: mv a/b/c a/b/c or mv a/b/c a/b |
187 | 187 | if (strcasecmp($target, dirname($source)) === 0) { |
188 | - return false; |
|
188 | + return false; |
|
189 | 189 | } |
190 | 190 | $isWindowsOS = api_is_windows_os(); |
191 | 191 | $canExec = function_exists('exec'); |
@@ -265,8 +265,8 @@ discard block |
||
265 | 265 | */ |
266 | 266 | function getextension($filename) |
267 | 267 | { |
268 | - $bouts = explode('.', $filename); |
|
269 | - return array(array_pop($bouts), implode('.', $bouts)); |
|
268 | + $bouts = explode('.', $filename); |
|
269 | + return array(array_pop($bouts), implode('.', $bouts)); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
@@ -277,17 +277,17 @@ discard block |
||
277 | 277 | * @param boolean $recursive if true , include subdirectory in total |
278 | 278 | */ |
279 | 279 | function dirsize($root, $recursive = true) { |
280 | - $dir = @opendir($root); |
|
281 | - $size = 0; |
|
282 | - while ($file = @readdir($dir)) { |
|
283 | - if (!in_array($file, array('.', '..'))) { |
|
284 | - if (is_dir($root.'/'.$file)) { |
|
285 | - $size += $recursive ? dirsize($root.'/'.$file) : 0; |
|
286 | - } else { |
|
287 | - $size += @filesize($root.'/'.$file); |
|
288 | - } |
|
289 | - } |
|
290 | - } |
|
291 | - @closedir($dir); |
|
292 | - return $size; |
|
280 | + $dir = @opendir($root); |
|
281 | + $size = 0; |
|
282 | + while ($file = @readdir($dir)) { |
|
283 | + if (!in_array($file, array('.', '..'))) { |
|
284 | + if (is_dir($root.'/'.$file)) { |
|
285 | + $size += $recursive ? dirsize($root.'/'.$file) : 0; |
|
286 | + } else { |
|
287 | + $size += @filesize($root.'/'.$file); |
|
288 | + } |
|
289 | + } |
|
290 | + } |
|
291 | + @closedir($dir); |
|
292 | + return $size; |
|
293 | 293 | } |
@@ -204,7 +204,7 @@ |
||
204 | 204 | $settings->setSchemaAlias($schemaAlias); |
205 | 205 | } |
206 | 206 | |
207 | - // We need to get a plain parameters array since we use the options resolver on it |
|
207 | + // We need to get a plain parameters array since we use the options resolver on it |
|
208 | 208 | $parameters = $settings->getParameters(); |
209 | 209 | |
210 | 210 | $settingsBuilder = new SettingsBuilder(); |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | public function getFunctions() |
32 | 32 | { |
33 | 33 | return array( |
34 | - new \Twig_SimpleFunction('chamilo_settings_all', array($this, 'getSettings')), |
|
35 | - new \Twig_SimpleFunction('chamilo_settings_get', array($this, 'getSettingsParameter')), |
|
36 | - new \Twig_SimpleFunction('chamilo_settings_has', [$this, 'hasSettingsParameter']), |
|
34 | + new \Twig_SimpleFunction('chamilo_settings_all', array($this, 'getSettings')), |
|
35 | + new \Twig_SimpleFunction('chamilo_settings_get', array($this, 'getSettingsParameter')), |
|
36 | + new \Twig_SimpleFunction('chamilo_settings_has', [$this, 'hasSettingsParameter']), |
|
37 | 37 | ); |
38 | 38 | } |
39 | 39 | |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | public function getFilters() |
45 | 45 | { |
46 | 46 | return array( |
47 | - //new \Twig_SimpleFunction('chamilo_settings_all', array($this, 'getSettings')), |
|
48 | - new \Twig_SimpleFilter('get_setting', array($this, 'getSettingsParameter')), |
|
49 | - //new \Twig_SimpleFunction('chamilo_settings_has', [$this, 'hasSettingsParameter']), |
|
47 | + //new \Twig_SimpleFunction('chamilo_settings_all', array($this, 'getSettings')), |
|
48 | + new \Twig_SimpleFilter('get_setting', array($this, 'getSettingsParameter')), |
|
49 | + //new \Twig_SimpleFunction('chamilo_settings_has', [$this, 'hasSettingsParameter']), |
|
50 | 50 | ); |
51 | 51 | } |
52 | 52 |
@@ -996,7 +996,7 @@ |
||
996 | 996 | } |
997 | 997 | } |
998 | 998 | |
999 | - return array( |
|
999 | + return array( |
|
1000 | 1000 | 'content' => $html, |
1001 | 1001 | 'tool_list' => $items |
1002 | 1002 | ); |
@@ -728,29 +728,29 @@ |
||
728 | 728 | } |
729 | 729 | |
730 | 730 | /** |
731 | - * Return an array of student state answers for fill the blank questions |
|
732 | - * for each students that answered the question |
|
733 | - * -2 : didn't answer |
|
734 | - * -1 : student answer is wrong |
|
735 | - * 0 : student answer is correct |
|
736 | - * >0 : for fill the blank question with choice menu, is the index of the student answer (right answer indice is 0) |
|
737 | - * |
|
738 | - * @param integer $testId |
|
739 | - * @param integer $questionId |
|
740 | - * @param $studentsIdList |
|
741 | - * @param string $startDate |
|
742 | - * @param string $endDate |
|
743 | - * @param bool $useLastAnswerredAttempt |
|
744 | - * @return array |
|
745 | - * ( |
|
746 | - * [student_id] => Array |
|
747 | - * ( |
|
748 | - * [first fill the blank for question] => -1 |
|
749 | - * [second fill the blank for question] => 2 |
|
750 | - * [third fill the blank for question] => -1 |
|
751 | - * ) |
|
752 | - * ) |
|
753 | - */ |
|
731 | + * Return an array of student state answers for fill the blank questions |
|
732 | + * for each students that answered the question |
|
733 | + * -2 : didn't answer |
|
734 | + * -1 : student answer is wrong |
|
735 | + * 0 : student answer is correct |
|
736 | + * >0 : for fill the blank question with choice menu, is the index of the student answer (right answer indice is 0) |
|
737 | + * |
|
738 | + * @param integer $testId |
|
739 | + * @param integer $questionId |
|
740 | + * @param $studentsIdList |
|
741 | + * @param string $startDate |
|
742 | + * @param string $endDate |
|
743 | + * @param bool $useLastAnswerredAttempt |
|
744 | + * @return array |
|
745 | + * ( |
|
746 | + * [student_id] => Array |
|
747 | + * ( |
|
748 | + * [first fill the blank for question] => -1 |
|
749 | + * [second fill the blank for question] => 2 |
|
750 | + * [third fill the blank for question] => -1 |
|
751 | + * ) |
|
752 | + * ) |
|
753 | + */ |
|
754 | 754 | public static function getFillTheBlankTabResult( |
755 | 755 | $testId, |
756 | 756 | $questionId, |
@@ -1408,7 +1408,7 @@ discard block |
||
1408 | 1408 | $media .= '<div class="col-md-2 col-xs-2 social-post-answers">'; |
1409 | 1409 | $media .= '<div class="user-image pull-right">'; |
1410 | 1410 | $media .= '<a href="'.$url.'" ><img src="'. $users[$userIdLoop]['avatar'] . |
1411 | - '" alt="'.$users[$userIdLoop]['complete_name'].'" class="avatar-thumb"></a>'; |
|
1411 | + '" alt="'.$users[$userIdLoop]['complete_name'].'" class="avatar-thumb"></a>'; |
|
1412 | 1412 | $media .= '</div>'; |
1413 | 1413 | $media .= '</div>'; |
1414 | 1414 | $media .= '<div class="col-md-9 col-xs-9 social-post-answers">'; |
@@ -1623,10 +1623,10 @@ discard block |
||
1623 | 1623 | } |
1624 | 1624 | |
1625 | 1625 | /** |
1626 | - * Delete messages delete logic |
|
1627 | - * @param int $id id message to delete. |
|
1628 | - * @return bool status query |
|
1629 | - */ |
|
1626 | + * Delete messages delete logic |
|
1627 | + * @param int $id id message to delete. |
|
1628 | + * @return bool status query |
|
1629 | + */ |
|
1630 | 1630 | public static function deleteMessage($id) |
1631 | 1631 | { |
1632 | 1632 | $id = intval($id); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | $gradebook = ''; |
60 | 60 | if (isset($_SESSION['gradebook'])) { |
61 | - $gradebook= $_SESSION['gradebook']; |
|
61 | + $gradebook= $_SESSION['gradebook']; |
|
62 | 62 | } |
63 | 63 | if (!empty($gradebook) && $gradebook=='view') { |
64 | 64 | $interbreadcrumb[] = array( |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | $htmlHeadXtra[] = '<link rel="stylesheet" href="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/css/hotspot.css">'; |
79 | 79 | |
80 | 80 | if ($origin != 'learnpath') { |
81 | - // So we are not in learnpath tool |
|
82 | - Display::display_header($nameTools, get_lang('Exercise')); |
|
81 | + // So we are not in learnpath tool |
|
82 | + Display::display_header($nameTools, get_lang('Exercise')); |
|
83 | 83 | } else { |
84 | 84 | $htmlHeadXtra[] = " |
85 | 85 | <style> |
@@ -93,19 +93,19 @@ discard block |
||
93 | 93 | |
94 | 94 | // I'm in a preview mode as course admin. Display the action menu. |
95 | 95 | if (api_is_course_admin() && $origin != 'learnpath') { |
96 | - echo '<div class="actions">'; |
|
97 | - echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'">'. |
|
96 | + echo '<div class="actions">'; |
|
97 | + echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'">'. |
|
98 | 98 | Display::return_icon('back.png', get_lang('GoBackToQuestionList'), array(), 32).'</a>'; |
99 | - echo '<a href="exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id.'">'. |
|
99 | + echo '<a href="exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id.'">'. |
|
100 | 100 | Display::return_icon('edit.png', get_lang('ModifyExercise'), array(), 32).'</a>'; |
101 | - echo '</div>'; |
|
101 | + echo '</div>'; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | $feedback_type = $objExercise->feedback_type; |
105 | 105 | $exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id); |
106 | 106 | |
107 | 107 | if (!empty($exercise_stat_info['data_tracking'])) { |
108 | - $question_list = explode(',', $exercise_stat_info['data_tracking']); |
|
108 | + $question_list = explode(',', $exercise_stat_info['data_tracking']); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | $learnpath_id = $exercise_stat_info['orig_lp_id']; |
@@ -204,11 +204,11 @@ discard block |
||
204 | 204 | Session::erase('objExercise'); |
205 | 205 | Session::erase('exe_id'); |
206 | 206 | } |
207 | - Display::display_footer(); |
|
207 | + Display::display_footer(); |
|
208 | 208 | } else { |
209 | - $lp_mode = isset($_SESSION['lp_mode']) ? $_SESSION['lp_mode'] : null; |
|
210 | - $url = '../lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exercise_stat_info['exe_id'].'&fb_type='.$objExercise->feedback_type.'#atoc_'.$learnpath_item_id; |
|
211 | - $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'"'; |
|
209 | + $lp_mode = isset($_SESSION['lp_mode']) ? $_SESSION['lp_mode'] : null; |
|
210 | + $url = '../lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exercise_stat_info['exe_id'].'&fb_type='.$objExercise->feedback_type.'#atoc_'.$learnpath_item_id; |
|
211 | + $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'"'; |
|
212 | 212 | |
213 | 213 | if (api_is_allowed_to_session_edit()) { |
214 | 214 | Session::erase('objExercise'); |
@@ -217,8 +217,8 @@ discard block |
||
217 | 217 | |
218 | 218 | Session::write('attempt_remaining', $remainingMessage); |
219 | 219 | |
220 | - // Record the results in the learning path, using the SCORM interface (API) |
|
221 | - echo "<script>window.parent.API.void_save_asset('$total_score', '$max_score', 0, 'completed');</script>"; |
|
220 | + // Record the results in the learning path, using the SCORM interface (API) |
|
221 | + echo "<script>window.parent.API.void_save_asset('$total_score', '$max_score', 0, 'completed');</script>"; |
|
222 | 222 | echo '<script type="text/javascript">'.$href.'</script>'; |
223 | - echo '</body></html>'; |
|
223 | + echo '</body></html>'; |
|
224 | 224 | } |
@@ -10,12 +10,12 @@ discard block |
||
10 | 10 | const VISIBLE_STUDENT = 2; |
11 | 11 | const VISIBLE_TEACHER = 3; |
12 | 12 | |
13 | - /** |
|
14 | - * Displays all announcements |
|
15 | - * @param int $visible VISIBLE_GUEST, VISIBLE_STUDENT or VISIBLE_TEACHER |
|
16 | - * @param int $id The identifier of the announcement to display |
|
17 | - */ |
|
18 | - public static function display_announcements($visible, $id = -1) |
|
13 | + /** |
|
14 | + * Displays all announcements |
|
15 | + * @param int $visible VISIBLE_GUEST, VISIBLE_STUDENT or VISIBLE_TEACHER |
|
16 | + * @param int $id The identifier of the announcement to display |
|
17 | + */ |
|
18 | + public static function display_announcements($visible, $id = -1) |
|
19 | 19 | { |
20 | 20 | $user_selected_language = api_get_interface_language(); |
21 | 21 | $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
@@ -423,10 +423,10 @@ discard block |
||
423 | 423 | } |
424 | 424 | |
425 | 425 | /** |
426 | - * Makes the announcement id visible only for groups in groups_array |
|
427 | - * @param int $announcement_id |
|
428 | - * @param array $group_array array of group id |
|
429 | - **/ |
|
426 | + * Makes the announcement id visible only for groups in groups_array |
|
427 | + * @param int $announcement_id |
|
428 | + * @param array $group_array array of group id |
|
429 | + **/ |
|
430 | 430 | public static function announcement_for_groups($announcement_id, $group_array) |
431 | 431 | { |
432 | 432 | $tbl_announcement_group = Database:: get_main_table( |
@@ -459,10 +459,10 @@ discard block |
||
459 | 459 | } |
460 | 460 | |
461 | 461 | /** |
462 | - * Gets the groups of this announce |
|
463 | - * @param int announcement id |
|
464 | - * @return array array of group id |
|
465 | - **/ |
|
462 | + * Gets the groups of this announce |
|
463 | + * @param int announcement id |
|
464 | + * @return array array of group id |
|
465 | + **/ |
|
466 | 466 | public static function get_announcement_groups($announcement_id) |
467 | 467 | { |
468 | 468 | $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS); |
@@ -482,15 +482,15 @@ discard block |
||
482 | 482 | return $groups; |
483 | 483 | } |
484 | 484 | |
485 | - /** |
|
486 | - * Updates an announcement to the database |
|
487 | - * @param integer $id : id of the announcement |
|
488 | - * @param string $title : title of the announcement |
|
489 | - * @param string $content : content of the announcement |
|
490 | - * @param array $date_start: start date of announcement (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute) |
|
491 | - * @param array $date_end : end date of announcement (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute) |
|
492 | - * @return bool True on success, false on failure |
|
493 | - */ |
|
485 | + /** |
|
486 | + * Updates an announcement to the database |
|
487 | + * @param integer $id : id of the announcement |
|
488 | + * @param string $title : title of the announcement |
|
489 | + * @param string $content : content of the announcement |
|
490 | + * @param array $date_start: start date of announcement (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute) |
|
491 | + * @param array $date_end : end date of announcement (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute) |
|
492 | + * @return bool True on success, false on failure |
|
493 | + */ |
|
494 | 494 | public static function update_announcement( |
495 | 495 | $id, |
496 | 496 | $title, |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | $sendEmailTest = false |
506 | 506 | ) { |
507 | 507 | $em = Database::getManager(); |
508 | - $announcement = $em->find('ChamiloCoreBundle:SysAnnouncement', $id); |
|
508 | + $announcement = $em->find('ChamiloCoreBundle:SysAnnouncement', $id); |
|
509 | 509 | |
510 | 510 | if (!$announcement) { |
511 | 511 | return false; |
@@ -529,28 +529,28 @@ discard block |
||
529 | 529 | return false; |
530 | 530 | } |
531 | 531 | |
532 | - if (($date_end_to_compare[1] || |
|
532 | + if (($date_end_to_compare[1] || |
|
533 | 533 | $date_end_to_compare[2] || |
534 | 534 | $date_end_to_compare[0]) && |
535 | 535 | !checkdate($date_end_to_compare[1], $date_end_to_compare[2], $date_end_to_compare[0]) |
536 | 536 | ) { |
537 | - Display :: display_normal_message(get_lang('InvalidEndDate')); |
|
537 | + Display :: display_normal_message(get_lang('InvalidEndDate')); |
|
538 | 538 | |
539 | - return false; |
|
540 | - } |
|
539 | + return false; |
|
540 | + } |
|
541 | 541 | |
542 | - if (strlen(trim($title)) == 0) { |
|
543 | - Display::display_normal_message(get_lang('InvalidTitle')); |
|
542 | + if (strlen(trim($title)) == 0) { |
|
543 | + Display::display_normal_message(get_lang('InvalidTitle')); |
|
544 | 544 | |
545 | - return false; |
|
546 | - } |
|
545 | + return false; |
|
546 | + } |
|
547 | 547 | |
548 | 548 | $start = api_get_utc_datetime($date_start); |
549 | 549 | $end = api_get_utc_datetime($date_end); |
550 | 550 | |
551 | - //Fixing urls that are sent by email |
|
552 | - //$content = str_replace('src=\"/home/', 'src=\"'.api_get_path(WEB_PATH).'home/', $content); |
|
553 | - //$content = str_replace('file=/home/', 'file='.api_get_path(WEB_PATH).'home/', $content); |
|
551 | + //Fixing urls that are sent by email |
|
552 | + //$content = str_replace('src=\"/home/', 'src=\"'.api_get_path(WEB_PATH).'home/', $content); |
|
553 | + //$content = str_replace('file=/home/', 'file='.api_get_path(WEB_PATH).'home/', $content); |
|
554 | 554 | $content = str_replace('src=\"'.api_get_path(REL_HOME_PATH), 'src=\"'.api_get_path(WEB_PATH).api_get_path(REL_HOME_PATH), $content); |
555 | 555 | $content = str_replace('file='.api_get_path(REL_HOME_PATH), 'file='.api_get_path(WEB_PATH).api_get_path(REL_HOME_PATH), $content); |
556 | 556 | |
@@ -592,81 +592,81 @@ discard block |
||
592 | 592 | $em->merge($announcement); |
593 | 593 | $em->flush(); |
594 | 594 | |
595 | - return true; |
|
596 | - } |
|
595 | + return true; |
|
596 | + } |
|
597 | 597 | |
598 | - /** |
|
599 | - * Deletes an announcement |
|
600 | - * @param int $id The identifier of the announcement that should be |
|
601 | - * @return bool True on success, false on failure |
|
602 | - */ |
|
603 | - public static function delete_announcement($id) |
|
598 | + /** |
|
599 | + * Deletes an announcement |
|
600 | + * @param int $id The identifier of the announcement that should be |
|
601 | + * @return bool True on success, false on failure |
|
602 | + */ |
|
603 | + public static function delete_announcement($id) |
|
604 | 604 | { |
605 | - $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
606 | - $id = intval($id); |
|
607 | - $sql = "DELETE FROM ".$db_table." WHERE id =".$id; |
|
608 | - $res = Database::query($sql); |
|
605 | + $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
606 | + $id = intval($id); |
|
607 | + $sql = "DELETE FROM ".$db_table." WHERE id =".$id; |
|
608 | + $res = Database::query($sql); |
|
609 | 609 | if ($res === false) { |
610 | - return false; |
|
611 | - } |
|
612 | - return true; |
|
613 | - } |
|
614 | - |
|
615 | - /** |
|
616 | - * Gets an announcement |
|
617 | - * @param int $id The identifier of the announcement that should be |
|
618 | - * @return object Object of class StdClass or the required class, containing the query result row |
|
619 | - */ |
|
620 | - public static function get_announcement($id) |
|
610 | + return false; |
|
611 | + } |
|
612 | + return true; |
|
613 | + } |
|
614 | + |
|
615 | + /** |
|
616 | + * Gets an announcement |
|
617 | + * @param int $id The identifier of the announcement that should be |
|
618 | + * @return object Object of class StdClass or the required class, containing the query result row |
|
619 | + */ |
|
620 | + public static function get_announcement($id) |
|
621 | 621 | { |
622 | - $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
623 | - $id = intval($id); |
|
624 | - $sql = "SELECT * FROM ".$db_table." WHERE id = ".$id; |
|
625 | - $announcement = Database::fetch_object(Database::query($sql)); |
|
626 | - |
|
627 | - return $announcement; |
|
628 | - } |
|
629 | - |
|
630 | - /** |
|
631 | - * Change the visibility of an announcement |
|
632 | - * @param int $announcement_id |
|
633 | - * @param int $user For who should the visibility be changed |
|
622 | + $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
623 | + $id = intval($id); |
|
624 | + $sql = "SELECT * FROM ".$db_table." WHERE id = ".$id; |
|
625 | + $announcement = Database::fetch_object(Database::query($sql)); |
|
626 | + |
|
627 | + return $announcement; |
|
628 | + } |
|
629 | + |
|
630 | + /** |
|
631 | + * Change the visibility of an announcement |
|
632 | + * @param int $announcement_id |
|
633 | + * @param int $user For who should the visibility be changed |
|
634 | 634 | * (possible values are VISIBLE_TEACHER, VISIBLE_STUDENT, VISIBLE_GUEST) |
635 | - * @return bool True on success, false on failure |
|
636 | - */ |
|
637 | - public static function set_visibility($announcement_id, $user, $visible) |
|
635 | + * @return bool True on success, false on failure |
|
636 | + */ |
|
637 | + public static function set_visibility($announcement_id, $user, $visible) |
|
638 | 638 | { |
639 | - $db_table = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
640 | - $visible = intval($visible); |
|
641 | - $announcement_id = intval($announcement_id); |
|
639 | + $db_table = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
640 | + $visible = intval($visible); |
|
641 | + $announcement_id = intval($announcement_id); |
|
642 | 642 | |
643 | 643 | if (!in_array($user, array(self::VISIBLE_GUEST, self::VISIBLE_STUDENT, self::VISIBLE_TEACHER))) { |
644 | 644 | return false; |
645 | 645 | } |
646 | 646 | |
647 | - $field = ($user == self::VISIBLE_TEACHER ? 'visible_teacher' : ($user == self::VISIBLE_STUDENT ? 'visible_student' : 'visible_guest')); |
|
647 | + $field = ($user == self::VISIBLE_TEACHER ? 'visible_teacher' : ($user == self::VISIBLE_STUDENT ? 'visible_student' : 'visible_guest')); |
|
648 | 648 | |
649 | - $sql = "UPDATE ".$db_table." SET ".$field." = '".$visible."' |
|
649 | + $sql = "UPDATE ".$db_table." SET ".$field." = '".$visible."' |
|
650 | 650 | WHERE id='".$announcement_id."'"; |
651 | - $res = Database::query($sql); |
|
652 | - |
|
653 | - if ($res === false) { |
|
654 | - return false; |
|
655 | - } |
|
656 | - |
|
657 | - return true; |
|
658 | - } |
|
659 | - |
|
660 | - /** |
|
661 | - * Send a system announcement by e-mail to all teachers/students depending on parameters |
|
662 | - * @param string $title |
|
663 | - * @param string $content |
|
664 | - * @param int $teacher Whether to send to all teachers (1) or not (0) |
|
665 | - * @param int $student Whether to send to all students (1) or not (0) |
|
666 | - * @param string $language Language (optional, considered for all languages if left empty) |
|
651 | + $res = Database::query($sql); |
|
652 | + |
|
653 | + if ($res === false) { |
|
654 | + return false; |
|
655 | + } |
|
656 | + |
|
657 | + return true; |
|
658 | + } |
|
659 | + |
|
660 | + /** |
|
661 | + * Send a system announcement by e-mail to all teachers/students depending on parameters |
|
662 | + * @param string $title |
|
663 | + * @param string $content |
|
664 | + * @param int $teacher Whether to send to all teachers (1) or not (0) |
|
665 | + * @param int $student Whether to send to all students (1) or not (0) |
|
666 | + * @param string $language Language (optional, considered for all languages if left empty) |
|
667 | 667 | * @param bool $sendEmailTest |
668 | 668 | * @return bool True if the message was sent or there was no destination matching. False on database or e-mail sending error. |
669 | - */ |
|
669 | + */ |
|
670 | 670 | public static function send_system_announcement_by_email( |
671 | 671 | $title, |
672 | 672 | $content, |
@@ -692,26 +692,26 @@ discard block |
||
692 | 692 | } |
693 | 693 | |
694 | 694 | if ($teacher <> 0 && $student == 0) { |
695 | - $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition |
|
695 | + $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition |
|
696 | 696 | WHERE status = '1' "; |
697 | - } |
|
697 | + } |
|
698 | 698 | |
699 | - if ($teacher == 0 && $student <> 0) { |
|
700 | - $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition |
|
699 | + if ($teacher == 0 && $student <> 0) { |
|
700 | + $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition |
|
701 | 701 | WHERE status = '5' "; |
702 | - } |
|
702 | + } |
|
703 | 703 | |
704 | - if ($teacher<> 0 && $student <> 0) { |
|
705 | - $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition |
|
704 | + if ($teacher<> 0 && $student <> 0) { |
|
705 | + $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition |
|
706 | 706 | WHERE 1 = 1 "; |
707 | - } |
|
707 | + } |
|
708 | 708 | |
709 | - if (!empty($language)) { |
|
710 | - //special condition because language was already treated for SQL insert before |
|
711 | - $sql .= " AND language = '".Database::escape_string($language)."' "; |
|
712 | - } |
|
709 | + if (!empty($language)) { |
|
710 | + //special condition because language was already treated for SQL insert before |
|
711 | + $sql .= " AND language = '".Database::escape_string($language)."' "; |
|
712 | + } |
|
713 | 713 | |
714 | - if (api_is_multiple_url_enabled()) { |
|
714 | + if (api_is_multiple_url_enabled()) { |
|
715 | 715 | $sql .= " AND access_url_id = '".$current_access_url_id."' "; |
716 | 716 | } |
717 | 717 | |
@@ -721,36 +721,36 @@ discard block |
||
721 | 721 | // Expiration date |
722 | 722 | $sql .= " AND (expiration_date = '' OR expiration_date IS NULL OR expiration_date > '$now') "; |
723 | 723 | |
724 | - if ((empty($teacher) || $teacher == '0') && (empty($student) || $student == '0')) { |
|
724 | + if ((empty($teacher) || $teacher == '0') && (empty($student) || $student == '0')) { |
|
725 | 725 | |
726 | - return true; |
|
727 | - } |
|
726 | + return true; |
|
727 | + } |
|
728 | 728 | |
729 | - $result = Database::query($sql); |
|
730 | - if ($result === false) { |
|
729 | + $result = Database::query($sql); |
|
730 | + if ($result === false) { |
|
731 | 731 | |
732 | - return false; |
|
733 | - } |
|
732 | + return false; |
|
733 | + } |
|
734 | 734 | |
735 | 735 | $message_sent = false; |
736 | 736 | |
737 | - while ($row = Database::fetch_array($result,'ASSOC')) { |
|
737 | + while ($row = Database::fetch_array($result,'ASSOC')) { |
|
738 | 738 | MessageManager::send_message_simple($row['user_id'], $title, $content); |
739 | 739 | $message_sent = true; |
740 | - } |
|
740 | + } |
|
741 | 741 | |
742 | - // Minor validation to clean up the attachment files in the announcement |
|
743 | - if (!empty($_FILES)) { |
|
744 | - $attachments = $_FILES; |
|
745 | - foreach ($attachments as $attachment) { |
|
746 | - unlink($attachment['tmp_name']); |
|
747 | - } |
|
748 | - } |
|
742 | + // Minor validation to clean up the attachment files in the announcement |
|
743 | + if (!empty($_FILES)) { |
|
744 | + $attachments = $_FILES; |
|
745 | + foreach ($attachments as $attachment) { |
|
746 | + unlink($attachment['tmp_name']); |
|
747 | + } |
|
748 | + } |
|
749 | 749 | |
750 | - return $message_sent; //true if at least one e-mail was sent |
|
751 | - } |
|
750 | + return $message_sent; //true if at least one e-mail was sent |
|
751 | + } |
|
752 | 752 | |
753 | - /** |
|
753 | + /** |
|
754 | 754 | * Displays announcements as an slideshow |
755 | 755 | * @param int $visible VISIBLE_GUEST, VISIBLE_STUDENT or VISIBLE_TEACHER |
756 | 756 | * @param int $id The identifier of the announcement to display |
@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | $learnpath_id = 0; |
42 | 42 | |
43 | 43 | if (isset($_REQUEST['learnpath_id'])) { |
44 | - $learnpath_id = intval($_REQUEST['learnpath_id']); |
|
44 | + $learnpath_id = intval($_REQUEST['learnpath_id']); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | $learnpath_item_id = 0; |
48 | 48 | |
49 | 49 | if (isset($_REQUEST['learnpath_item_id'])) { |
50 | - $learnpath_item_id = intval($_REQUEST['learnpath_item_id']); |
|
50 | + $learnpath_item_id = intval($_REQUEST['learnpath_item_id']); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | $_SESSION['hotspot_coord']=array(); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | // Getting the options by js |
92 | 92 | if (empty($choice_value)) { |
93 | 93 | |
94 | - echo "<script> |
|
94 | + echo "<script> |
|
95 | 95 | // this works for only radio buttons |
96 | 96 | var f = self.parent.window.document.frm_exercise; |
97 | 97 | var choice_js=''; |
@@ -120,12 +120,12 @@ discard block |
||
120 | 120 | } |
121 | 121 | |
122 | 122 | "; |
123 | - // IMPORTANT |
|
124 | - //this is the real redirect function |
|
125 | - //echo 'window.location.href = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";'; |
|
123 | + // IMPORTANT |
|
124 | + //this is the real redirect function |
|
125 | + //echo 'window.location.href = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";'; |
|
126 | 126 | echo ' url = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";'; |
127 | 127 | echo "$('#global-modal .modal-body').load(url);"; |
128 | - echo '</script>'; |
|
128 | + echo '</script>'; |
|
129 | 129 | |
130 | 130 | exit; |
131 | 131 | } |
@@ -178,12 +178,12 @@ discard block |
||
178 | 178 | |
179 | 179 | // creates a temporary Question object |
180 | 180 | if (in_array($questionid, $questionList)) { |
181 | - $objQuestionTmp = Question :: read($questionid); |
|
182 | - $questionName =$objQuestionTmp->selectTitle(); |
|
183 | - $questionDescription=$objQuestionTmp->selectDescription(); |
|
184 | - $questionWeighting =$objQuestionTmp->selectWeighting(); |
|
185 | - $answerType =$objQuestionTmp->selectType(); |
|
186 | - $quesId =$objQuestionTmp->selectId(); //added by priya saini |
|
181 | + $objQuestionTmp = Question :: read($questionid); |
|
182 | + $questionName =$objQuestionTmp->selectTitle(); |
|
183 | + $questionDescription=$objQuestionTmp->selectDescription(); |
|
184 | + $questionWeighting =$objQuestionTmp->selectWeighting(); |
|
185 | + $answerType =$objQuestionTmp->selectType(); |
|
186 | + $quesId =$objQuestionTmp->selectId(); //added by priya saini |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | $objAnswerTmp=new Answer($questionid); |
@@ -206,43 +206,43 @@ discard block |
||
206 | 206 | $totalScore = 0; |
207 | 207 | |
208 | 208 | if (!empty($choice_value)) { |
209 | - for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) { |
|
210 | - $answer = $objAnswerTmp->selectAnswer($answerId); |
|
211 | - $answerComment = $objAnswerTmp->selectComment($answerId); |
|
212 | - $answerDestination = $objAnswerTmp->selectDestination($answerId); |
|
213 | - |
|
214 | - $answerCorrect = $objAnswerTmp->isCorrect($answerId); |
|
215 | - $answerWeighting = $objAnswerTmp->selectWeighting($answerId); |
|
216 | - $numAnswer = $objAnswerTmp->selectAutoId($answerId); |
|
217 | - |
|
218 | - //delineation |
|
219 | - $delineation_cord = $objAnswerTmp->selectHotspotCoordinates(1); |
|
220 | - $answer_delineation_destination=$objAnswerTmp->selectDestination(1); |
|
209 | + for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) { |
|
210 | + $answer = $objAnswerTmp->selectAnswer($answerId); |
|
211 | + $answerComment = $objAnswerTmp->selectComment($answerId); |
|
212 | + $answerDestination = $objAnswerTmp->selectDestination($answerId); |
|
213 | + |
|
214 | + $answerCorrect = $objAnswerTmp->isCorrect($answerId); |
|
215 | + $answerWeighting = $objAnswerTmp->selectWeighting($answerId); |
|
216 | + $numAnswer = $objAnswerTmp->selectAutoId($answerId); |
|
217 | + |
|
218 | + //delineation |
|
219 | + $delineation_cord = $objAnswerTmp->selectHotspotCoordinates(1); |
|
220 | + $answer_delineation_destination=$objAnswerTmp->selectDestination(1); |
|
221 | 221 | if ($dbg_local>0) { error_log(__LINE__.' answerId: '.$answerId.'('.$answerType.') - user delineation_cord: '.$delineation_cord.' - $answer_delineation_destination: '.$answer_delineation_destination,0);} |
222 | 222 | |
223 | - switch($answerType) { |
|
224 | - // for unique answer |
|
225 | - case UNIQUE_ANSWER : |
|
226 | - $studentChoice = ($choice_value == $numAnswer)?1:0; |
|
227 | - if ($studentChoice) { |
|
228 | - $questionScore +=$answerWeighting; |
|
229 | - $totalScore +=$answerWeighting; |
|
230 | - $newquestionList[]=$questionid; |
|
231 | - } |
|
232 | - break; |
|
233 | - case HOT_SPOT_DELINEATION : |
|
234 | - $studentChoice=$choice[$answerId]; |
|
235 | - if ($studentChoice) { |
|
236 | - $newquestionList[]=$questionid; |
|
237 | - } |
|
238 | - if ($answerId===1) { |
|
239 | - $questionScore +=$answerWeighting; |
|
240 | - $totalScore +=$answerWeighting; |
|
241 | - $_SESSION['hotspot_coord'][1] =$delineation_cord; |
|
242 | - $_SESSION['hotspot_dest'][1] =$answer_delineation_destination; |
|
243 | - } |
|
244 | - break; |
|
245 | - } |
|
223 | + switch($answerType) { |
|
224 | + // for unique answer |
|
225 | + case UNIQUE_ANSWER : |
|
226 | + $studentChoice = ($choice_value == $numAnswer)?1:0; |
|
227 | + if ($studentChoice) { |
|
228 | + $questionScore +=$answerWeighting; |
|
229 | + $totalScore +=$answerWeighting; |
|
230 | + $newquestionList[]=$questionid; |
|
231 | + } |
|
232 | + break; |
|
233 | + case HOT_SPOT_DELINEATION : |
|
234 | + $studentChoice=$choice[$answerId]; |
|
235 | + if ($studentChoice) { |
|
236 | + $newquestionList[]=$questionid; |
|
237 | + } |
|
238 | + if ($answerId===1) { |
|
239 | + $questionScore +=$answerWeighting; |
|
240 | + $totalScore +=$answerWeighting; |
|
241 | + $_SESSION['hotspot_coord'][1] =$delineation_cord; |
|
242 | + $_SESSION['hotspot_dest'][1] =$answer_delineation_destination; |
|
243 | + } |
|
244 | + break; |
|
245 | + } |
|
246 | 246 | |
247 | 247 | |
248 | 248 | if ($answerType == UNIQUE_ANSWER || $answerType == MULTIPLE_ANSWER) { |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | $lp_hotspot=$destination_items[2]; |
340 | 340 | $select_question_hotspot=$destination_items[3]; |
341 | 341 | $url_hotspot=$destination_items[4]; |
342 | - //echo 'show the feedback'; |
|
342 | + //echo 'show the feedback'; |
|
343 | 343 | } |
344 | 344 | } elseif($answerId>1) { |
345 | 345 | if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') { |
@@ -396,41 +396,41 @@ discard block |
||
396 | 396 | //we send the error |
397 | 397 | } |
398 | 398 | } |
399 | - } |
|
399 | + } |
|
400 | 400 | |
401 | - if ($overlap_color) { |
|
402 | - $overlap_color='green'; |
|
401 | + if ($overlap_color) { |
|
402 | + $overlap_color='green'; |
|
403 | 403 | } else { |
404 | - $overlap_color='red'; |
|
404 | + $overlap_color='red'; |
|
405 | 405 | } |
406 | - if ($missing_color) { |
|
407 | - $missing_color='green'; |
|
406 | + if ($missing_color) { |
|
407 | + $missing_color='green'; |
|
408 | 408 | } else { |
409 | - $missing_color='red'; |
|
409 | + $missing_color='red'; |
|
410 | 410 | } |
411 | - if ($excess_color) { |
|
412 | - $excess_color='green'; |
|
411 | + if ($excess_color) { |
|
412 | + $excess_color='green'; |
|
413 | 413 | } else { |
414 | - $excess_color='red'; |
|
414 | + $excess_color='red'; |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | if (!is_numeric($final_overlap)) { |
418 | - $final_overlap = 0; |
|
418 | + $final_overlap = 0; |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | if (!is_numeric($final_missing)) { |
422 | - $final_missing = 0; |
|
422 | + $final_missing = 0; |
|
423 | 423 | } |
424 | 424 | if (!is_numeric($final_excess)) { |
425 | - $final_excess = 0; |
|
425 | + $final_excess = 0; |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | if ($final_excess>100) { |
429 | - $final_excess = 100; |
|
429 | + $final_excess = 100; |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | |
433 | - $table_resume = '<table class="data_table" > |
|
433 | + $table_resume = '<table class="data_table" > |
|
434 | 434 | <tr class="row_odd" > |
435 | 435 | <td></td> |
436 | 436 | <td ><b>'.get_lang('Requirements').'</b></td> |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | <td><div style="color:'.$missing_color.'">'.(($final_missing < 0)?0:intval($final_missing)).'</div></td> |
456 | 456 | </tr> |
457 | 457 | </table>'; |
458 | - //var_dump($final_overlap, $threadhold1 , $final_missing, $threadhold2 , $final_excess, $threadhold3); |
|
458 | + //var_dump($final_overlap, $threadhold1 , $final_missing, $threadhold2 , $final_excess, $threadhold3); |
|
459 | 459 | } |
460 | 460 | $_SESSION['newquestionList'] = $newquestionList; |
461 | 461 | |
@@ -472,68 +472,68 @@ discard block |
||
472 | 472 | if ($answerType != HOT_SPOT_DELINEATION) { |
473 | 473 | if (!empty($destination)) { |
474 | 474 | $item_list = explode('@@',$destination); |
475 | - //print_R($item_list); |
|
476 | - $try = $item_list[0]; |
|
477 | - $lp = $item_list[1]; |
|
478 | - $destinationid= $item_list[2]; |
|
479 | - $url=$item_list[3]; |
|
475 | + //print_R($item_list); |
|
476 | + $try = $item_list[0]; |
|
477 | + $lp = $item_list[1]; |
|
478 | + $destinationid= $item_list[2]; |
|
479 | + $url=$item_list[3]; |
|
480 | 480 | } |
481 | - $table_resume=''; |
|
481 | + $table_resume=''; |
|
482 | 482 | } else { |
483 | - $try = $try_hotspot; |
|
484 | - $lp = $lp_hotspot; |
|
485 | - $destinationid= $select_question_hotspot; |
|
486 | - $url=$url_hotspot; |
|
487 | - if ($organs_at_risk_hit==0 && $wrong_results==false ) { |
|
488 | - // no error = no oar and no wrong result for delineation |
|
489 | - //show if no error |
|
490 | - //echo 'no error'; |
|
491 | - $comment= $answerComment = $objAnswerTmp->selectComment($nbrAnswers); |
|
492 | - $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers); |
|
493 | - |
|
494 | - //we send the error |
|
495 | - $destination_items= explode('@@', $answerDestination); |
|
496 | - $try=$destination_items[1]; |
|
497 | - $lp=$destination_items[2]; |
|
498 | - $destinationid=$destination_items[3]; |
|
499 | - $url=$destination_items[4]; |
|
500 | - $exerciseResult[$questionid] = 1; |
|
501 | - } else { |
|
502 | - $exerciseResult[$questionid] = 0; |
|
503 | - } |
|
483 | + $try = $try_hotspot; |
|
484 | + $lp = $lp_hotspot; |
|
485 | + $destinationid= $select_question_hotspot; |
|
486 | + $url=$url_hotspot; |
|
487 | + if ($organs_at_risk_hit==0 && $wrong_results==false ) { |
|
488 | + // no error = no oar and no wrong result for delineation |
|
489 | + //show if no error |
|
490 | + //echo 'no error'; |
|
491 | + $comment= $answerComment = $objAnswerTmp->selectComment($nbrAnswers); |
|
492 | + $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers); |
|
493 | + |
|
494 | + //we send the error |
|
495 | + $destination_items= explode('@@', $answerDestination); |
|
496 | + $try=$destination_items[1]; |
|
497 | + $lp=$destination_items[2]; |
|
498 | + $destinationid=$destination_items[3]; |
|
499 | + $url=$destination_items[4]; |
|
500 | + $exerciseResult[$questionid] = 1; |
|
501 | + } else { |
|
502 | + $exerciseResult[$questionid] = 0; |
|
503 | + } |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | // the link to retry the question |
507 | 507 | if (isset($try) && $try==1) { |
508 | - $num_value_array= (array_keys($questionList, $questionid)); |
|
509 | - $links.= Display :: return_icon('reload.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />'; |
|
508 | + $num_value_array= (array_keys($questionList, $questionid)); |
|
509 | + $links.= Display :: return_icon('reload.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />'; |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | // the link to theory (a learning path) |
513 | 513 | if (!empty($lp)) { |
514 | - $lp_url= api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp; |
|
515 | - $list = new LearnpathList(api_get_user_id()); |
|
516 | - $flat_list = $list->get_flat_list(); |
|
517 | - $links.= Display :: return_icon('theory.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />'; |
|
514 | + $lp_url= api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp; |
|
515 | + $list = new LearnpathList(api_get_user_id()); |
|
516 | + $flat_list = $list->get_flat_list(); |
|
517 | + $links.= Display :: return_icon('theory.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />'; |
|
518 | 518 | } |
519 | 519 | $links.='<br />'; |
520 | 520 | |
521 | 521 | // the link to an external website or link |
522 | 522 | if (!empty($url)) { |
523 | - $links.= Display :: return_icon('link.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />'; |
|
523 | + $links.= Display :: return_icon('link.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />'; |
|
524 | 524 | } |
525 | 525 | |
526 | 526 | // the link to finish the test |
527 | 527 | if ($destinationid==-1) { |
528 | - $links.= Display :: return_icon('finish.gif', '', array ('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />'; |
|
528 | + $links.= Display :: return_icon('finish.gif', '', array ('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />'; |
|
529 | 529 | } else { |
530 | - // the link to other question |
|
531 | - if (in_array($destinationid,$questionList)) { |
|
532 | - $objQuestionTmp = Question :: read($destinationid); |
|
533 | - $questionName=$objQuestionTmp->selectTitle(); |
|
534 | - $num_value_array= (array_keys($questionList, $destinationid)); |
|
535 | - $links.= Display :: return_icon('quiz.png', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />'; |
|
536 | - } |
|
530 | + // the link to other question |
|
531 | + if (in_array($destinationid,$questionList)) { |
|
532 | + $objQuestionTmp = Question :: read($destinationid); |
|
533 | + $questionName=$objQuestionTmp->selectTitle(); |
|
534 | + $num_value_array= (array_keys($questionList, $destinationid)); |
|
535 | + $links.= Display :: return_icon('quiz.png', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />'; |
|
536 | + } |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | echo '<script> |
@@ -550,43 +550,43 @@ discard block |
||
550 | 550 | </script>'; |
551 | 551 | |
552 | 552 | if ($links!='') { |
553 | - /*echo '<div id="ModalContent" style="padding-bottom:30px;padding-top:10px;padding-left:20px;padding-right:20px;"> |
|
553 | + /*echo '<div id="ModalContent" style="padding-bottom:30px;padding-top:10px;padding-left:20px;padding-right:20px;"> |
|
554 | 554 | <a onclick="self.parent.tb_remove();" href="#" style="float:right; margin-top:-10px;">'.api_ucfirst(get_lang('Close')).'</a>';*/ |
555 | - echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>'; |
|
556 | - |
|
557 | - if ($answerType == HOT_SPOT_DELINEATION) { |
|
558 | - if ($organs_at_risk_hit > 0) { |
|
559 | - //$message='<p>'.get_lang('YourDelineation').'</p>'; |
|
560 | - //$message.=$table_resume; |
|
561 | - $message.='<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />'; |
|
562 | - //if ($wrong_results) { } |
|
563 | - $message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>'; |
|
564 | - $message.='<p>'.$comment.'</p>'; |
|
565 | - } else { |
|
566 | - $message='<p>'.get_lang('YourDelineation').'</p>'; |
|
567 | - $message.=$table_resume; |
|
568 | - $message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
569 | - $message.='<p>'.$comment.'</p>'; |
|
570 | - } |
|
571 | - echo $message; |
|
572 | - } else { |
|
573 | - echo '<p>'.$comment.'</p>'; |
|
574 | - } |
|
575 | - echo '<h3>'.$links.'</h3>'; |
|
576 | - echo '</div>'; |
|
577 | - |
|
578 | - $_SESSION['hot_spot_result']=$message; |
|
579 | - $_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]); |
|
580 | - //reseting the exerciseResult variable |
|
581 | - Session::write('exerciseResult',$exerciseResult); |
|
582 | - |
|
583 | - //save this variables just in case the exercise loads an LP with other exercise |
|
584 | - $_SESSION['objExerciseExtra'.$exerciseId] = $_SESSION['objExercise']; |
|
585 | - $_SESSION['exerciseResultExtra'.$exerciseId] = $_SESSION['exerciseResult']; |
|
586 | - $_SESSION['questionListExtra'.$exerciseId] = $_SESSION['questionList']; |
|
555 | + echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>'; |
|
556 | + |
|
557 | + if ($answerType == HOT_SPOT_DELINEATION) { |
|
558 | + if ($organs_at_risk_hit > 0) { |
|
559 | + //$message='<p>'.get_lang('YourDelineation').'</p>'; |
|
560 | + //$message.=$table_resume; |
|
561 | + $message.='<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />'; |
|
562 | + //if ($wrong_results) { } |
|
563 | + $message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>'; |
|
564 | + $message.='<p>'.$comment.'</p>'; |
|
565 | + } else { |
|
566 | + $message='<p>'.get_lang('YourDelineation').'</p>'; |
|
567 | + $message.=$table_resume; |
|
568 | + $message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
569 | + $message.='<p>'.$comment.'</p>'; |
|
570 | + } |
|
571 | + echo $message; |
|
572 | + } else { |
|
573 | + echo '<p>'.$comment.'</p>'; |
|
574 | + } |
|
575 | + echo '<h3>'.$links.'</h3>'; |
|
576 | + echo '</div>'; |
|
577 | + |
|
578 | + $_SESSION['hot_spot_result']=$message; |
|
579 | + $_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]); |
|
580 | + //reseting the exerciseResult variable |
|
581 | + Session::write('exerciseResult',$exerciseResult); |
|
582 | + |
|
583 | + //save this variables just in case the exercise loads an LP with other exercise |
|
584 | + $_SESSION['objExerciseExtra'.$exerciseId] = $_SESSION['objExercise']; |
|
585 | + $_SESSION['exerciseResultExtra'.$exerciseId] = $_SESSION['exerciseResult']; |
|
586 | + $_SESSION['questionListExtra'.$exerciseId] = $_SESSION['questionList']; |
|
587 | 587 | } else { |
588 | - $questionNum++; |
|
589 | - echo '<script> |
|
588 | + $questionNum++; |
|
589 | + echo '<script> |
|
590 | 590 | self.parent.window.location.href = "exercise_submit.php?exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'"; |
591 | 591 | //self.parent.tb_remove(); |
592 | 592 | </script>'; |