@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | public $feedback_type; |
28 | 28 | public $end_time; |
29 | 29 | public $start_time; |
30 | - public $questionList; // array with the list of this exercise's questions |
|
30 | + public $questionList; // array with the list of this exercise's questions |
|
31 | 31 | public $results_disabled; |
32 | 32 | public $expired_time; |
33 | 33 | public $course; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST); |
98 | 98 | $table_lp_item = Database::get_course_table(TABLE_LP_ITEM); |
99 | 99 | |
100 | - $id = intval($id); |
|
100 | + $id = intval($id); |
|
101 | 101 | if (empty($this->course_id)) { |
102 | 102 | return false; |
103 | 103 | } |
@@ -154,17 +154,17 @@ discard block |
||
154 | 154 | } |
155 | 155 | |
156 | 156 | if ($object->end_time != '0000-00-00 00:00:00') { |
157 | - $this->end_time = $object->end_time; |
|
157 | + $this->end_time = $object->end_time; |
|
158 | 158 | } |
159 | 159 | if ($object->start_time != '0000-00-00 00:00:00') { |
160 | - $this->start_time = $object->start_time; |
|
160 | + $this->start_time = $object->start_time; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | //control time |
164 | - $this->expired_time = $object->expired_time; |
|
164 | + $this->expired_time = $object->expired_time; |
|
165 | 165 | |
166 | 166 | //Checking if question_order is correctly set |
167 | - $this->questionList = $this->selectQuestionList(true); |
|
167 | + $this->questionList = $this->selectQuestionList(true); |
|
168 | 168 | |
169 | 169 | //overload questions list with recorded questions list |
170 | 170 | //load questions only for exercises of type 'one question per page' |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | */ |
383 | 383 | public function isRandom() |
384 | 384 | { |
385 | - if($this->random > 0 || $this->random == -1) { |
|
385 | + if ($this->random > 0 || $this->random == -1) { |
|
386 | 386 | return true; |
387 | 387 | } else { |
388 | 388 | return false; |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | public function selectQuestionList($from_db = false) |
428 | 428 | { |
429 | 429 | if ($from_db && !empty($this->id)) { |
430 | - $TBL_EXERCISE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); |
|
430 | + $TBL_EXERCISE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); |
|
431 | 431 | $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); |
432 | 432 | |
433 | 433 | $sql = "SELECT DISTINCT e.question_order |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | $question_list = array(); |
455 | 455 | |
456 | 456 | while ($new_object = Database::fetch_object($result)) { |
457 | - $question_list[$new_object->question_order]= $new_object->question_id; |
|
457 | + $question_list[$new_object->question_order] = $new_object->question_id; |
|
458 | 458 | $temp_question_list[$counter] = $new_object->question_id; |
459 | 459 | $counter++; |
460 | 460 | } |
@@ -500,16 +500,16 @@ discard block |
||
500 | 500 | */ |
501 | 501 | public function selectRandomList() |
502 | 502 | { |
503 | - $nbQuestions = $this->selectNbrQuestions(); |
|
504 | - $temp_list = $this->questionList; |
|
503 | + $nbQuestions = $this->selectNbrQuestions(); |
|
504 | + $temp_list = $this->questionList; |
|
505 | 505 | |
506 | 506 | //Not a random exercise, or if there are not at least 2 questions |
507 | - if($this->random == 0 || $nbQuestions < 2) { |
|
507 | + if ($this->random == 0 || $nbQuestions < 2) { |
|
508 | 508 | return $this->questionList; |
509 | 509 | } |
510 | 510 | if ($nbQuestions != 0) { |
511 | 511 | shuffle($temp_list); |
512 | - $my_random_list = array_combine(range(1,$nbQuestions),$temp_list); |
|
512 | + $my_random_list = array_combine(range(1, $nbQuestions), $temp_list); |
|
513 | 513 | $my_question_list = array(); |
514 | 514 | // $this->random == -1 if random with all questions |
515 | 515 | if ($this->random > 0) { |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | public function isInList($questionId) |
540 | 540 | { |
541 | 541 | if (is_array($this->questionList)) |
542 | - return in_array($questionId,$this->questionList); |
|
542 | + return in_array($questionId, $this->questionList); |
|
543 | 543 | else |
544 | 544 | return false; |
545 | 545 | } |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | */ |
553 | 553 | public function updateTitle($title) |
554 | 554 | { |
555 | - $this->exercise=$title; |
|
555 | + $this->exercise = $title; |
|
556 | 556 | } |
557 | 557 | |
558 | 558 | /** |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | */ |
563 | 563 | public function updateAttempts($attempts) |
564 | 564 | { |
565 | - $this->attempts=$attempts; |
|
565 | + $this->attempts = $attempts; |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | /** |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | */ |
573 | 573 | public function updateFeedbackType($feedback_type) |
574 | 574 | { |
575 | - $this->feedback_type=$feedback_type; |
|
575 | + $this->feedback_type = $feedback_type; |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | /** |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | */ |
584 | 584 | public function updateDescription($description) |
585 | 585 | { |
586 | - $this->description=$description; |
|
586 | + $this->description = $description; |
|
587 | 587 | } |
588 | 588 | |
589 | 589 | /** |
@@ -628,23 +628,23 @@ discard block |
||
628 | 628 | * @param string $sound - exercise sound file |
629 | 629 | * @param string $delete - ask to delete the file |
630 | 630 | */ |
631 | - public function updateSound($sound,$delete) |
|
631 | + public function updateSound($sound, $delete) |
|
632 | 632 | { |
633 | 633 | global $audioPath, $documentPath; |
634 | 634 | $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); |
635 | 635 | |
636 | - if ($sound['size'] && (strstr($sound['type'],'audio') || strstr($sound['type'],'video'))) { |
|
637 | - $this->sound=$sound['name']; |
|
636 | + if ($sound['size'] && (strstr($sound['type'], 'audio') || strstr($sound['type'], 'video'))) { |
|
637 | + $this->sound = $sound['name']; |
|
638 | 638 | |
639 | - if (@move_uploaded_file($sound['tmp_name'],$audioPath.'/'.$this->sound)) { |
|
639 | + if (@move_uploaded_file($sound['tmp_name'], $audioPath.'/'.$this->sound)) { |
|
640 | 640 | $query = "SELECT 1 FROM $TBL_DOCUMENT |
641 | - WHERE c_id = ".$this->course_id." AND path='".str_replace($documentPath,'',$audioPath).'/'.$this->sound."'"; |
|
642 | - $result=Database::query($query); |
|
641 | + WHERE c_id = ".$this->course_id." AND path='".str_replace($documentPath, '', $audioPath).'/'.$this->sound."'"; |
|
642 | + $result = Database::query($query); |
|
643 | 643 | |
644 | 644 | if (!Database::num_rows($result)) { |
645 | 645 | $id = add_document( |
646 | 646 | $this->course, |
647 | - str_replace($documentPath,'',$audioPath).'/'.$this->sound, |
|
647 | + str_replace($documentPath, '', $audioPath).'/'.$this->sound, |
|
648 | 648 | 'file', |
649 | 649 | $sound['size'], |
650 | 650 | $sound['name'] |
@@ -663,8 +663,8 @@ discard block |
||
663 | 663 | ); |
664 | 664 | } |
665 | 665 | } |
666 | - } elseif($delete && is_file($audioPath.'/'.$this->sound)) { |
|
667 | - $this->sound=''; |
|
666 | + } elseif ($delete && is_file($audioPath.'/'.$this->sound)) { |
|
667 | + $this->sound = ''; |
|
668 | 668 | } |
669 | 669 | } |
670 | 670 | |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | */ |
677 | 677 | public function updateType($type) |
678 | 678 | { |
679 | - $this->type=$type; |
|
679 | + $this->type = $type; |
|
680 | 680 | } |
681 | 681 | |
682 | 682 | /** |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | */ |
713 | 713 | public function enable() |
714 | 714 | { |
715 | - $this->active=1; |
|
715 | + $this->active = 1; |
|
716 | 716 | } |
717 | 717 | |
718 | 718 | /** |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | */ |
723 | 723 | public function disable() |
724 | 724 | { |
725 | - $this->active=0; |
|
725 | + $this->active = 0; |
|
726 | 726 | } |
727 | 727 | |
728 | 728 | /** |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | api_get_user_id() |
847 | 847 | ); |
848 | 848 | |
849 | - if (api_get_setting('search_enabled')=='true') { |
|
849 | + if (api_get_setting('search_enabled') == 'true') { |
|
850 | 850 | $this->search_engine_edit(); |
851 | 851 | } |
852 | 852 | } else { |
@@ -985,7 +985,7 @@ discard block |
||
985 | 985 | public function removeFromList($questionId) |
986 | 986 | { |
987 | 987 | // searches the position of the question ID in the list |
988 | - $pos = array_search($questionId,$this->questionList); |
|
988 | + $pos = array_search($questionId, $this->questionList); |
|
989 | 989 | |
990 | 990 | // question not found |
991 | 991 | if ($pos === false) { |
@@ -1020,7 +1020,7 @@ discard block |
||
1020 | 1020 | api_item_property_update($this->course, TOOL_QUIZ, $this->id, 'QuizDeleted', api_get_user_id()); |
1021 | 1021 | api_item_property_update($this->course, TOOL_QUIZ, $this->id, 'delete', api_get_user_id()); |
1022 | 1022 | |
1023 | - if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian') ) { |
|
1023 | + if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) { |
|
1024 | 1024 | $this->search_engine_delete(); |
1025 | 1025 | } |
1026 | 1026 | } |
@@ -1029,7 +1029,7 @@ discard block |
||
1029 | 1029 | * Creates the form to create / edit an exercise |
1030 | 1030 | * @param FormValidator $form |
1031 | 1031 | */ |
1032 | - public function createForm($form, $type='full') |
|
1032 | + public function createForm($form, $type = 'full') |
|
1033 | 1033 | { |
1034 | 1034 | if (empty($type)) { |
1035 | 1035 | $type = 'full'; |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | 'Width' => '100%', |
1061 | 1061 | 'Height' => '150', |
1062 | 1062 | ); |
1063 | - if (is_array($type)){ |
|
1063 | + if (is_array($type)) { |
|
1064 | 1064 | $editor_config = array_merge($editor_config, $type); |
1065 | 1065 | } |
1066 | 1066 | |
@@ -1114,13 +1114,13 @@ discard block |
||
1114 | 1114 | '2', |
1115 | 1115 | array('id' => 'exerciseType_2') |
1116 | 1116 | ); |
1117 | - $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'),get_lang('FeedbackDisplayOptions')), ''); |
|
1117 | + $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'), get_lang('FeedbackDisplayOptions')), ''); |
|
1118 | 1118 | |
1119 | 1119 | // Type of results display on the final page |
1120 | 1120 | $radios_results_disabled = array(); |
1121 | 1121 | $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id'=>'result_disabled_0')); |
1122 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1',array('id'=>'result_disabled_1','onclick' => 'check_results_disabled()')); |
|
1123 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2')); |
|
1122 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id'=>'result_disabled_1', 'onclick' => 'check_results_disabled()')); |
|
1123 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2')); |
|
1124 | 1124 | //$radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ExamModeWithFinalScoreShowOnlyFinalScoreWithCategoriesIfAvailable'), '3', array('id'=>'result_disabled_3','onclick' => 'check_results_disabled()')); |
1125 | 1125 | |
1126 | 1126 | $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), ''); |
@@ -1128,8 +1128,8 @@ discard block |
||
1128 | 1128 | // Type of questions disposition on page |
1129 | 1129 | $radios = array(); |
1130 | 1130 | |
1131 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
1132 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
1131 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
1132 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
1133 | 1133 | |
1134 | 1134 | $form->addGroup($radios, null, get_lang('QuestionsPerPage'), ''); |
1135 | 1135 | |
@@ -1139,33 +1139,33 @@ discard block |
||
1139 | 1139 | |
1140 | 1140 | // feedback type |
1141 | 1141 | $radios_feedback = array(); |
1142 | - $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('ExerciseAtTheEndOfTheTest'),'0',array('id' =>'exerciseType_0', 'onclick' => 'check_feedback()')); |
|
1142 | + $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('ExerciseAtTheEndOfTheTest'), '0', array('id' =>'exerciseType_0', 'onclick' => 'check_feedback()')); |
|
1143 | 1143 | |
1144 | 1144 | if (api_get_setting('enable_quiz_scenario') == 'true') { |
1145 | - $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('DirectFeedback'), '1', array('id' =>'exerciseType_1' , 'onclick' => 'check_direct_feedback()')); |
|
1145 | + $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('DirectFeedback'), '1', array('id' =>'exerciseType_1', 'onclick' => 'check_direct_feedback()')); |
|
1146 | 1146 | } |
1147 | - $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'),'2',array('id' =>'exerciseType_2')); |
|
1148 | - $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'),get_lang('FeedbackDisplayOptions'))); |
|
1147 | + $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'), '2', array('id' =>'exerciseType_2')); |
|
1148 | + $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'), get_lang('FeedbackDisplayOptions'))); |
|
1149 | 1149 | |
1150 | 1150 | //$form->addElement('select', 'exerciseFeedbackType',get_lang('FeedbackType'),$feedback_option,'onchange="javascript:feedbackselection()"'); |
1151 | 1151 | $radios_results_disabled = array(); |
1152 | 1152 | $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id'=>'result_disabled_0')); |
1153 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1',array('id'=>'result_disabled_1','onclick' => 'check_results_disabled()')); |
|
1154 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2',array('id'=>'result_disabled_2','onclick' => 'check_results_disabled()')); |
|
1155 | - $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'),''); |
|
1153 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id'=>'result_disabled_1', 'onclick' => 'check_results_disabled()')); |
|
1154 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2', 'onclick' => 'check_results_disabled()')); |
|
1155 | + $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), ''); |
|
1156 | 1156 | |
1157 | 1157 | // Type of questions disposition on page |
1158 | 1158 | $radios = array(); |
1159 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1'); |
|
1160 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2'); |
|
1159 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1'); |
|
1160 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2'); |
|
1161 | 1161 | $form->addGroup($radios, null, get_lang('ExerciseType')); |
1162 | 1162 | |
1163 | 1163 | } else { |
1164 | 1164 | //Show options freeze |
1165 | 1165 | $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id'=>'result_disabled_0')); |
1166 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1',array('id'=>'result_disabled_1','onclick' => 'check_results_disabled()')); |
|
1167 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2',array('id'=>'result_disabled_2','onclick' => 'check_results_disabled()')); |
|
1168 | - $result_disable_group = $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'),''); |
|
1166 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id'=>'result_disabled_1', 'onclick' => 'check_results_disabled()')); |
|
1167 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2', 'onclick' => 'check_results_disabled()')); |
|
1168 | + $result_disable_group = $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), ''); |
|
1169 | 1169 | $result_disable_group->freeze(); |
1170 | 1170 | |
1171 | 1171 | //we force the options to the DirectFeedback exercisetype |
@@ -1173,8 +1173,8 @@ discard block |
||
1173 | 1173 | $form->addElement('hidden', 'exerciseType', ONE_PER_PAGE); |
1174 | 1174 | |
1175 | 1175 | // Type of questions disposition on page |
1176 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
1177 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
1176 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
1177 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
1178 | 1178 | |
1179 | 1179 | $type_group = $form->addGroup($radios, null, get_lang('QuestionsPerPage'), ''); |
1180 | 1180 | $type_group->freeze(); |
@@ -1183,26 +1183,26 @@ discard block |
||
1183 | 1183 | |
1184 | 1184 | // number of random question |
1185 | 1185 | |
1186 | - $max = ($this->id > 0) ? $this->selectNbrQuestions() : 10 ; |
|
1187 | - $option = range(0,$max); |
|
1186 | + $max = ($this->id > 0) ? $this->selectNbrQuestions() : 10; |
|
1187 | + $option = range(0, $max); |
|
1188 | 1188 | $option[0] = get_lang('No'); |
1189 | 1189 | $option[-1] = get_lang('AllQuestionsShort'); |
1190 | - $form->addElement('select', 'randomQuestions',array(get_lang('RandomQuestions'), get_lang('RandomQuestionsHelp')), $option, array('id'=>'randomQuestions')); |
|
1190 | + $form->addElement('select', 'randomQuestions', array(get_lang('RandomQuestions'), get_lang('RandomQuestionsHelp')), $option, array('id'=>'randomQuestions')); |
|
1191 | 1191 | |
1192 | 1192 | // Random answers |
1193 | 1193 | $radios_random_answers = array(); |
1194 | - $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('Yes'),'1'); |
|
1195 | - $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('No'),'0'); |
|
1194 | + $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('Yes'), '1'); |
|
1195 | + $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('No'), '0'); |
|
1196 | 1196 | $form->addGroup($radios_random_answers, null, get_lang('RandomAnswers'), ''); |
1197 | 1197 | |
1198 | 1198 | // Random by category |
1199 | - $form->addElement('html','<div class="clear"> </div>'); |
|
1199 | + $form->addElement('html', '<div class="clear"> </div>'); |
|
1200 | 1200 | $radiocat = array(); |
1201 | - $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesShuffled'),'1'); |
|
1202 | - $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesSorted'),'2'); |
|
1203 | - $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('No'),'0'); |
|
1201 | + $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesShuffled'), '1'); |
|
1202 | + $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesSorted'), '2'); |
|
1203 | + $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('No'), '0'); |
|
1204 | 1204 | $radioCatGroup = $form->addGroup($radiocat, null, get_lang('RandomQuestionByCategory'), ''); |
1205 | - $form->addElement('html','<div class="clear"> </div>'); |
|
1205 | + $form->addElement('html', '<div class="clear"> </div>'); |
|
1206 | 1206 | |
1207 | 1207 | // add the radio display the category name for student |
1208 | 1208 | $radio_display_cat_name = array(); |
@@ -1223,36 +1223,36 @@ discard block |
||
1223 | 1223 | ); |
1224 | 1224 | |
1225 | 1225 | // Exercise time limit |
1226 | - $form->addElement('checkbox', 'activate_start_date_check',null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()')); |
|
1226 | + $form->addElement('checkbox', 'activate_start_date_check', null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()')); |
|
1227 | 1227 | |
1228 | 1228 | $var = Exercise::selectTimeLimit(); |
1229 | 1229 | |
1230 | 1230 | if (($this->start_time != '0000-00-00 00:00:00')) |
1231 | - $form->addElement('html','<div id="start_date_div" style="display:block;">'); |
|
1231 | + $form->addElement('html', '<div id="start_date_div" style="display:block;">'); |
|
1232 | 1232 | else |
1233 | - $form->addElement('html','<div id="start_date_div" style="display:none;">'); |
|
1233 | + $form->addElement('html', '<div id="start_date_div" style="display:none;">'); |
|
1234 | 1234 | |
1235 | 1235 | $form->addElement('date_time_picker', 'start_time'); |
1236 | 1236 | |
1237 | - $form->addElement('html','</div>'); |
|
1237 | + $form->addElement('html', '</div>'); |
|
1238 | 1238 | |
1239 | - $form->addElement('checkbox', 'activate_end_date_check', null , get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()')); |
|
1239 | + $form->addElement('checkbox', 'activate_end_date_check', null, get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()')); |
|
1240 | 1240 | |
1241 | 1241 | if (($this->end_time != '0000-00-00 00:00:00')) |
1242 | - $form->addElement('html','<div id="end_date_div" style="display:block;">'); |
|
1242 | + $form->addElement('html', '<div id="end_date_div" style="display:block;">'); |
|
1243 | 1243 | else |
1244 | - $form->addElement('html','<div id="end_date_div" style="display:none;">'); |
|
1244 | + $form->addElement('html', '<div id="end_date_div" style="display:none;">'); |
|
1245 | 1245 | |
1246 | 1246 | $form->addElement('date_time_picker', 'end_time'); |
1247 | - $form->addElement('html','</div>'); |
|
1247 | + $form->addElement('html', '</div>'); |
|
1248 | 1248 | |
1249 | 1249 | //$check_option=$this->selectType(); |
1250 | 1250 | $diplay = 'block'; |
1251 | 1251 | $form->addElement('checkbox', 'propagate_neg', null, get_lang('PropagateNegativeResults')); |
1252 | - $form->addElement('html','<div class="clear"> </div>'); |
|
1252 | + $form->addElement('html', '<div class="clear"> </div>'); |
|
1253 | 1253 | $form->addElement('checkbox', 'review_answers', null, get_lang('ReviewAnswers')); |
1254 | 1254 | |
1255 | - $form->addElement('html','<div id="divtimecontrol" style="display:'.$diplay.';">'); |
|
1255 | + $form->addElement('html', '<div id="divtimecontrol" style="display:'.$diplay.';">'); |
|
1256 | 1256 | |
1257 | 1257 | //Timer control |
1258 | 1258 | //$time_hours_option = range(0,12); |
@@ -1268,12 +1268,12 @@ discard block |
||
1268 | 1268 | 'onload' => 'check_load_time()', |
1269 | 1269 | ) |
1270 | 1270 | ); |
1271 | - $expired_date = (int)$this->selectExpiredTime(); |
|
1271 | + $expired_date = (int) $this->selectExpiredTime(); |
|
1272 | 1272 | |
1273 | - if (($expired_date!='0')) { |
|
1274 | - $form->addElement('html','<div id="timercontrol" style="display:block;">'); |
|
1273 | + if (($expired_date != '0')) { |
|
1274 | + $form->addElement('html', '<div id="timercontrol" style="display:block;">'); |
|
1275 | 1275 | } else { |
1276 | - $form->addElement('html','<div id="timercontrol" style="display:none;">'); |
|
1276 | + $form->addElement('html', '<div id="timercontrol" style="display:none;">'); |
|
1277 | 1277 | } |
1278 | 1278 | $form->addText( |
1279 | 1279 | 'enabletimercontroltotalminutes', |
@@ -1284,7 +1284,7 @@ discard block |
||
1284 | 1284 | 'cols-size' => [2, 2, 8] |
1285 | 1285 | ] |
1286 | 1286 | ); |
1287 | - $form->addElement('html','</div>'); |
|
1287 | + $form->addElement('html', '</div>'); |
|
1288 | 1288 | |
1289 | 1289 | $form->addElement( |
1290 | 1290 | 'text', |
@@ -1306,18 +1306,18 @@ discard block |
||
1306 | 1306 | $defaults = array(); |
1307 | 1307 | |
1308 | 1308 | if (api_get_setting('search_enabled') === 'true') { |
1309 | - require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; |
|
1309 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
1310 | 1310 | |
1311 | - $form->addElement ('checkbox', 'index_document','', get_lang('SearchFeatureDoIndexDocument')); |
|
1312 | - $form->addElement ('select_language', 'language', get_lang('SearchFeatureDocumentLanguage')); |
|
1311 | + $form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument')); |
|
1312 | + $form->addElement('select_language', 'language', get_lang('SearchFeatureDocumentLanguage')); |
|
1313 | 1313 | |
1314 | 1314 | $specific_fields = get_specific_field_list(); |
1315 | 1315 | |
1316 | 1316 | foreach ($specific_fields as $specific_field) { |
1317 | - $form->addElement ('text', $specific_field['code'], $specific_field['name']); |
|
1318 | - $filter = array('c_id'=> "'". api_get_course_int_id() ."'", 'field_id' => $specific_field['id'], 'ref_id' => $this->id, 'tool_id' => '\''. TOOL_QUIZ .'\''); |
|
1317 | + $form->addElement('text', $specific_field['code'], $specific_field['name']); |
|
1318 | + $filter = array('c_id'=> "'".api_get_course_int_id()."'", 'field_id' => $specific_field['id'], 'ref_id' => $this->id, 'tool_id' => '\''.TOOL_QUIZ.'\''); |
|
1319 | 1319 | $values = get_specific_field_values_list($filter, array('value')); |
1320 | - if ( !empty($values) ) { |
|
1320 | + if (!empty($values)) { |
|
1321 | 1321 | $arr_str_values = array(); |
1322 | 1322 | foreach ($values as $value) { |
1323 | 1323 | $arr_str_values[] = $value['value']; |
@@ -1328,8 +1328,8 @@ discard block |
||
1328 | 1328 | //$form->addElement ('html','</div>'); |
1329 | 1329 | } |
1330 | 1330 | |
1331 | - $form->addElement('html','</div>'); //End advanced setting |
|
1332 | - $form->addElement('html','</div>'); |
|
1331 | + $form->addElement('html', '</div>'); //End advanced setting |
|
1332 | + $form->addElement('html', '</div>'); |
|
1333 | 1333 | } |
1334 | 1334 | |
1335 | 1335 | // submit |
@@ -1349,10 +1349,10 @@ discard block |
||
1349 | 1349 | } |
1350 | 1350 | |
1351 | 1351 | // defaults |
1352 | - if ($type=='full') { |
|
1352 | + if ($type == 'full') { |
|
1353 | 1353 | if ($this->id > 0) { |
1354 | 1354 | if ($this->random > $this->selectNbrQuestions()) { |
1355 | - $defaults['randomQuestions'] = $this->selectNbrQuestions(); |
|
1355 | + $defaults['randomQuestions'] = $this->selectNbrQuestions(); |
|
1356 | 1356 | } else { |
1357 | 1357 | $defaults['randomQuestions'] = $this->random; |
1358 | 1358 | } |
@@ -1378,8 +1378,8 @@ discard block |
||
1378 | 1378 | $defaults['activate_end_date_check'] = 1; |
1379 | 1379 | } |
1380 | 1380 | |
1381 | - $defaults['start_time'] = ($this->start_time!='0000-00-00 00:00:00') ? api_get_local_time($this->start_time) : date('Y-m-d 12:00:00'); |
|
1382 | - $defaults['end_time'] = ($this->end_time!='0000-00-00 00:00:00') ? api_get_local_time($this->end_time) : date('Y-m-d 12:00:00', time()+84600); |
|
1381 | + $defaults['start_time'] = ($this->start_time != '0000-00-00 00:00:00') ? api_get_local_time($this->start_time) : date('Y-m-d 12:00:00'); |
|
1382 | + $defaults['end_time'] = ($this->end_time != '0000-00-00 00:00:00') ? api_get_local_time($this->end_time) : date('Y-m-d 12:00:00', time() + 84600); |
|
1383 | 1383 | |
1384 | 1384 | // Get expired time |
1385 | 1385 | if ($this->expired_time != '0') { |
@@ -1400,7 +1400,7 @@ discard block |
||
1400 | 1400 | $defaults['text_when_finished'] = ""; |
1401 | 1401 | $defaults['start_time'] = date('Y-m-d 12:00:00'); |
1402 | 1402 | $defaults['display_category_name'] = 1; |
1403 | - $defaults['end_time'] = date('Y-m-d 12:00:00', time()+84600); |
|
1403 | + $defaults['end_time'] = date('Y-m-d 12:00:00', time() + 84600); |
|
1404 | 1404 | $defaults['pass_percentage'] = ''; |
1405 | 1405 | } |
1406 | 1406 | } else { |
@@ -1467,7 +1467,7 @@ discard block |
||
1467 | 1467 | $end_time = $form->getSubmitValue('end_time'); |
1468 | 1468 | $this->end_time = api_get_utc_datetime($end_time); |
1469 | 1469 | } else { |
1470 | - $this->end_time = '0000-00-00 00:00:00'; |
|
1470 | + $this->end_time = '0000-00-00 00:00:00'; |
|
1471 | 1471 | } |
1472 | 1472 | |
1473 | 1473 | if ($form->getSubmitValue('enabletimercontrol') == 1) { |
@@ -1480,9 +1480,9 @@ discard block |
||
1480 | 1480 | } |
1481 | 1481 | |
1482 | 1482 | if ($form->getSubmitValue('randomAnswers') == 1) { |
1483 | - $this->random_answers=1; |
|
1483 | + $this->random_answers = 1; |
|
1484 | 1484 | } else { |
1485 | - $this->random_answers=0; |
|
1485 | + $this->random_answers = 0; |
|
1486 | 1486 | } |
1487 | 1487 | $this->save($type); |
1488 | 1488 | } |
@@ -1494,9 +1494,9 @@ discard block |
||
1494 | 1494 | } |
1495 | 1495 | $course_id = api_get_course_id(); |
1496 | 1496 | |
1497 | - require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'; |
|
1498 | - require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php'; |
|
1499 | - require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; |
|
1497 | + require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; |
|
1498 | + require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php'; |
|
1499 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
1500 | 1500 | |
1501 | 1501 | $specific_fields = get_specific_field_list(); |
1502 | 1502 | $ic_slide = new IndexableChunk(); |
@@ -1506,7 +1506,7 @@ discard block |
||
1506 | 1506 | if (isset($_REQUEST[$specific_field['code']])) { |
1507 | 1507 | $sterms = trim($_REQUEST[$specific_field['code']]); |
1508 | 1508 | if (!empty($sterms)) { |
1509 | - $all_specific_terms .= ' '. $sterms; |
|
1509 | + $all_specific_terms .= ' '.$sterms; |
|
1510 | 1510 | $sterms = explode(',', $sterms); |
1511 | 1511 | foreach ($sterms as $sterm) { |
1512 | 1512 | $ic_slide->addTerm(trim($sterm), $specific_field['code']); |
@@ -1523,15 +1523,15 @@ discard block |
||
1523 | 1523 | $xapian_data = array( |
1524 | 1524 | SE_COURSE_ID => $course_id, |
1525 | 1525 | SE_TOOL_ID => TOOL_QUIZ, |
1526 | - SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int)$this->id), |
|
1527 | - SE_USER => (int)api_get_user_id(), |
|
1526 | + SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int) $this->id), |
|
1527 | + SE_USER => (int) api_get_user_id(), |
|
1528 | 1528 | ); |
1529 | 1529 | $ic_slide->xapian_data = serialize($xapian_data); |
1530 | - $exercise_description = $all_specific_terms .' '. $this->description; |
|
1530 | + $exercise_description = $all_specific_terms.' '.$this->description; |
|
1531 | 1531 | $ic_slide->addValue("content", $exercise_description); |
1532 | 1532 | |
1533 | 1533 | $di = new ChamiloIndexer(); |
1534 | - isset($_POST['language'])? $lang=Database::escape_string($_POST['language']): $lang = 'english'; |
|
1534 | + isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english'; |
|
1535 | 1535 | $di->connectDb(NULL, NULL, $lang); |
1536 | 1536 | $di->addChunk($ic_slide); |
1537 | 1537 | |
@@ -1550,7 +1550,7 @@ discard block |
||
1550 | 1550 | function search_engine_edit() |
1551 | 1551 | { |
1552 | 1552 | // update search enchine and its values table if enabled |
1553 | - if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) { |
|
1553 | + if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) { |
|
1554 | 1554 | $course_id = api_get_course_id(); |
1555 | 1555 | |
1556 | 1556 | // actually, it consists on delete terms from db, |
@@ -1562,9 +1562,9 @@ discard block |
||
1562 | 1562 | $res = Database::query($sql); |
1563 | 1563 | |
1564 | 1564 | if (Database::num_rows($res) > 0) { |
1565 | - require_once(api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'); |
|
1566 | - require_once(api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php'); |
|
1567 | - require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'); |
|
1565 | + require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'); |
|
1566 | + require_once(api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php'); |
|
1567 | + require_once(api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'); |
|
1568 | 1568 | |
1569 | 1569 | $se_ref = Database::fetch_array($res); |
1570 | 1570 | $specific_fields = get_specific_field_list(); |
@@ -1575,7 +1575,7 @@ discard block |
||
1575 | 1575 | delete_all_specific_field_value($course_id, $specific_field['id'], TOOL_QUIZ, $this->id); |
1576 | 1576 | if (isset($_REQUEST[$specific_field['code']])) { |
1577 | 1577 | $sterms = trim($_REQUEST[$specific_field['code']]); |
1578 | - $all_specific_terms .= ' '. $sterms; |
|
1578 | + $all_specific_terms .= ' '.$sterms; |
|
1579 | 1579 | $sterms = explode(',', $sterms); |
1580 | 1580 | foreach ($sterms as $sterm) { |
1581 | 1581 | $ic_slide->addTerm(trim($sterm), $specific_field['code']); |
@@ -1591,17 +1591,17 @@ discard block |
||
1591 | 1591 | $xapian_data = array( |
1592 | 1592 | SE_COURSE_ID => $course_id, |
1593 | 1593 | SE_TOOL_ID => TOOL_QUIZ, |
1594 | - SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int)$this->id), |
|
1595 | - SE_USER => (int)api_get_user_id(), |
|
1594 | + SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int) $this->id), |
|
1595 | + SE_USER => (int) api_get_user_id(), |
|
1596 | 1596 | ); |
1597 | 1597 | $ic_slide->xapian_data = serialize($xapian_data); |
1598 | - $exercise_description = $all_specific_terms .' '. $this->description; |
|
1598 | + $exercise_description = $all_specific_terms.' '.$this->description; |
|
1599 | 1599 | $ic_slide->addValue("content", $exercise_description); |
1600 | 1600 | |
1601 | 1601 | $di = new ChamiloIndexer(); |
1602 | - isset($_POST['language'])? $lang=Database::escape_string($_POST['language']): $lang = 'english'; |
|
1602 | + isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english'; |
|
1603 | 1603 | $di->connectDb(NULL, NULL, $lang); |
1604 | - $di->remove_document((int)$se_ref['search_did']); |
|
1604 | + $di->remove_document((int) $se_ref['search_did']); |
|
1605 | 1605 | $di->addChunk($ic_slide); |
1606 | 1606 | |
1607 | 1607 | //index and return search engine document id |
@@ -1626,7 +1626,7 @@ discard block |
||
1626 | 1626 | function search_engine_delete() |
1627 | 1627 | { |
1628 | 1628 | // remove from search engine if enabled |
1629 | - if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian') ) { |
|
1629 | + if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) { |
|
1630 | 1630 | $course_id = api_get_course_id(); |
1631 | 1631 | $tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF); |
1632 | 1632 | $sql = 'SELECT * FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s AND ref_id_second_level IS NULL LIMIT 1'; |
@@ -1634,19 +1634,19 @@ discard block |
||
1634 | 1634 | $res = Database::query($sql); |
1635 | 1635 | if (Database::num_rows($res) > 0) { |
1636 | 1636 | $row = Database::fetch_array($res); |
1637 | - require_once(api_get_path(LIBRARY_PATH) .'search/ChamiloIndexer.class.php'); |
|
1637 | + require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'); |
|
1638 | 1638 | $di = new ChamiloIndexer(); |
1639 | - $di->remove_document((int)$row['search_did']); |
|
1639 | + $di->remove_document((int) $row['search_did']); |
|
1640 | 1640 | unset($di); |
1641 | 1641 | $tbl_quiz_question = Database::get_course_table(TABLE_QUIZ_QUESTION); |
1642 | - foreach ( $this->questionList as $question_i) { |
|
1642 | + foreach ($this->questionList as $question_i) { |
|
1643 | 1643 | $sql = 'SELECT type FROM %s WHERE id=%s'; |
1644 | 1644 | $sql = sprintf($sql, $tbl_quiz_question, $question_i); |
1645 | 1645 | $qres = Database::query($sql); |
1646 | 1646 | if (Database::num_rows($qres) > 0) { |
1647 | 1647 | $qrow = Database::fetch_array($qres); |
1648 | 1648 | $objQuestion = Question::getInstance($qrow['type']); |
1649 | - $objQuestion = Question::read((int)$question_i); |
|
1649 | + $objQuestion = Question::read((int) $question_i); |
|
1650 | 1650 | $objQuestion->search_engine_edit($this->id, FALSE, TRUE); |
1651 | 1651 | unset($objQuestion); |
1652 | 1652 | } |
@@ -1657,7 +1657,7 @@ discard block |
||
1657 | 1657 | Database::query($sql); |
1658 | 1658 | |
1659 | 1659 | // remove terms from db |
1660 | - require_once api_get_path(LIBRARY_PATH) .'specific_fields_manager.lib.php'; |
|
1660 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
1661 | 1661 | delete_all_values_for_item($course_id, TOOL_QUIZ, $this->id); |
1662 | 1662 | } |
1663 | 1663 | } |
@@ -1752,7 +1752,7 @@ discard block |
||
1752 | 1752 | */ |
1753 | 1753 | public function copy_exercise() |
1754 | 1754 | { |
1755 | - $exercise_obj= new Exercise(); |
|
1755 | + $exercise_obj = new Exercise(); |
|
1756 | 1756 | $exercise_obj = $this; |
1757 | 1757 | |
1758 | 1758 | // force the creation of a new exercise |
@@ -1824,25 +1824,25 @@ discard block |
||
1824 | 1824 | $lp_id = 0; |
1825 | 1825 | } |
1826 | 1826 | if (empty($lp_item_id)) { |
1827 | - $lp_item_id = 0; |
|
1827 | + $lp_item_id = 0; |
|
1828 | 1828 | } |
1829 | 1829 | if (empty($lp_item_view_id)) { |
1830 | 1830 | $lp_item_view_id = 0; |
1831 | 1831 | } |
1832 | - $condition = ' WHERE exe_exo_id = ' . "'" . $this->id . "'" .' AND |
|
1833 | - exe_user_id = ' . "'" . api_get_user_id() . "'" . ' AND |
|
1834 | - c_id = ' . api_get_course_int_id() . ' AND |
|
1835 | - status = ' . "'" . Database::escape_string($status). "'" . ' AND |
|
1836 | - orig_lp_id = ' . "'" . $lp_id . "'" . ' AND |
|
1837 | - orig_lp_item_id = ' . "'" . $lp_item_id . "'" . ' AND |
|
1838 | - orig_lp_item_view_id = ' . "'" . $lp_item_view_id . "'" . ' AND |
|
1839 | - session_id = ' . "'" . api_get_session_id() . "' LIMIT 1"; //Adding limit 1 just in case |
|
1832 | + $condition = ' WHERE exe_exo_id = '."'".$this->id."'".' AND |
|
1833 | + exe_user_id = ' . "'".api_get_user_id()."'".' AND |
|
1834 | + c_id = ' . api_get_course_int_id().' AND |
|
1835 | + status = ' . "'".Database::escape_string($status)."'".' AND |
|
1836 | + orig_lp_id = ' . "'".$lp_id."'".' AND |
|
1837 | + orig_lp_item_id = ' . "'".$lp_item_id."'".' AND |
|
1838 | + orig_lp_item_view_id = ' . "'".$lp_item_view_id."'".' AND |
|
1839 | + session_id = ' . "'".api_get_session_id()."' LIMIT 1"; //Adding limit 1 just in case |
|
1840 | 1840 | |
1841 | 1841 | $sql_track = 'SELECT * FROM '.$track_exercises.$condition; |
1842 | 1842 | |
1843 | 1843 | $result = Database::query($sql_track); |
1844 | 1844 | $new_array = array(); |
1845 | - if (Database::num_rows($result) > 0 ) { |
|
1845 | + if (Database::num_rows($result) > 0) { |
|
1846 | 1846 | $new_array = Database::fetch_array($result, 'ASSOC'); |
1847 | 1847 | $new_array['num_exe'] = Database::num_rows($result); |
1848 | 1848 | } |
@@ -1885,12 +1885,12 @@ discard block |
||
1885 | 1885 | $questionList = array_map('intval', $questionList); |
1886 | 1886 | |
1887 | 1887 | $params = array( |
1888 | - 'exe_exo_id' => $this->id , |
|
1888 | + 'exe_exo_id' => $this->id, |
|
1889 | 1889 | 'exe_user_id' => api_get_user_id(), |
1890 | 1890 | 'c_id' => api_get_course_int_id(), |
1891 | 1891 | 'status' => 'incomplete', |
1892 | 1892 | 'session_id' => api_get_session_id(), |
1893 | - 'data_tracking' => implode(',', $questionList) , |
|
1893 | + 'data_tracking' => implode(',', $questionList), |
|
1894 | 1894 | 'start_date' => api_get_utc_datetime(), |
1895 | 1895 | 'orig_lp_id' => $safe_lp_id, |
1896 | 1896 | 'orig_lp_item_id' => $safe_lp_item_id, |
@@ -1922,7 +1922,7 @@ discard block |
||
1922 | 1922 | $nbrQuestions = $this->get_count_question_list(); |
1923 | 1923 | |
1924 | 1924 | $all_button = $html = $label = ''; |
1925 | - $hotspot_get = isset($_POST['hotspot']) ? Security::remove_XSS($_POST['hotspot']):null; |
|
1925 | + $hotspot_get = isset($_POST['hotspot']) ? Security::remove_XSS($_POST['hotspot']) : null; |
|
1926 | 1926 | |
1927 | 1927 | if ($this->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT && $this->type == ONE_PER_PAGE) { |
1928 | 1928 | $urlTitle = get_lang('ContinueTest'); |
@@ -1933,7 +1933,7 @@ discard block |
||
1933 | 1933 | |
1934 | 1934 | $html .= Display::url( |
1935 | 1935 | $urlTitle, |
1936 | - 'exercise_submit_modal.php?' . http_build_query([ |
|
1936 | + 'exercise_submit_modal.php?'.http_build_query([ |
|
1937 | 1937 | 'learnpath_id' => $safe_lp_id, |
1938 | 1938 | 'learnpath_item_id' => $safe_lp_item_id, |
1939 | 1939 | 'learnpath_item_view_id' => $safe_lp_item_view_id, |
@@ -1950,7 +1950,7 @@ discard block |
||
1950 | 1950 | 'data-size' => 'md' |
1951 | 1951 | ] |
1952 | 1952 | ); |
1953 | - $html .='<br />'; |
|
1953 | + $html .= '<br />'; |
|
1954 | 1954 | } else { |
1955 | 1955 | // User |
1956 | 1956 | if (api_is_allowed_to_session_edit()) { |
@@ -1975,7 +1975,7 @@ discard block |
||
1975 | 1975 | |
1976 | 1976 | //Next question |
1977 | 1977 | if (!empty($questions_in_media)) { |
1978 | - $questions_in_media = "['".implode("','",$questions_in_media)."']"; |
|
1978 | + $questions_in_media = "['".implode("','", $questions_in_media)."']"; |
|
1979 | 1979 | $all_button .= ' <a href="javascript://" class="'.$class.'" onclick="save_question_list('.$questions_in_media.'); ">'.$label.'</a>'; |
1980 | 1980 | } else { |
1981 | 1981 | $all_button .= ' <a href="javascript://" class="'.$class.'" onclick="save_now('.$question_id.', \'\', \''.$currentAnswer.'\'); ">'.$label.'</a>'; |
@@ -1993,7 +1993,7 @@ discard block |
||
1993 | 1993 | } |
1994 | 1994 | $class .= ' question-validate-btn'; // used to select it with jquery |
1995 | 1995 | $all_button = ' <a href="javascript://" class="'.$class.'" onclick="validate_all(); ">'.$all_label.'</a>'; |
1996 | - $all_button .= ' ' . Display::span(null, ['id' => 'save_all_reponse']); |
|
1996 | + $all_button .= ' '.Display::span(null, ['id' => 'save_all_reponse']); |
|
1997 | 1997 | $html .= $all_button; |
1998 | 1998 | } |
1999 | 1999 | } |
@@ -2233,8 +2233,8 @@ discard block |
||
2233 | 2233 | $params = array(); |
2234 | 2234 | $params['course_id'] = $course_id; |
2235 | 2235 | $params['session_id'] = api_get_session_id(); |
2236 | - $params['user_id'] = isset($exe_info['exe_user_id'])? $exe_info['exe_user_id'] : api_get_user_id(); |
|
2237 | - $params['exercise_id'] = isset($exe_info['exe_exo_id'])? $exe_info['exe_exo_id'] : $this->id; |
|
2236 | + $params['user_id'] = isset($exe_info['exe_user_id']) ? $exe_info['exe_user_id'] : api_get_user_id(); |
|
2237 | + $params['exercise_id'] = isset($exe_info['exe_exo_id']) ? $exe_info['exe_exo_id'] : $this->id; |
|
2238 | 2238 | $params['question_id'] = $questionId; |
2239 | 2239 | $params['exe_id'] = isset($exe_info['exe_id']) ? $exe_info['exe_id'] : $exeId; |
2240 | 2240 | |
@@ -2276,10 +2276,10 @@ discard block |
||
2276 | 2276 | $answer = $objAnswerTmp->selectAnswer($answerId); |
2277 | 2277 | $answerComment = $objAnswerTmp->selectComment($answerId); |
2278 | 2278 | $answerCorrect = $objAnswerTmp->isCorrect($answerId); |
2279 | - $answerWeighting = (float)$objAnswerTmp->selectWeighting($answerId); |
|
2279 | + $answerWeighting = (float) $objAnswerTmp->selectWeighting($answerId); |
|
2280 | 2280 | $answerAutoId = $objAnswerTmp->selectAutoId($answerId); |
2281 | 2281 | |
2282 | - $answer_correct_array[$answerId] = (bool)$answerCorrect; |
|
2282 | + $answer_correct_array[$answerId] = (bool) $answerCorrect; |
|
2283 | 2283 | |
2284 | 2284 | if ($debug) { |
2285 | 2285 | error_log("answer auto id: $answerAutoId "); |
@@ -2288,7 +2288,7 @@ discard block |
||
2288 | 2288 | |
2289 | 2289 | // Delineation |
2290 | 2290 | $delineation_cord = $objAnswerTmp->selectHotspotCoordinates(1); |
2291 | - $answer_delineation_destination=$objAnswerTmp->selectDestination(1); |
|
2291 | + $answer_delineation_destination = $objAnswerTmp->selectDestination(1); |
|
2292 | 2292 | |
2293 | 2293 | switch ($answerType) { |
2294 | 2294 | // for unique answer |
@@ -2301,7 +2301,7 @@ discard block |
||
2301 | 2301 | exe_id = '".$exeId."' AND |
2302 | 2302 | question_id= '".$questionId."'"; |
2303 | 2303 | $result = Database::query($sql); |
2304 | - $choice = Database::result($result,0,"answer"); |
|
2304 | + $choice = Database::result($result, 0, "answer"); |
|
2305 | 2305 | |
2306 | 2306 | $studentChoice = $choice == $answerAutoId ? 1 : 0; |
2307 | 2307 | if ($studentChoice) { |
@@ -2352,7 +2352,7 @@ discard block |
||
2352 | 2352 | } else { |
2353 | 2353 | // If no result then the user just hit don't know |
2354 | 2354 | $studentChoice = 3; |
2355 | - $questionScore += $doubt_score; |
|
2355 | + $questionScore += $doubt_score; |
|
2356 | 2356 | } |
2357 | 2357 | $totalScore = $questionScore; |
2358 | 2358 | break; |
@@ -2368,17 +2368,17 @@ discard block |
||
2368 | 2368 | } |
2369 | 2369 | |
2370 | 2370 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
2371 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
2371 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
2372 | 2372 | |
2373 | 2373 | if ($studentChoice) { |
2374 | - $questionScore +=$answerWeighting; |
|
2374 | + $questionScore += $answerWeighting; |
|
2375 | 2375 | } |
2376 | 2376 | } else { |
2377 | 2377 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
2378 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
2378 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
2379 | 2379 | |
2380 | 2380 | if (isset($studentChoice)) { |
2381 | - $questionScore += $answerWeighting; |
|
2381 | + $questionScore += $answerWeighting; |
|
2382 | 2382 | } |
2383 | 2383 | } |
2384 | 2384 | $totalScore += $answerWeighting; |
@@ -2396,16 +2396,16 @@ discard block |
||
2396 | 2396 | $choice[$ind] = 1; |
2397 | 2397 | } |
2398 | 2398 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
2399 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
2399 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
2400 | 2400 | if ($studentChoice) { |
2401 | - $questionScore +=$answerWeighting; |
|
2401 | + $questionScore += $answerWeighting; |
|
2402 | 2402 | } |
2403 | 2403 | } else { |
2404 | 2404 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
2405 | 2405 | if (isset($studentChoice)) { |
2406 | 2406 | $questionScore += $answerWeighting; |
2407 | 2407 | } |
2408 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
2408 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
2409 | 2409 | } |
2410 | 2410 | $totalScore += $answerWeighting; |
2411 | 2411 | if ($debug) error_log("studentChoice: $studentChoice"); |
@@ -2417,7 +2417,7 @@ discard block |
||
2417 | 2417 | $resultans = Database::query($sql); |
2418 | 2418 | while ($row = Database::fetch_array($resultans)) { |
2419 | 2419 | $ind = $row['answer']; |
2420 | - $result = explode(':',$ind); |
|
2420 | + $result = explode(':', $ind); |
|
2421 | 2421 | if (isset($result[0])) { |
2422 | 2422 | $my_answer_id = isset($result[0]) ? $result[0] : ''; |
2423 | 2423 | $option = isset($result[1]) ? $result[1] : ''; |
@@ -2538,10 +2538,10 @@ discard block |
||
2538 | 2538 | } |
2539 | 2539 | // adds the piece of text that is before the blank |
2540 | 2540 | //and ends with '[' into a general storage array |
2541 | - $real_text[] = api_substr($temp, 0, $pos +1); |
|
2542 | - $answer .= api_substr($temp, 0, $pos +1); |
|
2541 | + $real_text[] = api_substr($temp, 0, $pos + 1); |
|
2542 | + $answer .= api_substr($temp, 0, $pos + 1); |
|
2543 | 2543 | //take the string remaining (after the last "[" we found) |
2544 | - $temp = api_substr($temp, $pos +1); |
|
2544 | + $temp = api_substr($temp, $pos + 1); |
|
2545 | 2545 | // quit the loop if there are no more blanks, and update $pos to the position of next ']' |
2546 | 2546 | if (($pos = api_strpos($temp, ']')) === false) { |
2547 | 2547 | // adds the end of the text |
@@ -2577,7 +2577,7 @@ discard block |
||
2577 | 2577 | //put the contents of the [] answer tag into correct_tags[] |
2578 | 2578 | $correct_tags[] = api_substr($temp, 0, $pos); |
2579 | 2579 | $j++; |
2580 | - $temp = api_substr($temp, $pos +1); |
|
2580 | + $temp = api_substr($temp, $pos + 1); |
|
2581 | 2581 | } |
2582 | 2582 | $answer = ''; |
2583 | 2583 | $real_correct_tags = $correct_tags; |
@@ -2600,7 +2600,7 @@ discard block |
||
2600 | 2600 | } elseif (!empty($user_tags[$i])) { |
2601 | 2601 | // else if the word entered by the student IS NOT the same as the one defined by the professor |
2602 | 2602 | // adds the word in red at the end of the string, and strikes it |
2603 | - $answer .= '<font color="red"><s>' . $user_tags[$i] . '</s></font>'; |
|
2603 | + $answer .= '<font color="red"><s>'.$user_tags[$i].'</s></font>'; |
|
2604 | 2604 | } else { |
2605 | 2605 | // adds a tabulation if no word has been typed by the student |
2606 | 2606 | $answer .= ''; // remove that causes issue |
@@ -2619,17 +2619,17 @@ discard block |
||
2619 | 2619 | } elseif (!empty ($user_tags[$i])) { |
2620 | 2620 | // else if the word entered by the student IS NOT the same as the one defined by the professor |
2621 | 2621 | // adds the word in red at the end of the string, and strikes it |
2622 | - $answer .= '<font color="red"><s>' . $user_tags[$i] . '</s></font>'; |
|
2622 | + $answer .= '<font color="red"><s>'.$user_tags[$i].'</s></font>'; |
|
2623 | 2623 | } else { |
2624 | 2624 | // adds a tabulation if no word has been typed by the student |
2625 | - $answer .= ''; // remove that causes issue |
|
2625 | + $answer .= ''; // remove that causes issue |
|
2626 | 2626 | } |
2627 | 2627 | } |
2628 | 2628 | |
2629 | 2629 | // adds the correct word, followed by ] to close the blank |
2630 | - $answer .= ' / <font color="green"><b>' . $real_correct_tags[$i] . '</b></font>]'; |
|
2631 | - if (isset($real_text[$i +1])) { |
|
2632 | - $answer .= $real_text[$i +1]; |
|
2630 | + $answer .= ' / <font color="green"><b>'.$real_correct_tags[$i].'</b></font>]'; |
|
2631 | + if (isset($real_text[$i + 1])) { |
|
2632 | + $answer .= $real_text[$i + 1]; |
|
2633 | 2633 | } |
2634 | 2634 | } |
2635 | 2635 | } else { |
@@ -2763,10 +2763,10 @@ discard block |
||
2763 | 2763 | } |
2764 | 2764 | // adds the piece of text that is before the blank |
2765 | 2765 | //and ends with '[' into a general storage array |
2766 | - $realText[] = api_substr($temp, 0, $pos +1); |
|
2767 | - $answer .= api_substr($temp, 0, $pos +1); |
|
2766 | + $realText[] = api_substr($temp, 0, $pos + 1); |
|
2767 | + $answer .= api_substr($temp, 0, $pos + 1); |
|
2768 | 2768 | //take the string remaining (after the last "[" we found) |
2769 | - $temp = api_substr($temp, $pos +1); |
|
2769 | + $temp = api_substr($temp, $pos + 1); |
|
2770 | 2770 | // quit the loop if there are no more blanks, and update $pos to the position of next ']' |
2771 | 2771 | if (($pos = api_strpos($temp, ']')) === false) { |
2772 | 2772 | // adds the end of the text |
@@ -2800,7 +2800,7 @@ discard block |
||
2800 | 2800 | //put the contents of the [] answer tag into correct_tags[] |
2801 | 2801 | $correctTags[] = api_substr($temp, 0, $pos); |
2802 | 2802 | $j++; |
2803 | - $temp = api_substr($temp, $pos +1); |
|
2803 | + $temp = api_substr($temp, $pos + 1); |
|
2804 | 2804 | } |
2805 | 2805 | $answer = ''; |
2806 | 2806 | $realCorrectTags = $correctTags; |
@@ -2820,22 +2820,22 @@ discard block |
||
2820 | 2820 | } elseif (!empty($userTags[$i])) { |
2821 | 2821 | // else if the word entered by the student IS NOT the same as the one defined by the professor |
2822 | 2822 | // adds the word in red at the end of the string, and strikes it |
2823 | - $answer .= '<font color="red"><s>' . $userTags[$i] . '</s></font>'; |
|
2823 | + $answer .= '<font color="red"><s>'.$userTags[$i].'</s></font>'; |
|
2824 | 2824 | } else { |
2825 | 2825 | // adds a tabulation if no word has been typed by the student |
2826 | 2826 | $answer .= ''; // remove that causes issue |
2827 | 2827 | } |
2828 | 2828 | // adds the correct word, followed by ] to close the blank |
2829 | - $answer .= ' / <font color="green"><b>' . $realCorrectTags[$i] . '</b></font>]'; |
|
2830 | - if (isset($realText[$i +1])) { |
|
2831 | - $answer .= $realText[$i +1]; |
|
2829 | + $answer .= ' / <font color="green"><b>'.$realCorrectTags[$i].'</b></font>]'; |
|
2830 | + if (isset($realText[$i + 1])) { |
|
2831 | + $answer .= $realText[$i + 1]; |
|
2832 | 2832 | } |
2833 | 2833 | } |
2834 | 2834 | break; |
2835 | 2835 | // for free answer |
2836 | 2836 | case FREE_ANSWER: |
2837 | 2837 | if ($from_database) { |
2838 | - $query = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT." |
|
2838 | + $query = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT." |
|
2839 | 2839 | WHERE exe_id = '".$exeId."' AND question_id= '".$questionId."'"; |
2840 | 2840 | $resq = Database::query($query); |
2841 | 2841 | $data = Database::fetch_array($resq); |
@@ -2846,9 +2846,9 @@ discard block |
||
2846 | 2846 | $questionScore = $data['marks']; |
2847 | 2847 | |
2848 | 2848 | if ($questionScore == -1) { |
2849 | - $totalScore+= 0; |
|
2849 | + $totalScore += 0; |
|
2850 | 2850 | } else { |
2851 | - $totalScore+= $questionScore; |
|
2851 | + $totalScore += $questionScore; |
|
2852 | 2852 | } |
2853 | 2853 | if ($questionScore == '') { |
2854 | 2854 | $questionScore = 0; |
@@ -2869,14 +2869,14 @@ discard block |
||
2869 | 2869 | $query = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT." |
2870 | 2870 | WHERE exe_id = '".$exeId."' AND question_id= '".$questionId."'"; |
2871 | 2871 | $resq = Database::query($query); |
2872 | - $choice = Database::result($resq,0,'answer'); |
|
2872 | + $choice = Database::result($resq, 0, 'answer'); |
|
2873 | 2873 | $choice = str_replace('\r\n', '', $choice); |
2874 | 2874 | $choice = stripslashes($choice); |
2875 | - $questionScore = Database::result($resq,0,"marks"); |
|
2876 | - if ($questionScore==-1) { |
|
2877 | - $totalScore+=0; |
|
2875 | + $questionScore = Database::result($resq, 0, "marks"); |
|
2876 | + if ($questionScore == -1) { |
|
2877 | + $totalScore += 0; |
|
2878 | 2878 | } else { |
2879 | - $totalScore+=$questionScore; |
|
2879 | + $totalScore += $questionScore; |
|
2880 | 2880 | } |
2881 | 2881 | $arrques = $questionName; |
2882 | 2882 | $arrans = $choice; |
@@ -2921,7 +2921,7 @@ discard block |
||
2921 | 2921 | |
2922 | 2922 | while ($a_answers = Database::fetch_array($res_answers)) { |
2923 | 2923 | $i_answer_id = $a_answers['id']; //3 |
2924 | - $s_answer_label = $a_answers['answer']; // your daddy - your mother |
|
2924 | + $s_answer_label = $a_answers['answer']; // your daddy - your mother |
|
2925 | 2925 | $i_answer_correct_answer = $a_answers['correct']; //1 - 2 |
2926 | 2926 | $i_answer_id_auto = $a_answers['id_auto']; // 3 - 4 |
2927 | 2927 | |
@@ -2973,8 +2973,8 @@ discard block |
||
2973 | 2973 | |
2974 | 2974 | if ($show_result) { |
2975 | 2975 | echo '<tr>'; |
2976 | - echo '<td>' . $s_answer_label . '</td>'; |
|
2977 | - echo '<td>' . $user_answer; |
|
2976 | + echo '<td>'.$s_answer_label.'</td>'; |
|
2977 | + echo '<td>'.$user_answer; |
|
2978 | 2978 | |
2979 | 2979 | if (in_array($answerType, [MATCHING, MATCHING_DRAGGABLE])) { |
2980 | 2980 | if (isset($real_list[$i_answer_correct_answer])) { |
@@ -3083,7 +3083,7 @@ discard block |
||
3083 | 3083 | if ($from_database) { |
3084 | 3084 | // getting the user answer |
3085 | 3085 | $TBL_TRACK_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT); |
3086 | - $query = "SELECT hotspot_correct, hotspot_coordinate |
|
3086 | + $query = "SELECT hotspot_correct, hotspot_coordinate |
|
3087 | 3087 | FROM $TBL_TRACK_HOTSPOT |
3088 | 3088 | WHERE |
3089 | 3089 | hotspot_exe_id = '".$exeId."' AND |
@@ -3091,20 +3091,20 @@ discard block |
||
3091 | 3091 | hotspot_answer_id='1'"; |
3092 | 3092 | //by default we take 1 because it's a delineation |
3093 | 3093 | $resq = Database::query($query); |
3094 | - $row = Database::fetch_array($resq,'ASSOC'); |
|
3094 | + $row = Database::fetch_array($resq, 'ASSOC'); |
|
3095 | 3095 | |
3096 | 3096 | $choice = $row['hotspot_correct']; |
3097 | 3097 | $user_answer = $row['hotspot_coordinate']; |
3098 | 3098 | |
3099 | 3099 | // THIS is very important otherwise the poly_compile will throw an error!! |
3100 | 3100 | // round-up the coordinates |
3101 | - $coords = explode('/',$user_answer); |
|
3101 | + $coords = explode('/', $user_answer); |
|
3102 | 3102 | $user_array = ''; |
3103 | 3103 | foreach ($coords as $coord) { |
3104 | - list($x,$y) = explode(';',$coord); |
|
3104 | + list($x, $y) = explode(';', $coord); |
|
3105 | 3105 | $user_array .= round($x).';'.round($y).'/'; |
3106 | 3106 | } |
3107 | - $user_array = substr($user_array,0,-1); |
|
3107 | + $user_array = substr($user_array, 0, -1); |
|
3108 | 3108 | } else { |
3109 | 3109 | if (!empty($studentChoice)) { |
3110 | 3110 | $newquestionList[] = $questionId; |
@@ -3114,13 +3114,13 @@ discard block |
||
3114 | 3114 | $studentChoice = $choice[$answerId]; |
3115 | 3115 | $questionScore += $answerWeighting; |
3116 | 3116 | |
3117 | - if ($hotspot_delineation_result[1]==1) { |
|
3117 | + if ($hotspot_delineation_result[1] == 1) { |
|
3118 | 3118 | $totalScore += $answerWeighting; //adding the total |
3119 | 3119 | } |
3120 | 3120 | } |
3121 | 3121 | } |
3122 | - $_SESSION['hotspot_coord'][1] = $delineation_cord; |
|
3123 | - $_SESSION['hotspot_dest'][1] = $answer_delineation_destination; |
|
3122 | + $_SESSION['hotspot_coord'][1] = $delineation_cord; |
|
3123 | + $_SESSION['hotspot_dest'][1] = $answer_delineation_destination; |
|
3124 | 3124 | break; |
3125 | 3125 | } // end switch Answertype |
3126 | 3126 | |
@@ -3178,7 +3178,7 @@ discard block |
||
3178 | 3178 | $results_disabled |
3179 | 3179 | ); |
3180 | 3180 | //} |
3181 | - } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE ) { |
|
3181 | + } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) { |
|
3182 | 3182 | // if ($origin!='learnpath') { |
3183 | 3183 | ExerciseShowFunctions::display_multiple_answer_combination_true_false( |
3184 | 3184 | $feedback_type, |
@@ -3195,11 +3195,11 @@ discard block |
||
3195 | 3195 | //} |
3196 | 3196 | } elseif ($answerType == FILL_IN_BLANKS) { |
3197 | 3197 | //if ($origin!='learnpath') { |
3198 | - ExerciseShowFunctions::display_fill_in_blanks_answer($feedback_type, $answer,0,0, $results_disabled); |
|
3198 | + ExerciseShowFunctions::display_fill_in_blanks_answer($feedback_type, $answer, 0, 0, $results_disabled); |
|
3199 | 3199 | // } |
3200 | 3200 | } elseif ($answerType == CALCULATED_ANSWER) { |
3201 | 3201 | //if ($origin!='learnpath') { |
3202 | - ExerciseShowFunctions::display_calculated_answer($feedback_type, $answer,0,0); |
|
3202 | + ExerciseShowFunctions::display_calculated_answer($feedback_type, $answer, 0, 0); |
|
3203 | 3203 | // } |
3204 | 3204 | } elseif ($answerType == FREE_ANSWER) { |
3205 | 3205 | //if($origin != 'learnpath') { |
@@ -3246,13 +3246,13 @@ discard block |
||
3246 | 3246 | $user_answer = $_SESSION['exerciseResultCoordinates'][$questionId]; |
3247 | 3247 | |
3248 | 3248 | //round-up the coordinates |
3249 | - $coords = explode('/',$user_answer); |
|
3249 | + $coords = explode('/', $user_answer); |
|
3250 | 3250 | $user_array = ''; |
3251 | 3251 | foreach ($coords as $coord) { |
3252 | - list($x,$y) = explode(';',$coord); |
|
3252 | + list($x, $y) = explode(';', $coord); |
|
3253 | 3253 | $user_array .= round($x).';'.round($y).'/'; |
3254 | 3254 | } |
3255 | - $user_array = substr($user_array,0,-1); |
|
3255 | + $user_array = substr($user_array, 0, -1); |
|
3256 | 3256 | |
3257 | 3257 | if ($next) { |
3258 | 3258 | |
@@ -3279,7 +3279,7 @@ discard block |
||
3279 | 3279 | //$overlap = round(polygons_overlap($poly_answer,$poly_user)); |
3280 | 3280 | // //this is an area in pixels |
3281 | 3281 | if ($debug > 0) { |
3282 | - error_log(__LINE__ . ' - Polygons results are ' . print_r($poly_results, 1), 0); |
|
3282 | + error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0); |
|
3283 | 3283 | } |
3284 | 3284 | |
3285 | 3285 | if ($overlap < 1) { |
@@ -3292,43 +3292,43 @@ discard block |
||
3292 | 3292 | // that is overlapped by the user's polygon |
3293 | 3293 | $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100); |
3294 | 3294 | if ($debug > 1) { |
3295 | - error_log(__LINE__ . ' - Final overlap is ' . $final_overlap, 0); |
|
3295 | + error_log(__LINE__.' - Final overlap is '.$final_overlap, 0); |
|
3296 | 3296 | } |
3297 | 3297 | // the final missing area is the percentage of the initial polygon |
3298 | 3298 | // that is not overlapped by the user's polygon |
3299 | 3299 | $final_missing = 100 - $final_overlap; |
3300 | 3300 | if ($debug > 1) { |
3301 | - error_log(__LINE__ . ' - Final missing is ' . $final_missing, 0); |
|
3301 | + error_log(__LINE__.' - Final missing is '.$final_missing, 0); |
|
3302 | 3302 | } |
3303 | 3303 | // the final excess area is the percentage of the initial polygon's size |
3304 | 3304 | // that is covered by the user's polygon outside of the initial polygon |
3305 | 3305 | $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100); |
3306 | 3306 | if ($debug > 1) { |
3307 | - error_log(__LINE__ . ' - Final excess is ' . $final_excess, 0); |
|
3307 | + error_log(__LINE__.' - Final excess is '.$final_excess, 0); |
|
3308 | 3308 | } |
3309 | 3309 | } |
3310 | 3310 | |
3311 | 3311 | //checking the destination parameters parsing the "@@" |
3312 | - $destination_items= explode('@@', $answerDestination); |
|
3312 | + $destination_items = explode('@@', $answerDestination); |
|
3313 | 3313 | $threadhold_total = $destination_items[0]; |
3314 | - $threadhold_items=explode(';',$threadhold_total); |
|
3314 | + $threadhold_items = explode(';', $threadhold_total); |
|
3315 | 3315 | $threadhold1 = $threadhold_items[0]; // overlap |
3316 | 3316 | $threadhold2 = $threadhold_items[1]; // excess |
3317 | - $threadhold3 = $threadhold_items[2]; //missing |
|
3317 | + $threadhold3 = $threadhold_items[2]; //missing |
|
3318 | 3318 | |
3319 | 3319 | // if is delineation |
3320 | - if ($answerId===1) { |
|
3320 | + if ($answerId === 1) { |
|
3321 | 3321 | //setting colors |
3322 | - if ($final_overlap>=$threadhold1) { |
|
3323 | - $overlap_color=true; //echo 'a'; |
|
3322 | + if ($final_overlap >= $threadhold1) { |
|
3323 | + $overlap_color = true; //echo 'a'; |
|
3324 | 3324 | } |
3325 | 3325 | //echo $excess.'-'.$threadhold2; |
3326 | - if ($final_excess<=$threadhold2) { |
|
3327 | - $excess_color=true; //echo 'b'; |
|
3326 | + if ($final_excess <= $threadhold2) { |
|
3327 | + $excess_color = true; //echo 'b'; |
|
3328 | 3328 | } |
3329 | 3329 | //echo '--------'.$missing.'-'.$threadhold3; |
3330 | - if ($final_missing<=$threadhold3) { |
|
3331 | - $missing_color=true; //echo 'c'; |
|
3330 | + if ($final_missing <= $threadhold3) { |
|
3331 | + $missing_color = true; //echo 'c'; |
|
3332 | 3332 | } |
3333 | 3333 | |
3334 | 3334 | // if pass |
@@ -3337,67 +3337,67 @@ discard block |
||
3337 | 3337 | $final_missing <= $threadhold3 && |
3338 | 3338 | $final_excess <= $threadhold2 |
3339 | 3339 | ) { |
3340 | - $next=1; //go to the oars |
|
3341 | - $result_comment=get_lang('Acceptable'); |
|
3342 | - $final_answer = 1; // do not update with update_exercise_attempt |
|
3340 | + $next = 1; //go to the oars |
|
3341 | + $result_comment = get_lang('Acceptable'); |
|
3342 | + $final_answer = 1; // do not update with update_exercise_attempt |
|
3343 | 3343 | } else { |
3344 | - $next=0; |
|
3345 | - $result_comment=get_lang('Unacceptable'); |
|
3346 | - $comment=$answerDestination=$objAnswerTmp->selectComment(1); |
|
3347 | - $answerDestination=$objAnswerTmp->selectDestination(1); |
|
3344 | + $next = 0; |
|
3345 | + $result_comment = get_lang('Unacceptable'); |
|
3346 | + $comment = $answerDestination = $objAnswerTmp->selectComment(1); |
|
3347 | + $answerDestination = $objAnswerTmp->selectDestination(1); |
|
3348 | 3348 | //checking the destination parameters parsing the "@@" |
3349 | - $destination_items= explode('@@', $answerDestination); |
|
3349 | + $destination_items = explode('@@', $answerDestination); |
|
3350 | 3350 | } |
3351 | - } elseif($answerId>1) { |
|
3351 | + } elseif ($answerId > 1) { |
|
3352 | 3352 | if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') { |
3353 | - if ($debug>0) { |
|
3354 | - error_log(__LINE__.' - answerId is of type noerror',0); |
|
3353 | + if ($debug > 0) { |
|
3354 | + error_log(__LINE__.' - answerId is of type noerror', 0); |
|
3355 | 3355 | } |
3356 | 3356 | //type no error shouldn't be treated |
3357 | 3357 | $next = 1; |
3358 | 3358 | continue; |
3359 | 3359 | } |
3360 | - if ($debug>0) { |
|
3361 | - error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR',0); |
|
3360 | + if ($debug > 0) { |
|
3361 | + error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0); |
|
3362 | 3362 | } |
3363 | 3363 | //check the intersection between the oar and the user |
3364 | 3364 | //echo 'user'; print_r($x_user_list); print_r($y_user_list); |
3365 | 3365 | //echo 'official';print_r($x_list);print_r($y_list); |
3366 | 3366 | //$result = get_intersection_data($x_list,$y_list,$x_user_list,$y_user_list); |
3367 | - $inter= $result['success']; |
|
3367 | + $inter = $result['success']; |
|
3368 | 3368 | |
3369 | 3369 | //$delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId); |
3370 | - $delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId); |
|
3370 | + $delineation_cord = $objAnswerTmp->selectHotspotCoordinates($answerId); |
|
3371 | 3371 | |
3372 | - $poly_answer = convert_coordinates($delineation_cord,'|'); |
|
3373 | - $max_coord = poly_get_max($poly_user,$poly_answer); |
|
3374 | - $poly_answer_compiled = poly_compile($poly_answer,$max_coord); |
|
3375 | - $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord); |
|
3372 | + $poly_answer = convert_coordinates($delineation_cord, '|'); |
|
3373 | + $max_coord = poly_get_max($poly_user, $poly_answer); |
|
3374 | + $poly_answer_compiled = poly_compile($poly_answer, $max_coord); |
|
3375 | + $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord); |
|
3376 | 3376 | |
3377 | 3377 | if ($overlap == false) { |
3378 | 3378 | //all good, no overlap |
3379 | 3379 | $next = 1; |
3380 | 3380 | continue; |
3381 | 3381 | } else { |
3382 | - if ($debug>0) { |
|
3383 | - error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit',0); |
|
3382 | + if ($debug > 0) { |
|
3383 | + error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0); |
|
3384 | 3384 | } |
3385 | 3385 | $organs_at_risk_hit++; |
3386 | 3386 | //show the feedback |
3387 | - $next=0; |
|
3388 | - $comment=$answerDestination=$objAnswerTmp->selectComment($answerId); |
|
3389 | - $answerDestination=$objAnswerTmp->selectDestination($answerId); |
|
3390 | - |
|
3391 | - $destination_items= explode('@@', $answerDestination); |
|
3392 | - $try_hotspot=$destination_items[1]; |
|
3393 | - $lp_hotspot=$destination_items[2]; |
|
3394 | - $select_question_hotspot=$destination_items[3]; |
|
3395 | - $url_hotspot=$destination_items[4]; |
|
3387 | + $next = 0; |
|
3388 | + $comment = $answerDestination = $objAnswerTmp->selectComment($answerId); |
|
3389 | + $answerDestination = $objAnswerTmp->selectDestination($answerId); |
|
3390 | + |
|
3391 | + $destination_items = explode('@@', $answerDestination); |
|
3392 | + $try_hotspot = $destination_items[1]; |
|
3393 | + $lp_hotspot = $destination_items[2]; |
|
3394 | + $select_question_hotspot = $destination_items[3]; |
|
3395 | + $url_hotspot = $destination_items[4]; |
|
3396 | 3396 | } |
3397 | 3397 | } |
3398 | 3398 | } else { // the first delineation feedback |
3399 | - if ($debug>0) { |
|
3400 | - error_log(__LINE__.' first',0); |
|
3399 | + if ($debug > 0) { |
|
3400 | + error_log(__LINE__.' first', 0); |
|
3401 | 3401 | } |
3402 | 3402 | } |
3403 | 3403 | } elseif (in_array($answerType, [MATCHING, MATCHING_DRAGGABLE])) { |
@@ -3405,7 +3405,7 @@ discard block |
||
3405 | 3405 | echo Display::tag('td', $answerMatching[$answerId]); |
3406 | 3406 | echo Display::tag( |
3407 | 3407 | 'td', |
3408 | - "$user_answer / " . Display::tag( |
|
3408 | + "$user_answer / ".Display::tag( |
|
3409 | 3409 | 'strong', |
3410 | 3410 | $answerMatching[$answerCorrect], |
3411 | 3411 | ['style' => 'color: #008000; font-weight: bold;'] |
@@ -3545,7 +3545,7 @@ discard block |
||
3545 | 3545 | $exeId, |
3546 | 3546 | $questionId, |
3547 | 3547 | $nano |
3548 | - ) . '</td> |
|
3548 | + ).'</td> |
|
3549 | 3549 | </tr> |
3550 | 3550 | </table>'; |
3551 | 3551 | break; |
@@ -3604,7 +3604,7 @@ discard block |
||
3604 | 3604 | |
3605 | 3605 | //$overlap = round(polygons_overlap($poly_answer,$poly_user)); //this is an area in pixels |
3606 | 3606 | if ($debug > 0) { |
3607 | - error_log(__LINE__ . ' - Polygons results are ' . print_r($poly_results, 1), 0); |
|
3607 | + error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0); |
|
3608 | 3608 | } |
3609 | 3609 | if ($overlap < 1) { |
3610 | 3610 | //shortcut to avoid complicated calculations |
@@ -3615,17 +3615,17 @@ discard block |
||
3615 | 3615 | // the final overlap is the percentage of the initial polygon that is overlapped by the user's polygon |
3616 | 3616 | $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100); |
3617 | 3617 | if ($debug > 1) { |
3618 | - error_log(__LINE__ . ' - Final overlap is ' . $final_overlap, 0); |
|
3618 | + error_log(__LINE__.' - Final overlap is '.$final_overlap, 0); |
|
3619 | 3619 | } |
3620 | 3620 | // the final missing area is the percentage of the initial polygon that is not overlapped by the user's polygon |
3621 | 3621 | $final_missing = 100 - $final_overlap; |
3622 | 3622 | if ($debug > 1) { |
3623 | - error_log(__LINE__ . ' - Final missing is ' . $final_missing, 0); |
|
3623 | + error_log(__LINE__.' - Final missing is '.$final_missing, 0); |
|
3624 | 3624 | } |
3625 | 3625 | // the final excess area is the percentage of the initial polygon's size that is covered by the user's polygon outside of the initial polygon |
3626 | 3626 | $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100); |
3627 | 3627 | if ($debug > 1) { |
3628 | - error_log(__LINE__ . ' - Final excess is ' . $final_excess, 0); |
|
3628 | + error_log(__LINE__.' - Final excess is '.$final_excess, 0); |
|
3629 | 3629 | } |
3630 | 3630 | } |
3631 | 3631 | |
@@ -3635,7 +3635,7 @@ discard block |
||
3635 | 3635 | $threadhold_items = explode(';', $threadhold_total); |
3636 | 3636 | $threadhold1 = $threadhold_items[0]; // overlap |
3637 | 3637 | $threadhold2 = $threadhold_items[1]; // excess |
3638 | - $threadhold3 = $threadhold_items[2]; //missing |
|
3638 | + $threadhold3 = $threadhold_items[2]; //missing |
|
3639 | 3639 | // if is delineation |
3640 | 3640 | if ($answerId === 1) { |
3641 | 3641 | //setting colors |
@@ -3667,14 +3667,14 @@ discard block |
||
3667 | 3667 | } elseif ($answerId > 1) { |
3668 | 3668 | if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') { |
3669 | 3669 | if ($debug > 0) { |
3670 | - error_log(__LINE__ . ' - answerId is of type noerror', 0); |
|
3670 | + error_log(__LINE__.' - answerId is of type noerror', 0); |
|
3671 | 3671 | } |
3672 | 3672 | //type no error shouldn't be treated |
3673 | 3673 | $next = 1; |
3674 | 3674 | continue; |
3675 | 3675 | } |
3676 | 3676 | if ($debug > 0) { |
3677 | - error_log(__LINE__ . ' - answerId is >1 so we\'re probably in OAR', 0); |
|
3677 | + error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0); |
|
3678 | 3678 | } |
3679 | 3679 | //check the intersection between the oar and the user |
3680 | 3680 | //echo 'user'; print_r($x_user_list); print_r($y_user_list); |
@@ -3688,7 +3688,7 @@ discard block |
||
3688 | 3688 | $poly_answer = convert_coordinates($delineation_cord, '|'); |
3689 | 3689 | $max_coord = poly_get_max($poly_user, $poly_answer); |
3690 | 3690 | $poly_answer_compiled = poly_compile($poly_answer, $max_coord); |
3691 | - $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord); |
|
3691 | + $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord); |
|
3692 | 3692 | |
3693 | 3693 | if ($overlap == false) { |
3694 | 3694 | //all good, no overlap |
@@ -3696,7 +3696,7 @@ discard block |
||
3696 | 3696 | continue; |
3697 | 3697 | } else { |
3698 | 3698 | if ($debug > 0) { |
3699 | - error_log(__LINE__ . ' - Overlap is ' . $overlap . ': OAR hit', 0); |
|
3699 | + error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0); |
|
3700 | 3700 | } |
3701 | 3701 | $organs_at_risk_hit++; |
3702 | 3702 | //show the feedback |
@@ -3708,12 +3708,12 @@ discard block |
||
3708 | 3708 | $try_hotspot = $destination_items[1]; |
3709 | 3709 | $lp_hotspot = $destination_items[2]; |
3710 | 3710 | $select_question_hotspot = $destination_items[3]; |
3711 | - $url_hotspot=$destination_items[4]; |
|
3711 | + $url_hotspot = $destination_items[4]; |
|
3712 | 3712 | } |
3713 | 3713 | } |
3714 | 3714 | } else { // the first delineation feedback |
3715 | 3715 | if ($debug > 0) { |
3716 | - error_log(__LINE__ . ' first', 0); |
|
3716 | + error_log(__LINE__.' first', 0); |
|
3717 | 3717 | } |
3718 | 3718 | } |
3719 | 3719 | break; |
@@ -3735,7 +3735,7 @@ discard block |
||
3735 | 3735 | echo Display::tag('td', $answerMatching[$answerId]); |
3736 | 3736 | echo Display::tag( |
3737 | 3737 | 'td', |
3738 | - "$user_answer / " . Display::tag( |
|
3738 | + "$user_answer / ".Display::tag( |
|
3739 | 3739 | 'strong', |
3740 | 3740 | $answerMatching[$answerCorrect], |
3741 | 3741 | ['style' => 'color: #008000; font-weight: bold;'] |
@@ -3821,7 +3821,7 @@ discard block |
||
3821 | 3821 | // we use the results from the session (from_db=0) |
3822 | 3822 | // TODO Change this, because it is wrong to show the user |
3823 | 3823 | // some results that haven't been stored in the database yet |
3824 | - if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION ) { |
|
3824 | + if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION) { |
|
3825 | 3825 | |
3826 | 3826 | if ($debug) error_log('$from AND this is a hotspot kind of question '); |
3827 | 3827 | |
@@ -3830,19 +3830,19 @@ discard block |
||
3830 | 3830 | if ($answerType == HOT_SPOT_DELINEATION) { |
3831 | 3831 | if (0) { |
3832 | 3832 | if ($overlap_color) { |
3833 | - $overlap_color='green'; |
|
3833 | + $overlap_color = 'green'; |
|
3834 | 3834 | } else { |
3835 | - $overlap_color='red'; |
|
3835 | + $overlap_color = 'red'; |
|
3836 | 3836 | } |
3837 | 3837 | if ($missing_color) { |
3838 | - $missing_color='green'; |
|
3838 | + $missing_color = 'green'; |
|
3839 | 3839 | } else { |
3840 | - $missing_color='red'; |
|
3840 | + $missing_color = 'red'; |
|
3841 | 3841 | } |
3842 | 3842 | if ($excess_color) { |
3843 | - $excess_color='green'; |
|
3843 | + $excess_color = 'green'; |
|
3844 | 3844 | } else { |
3845 | - $excess_color='red'; |
|
3845 | + $excess_color = 'red'; |
|
3846 | 3846 | } |
3847 | 3847 | if (!is_numeric($final_overlap)) { |
3848 | 3848 | $final_overlap = 0; |
@@ -3854,33 +3854,33 @@ discard block |
||
3854 | 3854 | $final_excess = 0; |
3855 | 3855 | } |
3856 | 3856 | |
3857 | - if ($final_overlap>100) { |
|
3857 | + if ($final_overlap > 100) { |
|
3858 | 3858 | $final_overlap = 100; |
3859 | 3859 | } |
3860 | 3860 | |
3861 | - $table_resume='<table class="data_table"> |
|
3861 | + $table_resume = '<table class="data_table"> |
|
3862 | 3862 | <tr class="row_odd" > |
3863 | 3863 | <td></td> |
3864 | - <td ><b>' . get_lang('Requirements') . '</b></td> |
|
3865 | - <td><b>' . get_lang('YourAnswer') . '</b></td> |
|
3864 | + <td ><b>' . get_lang('Requirements').'</b></td> |
|
3865 | + <td><b>' . get_lang('YourAnswer').'</b></td> |
|
3866 | 3866 | </tr> |
3867 | 3867 | <tr class="row_even"> |
3868 | - <td><b>' . get_lang('Overlap') . '</b></td> |
|
3869 | - <td>' . get_lang('Min') . ' ' . $threadhold1 . '</td> |
|
3870 | - <td><div style="color:' . $overlap_color . '">' |
|
3871 | - . (($final_overlap < 0) ? 0 : intval($final_overlap)) . '</div></td> |
|
3868 | + <td><b>' . get_lang('Overlap').'</b></td> |
|
3869 | + <td>' . get_lang('Min').' '.$threadhold1.'</td> |
|
3870 | + <td><div style="color:' . $overlap_color.'">' |
|
3871 | + . (($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td> |
|
3872 | 3872 | </tr> |
3873 | 3873 | <tr> |
3874 | - <td><b>' . get_lang('Excess') . '</b></td> |
|
3875 | - <td>' . get_lang('Max') . ' ' . $threadhold2 . '</td> |
|
3876 | - <td><div style="color:' . $excess_color . '">' |
|
3877 | - . (($final_excess < 0) ? 0 : intval($final_excess)) . '</div></td> |
|
3874 | + <td><b>' . get_lang('Excess').'</b></td> |
|
3875 | + <td>' . get_lang('Max').' '.$threadhold2.'</td> |
|
3876 | + <td><div style="color:' . $excess_color.'">' |
|
3877 | + . (($final_excess < 0) ? 0 : intval($final_excess)).'</div></td> |
|
3878 | 3878 | </tr> |
3879 | 3879 | <tr class="row_even"> |
3880 | - <td><b>' . get_lang('Missing') . '</b></td> |
|
3881 | - <td>' . get_lang('Max') . ' ' . $threadhold3 . '</td> |
|
3882 | - <td><div style="color:' . $missing_color . '">' |
|
3883 | - . (($final_missing < 0) ? 0 : intval($final_missing)) . '</div></td> |
|
3880 | + <td><b>' . get_lang('Missing').'</b></td> |
|
3881 | + <td>' . get_lang('Max').' '.$threadhold3.'</td> |
|
3882 | + <td><div style="color:' . $missing_color.'">' |
|
3883 | + . (($final_missing < 0) ? 0 : intval($final_missing)).'</div></td> |
|
3884 | 3884 | </tr> |
3885 | 3885 | </table>'; |
3886 | 3886 | if ($next == 0) { |
@@ -3895,20 +3895,20 @@ discard block |
||
3895 | 3895 | $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers); |
3896 | 3896 | } |
3897 | 3897 | |
3898 | - echo '<h1><div style="color:#333;">' . get_lang('Feedback') . '</div></h1> |
|
3898 | + echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1> |
|
3899 | 3899 | <p style="text-align:center">'; |
3900 | 3900 | |
3901 | - $message = '<p>' . get_lang('YourDelineation') . '</p>'; |
|
3901 | + $message = '<p>'.get_lang('YourDelineation').'</p>'; |
|
3902 | 3902 | $message .= $table_resume; |
3903 | - $message .= '<br />' . get_lang('ResultIs') . ' ' . $result_comment . '<br />'; |
|
3903 | + $message .= '<br />'.get_lang('ResultIs').' '.$result_comment.'<br />'; |
|
3904 | 3904 | if ($organs_at_risk_hit > 0) { |
3905 | - $message .= '<p><b>' . get_lang('OARHit') . '</b></p>'; |
|
3905 | + $message .= '<p><b>'.get_lang('OARHit').'</b></p>'; |
|
3906 | 3906 | } |
3907 | - $message .='<p>' . $comment . '</p>'; |
|
3907 | + $message .= '<p>'.$comment.'</p>'; |
|
3908 | 3908 | echo $message; |
3909 | 3909 | } else { |
3910 | 3910 | echo $hotspot_delineation_result[0]; //prints message |
3911 | - $from_database = 1; // the hotspot_solution.swf needs this variable |
|
3911 | + $from_database = 1; // the hotspot_solution.swf needs this variable |
|
3912 | 3912 | } |
3913 | 3913 | |
3914 | 3914 | //save the score attempts |
@@ -3930,20 +3930,20 @@ discard block |
||
3930 | 3930 | $exerciseResultCoordinates[$quesId] |
3931 | 3931 | ); |
3932 | 3932 | } else { |
3933 | - if ($final_answer==0) { |
|
3933 | + if ($final_answer == 0) { |
|
3934 | 3934 | $questionScore = 0; |
3935 | - $answer=0; |
|
3935 | + $answer = 0; |
|
3936 | 3936 | Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0); |
3937 | 3937 | if (is_array($exerciseResultCoordinates[$quesId])) { |
3938 | - foreach($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
3939 | - Event::saveExerciseAttemptHotspot($exeId,$quesId,$idx,0,$val); |
|
3938 | + foreach ($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
3939 | + Event::saveExerciseAttemptHotspot($exeId, $quesId, $idx, 0, $val); |
|
3940 | 3940 | } |
3941 | 3941 | } |
3942 | 3942 | } else { |
3943 | 3943 | Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0); |
3944 | 3944 | if (is_array($exerciseResultCoordinates[$quesId])) { |
3945 | - foreach($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
3946 | - Event::saveExerciseAttemptHotspot($exeId,$quesId,$idx,$choice[$idx],$val); |
|
3945 | + foreach ($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
3946 | + Event::saveExerciseAttemptHotspot($exeId, $quesId, $idx, $choice[$idx], $val); |
|
3947 | 3947 | } |
3948 | 3948 | } |
3949 | 3949 | } |
@@ -3962,7 +3962,7 @@ discard block |
||
3962 | 3962 | echo " |
3963 | 3963 | <tr> |
3964 | 3964 | <td colspan=\"2\"> |
3965 | - <p><em>" . get_lang('HotSpot') . "</em></p> |
|
3965 | + <p><em>" . get_lang('HotSpot')."</em></p> |
|
3966 | 3966 | |
3967 | 3967 | <div id=\"hotspot-solution-$questionId\"></div> |
3968 | 3968 | |
@@ -4000,7 +4000,7 @@ discard block |
||
4000 | 4000 | |
4001 | 4001 | if ($saved_results) { |
4002 | 4002 | if ($debug) error_log("Save question results $saved_results"); |
4003 | - if ($debug) error_log(print_r($choice ,1 )); |
|
4003 | + if ($debug) error_log(print_r($choice, 1)); |
|
4004 | 4004 | |
4005 | 4005 | if (empty($choice)) { |
4006 | 4006 | $choice = 0; |
@@ -4012,14 +4012,14 @@ discard block |
||
4012 | 4012 | $ans = $reply[$i]; |
4013 | 4013 | Event::saveQuestionAttempt( |
4014 | 4014 | $questionScore, |
4015 | - $ans . ':' . $choice[$ans], |
|
4015 | + $ans.':'.$choice[$ans], |
|
4016 | 4016 | $quesId, |
4017 | 4017 | $exeId, |
4018 | 4018 | $i, |
4019 | 4019 | $this->id |
4020 | 4020 | ); |
4021 | 4021 | if ($debug) { |
4022 | - error_log('result =>' . $questionScore . ' ' . $ans . ':' . $choice[$ans]); |
|
4022 | + error_log('result =>'.$questionScore.' '.$ans.':'.$choice[$ans]); |
|
4023 | 4023 | } |
4024 | 4024 | } |
4025 | 4025 | } else { |
@@ -4030,7 +4030,7 @@ discard block |
||
4030 | 4030 | $reply = array_keys($choice); |
4031 | 4031 | |
4032 | 4032 | if ($debug) { |
4033 | - error_log("reply " . print_r($reply, 1) . ""); |
|
4033 | + error_log("reply ".print_r($reply, 1).""); |
|
4034 | 4034 | } |
4035 | 4035 | for ($i = 0; $i < sizeof($reply); $i++) { |
4036 | 4036 | $ans = $reply[$i]; |
@@ -4089,7 +4089,7 @@ discard block |
||
4089 | 4089 | |
4090 | 4090 | Event::saveQuestionAttempt($questionScore, implode('|', $answer), $quesId, $exeId, 0, $this->id); |
4091 | 4091 | } else { |
4092 | - Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0,$this->id); |
|
4092 | + Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id); |
|
4093 | 4093 | } |
4094 | 4094 | } |
4095 | 4095 | |
@@ -4099,8 +4099,8 @@ discard block |
||
4099 | 4099 | |
4100 | 4100 | if ($saved_results) { |
4101 | 4101 | $stat_table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
4102 | - $sql = 'UPDATE ' . $stat_table . ' SET |
|
4103 | - exe_result = exe_result + ' . floatval($questionScore) . ' |
|
4102 | + $sql = 'UPDATE '.$stat_table.' SET |
|
4103 | + exe_result = exe_result + ' . floatval($questionScore).' |
|
4104 | 4104 | WHERE exe_id = ' . $exeId; |
4105 | 4105 | if ($debug) error_log($sql); |
4106 | 4106 | Database::query($sql); |
@@ -4124,7 +4124,7 @@ discard block |
||
4124 | 4124 | */ |
4125 | 4125 | public function send_mail_notification_for_exam($question_list_answers, $origin, $exe_id) |
4126 | 4126 | { |
4127 | - if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) { |
|
4127 | + if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) { |
|
4128 | 4128 | return null; |
4129 | 4129 | } |
4130 | 4130 | // Email configuration settings |
@@ -4175,7 +4175,7 @@ discard block |
||
4175 | 4175 | $msg = str_replace("#course#", $courseInfo['name'], $msg1); |
4176 | 4176 | |
4177 | 4177 | if ($origin != 'learnpath') { |
4178 | - $msg.= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
4178 | + $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
4179 | 4179 | } |
4180 | 4180 | $msg1 = str_replace("#url#", $url_email, $msg); |
4181 | 4181 | $mail_content = $msg1; |
@@ -4204,7 +4204,7 @@ discard block |
||
4204 | 4204 | */ |
4205 | 4205 | function send_notification_for_open_questions($question_list_answers, $origin, $exe_id) |
4206 | 4206 | { |
4207 | - if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) { |
|
4207 | + if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) { |
|
4208 | 4208 | return null; |
4209 | 4209 | } |
4210 | 4210 | // Email configuration settings |
@@ -4267,11 +4267,11 @@ discard block |
||
4267 | 4267 | $msg .= '</table><br />'; |
4268 | 4268 | |
4269 | 4269 | |
4270 | - $msg1 = str_replace("#exercise#", $this->exercise, $msg); |
|
4271 | - $msg = str_replace("#firstName#", $user_info['firstname'],$msg1); |
|
4272 | - $msg1 = str_replace("#lastName#", $user_info['lastname'],$msg); |
|
4273 | - $msg = str_replace("#mail#", $user_info['email'],$msg1); |
|
4274 | - $msg = str_replace("#course#", $course_info['name'],$msg1); |
|
4270 | + $msg1 = str_replace("#exercise#", $this->exercise, $msg); |
|
4271 | + $msg = str_replace("#firstName#", $user_info['firstname'], $msg1); |
|
4272 | + $msg1 = str_replace("#lastName#", $user_info['lastname'], $msg); |
|
4273 | + $msg = str_replace("#mail#", $user_info['email'], $msg1); |
|
4274 | + $msg = str_replace("#course#", $course_info['name'], $msg1); |
|
4275 | 4275 | |
4276 | 4276 | if ($origin != 'learnpath') { |
4277 | 4277 | $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
@@ -4300,7 +4300,7 @@ discard block |
||
4300 | 4300 | |
4301 | 4301 | function send_notification_for_oral_questions($question_list_answers, $origin, $exe_id) |
4302 | 4302 | { |
4303 | - if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) { |
|
4303 | + if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) { |
|
4304 | 4304 | return null; |
4305 | 4305 | } |
4306 | 4306 | // Email configuration settings |
@@ -4324,7 +4324,7 @@ discard block |
||
4324 | 4324 | $answer_type = $item['answer_type']; |
4325 | 4325 | |
4326 | 4326 | if (!empty($question) && !empty($answer) && $answer_type == ORAL_EXPRESSION) { |
4327 | - $oral_question_list.='<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">' |
|
4327 | + $oral_question_list .= '<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">' |
|
4328 | 4328 | .'<tr>' |
4329 | 4329 | .'<td width="220" valign="top" bgcolor="#E5EDF8"> '.get_lang('Question').'</td>' |
4330 | 4330 | .'<td width="473" valign="top" bgcolor="#F3F3F3">'.$question.'</td>' |
@@ -4357,7 +4357,7 @@ discard block |
||
4357 | 4357 | .'<td> #mail#</td>' |
4358 | 4358 | .'</tr>' |
4359 | 4359 | .'</table>'; |
4360 | - $msg .= '<br />'.sprintf(get_lang('OralQuestionsAttemptedAreX'),$oral_question_list).'<br />'; |
|
4360 | + $msg .= '<br />'.sprintf(get_lang('OralQuestionsAttemptedAreX'), $oral_question_list).'<br />'; |
|
4361 | 4361 | $msg1 = str_replace("#exercise#", $this->exercise, $msg); |
4362 | 4362 | $msg = str_replace("#firstName#", $user_info['firstname'], $msg1); |
4363 | 4363 | $msg1 = str_replace("#lastName#", $user_info['lastname'], $msg); |
@@ -4365,7 +4365,7 @@ discard block |
||
4365 | 4365 | $msg = str_replace("#course#", $course_info['name'], $msg1); |
4366 | 4366 | |
4367 | 4367 | if ($origin != 'learnpath') { |
4368 | - $msg.= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
4368 | + $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
4369 | 4369 | } |
4370 | 4370 | $msg1 = str_replace("#url#", $url_email, $msg); |
4371 | 4371 | $mail_content = $msg1; |
@@ -4431,10 +4431,10 @@ discard block |
||
4431 | 4431 | } |
4432 | 4432 | $html = '<div class="question-result">'; |
4433 | 4433 | $html .= Display::page_header( |
4434 | - Display::return_icon('test-quiz.png', get_lang('Result'),null, ICON_SIZE_MEDIUM).' '.$this->exercise.' : '.get_lang('Result') |
|
4434 | + Display::return_icon('test-quiz.png', get_lang('Result'), null, ICON_SIZE_MEDIUM).' '.$this->exercise.' : '.get_lang('Result') |
|
4435 | 4435 | ); |
4436 | 4436 | $html .= Display::description($array); |
4437 | - $html .="</div>"; |
|
4437 | + $html .= "</div>"; |
|
4438 | 4438 | return $html; |
4439 | 4439 | } |
4440 | 4440 | |
@@ -4551,7 +4551,7 @@ discard block |
||
4551 | 4551 | false, |
4552 | 4552 | $objExercise->selectPropagateNeg() |
4553 | 4553 | ); |
4554 | - $totalScore += $question_result['score']; |
|
4554 | + $totalScore += $question_result['score']; |
|
4555 | 4555 | } |
4556 | 4556 | |
4557 | 4557 | if ($objExercise->selectPropagateNeg() == 0 && $totalScore < 0) { |
@@ -4695,7 +4695,7 @@ discard block |
||
4695 | 4695 | } |
4696 | 4696 | } |
4697 | 4697 | |
4698 | - if (!empty($message)){ |
|
4698 | + if (!empty($message)) { |
|
4699 | 4699 | $message = Display::return_message($message, 'warning', false); |
4700 | 4700 | } |
4701 | 4701 | |
@@ -4709,7 +4709,7 @@ discard block |
||
4709 | 4709 | { |
4710 | 4710 | $TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM); |
4711 | 4711 | $sql = "SELECT max_score FROM $TBL_LP_ITEM |
4712 | - WHERE c_id = {$this->course_id} AND item_type = '" . TOOL_QUIZ . "' AND path = '{$this->id}'"; |
|
4712 | + WHERE c_id = {$this->course_id} AND item_type = '".TOOL_QUIZ."' AND path = '{$this->id}'"; |
|
4713 | 4713 | $result = Database::query($sql); |
4714 | 4714 | if (Database::num_rows($result) > 0) { |
4715 | 4715 | return true; |
@@ -4875,7 +4875,7 @@ discard block |
||
4875 | 4875 | $sql_track = "SELECT * FROM $track_exercises WHERE exe_id = $exe_id "; |
4876 | 4876 | $result = Database::query($sql_track); |
4877 | 4877 | $new_array = array(); |
4878 | - if (Database::num_rows($result) > 0 ) { |
|
4878 | + if (Database::num_rows($result) > 0) { |
|
4879 | 4879 | $new_array = Database::fetch_array($result, 'ASSOC'); |
4880 | 4880 | |
4881 | 4881 | $new_array['duration'] = null; |
@@ -4887,11 +4887,11 @@ discard block |
||
4887 | 4887 | $start_date = api_strtotime($start_date, 'UTC'); |
4888 | 4888 | $end_date = api_strtotime($end_date, 'UTC'); |
4889 | 4889 | if ($start_date && $end_date) { |
4890 | - $mytime = $end_date- $start_date; |
|
4890 | + $mytime = $end_date - $start_date; |
|
4891 | 4891 | $new_learnpath_item = new learnpathItem(null); |
4892 | 4892 | $time_attemp = $new_learnpath_item->get_scorm_time('js', $mytime); |
4893 | 4893 | $h = get_lang('h'); |
4894 | - $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp); |
|
4894 | + $time_attemp = str_replace('NaN', '00'.$h.'00\'00"', $time_attemp); |
|
4895 | 4895 | $new_array['duration'] = $time_attemp; |
4896 | 4896 | } |
4897 | 4897 | } |
@@ -4913,7 +4913,7 @@ discard block |
||
4913 | 4913 | $result = Database::query($sql); |
4914 | 4914 | } |
4915 | 4915 | } else { |
4916 | - $remind_list = explode(',',$exercise_info['questions_to_check']); |
|
4916 | + $remind_list = explode(',', $exercise_info['questions_to_check']); |
|
4917 | 4917 | |
4918 | 4918 | $remind_list_string = ''; |
4919 | 4919 | if ($action == 'add') { |
@@ -4925,7 +4925,7 @@ discard block |
||
4925 | 4925 | } |
4926 | 4926 | $remind_list_string = implode(',', $remind_list); |
4927 | 4927 | } |
4928 | - } elseif ($action == 'delete') { |
|
4928 | + } elseif ($action == 'delete') { |
|
4929 | 4929 | if (!empty($remind_list)) { |
4930 | 4930 | if (in_array($question_id, $remind_list)) { |
4931 | 4931 | $remind_list = array_flip($remind_list); |
@@ -5026,7 +5026,7 @@ discard block |
||
5026 | 5026 | public function get_max_score() |
5027 | 5027 | { |
5028 | 5028 | $out_max_score = 0; |
5029 | - $tab_question_list = $this->selectQuestionList(true); // list of question's id !!! the array key start at 1 !!! |
|
5029 | + $tab_question_list = $this->selectQuestionList(true); // list of question's id !!! the array key start at 1 !!! |
|
5030 | 5030 | // test is randomQuestions - see field random of test |
5031 | 5031 | if ($this->random > 0 && $this->randomByCat == 0) { |
5032 | 5032 | $nb_random_questions = $this->random; |
@@ -31,7 +31,7 @@ |
||
31 | 31 | function createAnswersForm($form) |
32 | 32 | { |
33 | 33 | |
34 | - $form -> addElement('text','weighting', get_lang('Weighting'), array('class' => 'span1')); |
|
34 | + $form -> addElement('text', 'weighting', get_lang('Weighting'), array('class' => 'span1')); |
|
35 | 35 | global $text, $class; |
36 | 36 | // setting the save button here and not in the question class.php |
37 | 37 | $form->addButtonSave($text, 'submitQuestion'); |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | if ($is_allowedToEdit && $origin != 'learnpath') { |
74 | 74 | // the form |
75 | 75 | if (api_is_platform_admin() || api_is_course_admin() || api_is_course_tutor() || api_is_course_coach()) { |
76 | - $actions .= '<a id="export_opener" href="'.api_get_self().'?export_report=1&path='.Security::remove_XSS($hotpotatoes_path).' ">'.Display::return_icon('save.png', get_lang('Export'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
76 | + $actions .= '<a id="export_opener" href="'.api_get_self().'?export_report=1&path='.Security::remove_XSS($hotpotatoes_path).' ">'.Display::return_icon('save.png', get_lang('Export'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
77 | 77 | } |
78 | 78 | } else { |
79 | - $actions .= '<a href="exercise.php">' . Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
79 | + $actions .= '<a href="exercise.php">'.Display :: return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | if ($is_allowedToEdit) { |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | |
99 | 99 | if ($is_allowedToEdit || $is_tutor) { |
100 | 100 | $nameTools = get_lang('StudentScore'); |
101 | - $interbreadcrumb[] = array("url" => "exercise.php","name" => get_lang('Exercises')); |
|
101 | + $interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises')); |
|
102 | 102 | $objExerciseTmp = new Exercise(); |
103 | 103 | /*if ($objExerciseTmp->read($exercise_id)) { |
104 | 104 | $interbreadcrumb[] = array("url" => "admin.php?exerciseId=".$exercise_id, "name" => $objExerciseTmp->name); |
105 | 105 | }*/ |
106 | 106 | } else { |
107 | - $interbreadcrumb[] = array("url" => "exercise.php","name" => get_lang('Exercises')); |
|
107 | + $interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises')); |
|
108 | 108 | $objExerciseTmp = new Exercise(); |
109 | 109 | /*if ($objExerciseTmp->read($exercise_id)) { |
110 | 110 | $nameTools = get_lang('Results').': '.$objExerciseTmp->name; |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | $actions = Display::div($actions, array('class'=> 'actions')); |
117 | 117 | |
118 | -$extra = '<script type="text/javascript"> |
|
118 | +$extra = '<script type="text/javascript"> |
|
119 | 119 | $(document).ready(function() { |
120 | 120 | |
121 | 121 | $( "#dialog:ui-dialog" ).dialog( "destroy" ); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | // Generating group list |
170 | 170 | |
171 | 171 | $group_list = GroupManager::get_group_list(); |
172 | -$group_parameters = array('group_all:'.get_lang('All'),'group_none:'.get_lang('None')); |
|
172 | +$group_parameters = array('group_all:'.get_lang('All'), 'group_none:'.get_lang('None')); |
|
173 | 173 | |
174 | 174 | foreach ($group_list as $group) { |
175 | 175 | $group_parameters[] = $group['id'].':'.$group['name']; |
@@ -192,14 +192,14 @@ discard block |
||
192 | 192 | |
193 | 193 | // Column config |
194 | 194 | // @todo fix search firstname/lastname that doesn't work. rmove search for the moment |
195 | - $column_model = array( |
|
196 | - array('name'=>'firstname', 'index'=>'firstname', 'width'=>'50', 'align'=>'left', 'search' => 'false'), |
|
197 | - array('name'=>'lastname', 'index'=>'lastname', 'width'=>'50', 'align'=>'left', 'formatter'=>'action_formatter', 'search' => 'false'), |
|
198 | - array('name'=>'login', 'hidden'=>'true', 'index'=>'username', 'width'=>'40', 'align'=>'left', 'search' => 'false'), |
|
199 | - array('name'=>'group_name', 'index'=>'group_id', 'width'=>'40', 'align'=>'left', 'search' => 'false'), |
|
200 | - array('name'=>'exe_date', 'index'=>'exe_date', 'width'=>'60', 'align'=>'left', 'search' => 'false'), |
|
201 | - array('name'=>'score', 'index'=>'exe_result', 'width'=>'50', 'align'=>'left', 'search' => 'false'), |
|
202 | - array('name'=>'actions', 'index'=>'actions', 'width'=>'60', 'align'=>'left', 'search' => 'false') |
|
195 | + $column_model = array( |
|
196 | + array('name'=>'firstname', 'index'=>'firstname', 'width'=>'50', 'align'=>'left', 'search' => 'false'), |
|
197 | + array('name'=>'lastname', 'index'=>'lastname', 'width'=>'50', 'align'=>'left', 'formatter'=>'action_formatter', 'search' => 'false'), |
|
198 | + array('name'=>'login', 'hidden'=>'true', 'index'=>'username', 'width'=>'40', 'align'=>'left', 'search' => 'false'), |
|
199 | + array('name'=>'group_name', 'index'=>'group_id', 'width'=>'40', 'align'=>'left', 'search' => 'false'), |
|
200 | + array('name'=>'exe_date', 'index'=>'exe_date', 'width'=>'60', 'align'=>'left', 'search' => 'false'), |
|
201 | + array('name'=>'score', 'index'=>'exe_result', 'width'=>'50', 'align'=>'left', 'search' => 'false'), |
|
202 | + array('name'=>'actions', 'index'=>'actions', 'width'=>'60', 'align'=>'left', 'search' => 'false') |
|
203 | 203 | ); |
204 | 204 | |
205 | 205 | $action_links = ' |
@@ -222,10 +222,10 @@ discard block |
||
222 | 222 | |
223 | 223 | //Column config |
224 | 224 | // @todo fix search firstname/lastname that doesn't work. rmove search for the moment |
225 | - $column_model = array( |
|
226 | - array('name'=>'exe_date', 'index'=>'exe_date', 'width'=>'60', 'align'=>'left', 'search' => 'false'), |
|
227 | - array('name'=>'score', 'index'=>'exe_result', 'width'=>'50', 'align'=>'left', 'search' => 'false'), |
|
228 | - array('name'=>'actions', 'index'=>'actions', 'width'=>'60', 'align'=>'left', 'search' => 'false') |
|
225 | + $column_model = array( |
|
226 | + array('name'=>'exe_date', 'index'=>'exe_date', 'width'=>'60', 'align'=>'left', 'search' => 'false'), |
|
227 | + array('name'=>'score', 'index'=>'exe_result', 'width'=>'50', 'align'=>'left', 'search' => 'false'), |
|
228 | + array('name'=>'actions', 'index'=>'actions', 'width'=>'60', 'align'=>'left', 'search' => 'false') |
|
229 | 229 | ); |
230 | 230 | } |
231 | 231 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | $file = file(api_get_path(SYS_LANG_PATH).'english/hotspot.inc.php'); |
19 | 19 | |
20 | 20 | foreach ($file as &$value) { |
21 | - $variable = explode('=', $value , 2); |
|
21 | + $variable = explode('=', $value, 2); |
|
22 | 22 | if (count($variable) > 1) { |
23 | 23 | $variable = substr(trim($variable[0]), 1); |
24 | 24 | $variable = '&'.$variable.'='.api_utf8_encode(get_lang($variable)).' '; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | function add_category_form($action) { |
148 | 148 | $action = Security::remove_XSS($action); |
149 | 149 | // initiate the object |
150 | - $form = new FormValidator('note', 'post', api_get_self() . '?action=' . $action); |
|
150 | + $form = new FormValidator('note', 'post', api_get_self().'?action='.$action); |
|
151 | 151 | // Setting the form elements |
152 | 152 | $form->addElement('header', get_lang('AddACategory')); |
153 | 153 | $form->addElement('text', 'category_name', get_lang('CategoryName'), array('size' => '95')); |
@@ -189,19 +189,19 @@ discard block |
||
189 | 189 | |
190 | 190 | function display_add_category() { |
191 | 191 | echo '<div class="actions">'; |
192 | - echo '<a href="exercise.php?' . api_get_cidreq() . '">' . |
|
193 | - Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
194 | - echo '<a href="' . api_get_self() . '?action=addcategory">' . |
|
195 | - Display::return_icon('question_category.gif', get_lang('AddACategory')) . '</a>'; |
|
192 | + echo '<a href="exercise.php?'.api_get_cidreq().'">'. |
|
193 | + Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
194 | + echo '<a href="'.api_get_self().'?action=addcategory">'. |
|
195 | + Display::return_icon('question_category.gif', get_lang('AddACategory')).'</a>'; |
|
196 | 196 | echo '</div>'; |
197 | 197 | echo "<br/>"; |
198 | - echo "<fieldset><legend>" . get_lang('QuestionCategory') . "</legend></fieldset>"; |
|
198 | + echo "<fieldset><legend>".get_lang('QuestionCategory')."</legend></fieldset>"; |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | // display goback to category list page link |
202 | 202 | function display_goback() { |
203 | 203 | echo '<div class="actions">'; |
204 | - echo '<a href="' . api_get_self() . '">' . |
|
205 | - Display::return_icon('back.png', get_lang('BackToCategoryList'), array(), 32) . '</a>'; |
|
204 | + echo '<a href="'.api_get_self().'">'. |
|
205 | + Display::return_icon('back.png', get_lang('BackToCategoryList'), array(), 32).'</a>'; |
|
206 | 206 | echo '</div>'; |
207 | 207 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | require_once '../inc/global.inc.php'; |
14 | 14 | |
15 | -$current_course_tool = TOOL_QUIZ; |
|
15 | +$current_course_tool = TOOL_QUIZ; |
|
16 | 16 | |
17 | 17 | // Clear the exercise session just in case |
18 | 18 | if (isset($_SESSION['objExercise'])) { |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | if ($time_control) { |
51 | 51 | // Get time left for expiring time |
52 | - $time_left = api_strtotime($clock_expired_time,'UTC') - time(); |
|
52 | + $time_left = api_strtotime($clock_expired_time, 'UTC') - time(); |
|
53 | 53 | |
54 | 54 | $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/stylesheet/jquery.epiclock.css'); |
55 | 55 | $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/renderers/minute/epiclock.minute.css'); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | $html = ''; |
74 | 74 | $message = ''; |
75 | -$html.= '<div class="exercise">'; |
|
75 | +$html .= '<div class="exercise">'; |
|
76 | 76 | $is_allowed_to_edit = api_is_allowed_to_edit(null, true); |
77 | 77 | $edit_link = ''; |
78 | 78 | if ($is_allowed_to_edit && $objExercise->sessionId == $sessionId) { |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | $attempt_result['exe_result'], |
178 | 178 | $attempt_result['exe_weighting'] |
179 | 179 | ); |
180 | - $attempt_url = api_get_path(WEB_CODE_PATH) . 'exercice/result.php?'; |
|
181 | - $attempt_url .= api_get_cidreq() . '&show_headers=1&'; |
|
180 | + $attempt_url = api_get_path(WEB_CODE_PATH).'exercice/result.php?'; |
|
181 | + $attempt_url .= api_get_cidreq().'&show_headers=1&'; |
|
182 | 182 | $attempt_url .= http_build_query([ |
183 | 183 | 'id' => $attempt_result['exe_id'] |
184 | 184 | ]); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | get_lang('Show'), |
189 | 189 | $attempt_url, |
190 | 190 | [ |
191 | - 'class' => $btn_class . 'btn btn-default', |
|
191 | + 'class' => $btn_class.'btn btn-default', |
|
192 | 192 | 'data-title' => get_lang('Show'), |
193 | 193 | 'data-size' => 'lg' |
194 | 194 | ] |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | ), |
207 | 207 | 'userIp' => $attempt_result['user_ip'] |
208 | 208 | ); |
209 | - $attempt_link .= " " . $teacher_revised; |
|
209 | + $attempt_link .= " ".$teacher_revised; |
|
210 | 210 | |
211 | 211 | if (in_array( |
212 | 212 | $objExercise->results_disabled, |
@@ -283,12 +283,12 @@ discard block |
||
283 | 283 | $attempt_message = Display::return_message($attempt_message, 'info'); |
284 | 284 | } |
285 | 285 | if ($visible_return['value'] == true) { |
286 | - $message .= $attempt_message; |
|
286 | + $message .= $attempt_message; |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 | |
290 | 290 | if ($time_control) { |
291 | - $html.= $objExercise->return_time_left_div(); |
|
291 | + $html .= $objExercise->return_time_left_div(); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | $html .= $message; |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | $table_content, |
309 | 309 | ['class' => 'table-responsive'] |
310 | 310 | ); |
311 | -$html.= '</div>'; |
|
311 | +$html .= '</div>'; |
|
312 | 312 | echo $html; |
313 | 313 | |
314 | 314 | Display::display_footer(); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $row = Database::fetch_array($res); |
58 | 58 | $this->id = $row['id']; |
59 | 59 | $this->name = $row['title']; |
60 | - $this->description = $row['description']; |
|
60 | + $this->description = $row['description']; |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | /** |
197 | 197 | * @param string $in_color |
198 | 198 | */ |
199 | - public function display($in_color="#E0EBF5") |
|
199 | + public function display($in_color = "#E0EBF5") |
|
200 | 200 | { |
201 | 201 | echo "<textarea style='background-color:$in_color; width:60%; height:100px;'>"; |
202 | 202 | print_r($this); |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public static function getCategoryListInfo($in_field = "", $courseId = "") |
213 | 213 | { |
214 | - if (empty($courseId) || $courseId=="") { |
|
214 | + if (empty($courseId) || $courseId == "") { |
|
215 | 215 | $courseId = api_get_course_int_id(); |
216 | 216 | } |
217 | 217 | $table = Database :: get_course_table(TABLE_QUIZ_QUESTION_CATEGORY); |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * |
252 | 252 | * @return int |
253 | 253 | */ |
254 | - public static function getCategoryForQuestion($questionId, $courseId ="") |
|
254 | + public static function getCategoryForQuestion($questionId, $courseId = "") |
|
255 | 255 | { |
256 | 256 | $result = 0; |
257 | 257 | if (empty($courseId) || $courseId == "") { |
@@ -291,11 +291,11 @@ discard block |
||
291 | 291 | $questionId, |
292 | 292 | $courseId = "" |
293 | 293 | ) { |
294 | - if (empty($courseId) || $courseId=="") { |
|
294 | + if (empty($courseId) || $courseId == "") { |
|
295 | 295 | $courseId = api_get_course_int_id(); |
296 | 296 | } |
297 | 297 | $catid = TestCategory::getCategoryForQuestion($questionId, $courseId); |
298 | - $result = ""; // result |
|
298 | + $result = ""; // result |
|
299 | 299 | $table = Database::get_course_table(TABLE_QUIZ_QUESTION_CATEGORY); |
300 | 300 | $catid = intval($catid); |
301 | 301 | $sql = "SELECT title FROM $table |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | $quiz->read($in_testid); |
324 | 324 | $tabQuestionList = $quiz->selectQuestionList(); |
325 | 325 | // the array given by selectQuestionList start at indice 1 and not at indice 0 !!! ??? |
326 | - for ($i=1; $i <= count($tabQuestionList); $i++) { |
|
326 | + for ($i = 1; $i <= count($tabQuestionList); $i++) { |
|
327 | 327 | if (!in_array(TestCategory::getCategoryForQuestion($tabQuestionList[$i]), $result)) { |
328 | 328 | $result[] = TestCategory::getCategoryForQuestion($tabQuestionList[$i]); |
329 | 329 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | { |
344 | 344 | $tabcatName = array(); |
345 | 345 | $tabcatID = self::getListOfCategoriesIDForTest($in_testid); |
346 | - for ($i=0; $i < count($tabcatID); $i++) { |
|
346 | + for ($i = 0; $i < count($tabcatID); $i++) { |
|
347 | 347 | $cat = new TestCategory($tabcatID[$i]); |
348 | 348 | $tabcatName[$cat->id] = $cat->name; |
349 | 349 | } |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | $quiz->read($exerciseId); |
378 | 378 | $tabQuestionList = $quiz->selectQuestionList(); |
379 | 379 | // the array given by selectQuestionList start at indice 1 and not at indice 0 !!! ? ? ? |
380 | - for ($i=1; $i <= count($tabQuestionList); $i++) { |
|
380 | + for ($i = 1; $i <= count($tabQuestionList); $i++) { |
|
381 | 381 | if (TestCategory::getCategoryForQuestion($tabQuestionList[$i]) == $categoryId) { |
382 | 382 | $nbCatResult++; |
383 | 383 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | { |
397 | 397 | $nbquestionresult = 0; |
398 | 398 | $tabcatid = TestCategory::getListOfCategoriesIDForTest($exerciseId); |
399 | - for ($i=0; $i < count($tabcatid); $i++) { |
|
399 | + for ($i = 0; $i < count($tabcatid); $i++) { |
|
400 | 400 | if ($tabcatid[$i] > 0) { // 0 = no category for this questio |
401 | 401 | $nbQuestionInThisCat = TestCategory::getNumberOfQuestionsInCategoryForTest($exerciseId, $tabcatid[$i]); |
402 | 402 | if ($nbQuestionInThisCat > $in_nbrandom) { |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | } |
427 | 427 | $tabcatobject = TestCategory::getCategoryListInfo("", $courseId); |
428 | 428 | $tabresult = array("0"=>get_lang('NoCategorySelected')); |
429 | - for ($i=0; $i < count($tabcatobject); $i++) { |
|
429 | + for ($i = 0; $i < count($tabcatobject); $i++) { |
|
430 | 430 | $tabresult[$tabcatobject[$i]->id] = $tabcatobject[$i]->name; |
431 | 431 | } |
432 | 432 | return $tabresult; |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | */ |
501 | 501 | public static function returnCategoryAndTitle($questionId, $in_display_category_name = 1) |
502 | 502 | { |
503 | - $is_student = !(api_is_allowed_to_edit(null,true) || api_is_session_admin()); |
|
503 | + $is_student = !(api_is_allowed_to_edit(null, true) || api_is_session_admin()); |
|
504 | 504 | // @todo fix $_SESSION['objExercise'] |
505 | 505 | $objExercise = isset($_SESSION['objExercise']) ? $_SESSION['objExercise'] : null; |
506 | 506 | if (!empty($objExercise)) { |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | public static function sortTabByBracketLabel($in_tab) |
539 | 539 | { |
540 | 540 | $tabResult = array(); |
541 | - $tabCatName = array(); // tab of category name |
|
541 | + $tabCatName = array(); // tab of category name |
|
542 | 542 | while (list($cat_id, $tabquestion) = each($in_tab)) { |
543 | 543 | $catTitle = new TestCategory($cat_id); |
544 | 544 | $tabCatName[$cat_id] = $catTitle->name; |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | $res_num_max = 0; |
565 | 565 | // foreach question |
566 | 566 | $tabcatid = TestCategory::getListOfCategoriesIDForTest($exerciseId); |
567 | - for ($i=0; $i < count($tabcatid); $i++) { |
|
567 | + for ($i = 0; $i < count($tabcatid); $i++) { |
|
568 | 568 | if ($tabcatid[$i] > 0) { // 0 = no category for this question |
569 | 569 | $nbQuestionInThisCat = TestCategory::getNumberOfQuestionsInCategoryForTest($exerciseId, $tabcatid[$i]); |
570 | 570 | if ($nbQuestionInThisCat > $res_num_max) { |
@@ -750,20 +750,20 @@ discard block |
||
750 | 750 | $tmpobj = new TestCategory($category['id']); |
751 | 751 | $nb_question = $tmpobj->getCategoryQuestionsNumber(); |
752 | 752 | $rowname = self::protectJSDialogQuote($category['title']); |
753 | - $nb_question_label = $nb_question == 1 ? $nb_question . ' ' . get_lang('Question') : $nb_question . ' ' . get_lang('Questions'); |
|
753 | + $nb_question_label = $nb_question == 1 ? $nb_question.' '.get_lang('Question') : $nb_question.' '.get_lang('Questions'); |
|
754 | 754 | |
755 | 755 | //$html .= '<div class="sectiontitle" id="id_cat' . $category['id'] . '">'; |
756 | - $content = "<span style='float:right'>" . $nb_question_label . "</span>"; |
|
756 | + $content = "<span style='float:right'>".$nb_question_label."</span>"; |
|
757 | 757 | |
758 | 758 | $content .= '<div class="sectioncomment">'; |
759 | 759 | $content .= $category['description']; |
760 | 760 | $content .= '</div>'; |
761 | 761 | |
762 | - $links = '<a href="' . api_get_self() . '?action=editcategory&category_id=' . $category['id'] . '">' . |
|
763 | - Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
764 | - $links .= ' <a href="' . api_get_self() . '?action=deletecategory&category_id=' . $category['id'] . '" '; |
|
765 | - $links .= 'onclick="return confirmDelete(\'' . self::protectJSDialogQuote(get_lang('DeleteCategoryAreYouSure') . '[' . $rowname) . '] ?\', \'id_cat' . $category['id'] . '\');">'; |
|
766 | - $links .= Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
762 | + $links = '<a href="'.api_get_self().'?action=editcategory&category_id='.$category['id'].'">'. |
|
763 | + Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>'; |
|
764 | + $links .= ' <a href="'.api_get_self().'?action=deletecategory&category_id='.$category['id'].'" '; |
|
765 | + $links .= 'onclick="return confirmDelete(\''.self::protectJSDialogQuote(get_lang('DeleteCategoryAreYouSure').'['.$rowname).'] ?\', \'id_cat'.$category['id'].'\');">'; |
|
766 | + $links .= Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>'; |
|
767 | 767 | $html .= Display::panel($content, $category['title'].$links); |
768 | 768 | } |
769 | 769 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | require_once '../inc/global.inc.php'; |
18 | 18 | $debug = false; |
19 | -if (empty($origin) ) { |
|
19 | +if (empty($origin)) { |
|
20 | 20 | $origin = isset($_REQUEST['origin']) ? $_REQUEST['origin'] : null; |
21 | 21 | } |
22 | 22 | |
@@ -30,21 +30,21 @@ discard block |
||
30 | 30 | $TBL_EXERCISE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); |
31 | 31 | $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); |
32 | 32 | $TBL_TRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
33 | -$TBL_TRACK_ATTEMPT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
|
33 | +$TBL_TRACK_ATTEMPT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
|
34 | 34 | |
35 | 35 | // General parameters passed via POST/GET |
36 | -if ($debug) { error_log('Entered exercise_result.php: '.print_r($_POST,1)); } |
|
36 | +if ($debug) { error_log('Entered exercise_result.php: '.print_r($_POST, 1)); } |
|
37 | 37 | |
38 | 38 | if (empty($formSent)) { $formSent = isset($_REQUEST['formSent']) ? $_REQUEST['formSent'] : null; } |
39 | 39 | if (empty($exerciseResult)) { $exerciseResult = isset($_SESSION['exerciseResult']) ? $_SESSION['exerciseResult'] : null; } |
40 | -if (empty($questionId)) { $questionId = isset($_REQUEST['questionId']) ? $_REQUEST['questionId'] : null;} |
|
41 | -if (empty($choice)) { $choice = isset($_REQUEST['choice']) ? $_REQUEST['choice'] : null;} |
|
42 | -if (empty($questionNum)) { $questionNum = isset($_REQUEST['num']) ? $_REQUEST['num'] : null;} |
|
43 | -if (empty($nbrQuestions)) { $nbrQuestions = isset($_REQUEST['nbrQuestions']) ? $_REQUEST['nbrQuestions'] : null;} |
|
44 | -if (empty($questionList)) { $questionList = isset($_SESSION['questionList']) ? $_SESSION['questionList'] : null;} |
|
45 | -if (empty($objExercise)) { $objExercise = isset($_SESSION['objExercise']) ? $_SESSION['objExercise'] : null;} |
|
46 | -if (empty($exeId)) { $exeId = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;} |
|
47 | -if (empty($action)) { $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;} |
|
40 | +if (empty($questionId)) { $questionId = isset($_REQUEST['questionId']) ? $_REQUEST['questionId'] : null; } |
|
41 | +if (empty($choice)) { $choice = isset($_REQUEST['choice']) ? $_REQUEST['choice'] : null; } |
|
42 | +if (empty($questionNum)) { $questionNum = isset($_REQUEST['num']) ? $_REQUEST['num'] : null; } |
|
43 | +if (empty($nbrQuestions)) { $nbrQuestions = isset($_REQUEST['nbrQuestions']) ? $_REQUEST['nbrQuestions'] : null; } |
|
44 | +if (empty($questionList)) { $questionList = isset($_SESSION['questionList']) ? $_SESSION['questionList'] : null; } |
|
45 | +if (empty($objExercise)) { $objExercise = isset($_SESSION['objExercise']) ? $_SESSION['objExercise'] : null; } |
|
46 | +if (empty($exeId)) { $exeId = isset($_REQUEST['id']) ? $_REQUEST['id'] : null; } |
|
47 | +if (empty($action)) { $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; } |
|
48 | 48 | |
49 | 49 | $id = intval($_REQUEST['id']); //exe id |
50 | 50 | |
@@ -105,23 +105,23 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | if (isset($_SESSION['gradebook'])) { |
108 | - $gradebook= Security::remove_XSS($_SESSION['gradebook']); |
|
108 | + $gradebook = Security::remove_XSS($_SESSION['gradebook']); |
|
109 | 109 | } |
110 | 110 | |
111 | -if (!empty($gradebook) && $gradebook=='view') { |
|
112 | - $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'],'name' => get_lang('ToolGradebook')); |
|
111 | +if (!empty($gradebook) && $gradebook == 'view') { |
|
112 | + $interbreadcrumb[] = array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook')); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | $fromlink = ''; |
116 | 116 | |
117 | -$interbreadcrumb[]= array("url" => "exercise.php?".api_get_cidreq(),"name" => get_lang('Exercises')); |
|
118 | -$interbreadcrumb[]= array("url" => "overview.php?exerciseId=".$exercise_id.'&'.api_get_cidreq(),"name" => $objExercise->name); |
|
119 | -$interbreadcrumb[]= array("url" => "#","name" => get_lang('Result')); |
|
117 | +$interbreadcrumb[] = array("url" => "exercise.php?".api_get_cidreq(), "name" => get_lang('Exercises')); |
|
118 | +$interbreadcrumb[] = array("url" => "overview.php?exerciseId=".$exercise_id.'&'.api_get_cidreq(), "name" => $objExercise->name); |
|
119 | +$interbreadcrumb[] = array("url" => "#", "name" => get_lang('Result')); |
|
120 | 120 | |
121 | 121 | $this_section = SECTION_COURSES; |
122 | 122 | |
123 | -$htmlHeadXtra[] = '<link rel="stylesheet" href="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/css/hotspot.css">'; |
|
124 | -$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/js/hotspot.js"></script>'; |
|
123 | +$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/css/hotspot.css">'; |
|
124 | +$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/hotspot.js"></script>'; |
|
125 | 125 | |
126 | 126 | if ($origin != 'learnpath') { |
127 | 127 | Display::display_header(''); |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | // Avoiding the "Score 0/0" message when the exe_id is not set |
179 | 179 | if (!empty($track_exercise_info)) { |
180 | 180 | // if the results_disabled of the Quiz is 1 when block the script |
181 | - $result_disabled = $track_exercise_info['results_disabled']; |
|
181 | + $result_disabled = $track_exercise_info['results_disabled']; |
|
182 | 182 | |
183 | - if (!(api_is_platform_admin() || api_is_course_admin() || api_is_course_coach()) ) { |
|
183 | + if (!(api_is_platform_admin() || api_is_course_admin() || api_is_course_coach())) { |
|
184 | 184 | if ($result_disabled == 1) { |
185 | 185 | $show_results = false; |
186 | 186 | if ($origin != 'learnpath') { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $show_results = false; |
215 | 215 | } |
216 | 216 | |
217 | -if ($origin == 'learnpath' && !isset($_GET['fb_type']) ) { |
|
217 | +if ($origin == 'learnpath' && !isset($_GET['fb_type'])) { |
|
218 | 218 | $show_results = false; |
219 | 219 | } |
220 | 220 | |
@@ -231,12 +231,12 @@ discard block |
||
231 | 231 | |
232 | 232 | $i = $totalScore = $totalWeighting = 0; |
233 | 233 | |
234 | -if ($debug > 0){error_log("ExerciseResult: ".print_r($exerciseResult,1)); error_log("QuestionList: ".print_r($questionList,1));} |
|
234 | +if ($debug > 0) {error_log("ExerciseResult: ".print_r($exerciseResult, 1)); error_log("QuestionList: ".print_r($questionList, 1)); } |
|
235 | 235 | |
236 | 236 | $arrques = array(); |
237 | 237 | $arrans = array(); |
238 | 238 | |
239 | -$user_restriction = $is_allowedToEdit ? '' : "AND user_id=".intval($student_id)." "; |
|
239 | +$user_restriction = $is_allowedToEdit ? '' : "AND user_id=".intval($student_id)." "; |
|
240 | 240 | $sql = "SELECT attempts.question_id, answer |
241 | 241 | FROM $TBL_TRACK_ATTEMPT as attempts |
242 | 242 | INNER JOIN ".$TBL_TRACK_EXERCISES." AS stats_exercises |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | $total_weighting = 0; |
292 | 292 | foreach ($questionList as $questionId) { |
293 | 293 | $objQuestionTmp = Question::read($questionId); |
294 | - $total_weighting +=$objQuestionTmp->selectWeighting(); |
|
294 | + $total_weighting += $objQuestionTmp->selectWeighting(); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | $counter = 1; |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | unset($objQuestionTmp); |
312 | 312 | |
313 | 313 | // creates a temporary Question object |
314 | - $objQuestionTmp = Question::read($questionId); |
|
315 | - $questionWeighting = $objQuestionTmp->selectWeighting(); |
|
316 | - $answerType = $objQuestionTmp->selectType(); |
|
314 | + $objQuestionTmp = Question::read($questionId); |
|
315 | + $questionWeighting = $objQuestionTmp->selectWeighting(); |
|
316 | + $answerType = $objQuestionTmp->selectType(); |
|
317 | 317 | |
318 | 318 | // Start buffer |
319 | 319 | ob_start(); |
@@ -323,39 +323,39 @@ discard block |
||
323 | 323 | }*/ |
324 | 324 | |
325 | 325 | if ($answerType == MULTIPLE_ANSWER || $answerType == MULTIPLE_ANSWER_TRUE_FALSE) { |
326 | - $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
326 | + $question_result = $objExercise->manage_answer($id, $questionId, $choice, 'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
327 | 327 | $questionScore = $question_result['score']; |
328 | - $totalScore += $question_result['score']; |
|
329 | - } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION || $answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) { |
|
328 | + $totalScore += $question_result['score']; |
|
329 | + } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION || $answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) { |
|
330 | 330 | $choice = array(); |
331 | - $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
331 | + $question_result = $objExercise->manage_answer($id, $questionId, $choice, 'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
332 | 332 | $questionScore = $question_result['score']; |
333 | 333 | $totalScore += $question_result['score']; |
334 | - } elseif ($answerType == UNIQUE_ANSWER || $answerType == UNIQUE_ANSWER_NO_OPTION) { |
|
335 | - $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
334 | + } elseif ($answerType == UNIQUE_ANSWER || $answerType == UNIQUE_ANSWER_NO_OPTION) { |
|
335 | + $question_result = $objExercise->manage_answer($id, $questionId, $choice, 'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
336 | 336 | $questionScore = $question_result['score']; |
337 | 337 | $totalScore += $question_result['score']; |
338 | 338 | echo '</table>'; |
339 | 339 | } elseif ($answerType == FILL_IN_BLANKS) { |
340 | - $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
340 | + $question_result = $objExercise->manage_answer($id, $questionId, $choice, 'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
341 | 341 | $questionScore = $question_result['score']; |
342 | 342 | $totalScore += $question_result['score']; |
343 | 343 | } elseif ($answerType == GLOBAL_MULTIPLE_ANSWER) { |
344 | - $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
344 | + $question_result = $objExercise->manage_answer($id, $questionId, $choice, 'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
345 | 345 | $questionScore = $question_result['score']; |
346 | 346 | $totalScore += $question_result['score']; |
347 | 347 | } elseif ($answerType == FREE_ANSWER) { |
348 | 348 | $answer = $str; |
349 | - $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
349 | + $question_result = $objExercise->manage_answer($id, $questionId, $choice, 'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
350 | 350 | $questionScore = $question_result['score']; |
351 | 351 | $totalScore += $question_result['score']; |
352 | 352 | } elseif ($answerType == ORAL_EXPRESSION) { |
353 | 353 | $answer = $str; |
354 | - $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
354 | + $question_result = $objExercise->manage_answer($id, $questionId, $choice, 'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
355 | 355 | $questionScore = $question_result['score']; |
356 | 356 | $totalScore += $question_result['score']; |
357 | 357 | } elseif (in_array($answerType, [MATCHING, DRAGGABLE, MATCHING_DRAGGABLE])) { |
358 | - $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
358 | + $question_result = $objExercise->manage_answer($id, $questionId, $choice, 'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
359 | 359 | $questionScore = $question_result['score']; |
360 | 360 | $totalScore += $question_result['score']; |
361 | 361 | } elseif ($answerType == HOT_SPOT) { |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | <td valign="top" align="center" style="padding-left:0px;" > |
365 | 365 | <table border="1" bordercolor="#A4A4A4" style="border-collapse: collapse;" width="552">'; |
366 | 366 | } |
367 | - $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
367 | + $question_result = $objExercise->manage_answer($id, $questionId, $choice, 'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
368 | 368 | $questionScore = $question_result['score']; |
369 | 369 | $totalScore += $question_result['score']; |
370 | 370 | |
@@ -392,9 +392,9 @@ discard block |
||
392 | 392 | <br> |
393 | 393 | "; |
394 | 394 | } |
395 | - } else if($answerType == HOT_SPOT_DELINEATION) { |
|
395 | + } else if ($answerType == HOT_SPOT_DELINEATION) { |
|
396 | 396 | |
397 | - $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg(), 'database'); |
|
397 | + $question_result = $objExercise->manage_answer($id, $questionId, $choice, 'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg(), 'database'); |
|
398 | 398 | |
399 | 399 | $questionScore = $question_result['score']; |
400 | 400 | $totalScore += $question_result['score']; |
@@ -414,20 +414,20 @@ discard block |
||
414 | 414 | if ($show_results) { |
415 | 415 | |
416 | 416 | if ($overlap_color) { |
417 | - $overlap_color='green'; |
|
417 | + $overlap_color = 'green'; |
|
418 | 418 | } else { |
419 | - $overlap_color='red'; |
|
419 | + $overlap_color = 'red'; |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | if ($missing_color) { |
423 | - $missing_color='green'; |
|
423 | + $missing_color = 'green'; |
|
424 | 424 | } else { |
425 | - $missing_color='red'; |
|
425 | + $missing_color = 'red'; |
|
426 | 426 | } |
427 | 427 | if ($excess_color) { |
428 | - $excess_color='green'; |
|
428 | + $excess_color = 'green'; |
|
429 | 429 | } else { |
430 | - $excess_color='red'; |
|
430 | + $excess_color = 'red'; |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | if (!is_numeric($final_overlap)) { |
@@ -441,11 +441,11 @@ discard block |
||
441 | 441 | $final_excess = 0; |
442 | 442 | } |
443 | 443 | |
444 | - if ($final_excess>100) { |
|
444 | + if ($final_excess > 100) { |
|
445 | 445 | $final_excess = 100; |
446 | 446 | } |
447 | 447 | |
448 | - $table_resume='<table class="data_table"> |
|
448 | + $table_resume = '<table class="data_table"> |
|
449 | 449 | <tr class="row_odd" > |
450 | 450 | <td></td> |
451 | 451 | <td ><b>'.get_lang('Requirements').'</b></td> |
@@ -455,38 +455,38 @@ discard block |
||
455 | 455 | <tr class="row_even"> |
456 | 456 | <td><b>'.get_lang('Overlap').'</b></td> |
457 | 457 | <td>'.get_lang('Min').' '.$threadhold1.'</td> |
458 | - <td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0)?0:intval($final_overlap)).'</div></td> |
|
458 | + <td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td> |
|
459 | 459 | </tr> |
460 | 460 | |
461 | 461 | <tr> |
462 | 462 | <td><b>'.get_lang('Excess').'</b></td> |
463 | 463 | <td>'.get_lang('Max').' '.$threadhold2.'</td> |
464 | - <td><div style="color:'.$excess_color.'">'.(($final_excess < 0)?0:intval($final_excess)).'</div></td> |
|
464 | + <td><div style="color:'.$excess_color.'">'.(($final_excess < 0) ? 0 : intval($final_excess)).'</div></td> |
|
465 | 465 | </tr> |
466 | 466 | |
467 | 467 | <tr class="row_even"> |
468 | 468 | <td><b>'.get_lang('Missing').'</b></td> |
469 | 469 | <td>'.get_lang('Max').' '.$threadhold3.'</td> |
470 | - <td><div style="color:'.$missing_color.'">'.(($final_missing < 0)?0:intval($final_missing)).'</div></td> |
|
470 | + <td><div style="color:'.$missing_color.'">'.(($final_missing < 0) ? 0 : intval($final_missing)).'</div></td> |
|
471 | 471 | </tr></table>'; |
472 | 472 | |
473 | - if ($answerType!= HOT_SPOT_DELINEATION) { |
|
474 | - $item_list = explode('@@',$destination); |
|
473 | + if ($answerType != HOT_SPOT_DELINEATION) { |
|
474 | + $item_list = explode('@@', $destination); |
|
475 | 475 | |
476 | 476 | $try = $item_list[0]; |
477 | 477 | $lp = $item_list[1]; |
478 | 478 | $destinationid = $item_list[2]; |
479 | 479 | $url = $item_list[3]; |
480 | - $table_resume=''; |
|
480 | + $table_resume = ''; |
|
481 | 481 | } else { |
482 | - if ($next==0) { |
|
482 | + if ($next == 0) { |
|
483 | 483 | $try = $try_hotspot; |
484 | 484 | $lp = $lp_hotspot; |
485 | - $destinationid= $select_question_hotspot; |
|
486 | - $url=$url_hotspot; |
|
485 | + $destinationid = $select_question_hotspot; |
|
486 | + $url = $url_hotspot; |
|
487 | 487 | } else { |
488 | 488 | //show if no error |
489 | - $comment=$answerComment = $objAnswerTmp->selectComment($nbrAnswers); |
|
489 | + $comment = $answerComment = $objAnswerTmp->selectComment($nbrAnswers); |
|
490 | 490 | $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers); |
491 | 491 | } |
492 | 492 | } |
@@ -494,14 +494,14 @@ discard block |
||
494 | 494 | echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>'; |
495 | 495 | if ($answerType == HOT_SPOT_DELINEATION) { |
496 | 496 | if ($organs_at_risk_hit > 0) { |
497 | - $message='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
498 | - $message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>'; |
|
497 | + $message = '<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
498 | + $message .= '<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>'; |
|
499 | 499 | } else { |
500 | - $message='<p>'.get_lang('YourDelineation').'</p>'; |
|
501 | - $message.=$table_resume; |
|
502 | - $message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
500 | + $message = '<p>'.get_lang('YourDelineation').'</p>'; |
|
501 | + $message .= $table_resume; |
|
502 | + $message .= '<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
503 | 503 | } |
504 | - $message.='<p>'.$comment.'</p>'; |
|
504 | + $message .= '<p>'.$comment.'</p>'; |
|
505 | 505 | echo $message; |
506 | 506 | } else { |
507 | 507 | echo '<p>'.$comment.'</p>'; |
@@ -510,8 +510,8 @@ discard block |
||
510 | 510 | //showing the score |
511 | 511 | $queryfree = "select marks from ".$TBL_TRACK_ATTEMPT." WHERE exe_id = ".intval($id)." and question_id= ".intval($questionId).""; |
512 | 512 | $resfree = Database::query($queryfree); |
513 | - $questionScore= Database::result($resfree,0,"marks"); |
|
514 | - $totalScore+=$questionScore; |
|
513 | + $questionScore = Database::result($resfree, 0, "marks"); |
|
514 | + $totalScore += $questionScore; |
|
515 | 515 | $relPath = api_get_path(REL_PATH); |
516 | 516 | echo '</table></td></tr>'; |
517 | 517 | |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) { |
567 | 567 | $url_name = get_lang('EditCommentsAndMarks'); |
568 | 568 | } else { |
569 | - if ($action=='edit') { |
|
569 | + if ($action == 'edit') { |
|
570 | 570 | $url_name = get_lang('EditIndividualComment'); |
571 | 571 | } else { |
572 | 572 | $url_name = get_lang('AddComments'); |
@@ -587,9 +587,9 @@ discard block |
||
587 | 587 | |
588 | 588 | echo '<div id="'.$name.'" style="display:none">'; |
589 | 589 | $arrid[] = $questionId; |
590 | - $feedback_form = new FormValidator('frmcomments'.$questionId,'post',''); |
|
591 | - $feedback_form->addElement('html','<br>'); |
|
592 | - $renderer =& $feedback_form->defaultRenderer(); |
|
590 | + $feedback_form = new FormValidator('frmcomments'.$questionId, 'post', ''); |
|
591 | + $feedback_form->addElement('html', '<br>'); |
|
592 | + $renderer = & $feedback_form->defaultRenderer(); |
|
593 | 593 | $renderer->setFormTemplate('<form{attributes}><div align="left">{content}</div></form>'); |
594 | 594 | $renderer->setCustomElementTemplate('<div align="left">{element}</div>'); |
595 | 595 | $comnt = Event::get_comments($id, $questionId); |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | if ($useAdvancedEditor) { |
599 | 599 | $feedback_form->addElement( |
600 | 600 | 'html_editor', |
601 | - 'comments_' . $questionId, |
|
601 | + 'comments_'.$questionId, |
|
602 | 602 | null, |
603 | 603 | null, |
604 | 604 | array( |
@@ -608,9 +608,9 @@ discard block |
||
608 | 608 | ) |
609 | 609 | ); |
610 | 610 | } else { |
611 | - $feedback_form->addElement('textarea', 'comments_' . $questionId); |
|
611 | + $feedback_form->addElement('textarea', 'comments_'.$questionId); |
|
612 | 612 | } |
613 | - $feedback_form->addElement('html','<br>'); |
|
613 | + $feedback_form->addElement('html', '<br>'); |
|
614 | 614 | $feedback_form->setDefaults($default); |
615 | 615 | $feedback_form->display(); |
616 | 616 | echo '</div>'; |
@@ -632,13 +632,13 @@ discard block |
||
632 | 632 | $arrmarks[] = $questionId; |
633 | 633 | echo get_lang("AssignMarks"); |
634 | 634 | echo " <select name='marks' id='marks'>"; |
635 | - for ($i=0;$i<=$questionWeighting;$i++) { |
|
636 | - echo '<option '.(($i==$questionScore)?"selected='selected'":'').'>'.$i.'</option>'; |
|
635 | + for ($i = 0; $i <= $questionWeighting; $i++) { |
|
636 | + echo '<option '.(($i == $questionScore) ? "selected='selected'" : '').'>'.$i.'</option>'; |
|
637 | 637 | } |
638 | 638 | echo '</select>'; |
639 | 639 | echo '</form><br /></div>'; |
640 | 640 | |
641 | - if ($questionScore == -1 ) { |
|
641 | + if ($questionScore == -1) { |
|
642 | 642 | $questionScore = 0; |
643 | 643 | echo Display::return_message(get_lang('notCorrectedYet')); |
644 | 644 | } |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | } |
675 | 675 | |
676 | 676 | if (isset($objQuestionTmp->category_list) && !empty($objQuestionTmp->category_list)) { |
677 | - foreach($objQuestionTmp->category_list as $category_id) { |
|
677 | + foreach ($objQuestionTmp->category_list as $category_id) { |
|
678 | 678 | $category_list[$category_id]['score'] += $my_total_score; |
679 | 679 | $category_list[$category_id]['total'] += $my_total_weight; |
680 | 680 | $category_was_added_for_this_test = true; |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | $total_score_text = null; |
730 | 730 | |
731 | 731 | //Total score |
732 | -if ($origin!='learnpath' || ($origin == 'learnpath' && isset($_GET['fb_type']))) { |
|
732 | +if ($origin != 'learnpath' || ($origin == 'learnpath' && isset($_GET['fb_type']))) { |
|
733 | 733 | if ($show_results || $show_only_total_score) { |
734 | 734 | $total_score_text .= '<div class="question_row">'; |
735 | 735 | $my_total_score_temp = $totalScore; |
@@ -761,13 +761,13 @@ discard block |
||
761 | 761 | |
762 | 762 | if ($isFeedbackAllowed) { |
763 | 763 | if (is_array($arrid) && is_array($arrmarks)) { |
764 | - $strids = implode(",",$arrid); |
|
765 | - $marksid = implode(",",$arrmarks); |
|
764 | + $strids = implode(",", $arrid); |
|
765 | + $marksid = implode(",", $arrmarks); |
|
766 | 766 | } |
767 | 767 | } |
768 | 768 | |
769 | 769 | if ($isFeedbackAllowed) { |
770 | - if (in_array($origin, array('tracking_course','user_course','correct_exercise_in_lp'))) { |
|
770 | + if (in_array($origin, array('tracking_course', 'user_course', 'correct_exercise_in_lp'))) { |
|
771 | 771 | echo '<form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=2&comments=update&exeid='.$id.'&origin='.$origin.'&details=true&course='.Security::remove_XSS($_GET['cidReq']).$fromlink.'" method="post">'; |
772 | 772 | echo '<input type = "hidden" name="lp_item_id" value="'.$learnpath_id.'">'; |
773 | 773 | echo '<input type = "hidden" name="lp_item_view_id" value="'.$lp_item_view_id.'">'; |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | } else { |
778 | 778 | echo ' <form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=1&comments=update&exeid='.$id.'" method="post">'; |
779 | 779 | } |
780 | - if ($origin !='learnpath' && $origin!='student_progress') { |
|
780 | + if ($origin != 'learnpath' && $origin != 'student_progress') { |
|
781 | 781 | echo '<label><input type= "checkbox" name="send_notification"> '.get_lang('SendEmail').'</label>'; |
782 | 782 | ?> |
783 | 783 | <button type="submit" class="btn btn-primary" value="<?php echo get_lang('Ok'); ?>" onclick="getFCK('<?php echo $strids; ?>','<?php echo $marksid; ?>');"> |
@@ -789,14 +789,14 @@ discard block |
||
789 | 789 | } |
790 | 790 | |
791 | 791 | //Came from lpstats in a lp |
792 | -if ($origin =='student_progress') { ?> |
|
792 | +if ($origin == 'student_progress') { ?> |
|
793 | 793 | <button type="button" class="back" onclick="window.history.go(-1);" value="<?php echo get_lang('Back'); ?>" > |
794 | - <?php echo get_lang('Back');?></button> |
|
794 | + <?php echo get_lang('Back'); ?></button> |
|
795 | 795 | <?php |
796 | -} else if($origin=='myprogress') { |
|
796 | +} else if ($origin == 'myprogress') { |
|
797 | 797 | ?> |
798 | 798 | <button type="button" class="save" onclick="top.location.href='../auth/my_progress.php?course=<?php echo api_get_course_id()?>'" value="<?php echo get_lang('Finish'); ?>" > |
799 | - <?php echo get_lang('Finish');?> |
|
799 | + <?php echo get_lang('Finish'); ?> |
|
800 | 800 | </button> |
801 | 801 | <?php |
802 | 802 | } |
@@ -806,9 +806,9 @@ discard block |
||
806 | 806 | Display::display_footer(); |
807 | 807 | } else { |
808 | 808 | if (!isset($_GET['fb_type'])) { |
809 | - $lp_mode = $_SESSION['lp_mode']; |
|
809 | + $lp_mode = $_SESSION['lp_mode']; |
|
810 | 810 | $url = '../newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exeId.'&fb_type='.$feedback_type; |
811 | - $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'" '; |
|
811 | + $href = ($lp_mode == 'fullscreen') ? ' window.opener.location.href="'.$url.'" ' : ' top.location.href="'.$url.'" '; |
|
812 | 812 | echo '<script type="text/javascript">'.$href.'</script>'; |
813 | 813 | // Record the results in the learning path, using the SCORM interface (API) |
814 | 814 | echo "<script>window.parent.API.void_save_asset('$totalScore', '$totalWeighting', 0, 'completed'); </script>"; |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | $html = '<table class="table table-striped table-hover">'; |
40 | 40 | $html .= '<thead>'; |
41 | 41 | $html .= '<tr>'; |
42 | - $html .= '<th width="10">' . get_lang('Number') . '</th>'; |
|
43 | - $html .= '<th width="10">' . get_lang('True') . '</th>'; |
|
44 | - $html .= '<th width="50%">' . get_lang('Comment') . '</th>'; |
|
45 | - $html .= '<th width="50%">' . get_lang('Answer') . '</th>'; |
|
42 | + $html .= '<th width="10">'.get_lang('Number').'</th>'; |
|
43 | + $html .= '<th width="10">'.get_lang('True').'</th>'; |
|
44 | + $html .= '<th width="50%">'.get_lang('Comment').'</th>'; |
|
45 | + $html .= '<th width="50%">'.get_lang('Answer').'</th>'; |
|
46 | 46 | $html .= '</tr>'; |
47 | 47 | $html .= '</thead>'; |
48 | 48 | $html .= '<tbody>'; |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | $form->addHtml('<tr>'); |
75 | 75 | |
76 | 76 | if (is_object($answer)) { |
77 | - $defaults['answer[' . $i . ']'] = $answer->answer[$i]; |
|
78 | - $defaults['comment[' . $i . ']'] = $answer->comment[$i]; |
|
79 | - $defaults['weighting[' . $i . ']'] = float_format($answer->weighting[$i], 1); |
|
80 | - $defaults['correct[' . $i . ']'] = $answer->correct[$i]; |
|
77 | + $defaults['answer['.$i.']'] = $answer->answer[$i]; |
|
78 | + $defaults['comment['.$i.']'] = $answer->comment[$i]; |
|
79 | + $defaults['weighting['.$i.']'] = float_format($answer->weighting[$i], 1); |
|
80 | + $defaults['correct['.$i.']'] = $answer->correct[$i]; |
|
81 | 81 | } else { |
82 | 82 | $defaults['answer[1]'] = get_lang('DefaultMultipleAnswer2'); |
83 | 83 | $defaults['comment[1]'] = get_lang('DefaultMultipleComment2'); |
@@ -93,44 +93,44 @@ discard block |
||
93 | 93 | |
94 | 94 | $renderer->setElementTemplate( |
95 | 95 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
96 | - 'correct[' . $i . ']' |
|
96 | + 'correct['.$i.']' |
|
97 | 97 | ); |
98 | 98 | $renderer->setElementTemplate( |
99 | 99 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
100 | - 'counter[' . $i . ']' |
|
100 | + 'counter['.$i.']' |
|
101 | 101 | ); |
102 | 102 | $renderer->setElementTemplate( |
103 | 103 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
104 | - 'answer[' . $i . ']' |
|
104 | + 'answer['.$i.']' |
|
105 | 105 | ); |
106 | 106 | $renderer->setElementTemplate( |
107 | 107 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
108 | - 'comment[' . $i . ']' |
|
108 | + 'comment['.$i.']' |
|
109 | 109 | ); |
110 | 110 | |
111 | - $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"'); |
|
111 | + $answer_number = $form->addElement('text', 'counter['.$i.']', null, 'value="'.$i.'"'); |
|
112 | 112 | $answer_number->freeze(); |
113 | 113 | |
114 | 114 | $form->addElement('checkbox', |
115 | - 'correct[' . $i . ']', |
|
115 | + 'correct['.$i.']', |
|
116 | 116 | null, |
117 | 117 | null, |
118 | 118 | 'class="checkbox" style="margin-left: 0em;"' |
119 | 119 | ); |
120 | - $boxes_names[] = 'correct[' . $i . ']'; |
|
120 | + $boxes_names[] = 'correct['.$i.']'; |
|
121 | 121 | |
122 | 122 | $form->addElement( |
123 | 123 | 'html_editor', |
124 | - 'answer[' . $i . ']', |
|
124 | + 'answer['.$i.']', |
|
125 | 125 | null, |
126 | 126 | array(), |
127 | 127 | array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100') |
128 | 128 | ); |
129 | - $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required'); |
|
129 | + $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required'); |
|
130 | 130 | |
131 | 131 | $form->addElement( |
132 | 132 | 'html_editor', |
133 | - 'comment[' . $i . ']', |
|
133 | + 'comment['.$i.']', |
|
134 | 134 | null, |
135 | 135 | array(), |
136 | 136 | array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100') |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | function return_header($feedback_type = null, $counter = null, $score = null) |
227 | 227 | { |
228 | 228 | $header = parent::return_header($feedback_type, $counter, $score); |
229 | - $header .= '<table class="'.$this->question_table_class .'"> |
|
229 | + $header .= '<table class="'.$this->question_table_class.'"> |
|
230 | 230 | <tr> |
231 | 231 | <th>'.get_lang("Choice").'</th> |
232 | 232 | <th>'. get_lang("ExpectedChoice").'</th> |