Completed
Pull Request — 1.11.x (#1285)
by José
43:07
created
main/exercise/question.class.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -607,10 +607,11 @@
 block discarded – undo
607 607
             $current_width = $current_image_size['width'];
608 608
             $current_height = $current_image_size['height'];
609 609
 
610
-            if ($current_width < $Max && $current_height < $Max)
611
-                return true;
612
-            elseif ($current_height == "")
613
-                return false;
610
+            if ($current_width < $Max && $current_height < $Max) {
611
+                            return true;
612
+            } elseif ($current_height == "") {
613
+                            return false;
614
+            }
614 615
 
615 616
             // Resize according to height.
616 617
             if ($Dimension == "height") {
Please login to merge, or discard this patch.
main/exercise/unique_answer_no_option.class.php 1 patch
Braces   +13 added lines, -10 removed lines patch added patch discarded remove patch
@@ -146,15 +146,17 @@  discard block
 block discarded – undo
146 146
                     $list_dest = $item_list[2];
147 147
                     $url = $item_list[3];
148 148
 
149
-                    if ($try == 0)
150
-                        $try_result = 0;
151
-                    else
152
-                        $try_result = 1;
149
+                    if ($try == 0) {
150
+                                            $try_result = 0;
151
+                    } else {
152
+                                            $try_result = 1;
153
+                    }
153 154
 
154
-                    if ($url == 0)
155
-                        $url_result = '';
156
-                    else
157
-                        $url_result = $url;
155
+                    if ($url == 0) {
156
+                                            $url_result = '';
157
+                    } else {
158
+                                            $url_result = $url;
159
+                    }
158 160
 
159 161
                     $temp_scenario['url' . $i] = $url_result;
160 162
                     $temp_scenario['try' . $i] = $try_result;
@@ -343,8 +345,9 @@  discard block
 block discarded – undo
343 345
                 }
344 346
         	}
345 347
 
346
- 			if (empty($try))
347
- 				$try=0;
348
+ 			if (empty($try)) {
349
+ 			 				$try=0;
350
+ 			}
348 351
 
349 352
  			if (empty($lp)) {
350 353
  				$lp=0;
Please login to merge, or discard this patch.
main/exercise/hotspot_admin.inc.php 1 patch
Braces   +32 added lines, -13 removed lines patch added patch discarded remove patch
@@ -366,8 +366,9 @@  discard block
 block discarded – undo
366 366
         if ($answerType == HOT_SPOT_DELINEATION) {
367 367
             // the magic happens here ...
368 368
             // we do this to not count the if no error section
369
-            if ($nbrAnswers >= 2)
370
-                $nbrAnswers--;
369
+            if ($nbrAnswers >= 2) {
370
+                            $nbrAnswers--;
371
+            }
371 372
         }
372 373
 
373 374
         $reponse = array();
@@ -679,12 +680,15 @@  discard block
 block discarded – undo
679 680
 
680 681
                                     for ($k = 1; $k <= 100; $k++) {
681 682
                                         $selected1 = $selected2 = $selected3 = '';
682
-                                        if ($k == $threadhold1[$i])
683
-                                            $selected1 = 'selected="selected"';
684
-                                        if ($k == $threadhold2[$i])
685
-                                            $selected2 = 'selected="selected"';
686
-                                        if ($k == $threadhold3[$i])
687
-                                            $selected3 = 'selected="selected"';
683
+                                        if ($k == $threadhold1[$i]) {
684
+                                                                                    $selected1 = 'selected="selected"';
685
+                                        }
686
+                                        if ($k == $threadhold2[$i]) {
687
+                                                                                    $selected2 = 'selected="selected"';
688
+                                        }
689
+                                        if ($k == $threadhold3[$i]) {
690
+                                                                                    $selected3 = 'selected="selected"';
691
+                                        }
688 692
                                         $option1.='<option ' . $selected1 . ' >' . $k . ' % </option>';
689 693
                                         $option2.='<option ' . $selected2 . ' >' . $k . ' % </option>';
690 694
                                         $option3.='<option ' . $selected3 . '>' . $k . ' %</option>';
@@ -731,7 +735,10 @@  discard block
 block discarded – undo
731 735
                                                 <div class="checkbox">
732 736
                                                     <p>
733 737
                                                         <label>
734
-                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]"  <?php if ($try[$i] == 1) echo'checked'; ?> />
738
+                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]"  <?php if ($try[$i] == 1) {
739
+    echo'checked';
740
+}
741
+?> />
735 742
                                                             <?php echo get_lang('TryAgain'); ?>
736 743
                                                         </label>
737 744
                                                     </p>
@@ -784,7 +791,10 @@  discard block
 block discarded – undo
784 791
                                                             <div class="checkbox">
785 792
                                                                 <p>
786 793
                                                                     <label>
787
-                                                                        <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
794
+                                                                        <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) {
795
+    echo'checked';
796
+}
797
+?> />
788 798
                                                                         <?php echo get_lang('TryAgain'); ?>
789 799
                                                                     </label>
790 800
                                                                 </p>
@@ -823,7 +833,10 @@  discard block
 block discarded – undo
823 833
                                             <th ><?php echo get_lang('OAR'); ?>*</th>
824 834
                                             <?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?>
825 835
                                                 <th colspan="2" ><?php echo get_lang('Comment'); ?></th>
826
-                                                <th ><?php if ($answerType == HOT_SPOT_DELINEATION) echo get_lang('Scenario'); ?></th>
836
+                                                <th ><?php if ($answerType == HOT_SPOT_DELINEATION) {
837
+    echo get_lang('Scenario');
838
+}
839
+?></th>
827 840
                                             <?php } else { ?>
828 841
                                                 <th colspan="3" ><?php echo get_lang('Comment'); ?></th>
829 842
                                             <?php } ?>
@@ -849,7 +862,10 @@  discard block
 block discarded – undo
849 862
                                                 <div class="checkbox">
850 863
                                                     <p>
851 864
                                                         <label>
852
-                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) echo'checked'; ?> />
865
+                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) {
866
+    echo'checked';
867
+}
868
+?> />
853 869
                                                             <?php echo get_lang('TryAgain'); ?>
854 870
                                                         </label>
855 871
                                                     </p>
@@ -998,7 +1014,10 @@  discard block
 block discarded – undo
998 1014
                                         <div class="checkbox">
999 1015
                                             <p>
1000 1016
                                                 <label>
1001
-                                                    <input type="checkbox" class="checkbox" name="try_noerror" <?php if ($try_noerror == 1) echo'checked'; ?> />
1017
+                                                    <input type="checkbox" class="checkbox" name="try_noerror" <?php if ($try_noerror == 1) {
1018
+    echo'checked';
1019
+}
1020
+?> />
1002 1021
                                                     <?php echo get_lang('TryAgain'); ?>
1003 1022
                                                 </label>
1004 1023
                                             </p>
Please login to merge, or discard this patch.
main/exercise/hotspot_lang_conversion.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,10 +18,11 @@
 block discarded – undo
18 18
 	$lang = urldecode($_GET['lang']);
19 19
 	if (preg_match('/^[a-zA-Z0-9\._-]+$/', $lang)) {
20 20
 		//$lang = str_replace($search,$replace,urldecode($_GET['lang']));
21
-		if(file_exists($hotspot_lang_file . $lang . '/hotspot.inc.php'))
22
-			$hotspot_lang_file .= $lang . '/hotspot.inc.php';
23
-		else
24
-			$hotspot_lang_file .= 'english/hotspot.inc.php';
21
+		if(file_exists($hotspot_lang_file . $lang . '/hotspot.inc.php')) {
22
+					$hotspot_lang_file .= $lang . '/hotspot.inc.php';
23
+		} else {
24
+					$hotspot_lang_file .= 'english/hotspot.inc.php';
25
+		}
25 26
 	} else {
26 27
 		$hotspot_lang_file .= 'english/hotspot.inc.php';
27 28
 	}
Please login to merge, or discard this patch.
main/exercise/exercise_report.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -400,8 +400,9 @@
 block discarded – undo
400 400
 $extra .= $form->return_form();
401 401
 $extra .= '</div>';
402 402
 
403
-if ($is_allowedToEdit)
403
+if ($is_allowedToEdit) {
404 404
     echo $extra;
405
+}
405 406
 
406 407
 echo $actions;
407 408
 
Please login to merge, or discard this patch.
main/exercise/export/aiken/aiken_classes.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,9 @@
 block discarded – undo
7 7
  * @package chamilo.exercise
8 8
  */
9 9
 
10
-if ( count( get_included_files() ) == 1 ) die( '---' );
10
+if ( count( get_included_files() ) == 1 ) {
11
+    die( '---' );
12
+}
11 13
 
12 14
 if (!function_exists('mime_content_type')) {
13 15
 	function mime_content_type($filename) {
Please login to merge, or discard this patch.
main/exercise/export/aiken/aiken_import.inc.php 1 patch
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,8 +10,9 @@  discard block
 block discarded – undo
10 10
 /**
11 11
  * Security check
12 12
  */
13
-if (count(get_included_files()) == 1)
13
+if (count(get_included_files()) == 1) {
14 14
     die('---');
15
+}
15 16
 
16 17
 /**
17 18
  * Creates a temporary directory
@@ -21,8 +22,9 @@  discard block
 block discarded – undo
21 22
  * @return string
22 23
  */
23 24
 function tempdir($dir, $prefix = 'tmp', $mode = 0777) {
24
-    if (substr($dir, -1) != '/')
25
-        $dir .= '/';
25
+    if (substr($dir, -1) != '/') {
26
+            $dir .= '/';
27
+    }
26 28
 
27 29
     do {
28 30
         $path = $dir . $prefix . mt_rand(0, 9999999);
Please login to merge, or discard this patch.
main/exercise/export/qti2/qti2_classes.php 1 patch
Braces   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,11 @@
 block discarded – undo
104 104
     {
105 105
 		$this->answerList = $this->getAnswersList(true);
106 106
 		$type = $this->getQuestionType();
107
-        if ($type == MCMA)  $cardinality = 'multiple'; else $cardinality = 'single';
107
+        if ($type == MCMA) {
108
+            $cardinality = 'multiple';
109
+        } else {
110
+            $cardinality = 'single';
111
+        }
108 112
 
109 113
         $out = '  <responseDeclaration identifier="' . $questionIdent . '" cardinality="' . $cardinality . '" baseType="identifier">' . "\n";
110 114
 
Please login to merge, or discard this patch.
main/exercise/exercise.class.php 1 patch
Braces   +30 added lines, -10 removed lines patch added patch discarded remove patch
@@ -3243,7 +3243,9 @@  discard block
 block discarded – undo
3243 3243
         $organs_at_risk_hit = 0;
3244 3244
         $questionScore = 0;
3245 3245
 
3246
-        if ($debug) error_log('Start answer loop ');
3246
+        if ($debug) {
3247
+            error_log('Start answer loop ');
3248
+        }
3247 3249
 
3248 3250
         $answer_correct_array = array();
3249 3251
 
@@ -3372,7 +3374,9 @@  discard block
 block discarded – undo
3372 3374
                     }
3373 3375
                     $totalScore += $answerWeighting;
3374 3376
 
3375
-                    if ($debug) error_log("studentChoice: $studentChoice");
3377
+                    if ($debug) {
3378
+                        error_log("studentChoice: $studentChoice");
3379
+                    }
3376 3380
                     break;
3377 3381
                 case GLOBAL_MULTIPLE_ANSWER:
3378 3382
                     if ($from_database) {
@@ -3397,7 +3401,9 @@  discard block
 block discarded – undo
3397 3401
                         $real_answers[$answerId] = (bool)$studentChoice;
3398 3402
                     }
3399 3403
                     $totalScore += $answerWeighting;
3400
-                    if ($debug) error_log("studentChoice: $studentChoice");
3404
+                    if ($debug) {
3405
+                        error_log("studentChoice: $studentChoice");
3406
+                    }
3401 3407
                     break;
3402 3408
                 case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE:
3403 3409
                     if ($from_database) {
@@ -4143,7 +4149,9 @@  discard block
 block discarded – undo
4143 4149
             } // end switch Answertype
4144 4150
 
4145 4151
             if ($show_result) {
4146
-                if ($debug) error_log('Showing questions $from '.$from);
4152
+                if ($debug) {
4153
+                    error_log('Showing questions $from '.$from);
4154
+                }
4147 4155
                 if ($from == 'exercise_result') {
4148 4156
                     //display answers (if not matching type, or if the answer is correct)
4149 4157
                     if (
@@ -4440,7 +4448,9 @@  discard block
 block discarded – undo
4440 4448
                         }
4441 4449
                     }
4442 4450
                 } else {
4443
-                    if ($debug) error_log('Showing questions $from '.$from);
4451
+                    if ($debug) {
4452
+                        error_log('Showing questions $from '.$from);
4453
+                    }
4444 4454
 
4445 4455
                     switch ($answerType) {
4446 4456
                         case UNIQUE_ANSWER:
@@ -4786,10 +4796,14 @@  discard block
 block discarded – undo
4786 4796
                     }
4787 4797
                 }
4788 4798
             }
4789
-            if ($debug) error_log(' ------ ');
4799
+            if ($debug) {
4800
+                error_log(' ------ ');
4801
+            }
4790 4802
         } // end for that loops over all answers of the current question
4791 4803
 
4792
-        if ($debug) error_log('-- end answer loop --');
4804
+        if ($debug) {
4805
+            error_log('-- end answer loop --');
4806
+        }
4793 4807
 
4794 4808
         $final_answer = true;
4795 4809
 
@@ -4862,7 +4876,9 @@  discard block
 block discarded – undo
4862 4876
             //  some results that haven't been stored in the database yet
4863 4877
             if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION ) {
4864 4878
 
4865
-                if ($debug) error_log('$from AND this is a hotspot kind of question ');
4879
+                if ($debug) {
4880
+                    error_log('$from AND this is a hotspot kind of question ');
4881
+                }
4866 4882
 
4867 4883
                 $my_exe_id = 0;
4868 4884
                 $from_database = 0;
@@ -5038,8 +5054,12 @@  discard block
 block discarded – undo
5038 5054
         // stored by exercise_results.php (using the session)
5039 5055
 
5040 5056
         if ($saved_results) {
5041
-            if ($debug) error_log("Save question results $saved_results");
5042
-            if ($debug) error_log(print_r($choice ,1 ));
5057
+            if ($debug) {
5058
+                error_log("Save question results $saved_results");
5059
+            }
5060
+            if ($debug) {
5061
+                error_log(print_r($choice ,1 ));
5062
+            }
5043 5063
 
5044 5064
             if (empty($choice)) {
5045 5065
                 $choice = 0;
Please login to merge, or discard this patch.