Completed
Push — 1.10.x ( 8f5d7d...f2cdff )
by Julito
53:05 queued 11:34
created
main/exercice/exercise_show.php 1 patch
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 // General parameters passed via POST/GET
36 36
 if ($debug) {
37
-    error_log('Entered exercise_result.php: ' . print_r($_POST, 1));
37
+    error_log('Entered exercise_result.php: '.print_r($_POST, 1));
38 38
 }
39 39
 
40 40
 if (empty($formSent)) {
@@ -131,19 +131,19 @@  discard block
 block discarded – undo
131 131
 }
132 132
 
133 133
 if (!empty($gradebook) && $gradebook == 'view') {
134
-    $interbreadcrumb[] = array('url' => '../gradebook/' . $_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook'));
134
+    $interbreadcrumb[] = array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook'));
135 135
 }
136 136
 
137 137
 $fromlink = '';
138 138
 
139
-$interbreadcrumb[] = array("url" => "exercise.php?" . api_get_cidreq(), "name" => get_lang('Exercises'));
140
-$interbreadcrumb[] = array("url" => "overview.php?exerciseId=" . $exercise_id . '&' . api_get_cidreq(), "name" => $objExercise->name);
139
+$interbreadcrumb[] = array("url" => "exercise.php?".api_get_cidreq(), "name" => get_lang('Exercises'));
140
+$interbreadcrumb[] = array("url" => "overview.php?exerciseId=".$exercise_id.'&'.api_get_cidreq(), "name" => $objExercise->name);
141 141
 $interbreadcrumb[] = array("url" => "#", "name" => get_lang('Result'));
142 142
 
143 143
 $this_section = SECTION_COURSES;
144 144
 
145
-$htmlHeadXtra[] = '<link rel="stylesheet" href="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/css/hotspot.css">';
146
-$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/js/hotspot.js"></script>';
145
+$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/css/hotspot.css">';
146
+$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/hotspot.js"></script>';
147 147
 
148 148
 if ($origin != 'learnpath') {
149 149
     Display::display_header('');
@@ -280,29 +280,29 @@  discard block
 block discarded – undo
280 280
 $i = $totalScore = $totalWeighting = 0;
281 281
 
282 282
 if ($debug > 0) {
283
-    error_log("ExerciseResult: " . print_r($exerciseResult, 1));
284
-    error_log("QuestionList: " . print_r($questionList, 1));
283
+    error_log("ExerciseResult: ".print_r($exerciseResult, 1));
284
+    error_log("QuestionList: ".print_r($questionList, 1));
285 285
 }
286 286
 
287 287
 $arrques = array();
288 288
 $arrans = array();
289 289
 
290
-$user_restriction = $is_allowedToEdit ? '' : "AND user_id=" . intval($student_id) . " ";
290
+$user_restriction = $is_allowedToEdit ? '' : "AND user_id=".intval($student_id)." ";
291 291
 $sql = "SELECT attempts.question_id, answer
292 292
         FROM $TBL_TRACK_ATTEMPT as attempts
293
-        INNER JOIN " . $TBL_TRACK_EXERCISES . " AS stats_exercises
293
+        INNER JOIN ".$TBL_TRACK_EXERCISES." AS stats_exercises
294 294
         ON stats_exercises.exe_id=attempts.exe_id
295 295
         INNER JOIN $TBL_EXERCISE_QUESTION AS quizz_rel_questions
296 296
         ON
297 297
             quizz_rel_questions.exercice_id=stats_exercises.exe_exo_id AND
298 298
             quizz_rel_questions.question_id = attempts.question_id AND
299
-            quizz_rel_questions.c_id=" . api_get_course_int_id() . "
300
-        INNER JOIN " . $TBL_QUESTIONS . " AS questions
299
+            quizz_rel_questions.c_id=".api_get_course_int_id()."
300
+        INNER JOIN " . $TBL_QUESTIONS." AS questions
301 301
         ON
302 302
             questions.id=quizz_rel_questions.question_id AND
303
-            questions.c_id = " . api_get_course_int_id() . "
303
+            questions.c_id = " . api_get_course_int_id()."
304 304
         WHERE
305
-            attempts.exe_id = " . intval($id) . " $user_restriction
305
+            attempts.exe_id = " . intval($id)." $user_restriction
306 306
 		GROUP BY quizz_rel_questions.question_order, attempts.question_id";
307 307
 
308 308
 $result = Database::query($sql);
@@ -530,26 +530,26 @@  discard block
 block discarded – undo
530 530
                 $table_resume = '<table class="data_table">
531 531
                     <tr class="row_odd" >
532 532
                     <td></td>
533
-                    <td ><b>' . get_lang('Requirements') . '</b></td>
534
-                    <td><b>' . get_lang('YourAnswer') . '</b></td>
533
+                    <td ><b>' . get_lang('Requirements').'</b></td>
534
+                    <td><b>' . get_lang('YourAnswer').'</b></td>
535 535
                     </tr>
536 536
         
537 537
                     <tr class="row_even">
538
-                    <td><b>' . get_lang('Overlap') . '</b></td>
539
-                    <td>' . get_lang('Min') . ' ' . $threadhold1 . '</td>
540
-                        <td><div style="color:' . $overlap_color . '">' . (($final_overlap < 0) ? 0 : intval($final_overlap)) . '</div></td>
538
+                    <td><b>' . get_lang('Overlap').'</b></td>
539
+                    <td>' . get_lang('Min').' '.$threadhold1.'</td>
540
+                        <td><div style="color:' . $overlap_color.'">'.(($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td>
541 541
                     </tr>
542 542
         
543 543
                     <tr>
544
-                        <td><b>' . get_lang('Excess') . '</b></td>
545
-                        <td>' . get_lang('Max') . ' ' . $threadhold2 . '</td>
546
-                        <td><div style="color:' . $excess_color . '">' . (($final_excess < 0) ? 0 : intval($final_excess)) . '</div></td>
544
+                        <td><b>' . get_lang('Excess').'</b></td>
545
+                        <td>' . get_lang('Max').' '.$threadhold2.'</td>
546
+                        <td><div style="color:' . $excess_color.'">'.(($final_excess < 0) ? 0 : intval($final_excess)).'</div></td>
547 547
                     </tr>
548 548
         
549 549
                     <tr class="row_even">
550
-                        <td><b>' . get_lang('Missing') . '</b></td>
551
-                        <td>' . get_lang('Max') . ' ' . $threadhold3 . '</td>
552
-                        <td><div style="color:' . $missing_color . '">' . (($final_missing < 0) ? 0 : intval($final_missing)) . '</div></td>
550
+                        <td><b>' . get_lang('Missing').'</b></td>
551
+                        <td>' . get_lang('Max').' '.$threadhold3.'</td>
552
+                        <td><div style="color:' . $missing_color.'">'.(($final_missing < 0) ? 0 : intval($final_missing)).'</div></td>
553 553
                     </tr></table>';
554 554
 
555 555
                 if ($answerType != HOT_SPOT_DELINEATION) {
@@ -573,24 +573,24 @@  discard block
 block discarded – undo
573 573
                     }
574 574
                 }
575 575
 
576
-                echo '<h1><div style="color:#333;">' . get_lang('Feedback') . '</div></h1>';
576
+                echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>';
577 577
                 if ($answerType == HOT_SPOT_DELINEATION) {
578 578
                     if ($organs_at_risk_hit > 0) {
579
-                        $message = '<br />' . get_lang('ResultIs') . ' <b>' . $result_comment . '</b><br />';
580
-                        $message .= '<p style="color:#DC0A0A;"><b>' . get_lang('OARHit') . '</b></p>';
579
+                        $message = '<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
580
+                        $message .= '<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>';
581 581
                     } else {
582
-                        $message = '<p>' . get_lang('YourDelineation') . '</p>';
582
+                        $message = '<p>'.get_lang('YourDelineation').'</p>';
583 583
                         $message .= $table_resume;
584
-                        $message .= '<br />' . get_lang('ResultIs') . ' <b>' . $result_comment . '</b><br />';
584
+                        $message .= '<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
585 585
                     }
586
-                    $message .= '<p>' . $comment . '</p>';
586
+                    $message .= '<p>'.$comment.'</p>';
587 587
                     echo $message;
588 588
                 } else {
589
-                    echo '<p>' . $comment . '</p>';
589
+                    echo '<p>'.$comment.'</p>';
590 590
                 }
591 591
 
592 592
                 //showing the score
593
-                $queryfree = "select marks from " . $TBL_TRACK_ATTEMPT . " WHERE exe_id = " . intval($id) . " and question_id= " . intval($questionId) . "";
593
+                $queryfree = "select marks from ".$TBL_TRACK_ATTEMPT." WHERE exe_id = ".intval($id)." and question_id= ".intval($questionId)."";
594 594
                 $resfree = Database::query($queryfree);
595 595
                 $questionScore = Database::result($resfree, 0, "marks");
596 596
                 $totalScore += $questionScore;
@@ -645,8 +645,8 @@  discard block
 block discarded – undo
645 645
         $marksname = '';
646 646
 
647 647
         if ($isFeedbackAllowed) {
648
-            $name = "fckdiv" . $questionId;
649
-            $marksname = "marksName" . $questionId;
648
+            $name = "fckdiv".$questionId;
649
+            $marksname = "marksName".$questionId;
650 650
             if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) {
651 651
                 $url_name = get_lang('EditCommentsAndMarks');
652 652
             } else {
@@ -657,32 +657,32 @@  discard block
 block discarded – undo
657 657
                 }
658 658
             }
659 659
             echo '<br />';
660
-            echo Display::url($url_name, 'javascript://', array('class' => 'btn', 'onclick' => "showfck('" . $name . "', '" . $marksname . "');"));
660
+            echo Display::url($url_name, 'javascript://', array('class' => 'btn', 'onclick' => "showfck('".$name."', '".$marksname."');"));
661 661
             echo '<br />';
662 662
 
663
-            echo '<div id="feedback_' . $name . '" style="width:100%">';
663
+            echo '<div id="feedback_'.$name.'" style="width:100%">';
664 664
             $comnt = trim(Event::get_comments($id, $questionId));
665 665
             if (empty($comnt)) {
666 666
                 echo '<br />';
667 667
             } else {
668
-                echo '<div id="question_feedback">' . $comnt . '</div>';
668
+                echo '<div id="question_feedback">'.$comnt.'</div>';
669 669
             }
670 670
             echo '</div>';
671 671
 
672
-            echo '<div id="' . $name . '" style="display:none">';
672
+            echo '<div id="'.$name.'" style="display:none">';
673 673
             $arrid[] = $questionId;
674
-            $feedback_form = new FormValidator('frmcomments' . $questionId, 'post', '');
674
+            $feedback_form = new FormValidator('frmcomments'.$questionId, 'post', '');
675 675
             $feedback_form->addElement('html', '<br>');
676
-            $renderer =& $feedback_form->defaultRenderer();
676
+            $renderer = & $feedback_form->defaultRenderer();
677 677
             $renderer->setFormTemplate('<form{attributes}><div align="left">{content}</div></form>');
678 678
             $renderer->setCustomElementTemplate('<div align="left">{element}</div>');
679 679
             $comnt = Event::get_comments($id, $questionId);
680
-            $default = array('comments_' . $questionId => $comnt);
680
+            $default = array('comments_'.$questionId => $comnt);
681 681
 
682 682
             if ($useAdvancedEditor) {
683 683
                 $feedback_form->addElement(
684 684
                     'html_editor',
685
-                    'comments_' . $questionId,
685
+                    'comments_'.$questionId,
686 686
                     null,
687 687
                     null,
688 688
                     array(
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
                     )
693 693
                 );
694 694
             } else {
695
-                $feedback_form->addElement('textarea', 'comments_' . $questionId);
695
+                $feedback_form->addElement('textarea', 'comments_'.$questionId);
696 696
             }
697 697
             $feedback_form->addElement('html', '<br>');
698 698
             $feedback_form->setDefaults($default);
@@ -703,21 +703,21 @@  discard block
 block discarded – undo
703 703
             $comnt = Event::get_comments($id, $questionId);
704 704
             echo '<br />';
705 705
             if (!empty($comnt)) {
706
-                echo '<b>' . get_lang('Feedback') . '</b>';
707
-                echo '<div id="question_feedback">' . $comnt . '</div>';
706
+                echo '<b>'.get_lang('Feedback').'</b>';
707
+                echo '<div id="question_feedback">'.$comnt.'</div>';
708 708
             }
709 709
         }
710 710
 
711 711
         if ($is_allowedToEdit && $isFeedbackAllowed) {
712 712
             if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) {
713
-                $marksname = "marksName" . $questionId;
714
-                echo '<div id="' . $marksname . '" style="display:none">';
715
-                echo '<form name="marksform_' . $questionId . '" method="post" action="">';
713
+                $marksname = "marksName".$questionId;
714
+                echo '<div id="'.$marksname.'" style="display:none">';
715
+                echo '<form name="marksform_'.$questionId.'" method="post" action="">';
716 716
                 $arrmarks[] = $questionId;
717 717
                 echo get_lang("AssignMarks");
718 718
                 echo "&nbsp;<select name='marks' id='marks'>";
719 719
                 for ($i = 0; $i <= $questionWeighting; $i++) {
720
-                    echo '<option ' . (($i == $questionScore) ? "selected='selected'" : '') . '>' . $i . '</option>';
720
+                    echo '<option '.(($i == $questionScore) ? "selected='selected'" : '').'>'.$i.'</option>';
721 721
                 }
722 722
                 echo '</select>';
723 723
                 echo '</form><br /></div>';
@@ -728,8 +728,8 @@  discard block
 block discarded – undo
728 728
                 }
729 729
             } else {
730 730
                 $arrmarks[] = $questionId;
731
-                echo '<div id="' . $marksname . '" style="display:none"><form name="marksform_' . $questionId . '" method="post" action="">
732
-					  <select name="marks" id="marks" style="display:none;"><option>' . $questionScore . '</option></select></form><br/ ></div>';
731
+                echo '<div id="'.$marksname.'" style="display:none"><form name="marksform_'.$questionId.'" method="post" action="">
732
+					  <select name="marks" id="marks" style="display:none;"><option>' . $questionScore.'</option></select></form><br/ ></div>';
733 733
             }
734 734
         } else {
735 735
             if ($questionScore == -1) {
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 
786 786
     $score = array();
787 787
     if ($show_results) {
788
-        $score['result'] = get_lang('Score') . " : " . ExerciseLib::show_score(
788
+        $score['result'] = get_lang('Score')." : ".ExerciseLib::show_score(
789 789
             $my_total_score,
790 790
             $my_total_weight,
791 791
             false,
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
 
858 858
 if ($isFeedbackAllowed) {
859 859
     if (in_array($origin, array('tracking_course', 'user_course', 'correct_exercise_in_lp'))) {
860
-        $formUrl = api_get_path(WEB_CODE_PATH) . 'exercice/exercise_report.php?' . api_get_cidreq() . '&';
860
+        $formUrl = api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&';
861 861
         $formUrl .= http_build_query([
862 862
             'exerciseId' => $exercise_id,
863 863
             'filter' => 2,
@@ -869,14 +869,14 @@  discard block
 block discarded – undo
869 869
         ]);
870 870
         $formUrl .= $fromlink;
871 871
 
872
-        echo '<form name="myform" id="myform" action="' . $formUrl . '" method="post">';
873
-        echo '<input type = "hidden" name="lp_item_id"       value="' . $learnpath_id . '">';
874
-        echo '<input type = "hidden" name="lp_item_view_id"  value="' . $lp_item_view_id . '">';
875
-        echo '<input type = "hidden" name="student_id"       value="' . $student_id . '">';
876
-        echo '<input type = "hidden" name="total_score"      value="' . $totalScore . '"> ';
877
-        echo '<input type = "hidden" name="my_exe_exo_id"    value="' . $exercise_id . '"> ';
872
+        echo '<form name="myform" id="myform" action="'.$formUrl.'" method="post">';
873
+        echo '<input type = "hidden" name="lp_item_id"       value="'.$learnpath_id.'">';
874
+        echo '<input type = "hidden" name="lp_item_view_id"  value="'.$lp_item_view_id.'">';
875
+        echo '<input type = "hidden" name="student_id"       value="'.$student_id.'">';
876
+        echo '<input type = "hidden" name="total_score"      value="'.$totalScore.'"> ';
877
+        echo '<input type = "hidden" name="my_exe_exo_id"    value="'.$exercise_id.'"> ';
878 878
     } else {
879
-        $formUrl = api_get_path(WEB_CODE_PATH) . 'exercice/exercise_report.php?' . api_get_cidreq() . '&';
879
+        $formUrl = api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&';
880 880
         $formUrl .= http_build_query([
881 881
             'exerciseId' => $exercise_id,
882 882
             'filter' => 1,
@@ -884,11 +884,11 @@  discard block
 block discarded – undo
884 884
             'exeid' => $id
885 885
         ]);
886 886
 
887
-        echo ' <form name="myform" id="myform" action="' . $formUrl . '" method="post">';
887
+        echo ' <form name="myform" id="myform" action="'.$formUrl.'" method="post">';
888 888
     }
889 889
 
890 890
     if ($origin != 'learnpath' && $origin != 'student_progress') {
891
-        echo '<label><input type= "checkbox" name="send_notification"> ' . get_lang('SendEmail') . '</label>';
891
+        echo '<label><input type= "checkbox" name="send_notification"> '.get_lang('SendEmail').'</label>';
892 892
         ?>
893 893
         <br/>
894 894
         <button type="submit" class="btn btn-primary" value="<?php echo get_lang('Ok'); ?>"
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
 } else {
922 922
     if (!isset($_GET['fb_type'])) {
923 923
         $lp_mode = $_SESSION['lp_mode'];
924
-        $url = '../newscorm/lp_controller.php?' . api_get_cidreq() . '&';
924
+        $url = '../newscorm/lp_controller.php?'.api_get_cidreq().'&';
925 925
         $url .= http_build_url([
926 926
             'action' => 'view',
927 927
             'lp_id' => $learnpath_id,
@@ -929,13 +929,13 @@  discard block
 block discarded – undo
929 929
             'exeId' => $exeId,
930 930
             'fb_type' => $feedback_type
931 931
         ]);
932
-        $href = ($lp_mode == 'fullscreen') ? ' window.opener.location.href="' . $url . '" ' : ' top.location.href="' . $url . '" ';
933
-        echo '<script type="text/javascript">' . $href . '</script>';
932
+        $href = ($lp_mode == 'fullscreen') ? ' window.opener.location.href="'.$url.'" ' : ' top.location.href="'.$url.'" ';
933
+        echo '<script type="text/javascript">'.$href.'</script>';
934 934
         // Record the results in the learning path, using the SCORM interface (API)
935 935
         echo "<script>window.parent.API.void_save_asset('$totalScore', '$totalWeighting', 0, 'completed'); </script>";
936 936
         echo '</body></html>';
937 937
     } else {
938
-        Display::display_normal_message(get_lang('ExerciseFinished') . ' ' . get_lang('ToContinueUseMenu'));
938
+        Display::display_normal_message(get_lang('ExerciseFinished').' '.get_lang('ToContinueUseMenu'));
939 939
         echo '<br />';
940 940
     }
941 941
 }
Please login to merge, or discard this patch.