Passed
Push — 1.10.x ( 07da6d...08890a )
by Yannick
83:27 queued 37:15
created
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 (isset($try[$i]) && $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) {
@@ -521,11 +521,11 @@  discard block
 block discarded – undo
521 521
     }
522 522
 
523 523
     if ($debug > 0) {
524
-        echo str_repeat('&nbsp;', 2) . '$usedInSeveralExercises is untrue' . "<br />\n";
524
+        echo str_repeat('&nbsp;', 2).'$usedInSeveralExercises is untrue'."<br />\n";
525 525
     }
526 526
 
527 527
     if ($debug > 0) {
528
-        echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n";
528
+        echo str_repeat('&nbsp;', 4).'$answerType is HOT_SPOT'."<br />\n";
529 529
     }
530 530
 
531 531
     if ($answerType == HOT_SPOT_DELINEATION) {
@@ -563,13 +563,13 @@  discard block
 block discarded – undo
563 563
         );
564 564
     }
565 565
 
566
-    Display::tag('h3', get_lang('Question') . ": " . $questionName . ' <img src="../img/info3.gif" title="' . strip_tags(get_lang('HotspotChoose')) . '" alt="' . strip_tags(get_lang('HotspotChoose')) . '" />');
566
+    Display::tag('h3', get_lang('Question').": ".$questionName.' <img src="../img/info3.gif" title="'.strip_tags(get_lang('HotspotChoose')).'" alt="'.strip_tags(get_lang('HotspotChoose')).'" />');
567 567
 
568 568
     if (!empty($msgErr)) {
569 569
         Display::display_normal_message($msgErr); //main API
570 570
     }
571 571
 
572
-    $hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&hotspotadmin=' . $modifyAnswers . '&exerciseId=' . $exerciseId . '&' . api_get_cidreq();
572
+    $hotspot_admin_url = api_get_path(WEB_CODE_PATH).'exercice/admin.php?'.api_get_cidreq().'&hotspotadmin='.$modifyAnswers.'&exerciseId='.$exerciseId.'&'.api_get_cidreq();
573 573
     ?>
574 574
     <form method="post" action="<?php echo $hotspot_admin_url; ?>" class="form-horizontal" id="frm_exercise" name="frm_exercise">
575 575
         <div class="form-group">
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
                                 <th><?php echo get_lang('Comment'); ?></th>
609 609
                                 <?php
610 610
                                 if ($answerType == HOT_SPOT_DELINEATION) {
611
-                                    echo '<th >' . get_lang('Scenario') . '</th>';
611
+                                    echo '<th >'.get_lang('Scenario').'</th>';
612 612
                                 }
613 613
                                 ?>
614 614
                                 <?php
@@ -640,36 +640,36 @@  discard block
 block discarded – undo
640 640
                                         $isSelected = true;
641 641
                                         $selected = 'selected="selected"';
642 642
                                     }
643
-                                    $option_lp.='<option value="' . $id . '" ' . $selected . '>' . $details['lp_name'] . '</option>';
643
+                                    $option_lp .= '<option value="'.$id.'" '.$selected.'>'.$details['lp_name'].'</option>';
644 644
                                 }
645 645
 
646 646
                                 if ($isSelected) {
647
-                                    $option_lp = '<option value="0">' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
647
+                                    $option_lp = '<option value="0">'.get_lang('SelectTargetLP').'</option>'.$option_lp;
648 648
                                 } else {
649
-                                    $option_lp = '<option value="0" selected="selected" >' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
649
+                                    $option_lp = '<option value="0" selected="selected" >'.get_lang('SelectTargetLP').'</option>'.$option_lp;
650 650
                                 }
651 651
 
652 652
                                 // Feedback SELECT
653 653
                                 $question_list = $objExercise->selectQuestionList();
654 654
                                 $option_feed = '';
655
-                                $option_feed.='<option value="0">' . get_lang('SelectTargetQuestion') . '</option>';
655
+                                $option_feed .= '<option value="0">'.get_lang('SelectTargetQuestion').'</option>';
656 656
 
657 657
                                 foreach ($question_list as $key => $questionid) {
658 658
                                     $selected = '';
659 659
                                     $question = Question::read($questionid);
660
-                                    $val = 'Q' . $key . ' :' . substrwords($question->selectTitle(), ICON_SIZE_SMALL);
660
+                                    $val = 'Q'.$key.' :'.substrwords($question->selectTitle(), ICON_SIZE_SMALL);
661 661
 
662 662
                                     if (isset($select_question[$i]) && $questionid == $select_question[$i]) {
663 663
                                         $selected = 'selected="selected"';
664 664
                                     }
665 665
 
666
-                                    $option_feed.='<option value="' . $questionid . '" ' . $selected . ' >' . $val . '</option>';
666
+                                    $option_feed .= '<option value="'.$questionid.'" '.$selected.' >'.$val.'</option>';
667 667
                                 }
668 668
 
669 669
                                 if (isset($select_question[$i]) && $select_question[$i] == -1) {
670
-                                    $option_feed .= '<option value="-1" selected="selected" >' . get_lang('ExitTest') . '</option>';
670
+                                    $option_feed .= '<option value="-1" selected="selected" >'.get_lang('ExitTest').'</option>';
671 671
                                 } else {
672
-                                    $option_feed .= '<option value="-1">' . get_lang('ExitTest') . '</option>';
672
+                                    $option_feed .= '<option value="-1">'.get_lang('ExitTest').'</option>';
673 673
                                 }
674 674
 
675 675
                                 //-------- IF it is a delineation
@@ -685,9 +685,9 @@  discard block
 block discarded – undo
685 685
                                             $selected2 = 'selected="selected"';
686 686
                                         if ($k == $threadhold3[$i])
687 687
                                             $selected3 = 'selected="selected"';
688
-                                        $option1.='<option ' . $selected1 . ' >' . $k . ' % </option>';
689
-                                        $option2.='<option ' . $selected2 . ' >' . $k . ' % </option>';
690
-                                        $option3.='<option ' . $selected3 . '>' . $k . ' %</option>';
688
+                                        $option1 .= '<option '.$selected1.' >'.$k.' % </option>';
689
+                                        $option2 .= '<option '.$selected2.' >'.$k.' % </option>';
690
+                                        $option3 .= '<option '.$selected3.'>'.$k.' %</option>';
691 691
                                     }
692 692
                                     ?>
693 693
                                     <tr>
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
                                                 <div class="checkbox">
732 732
                                                     <p>
733 733
                                                         <label>
734
-                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]"  <?php if ($try[$i] == 1) echo'checked'; ?> />
734
+                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]"  <?php if ($try[$i] == 1) echo'checked'; ?> />
735 735
                                                             <?php echo get_lang('TryAgain'); ?>
736 736
                                                         </label>
737 737
                                                     </p>
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
                                                             <div class="checkbox">
785 785
                                                                 <p>
786 786
                                                                     <label>
787
-                                                                        <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
787
+                                                                        <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
788 788
                                                                         <?php echo get_lang('TryAgain'); ?>
789 789
                                                                     </label>
790 790
                                                                 </p>
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
                                                 <div class="checkbox">
850 850
                                                     <p>
851 851
                                                         <label>
852
-                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) echo'checked'; ?> />
852
+                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) echo'checked'; ?> />
853 853
                                                             <?php echo get_lang('TryAgain'); ?>
854 854
                                                         </label>
855 855
                                                     </p>
@@ -889,12 +889,12 @@  discard block
 block discarded – undo
889 889
                                         <input class="form-control" type="text" name="reponse[<?php echo $i; ?>]" value="<?php echo Security::remove_XSS($responseValue); ?>" />
890 890
                                     </td>
891 891
                                     <?php
892
-                                    $form = new FormValidator('form_' . $i);
892
+                                    $form = new FormValidator('form_'.$i);
893 893
                                     $config = array(
894 894
                                         'ToolbarSet' => 'TestProposedAnswer',
895 895
                                         'cols-size' => [0, 12, 0]
896 896
                                     );
897
-                                    $form->addHtmlEditor('comment[' . $i . ']', null, false, false, $config);
897
+                                    $form->addHtmlEditor('comment['.$i.']', null, false, false, $config);
898 898
                                     $renderer = $form->defaultRenderer();
899 899
                                     $form_template = '{content}';
900 900
                                     $renderer->setFormTemplate($form_template);
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
                                         {element}';
904 904
                                     $renderer->setElementTemplate($element_template);
905 905
 
906
-                                    $form->setDefaults(array('comment[' . $i . ']' => $commentValue));
906
+                                    $form->setDefaults(array('comment['.$i.']' => $commentValue));
907 907
                                     $return = $form->return_form();
908 908
                                     ?>
909 909
                                     <td colspan="2" align="left" ><?php echo $return; ?></td>
@@ -942,36 +942,36 @@  discard block
 block discarded – undo
942 942
                                 $selected = 'selected="selected"';
943 943
                                 $isSelected = true;
944 944
                             }
945
-                            $option_lp.='<option value="' . $id . '" ' . $selected . '>' . $details['lp_name'] . '</option>';
945
+                            $option_lp .= '<option value="'.$id.'" '.$selected.'>'.$details['lp_name'].'</option>';
946 946
                         }
947 947
 
948 948
                         if ($isSelected) {
949
-                            $option_lp = '<option value="0">' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
949
+                            $option_lp = '<option value="0">'.get_lang('SelectTargetLP').'</option>'.$option_lp;
950 950
                         } else {
951
-                            $option_lp = '<option value="0" selected="selected" >' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
951
+                            $option_lp = '<option value="0" selected="selected" >'.get_lang('SelectTargetLP').'</option>'.$option_lp;
952 952
                         }
953 953
 
954 954
                         // Feedback SELECT
955 955
                         $question_list = $objExercise->selectQuestionList();
956 956
                         $option_feed = '';
957
-                        $option_feed.='<option value="0">' . get_lang('SelectTargetQuestion') . '</option>';
957
+                        $option_feed .= '<option value="0">'.get_lang('SelectTargetQuestion').'</option>';
958 958
                         $details = isset($details) ? $details : null;
959 959
                         $id = isset($id) ? $id : 0;
960 960
                         $selectQuestionNoError = isset($selectQuestionNoError) ? $selectQuestionNoError : null;
961 961
                         foreach ($question_list as $key => $questionid) {
962 962
                             $selected = '';
963 963
                             $question = Question::read($questionid);
964
-                            $val = 'Q' . $key . ' :' . substrwords($question->selectTitle(), ICON_SIZE_SMALL);
964
+                            $val = 'Q'.$key.' :'.substrwords($question->selectTitle(), ICON_SIZE_SMALL);
965 965
                             $select_lp_id[$id] = $details['lp_name'];
966 966
                             if ($questionid == $selectQuestionNoError) {
967 967
                                 $selected = 'selected="selected"';
968 968
                             }
969
-                            $option_feed.='<option value="' . $questionid . '" ' . $selected . ' >' . $val . '</option>';
969
+                            $option_feed .= '<option value="'.$questionid.'" '.$selected.' >'.$val.'</option>';
970 970
                         }
971 971
                         if ($selectQuestionNoError == -1) {
972
-                            $option_feed.='<option value="-1" selected="selected" >' . get_lang('ExitTest') . '</option>';
972
+                            $option_feed .= '<option value="-1" selected="selected" >'.get_lang('ExitTest').'</option>';
973 973
                         } else {
974
-                            $option_feed.='<option value="-1">' . get_lang('ExitTest') . '</option>';
974
+                            $option_feed .= '<option value="-1">'.get_lang('ExitTest').'</option>';
975 975
                         }
976 976
 
977 977
                         if ($answerType == HOT_SPOT_DELINEATION) {
@@ -1062,6 +1062,6 @@  discard block
 block discarded – undo
1062 1062
     </script>
1063 1063
     <?php
1064 1064
     if ($debug > 0) {
1065
-        echo str_repeat('&nbsp;', 0) . '$modifyAnswers was set - end' . "<br />\n";
1065
+        echo str_repeat('&nbsp;', 0).'$modifyAnswers was set - end'."<br />\n";
1066 1066
     }
1067 1067
 }
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();
@@ -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/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.
main/exercice/exercise_submit_modal.php 2 patches
Indentation   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
 $learnpath_id = 0;
42 42
 
43 43
 if (empty($learnpath_id)) {
44
-	$learnpath_id = Security::remove_XSS($_REQUEST['learnpath_id']);
44
+    $learnpath_id = Security::remove_XSS($_REQUEST['learnpath_id']);
45 45
 }
46 46
 
47 47
 $learnpath_item_id = 0;
48 48
 
49 49
 if (empty($learnpath_item_id)) {
50
-	$learnpath_item_id = Security::remove_XSS($_REQUEST['learnpath_item_id']);
50
+    $learnpath_item_id = Security::remove_XSS($_REQUEST['learnpath_item_id']);
51 51
 }
52 52
 
53 53
 $_SESSION['hotspot_coord']=array();
@@ -68,12 +68,12 @@  discard block
 block discarded – undo
68 68
 $coords = explode('/', $_GET['hotspot']);
69 69
 $user_array = '';
70 70
 if (is_array($coords) && count($coords) > 0) {
71
-	foreach ($coords as $coord) {
71
+    foreach ($coords as $coord) {
72 72
         if (!empty($coord)) {
73 73
             list($x, $y) = explode(';', $coord);
74 74
             $user_array .= round($x).';'.round($y).'/';
75 75
         }
76
-	}
76
+    }
77 77
 }
78 78
 
79 79
 $choice_value = '';
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 // Getting the options by js
88 88
 if (empty($choice_value)) {
89 89
 
90
-	echo "<script>
90
+    echo "<script>
91 91
 		// this works for only radio buttons
92 92
 		var f = self.parent.window.document.frm_exercise;
93 93
 		var choice_js='';
@@ -116,12 +116,12 @@  discard block
 block discarded – undo
116 116
 		}
117 117
 
118 118
 	";
119
-	// IMPORTANT
120
-	//this is the real redirect function
121
-	//echo 'window.location.href = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";';
119
+    // IMPORTANT
120
+    //this is the real redirect function
121
+    //echo 'window.location.href = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";';
122 122
     echo ' url = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";';
123 123
     echo "$('#global-modal .modal-body').load(url);";
124
-	echo '</script>';
124
+    echo '</script>';
125 125
 
126 126
     exit;
127 127
 }
@@ -174,12 +174,12 @@  discard block
 block discarded – undo
174 174
 
175 175
 // creates a temporary Question object
176 176
 if (in_array($questionid, $questionList)) {
177
-	$objQuestionTmp 	= Question :: read($questionid);
178
-	$questionName		=$objQuestionTmp->selectTitle();
179
-	$questionDescription=$objQuestionTmp->selectDescription();
180
-	$questionWeighting	=$objQuestionTmp->selectWeighting();
181
-	$answerType			=$objQuestionTmp->selectType();
182
-	$quesId				=$objQuestionTmp->selectId(); //added by priya saini
177
+    $objQuestionTmp 	= Question :: read($questionid);
178
+    $questionName		=$objQuestionTmp->selectTitle();
179
+    $questionDescription=$objQuestionTmp->selectDescription();
180
+    $questionWeighting	=$objQuestionTmp->selectWeighting();
181
+    $answerType			=$objQuestionTmp->selectType();
182
+    $quesId				=$objQuestionTmp->selectId(); //added by priya saini
183 183
 }
184 184
 
185 185
 $objAnswerTmp=new Answer($questionid);
@@ -202,43 +202,43 @@  discard block
 block discarded – undo
202 202
 $totalScore = 0;
203 203
 
204 204
 if (!empty($choice_value)) {
205
-	for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
206
-		$answer            = $objAnswerTmp->selectAnswer($answerId);
207
-		$answerComment     = $objAnswerTmp->selectComment($answerId);
208
-		$answerDestination = $objAnswerTmp->selectDestination($answerId);
209
-
210
-		$answerCorrect     = $objAnswerTmp->isCorrect($answerId);
211
-		$answerWeighting   = $objAnswerTmp->selectWeighting($answerId);
212
-		$numAnswer         = $objAnswerTmp->selectAutoId($answerId);
213
-
214
-		//delineation
215
-		$delineation_cord  = $objAnswerTmp->selectHotspotCoordinates(1);
216
-		$answer_delineation_destination=$objAnswerTmp->selectDestination(1);
205
+    for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
206
+        $answer            = $objAnswerTmp->selectAnswer($answerId);
207
+        $answerComment     = $objAnswerTmp->selectComment($answerId);
208
+        $answerDestination = $objAnswerTmp->selectDestination($answerId);
209
+
210
+        $answerCorrect     = $objAnswerTmp->isCorrect($answerId);
211
+        $answerWeighting   = $objAnswerTmp->selectWeighting($answerId);
212
+        $numAnswer         = $objAnswerTmp->selectAutoId($answerId);
213
+
214
+        //delineation
215
+        $delineation_cord  = $objAnswerTmp->selectHotspotCoordinates(1);
216
+        $answer_delineation_destination=$objAnswerTmp->selectDestination(1);
217 217
         if ($dbg_local>0) { error_log(__LINE__.' answerId: '.$answerId.'('.$answerType.') - user delineation_cord: '.$delineation_cord.' - $answer_delineation_destination: '.$answer_delineation_destination,0);}
218 218
 
219
-		switch($answerType) {
220
-			// for unique answer
221
-			case UNIQUE_ANSWER :
222
-				$studentChoice = ($choice_value == $numAnswer)?1:0;
223
-				if ($studentChoice) {
224
-					$questionScore	+=$answerWeighting;
225
-					$totalScore		+=$answerWeighting;
226
-					$newquestionList[]=$questionid;
227
-				}
228
-				break;
229
-			case HOT_SPOT_DELINEATION :
230
-			    $studentChoice=$choice[$answerId];
231
-				if ($studentChoice) {
232
-					$newquestionList[]=$questionid;
233
-				}
234
-				if ($answerId===1) {
235
-					$questionScore	+=$answerWeighting;
236
-					$totalScore		+=$answerWeighting;
237
-					$_SESSION['hotspot_coord'][1]	=$delineation_cord;
238
-					$_SESSION['hotspot_dest'][1]	=$answer_delineation_destination;
239
-				}
240
-				break;
241
-		}
219
+        switch($answerType) {
220
+            // for unique answer
221
+            case UNIQUE_ANSWER :
222
+                $studentChoice = ($choice_value == $numAnswer)?1:0;
223
+                if ($studentChoice) {
224
+                    $questionScore	+=$answerWeighting;
225
+                    $totalScore		+=$answerWeighting;
226
+                    $newquestionList[]=$questionid;
227
+                }
228
+                break;
229
+            case HOT_SPOT_DELINEATION :
230
+                $studentChoice=$choice[$answerId];
231
+                if ($studentChoice) {
232
+                    $newquestionList[]=$questionid;
233
+                }
234
+                if ($answerId===1) {
235
+                    $questionScore	+=$answerWeighting;
236
+                    $totalScore		+=$answerWeighting;
237
+                    $_SESSION['hotspot_coord'][1]	=$delineation_cord;
238
+                    $_SESSION['hotspot_dest'][1]	=$answer_delineation_destination;
239
+                }
240
+                break;
241
+        }
242 242
 
243 243
 
244 244
         if ($answerType == UNIQUE_ANSWER || $answerType == MULTIPLE_ANSWER) {
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
                         $lp_hotspot=$destination_items[2];
336 336
                         $select_question_hotspot=$destination_items[3];
337 337
                         $url_hotspot=$destination_items[4];
338
-                         //echo 'show the feedback';
338
+                            //echo 'show the feedback';
339 339
                     }
340 340
                 } elseif($answerId>1) {
341 341
                     if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') {
@@ -392,41 +392,41 @@  discard block
 block discarded – undo
392 392
                 //we send the error
393 393
             }
394 394
         }
395
-	}
395
+    }
396 396
 
397
-	if ($overlap_color) {
398
-		$overlap_color='green';
397
+    if ($overlap_color) {
398
+        $overlap_color='green';
399 399
     } else {
400
-		$overlap_color='red';
400
+        $overlap_color='red';
401 401
     }
402
-	if ($missing_color) {
403
-		$missing_color='green';
402
+    if ($missing_color) {
403
+        $missing_color='green';
404 404
     } else {
405
-		$missing_color='red';
405
+        $missing_color='red';
406 406
     }
407
-	if ($excess_color) {
408
-		$excess_color='green';
407
+    if ($excess_color) {
408
+        $excess_color='green';
409 409
     } else {
410
-		$excess_color='red';
410
+        $excess_color='red';
411 411
     }
412 412
 
413 413
     if (!is_numeric($final_overlap)) {
414
-    	$final_overlap = 0;
414
+        $final_overlap = 0;
415 415
     }
416 416
 
417 417
     if (!is_numeric($final_missing)) {
418
-    	$final_missing = 0;
418
+        $final_missing = 0;
419 419
     }
420 420
     if (!is_numeric($final_excess)) {
421
-    	$final_excess = 0;
421
+        $final_excess = 0;
422 422
     }
423 423
 
424 424
     if ($final_excess>100) {
425
-    	$final_excess = 100;
425
+        $final_excess = 100;
426 426
     }
427 427
 
428 428
 
429
-	$table_resume = '<table class="data_table" >
429
+    $table_resume = '<table class="data_table" >
430 430
 	<tr class="row_odd" >
431 431
 		<td></td>
432 432
 		<td ><b>'.get_lang('Requirements').'</b></td>
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 		<td><div style="color:'.$missing_color.'">'.(($final_missing < 0)?0:intval($final_missing)).'</div></td>
452 452
 	</tr>
453 453
 	</table>';
454
-	//var_dump($final_overlap, $threadhold1 , $final_missing, $threadhold2 , $final_excess, $threadhold3);
454
+    //var_dump($final_overlap, $threadhold1 , $final_missing, $threadhold2 , $final_excess, $threadhold3);
455 455
 }
456 456
 $_SESSION['newquestionList'] = $newquestionList;
457 457
 
@@ -468,68 +468,68 @@  discard block
 block discarded – undo
468 468
 if ($answerType != HOT_SPOT_DELINEATION) {
469 469
     if (!empty($destination)) {
470 470
         $item_list = explode('@@',$destination);
471
-    	//print_R($item_list);
472
-    	$try = $item_list[0];
473
-    	$lp = $item_list[1];
474
-    	$destinationid= $item_list[2];
475
-    	$url=$item_list[3];
471
+        //print_R($item_list);
472
+        $try = $item_list[0];
473
+        $lp = $item_list[1];
474
+        $destinationid= $item_list[2];
475
+        $url=$item_list[3];
476 476
     }
477
-	$table_resume='';
477
+    $table_resume='';
478 478
 } else {
479
-		$try = $try_hotspot;
480
-		$lp = $lp_hotspot;
481
-		$destinationid= $select_question_hotspot;
482
-		$url=$url_hotspot;
483
-	if ($organs_at_risk_hit==0 && $wrong_results==false ) {
484
-		// no error = no oar and no wrong result for delineation
485
-		//show if no error
486
-		//echo 'no error';
487
-		$comment= $answerComment = $objAnswerTmp->selectComment($nbrAnswers);
488
-		$answerDestination		 = $objAnswerTmp->selectDestination($nbrAnswers);
489
-
490
-		//we send the error
491
-		$destination_items= explode('@@', $answerDestination);
492
-		$try=$destination_items[1];
493
-		$lp=$destination_items[2];
494
-		$destinationid=$destination_items[3];
495
-		$url=$destination_items[4];
496
-		$exerciseResult[$questionid] = 1;
497
-	} else {
498
-		$exerciseResult[$questionid] = 0;
499
-	}
479
+        $try = $try_hotspot;
480
+        $lp = $lp_hotspot;
481
+        $destinationid= $select_question_hotspot;
482
+        $url=$url_hotspot;
483
+    if ($organs_at_risk_hit==0 && $wrong_results==false ) {
484
+        // no error = no oar and no wrong result for delineation
485
+        //show if no error
486
+        //echo 'no error';
487
+        $comment= $answerComment = $objAnswerTmp->selectComment($nbrAnswers);
488
+        $answerDestination		 = $objAnswerTmp->selectDestination($nbrAnswers);
489
+
490
+        //we send the error
491
+        $destination_items= explode('@@', $answerDestination);
492
+        $try=$destination_items[1];
493
+        $lp=$destination_items[2];
494
+        $destinationid=$destination_items[3];
495
+        $url=$destination_items[4];
496
+        $exerciseResult[$questionid] = 1;
497
+    } else {
498
+        $exerciseResult[$questionid] = 0;
499
+    }
500 500
 }
501 501
 
502 502
 // the link to retry the question
503 503
 if (isset($try) && $try==1) {
504
-	$num_value_array= (array_keys($questionList, $questionid));
505
-	$links.= Display :: return_icon('reload.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />';
504
+    $num_value_array= (array_keys($questionList, $questionid));
505
+    $links.= Display :: return_icon('reload.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />';
506 506
 }
507 507
 
508 508
 // the link to theory (a learning path)
509 509
 if (!empty($lp)) {
510
-	$lp_url= api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp;
511
-	$list = new LearnpathList(api_get_user_id());
512
-	$flat_list = $list->get_flat_list();
513
-	$links.= Display :: return_icon('theory.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />';
510
+    $lp_url= api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp;
511
+    $list = new LearnpathList(api_get_user_id());
512
+    $flat_list = $list->get_flat_list();
513
+    $links.= Display :: return_icon('theory.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />';
514 514
 }
515 515
 $links.='<br />';
516 516
 
517 517
 // the link to an external website or link
518 518
 if (!empty($url)) {
519
-	$links.= Display :: return_icon('link.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />';
519
+    $links.= Display :: return_icon('link.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />';
520 520
 }
521 521
 
522 522
 // the link to finish the test
523 523
 if ($destinationid==-1) {
524
-	$links.= Display :: return_icon('finish.gif', '', array ('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />';
524
+    $links.= Display :: return_icon('finish.gif', '', array ('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />';
525 525
 } else {
526
-	// the link to other question
527
-	if (in_array($destinationid,$questionList)) {
528
-		$objQuestionTmp = Question :: read($destinationid);
529
-		$questionName=$objQuestionTmp->selectTitle();
530
-		$num_value_array= (array_keys($questionList, $destinationid));
531
-		$links.= Display :: return_icon('quiz.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />';
532
-	}
526
+    // the link to other question
527
+    if (in_array($destinationid,$questionList)) {
528
+        $objQuestionTmp = Question :: read($destinationid);
529
+        $questionName=$objQuestionTmp->selectTitle();
530
+        $num_value_array= (array_keys($questionList, $destinationid));
531
+        $links.= Display :: return_icon('quiz.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />';
532
+    }
533 533
 }
534 534
 
535 535
 echo '<script>
@@ -546,43 +546,43 @@  discard block
 block discarded – undo
546 546
 </script>';
547 547
 
548 548
 if ($links!='') {
549
-	/*echo '<div id="ModalContent" style="padding-bottom:30px;padding-top:10px;padding-left:20px;padding-right:20px;">
549
+    /*echo '<div id="ModalContent" style="padding-bottom:30px;padding-top:10px;padding-left:20px;padding-right:20px;">
550 550
     <a onclick="self.parent.tb_remove();" href="#" style="float:right; margin-top:-10px;">'.api_ucfirst(get_lang('Close')).'</a>';*/
551
-	echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>';
552
-
553
-	if ($answerType == HOT_SPOT_DELINEATION) {
554
-		if ($organs_at_risk_hit > 0) {
555
-			//$message='<p>'.get_lang('YourDelineation').'</p>';
556
-			//$message.=$table_resume;
557
-			$message.='<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />';
558
-			//if ($wrong_results) { }
559
-			$message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>';
560
-			$message.='<p>'.$comment.'</p>';
561
-		} else {
562
-			$message='<p>'.get_lang('YourDelineation').'</p>';
563
-			$message.=$table_resume;
564
-			$message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
565
-			$message.='<p>'.$comment.'</p>';
566
-		}
567
-		echo $message;
568
-	} else {
569
-		echo '<p>'.$comment.'</p>';
570
-	}
571
-	echo '<h3>'.$links.'</h3>';
572
-	echo '</div>';
573
-
574
-	$_SESSION['hot_spot_result']=$message;
575
-	$_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]);
576
-	//reseting the exerciseResult variable
577
-	Session::write('exerciseResult',$exerciseResult);
578
-
579
-	//save this variables just in case the exercise loads an LP with other exercise
580
-	$_SESSION['objExerciseExtra'.$exerciseId] 	 = $_SESSION['objExercise'];
581
-	$_SESSION['exerciseResultExtra'.$exerciseId] = $_SESSION['exerciseResult'];
582
-	$_SESSION['questionListExtra'.$exerciseId]	 = $_SESSION['questionList'];
551
+    echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>';
552
+
553
+    if ($answerType == HOT_SPOT_DELINEATION) {
554
+        if ($organs_at_risk_hit > 0) {
555
+            //$message='<p>'.get_lang('YourDelineation').'</p>';
556
+            //$message.=$table_resume;
557
+            $message.='<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />';
558
+            //if ($wrong_results) { }
559
+            $message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>';
560
+            $message.='<p>'.$comment.'</p>';
561
+        } else {
562
+            $message='<p>'.get_lang('YourDelineation').'</p>';
563
+            $message.=$table_resume;
564
+            $message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
565
+            $message.='<p>'.$comment.'</p>';
566
+        }
567
+        echo $message;
568
+    } else {
569
+        echo '<p>'.$comment.'</p>';
570
+    }
571
+    echo '<h3>'.$links.'</h3>';
572
+    echo '</div>';
573
+
574
+    $_SESSION['hot_spot_result']=$message;
575
+    $_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]);
576
+    //reseting the exerciseResult variable
577
+    Session::write('exerciseResult',$exerciseResult);
578
+
579
+    //save this variables just in case the exercise loads an LP with other exercise
580
+    $_SESSION['objExerciseExtra'.$exerciseId] 	 = $_SESSION['objExercise'];
581
+    $_SESSION['exerciseResultExtra'.$exerciseId] = $_SESSION['exerciseResult'];
582
+    $_SESSION['questionListExtra'.$exerciseId]	 = $_SESSION['questionList'];
583 583
 } else {
584
-	$questionNum++;
585
-	echo '<script>
584
+    $questionNum++;
585
+    echo '<script>
586 586
 			self.parent.window.location.href = "exercise_submit.php?exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'";
587 587
    			//self.parent.tb_remove();
588 588
  	 	</script>';
Please login to merge, or discard this patch.
Spacing   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 	$learnpath_item_id = Security::remove_XSS($_REQUEST['learnpath_item_id']);
51 51
 }
52 52
 
53
-$_SESSION['hotspot_coord']=array();
54
-$newquestionList= $_SESSION['newquestionList'];
55
-$questionList 	= $_SESSION['questionList'];
53
+$_SESSION['hotspot_coord'] = array();
54
+$newquestionList = $_SESSION['newquestionList'];
55
+$questionList = $_SESSION['questionList'];
56 56
 
57 57
 $exerciseId		= intval($_GET['exerciseId']);
58 58
 $exerciseType	= intval($_GET['exerciseType']);
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 
79 79
 $choice_value = '';
80 80
 
81
-$user_array = substr($user_array,0,-1);
81
+$user_array = substr($user_array, 0, -1);
82 82
 
83
-if (isset($_GET['choice'])){
83
+if (isset($_GET['choice'])) {
84 84
     $choice_value = intval($_GET['choice']);
85 85
 }
86 86
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 }
128 128
 
129 129
 $choice = array();
130
-$questionid= $questionList[$questionNum];
130
+$questionid = $questionList[$questionNum];
131 131
 // $choice_value => value of the user selection
132 132
 $choice[$questionid] = isset($choice_value) ? $choice_value : null;
133 133
 
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
         $exerciseResult = $choice;
145 145
     } else {
146 146
         // gets the question ID from $choice. It is the key of the array
147
-        list($key)=array_keys($choice);
147
+        list($key) = array_keys($choice);
148 148
         // if the user didn't already answer this question
149
-        if(!isset($exerciseResult[$key])) {
149
+        if (!isset($exerciseResult[$key])) {
150 150
             // stores the user answer into the array
151
-            $exerciseResult[$key]=$choice[$key];
151
+            $exerciseResult[$key] = $choice[$key];
152 152
         }
153 153
     }
154 154
 }
@@ -174,26 +174,26 @@  discard block
 block discarded – undo
174 174
 
175 175
 // creates a temporary Question object
176 176
 if (in_array($questionid, $questionList)) {
177
-	$objQuestionTmp 	= Question :: read($questionid);
178
-	$questionName		=$objQuestionTmp->selectTitle();
179
-	$questionDescription=$objQuestionTmp->selectDescription();
180
-	$questionWeighting	=$objQuestionTmp->selectWeighting();
181
-	$answerType			=$objQuestionTmp->selectType();
182
-	$quesId				=$objQuestionTmp->selectId(); //added by priya saini
177
+	$objQuestionTmp = Question :: read($questionid);
178
+	$questionName = $objQuestionTmp->selectTitle();
179
+	$questionDescription = $objQuestionTmp->selectDescription();
180
+	$questionWeighting = $objQuestionTmp->selectWeighting();
181
+	$answerType = $objQuestionTmp->selectType();
182
+	$quesId = $objQuestionTmp->selectId(); //added by priya saini
183 183
 }
184 184
 
185
-$objAnswerTmp=new Answer($questionid);
186
-$nbrAnswers=$objAnswerTmp->selectNbrAnswers();
185
+$objAnswerTmp = new Answer($questionid);
186
+$nbrAnswers = $objAnswerTmp->selectNbrAnswers();
187 187
 //echo 'answe_type '.$answerType;echo '<br />';
188 188
 
189 189
 $choice = $exerciseResult[$questionid];
190
-$destination=array();
191
-$comment='';
192
-$next=1;
190
+$destination = array();
191
+$comment = '';
192
+$next = 1;
193 193
 $_SESSION['hotspot_coord'] = array();
194 194
 $_SESSION['hotspot_dest'] = array();
195 195
 
196
-$overlap_color = $missing_color = $excess_color=false;
196
+$overlap_color = $missing_color = $excess_color = false;
197 197
 $organs_at_risk_hit = 0;
198 198
 $wrong_results = false;
199 199
 $hot_spot_load = false;
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 $totalScore = 0;
203 203
 
204 204
 if (!empty($choice_value)) {
205
-	for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
205
+	for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
206 206
 		$answer            = $objAnswerTmp->selectAnswer($answerId);
207 207
 		$answerComment     = $objAnswerTmp->selectComment($answerId);
208 208
 		$answerDestination = $objAnswerTmp->selectDestination($answerId);
@@ -213,29 +213,29 @@  discard block
 block discarded – undo
213 213
 
214 214
 		//delineation
215 215
 		$delineation_cord  = $objAnswerTmp->selectHotspotCoordinates(1);
216
-		$answer_delineation_destination=$objAnswerTmp->selectDestination(1);
217
-        if ($dbg_local>0) { error_log(__LINE__.' answerId: '.$answerId.'('.$answerType.') - user delineation_cord: '.$delineation_cord.' - $answer_delineation_destination: '.$answer_delineation_destination,0);}
216
+		$answer_delineation_destination = $objAnswerTmp->selectDestination(1);
217
+        if ($dbg_local > 0) { error_log(__LINE__.' answerId: '.$answerId.'('.$answerType.') - user delineation_cord: '.$delineation_cord.' - $answer_delineation_destination: '.$answer_delineation_destination, 0); }
218 218
 
219
-		switch($answerType) {
219
+		switch ($answerType) {
220 220
 			// for unique answer
221 221
 			case UNIQUE_ANSWER :
222
-				$studentChoice = ($choice_value == $numAnswer)?1:0;
222
+				$studentChoice = ($choice_value == $numAnswer) ? 1 : 0;
223 223
 				if ($studentChoice) {
224
-					$questionScore	+=$answerWeighting;
225
-					$totalScore		+=$answerWeighting;
226
-					$newquestionList[]=$questionid;
224
+					$questionScore += $answerWeighting;
225
+					$totalScore		+= $answerWeighting;
226
+					$newquestionList[] = $questionid;
227 227
 				}
228 228
 				break;
229 229
 			case HOT_SPOT_DELINEATION :
230
-			    $studentChoice=$choice[$answerId];
230
+			    $studentChoice = $choice[$answerId];
231 231
 				if ($studentChoice) {
232
-					$newquestionList[]=$questionid;
232
+					$newquestionList[] = $questionid;
233 233
 				}
234
-				if ($answerId===1) {
235
-					$questionScore	+=$answerWeighting;
236
-					$totalScore		+=$answerWeighting;
237
-					$_SESSION['hotspot_coord'][1]	=$delineation_cord;
238
-					$_SESSION['hotspot_dest'][1]	=$answer_delineation_destination;
234
+				if ($answerId === 1) {
235
+					$questionScore += $answerWeighting;
236
+					$totalScore += $answerWeighting;
237
+					$_SESSION['hotspot_coord'][1] = $delineation_cord;
238
+					$_SESSION['hotspot_dest'][1] = $answer_delineation_destination;
239 239
 				}
240 240
 				break;
241 241
 		}
@@ -247,27 +247,27 @@  discard block
 block discarded – undo
247 247
                 $destination = $answerDestination;
248 248
                 $comment = $answerComment;
249 249
             }
250
-        } elseif($answerType == HOT_SPOT_DELINEATION) {
250
+        } elseif ($answerType == HOT_SPOT_DELINEATION) {
251 251
             if ($next) {
252
-                if ($dbg_local>0) { error_log(__LINE__.' - next',0);}
252
+                if ($dbg_local > 0) { error_log(__LINE__.' - next', 0); }
253 253
                 $hot_spot_load = true; //apparently the script is called twice
254 254
                 $user_answer = $user_array;
255
-                $_SESSION['exerciseResultCoordinates'][$questionid]=$user_answer; //needed for exercise_result.php
255
+                $_SESSION['exerciseResultCoordinates'][$questionid] = $user_answer; //needed for exercise_result.php
256 256
 
257 257
                 // we compare only the delineation not the other points
258
-                $answer_question	= $_SESSION['hotspot_coord'][1];
259
-                $answerDestination	= $_SESSION['hotspot_dest'][1];
258
+                $answer_question = $_SESSION['hotspot_coord'][1];
259
+                $answerDestination = $_SESSION['hotspot_dest'][1];
260 260
 
261
-                $poly_user 				= convert_coordinates($user_answer,'/');
262
-                $poly_answer 			= convert_coordinates($answer_question,'|');
263
-                $max_coord 				= poly_get_max($poly_user,$poly_answer);
261
+                $poly_user 				= convert_coordinates($user_answer, '/');
262
+                $poly_answer = convert_coordinates($answer_question, '|');
263
+                $max_coord 				= poly_get_max($poly_user, $poly_answer);
264 264
 
265 265
                 if (empty($_GET['hotspot'])) { //no user response
266 266
                     $overlap = -2;
267 267
                 } else {
268
-                    $poly_user_compiled 	= poly_compile($poly_user,$max_coord);
269
-                    $poly_answer_compiled 	= poly_compile($poly_answer,$max_coord);
270
-                    $poly_results 			= poly_result($poly_answer_compiled,$poly_user_compiled,$max_coord);
268
+                    $poly_user_compiled = poly_compile($poly_user, $max_coord);
269
+                    $poly_answer_compiled = poly_compile($poly_answer, $max_coord);
270
+                    $poly_results = poly_result($poly_answer_compiled, $poly_user_compiled, $max_coord);
271 271
 
272 272
                     $overlap = $poly_results['both'];
273 273
                     $poly_answer_area = $poly_results['s1'];
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
                 }
278 278
 
279 279
                 //$overlap = round(polygons_overlap($poly_answer,$poly_user)); //this is an area in pixels
280
-                if ($dbg_local>0) { error_log(__LINE__.' - Polygons results are '.print_r($poly_results,1),0);}
280
+                if ($dbg_local > 0) { error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0); }
281 281
                 if ($overlap < 1) {
282 282
                     //shortcut to avoid complicated calculations
283 283
                     $final_overlap = 0;
@@ -285,27 +285,27 @@  discard block
 block discarded – undo
285 285
                     $final_excess  = 100;
286 286
                 } else {
287 287
                     // the final overlap is the percentage of the initial polygon that is overlapped by the user's polygon
288
-                    $final_overlap = round(((float)$overlap / (float)$poly_answer_area)*100);
289
-                    if ($dbg_local>1) { error_log(__LINE__.' - Final overlap is '.$final_overlap,0);}
288
+                    $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100);
289
+                    if ($dbg_local > 1) { error_log(__LINE__.' - Final overlap is '.$final_overlap, 0); }
290 290
                     // the final missing area is the percentage of the initial polygon that is not overlapped by the user's polygon
291 291
                     $final_missing = 100 - $final_overlap;
292
-                    if ($dbg_local>1) { error_log(__LINE__.' - Final missing is '.$final_missing,0);}
292
+                    if ($dbg_local > 1) { error_log(__LINE__.' - Final missing is '.$final_missing, 0); }
293 293
                     // the final excess area is the percentage of the initial polygon's size that is covered by the user's polygon outside of the initial polygon
294
-                    $final_excess = round((((float)$poly_user_area-(float)$overlap)/(float)$poly_answer_area)*100);
295
-                    if ($dbg_local>1) { error_log(__LINE__.' - Final excess is '.$final_excess,0);}
294
+                    $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100);
295
+                    if ($dbg_local > 1) { error_log(__LINE__.' - Final excess is '.$final_excess, 0); }
296 296
                 }
297 297
 
298
-                $destination_items= explode('@@', $answerDestination);
298
+                $destination_items = explode('@@', $answerDestination);
299 299
                 $threadhold_total = $destination_items[0];
300
-                $threadhold_items=explode(';',$threadhold_total);
300
+                $threadhold_items = explode(';', $threadhold_total);
301 301
                 $threadhold1 = $threadhold_items[0]; // overlap
302 302
                 $threadhold2 = $threadhold_items[1]; // excess
303
-                $threadhold3 = $threadhold_items[2];	 //missing
303
+                $threadhold3 = $threadhold_items[2]; //missing
304 304
 
305 305
                 // echo $final_overlap.'  '.$threadhold1 .' - '. $final_missing.' '. $threadhold2 .' - '. $final_excess.'  '. $threadhold3;
306 306
 
307 307
                 // if is delineation
308
-                if ($answerId===1) {
308
+                if ($answerId === 1) {
309 309
                     //setting colors
310 310
                     if ($final_overlap >= $threadhold1) {
311 311
                         $overlap_color = true; //echo 'a';
@@ -321,40 +321,40 @@  discard block
 block discarded – undo
321 321
 
322 322
                     // if pass
323 323
                     //if ($final_overlap>=$threadhold1 && $final_missing<=$threadhold2 && $final_excess<=$threadhold3) {
324
-                    if ($final_overlap>=$threadhold1 && $final_missing<=$threadhold3 && $final_excess<=$threadhold2) {
325
-                        $next=1; //go to the oars
326
-                        $result_comment=get_lang('Acceptable');
324
+                    if ($final_overlap >= $threadhold1 && $final_missing <= $threadhold3 && $final_excess <= $threadhold2) {
325
+                        $next = 1; //go to the oars
326
+                        $result_comment = get_lang('Acceptable');
327 327
                     } else {
328
-                        $next=1; //Go to the oars. If $next =  0 we will show this message: "One (or more) area at risk has been hit" instead of the table resume with the results
328
+                        $next = 1; //Go to the oars. If $next =  0 we will show this message: "One (or more) area at risk has been hit" instead of the table resume with the results
329 329
                         $wrong_results = true;
330
-                        $result_comment=get_lang('Unacceptable');
331
-                        $special_comment = $comment=$answerDestination=$objAnswerTmp->selectComment(1);
332
-                        $answerDestination=$objAnswerTmp->selectDestination(1);
333
-                        $destination_items= explode('@@', $answerDestination);
334
-                        $try_hotspot=$destination_items[1];
335
-                        $lp_hotspot=$destination_items[2];
336
-                        $select_question_hotspot=$destination_items[3];
337
-                        $url_hotspot=$destination_items[4];
330
+                        $result_comment = get_lang('Unacceptable');
331
+                        $special_comment = $comment = $answerDestination = $objAnswerTmp->selectComment(1);
332
+                        $answerDestination = $objAnswerTmp->selectDestination(1);
333
+                        $destination_items = explode('@@', $answerDestination);
334
+                        $try_hotspot = $destination_items[1];
335
+                        $lp_hotspot = $destination_items[2];
336
+                        $select_question_hotspot = $destination_items[3];
337
+                        $url_hotspot = $destination_items[4];
338 338
                          //echo 'show the feedback';
339 339
                     }
340
-                } elseif($answerId>1) {
340
+                } elseif ($answerId > 1) {
341 341
                     if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') {
342
-                        if ($dbg_local>0) { error_log(__LINE__.' - answerId is of type noerror',0);}
342
+                        if ($dbg_local > 0) { error_log(__LINE__.' - answerId is of type noerror', 0); }
343 343
                         //type no error shouldn't be treated
344 344
                         $next = 1;
345 345
                         continue;
346 346
                     }
347
-                    if ($dbg_local>0) { error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR',0);}
347
+                    if ($dbg_local > 0) { error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0); }
348 348
                     //check the intersection between the oar and the user
349 349
                     //echo 'user';	print_r($x_user_list);		print_r($y_user_list);
350 350
                     //echo 'official';print_r($x_list);print_r($y_list);
351 351
                     //$result = get_intersection_data($x_list,$y_list,$x_user_list,$y_user_list);
352 352
 
353 353
                     //$delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId);
354
-                    $delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId); //getting the oars coordinates
354
+                    $delineation_cord = $objAnswerTmp->selectHotspotCoordinates($answerId); //getting the oars coordinates
355 355
 
356
-                    $poly_answer 			= convert_coordinates($delineation_cord,'|');
357
-                    $max_coord 				= poly_get_max($poly_user,$poly_answer); //getting max coordinates
356
+                    $poly_answer = convert_coordinates($delineation_cord, '|');
357
+                    $max_coord = poly_get_max($poly_user, $poly_answer); //getting max coordinates
358 358
                     $test = false;
359 359
                     // if ($answerId == 2 ){$test = true;} for test oars
360 360
 
@@ -362,9 +362,9 @@  discard block
 block discarded – undo
362 362
                         $overlap = false;
363 363
                     } else {
364 364
                         //	poly_compile really works tested with gnuplot
365
-                        $poly_user_compiled	  	= poly_compile($poly_user,$max_coord,$test);//$poly_user is already set when answerid = 1
366
-                        $poly_answer_compiled 	= poly_compile($poly_answer,$max_coord,$test);
367
-                        $overlap 			  	= poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord);
365
+                        $poly_user_compiled	  	= poly_compile($poly_user, $max_coord, $test); //$poly_user is already set when answerid = 1
366
+                        $poly_answer_compiled 	= poly_compile($poly_answer, $max_coord, $test);
367
+                        $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord);
368 368
                     }
369 369
 
370 370
                     if ($overlap == false) {
@@ -372,42 +372,42 @@  discard block
 block discarded – undo
372 372
                         $next = 1;
373 373
                         continue;
374 374
                     } else {
375
-                        if ($dbg_local>0) { error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit',0);}
375
+                        if ($dbg_local > 0) { error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0); }
376 376
 
377 377
                         $organs_at_risk_hit++;
378 378
                         //show the feedback
379
-                        $next=1;
380
-                        $comment=$answerDestination=$objAnswerTmp->selectComment($answerId);
381
-                        $answerDestination=$objAnswerTmp->selectDestination($answerId);
382
-                        $destination_items= explode('@@', $answerDestination);
383
-                        $try_hotspot=$destination_items[1];
384
-                        $lp_hotspot=$destination_items[2];
385
-                        $select_question_hotspot=$destination_items[3];
386
-                        $url_hotspot=$destination_items[4];
379
+                        $next = 1;
380
+                        $comment = $answerDestination = $objAnswerTmp->selectComment($answerId);
381
+                        $answerDestination = $objAnswerTmp->selectDestination($answerId);
382
+                        $destination_items = explode('@@', $answerDestination);
383
+                        $try_hotspot = $destination_items[1];
384
+                        $lp_hotspot = $destination_items[2];
385
+                        $select_question_hotspot = $destination_items[3];
386
+                        $url_hotspot = $destination_items[4];
387 387
                     }
388 388
                 }
389 389
             } else {
390 390
                 // the first delineation feedback
391
-                if ($dbg_local>0) { error_log(__LINE__.' first',0);}
391
+                if ($dbg_local > 0) { error_log(__LINE__.' first', 0); }
392 392
                 //we send the error
393 393
             }
394 394
         }
395 395
 	}
396 396
 
397 397
 	if ($overlap_color) {
398
-		$overlap_color='green';
398
+		$overlap_color = 'green';
399 399
     } else {
400
-		$overlap_color='red';
400
+		$overlap_color = 'red';
401 401
     }
402 402
 	if ($missing_color) {
403
-		$missing_color='green';
403
+		$missing_color = 'green';
404 404
     } else {
405
-		$missing_color='red';
405
+		$missing_color = 'red';
406 406
     }
407 407
 	if ($excess_color) {
408
-		$excess_color='green';
408
+		$excess_color = 'green';
409 409
     } else {
410
-		$excess_color='red';
410
+		$excess_color = 'red';
411 411
     }
412 412
 
413 413
     if (!is_numeric($final_overlap)) {
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
     	$final_excess = 0;
422 422
     }
423 423
 
424
-    if ($final_excess>100) {
424
+    if ($final_excess > 100) {
425 425
     	$final_excess = 100;
426 426
     }
427 427
 
@@ -436,26 +436,26 @@  discard block
 block discarded – undo
436 436
 	<tr class="row_even">
437 437
 		<td><b>'.get_lang('Overlap').'</b></td>
438 438
 		<td>'.get_lang('Min').' '.$threadhold1.'</td>
439
-		<td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0)?0:intval($final_overlap)).'</div></td>
439
+		<td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td>
440 440
 	</tr>
441 441
 
442 442
 	<tr>
443 443
 		<td><b>'.get_lang('Excess').'</b></td>
444 444
 		<td>'.get_lang('Max').' '.$threadhold2.'</td>
445
-		<td><div style="color:'.$excess_color.'">'.(($final_excess < 0)?0:intval($final_excess)).'</div></td>
445
+		<td><div style="color:'.$excess_color.'">'.(($final_excess < 0) ? 0 : intval($final_excess)).'</div></td>
446 446
 	</tr>
447 447
 
448 448
 	<tr class="row_even">
449 449
 		<td><b>'.get_lang('Missing').'</b></td>
450 450
 		<td>'.get_lang('Max').' '.$threadhold3.'</td>
451
-		<td><div style="color:'.$missing_color.'">'.(($final_missing < 0)?0:intval($final_missing)).'</div></td>
451
+		<td><div style="color:'.$missing_color.'">'.(($final_missing < 0) ? 0 : intval($final_missing)).'</div></td>
452 452
 	</tr>
453 453
 	</table>';
454 454
 	//var_dump($final_overlap, $threadhold1 , $final_missing, $threadhold2 , $final_excess, $threadhold3);
455 455
 }
456 456
 $_SESSION['newquestionList'] = $newquestionList;
457 457
 
458
-$links='';
458
+$links = '';
459 459
 
460 460
 if (isset($choice_value) && $choice_value == -1) {
461 461
     if ($answerType != HOT_SPOT_DELINEATION) {
@@ -467,32 +467,32 @@  discard block
 block discarded – undo
467 467
 
468 468
 if ($answerType != HOT_SPOT_DELINEATION) {
469 469
     if (!empty($destination)) {
470
-        $item_list = explode('@@',$destination);
470
+        $item_list = explode('@@', $destination);
471 471
     	//print_R($item_list);
472 472
     	$try = $item_list[0];
473 473
     	$lp = $item_list[1];
474
-    	$destinationid= $item_list[2];
475
-    	$url=$item_list[3];
474
+    	$destinationid = $item_list[2];
475
+    	$url = $item_list[3];
476 476
     }
477
-	$table_resume='';
477
+	$table_resume = '';
478 478
 } else {
479 479
 		$try = $try_hotspot;
480 480
 		$lp = $lp_hotspot;
481
-		$destinationid= $select_question_hotspot;
482
-		$url=$url_hotspot;
483
-	if ($organs_at_risk_hit==0 && $wrong_results==false ) {
481
+		$destinationid = $select_question_hotspot;
482
+		$url = $url_hotspot;
483
+	if ($organs_at_risk_hit == 0 && $wrong_results == false) {
484 484
 		// no error = no oar and no wrong result for delineation
485 485
 		//show if no error
486 486
 		//echo 'no error';
487
-		$comment= $answerComment = $objAnswerTmp->selectComment($nbrAnswers);
488
-		$answerDestination		 = $objAnswerTmp->selectDestination($nbrAnswers);
487
+		$comment = $answerComment = $objAnswerTmp->selectComment($nbrAnswers);
488
+		$answerDestination = $objAnswerTmp->selectDestination($nbrAnswers);
489 489
 
490 490
 		//we send the error
491
-		$destination_items= explode('@@', $answerDestination);
492
-		$try=$destination_items[1];
493
-		$lp=$destination_items[2];
494
-		$destinationid=$destination_items[3];
495
-		$url=$destination_items[4];
491
+		$destination_items = explode('@@', $answerDestination);
492
+		$try = $destination_items[1];
493
+		$lp = $destination_items[2];
494
+		$destinationid = $destination_items[3];
495
+		$url = $destination_items[4];
496 496
 		$exerciseResult[$questionid] = 1;
497 497
 	} else {
498 498
 		$exerciseResult[$questionid] = 0;
@@ -500,35 +500,35 @@  discard block
 block discarded – undo
500 500
 }
501 501
 
502 502
 // the link to retry the question
503
-if (isset($try) && $try==1) {
504
-	$num_value_array= (array_keys($questionList, $questionid));
505
-	$links.= Display :: return_icon('reload.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />';
503
+if (isset($try) && $try == 1) {
504
+	$num_value_array = (array_keys($questionList, $questionid));
505
+	$links .= Display :: return_icon('reload.gif', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />';
506 506
 }
507 507
 
508 508
 // the link to theory (a learning path)
509 509
 if (!empty($lp)) {
510
-	$lp_url= api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp;
510
+	$lp_url = api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp;
511 511
 	$list = new LearnpathList(api_get_user_id());
512 512
 	$flat_list = $list->get_flat_list();
513
-	$links.= Display :: return_icon('theory.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />';
513
+	$links .= Display :: return_icon('theory.gif', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />';
514 514
 }
515
-$links.='<br />';
515
+$links .= '<br />';
516 516
 
517 517
 // the link to an external website or link
518 518
 if (!empty($url)) {
519
-	$links.= Display :: return_icon('link.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />';
519
+	$links .= Display :: return_icon('link.gif', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />';
520 520
 }
521 521
 
522 522
 // the link to finish the test
523
-if ($destinationid==-1) {
524
-	$links.= Display :: return_icon('finish.gif', '', array ('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />';
523
+if ($destinationid == -1) {
524
+	$links .= Display :: return_icon('finish.gif', '', array('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />';
525 525
 } else {
526 526
 	// the link to other question
527
-	if (in_array($destinationid,$questionList)) {
527
+	if (in_array($destinationid, $questionList)) {
528 528
 		$objQuestionTmp = Question :: read($destinationid);
529
-		$questionName=$objQuestionTmp->selectTitle();
530
-		$num_value_array= (array_keys($questionList, $destinationid));
531
-		$links.= Display :: return_icon('quiz.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />';
529
+		$questionName = $objQuestionTmp->selectTitle();
530
+		$num_value_array = (array_keys($questionList, $destinationid));
531
+		$links .= Display :: return_icon('quiz.gif', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />';
532 532
 	}
533 533
 }
534 534
 
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 }
546 546
 </script>';
547 547
 
548
-if ($links!='') {
548
+if ($links != '') {
549 549
 	/*echo '<div id="ModalContent" style="padding-bottom:30px;padding-top:10px;padding-left:20px;padding-right:20px;">
550 550
     <a onclick="self.parent.tb_remove();" href="#" style="float:right; margin-top:-10px;">'.api_ucfirst(get_lang('Close')).'</a>';*/
551 551
 	echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>';
@@ -554,15 +554,15 @@  discard block
 block discarded – undo
554 554
 		if ($organs_at_risk_hit > 0) {
555 555
 			//$message='<p>'.get_lang('YourDelineation').'</p>';
556 556
 			//$message.=$table_resume;
557
-			$message.='<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />';
557
+			$message .= '<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />';
558 558
 			//if ($wrong_results) { }
559
-			$message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>';
560
-			$message.='<p>'.$comment.'</p>';
559
+			$message .= '<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>';
560
+			$message .= '<p>'.$comment.'</p>';
561 561
 		} else {
562
-			$message='<p>'.get_lang('YourDelineation').'</p>';
563
-			$message.=$table_resume;
564
-			$message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
565
-			$message.='<p>'.$comment.'</p>';
562
+			$message = '<p>'.get_lang('YourDelineation').'</p>';
563
+			$message .= $table_resume;
564
+			$message .= '<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
565
+			$message .= '<p>'.$comment.'</p>';
566 566
 		}
567 567
 		echo $message;
568 568
 	} else {
@@ -571,10 +571,10 @@  discard block
 block discarded – undo
571 571
 	echo '<h3>'.$links.'</h3>';
572 572
 	echo '</div>';
573 573
 
574
-	$_SESSION['hot_spot_result']=$message;
574
+	$_SESSION['hot_spot_result'] = $message;
575 575
 	$_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]);
576 576
 	//reseting the exerciseResult variable
577
-	Session::write('exerciseResult',$exerciseResult);
577
+	Session::write('exerciseResult', $exerciseResult);
578 578
 
579 579
 	//save this variables just in case the exercise loads an LP with other exercise
580 580
 	$_SESSION['objExerciseExtra'.$exerciseId] 	 = $_SESSION['objExercise'];
Please login to merge, or discard this patch.