Completed
Push — 1.10.x ( b081ff...c4deb6 )
by Julito
41:19
created
main/exercice/exercise.class.php 1 patch
Braces   +48 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1267,10 +1267,11 @@  discard block
 block discarded – undo
1267 1267
      */
1268 1268
     public function isInList($questionId)
1269 1269
     {
1270
-        if (is_array($this->questionList))
1271
-            return in_array($questionId,$this->questionList);
1272
-        else
1273
-            return false;
1270
+        if (is_array($this->questionList)) {
1271
+                    return in_array($questionId,$this->questionList);
1272
+        } else {
1273
+                    return false;
1274
+        }
1274 1275
     }
1275 1276
 
1276 1277
     /**
@@ -2207,10 +2208,11 @@  discard block
 block discarded – undo
2207 2208
 
2208 2209
             $var = Exercise::selectTimeLimit();
2209 2210
 
2210
-            if (($this->start_time != '0000-00-00 00:00:00') && !empty($this->start_time))
2211
-                $form->addElement('html','<div id="start_date_div" style="display:block;">');
2212
-            else
2213
-                $form->addElement('html','<div id="start_date_div" style="display:none;">');
2211
+            if (($this->start_time != '0000-00-00 00:00:00') && !empty($this->start_time)) {
2212
+                            $form->addElement('html','<div id="start_date_div" style="display:block;">');
2213
+            } else {
2214
+                            $form->addElement('html','<div id="start_date_div" style="display:none;">');
2215
+            }
2214 2216
 
2215 2217
             $form->addElement('date_time_picker', 'start_time');
2216 2218
 
@@ -2218,10 +2220,11 @@  discard block
 block discarded – undo
2218 2220
 
2219 2221
             $form->addElement('checkbox', 'activate_end_date_check', null , get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()'));
2220 2222
 
2221
-            if (($this->end_time != '0000-00-00 00:00:00' && !empty($this->end_time)))
2222
-                $form->addElement('html','<div id="end_date_div" style="display:block;">');
2223
-            else
2224
-                $form->addElement('html','<div id="end_date_div" style="display:none;">');
2223
+            if (($this->end_time != '0000-00-00 00:00:00' && !empty($this->end_time))) {
2224
+                            $form->addElement('html','<div id="end_date_div" style="display:block;">');
2225
+            } else {
2226
+                            $form->addElement('html','<div id="end_date_div" style="display:none;">');
2227
+            }
2225 2228
 
2226 2229
             $form->addElement('date_time_picker', 'end_time');
2227 2230
             $form->addElement('html','</div>');
@@ -3278,7 +3281,9 @@  discard block
 block discarded – undo
3278 3281
         $organs_at_risk_hit = 0;
3279 3282
         $questionScore = 0;
3280 3283
 
3281
-        if ($debug) error_log('Start answer loop ');
3284
+        if ($debug) {
3285
+            error_log('Start answer loop ');
3286
+        }
3282 3287
 
3283 3288
         $orderedHotspots = [];
3284 3289
 
@@ -3402,7 +3407,9 @@  discard block
 block discarded – undo
3402 3407
                     }
3403 3408
                     $totalScore += $answerWeighting;
3404 3409
 
3405
-                    if ($debug) error_log("studentChoice: $studentChoice");
3410
+                    if ($debug) {
3411
+                        error_log("studentChoice: $studentChoice");
3412
+                    }
3406 3413
                     break;
3407 3414
                 case GLOBAL_MULTIPLE_ANSWER:
3408 3415
                     if ($from_database) {
@@ -3427,7 +3434,9 @@  discard block
 block discarded – undo
3427 3434
                         $real_answers[$answerId] = (bool)$studentChoice;
3428 3435
                     }
3429 3436
                     $totalScore += $answerWeighting;
3430
-                    if ($debug) error_log("studentChoice: $studentChoice");
3437
+                    if ($debug) {
3438
+                        error_log("studentChoice: $studentChoice");
3439
+                    }
3431 3440
                     break;
3432 3441
                 case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE:
3433 3442
                     if ($from_database) {
@@ -4149,7 +4158,9 @@  discard block
 block discarded – undo
4149 4158
             } // end switch Answertype
4150 4159
 
4151 4160
             if ($show_result) {
4152
-                if ($debug) error_log('Showing questions $from '.$from);
4161
+                if ($debug) {
4162
+                    error_log('Showing questions $from '.$from);
4163
+                }
4153 4164
                 if ($from == 'exercise_result') {
4154 4165
                     // display answers (if not matching type, or if the answer is correct)
4155 4166
                     if (
@@ -4446,7 +4457,9 @@  discard block
 block discarded – undo
4446 4457
                         }
4447 4458
                     }
4448 4459
                 } else {
4449
-                    if ($debug) error_log('Showing questions $from '.$from);
4460
+                    if ($debug) {
4461
+                        error_log('Showing questions $from '.$from);
4462
+                    }
4450 4463
 
4451 4464
                     switch ($answerType) {
4452 4465
                         case UNIQUE_ANSWER:
@@ -4793,10 +4806,14 @@  discard block
 block discarded – undo
4793 4806
                     }
4794 4807
                 }
4795 4808
             }
4796
-            if ($debug) error_log(' ------ ');
4809
+            if ($debug) {
4810
+                error_log(' ------ ');
4811
+            }
4797 4812
         } // end for that loops over all answers of the current question
4798 4813
 
4799
-        if ($debug) error_log('-- end answer loop --');
4814
+        if ($debug) {
4815
+            error_log('-- end answer loop --');
4816
+        }
4800 4817
 
4801 4818
         $final_answer = true;
4802 4819
 
@@ -4869,7 +4886,9 @@  discard block
 block discarded – undo
4869 4886
             //  some results that haven't been stored in the database yet
4870 4887
             if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION ) {
4871 4888
 
4872
-                if ($debug) error_log('$from AND this is a hotspot kind of question ');
4889
+                if ($debug) {
4890
+                    error_log('$from AND this is a hotspot kind of question ');
4891
+                }
4873 4892
 
4874 4893
                 $my_exe_id = 0;
4875 4894
                 $from_database = 0;
@@ -5045,8 +5064,12 @@  discard block
 block discarded – undo
5045 5064
         // stored by exercise_results.php (using the session)
5046 5065
 
5047 5066
         if ($saved_results) {
5048
-            if ($debug) error_log("Save question results $saved_results");
5049
-            if ($debug) error_log(print_r($choice ,1 ));
5067
+            if ($debug) {
5068
+                error_log("Save question results $saved_results");
5069
+            }
5070
+            if ($debug) {
5071
+                error_log(print_r($choice ,1 ));
5072
+            }
5050 5073
 
5051 5074
             if (empty($choice)) {
5052 5075
                 $choice = 0;
@@ -5148,7 +5171,9 @@  discard block
 block discarded – undo
5148 5171
             $sql = 'UPDATE ' . $stat_table . ' SET
5149 5172
                         exe_result = exe_result + ' . floatval($questionScore) . '
5150 5173
                     WHERE exe_id = ' . $exeId;
5151
-            if ($debug) error_log($sql);
5174
+            if ($debug) {
5175
+                error_log($sql);
5176
+            }
5152 5177
             Database::query($sql);
5153 5178
         }
5154 5179
 
Please login to merge, or discard this patch.