Passed
Push — 1.10.x ( aae6b1...e5a590 )
by Yannick
131:05 queued 81:36
created
main/exercice/question_list_admin.inc.php 2 patches
Spacing   +13 added lines, -14 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             .sortable({
109 109
                 cursor: "move", // works?
110 110
                 update: function(event, ui) {
111
-                    var order = $(this).sortable("serialize") + "&a=update_question_order&exercise_id=<?php echo intval($_GET['exerciseId']);?>";
111
+                    var order = $(this).sortable("serialize") + "&a=update_question_order&exercise_id=<?php echo intval($_GET['exerciseId']); ?>";
112 112
                     $.post("<?php echo $ajax_url ?>", order, function(reponse){
113 113
                         $("#message").html(reponse);
114 114
                     });
@@ -141,11 +141,11 @@  discard block
 block discarded – undo
141 141
     echo "<div class='table-responsive'>";
142 142
     echo "<table class='table table-condensed'>";
143 143
     echo "<tr>";
144
-    echo "<th style=\"width: 50%;\">" .get_lang('Questions'). "</th>";
145
-    echo "<th style=\"width: 6%;\">" .get_lang('Type'). "</th>";
146
-    echo "<th style=\"width: 22%; text-align:center;\">" .get_lang('Category'). "</th>";
147
-    echo "<th style=\"width: 6%;\">" .get_lang('Difficulty'). "</th>";
148
-    echo "<th style=\"width: 16%; float:left;\">" .get_lang('Score'). "</th>";
144
+    echo "<th style=\"width: 50%;\">".get_lang('Questions')."</th>";
145
+    echo "<th style=\"width: 6%;\">".get_lang('Type')."</th>";
146
+    echo "<th style=\"width: 22%; text-align:center;\">".get_lang('Category')."</th>";
147
+    echo "<th style=\"width: 6%;\">".get_lang('Difficulty')."</th>";
148
+    echo "<th style=\"width: 16%; float:left;\">".get_lang('Score')."</th>";
149 149
     echo "</tr>";
150 150
     echo "</table>";
151 151
     echo "</div>";
@@ -172,15 +172,14 @@  discard block
 block discarded – undo
172 172
                 $question_class = get_class($objQuestionTmp);
173 173
 
174 174
                 $clone_link = '<a href="'.api_get_self().'?'.api_get_cidreq().'&clone_question='.$id.'">'.
175
-                    Display::return_icon('cd.gif',get_lang('Copy'), array(), ICON_SIZE_SMALL).'</a>';
175
+                    Display::return_icon('cd.gif', get_lang('Copy'), array(), ICON_SIZE_SMALL).'</a>';
176 176
                 $edit_link = ($objQuestionTmp->type == CALCULATED_ANSWER && $objQuestionTmp->isAnswered()) ?
177 177
                     '<a>'.Display::return_icon(
178 178
                         'edit_na.png',
179 179
                         get_lang('QuestionEditionNotAvailableBecauseItIsAlreadyAnsweredHoweverYouCanCopyItAndModifyTheCopy'),
180 180
                         array(),
181 181
                         ICON_SIZE_SMALL
182
-                    ).'</a>' :
183
-                    '<a href="'.api_get_self().'?'.api_get_cidreq().'&type='.
182
+                    ).'</a>' : '<a href="'.api_get_self().'?'.api_get_cidreq().'&type='.
184 183
                     $objQuestionTmp->selectType().'&myid=1&editQuestion='.$id.'">'.
185 184
                     Display::return_icon(
186 185
                         'edit.png',
@@ -190,16 +189,16 @@  discard block
 block discarded – undo
190 189
                     ).'</a>';
191 190
                 $delete_link = null;
192 191
                 if ($objExercise->edit_exercise_in_lp == true) {
193
-                    $delete_link = '<a id="delete_'.$id.'" class="opener"  href="'.api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId.'&deleteQuestion='.$id.'" >'.Display::return_icon('delete.png',get_lang('RemoveFromTest'), array(), ICON_SIZE_SMALL).'</a>';
192
+                    $delete_link = '<a id="delete_'.$id.'" class="opener"  href="'.api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId.'&deleteQuestion='.$id.'" >'.Display::return_icon('delete.png', get_lang('RemoveFromTest'), array(), ICON_SIZE_SMALL).'</a>';
194 193
                 }
195 194
 
196
-                $edit_link = Display::tag('div', $edit_link,   array('style'=>'float:left; padding:0px; margin:0px'));
197
-                $clone_link = Display::tag('div', $clone_link,  array('style'=>'float:left; padding:0px; margin:0px'));
195
+                $edit_link = Display::tag('div', $edit_link, array('style'=>'float:left; padding:0px; margin:0px'));
196
+                $clone_link = Display::tag('div', $clone_link, array('style'=>'float:left; padding:0px; margin:0px'));
198 197
                 $delete_link = Display::tag('div', $delete_link, array('style'=>'float:left; padding:0px; margin:0px'));
199 198
                 $actions = Display::tag(
200 199
                     'div',
201 200
                     $edit_link.$clone_link.$delete_link,
202
-                    array('class'=>'edition','style'=>'width:100px; right:10px; margin-top: 8px; position: absolute; top: 10%;')
201
+                    array('class'=>'edition', 'style'=>'width:100px; right:10px; margin-top: 8px; position: absolute; top: 10%;')
203 202
                 );
204 203
 
205 204
                 $title = Security::remove_XSS($objQuestionTmp->selectTitle());
@@ -248,7 +247,7 @@  discard block
 block discarded – undo
248 247
                 echo $actions;
249 248
                 echo '</div>';
250 249
                 echo '<div class="question-list-description-block">';
251
-                echo '<p class="lead">' . get_lang($question_class) . '</p>';
250
+                echo '<p class="lead">'.get_lang($question_class).'</p>';
252 251
                 //echo get_lang('Level').': '.$objQuestionTmp->selectLevel();
253 252
                 ExerciseLib::showQuestion($id, false, null, null, false, true, false, true, $objExercise->feedback_type, true);
254 253
                 echo '</div>';
Please login to merge, or discard this patch.
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,6 @@
 block discarded – undo
16 16
  * @author Patrick Cool
17 17
  * @author René Haentjens, added CSV file import (October 2004)
18 18
  * @package chamilo.link
19
-
20 19
  */
21 20
 
22 21
 // Including libraries
Please login to merge, or discard this patch.
main/exercice/question_create.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -51,17 +51,17 @@
 block discarded – undo
51 51
 $result = Database::query($sql);
52 52
 $exercises['-'] = '-'.get_lang('SelectExercise').'-';
53 53
 while ($row = Database :: fetch_array($result)) {
54
-	$exercises[$row['id']] = cut($row['title'], EXERCISE_MAX_NAME_SIZE);
54
+    $exercises[$row['id']] = cut($row['title'], EXERCISE_MAX_NAME_SIZE);
55 55
 }
56 56
 $form->addElement('select', 'exercise', get_lang('Exercise'), $exercises);
57 57
 
58 58
 // generate default content
59 59
 $form->addElement(
60
-	'checkbox',
61
-	'is_content',
62
-	null,
63
-	get_lang('GenerateDefaultContent'),
64
-	array('checked' => true)
60
+    'checkbox',
61
+    'is_content',
62
+    null,
63
+    get_lang('GenerateDefaultContent'),
64
+    array('checked' => true)
65 65
 );
66 66
 
67 67
 // the submit button
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,21 +8,21 @@  discard block
 block discarded – undo
8 8
 require_once '../inc/global.inc.php';
9 9
 
10 10
 // the section (tabs)
11
-$this_section=SECTION_COURSES;
11
+$this_section = SECTION_COURSES;
12 12
 
13 13
 // notice for unauthorized people.
14 14
 api_protect_course_script(true);
15 15
 
16 16
 // breadcrumbs
17
-$interbreadcrumb[]=array("url" => "exercise.php","name" => get_lang('Exercises'));
17
+$interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises'));
18 18
 
19 19
 // Tool name
20
-$nameTools=get_lang('AddQuestionToExercise');
20
+$nameTools = get_lang('AddQuestionToExercise');
21 21
 
22 22
 // The form
23
-$form = new FormValidator('add_question','post',api_get_self().'?'.api_get_cidreq());
23
+$form = new FormValidator('add_question', 'post', api_get_self().'?'.api_get_cidreq());
24 24
 // form title
25
-$form->addElement('header','',get_lang('AddQuestionToExercise'));
25
+$form->addElement('header', '', get_lang('AddQuestionToExercise'));
26 26
 
27 27
 $question_list = Question::get_question_type_list();
28 28
 $question_list_options = array();
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 );
39 39
 
40 40
 //session id
41
-$session_id  = api_get_session_id();
41
+$session_id = api_get_session_id();
42 42
 
43 43
 // the exercises
44 44
 $tbl_exercises = Database :: get_course_table(TABLE_QUIZ_TEST);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     Display::display_header($nameTools);
99 99
 
100 100
     echo '<div class="actions">';
101
-    echo '<a href="exercise.php?show=test">'.Display :: return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>';
101
+    echo '<a href="exercise.php?show=test">'.Display :: return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>';
102 102
     echo '</div>';
103 103
 
104 104
     // displaying the form
Please login to merge, or discard this patch.
main/exercice/calculated_answer.class.php 2 patches
Spacing   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
             ),
134 134
             array('ToolbarSet' => 'TestQuestionDescription', 'Width' => '100%', 'Height' => '350'));
135 135
 
136
-        $form->addRule('answer', get_lang('GiveText'),'required');
137
-        $form->addRule('answer', get_lang('DefineBlanks'),'regex','/\[.*\]/');
136
+        $form->addRule('answer', get_lang('GiveText'), 'required');
137
+        $form->addRule('answer', get_lang('DefineBlanks'), 'regex', '/\[.*\]/');
138 138
 
139 139
         $form->addElement('label', null, get_lang('IfYouWantOnlyIntegerValuesWriteBothLimitsWithoutDecimals'));
140 140
         $form->addElement('html', '<div id="blanks_weighting"></div>');
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
         $form->setDefaults(array('weighting' => '10'));
162 162
 
163 163
         $form->addElement('text', 'answerVariations', get_lang('AnswerVariations'));
164
-        $form->addRule('answerVariations', get_lang('GiveAnswerVariations'),'required');
164
+        $form->addRule('answerVariations', get_lang('GiveAnswerVariations'), 'required');
165 165
         $form->setDefaults(array('answerVariations' => '1'));
166 166
 
167 167
         global $text;
@@ -201,22 +201,21 @@  discard block
 block discarded – undo
201 201
             $answerVariations = $form->getSubmitValue('answerVariations');
202 202
             $this->weighting = $form->getSubmitValue('weighting');
203 203
             // Create as many answers as $answerVariations
204
-            for ($j=0 ; $j < $answerVariations; $j++) {
204
+            for ($j = 0; $j < $answerVariations; $j++) {
205 205
                 $auxAnswer = $answer;
206 206
                 $auxFormula = $formula;
207 207
                 $nb = preg_match_all('/\[[^\]]*\]/', $auxAnswer, $blanks);
208 208
                 if ($nb > 0) {
209
-                    for ($i=0 ; $i < $nb; ++$i) {
209
+                    for ($i = 0; $i < $nb; ++$i) {
210 210
                         $blankItem = $blanks[0][$i];
211 211
                         $replace = array("[", "]");
212 212
                         $newBlankItem = str_replace($replace, "", $blankItem);
213 213
                         $newBlankItem = "[".trim($newBlankItem)."]";
214 214
                         // take random float values when one or both edge values have a decimal point
215 215
                         $randomValue =
216
-                            (strpos($lowestValues[$i],'.') !== false ||
217
-                            strpos($highestValues[$i],'.') !== false) ?
218
-                            mt_rand($lowestValues[$i]*100,$highestValues[$i]*100)/100 :
219
-                            mt_rand($lowestValues[$i],$highestValues[$i]);
216
+                            (strpos($lowestValues[$i], '.') !== false ||
217
+                            strpos($highestValues[$i], '.') !== false) ?
218
+                            mt_rand($lowestValues[$i] * 100, $highestValues[$i] * 100) / 100 : mt_rand($lowestValues[$i], $highestValues[$i]);
220 219
                         $auxAnswer = str_replace($blankItem, $randomValue, $auxAnswer);
221 220
                         $auxFormula = str_replace($blankItem, $randomValue, $auxFormula);
222 221
                     }
@@ -250,7 +249,7 @@  discard block
 block discarded – undo
250 249
     function return_header($feedback_type = null, $counter = null, $score = null)
251 250
     {
252 251
         $header = parent::return_header($feedback_type, $counter, $score);
253
-        $header .= '<table class="'.$this->question_table_class .'">
252
+        $header .= '<table class="'.$this->question_table_class.'">
254 253
             <tr>
255 254
                 <th>'.get_lang("Answer").'</th>
256 255
             </tr>';
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
      * @param null $feedback_type
59 59
      * @param null $counter
60 60
      * @param null $score
61
-     * @return null|string
61
+     * @return string
62 62
      */
63 63
     function return_header($feedback_type = null, $counter = null, $score = null)
64 64
     {
Please login to merge, or discard this patch.
main/exercice/matching.class.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
                 for ($i = 1; $i <= $answer->nbrAnswers; $i++) {
73 73
                     if ($answer->isCorrect($i)) {
74 74
                         $nb_matches++;
75
-                        $defaults['answer[' . $nb_matches . ']'] = $answer->selectAnswer($i);
76
-                        $defaults['weighting[' . $nb_matches . ']'] = float_format($answer->selectWeighting($i), 1);
77
-                        $defaults['matches[' . $nb_matches . ']'] = $answer->correct[$i];
75
+                        $defaults['answer['.$nb_matches.']'] = $answer->selectAnswer($i);
76
+                        $defaults['weighting['.$nb_matches.']'] = float_format($answer->selectWeighting($i), 1);
77
+                        $defaults['matches['.$nb_matches.']'] = $answer->correct[$i];
78 78
                     } else {
79 79
                         $nb_options++;
80
-                        $defaults['option[' . $nb_options . ']'] = $answer->selectAnswer($i);
80
+                        $defaults['option['.$nb_options.']'] = $answer->selectAnswer($i);
81 81
                     }
82 82
                 }
83 83
             }
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
         $html = '<table class="table table-striped table-hover">
109 109
             <thead>
110 110
                 <tr>
111
-                    <th width="5%">' . get_lang('Number') . '</th>
112
-                    <th width="70%">' . get_lang('Answer') . '</th>
113
-                    <th width="15%">' . get_lang('MatchesTo') . '</th>
114
-                    <th width="10%">' . get_lang('Weighting') . '</th>
111
+                    <th width="5%">' . get_lang('Number').'</th>
112
+                    <th width="70%">' . get_lang('Answer').'</th>
113
+                    <th width="15%">' . get_lang('MatchesTo').'</th>
114
+                    <th width="10%">' . get_lang('Weighting').'</th>
115 115
                 </tr>
116 116
             </thead>
117 117
             <tbody>';
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
         $html = '<table class="table table-striped table-hover">
163 163
             <thead>
164 164
                 <tr>
165
-                    <th width="15%">' . get_lang('Number') . '</th>
166
-                    <th width="85%">' . get_lang('Answer') . '</th>
165
+                    <th width="15%">' . get_lang('Number').'</th>
166
+                    <th width="85%">' . get_lang('Answer').'</th>
167 167
                 </tr>
168 168
             </thead>
169 169
             <tbody>';
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 
186 186
             $form->addHtml('<tr>');
187 187
 
188
-            $form->addHtml('<td>' . chr(64 + $i) . '</td>');
188
+            $form->addHtml('<td>'.chr(64 + $i).'</td>');
189 189
             $form->addText("option[$i]", null);
190 190
 
191 191
             $form->addHtml('</tr>');
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
     public function return_header($feedback_type = null, $counter = null, $score = null)
268 268
     {
269 269
         $header = parent::return_header($feedback_type, $counter, $score);
270
-        $header .= '<table class="'.$this->question_table_class .'">';
270
+        $header .= '<table class="'.$this->question_table_class.'">';
271 271
         $header .= '<tr>
272 272
                 <th>'.get_lang('ElementList').'</th>
273 273
                 <th>'.get_lang('CorrespondsTo').'</th>
Please login to merge, or discard this patch.
main/exercice/question_admin.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 if (isset($_GET['editQuestion'])) {
14
-    $objQuestion = Question::read ($_GET['editQuestion']);
14
+    $objQuestion = Question::read($_GET['editQuestion']);
15 15
     $action = api_get_self()."?".api_get_cidreq()."&myid=1&modifyQuestion=".$modifyQuestion."&editQuestion=".$objQuestion->id;
16 16
 } else {
17 17
     $objQuestion = Question :: getInstance($_REQUEST['answerType']);
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
 if (is_object($objQuestion)) {
22 22
     // FORM CREATION
23
-    $form = new FormValidator('question_admin_form','post', $action);
23
+    $form = new FormValidator('question_admin_form', 'post', $action);
24 24
     if (isset($_GET['editQuestion'])) {
25 25
         $class = "btn btn-default";
26 26
         $text = get_lang('ModifyQuestion');
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
         // redirect
64 64
         if ($objQuestion->type != HOT_SPOT && $objQuestion->type != HOT_SPOT_DELINEATION) {
65
-            if(isset($_GET['editQuestion'])) {
65
+            if (isset($_GET['editQuestion'])) {
66 66
                 echo '<script type="text/javascript">window.location.href="admin.php?exerciseId='.$exerciseId.'&'.api_get_cidreq().'&message=ItemUpdated"</script>';
67 67
             } else {
68 68
                 //New question
Please login to merge, or discard this patch.
main/exercice/hotspot_updatescore.inc.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -17,25 +17,25 @@
 block discarded – undo
17 17
 $hotspotId	  = $_GET['hotspotId'];
18 18
 $exerciseId   = $objExcercise->selectId();
19 19
 if ($_GET['answerId'] == "0") { // click is NOT on a hotspot
20
-	$hit = 0;
21
-	$answerId = $hotspotId;
20
+    $hit = 0;
21
+    $answerId = $hotspotId;
22 22
 
23
-	// remove from session
24
-	unset($_SESSION['exerciseResult'][$questionId][$answerId]);
23
+    // remove from session
24
+    unset($_SESSION['exerciseResult'][$questionId][$answerId]);
25 25
 
26
-	// Save clicking order
27
-	//$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['order'])+1;
28
-	//$_SESSION['exerciseResult'][$questionId]['order'][$answerOrderId] = $answerId;
26
+    // Save clicking order
27
+    //$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['order'])+1;
28
+    //$_SESSION['exerciseResult'][$questionId]['order'][$answerOrderId] = $answerId;
29 29
 } else { // user clicked ON a hotspot
30
-	$hit = 1;
31
-	$answerId = $hotspotId;
30
+    $hit = 1;
31
+    $answerId = $hotspotId;
32 32
 
33
-	// Save into session
34
-	$_SESSION['exerciseResult'][$questionId][$answerId] = $hit;
33
+    // Save into session
34
+    $_SESSION['exerciseResult'][$questionId][$answerId] = $hit;
35 35
 
36
-	// Save clicking order
37
-	//$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['order'])+1;
38
-	//$_SESSION['exerciseResult'][$questionId]['order'][$answerOrderId] = $answerId;
36
+    // Save clicking order
37
+    //$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['order'])+1;
38
+    //$_SESSION['exerciseResult'][$questionId]['order'][$answerOrderId] = $answerId;
39 39
 }
40 40
 
41 41
 //round-up the coordinates
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 $questionId   = $_GET['questionId'];
15 15
 $coordinates  = $_GET['coord'];
16 16
 $objExcercise = $_SESSION['objExercise'];
17
-$hotspotId	  = $_GET['hotspotId'];
17
+$hotspotId = $_GET['hotspotId'];
18 18
 $exerciseId   = $objExcercise->selectId();
19 19
 if ($_GET['answerId'] == "0") { // click is NOT on a hotspot
20 20
 	$hit = 0;
@@ -39,15 +39,15 @@  discard block
 block discarded – undo
39 39
 }
40 40
 
41 41
 //round-up the coordinates
42
-$coords = explode('/',$coordinates);
42
+$coords = explode('/', $coordinates);
43 43
 $coordinates = '';
44 44
 foreach ($coords as $coord) {
45
-    list($x,$y) = explode(';',$coord);
45
+    list($x, $y) = explode(';', $coord);
46 46
     $coordinates .= round($x).';'.round($y).'/';
47 47
 }
48
-$coordinates = substr($coordinates,0,-1);
48
+$coordinates = substr($coordinates, 0, -1);
49 49
 
50
-$TBL_TRACK_E_HOTSPOT   = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
50
+$TBL_TRACK_E_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
51 51
 
52 52
 // update db
53 53
 $update_id = $_SESSION['exerciseResult'][$questionId]['ids'][$answerId];
Please login to merge, or discard this patch.
main/exercice/hotspot_admin.inc.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -907,10 +907,10 @@
 block discarded – undo
907 907
                                         <?php } else { ?>
908 908
                                             <input class="form-control" type="text" name="weighting[<?php echo $i; ?>]" value="<?php echo (isset($weighting[$i]) ? $weighting[$i] : 10); ?>" />
909 909
                                                    <?php
910
-                                               }
911
-                                           }
912
-                                           if ($answerType == HOT_SPOT) {
913
-                                               ?>
910
+                                                }
911
+                                            }
912
+                                            if ($answerType == HOT_SPOT) {
913
+                                                ?>
914 914
                                         <input class="form-control" type="text" name="weighting[<?php echo $i; ?>]" value="<?php echo (isset($weighting[$i]) ? $weighting[$i] : 10); ?>" />
915 915
                                         <input type="hidden" name="hotspot_coordinates[<?php echo $i; ?>]" value="<?php echo (empty($hotspot_coordinates[$i]) ? '0;0|0|0' : $hotspot_coordinates[$i]); ?>" />
916 916
                                         <input type="hidden" name="hotspot_type[<?php echo $i; ?>]" value="<?php echo (empty($hotspot_type[$i]) ? 'square' : $hotspot_type[$i]); ?>" />
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 if ($modifyIn) {
27 27
     if ($debug > 0) {
28
-        echo '$modifyIn was set' . "<br />\n";
28
+        echo '$modifyIn was set'."<br />\n";
29 29
     }
30 30
     // if the user has chosen to modify the question only in the current exercise
31 31
     if ($modifyIn == 'thisExercise') {
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     unset($buttonBack);
65 65
 }
66 66
 
67
-$hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&exerciseId=' . $exerciseId;
67
+$hotspot_admin_url = api_get_path(WEB_CODE_PATH).'exercice/admin.php?'.api_get_cidreq().'&exerciseId='.$exerciseId;
68 68
 
69 69
 // the answer form has been submitted
70 70
 $submitAnswers = isset($_POST['submitAnswers']) ? true : false;
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
 if ($submitAnswers || $buttonBack) {
75 75
     if ($answerType == HOT_SPOT) {
76 76
         if ($debug > 0) {
77
-            echo '$submitAnswers or $buttonBack was set' . "<br />\n";
77
+            echo '$submitAnswers or $buttonBack was set'."<br />\n";
78 78
         }
79 79
 
80 80
         $questionWeighting = $nbrGoodAnswers = 0;
81 81
         for ($i = 1; $i <= $nbrAnswers; $i++) {
82 82
             if ($debug > 0) {
83
-                echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n";
83
+                echo str_repeat('&nbsp;', 4).'$answerType is HOT_SPOT'."<br />\n";
84 84
             }
85 85
 
86 86
             $reponse[$i] = trim($reponse[$i]);
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         if (empty($msgErr)) {
115 115
             for ($i = 1; $i <= $nbrAnswers; $i++) {
116 116
                 if ($debug > 0) {
117
-                    echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n";
117
+                    echo str_repeat('&nbsp;', 4).'$answerType is HOT_SPOT'."<br />\n";
118 118
                 }
119 119
 
120 120
                 $reponse[$i] = trim($reponse[$i]);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
                 $weighting[$i] = ($weighting[$i]); //it can be float
123 123
 
124 124
                 if ($weighting[$i]) {
125
-                    $questionWeighting+=$weighting[$i];
125
+                    $questionWeighting += $weighting[$i];
126 126
                 }
127 127
 
128 128
                 // creates answer
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
 
146 146
             $editQuestion = $questionId;
147 147
             unset($modifyAnswers);
148
-            echo '<script type="text/javascript">window.location.href="' . $hotspot_admin_url . '&message=ItemUpdated"</script>';
148
+            echo '<script type="text/javascript">window.location.href="'.$hotspot_admin_url.'&message=ItemUpdated"</script>';
149 149
         }
150 150
 
151 151
         if ($debug > 0) {
152
-            echo '$modifyIn was set - end' . "<br />\n";
152
+            echo '$modifyIn was set - end'."<br />\n";
153 153
         }
154 154
     } else {
155 155
         if ($debug > 0) {
156
-            echo '$submitAnswers or $buttonBack was set' . "<br />\n";
156
+            echo '$submitAnswers or $buttonBack was set'."<br />\n";
157 157
         }
158 158
 
159 159
         $questionWeighting = $nbrGoodAnswers = 0;
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
         for ($i = 1; $i <= $nbrAnswers; $i++) {
170 170
             if ($debug > 0) {
171
-                echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n";
171
+                echo str_repeat('&nbsp;', 4).'$answerType is HOT_SPOT'."<br />\n";
172 172
             }
173 173
 
174 174
             $reponse[$i] = trim($reponse[$i]);
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
                 $threadhold3_str = intval($threadhold3[$i]);
194 194
             }
195 195
 
196
-            $threadhold_total = $threadhold1_str . ';' . $threadhold2_str . ';' . $threadhold3_str;
196
+            $threadhold_total = $threadhold1_str.';'.$threadhold2_str.';'.$threadhold3_str;
197 197
 
198 198
             if ($try[$i] == 'on') {
199 199
                 $try_str = 1;
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
                 $question_str = $select_question[$i];
220 220
             }
221 221
 
222
-            $destination[$i] = $threadhold_total . '@@' . $try_str . '@@' . $lp_str . '@@' . $question_str . '@@' . $url_str;
222
+            $destination[$i] = $threadhold_total.'@@'.$try_str.'@@'.$lp_str.'@@'.$question_str.'@@'.$url_str;
223 223
 
224 224
             // checks if field is empty
225 225
             if (empty($reponse[$i]) && $reponse[$i] != '0') {
@@ -277,12 +277,12 @@  discard block
 block discarded – undo
277 277
             $question_str = $selectQuestionNoError;
278 278
         }
279 279
 
280
-        $destination_noerror = $threadhold_total . '@@' . $try_str . '@@' . $lp_str . '@@' . $question_str . '@@' . $url_str;
280
+        $destination_noerror = $threadhold_total.'@@'.$try_str.'@@'.$lp_str.'@@'.$question_str.'@@'.$url_str;
281 281
 
282 282
         if (empty($msgErr)) {
283 283
             for ($i = 1; $i <= $nbrAnswers; $i++) {
284 284
                 if ($debug > 0) {
285
-                    echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n";
285
+                    echo str_repeat('&nbsp;', 4).'$answerType is HOT_SPOT'."<br />\n";
286 286
                 }
287 287
 
288 288
                 $reponse[$i] = trim($reponse[$i]);
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
                 $weighting[$i] = ($weighting[$i]); //it can be float
291 291
 
292 292
                 if ($weighting[$i]) {
293
-                    $questionWeighting+=$weighting[$i];
293
+                    $questionWeighting += $weighting[$i];
294 294
                 }
295 295
                 // creates answer
296 296
                 $objAnswer->createAnswer(
@@ -325,14 +325,14 @@  discard block
 block discarded – undo
325 325
             $editQuestion = $questionId;
326 326
             unset($modifyAnswers);
327 327
 
328
-            echo '<script type="text/javascript">window.location.href="' . $hotspot_admin_url . '&message=ItemUpdated"</script>';
328
+            echo '<script type="text/javascript">window.location.href="'.$hotspot_admin_url.'&message=ItemUpdated"</script>';
329 329
         }
330 330
     }
331 331
 }
332 332
 
333 333
 if ($modifyAnswers) {
334 334
     if ($debug > 0) {
335
-        echo str_repeat('&nbsp;', 0) . '$modifyAnswers is set' . "<br />\n";
335
+        echo str_repeat('&nbsp;', 0).'$modifyAnswers is set'."<br />\n";
336 336
     }
337 337
 
338 338
     // construction of the Answer object
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
     Session::write('objAnswer', $objAnswer);
341 341
 
342 342
     if ($debug > 0) {
343
-        echo str_repeat('&nbsp;', 2) . '$answerType is HOT_SPOT' . "<br />\n";
343
+        echo str_repeat('&nbsp;', 2).'$answerType is HOT_SPOT'."<br />\n";
344 344
     }
345 345
 
346 346
     if ($answerType == HOT_SPOT_DELINEATION) {
@@ -512,11 +512,11 @@  discard block
 block discarded – undo
512 512
     }
513 513
 
514 514
     if ($debug > 0) {
515
-        echo str_repeat('&nbsp;', 2) . '$usedInSeveralExercises is untrue' . "<br />\n";
515
+        echo str_repeat('&nbsp;', 2).'$usedInSeveralExercises is untrue'."<br />\n";
516 516
     }
517 517
 
518 518
     if ($debug > 0) {
519
-        echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n";
519
+        echo str_repeat('&nbsp;', 4).'$answerType is HOT_SPOT'."<br />\n";
520 520
     }
521 521
 
522 522
     if ($answerType == HOT_SPOT_DELINEATION) {
@@ -554,13 +554,13 @@  discard block
 block discarded – undo
554 554
         );
555 555
     }
556 556
 
557
-    Display::tag('h3', get_lang('Question') . ": " . $questionName . ' <img src="../img/info3.gif" title="' . strip_tags(get_lang('HotspotChoose')) . '" alt="' . strip_tags(get_lang('HotspotChoose')) . '" />');
557
+    Display::tag('h3', get_lang('Question').": ".$questionName.' <img src="../img/info3.gif" title="'.strip_tags(get_lang('HotspotChoose')).'" alt="'.strip_tags(get_lang('HotspotChoose')).'" />');
558 558
 
559 559
     if (!empty($msgErr)) {
560 560
         Display::display_normal_message($msgErr); //main API
561 561
     }
562 562
 
563
-    $hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&hotspotadmin=' . $modifyAnswers . '&exerciseId=' . $exerciseId . '&' . api_get_cidreq();
563
+    $hotspot_admin_url = api_get_path(WEB_CODE_PATH).'exercice/admin.php?'.api_get_cidreq().'&hotspotadmin='.$modifyAnswers.'&exerciseId='.$exerciseId.'&'.api_get_cidreq();
564 564
     ?>
565 565
     <form method="post" action="<?php echo $hotspot_admin_url; ?>" class="form-horizontal" id="frm_exercise" name="frm_exercise">
566 566
         <div class="form-group">
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
                                 <th><?php echo get_lang('Comment'); ?></th>
600 600
                                 <?php
601 601
                                 if ($answerType == HOT_SPOT_DELINEATION) {
602
-                                    echo '<th >' . get_lang('Scenario') . '</th>';
602
+                                    echo '<th >'.get_lang('Scenario').'</th>';
603 603
                                 }
604 604
                                 ?>
605 605
                                 <?php
@@ -631,37 +631,37 @@  discard block
 block discarded – undo
631 631
                                         $isSelected = true;
632 632
                                         $selected = 'selected="selected"';
633 633
                                     }
634
-                                    $option_lp.='<option value="' . $id . '" ' . $selected . '>' . $details['lp_name'] . '</option>';
634
+                                    $option_lp .= '<option value="'.$id.'" '.$selected.'>'.$details['lp_name'].'</option>';
635 635
                                 }
636 636
 
637 637
                                 if ($isSelected) {
638
-                                    $option_lp = '<option value="0">' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
638
+                                    $option_lp = '<option value="0">'.get_lang('SelectTargetLP').'</option>'.$option_lp;
639 639
                                 } else {
640
-                                    $option_lp = '<option value="0" selected="selected" >' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
640
+                                    $option_lp = '<option value="0" selected="selected" >'.get_lang('SelectTargetLP').'</option>'.$option_lp;
641 641
                                 }
642 642
 
643 643
                                 // Feedback SELECT
644 644
                                 $question_list = $objExercise->selectQuestionList();
645 645
                                 $option_feed = '';
646
-                                $option_feed.='<option value="0">' . get_lang('SelectTargetQuestion') . '</option>';
646
+                                $option_feed .= '<option value="0">'.get_lang('SelectTargetQuestion').'</option>';
647 647
 
648 648
                                 foreach ($question_list as $key => $questionid) {
649 649
                                     $selected = '';
650 650
                                     $question = Question::read($questionid);
651
-                                    $val = 'Q' . $key . ' :' . substrwords($question->selectTitle(), ICON_SIZE_SMALL);
651
+                                    $val = 'Q'.$key.' :'.substrwords($question->selectTitle(), ICON_SIZE_SMALL);
652 652
                                     $select_lp_id[$id] = $details['lp_name'];
653 653
 
654 654
                                     if ($questionid == $select_question[$i]) {
655 655
                                         $selected = 'selected="selected"';
656 656
                                     }
657 657
 
658
-                                    $option_feed.='<option value="' . $questionid . '" ' . $selected . ' >' . $val . '</option>';
658
+                                    $option_feed .= '<option value="'.$questionid.'" '.$selected.' >'.$val.'</option>';
659 659
                                 }
660 660
 
661 661
                                 if ($select_question[$i] == -1) {
662
-                                    $option_feed .= '<option value="-1" selected="selected" >' . get_lang('ExitTest') . '</option>';
662
+                                    $option_feed .= '<option value="-1" selected="selected" >'.get_lang('ExitTest').'</option>';
663 663
                                 } else {
664
-                                    $option_feed .= '<option value="-1">' . get_lang('ExitTest') . '</option>';
664
+                                    $option_feed .= '<option value="-1">'.get_lang('ExitTest').'</option>';
665 665
                                 }
666 666
 
667 667
                                 //-------- IF it is a delineation
@@ -675,9 +675,9 @@  discard block
 block discarded – undo
675 675
                                             $selected2 = 'selected="selected"';
676 676
                                         if ($k == $threadhold3[$i])
677 677
                                             $selected3 = 'selected="selected"';
678
-                                        $option1.='<option ' . $selected1 . ' >' . $k . ' % </option>';
679
-                                        $option2.='<option ' . $selected2 . ' >' . $k . ' % </option>';
680
-                                        $option3.='<option ' . $selected3 . '>' . $k . ' %</option>';
678
+                                        $option1 .= '<option '.$selected1.' >'.$k.' % </option>';
679
+                                        $option2 .= '<option '.$selected2.' >'.$k.' % </option>';
680
+                                        $option3 .= '<option '.$selected3.'>'.$k.' %</option>';
681 681
                                     }
682 682
                                     ?>
683 683
                                     <tr>
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
                                                 <div class="checkbox">
722 722
                                                     <p>
723 723
                                                         <label>
724
-                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]"  <?php if ($try[$i] == 1) echo'checked'; ?> />
724
+                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]"  <?php if ($try[$i] == 1) echo'checked'; ?> />
725 725
                                                             <?php echo get_lang('TryAgain'); ?>
726 726
                                                         </label>
727 727
                                                     </p>
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
                                                             <div class="checkbox">
775 775
                                                                 <p>
776 776
                                                                     <label>
777
-                                                                        <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
777
+                                                                        <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
778 778
                                                                         <?php echo get_lang('TryAgain'); ?>
779 779
                                                                     </label>
780 780
                                                                 </p>
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
                                                 <div class="checkbox">
840 840
                                                     <p>
841 841
                                                         <label>
842
-                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
842
+                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
843 843
                                                             <?php echo get_lang('TryAgain'); ?>
844 844
                                                         </label>
845 845
                                                     </p>
@@ -879,12 +879,12 @@  discard block
 block discarded – undo
879 879
                                         <input class="form-control" type="text" name="reponse[<?php echo $i; ?>]" value="<?php echo Security::remove_XSS($responseValue); ?>" />
880 880
                                     </td>
881 881
                                     <?php
882
-                                    $form = new FormValidator('form_' . $i);
882
+                                    $form = new FormValidator('form_'.$i);
883 883
                                     $config = array(
884 884
                                         'ToolbarSet' => 'TestProposedAnswer',
885 885
                                         'cols-size' => [0, 12, 0]
886 886
                                     );
887
-                                    $form->addHtmlEditor('comment[' . $i . ']', null, false, false, $config);
887
+                                    $form->addHtmlEditor('comment['.$i.']', null, false, false, $config);
888 888
                                     $renderer = $form->defaultRenderer();
889 889
                                     $form_template = '{content}';
890 890
                                     $renderer->setFormTemplate($form_template);
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
                                         {element}';
894 894
                                     $renderer->setElementTemplate($element_template);
895 895
 
896
-                                    $form->setDefaults(array('comment[' . $i . ']' => $commentValue));
896
+                                    $form->setDefaults(array('comment['.$i.']' => $commentValue));
897 897
                                     $return = $form->return_form();
898 898
                                     ?>
899 899
                                     <td colspan="2" align="left" ><?php echo $return; ?></td>
@@ -932,36 +932,36 @@  discard block
 block discarded – undo
932 932
                                 $selected = 'selected="selected"';
933 933
                                 $isSelected = true;
934 934
                             }
935
-                            $option_lp.='<option value="' . $id . '" ' . $selected . '>' . $details['lp_name'] . '</option>';
935
+                            $option_lp .= '<option value="'.$id.'" '.$selected.'>'.$details['lp_name'].'</option>';
936 936
                         }
937 937
 
938 938
                         if ($isSelected) {
939
-                            $option_lp = '<option value="0">' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
939
+                            $option_lp = '<option value="0">'.get_lang('SelectTargetLP').'</option>'.$option_lp;
940 940
                         } else {
941
-                            $option_lp = '<option value="0" selected="selected" >' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
941
+                            $option_lp = '<option value="0" selected="selected" >'.get_lang('SelectTargetLP').'</option>'.$option_lp;
942 942
                         }
943 943
 
944 944
                         // Feedback SELECT
945 945
                         $question_list = $objExercise->selectQuestionList();
946 946
                         $option_feed = '';
947
-                        $option_feed.='<option value="0">' . get_lang('SelectTargetQuestion') . '</option>';
947
+                        $option_feed .= '<option value="0">'.get_lang('SelectTargetQuestion').'</option>';
948 948
                         $details = isset($details) ? $details : null;
949 949
                         $id = isset($id) ? $id : 0;
950 950
                         $selectQuestionNoError = isset($selectQuestionNoError) ? $selectQuestionNoError : null;
951 951
                         foreach ($question_list as $key => $questionid) {
952 952
                             $selected = '';
953 953
                             $question = Question::read($questionid);
954
-                            $val = 'Q' . $key . ' :' . substrwords($question->selectTitle(), ICON_SIZE_SMALL);
954
+                            $val = 'Q'.$key.' :'.substrwords($question->selectTitle(), ICON_SIZE_SMALL);
955 955
                             $select_lp_id[$id] = $details['lp_name'];
956 956
                             if ($questionid == $selectQuestionNoError) {
957 957
                                 $selected = 'selected="selected"';
958 958
                             }
959
-                            $option_feed.='<option value="' . $questionid . '" ' . $selected . ' >' . $val . '</option>';
959
+                            $option_feed .= '<option value="'.$questionid.'" '.$selected.' >'.$val.'</option>';
960 960
                         }
961 961
                         if ($selectQuestionNoError == -1) {
962
-                            $option_feed.='<option value="-1" selected="selected" >' . get_lang('ExitTest') . '</option>';
962
+                            $option_feed .= '<option value="-1" selected="selected" >'.get_lang('ExitTest').'</option>';
963 963
                         } else {
964
-                            $option_feed.='<option value="-1">' . get_lang('ExitTest') . '</option>';
964
+                            $option_feed .= '<option value="-1">'.get_lang('ExitTest').'</option>';
965 965
                         }
966 966
 
967 967
                         if ($answerType == HOT_SPOT_DELINEATION) {
@@ -1052,6 +1052,6 @@  discard block
 block discarded – undo
1052 1052
     </script>
1053 1053
     <?php
1054 1054
     if ($debug > 0) {
1055
-        echo str_repeat('&nbsp;', 0) . '$modifyAnswers was set - end' . "<br />\n";
1055
+        echo str_repeat('&nbsp;', 0).'$modifyAnswers was set - end'."<br />\n";
1056 1056
     }
1057 1057
 }
Please login to merge, or discard this 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();
@@ -669,12 +670,15 @@  discard block
 block discarded – undo
669 670
                                 if ($_SESSION['tmp_answers']['hotspot_type'][$i] == 'delineation') {
670 671
                                     for ($k = 1; $k <= 100; $k++) {
671 672
                                         $selected1 = $selected2 = $selected3 = '';
672
-                                        if ($k == $threadhold1[$i])
673
-                                            $selected1 = 'selected="selected"';
674
-                                        if ($k == $threadhold2[$i])
675
-                                            $selected2 = 'selected="selected"';
676
-                                        if ($k == $threadhold3[$i])
677
-                                            $selected3 = 'selected="selected"';
673
+                                        if ($k == $threadhold1[$i]) {
674
+                                                                                    $selected1 = 'selected="selected"';
675
+                                        }
676
+                                        if ($k == $threadhold2[$i]) {
677
+                                                                                    $selected2 = 'selected="selected"';
678
+                                        }
679
+                                        if ($k == $threadhold3[$i]) {
680
+                                                                                    $selected3 = 'selected="selected"';
681
+                                        }
678 682
                                         $option1.='<option ' . $selected1 . ' >' . $k . ' % </option>';
679 683
                                         $option2.='<option ' . $selected2 . ' >' . $k . ' % </option>';
680 684
                                         $option3.='<option ' . $selected3 . '>' . $k . ' %</option>';
@@ -721,7 +725,10 @@  discard block
 block discarded – undo
721 725
                                                 <div class="checkbox">
722 726
                                                     <p>
723 727
                                                         <label>
724
-                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]"  <?php if ($try[$i] == 1) echo'checked'; ?> />
728
+                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]"  <?php if ($try[$i] == 1) {
729
+    echo'checked';
730
+}
731
+?> />
725 732
                                                             <?php echo get_lang('TryAgain'); ?>
726 733
                                                         </label>
727 734
                                                     </p>
@@ -774,7 +781,10 @@  discard block
 block discarded – undo
774 781
                                                             <div class="checkbox">
775 782
                                                                 <p>
776 783
                                                                     <label>
777
-                                                                        <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
784
+                                                                        <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) {
785
+    echo'checked';
786
+}
787
+?> />
778 788
                                                                         <?php echo get_lang('TryAgain'); ?>
779 789
                                                                     </label>
780 790
                                                                 </p>
@@ -813,7 +823,10 @@  discard block
 block discarded – undo
813 823
                                             <th ><?php echo get_lang('OAR'); ?>*</th>
814 824
                                             <?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?>
815 825
                                                 <th colspan="2" ><?php echo get_lang('Comment'); ?></th>
816
-                                                <th ><?php if ($answerType == HOT_SPOT_DELINEATION) echo get_lang('Scenario'); ?></th>
826
+                                                <th ><?php if ($answerType == HOT_SPOT_DELINEATION) {
827
+    echo get_lang('Scenario');
828
+}
829
+?></th>
817 830
                                             <?php } else { ?>
818 831
                                                 <th colspan="3" ><?php echo get_lang('Comment'); ?></th>
819 832
                                             <?php } ?>
@@ -839,7 +852,10 @@  discard block
 block discarded – undo
839 852
                                                 <div class="checkbox">
840 853
                                                     <p>
841 854
                                                         <label>
842
-                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
855
+                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) {
856
+    echo'checked';
857
+}
858
+?> />
843 859
                                                             <?php echo get_lang('TryAgain'); ?>
844 860
                                                         </label>
845 861
                                                     </p>
@@ -988,7 +1004,10 @@  discard block
 block discarded – undo
988 1004
                                         <div class="checkbox">
989 1005
                                             <p>
990 1006
                                                 <label>
991
-                                                    <input type="checkbox" class="checkbox" name="try_noerror" <?php if ($try_noerror == 1) echo'checked'; ?> />
1007
+                                                    <input type="checkbox" class="checkbox" name="try_noerror" <?php if ($try_noerror == 1) {
1008
+    echo'checked';
1009
+}
1010
+?> />
992 1011
                                                     <?php echo get_lang('TryAgain'); ?>
993 1012
                                                 </label>
994 1013
                                             </p>
Please login to merge, or discard this patch.
main/exercice/global_multiple_answer.class.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -34,18 +34,18 @@  discard block
 block discarded – undo
34 34
         $html = '<table class="data_table">
35 35
                 <tr>
36 36
                     <th width="10px">
37
-                        ' . get_lang('Number') . '
37
+                        ' . get_lang('Number').'
38 38
                     </th>
39 39
                     <th width="10px">
40
-                        ' . get_lang('True') . '
40
+                        ' . get_lang('True').'
41 41
                     </th>
42 42
                     <th width="50%">
43
-                        ' . get_lang('Answer') . '
43
+                        ' . get_lang('Answer').'
44 44
                     </th>';
45 45
 
46
-        $html .='<th>' . get_lang('Comment') . '</th>';
47
-        $html .='</tr>';
48
-        $form->addElement('label', get_lang('Answers') . '<br /> <img src="../img/fill_field.png">', $html);
46
+        $html .= '<th>'.get_lang('Comment').'</th>';
47
+        $html .= '</tr>';
48
+        $form->addElement('label', get_lang('Answers').'<br /> <img src="../img/fill_field.png">', $html);
49 49
         $defaults = array();
50 50
         $correct = 0;
51 51
         $answer = false;
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
         for ($i = 1; $i <= $nb_answers; ++$i) {
78 78
             /* si la reponse est de type objet */
79 79
             if (is_object($answer)) {
80
-                $defaults['answer[' . $i . ']'] = $answer->answer[$i];
81
-                $defaults['comment[' . $i . ']'] = $answer->comment[$i];
82
-                $defaults['correct[' . $i . ']'] = $answer->correct[$i];
80
+                $defaults['answer['.$i.']'] = $answer->answer[$i];
81
+                $defaults['comment['.$i.']'] = $answer->comment[$i];
82
+                $defaults['correct['.$i.']'] = $answer->correct[$i];
83 83
 
84 84
                 // start
85 85
                 $scoreA = $answer->weighting[$i];
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
             $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'comment['.$i.']');
102 102
             //$renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'weighting['.$i.']');
103 103
 
104
-            $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"');
104
+            $answer_number = $form->addElement('text', 'counter['.$i.']', null, 'value="'.$i.'"');
105 105
             $answer_number->freeze();
106 106
 
107
-            $form->addElement('checkbox', 'correct[' . $i . ']', null, null, 'class="checkbox"');
108
-            $boxes_names[] = 'correct[' . $i . ']';
107
+            $form->addElement('checkbox', 'correct['.$i.']', null, null, 'class="checkbox"');
108
+            $boxes_names[] = 'correct['.$i.']';
109 109
 
110
-            $form->addElement('html_editor', 'answer[' . $i . ']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
111
-            $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required');
110
+            $form->addElement('html_editor', 'answer['.$i.']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
111
+            $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required');
112 112
 
113
-            $form->addElement('html_editor', 'comment[' . $i . ']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
113
+            $form->addElement('html_editor', 'comment['.$i.']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
114 114
 
115 115
             $form->addElement('html', '</tr>');
116 116
         }
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
         // Reponses correctes
177 177
         $nbr_corrects = 0;
178 178
         for ($i = 1; $i <= $nb_answers; $i++) {
179
-            $goodAnswer = trim($form->getSubmitValue('correct[' . $i . ']'));
179
+            $goodAnswer = trim($form->getSubmitValue('correct['.$i.']'));
180 180
             if ($goodAnswer) {
181 181
                 $nbr_corrects++;
182 182
             }
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
         $test = $form->getSubmitValue('pts');
196 196
 
197 197
         for ($i = 1; $i <= $nb_answers; $i++) {
198
-            $answer = trim($form->getSubmitValue('answer[' . $i . ']'));
199
-            $comment = trim($form->getSubmitValue('comment[' . $i . ']'));
200
-            $goodAnswer = trim($form->getSubmitValue('correct[' . $i . ']'));
198
+            $answer = trim($form->getSubmitValue('answer['.$i.']'));
199
+            $comment = trim($form->getSubmitValue('comment['.$i.']'));
200
+            $goodAnswer = trim($form->getSubmitValue('correct['.$i.']'));
201 201
 
202 202
             if ($goodAnswer) {
203 203
                 $weighting = abs($answer_score);
@@ -225,12 +225,12 @@  discard block
 block discarded – undo
225 225
         $score = null
226 226
     ) {
227 227
         $header = parent::return_header($feedback_type, $counter, $score);
228
-        $header .= '<table class="'.$this->question_table_class .'">
228
+        $header .= '<table class="'.$this->question_table_class.'">
229 229
         <tr>
230
-            <th>' . get_lang("Choice") . '</th>
231
-            <th>' . get_lang("ExpectedChoice") . '</th>
232
-            <th>' . get_lang("Answer") . '</th>';
233
-        $header .= '<th>' . get_lang("Comment") . '</th>';
230
+            <th>' . get_lang("Choice").'</th>
231
+            <th>' . get_lang("ExpectedChoice").'</th>
232
+            <th>' . get_lang("Answer").'</th>';
233
+        $header .= '<th>'.get_lang("Comment").'</th>';
234 234
         $header .= '</tr>';
235 235
 
236 236
         return $header;
Please login to merge, or discard this patch.
main/exercice/hotspot_savescore.inc.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,15 +17,15 @@
 block discarded – undo
17 17
 $answerOrderId = count($_SESSION['exerciseResult'][$questionId]['ids'])+1;
18 18
 if ($_GET['answerId'] == "0") // click is NOT on a hotspot
19 19
 {
20
-	$hit = 0;
21
-	$answerId = NULL;
20
+    $hit = 0;
21
+    $answerId = NULL;
22 22
 }
23 23
 else // user clicked ON a hotspot
24 24
 {
25
-	$hit = 1;
26
-	$answerId = api_substr($_GET['answerId'],22,2);
27
-	// Save into session
28
-	$_SESSION['exerciseResult'][$questionId][$answerId] = $hit;
25
+    $hit = 1;
26
+    $answerId = api_substr($_GET['answerId'],22,2);
27
+    // Save into session
28
+    $_SESSION['exerciseResult'][$questionId][$answerId] = $hit;
29 29
 }
30 30
 //round-up the coordinates
31 31
 $coords = explode('/',$coordinates);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 $objExcercise = $_SESSION['objExercise'];
15 15
 $exerciseId   = $objExcercise->selectId();
16 16
 // Save clicking order
17
-$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['ids'])+1;
17
+$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['ids']) + 1;
18 18
 if ($_GET['answerId'] == "0") // click is NOT on a hotspot
19 19
 {
20 20
 	$hit = 0;
@@ -23,18 +23,18 @@  discard block
 block discarded – undo
23 23
 else // user clicked ON a hotspot
24 24
 {
25 25
 	$hit = 1;
26
-	$answerId = api_substr($_GET['answerId'],22,2);
26
+	$answerId = api_substr($_GET['answerId'], 22, 2);
27 27
 	// Save into session
28 28
 	$_SESSION['exerciseResult'][$questionId][$answerId] = $hit;
29 29
 }
30 30
 //round-up the coordinates
31
-$coords = explode('/',$coordinates);
31
+$coords = explode('/', $coordinates);
32 32
 $coordinates = '';
33 33
 foreach ($coords as $coord) {
34
-    list($x,$y) = explode(';',$coord);
34
+    list($x, $y) = explode(';', $coord);
35 35
     $coordinates .= round($x).';'.round($y).'/';
36 36
 }
37
-$coordinates = substr($coordinates,0,-1);
37
+$coordinates = substr($coordinates, 0, -1);
38 38
 
39 39
 $TBL_TRACK_E_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
40 40
 // Save into db
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     'quiz_id' => $exerciseId,
45 45
     'question_id' => $questionId,
46 46
     'answer_id' =>  $answerId,
47
-    'correct' => $hit ,
47
+    'correct' => $hit,
48 48
     'coordinate' => $coordinates
49 49
 ];
50 50
 // Save insert id into session if users changes answer.
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,12 +15,13 @@
 block discarded – undo
15 15
 $exerciseId   = $objExcercise->selectId();
16 16
 // Save clicking order
17 17
 $answerOrderId = count($_SESSION['exerciseResult'][$questionId]['ids'])+1;
18
-if ($_GET['answerId'] == "0") // click is NOT on a hotspot
18
+if ($_GET['answerId'] == "0") {
19
+    // click is NOT on a hotspot
19 20
 {
20 21
 	$hit = 0;
21
-	$answerId = NULL;
22 22
 }
23
-else // user clicked ON a hotspot
23
+	$answerId = NULL;
24
+} else // user clicked ON a hotspot
24 25
 {
25 26
 	$hit = 1;
26 27
 	$answerId = api_substr($_GET['answerId'],22,2);
Please login to merge, or discard this patch.