Completed
Push — 1.10.x ( a788c0...4b0069 )
by Angel Fernando Quiroz
44:46
created
main/inc/lib/exercise.lib.php 2 patches
Doc Comments   +8 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1279,6 +1279,7 @@  discard block
 block discarded – undo
1279 1279
 
1280 1280
     /**
1281 1281
      * Validates the time control key
1282
+     * @param integer $exercise_id
1282 1283
      */
1283 1284
     public static function exercise_time_control_is_valid(
1284 1285
         $exercise_id,
@@ -1412,7 +1413,7 @@  discard block
 block discarded – undo
1412 1413
      * @param int $in_direction
1413 1414
      * @param string $in_hotpot_path
1414 1415
      * @param bool $in_get_count
1415
-     * @param null $where_condition
1416
+     * @param string $where_condition
1416 1417
      * @return array|int
1417 1418
      */
1418 1419
     public static function get_exam_results_hotpotatoes_data(
@@ -2213,7 +2214,7 @@  discard block
 block discarded – undo
2213 2214
     /**
2214 2215
      * Converts a numeric value in a percentage example 0.66666 to 66.67 %
2215 2216
      * @param $value
2216
-     * @return float Converted number
2217
+     * @return string Converted number
2217 2218
      */
2218 2219
     public static function convert_to_percentage($value)
2219 2220
     {
@@ -2229,7 +2230,7 @@  discard block
 block discarded – undo
2229 2230
      * @param   float $score
2230 2231
      * @param   float $weight
2231 2232
      * @deprecated seem not to be used
2232
-     * @return  float   the score rounded converted to the new range
2233
+     * @return  string|null   the score rounded converted to the new range
2233 2234
      */
2234 2235
     public static function convert_score($score, $weight)
2235 2236
     {
@@ -2780,6 +2781,7 @@  discard block
 block discarded – undo
2780 2781
      * @param    int        exercise id
2781 2782
      * @param    int    $courseId
2782 2783
      * @param    int        session id
2784
+     * @param integer $user_count
2783 2785
      * @return    float    Best average score
2784 2786
      */
2785 2787
     public static function get_best_average_score_by_exercise(
@@ -3219,8 +3221,9 @@  discard block
 block discarded – undo
3219 3221
     }
3220 3222
 
3221 3223
     /**
3222
-     * @param array $answer
3224
+     * @param string|null $answer
3223 3225
      * @param string $user_answer
3226
+     * @param string|null $current_answer
3224 3227
      * @return array
3225 3228
      */
3226 3229
     public static function check_fill_in_blanks($answer, $user_answer, $current_answer)
@@ -3848,7 +3851,7 @@  discard block
 block discarded – undo
3848 3851
 
3849 3852
     /**
3850 3853
      * @param int $countLetter
3851
-     * @return mixed
3854
+     * @return string
3852 3855
      */
3853 3856
     public static function detectInputAppropriateClass($countLetter)
3854 3857
     {
Please login to merge, or discard this patch.
Spacing   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
                 if ($show_title) {
66 66
                     TestCategory::displayCategoryAndTitle($objQuestionTmp->id);
67 67
                     echo Display::div(
68
-                        $current_item . '. ' . $objQuestionTmp->selectTitle(),
68
+                        $current_item.'. '.$objQuestionTmp->selectTitle(),
69 69
                         array('class' => 'question_title')
70 70
                     );
71 71
                 }
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
                 $config = array(
169 169
                     'ToolbarSet' => 'TestFreeAnswer'
170 170
                 );
171
-                $form->addHtmlEditor("choice[" . $questionId . "]", null, false, false, $config);
172
-                $form->setDefaults(array("choice[" . $questionId . "]" => $fck_content));
171
+                $form->addHtmlEditor("choice[".$questionId."]", null, false, false, $config);
172
+                $form->setDefaults(array("choice[".$questionId."]" => $fck_content));
173 173
                 $s .= $form->returnForm();
174 174
             } elseif ($answerType == ORAL_EXPRESSION) {
175 175
                 // Add nanog
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
                 $config = array(
199 199
                     'ToolbarSet' => 'TestFreeAnswer'
200 200
                 );
201
-                $form->addHtmlEditor("choice[" . $questionId . "]", null, false, false, $config);
201
+                $form->addHtmlEditor("choice[".$questionId."]", null, false, false, $config);
202 202
                 //$form->setDefaults(array("choice[" . $questionId . "]" => $fck_content));
203 203
                 $s .= $form->returnForm();
204 204
             }
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 
280 280
                 // Unique answer
281 281
                 if (in_array($answerType, [UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION, UNIQUE_ANSWER_IMAGE])) {
282
-                    $input_id = 'choice-' . $questionId . '-' . $answerId;
282
+                    $input_id = 'choice-'.$questionId.'-'.$answerId;
283 283
                     if (isset($user_choice[0]['answer']) && $user_choice[0]['answer'] == $numAnswer) {
284 284
                         $attributes = array(
285 285
                             'id' => $input_id,
@@ -304,14 +304,14 @@  discard block
 block discarded – undo
304 304
                     if ($answerType == UNIQUE_ANSWER_IMAGE) {
305 305
                         if ($show_comment) {
306 306
                             if (empty($comment)) {
307
-                                $s .= '<div id="answer' . $questionId . $numAnswer . '" '
307
+                                $s .= '<div id="answer'.$questionId.$numAnswer.'" '
308 308
                                     . 'class="exercise-unique-answer-image" style="text-align: center">';
309 309
                             } else {
310
-                                $s .= '<div id="answer' . $questionId . $numAnswer . '" '
310
+                                $s .= '<div id="answer'.$questionId.$numAnswer.'" '
311 311
                                     . 'class="exercise-unique-answer-image col-xs-6 col-sm-12" style="text-align: center">';
312 312
                             }
313 313
                         } else {
314
-                            $s .= '<div id="answer' . $questionId . $numAnswer . '" '
314
+                            $s .= '<div id="answer'.$questionId.$numAnswer.'" '
315 315
                                 . 'class="exercise-unique-answer-image col-xs-6 col-md-3" style="text-align: center">';
316 316
                         }
317 317
                     }
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
                     $answer = Security::remove_XSS($answer, STUDENT);
320 320
                     $s .= Display::input(
321 321
                         'hidden',
322
-                        'choice2[' . $questionId . ']',
322
+                        'choice2['.$questionId.']',
323 323
                         '0'
324 324
                     );
325 325
 
@@ -327,13 +327,13 @@  discard block
 block discarded – undo
327 327
 
328 328
                     if ($answerType == UNIQUE_ANSWER_IMAGE) {
329 329
                         $attributes['style'] = 'display: none;';
330
-                        $answer = '<div class="thumbnail">' . $answer . '</div>';
330
+                        $answer = '<div class="thumbnail">'.$answer.'</div>';
331 331
                     }
332 332
 
333 333
                     $answer_input .= '<label class="radio">';
334 334
                     $answer_input .= Display::input(
335 335
                         'radio',
336
-                        'choice[' . $questionId . ']',
336
+                        'choice['.$questionId.']',
337 337
                         $numAnswer,
338 338
                         $attributes
339 339
                     );
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
                     $answerType == MULTIPLE_ANSWER_TRUE_FALSE ||
361 361
                     $answerType == GLOBAL_MULTIPLE_ANSWER
362 362
                 ) {
363
-                    $input_id = 'choice-' . $questionId . '-' . $answerId;
363
+                    $input_id = 'choice-'.$questionId.'-'.$answerId;
364 364
                     $answer = Security::remove_XSS($answer, STUDENT);
365 365
 
366 366
                     if (in_array($numAnswer, $user_choice_array)) {
@@ -381,12 +381,12 @@  discard block
 block discarded – undo
381 381
                     }
382 382
 
383 383
                     if ($answerType == MULTIPLE_ANSWER || $answerType == GLOBAL_MULTIPLE_ANSWER) {
384
-                        $s .= '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />';
384
+                        $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />';
385 385
 
386 386
                         $answer_input = '<label class="checkbox">';
387 387
                         $answer_input .= Display::input(
388 388
                             'checkbox',
389
-                            'choice[' . $questionId . '][' . $numAnswer . ']',
389
+                            'choice['.$questionId.']['.$numAnswer.']',
390 390
                             $numAnswer,
391 391
                             $attributes
392 392
                         );
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
                                     'td',
440 440
                                     Display::input(
441 441
                                         'radio',
442
-                                        'choice[' . $questionId . '][' . $numAnswer . ']',
442
+                                        'choice['.$questionId.']['.$numAnswer.']',
443 443
                                         $id,
444 444
                                         $attributes
445 445
                                     ),
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
                     }
458 458
                 } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION) {
459 459
                     // multiple answers
460
-                    $input_id = 'choice-' . $questionId . '-' . $answerId;
460
+                    $input_id = 'choice-'.$questionId.'-'.$answerId;
461 461
 
462 462
                     if (in_array($numAnswer, $user_choice_array)) {
463 463
                         $attributes = array(
@@ -477,11 +477,11 @@  discard block
 block discarded – undo
477 477
                     }
478 478
 
479 479
                     $answer = Security::remove_XSS($answer, STUDENT);
480
-                    $answer_input = '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />';
480
+                    $answer_input = '<input type="hidden" name="choice2['.$questionId.']" value="0" />';
481 481
                     $answer_input .= '<label class="checkbox">';
482 482
                     $answer_input .= Display::input(
483 483
                         'checkbox',
484
-                        'choice[' . $questionId . '][' . $numAnswer . ']',
484
+                        'choice['.$questionId.']['.$numAnswer.']',
485 485
                         1,
486 486
                         $attributes
487 487
                     );
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
                     }
503 503
 
504 504
                 } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) {
505
-                    $s .= '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />';
505
+                    $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />';
506 506
 
507 507
                     $my_choice = array();
508 508
                     if (!empty($user_choice_array)) {
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
                             'td',
538 538
                             Display::input(
539 539
                                 'radio',
540
-                                'choice[' . $questionId . '][' . $numAnswer . ']',
540
+                                'choice['.$questionId.']['.$numAnswer.']',
541 541
                                 $key,
542 542
                                 $attributes
543 543
                             )
@@ -633,8 +633,8 @@  discard block
 block discarded – undo
633 633
                     $trackAttempts = Database::get_main_table(
634 634
                         TABLE_STATISTIC_TRACK_E_ATTEMPT
635 635
                     );
636
-                    $sql = 'SELECT answer FROM ' . $trackAttempts . '
637
-                            WHERE exe_id=' . $exerciseId . ' AND question_id=' . $questionId;
636
+                    $sql = 'SELECT answer FROM '.$trackAttempts.'
637
+                            WHERE exe_id=' . $exerciseId.' AND question_id='.$questionId;
638 638
                     $rsLastAttempt = Database::query($sql);
639 639
                     $rowLastAttempt = Database::fetch_array($rsLastAttempt);
640 640
                     $answer = $rowLastAttempt['answer'];
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
                                 '',
705 705
                                 $answerCorrected
706 706
                             );
707
-                            $answerCorrected = '[' . $answerCorrected . ']';
707
+                            $answerCorrected = '['.$answerCorrected.']';
708 708
                             $studentAnswerList[] = $answerCorrected;
709 709
                         }
710 710
                     }
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
                     */
726 726
                     $tabComments = api_preg_split(
727 727
                         '/\[[^]]+\]/',
728
-                        ' ' . $answer . ' '
728
+                        ' '.$answer.' '
729 729
                     );
730 730
                     if (!empty($correctAnswerList) && !empty($studentAnswerList)) {
731 731
                         $answer = "";
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
                                 $size
743 743
                             );
744 744
 
745
-                            $answer .= $tabComments[$i] .
745
+                            $answer .= $tabComments[$i].
746 746
                                 Display::input(
747 747
                                     'text',
748 748
                                     "choice[$questionId][]",
@@ -788,12 +788,12 @@  discard block
 block discarded – undo
788 788
                         $s .= '<tr><td width="45%" valign="top">';
789 789
                         $parsed_answer = $answer;
790 790
                         //left part questions
791
-                        $s .= '<p class="indent">' . $lines_count . '.&nbsp;' . $parsed_answer . '</p></td>';
791
+                        $s .= '<p class="indent">'.$lines_count.'.&nbsp;'.$parsed_answer.'</p></td>';
792 792
                         //middle part (matches selects)
793 793
 
794 794
                         $s .= '<td width="10%" valign="top" align="center" >
795 795
                                 <div class="select-matching">
796
-                                <select name="choice[' . $questionId . '][' . $numAnswer . ']">';
796
+                                <select name="choice[' . $questionId.']['.$numAnswer.']">';
797 797
 
798 798
                         // fills the list-box
799 799
                         foreach ($select_items as $key => $val) {
@@ -809,14 +809,14 @@  discard block
 block discarded – undo
809 809
                             if (isset($user_choice_array_position[$numAnswer]) && $val['id'] == $user_choice_array_position[$numAnswer]) {
810 810
                                 $selected = 'selected="selected"';
811 811
                             }
812
-                            $s .= '<option value="' . $val['id'] . '" ' . $selected . '>' . $val['letter'] . '</option>';
812
+                            $s .= '<option value="'.$val['id'].'" '.$selected.'>'.$val['letter'].'</option>';
813 813
 
814 814
                         }  // end foreach()
815 815
 
816 816
                         $s .= '</select></div></td><td width="5%" class="separate">&nbsp;</td>';
817 817
                         $s .= '<td width="40%" valign="top" >';
818 818
                         if (isset($select_items[$lines_count])) {
819
-                            $s .= '<div class="text-right"><p class="indent">' . $select_items[$lines_count]['letter'].'.&nbsp; '. $select_items[$lines_count]['answer'].'</p></div>';
819
+                            $s .= '<div class="text-right"><p class="indent">'.$select_items[$lines_count]['letter'].'.&nbsp; '.$select_items[$lines_count]['answer'].'</p></div>';
820 820
                         } else {
821 821
                             $s .= '&nbsp;';
822 822
                         }
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
                                 $s .= '<tr>
832 832
                                       <td colspan="2"></td>
833 833
                                       <td valign="top">';
834
-                                $s .= '<b>' . $select_items[$lines_count]['letter'] . '.</b> ' . $select_items[$lines_count]['answer'];
834
+                                $s .= '<b>'.$select_items[$lines_count]['letter'].'.</b> '.$select_items[$lines_count]['answer'];
835 835
                                 $s .= "</td>
836 836
                                 </tr>";
837 837
                                 $lines_count++;
@@ -847,9 +847,9 @@  discard block
 block discarded – undo
847 847
                         $data = $objAnswerTmp->getAnswerByAutoId($data['correct']);
848 848
                         $lines_count = $data['answer'];*/
849 849
 
850
-                        $windowId = $questionId . '_' . $lines_count;
850
+                        $windowId = $questionId.'_'.$lines_count;
851 851
 
852
-                        $s .= '<li class="touch-items" id="' . $windowId . '">';
852
+                        $s .= '<li class="touch-items" id="'.$windowId.'">';
853 853
                         $s .= Display::div(
854 854
                             $parsed_answer,
855 855
                             [
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
                                 Display::tag(
908 908
                                     'b',
909 909
                                     $select_items[$lines_count]['letter']
910
-                                ) . $select_items[$lines_count]['answer'],
910
+                                ).$select_items[$lines_count]['answer'],
911 911
                                 [
912 912
                                     'id' => "window_{$windowId}_answer",
913 913
                                     'style' => 'display: none;'
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
 
1052 1052
             if ($show_comment) {
1053 1053
                 $s .= '</table>';
1054
-            } elseif(
1054
+            } elseif (
1055 1055
                 in_array(
1056 1056
                     $answerType,
1057 1057
                     [
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
 
1077 1077
                 for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
1078 1078
                     $answerCorrect = $objAnswerTmp->isCorrect($answerId);
1079
-                    $windowId = $questionId . '_' . $counterAnswer;
1079
+                    $windowId = $questionId.'_'.$counterAnswer;
1080 1080
 
1081 1081
                     if ($answerCorrect) {
1082 1082
                         $s .= Display::div(
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
                 $course = api_get_course_info();
1122 1122
                 $doc_id = DocumentManager::get_document_id(
1123 1123
                     $course,
1124
-                    '/images/' . $pictureName
1124
+                    '/images/'.$pictureName
1125 1125
                 );
1126 1126
                 if (is_numeric($doc_id)) {
1127 1127
                     $images_folder_visibility = api_get_item_visibility(
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
                 echo "
1147 1147
                     <script>
1148 1148
                         $(document).on('ready', function () {
1149
-                            new " . ($answerType == HOT_SPOT ?  "HotspotQuestion" : "DelineationQuestion" ) . "({
1149
+                            new " . ($answerType == HOT_SPOT ? "HotspotQuestion" : "DelineationQuestion")."({
1150 1150
                                 questionId: $questionId,
1151 1151
                                 exerciseId: $exerciseId,
1152 1152
                                 selector: '#hotspot-preview-$questionId',
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
             if ($answerType != HOT_SPOT_DELINEATION) {
1181 1181
                 $answerList = '
1182 1182
                     <div class="well well-sm">
1183
-                        <h5 class="page-header">' . get_lang('HotspotZones') . '</h5>
1183
+                        <h5 class="page-header">' . get_lang('HotspotZones').'</h5>
1184 1184
                         <ol>
1185 1185
                 ';
1186 1186
 
@@ -1205,7 +1205,7 @@  discard block
 block discarded – undo
1205 1205
             if (!$only_questions) {
1206 1206
                 if ($show_title) {
1207 1207
                     TestCategory::displayCategoryAndTitle($objQuestionTmp->id);
1208
-                    echo '<div class="question_title">' . $current_item . '. ' . $questionName . '</div>';
1208
+                    echo '<div class="question_title">'.$current_item.'. '.$questionName.'</div>';
1209 1209
                 }
1210 1210
                 //@todo I need to the get the feedback type
1211 1211
                 echo <<<HOTSPOT
@@ -1223,7 +1223,7 @@  discard block
 block discarded – undo
1223 1223
                                 <div class=\"hotspot-image\"></div>
1224 1224
                                 <script>
1225 1225
                                     $(document).on('ready', function () {
1226
-                                        new " . ($answerType == HOT_SPOT_DELINEATION ? 'DelineationQuestion' : 'HotspotQuestion') . "({
1226
+                                        new " . ($answerType == HOT_SPOT_DELINEATION ? 'DelineationQuestion' : 'HotspotQuestion')."({
1227 1227
                                             questionId: $questionId,
1228 1228
                                             exerciseId: $exe_id,
1229 1229
                                             selector: '#question_div_' + $questionId + ' .hotspot-image',
@@ -1342,11 +1342,11 @@  discard block
 block discarded – undo
1342 1342
         $lp_id = intval($lp_id);
1343 1343
         $lp_item_id = intval($lp_item_id);
1344 1344
         return
1345
-            api_get_course_int_id() . '_' .
1346
-            api_get_session_id() . '_' .
1347
-            $exercise_id . '_' .
1348
-            api_get_user_id() . '_' .
1349
-            $lp_id . '_' .
1345
+            api_get_course_int_id().'_'.
1346
+            api_get_session_id().'_'.
1347
+            $exercise_id.'_'.
1348
+            api_get_user_id().'_'.
1349
+            $lp_id.'_'.
1350 1350
             $lp_item_id;
1351 1351
     }
1352 1352
 
@@ -1458,14 +1458,14 @@  discard block
 block discarded – undo
1458 1458
         $res = Database::query($sql);
1459 1459
         $result = array();
1460 1460
         $apiIsAllowedToEdit = api_is_allowed_to_edit();
1461
-        $urlBase = api_get_path(WEB_CODE_PATH) .
1462
-            'exercice/hotpotatoes_exercise_report.php?action=delete&' .
1463
-            api_get_cidreq() . '&id=';
1461
+        $urlBase = api_get_path(WEB_CODE_PATH).
1462
+            'exercice/hotpotatoes_exercise_report.php?action=delete&'.
1463
+            api_get_cidreq().'&id=';
1464 1464
         while ($data = Database::fetch_array($res)) {
1465 1465
             $actions = null;
1466 1466
 
1467 1467
             if ($apiIsAllowedToEdit) {
1468
-                $url = $urlBase . $data['id'] . '&path=' . $data['exe_name'];
1468
+                $url = $urlBase.$data['id'].'&path='.$data['exe_name'];
1469 1469
                 $actions = Display::url(
1470 1470
                     Display::return_icon('delete.png', get_lang('Delete')),
1471 1471
                     $url
@@ -1481,7 +1481,7 @@  discard block
 block discarded – undo
1481 1481
                     GroupManager::get_user_group_name($data['user_id'])
1482 1482
                 ),
1483 1483
                 'exe_date' => $data['exe_date'],
1484
-                'score' => $data['exe_result'] . ' / ' . $data['exe_weighting'],
1484
+                'score' => $data['exe_result'].' / '.$data['exe_weighting'],
1485 1485
                 'actions' => $actions,
1486 1486
             );
1487 1487
         }
@@ -1564,18 +1564,18 @@  discard block
 block discarded – undo
1564 1564
         $TBL_TRACK_HOTPOTATOES = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
1565 1565
         $TBL_TRACK_ATTEMPT_RECORDING = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
1566 1566
 
1567
-        $session_id_and = ' AND te.session_id = ' . $sessionId . ' ';
1567
+        $session_id_and = ' AND te.session_id = '.$sessionId.' ';
1568 1568
         $exercise_id = intval($exercise_id);
1569 1569
 
1570 1570
         $exercise_where = '';
1571 1571
         if (!empty($exercise_id)) {
1572
-            $exercise_where .= ' AND te.exe_exo_id = ' . $exercise_id . '  ';
1572
+            $exercise_where .= ' AND te.exe_exo_id = '.$exercise_id.'  ';
1573 1573
         }
1574 1574
 
1575 1575
         $hotpotatoe_where = '';
1576 1576
         if (!empty($_GET['path'])) {
1577 1577
             $hotpotatoe_path = Database::escape_string($_GET['path']);
1578
-            $hotpotatoe_where .= ' AND exe_name = "' . $hotpotatoe_path . '"  ';
1578
+            $hotpotatoe_where .= ' AND exe_name = "'.$hotpotatoe_path.'"  ';
1579 1579
         }
1580 1580
 
1581 1581
         // sql for chamilo-type tests for teacher / tutor view
@@ -1587,7 +1587,7 @@  discard block
 block discarded – undo
1587 1587
             WHERE
1588 1588
                 c_id = $course_id AND
1589 1589
                 exe_exo_id = $exercise_id AND
1590
-                ttte.session_id = " . $sessionId . "
1590
+                ttte.session_id = ".$sessionId."
1591 1591
         )";
1592 1592
 
1593 1593
         if ($is_allowedToEdit) {
@@ -1610,9 +1610,9 @@  discard block
 block discarded – undo
1610 1610
                         g.id as group_id
1611 1611
                     FROM $TBL_USER u
1612 1612
                     INNER JOIN $TBL_GROUP_REL_USER gru
1613
-                    ON (gru.user_id = u.user_id AND gru.c_id=" . $course_id . ")
1613
+                    ON (gru.user_id = u.user_id AND gru.c_id=".$course_id.")
1614 1614
                     INNER JOIN $TBL_GROUP g
1615
-                    ON (gru.group_id = g.id AND g.c_id=" . $course_id . ")
1615
+                    ON (gru.group_id = g.id AND g.c_id=".$course_id.")
1616 1616
                 )";
1617 1617
             }
1618 1618
 
@@ -1674,9 +1674,9 @@  discard block
 block discarded – undo
1674 1674
                     g.id as group_id
1675 1675
                 FROM $TBL_USER u
1676 1676
                 LEFT OUTER JOIN $TBL_GROUP_REL_USER gru
1677
-                ON ( gru.user_id = u.user_id AND gru.c_id=" . $course_id . " )
1677
+                ON ( gru.user_id = u.user_id AND gru.c_id=".$course_id." )
1678 1678
                 LEFT OUTER JOIN $TBL_GROUP g
1679
-                ON (gru.group_id = g.id AND g.c_id = " . $course_id . ")
1679
+                ON (gru.group_id = g.id AND g.c_id = ".$course_id.")
1680 1680
             )";
1681 1681
             }
1682 1682
 
@@ -1689,12 +1689,12 @@  discard block
 block discarded – undo
1689 1689
             (
1690 1690
                 SELECT u.user_id, firstname, lastname, email, username, ' ' as group_name, '' as group_id, official_code
1691 1691
                 FROM $TBL_USER u
1692
-                WHERE u.status NOT IN(" . api_get_users_status_ignored_in_reports('string') . ")
1692
+                WHERE u.status NOT IN(".api_get_users_status_ignored_in_reports('string').")
1693 1693
             )";
1694 1694
             }
1695 1695
 
1696 1696
             $sqlFromOption = " , $TBL_GROUP_REL_USER AS gru ";
1697
-            $sqlWhereOption = "  AND gru.c_id = " . $course_id ." AND gru.user_id = user.user_id ";
1697
+            $sqlWhereOption = "  AND gru.c_id = ".$course_id." AND gru.user_id = user.user_id ";
1698 1698
             $first_and_last_name = api_is_western_name_order() ? "firstname, lastname" : "lastname, firstname";
1699 1699
 
1700 1700
             if ($get_count) {
@@ -1731,8 +1731,8 @@  discard block
 block discarded – undo
1731 1731
                 ON (user.user_id = exe_user_id)
1732 1732
                 WHERE
1733 1733
                     te.status != 'incomplete' AND
1734
-                    te.c_id = " . $course_id . " $session_id_and AND
1735
-                    ce.active <>-1 AND ce.c_id = " . $course_id . "
1734
+                    te.c_id = ".$course_id." $session_id_and AND
1735
+                    ce.active <>-1 AND ce.c_id = ".$course_id."
1736 1736
                     $exercise_where
1737 1737
                     $extra_where_conditions
1738 1738
                 ";
@@ -1759,12 +1759,12 @@  discard block
 block discarded – undo
1759 1759
                     $sqlFromOption
1760 1760
                 WHERE
1761 1761
                     user.user_id=tth.exe_user_id
1762
-                    AND tth.c_id = " . $course_id . "
1762
+                    AND tth.c_id = ".$course_id."
1763 1763
                     $hotpotatoe_where
1764 1764
                     $sqlWhereOption
1765
-                    AND user.status NOT IN(" . api_get_users_status_ignored_in_reports(
1765
+                    AND user.status NOT IN(".api_get_users_status_ignored_in_reports(
1766 1766
                     'string'
1767
-                ) . ")
1767
+                ).")
1768 1768
                 ORDER BY
1769 1769
                     tth.c_id ASC,
1770 1770
                     tth.exe_date DESC";
@@ -1837,12 +1837,12 @@  discard block
 block discarded – undo
1837 1837
 
1838 1838
                     if ($from_gradebook && ($is_allowedToEdit)) {
1839 1839
                         if (in_array(
1840
-                            $results[$i]['username'] . $results[$i]['firstname'] . $results[$i]['lastname'],
1840
+                            $results[$i]['username'].$results[$i]['firstname'].$results[$i]['lastname'],
1841 1841
                             $users_array_id
1842 1842
                         )) {
1843 1843
                             continue;
1844 1844
                         }
1845
-                        $users_array_id[] = $results[$i]['username'] . $results[$i]['firstname'] . $results[$i]['lastname'];
1845
+                        $users_array_id[] = $results[$i]['username'].$results[$i]['firstname'].$results[$i]['lastname'];
1846 1846
                     }
1847 1847
 
1848 1848
                     $lp_obj = isset($results[$i]['orig_lp_id']) && isset($lp_list[$results[$i]['orig_lp_id']]) ? $lp_list[$results[$i]['orig_lp_id']] : null;
@@ -1851,8 +1851,8 @@  discard block
 block discarded – undo
1851 1851
                     if ($lp_obj) {
1852 1852
                         $url = api_get_path(
1853 1853
                                 WEB_CODE_PATH
1854
-                            ) . 'newscorm/lp_controller.php?' . api_get_cidreq(
1855
-                            ) . '&action=view&lp_id=' . $results[$i]['orig_lp_id'];
1854
+                            ).'newscorm/lp_controller.php?'.api_get_cidreq(
1855
+                            ).'&action=view&lp_id='.$results[$i]['orig_lp_id'];
1856 1856
                         $lp_name = Display::url(
1857 1857
                             $lp_obj['lp_name'],
1858 1858
                             $url,
@@ -1870,7 +1870,7 @@  discard block
 block discarded – undo
1870 1870
                         );
1871 1871
 
1872 1872
                         foreach ($group_list as $id) {
1873
-                            $group_name_list .= $clean_group_list[$id] . '<br/>';
1873
+                            $group_name_list .= $clean_group_list[$id].'<br/>';
1874 1874
                         }
1875 1875
                         $results[$i]['group_name'] = $group_name_list;
1876 1876
                     }
@@ -1926,8 +1926,8 @@  discard block
 block discarded – undo
1926 1926
                                 }
1927 1927
                             }
1928 1928
                             if ($revised) {
1929
-                                $actions .= "<a href='exercise_show.php?" . api_get_cidreq(
1930
-                                    ) . "&action=edit&id=$id'>" .
1929
+                                $actions .= "<a href='exercise_show.php?".api_get_cidreq(
1930
+                                    )."&action=edit&id=$id'>".
1931 1931
                                     Display:: return_icon(
1932 1932
                                         'edit.png',
1933 1933
                                         get_lang('Edit'),
@@ -1936,8 +1936,8 @@  discard block
 block discarded – undo
1936 1936
                                     );
1937 1937
                                 $actions .= '&nbsp;';
1938 1938
                             } else {
1939
-                                $actions .= "<a href='exercise_show.php?" . api_get_cidreq(
1940
-                                    ) . "&action=qualify&id=$id'>" .
1939
+                                $actions .= "<a href='exercise_show.php?".api_get_cidreq(
1940
+                                    )."&action=qualify&id=$id'>".
1941 1941
                                     Display:: return_icon(
1942 1942
                                         'quiz.gif',
1943 1943
                                         get_lang('Qualify')
@@ -1947,12 +1947,12 @@  discard block
 block discarded – undo
1947 1947
                             $actions .= "</a>";
1948 1948
 
1949 1949
                             if ($filter == 2) {
1950
-                                $actions .= ' <a href="exercise_history.php?' . api_get_cidreq(
1951
-                                    ) . '&exe_id=' . $id . '">' .
1950
+                                $actions .= ' <a href="exercise_history.php?'.api_get_cidreq(
1951
+                                    ).'&exe_id='.$id.'">'.
1952 1952
                                     Display:: return_icon(
1953 1953
                                         'history.gif',
1954 1954
                                         get_lang('ViewHistoryChange')
1955
-                                    ) . '</a>';
1955
+                                    ).'</a>';
1956 1956
                             }
1957 1957
 
1958 1958
                             //Admin can always delete the attempt
@@ -1964,32 +1964,32 @@  discard block
 block discarded – undo
1964 1964
                                     date('Y-m-d h:i:s'),
1965 1965
                                     false
1966 1966
                                 );
1967
-                                $actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip=' . $ip . '" target="_blank">
1967
+                                $actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip='.$ip.'" target="_blank">
1968 1968
                                 '.Display::return_icon('info.png', $ip).'
1969 1969
                                 </a>';
1970 1970
 
1971
-                                $delete_link = '<a href="exercise_report.php?' . api_get_cidreq() . '&filter_by_user=' . intval($_GET['filter_by_user']) . '&filter=' . $filter . '&exerciseId=' . $exercise_id . '&delete=delete&did=' . $id . '"
1971
+                                $delete_link = '<a href="exercise_report.php?'.api_get_cidreq().'&filter_by_user='.intval($_GET['filter_by_user']).'&filter='.$filter.'&exerciseId='.$exercise_id.'&delete=delete&did='.$id.'"
1972 1972
                                 onclick="javascript:if(!confirm(\'' . sprintf(
1973 1973
                                         get_lang('DeleteAttempt'),
1974 1974
                                         $results[$i]['username'],
1975 1975
                                         $dt
1976
-                                    ) . '\')) return false;">' . Display:: return_icon(
1976
+                                    ).'\')) return false;">'.Display:: return_icon(
1977 1977
                                         'delete.png',
1978 1978
                                         get_lang('Delete')
1979
-                                    ) . '</a>';
1979
+                                    ).'</a>';
1980 1980
                                 $delete_link = utf8_encode($delete_link);
1981 1981
 
1982 1982
                                 if (api_is_drh() && !api_is_platform_admin()) {
1983 1983
                                     $delete_link = null;
1984 1984
                                 }
1985
-                                $actions .= $delete_link . '&nbsp;';
1985
+                                $actions .= $delete_link.'&nbsp;';
1986 1986
                             }
1987 1987
 
1988 1988
                         } else {
1989 1989
                             $attempt_url = api_get_path(
1990 1990
                                     WEB_CODE_PATH
1991
-                                ) . 'exercice/result.php?' . api_get_cidreq(
1992
-                                ) . '&id=' . $results[$i]['exe_id'] . '&id_session=' . $sessionId;
1991
+                                ).'exercice/result.php?'.api_get_cidreq(
1992
+                                ).'&id='.$results[$i]['exe_id'].'&id_session='.$sessionId;
1993 1993
                             $attempt_link = Display::url(
1994 1994
                                 get_lang('Show'),
1995 1995
                                 $attempt_url,
@@ -2046,7 +2046,7 @@  discard block
 block discarded – undo
2046 2046
                     $hp_result = round(
2047 2047
                             ($hpresults[$i][4] / ($hpresults[$i][5] != 0 ? $hpresults[$i][5] : 1)) * 100,
2048 2048
                             2
2049
-                        ) . '% (' . $hpresults[$i][4] . ' / ' . $hpresults[$i][5] . ')';
2049
+                        ).'% ('.$hpresults[$i][4].' / '.$hpresults[$i][5].')';
2050 2050
                     if ($is_allowedToEdit) {
2051 2051
                         $list_info[] = array(
2052 2052
                             $hpresults[$i][0],
@@ -2119,13 +2119,13 @@  discard block
 block discarded – undo
2119 2119
 
2120 2120
         $html = null;
2121 2121
         if ($show_percentage) {
2122
-            $parent = '(' . $score . ' / ' . $weight . ')';
2123
-            $html = $percentage . "%  $parent";
2122
+            $parent = '('.$score.' / '.$weight.')';
2123
+            $html = $percentage."%  $parent";
2124 2124
             if ($show_only_percentage) {
2125
-                $html = $percentage . "% ";
2125
+                $html = $percentage."% ";
2126 2126
             }
2127 2127
         } else {
2128
-            $html = $score . ' / ' . $weight;
2128
+            $html = $score.' / '.$weight;
2129 2129
         }
2130 2130
         $html = Display::span($html, array('class' => 'score_exercise'));
2131 2131
 
@@ -2219,7 +2219,7 @@  discard block
 block discarded – undo
2219 2219
     {
2220 2220
         $return = '-';
2221 2221
         if ($value != '') {
2222
-            $return = float_format($value * 100, 1) . ' %';
2222
+            $return = float_format($value * 100, 1).' %';
2223 2223
         }
2224 2224
         return $return;
2225 2225
     }
@@ -2297,7 +2297,7 @@  discard block
 block discarded – undo
2297 2297
         }
2298 2298
 
2299 2299
         $needle_where = !empty($search) ? " AND title LIKE '?' " : '';
2300
-        $needle = !empty($search) ? "%" . $search . "%" : '';
2300
+        $needle = !empty($search) ? "%".$search."%" : '';
2301 2301
 
2302 2302
         // Show courses by active status
2303 2303
         $active_sql = '';
@@ -2312,7 +2312,7 @@  discard block
 block discarded – undo
2312 2312
         if ($search_all_sessions == true) {
2313 2313
             $conditions = array(
2314 2314
                 'where' => array(
2315
-                    $active_sql . ' c_id = ? ' . $needle_where . $time_conditions => array(
2315
+                    $active_sql.' c_id = ? '.$needle_where.$time_conditions => array(
2316 2316
                         $course_id,
2317 2317
                         $needle
2318 2318
                     )
@@ -2323,7 +2323,7 @@  discard block
 block discarded – undo
2323 2323
             if ($session_id == 0) {
2324 2324
                 $conditions = array(
2325 2325
                     'where' => array(
2326
-                        $active_sql . ' session_id = ? AND c_id = ? ' . $needle_where . $time_conditions => array(
2326
+                        $active_sql.' session_id = ? AND c_id = ? '.$needle_where.$time_conditions => array(
2327 2327
                             $session_id,
2328 2328
                             $course_id,
2329 2329
                             $needle
@@ -2334,7 +2334,7 @@  discard block
 block discarded – undo
2334 2334
             } else {
2335 2335
                 $conditions = array(
2336 2336
                     'where' => array(
2337
-                        $active_sql . ' (session_id = 0 OR session_id = ? ) AND c_id = ? ' . $needle_where . $time_conditions => array(
2337
+                        $active_sql.' (session_id = 0 OR session_id = ? ) AND c_id = ? '.$needle_where.$time_conditions => array(
2338 2338
                             $session_id,
2339 2339
                             $course_id,
2340 2340
                             $needle
@@ -2513,7 +2513,7 @@  discard block
 block discarded – undo
2513 2513
 
2514 2514
             if ($return_string) {
2515 2515
                 if (!empty($position) && !empty($my_ranking)) {
2516
-                    $return_value = $position . '/' . count($my_ranking);
2516
+                    $return_value = $position.'/'.count($my_ranking);
2517 2517
                 } else {
2518 2518
                     $return_value = '-';
2519 2519
                 }
@@ -2593,7 +2593,7 @@  discard block
 block discarded – undo
2593 2593
 
2594 2594
             if ($return_string) {
2595 2595
                 if (!empty($position) && !empty($my_ranking)) {
2596
-                    return $position . '/' . count($my_ranking);
2596
+                    return $position.'/'.count($my_ranking);
2597 2597
                 }
2598 2598
             }
2599 2599
             return $return_value;
@@ -2993,7 +2993,7 @@  discard block
 block discarded – undo
2993 2993
             $courseCondition = "
2994 2994
             INNER JOIN $courseUser cu
2995 2995
             ON cu.c_id = c.id AND cu.user_id  = exe_user_id";
2996
-            $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT;
2996
+            $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT;
2997 2997
         } else {
2998 2998
             $courseCondition = "
2999 2999
             INNER JOIN $courseUserSession cu
@@ -3068,7 +3068,7 @@  discard block
 block discarded – undo
3068 3068
             $courseCondition = "
3069 3069
             INNER JOIN $courseUser cu
3070 3070
             ON cu.c_id = c.id AND cu.user_id  = exe_user_id";
3071
-            $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT;
3071
+            $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT;
3072 3072
         } else {
3073 3073
             $courseCondition = "
3074 3074
             INNER JOIN $courseUserSession cu
@@ -3160,7 +3160,7 @@  discard block
 block discarded – undo
3160 3160
             $courseCondition = "
3161 3161
             INNER JOIN $courseUser cu
3162 3162
             ON cu.c_id = c.id AND cu.user_id  = exe_user_id";
3163
-            $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT;
3163
+            $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT;
3164 3164
         } else {
3165 3165
             $courseCondition = "
3166 3166
             INNER JOIN $courseUserSession cu
@@ -3342,7 +3342,7 @@  discard block
 block discarded – undo
3342 3342
                 }
3343 3343
             }
3344 3344
             // adds the correct word, followed by ] to close the blank
3345
-            $answer .= ' / <font color="green"><b>' . $real_correct_tags[$i] . '</b></font>]';
3345
+            $answer .= ' / <font color="green"><b>'.$real_correct_tags[$i].'</b></font>]';
3346 3346
             if (isset ($real_text[$i + 1])) {
3347 3347
                 $answer .= $real_text[$i + 1];
3348 3348
             }
@@ -3401,13 +3401,13 @@  discard block
 block discarded – undo
3401 3401
         // check the default value of option
3402 3402
         $tabSelected = array($in_default => " selected='selected' ");
3403 3403
         $res = "";
3404
-        $res .= "<select name='$in_name' id='$in_name' onchange='" . $in_onchange . "' >";
3405
-        $res .= "<option value='-1'" . $tabSelected["-1"] . ">-- " . get_lang(
3404
+        $res .= "<select name='$in_name' id='$in_name' onchange='".$in_onchange."' >";
3405
+        $res .= "<option value='-1'".$tabSelected["-1"].">-- ".get_lang(
3406 3406
                 'AllGroups'
3407
-            ) . " --</option>";
3408
-        $res .= "<option value='0'" . $tabSelected["0"] . ">- " . get_lang(
3407
+            )." --</option>";
3408
+        $res .= "<option value='0'".$tabSelected["0"].">- ".get_lang(
3409 3409
                 'NotInAGroup'
3410
-            ) . " -</option>";
3410
+            )." -</option>";
3411 3411
         $tabGroups = GroupManager::get_group_list();
3412 3412
         $currentCatId = 0;
3413 3413
         for ($i = 0; $i < count($tabGroups); $i++) {
@@ -3415,10 +3415,10 @@  discard block
 block discarded – undo
3415 3415
                 $tabGroups[$i]["id"]
3416 3416
             );
3417 3417
             if ($tabCategory["id"] != $currentCatId) {
3418
-                $res .= "<option value='-1' disabled='disabled'>" . $tabCategory["title"] . "</option>";
3418
+                $res .= "<option value='-1' disabled='disabled'>".$tabCategory["title"]."</option>";
3419 3419
                 $currentCatId = $tabCategory["id"];
3420 3420
             }
3421
-            $res .= "<option " . $tabSelected[$tabGroups[$i]["id"]] . "style='margin-left:40px' value='" . $tabGroups[$i]["id"] . "'>" . $tabGroups[$i]["name"] . "</option>";
3421
+            $res .= "<option ".$tabSelected[$tabGroups[$i]["id"]]."style='margin-left:40px' value='".$tabGroups[$i]["id"]."'>".$tabGroups[$i]["name"]."</option>";
3422 3422
         }
3423 3423
         $res .= "</select>";
3424 3424
         return $res;
@@ -3651,14 +3651,14 @@  discard block
 block discarded – undo
3651 3651
                 if ($show_results) {
3652 3652
                     $comnt = Event::get_comments($exe_id, $questionId);
3653 3653
                     if (!empty($comnt)) {
3654
-                        echo '<b>' . get_lang('Feedback') . '</b>';
3655
-                        echo '<div id="question_feedback">' . $comnt . '</div>';
3654
+                        echo '<b>'.get_lang('Feedback').'</b>';
3655
+                        echo '<div id="question_feedback">'.$comnt.'</div>';
3656 3656
                     }
3657 3657
                 }
3658 3658
 
3659 3659
                 if ($show_results) {
3660 3660
                     $score = array(
3661
-                        'result' => get_lang('Score') . " : " . self::show_score(
3661
+                        'result' => get_lang('Score')." : ".self::show_score(
3662 3662
                                 $my_total_score,
3663 3663
                                 $my_total_weight,
3664 3664
                                 false,
@@ -3726,13 +3726,13 @@  discard block
 block discarded – undo
3726 3726
         }
3727 3727
 
3728 3728
         if ($show_all_but_expected_answer) {
3729
-            $exercise_content .= "<div class='normal-message'>" . get_lang(
3729
+            $exercise_content .= "<div class='normal-message'>".get_lang(
3730 3730
                     "ExerciseWithFeedbackWithoutCorrectionComment"
3731
-                ) . "</div>";
3731
+                )."</div>";
3732 3732
         }
3733 3733
         // Remove audio auto play from questions on results page - refs BT#7939
3734 3734
         $exercise_content = preg_replace(
3735
-            ['/autoplay[\=\".+\"]+/','/autostart[\=\".+\"]+/'],
3735
+            ['/autoplay[\=\".+\"]+/', '/autostart[\=\".+\"]+/'],
3736 3736
             '',
3737 3737
             $exercise_content
3738 3738
         );
@@ -3826,11 +3826,11 @@  discard block
 block discarded – undo
3826 3826
                     $ribbon_total_success_or_error = ' ribbon-total-error';
3827 3827
                 }
3828 3828
             }
3829
-            $ribbon .= '<div class="total ' . $ribbon_total_success_or_error . '">';
3829
+            $ribbon .= '<div class="total '.$ribbon_total_success_or_error.'">';
3830 3830
         } else {
3831 3831
             $ribbon .= '<div class="total">';
3832 3832
         }
3833
-        $ribbon .= '<h3>' . get_lang('YourTotalScore') . ":&nbsp;";
3833
+        $ribbon .= '<h3>'.get_lang('YourTotalScore').":&nbsp;";
3834 3834
         $ribbon .= self::show_score($score, $weight, false, true);
3835 3835
         $ribbon .= '</h3>';
3836 3836
         $ribbon .= '</div>';
Please login to merge, or discard this patch.