Completed
Pull Request — 1.11.x (#1700)
by José
28:48
created
main/exercise/qti2.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 }
22 22
 
23 23
 // the breadcrumbs
24
-$interbreadcrumb[]= array (
25
-    "url" => api_get_path(WEB_CODE_PATH) . "exercise/exercise.php?".api_get_cidreq(),
24
+$interbreadcrumb[] = array(
25
+    "url" => api_get_path(WEB_CODE_PATH)."exercise/exercise.php?".api_get_cidreq(),
26 26
     "name" => get_lang('Exercises')
27 27
 );
28 28
 $is_allowedToEdit = api_is_allowed_to_edit(null, true);
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 {
35 35
     $name_tools = get_lang('ImportQtiQuiz');
36 36
     $form  = '<div class="actions">';
37
-    $form .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercise/exercise.php?show=test&'.api_get_cidreq().'">'.
37
+    $form .= '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/exercise.php?show=test&'.api_get_cidreq().'">'.
38 38
         Display :: return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>';
39 39
     $form .= '</div>';
40 40
     $formValidator = new FormValidator(
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         $imported = ch_qti2_import_file($_FILES['userFile']);
85 85
 
86 86
         if (is_numeric($imported) && !empty($imported)) {
87
-            header('Location: '.api_get_path(WEB_CODE_PATH) . 'exercise/admin.php?'.api_get_cidreq().'&exerciseId='.$imported);
87
+            header('Location: '.api_get_path(WEB_CODE_PATH).'exercise/admin.php?'.api_get_cidreq().'&exerciseId='.$imported);
88 88
             exit;
89 89
         } else {
90 90
             $message = Display::return_message(get_lang($imported));
Please login to merge, or discard this patch.
main/exercise/unique_answer.class.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -59,21 +59,21 @@  discard block
 block discarded – undo
59 59
 
60 60
         if ($obj_ex->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) {
61 61
             //Scenario
62
-            $comment_title = '<th width="20%">' . get_lang('Comment') . '</th>';
63
-            $feedback_title = '<th width="20%">' . get_lang('Scenario') . '</th>';
62
+            $comment_title = '<th width="20%">'.get_lang('Comment').'</th>';
63
+            $feedback_title = '<th width="20%">'.get_lang('Scenario').'</th>';
64 64
         } else {
65
-            $comment_title = '<th width="40%">' . get_lang('Comment') . '</th>';
65
+            $comment_title = '<th width="40%">'.get_lang('Comment').'</th>';
66 66
         }
67 67
 
68 68
         $html = '<table class="table table-striped table-hover">
69 69
             <thead>
70 70
                 <tr style="text-align: center;">
71
-                    <th width="5%">' . get_lang('Number') . '</th>
72
-                    <th width="5%"> ' . get_lang('True') . '</th>
73
-                    <th width="40%">' . get_lang('Answer') . '</th>
74
-                        ' . $comment_title . '
75
-                        ' . $feedback_title . '
76
-                    <th width="10%">' . get_lang('Weighting') . '</th>
71
+                    <th width="5%">' . get_lang('Number').'</th>
72
+                    <th width="5%"> ' . get_lang('True').'</th>
73
+                    <th width="40%">' . get_lang('Answer').'</th>
74
+                        ' . $comment_title.'
75
+                        ' . $feedback_title.'
76
+                    <th width="10%">' . get_lang('Weighting').'</th>
77 77
                 </tr>
78 78
             </thead>
79 79
             <tbody>';
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
                     continue;
104 104
                 }
105 105
                 $question = Question::read($questionid);
106
-                $select_question[$questionid] = 'Q' . $key . ' :' . cut(
106
+                $select_question[$questionid] = 'Q'.$key.' :'.cut(
107 107
                     $question->selectTitle(), 20
108 108
                 );
109 109
             }
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
                 if ($answer->correct[$i]) {
135 135
                     $correct = $i;
136 136
                 }
137
-                $defaults['answer[' . $i . ']'] = $answer->answer[$i];
138
-                $defaults['comment[' . $i . ']'] = $answer->comment[$i];
139
-                $defaults['weighting[' . $i . ']'] = float_format(
137
+                $defaults['answer['.$i.']'] = $answer->answer[$i];
138
+                $defaults['comment['.$i.']'] = $answer->comment[$i];
139
+                $defaults['weighting['.$i.']'] = float_format(
140 140
                     $answer->weighting[$i],
141 141
                     1
142 142
                 );
@@ -159,18 +159,18 @@  discard block
 block discarded – undo
159 159
                     $url_result = $url;
160 160
                 }
161 161
 
162
-                $temp_scenario['url' . $i] = $url_result;
163
-                $temp_scenario['try' . $i] = $try_result;
164
-                $temp_scenario['lp' . $i] = $lp;
165
-                $temp_scenario['destination' . $i] = $list_dest;
162
+                $temp_scenario['url'.$i] = $url_result;
163
+                $temp_scenario['try'.$i] = $try_result;
164
+                $temp_scenario['lp'.$i] = $lp;
165
+                $temp_scenario['destination'.$i] = $list_dest;
166 166
             } else {
167 167
                 $defaults['answer[1]'] = get_lang('DefaultUniqueAnswer1');
168 168
                 $defaults['weighting[1]'] = 10;
169 169
                 $defaults['answer[2]'] = get_lang('DefaultUniqueAnswer2');
170 170
                 $defaults['weighting[2]'] = 0;
171 171
 
172
-                $temp_scenario['destination' . $i] = array('0');
173
-                $temp_scenario['lp' . $i] = array('0');
172
+                $temp_scenario['destination'.$i] = array('0');
173
+                $temp_scenario['lp'.$i] = array('0');
174 174
             }
175 175
             $defaults['scenario'] = $temp_scenario;
176 176
 
@@ -182,62 +182,62 @@  discard block
 block discarded – undo
182 182
             );
183 183
             $renderer->setElementTemplate(
184 184
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
185
-                'counter[' . $i . ']'
185
+                'counter['.$i.']'
186 186
             );
187 187
             $renderer->setElementTemplate(
188 188
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
189
-                'answer[' . $i . ']'
189
+                'answer['.$i.']'
190 190
             );
191 191
             $renderer->setElementTemplate(
192 192
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
193
-                'comment[' . $i . ']'
193
+                'comment['.$i.']'
194 194
             );
195 195
             $renderer->setElementTemplate(
196 196
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
197
-                'weighting[' . $i . ']'
197
+                'weighting['.$i.']'
198 198
             );
199 199
 
200 200
             $answer_number = $form->addElement(
201
-                'text', 'counter[' . $i . ']', null, ' value = "' . $i . '"'
201
+                'text', 'counter['.$i.']', null, ' value = "'.$i.'"'
202 202
             );
203 203
             $answer_number->freeze();
204 204
             $form->addElement(
205 205
                 'radio', 'correct', null, null, $i, 'class="checkbox"'
206 206
             );
207 207
 
208
-            $form->addHtmlEditor('answer[' . $i . ']', null, null, true, $editor_config);
208
+            $form->addHtmlEditor('answer['.$i.']', null, null, true, $editor_config);
209 209
 
210 210
             $form->addRule(
211
-                'answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required'
211
+                'answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required'
212 212
             );
213 213
 
214 214
             if ($obj_ex->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) {
215
-                $form->addHtmlEditor('comment[' . $i . ']', null, null, false, $editor_config);
215
+                $form->addHtmlEditor('comment['.$i.']', null, null, false, $editor_config);
216 216
                 // Direct feedback
217 217
                 //Adding extra feedback fields
218 218
                 $group = array();
219
-                $group['try' . $i] = $form->createElement(
219
+                $group['try'.$i] = $form->createElement(
220 220
                     'checkbox',
221
-                    'try' . $i,
221
+                    'try'.$i,
222 222
                     null,
223 223
                     get_lang('TryAgain')
224 224
                 );
225
-                $group['lp' . $i] = $form->createElement(
225
+                $group['lp'.$i] = $form->createElement(
226 226
                     'select',
227
-                    'lp' . $i,
228
-                    get_lang('SeeTheory') . ': ',
227
+                    'lp'.$i,
228
+                    get_lang('SeeTheory').': ',
229 229
                     $select_lp_id
230 230
                 );
231
-                $group['destination' . $i] = $form->createElement(
231
+                $group['destination'.$i] = $form->createElement(
232 232
                     'select',
233
-                    'destination' . $i,
234
-                    get_lang('GoToQuestion') . ': ',
233
+                    'destination'.$i,
234
+                    get_lang('GoToQuestion').': ',
235 235
                     $select_question
236 236
                 );
237
-                $group['url' . $i] = $form->createElement(
237
+                $group['url'.$i] = $form->createElement(
238 238
                     'text',
239
-                    'url' . $i,
240
-                    get_lang('Other') . ': ',
239
+                    'url'.$i,
240
+                    get_lang('Other').': ',
241 241
                     array(
242 242
                         'class' => 'col-md-2',
243 243
                         'placeholder' => get_lang('Other')
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
                     'scenario'
251 251
                 );
252 252
             } else {
253
-                $form->addHtmlEditor('comment[' . $i . ']', null, null, false, $editor_config);
253
+                $form->addHtmlEditor('comment['.$i.']', null, null, false, $editor_config);
254 254
             }
255
-            $form->addText('weighting[' . $i . ']', null, null, array('value' => '0'));
255
+            $form->addText('weighting['.$i.']', null, null, array('value' => '0'));
256 256
             $form->addHtml('</tr>');
257 257
         }
258 258
 
@@ -306,19 +306,19 @@  discard block
 block discarded – undo
306 306
         $nb_answers = $form->getSubmitValue('nb_answers');
307 307
 
308 308
         for ($i = 1; $i <= $nb_answers; $i++) {
309
-            $answer = trim($form->getSubmitValue('answer[' . $i . ']'));
310
-            $comment = trim($form->getSubmitValue('comment[' . $i . ']'));
311
-            $weighting = trim($form->getSubmitValue('weighting[' . $i . ']'));
309
+            $answer = trim($form->getSubmitValue('answer['.$i.']'));
310
+            $comment = trim($form->getSubmitValue('comment['.$i.']'));
311
+            $weighting = trim($form->getSubmitValue('weighting['.$i.']'));
312 312
 
313 313
             $scenario = $form->getSubmitValue('scenario');
314 314
 
315 315
             //$list_destination = $form -> getSubmitValue('destination'.$i);
316 316
             //$destination_str = $form -> getSubmitValue('destination'.$i);
317 317
 
318
-            $try = $scenario['try' . $i];
319
-            $lp = $scenario['lp' . $i];
320
-            $destination = $scenario['destination' . $i];
321
-            $url = trim($scenario['url' . $i]);
318
+            $try = $scenario['try'.$i];
319
+            $lp = $scenario['lp'.$i];
320
+            $destination = $scenario['destination'.$i];
321
+            $url = trim($scenario['url'.$i]);
322 322
 
323 323
             /*
324 324
             How we are going to parse the destination value
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
             }
367 367
 
368 368
             //1@@1;2;@@2;4;4;@@http://www.chamilo.org
369
-            $dest = $try . '@@' . $lp . '@@' . $destination . '@@' . $url;
369
+            $dest = $try.'@@'.$lp.'@@'.$destination.'@@'.$url;
370 370
             $objAnswer->createAnswer(
371 371
                 $answer,
372 372
                 $goodAnswer,
@@ -400,12 +400,12 @@  discard block
 block discarded – undo
400 400
         $score = null
401 401
     ) {
402 402
         $header = parent::return_header($feedback_type, $counter, $score);
403
-        $header .= '<table class="' . $this->question_table_class . '">
403
+        $header .= '<table class="'.$this->question_table_class.'">
404 404
 			<tr>
405
-				<th>' . get_lang("Choice") . '</th>
406
-				<th>' . get_lang("ExpectedChoice") . '</th>
407
-				<th>' . get_lang("Answer") . '</th>';
408
-        $header .= '<th>' . get_lang("Comment") . '</th>';
405
+				<th>' . get_lang("Choice").'</th>
406
+				<th>' . get_lang("ExpectedChoice").'</th>
407
+				<th>' . get_lang("Answer").'</th>';
408
+        $header .= '<th>'.get_lang("Comment").'</th>';
409 409
         $header .= '</tr>';
410 410
 
411 411
         return $header;
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
         if ($correct) {
470 470
             $sql = "UPDATE $tbl_quiz_question
471 471
                     SET ponderation = (ponderation + $score)
472
-                    WHERE c_id = $course_id AND id = " . $question_id;
472
+                    WHERE c_id = $course_id AND id = ".$question_id;
473 473
             Database::query($sql);
474 474
         }
475 475
     }
Please login to merge, or discard this patch.
main/exercise/showinframes.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@
 block discarded – undo
28 28
 $content = ReadFileCont($full_file_path.$user_id.'.t.html');
29 29
 
30 30
 if ($content == '') {
31
-	$content = ReadFileCont($full_file_path);
31
+    $content = ReadFileCont($full_file_path);
32 32
     // Do not move this like:
33
-	$mit = "function Finish(){";
34
-	$js_content = "
33
+    $mit = "function Finish(){";
34
+    $js_content = "
35 35
     // Code added - start
36 36
     var SaveScoreVariable = 0;
37 37
     function mySaveScore() {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
 $time = time();
15 15
 $doc_url = str_replace(array('../', '\\', '\\0', '..'), array('', '', '', ''), urldecode($_GET['file']));
16 16
 $cid = api_get_course_id();
17
-$document_path = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document';
18
-$document_web_path = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document';
17
+$document_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
18
+$document_web_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document';
19 19
 $origin = isset($_REQUEST['origin']) ? $_REQUEST['origin'] : null;
20 20
 $learnpath_id = isset($_REQUEST['learnpath_id']) ? $_REQUEST['learnpath_id'] : null;
21 21
 $learnpath_item_id = isset($_REQUEST['learnpath_item_id']) ? $_REQUEST['learnpath_item_id'] : null;
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
         if (SaveScoreVariable==0) {
39 39
             SaveScoreVariable = 1;
40 40
             if (C.ie) {
41
-                document.location.href = '" . api_get_path(WEB_CODE_PATH) . "exercise/savescores.php?lp_view_id=$lpViewId&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id&time=".Security::remove_XSS($time)."&test=".$doc_url."&uid=".$user_id."&cid=".$cid."&score='+Score;
41
+                document.location.href = '" . api_get_path(WEB_CODE_PATH)."exercise/savescores.php?lp_view_id=$lpViewId&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id&time=".Security::remove_XSS($time)."&test=".$doc_url."&uid=".$user_id."&cid=".$cid."&score='+Score;
42 42
             } else {
43
-                window.location.href = '" . api_get_path(WEB_CODE_PATH) . "exercise/savescores.php?lp_view_id=$lpViewId&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id&time=".Security::remove_XSS($time)."&test=".$doc_url."&uid=".$user_id."&cid=".$cid."&score='+Score;
43
+                window.location.href = '" . api_get_path(WEB_CODE_PATH)."exercise/savescores.php?lp_view_id=$lpViewId&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id&time=".Security::remove_XSS($time)."&test=".$doc_url."&uid=".$user_id."&cid=".$cid."&score='+Score;
44 44
             }
45 45
         }
46 46
     }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 $my_file = str_replace(array('../', '\\..', '\\0', '..\\'), array('', '', '', ''), urldecode($my_file));
70 70
 
71 71
 $title = GetQuizName($my_file, $documentPath);
72
-if ($title =='') {
72
+if ($title == '') {
73 73
     $title = basename($my_file);
74 74
 }
75 75
 $nameTools = $title;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     </script>
88 88
 HTML;
89 89
 
90
-$interbreadcrumb[]= array ("url"=>"./exercise.php", "name"=> get_lang('Exercises'));
90
+$interbreadcrumb[] = array("url"=>"./exercise.php", "name"=> get_lang('Exercises'));
91 91
 if ($origin == 'learnpath') {
92 92
     Display::display_reduced_header($nameTools, "Exercise");
93 93
 } else {
Please login to merge, or discard this patch.
main/exercise/freeanswer.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,9 +60,9 @@
 block discarded – undo
60 60
             $score['revised'] = false;
61 61
         }
62 62
         $header = parent::return_header($feedback_type, $counter, $score);
63
-        $header .= '<table class="' . $this->question_table_class . '" >
63
+        $header .= '<table class="'.$this->question_table_class.'" >
64 64
         <tr>
65
-        <th>' . get_lang("Answer") . '</th>
65
+        <th>' . get_lang("Answer").'</th>
66 66
         </tr>';
67 67
 
68 68
         return $header;
Please login to merge, or discard this patch.
main/exercise/export/aiken/aiken_import.inc.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -281,7 +281,7 @@
 block discarded – undo
281 281
             $correct_answer_index = array_search($matches[1], $answers_array);
282 282
             $exercise_info['question'][$question_index]['title'] = $matches[1];
283 283
         } elseif (preg_match('/^TAGS:\s?([A-Z])\s?/', $info, $matches)) {
284
-             //TAGS for chamilo >= 1.10
284
+                //TAGS for chamilo >= 1.10
285 285
             $exercise_info['question'][$question_index]['answer_tags'] = explode(',', $matches[1]);
286 286
         } elseif (preg_match('/^ETIQUETAS:\s?([A-Z])\s?/', $info, $matches)) {
287 287
             //TAGS for chamilo >= 1.10 (Spanish e-ducativa format)
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,8 +10,9 @@  discard block
 block discarded – undo
10 10
 /**
11 11
  * Security check
12 12
  */
13
-if (count(get_included_files()) == 1)
13
+if (count(get_included_files()) == 1) {
14 14
     die('---');
15
+}
15 16
 
16 17
 /**
17 18
  * Creates a temporary directory
@@ -21,8 +22,9 @@  discard block
 block discarded – undo
21 22
  * @return string
22 23
  */
23 24
 function tempdir($dir, $prefix = 'tmp', $mode = 0777) {
24
-    if (substr($dir, -1) != '/')
25
-        $dir .= '/';
25
+    if (substr($dir, -1) != '/') {
26
+            $dir .= '/';
27
+    }
26 28
 
27 29
     do {
28 30
         $path = $dir . $prefix . mt_rand(0, 9999999);
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         $dir .= '/';
26 26
 
27 27
     do {
28
-        $path = $dir . $prefix . mt_rand(0, 9999999);
28
+        $path = $dir.$prefix.mt_rand(0, 9999999);
29 29
     } while (!mkdir($path, $mode));
30 30
 
31 31
     return $path;
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 {
40 40
     $name_tools = get_lang('ImportAikenQuiz');
41 41
     $form  = '<div class="actions">';
42
-    $form .= '<a href="exercise.php?show=test&'.api_get_cidreq().'">' .
43
-        Display :: return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>';
42
+    $form .= '<a href="exercise.php?show=test&'.api_get_cidreq().'">'.
43
+        Display :: return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>';
44 44
     $form .= '</div>';
45 45
     $form_validator = new FormValidator(
46 46
         'aiken_upload',
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 function aiken_import_exercise($file)
94 94
 {
95 95
     global $exercise_info;
96
-    $archive_path = api_get_path(SYS_ARCHIVE_PATH) . 'aiken';
96
+    $archive_path = api_get_path(SYS_ARCHIVE_PATH).'aiken';
97 97
     $baseWorkDir = $archive_path;
98 98
 
99 99
     if (!is_dir($baseWorkDir)) {
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 
131 131
     // Parse every subdirectory to search txt question files
132 132
     while (false !== ($file = readdir($exerciseHandle))) {
133
-        if (is_dir($baseWorkDir . '/' . $file) && $file != "." && $file != "..") {
133
+        if (is_dir($baseWorkDir.'/'.$file) && $file != "." && $file != "..") {
134 134
             //find each manifest for each question repository found
135
-            $questionHandle = opendir($baseWorkDir . '/' . $file);
135
+            $questionHandle = opendir($baseWorkDir.'/'.$file);
136 136
             while (false !== ($questionFile = readdir($questionHandle))) {
137 137
                 if (preg_match('/.txt$/i', $questionFile)) {
138 138
                     $result = aiken_parse_file(
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
         }
217 217
 
218 218
         // Delete the temp dir where the exercise was unzipped
219
-        my_delete($baseWorkDir . $uploadPath);
219
+        my_delete($baseWorkDir.$uploadPath);
220 220
         $operation = $last_exercise_id;
221 221
     }
222 222
 
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
 function aiken_parse_file(&$exercise_info, $exercisePath, $file, $questionFile) {
240 240
     global $questionTempDir;
241 241
 
242
-    $questionTempDir = $exercisePath . '/' . $file . '/';
243
-    $questionFilePath = $questionTempDir . $questionFile;
242
+    $questionTempDir = $exercisePath.'/'.$file.'/';
243
+    $questionFilePath = $questionTempDir.$questionFile;
244 244
 
245 245
     if (!is_file($questionFilePath)) {
246 246
         return 'FileNotFound';
@@ -252,13 +252,13 @@  discard block
 block discarded – undo
252 252
     $answers_array = array();
253 253
     $new_question = true;
254 254
     foreach ($data as $line => $info) {
255
-        if ($question_index > 0 && $new_question == true && preg_match('/^(\r)?\n/',$info)) {
255
+        if ($question_index > 0 && $new_question == true && preg_match('/^(\r)?\n/', $info)) {
256 256
             // double empty line
257 257
             continue;
258 258
         }
259 259
         $new_question = false;
260 260
         //make sure it is transformed from iso-8859-1 to utf-8 if in that form
261
-        if (!mb_check_encoding($info,'utf-8') && mb_check_encoding($info,'iso-8859-1')) {
261
+        if (!mb_check_encoding($info, 'utf-8') && mb_check_encoding($info, 'iso-8859-1')) {
262 262
             $info = utf8_encode($info);
263 263
         }
264 264
         $exercise_info['question'][$question_index]['type'] = 'MCUA';
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
         } elseif (preg_match('/^ETIQUETAS:\s?([A-Z])\s?/', $info, $matches)) {
291 291
             //TAGS for chamilo >= 1.10 (Spanish e-ducativa format)
292 292
             $exercise_info['question'][$question_index]['answer_tags'] = explode(',', $matches[1]);
293
-        } elseif (preg_match('/^(\r)?\n/',$info)) {
293
+        } elseif (preg_match('/^(\r)?\n/', $info)) {
294 294
             //moving to next question (tolerate \r\n or just \n)
295 295
             if (empty($exercise_info['question'][$question_index]['correct_answers'])) {
296 296
                 error_log('Aiken: Error in question index '.$question_index.': no correct answer defined');
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
                     $exercise_info['question'][$question_index]['title'] = $info;
311 311
                 } else {
312 312
                     //Question itself (use a 100-chars long title and a larger description)
313
-                    $exercise_info['question'][$question_index]['title'] = trim(substr($info, 0, 100)) . '...';
313
+                    $exercise_info['question'][$question_index]['title'] = trim(substr($info, 0, 100)).'...';
314 314
                     $exercise_info['question'][$question_index]['description'] = $info;
315 315
                 }
316 316
             } else {
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
     }
321 321
     $total_questions = count($exercise_info['question']);
322 322
     $total_weight = (!empty($_POST['total_weight'])) ? intval($_POST['total_weight']) : 20;
323
-    foreach  ($exercise_info['question'] as $key => $question) {
323
+    foreach ($exercise_info['question'] as $key => $question) {
324 324
         $exercise_info['question'][$key]['weighting'][current(array_keys($exercise_info['question'][$key]['weighting']))] = $total_weight / $total_questions;
325 325
     }
326 326
     return true;
Please login to merge, or discard this patch.
main/exercise/export/exercise_import.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -74,10 +74,10 @@
 block discarded – undo
74 74
 Display::display_introduction_section(
75 75
     TOOL_QUIZ,
76 76
     array(
77
-		'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
77
+        'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
78 78
         'CreateDocumentDir' => '../../..'.api_get_path(REL_COURSE_PATH).api_get_course_path().'/document/',
79
-		'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/'
80
-	)
79
+        'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/'
80
+    )
81 81
 );
82 82
 
83 83
 // Display Forms or dialog box(if needed)
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -30,22 +30,22 @@  discard block
 block discarded – undo
30 30
 $interbredcrump[] = array('url' => '../exercise.php', 'name' => get_lang('Exercises'));
31 31
 
32 32
 // EXECUTE COMMAND
33
-$cmd = (isset($_REQUEST['cmd'])? $_REQUEST['cmd'] : 'show_import');
33
+$cmd = (isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : 'show_import');
34 34
 
35 35
 switch ($cmd) {
36 36
     case 'show_import':
37 37
 
38 38
         $display = '<p>'
39
-        .            get_lang('Imported exercises must consist of a zip or an XML file (IMS-QTI) and be compatible with your Claroline version.') . '<br>'
39
+        .            get_lang('Imported exercises must consist of a zip or an XML file (IMS-QTI) and be compatible with your Claroline version.').'<br>'
40 40
         .            '</p>'
41 41
         .            '<form enctype="multipart/form-data" action="" method="post">'
42 42
         .            '<input name="cmd" type="hidden" value="import" />'
43 43
         .            '<input name="uploadedExercise" type="file" /><br><br>'
44
-        .            get_lang('Import exercise') . ' : '
45
-        .            '<input value="' . get_lang('Ok') . '" type="submit" /> '
46
-        .            claro_html_button( $_SERVER['PHP_SELF'], get_lang('Cancel'))
44
+        .            get_lang('Import exercise').' : '
45
+        .            '<input value="'.get_lang('Ok').'" type="submit" /> '
46
+        .            claro_html_button($_SERVER['PHP_SELF'], get_lang('Cancel'))
47 47
         .            '<br><br>'
48
-        .            '<small>' . get_lang('Max file size') . ' :  2&nbsp;MB</small>'
48
+        .            '<small>'.get_lang('Max file size').' :  2&nbsp;MB</small>'
49 49
         .            '</form>';
50 50
 
51 51
         break;
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
 
64 64
 // DISPLAY
65
-include api_get_path(SYS_INC_PATH) . '/header.inc.php';
65
+include api_get_path(SYS_INC_PATH).'/header.inc.php';
66 66
 
67 67
 // Tool introduction
68 68
 // TODO: These settings to be checked when it is possible.
@@ -84,4 +84,4 @@  discard block
 block discarded – undo
84 84
     echo $display;
85 85
 }
86 86
 
87
-include api_get_path(SYS_INC_PATH) . '/footer.inc.php';
87
+include api_get_path(SYS_INC_PATH).'/footer.inc.php';
Please login to merge, or discard this patch.
main/exercise/exercise.class.php 4 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1966,7 +1966,7 @@  discard block
 block discarded – undo
1966 1966
                     $label = get_lang('NextQuestion');
1967 1967
                     $class = 'btn btn-primary';
1968 1968
                 }
1969
-				$class .= ' question-validate-btn'; // used to select it with jquery
1969
+                $class .= ' question-validate-btn'; // used to select it with jquery
1970 1970
                 if ($this->type == ONE_PER_PAGE) {
1971 1971
                     if ($questionNum != 1) {
1972 1972
                         $prev_question = $questionNum - 2;
@@ -1991,7 +1991,7 @@  discard block
 block discarded – undo
1991 1991
                         $all_label = get_lang('EndTest');
1992 1992
                         $class = 'btn btn-warning';
1993 1993
                     }
1994
-					$class .= ' question-validate-btn'; // used to select it with jquery
1994
+                    $class .= ' question-validate-btn'; // used to select it with jquery
1995 1995
                     $all_button = '&nbsp;<a href="javascript://" class="'.$class.'" onclick="validate_all(); ">'.$all_label.'</a>';
1996 1996
                     $all_button .= '&nbsp;' . Display::span(null, ['id' => 'save_all_reponse']);
1997 1997
                     $html .= $all_button;
@@ -3774,7 +3774,7 @@  discard block
 block discarded – undo
3774 3774
 
3775 3775
         //Fixes multiple answer question in order to be exact
3776 3776
         //if ($answerType == MULTIPLE_ANSWER || $answerType == GLOBAL_MULTIPLE_ANSWER) {
3777
-       /* if ($answerType == GLOBAL_MULTIPLE_ANSWER) {
3777
+        /* if ($answerType == GLOBAL_MULTIPLE_ANSWER) {
3778 3778
             $diff = @array_diff($answer_correct_array, $real_answers);
3779 3779
 
3780 3780
             // All good answers or nothing works like exact
@@ -5073,8 +5073,8 @@  discard block
 block discarded – undo
5073 5073
     }
5074 5074
 
5075 5075
     /**
5076
-    * @return string
5077
-    */
5076
+     * @return string
5077
+     */
5078 5078
     public function get_formated_title()
5079 5079
     {
5080 5080
         return api_html_entity_decode($this->selectTitle());
Please login to merge, or discard this patch.
Doc Comments   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
     }
354 354
 
355 355
     /**
356
-     * @return int
356
+     * @return string
357 357
      */
358 358
     public function selectPassPercentage()
359 359
     {
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
      * tells if questions are selected randomly, and if so returns the draws
463 463
      *
464 464
      * @author Olivier Brouckaert
465
-     * @return integer - 0 if not random, otherwise the draws
465
+     * @return boolean - 0 if not random, otherwise the draws
466 466
      */
467 467
     public function isRandom()
468 468
     {
@@ -2838,7 +2838,7 @@  discard block
 block discarded – undo
2838 2838
      * @param int  int lp id
2839 2839
      * @param int  int lp item id
2840 2840
      * @param int  int lp item_view id
2841
-     * @param float $weight
2841
+     * @param integer $weight
2842 2842
      * @param array question list
2843 2843
      */
2844 2844
     public function save_stat_track_exercise_info(
@@ -5246,7 +5246,7 @@  discard block
 block discarded – undo
5246 5246
      * @param int $exe_id
5247 5247
      * @param float $score
5248 5248
      * @param float $weight
5249
-     * @return bool
5249
+     * @return false|null
5250 5250
      */
5251 5251
     public function send_mail_notification_for_exam($question_list_answers, $origin, $exe_id, $score, $weight)
5252 5252
     {
@@ -5445,6 +5445,9 @@  discard block
 block discarded – undo
5445 5445
         }
5446 5446
     }
5447 5447
 
5448
+    /**
5449
+     * @param integer $exe_id
5450
+     */
5448 5451
     function send_notification_for_oral_questions($question_list_answers, $origin, $exe_id)
5449 5452
     {
5450 5453
         if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) {
@@ -5596,7 +5599,7 @@  discard block
 block discarded – undo
5596 5599
      * @param int     Maximum number of attempts (0 if no limit)
5597 5600
      * @param int     Feedback type
5598 5601
      * @todo this was function was added due the import exercise via CSV
5599
-     * @return    int New exercise ID
5602
+     * @return    string New exercise ID
5600 5603
      */
5601 5604
     public function createExercise(
5602 5605
         $title,
@@ -6931,7 +6934,7 @@  discard block
 block discarded – undo
6931 6934
      * @param bool $show_comment
6932 6935
      * @param null $exercise_feedback
6933 6936
      * @param bool $show_answers
6934
-     * @param null $modelType
6937
+     * @param integer $modelType
6935 6938
      * @param bool $categoryMinusOne
6936 6939
      * @return bool|null|string
6937 6940
      */
Please login to merge, or discard this patch.
Braces   +30 added lines, -10 removed lines patch added patch discarded remove patch
@@ -3267,7 +3267,9 @@  discard block
 block discarded – undo
3267 3267
                 );
3268 3268
         }
3269 3269
 
3270
-        if ($debug) error_log('Start answer loop ');
3270
+        if ($debug) {
3271
+            error_log('Start answer loop ');
3272
+        }
3271 3273
 
3272 3274
         for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
3273 3275
             $answer = $objAnswerTmp->selectAnswer($answerId);
@@ -3381,7 +3383,9 @@  discard block
 block discarded – undo
3381 3383
                     }
3382 3384
                     $totalScore += $answerWeighting;
3383 3385
 
3384
-                    if ($debug) error_log("studentChoice: $studentChoice");
3386
+                    if ($debug) {
3387
+                        error_log("studentChoice: $studentChoice");
3388
+                    }
3385 3389
                     break;
3386 3390
                 case GLOBAL_MULTIPLE_ANSWER:
3387 3391
                     if ($from_database) {
@@ -3406,7 +3410,9 @@  discard block
 block discarded – undo
3406 3410
                         $real_answers[$answerId] = (bool)$studentChoice;
3407 3411
                     }
3408 3412
                     $totalScore += $answerWeighting;
3409
-                    if ($debug) error_log("studentChoice: $studentChoice");
3413
+                    if ($debug) {
3414
+                        error_log("studentChoice: $studentChoice");
3415
+                    }
3410 3416
                     break;
3411 3417
                 case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE:
3412 3418
                     if ($from_database) {
@@ -4201,7 +4207,9 @@  discard block
 block discarded – undo
4201 4207
             } // end switch Answertype
4202 4208
 
4203 4209
             if ($show_result) {
4204
-                if ($debug) error_log('Showing questions $from '.$from);
4210
+                if ($debug) {
4211
+                    error_log('Showing questions $from '.$from);
4212
+                }
4205 4213
                 if ($from == 'exercise_result') {
4206 4214
                     //display answers (if not matching type, or if the answer is correct)
4207 4215
                     if (
@@ -4499,7 +4507,9 @@  discard block
 block discarded – undo
4499 4507
                         }
4500 4508
                     }
4501 4509
                 } else {
4502
-                    if ($debug) error_log('Showing questions $from '.$from);
4510
+                    if ($debug) {
4511
+                        error_log('Showing questions $from '.$from);
4512
+                    }
4503 4513
 
4504 4514
                     switch ($answerType) {
4505 4515
                         case UNIQUE_ANSWER:
@@ -4846,10 +4856,14 @@  discard block
 block discarded – undo
4846 4856
                     }
4847 4857
                 }
4848 4858
             }
4849
-            if ($debug) error_log(' ------ ');
4859
+            if ($debug) {
4860
+                error_log(' ------ ');
4861
+            }
4850 4862
         } // end for that loops over all answers of the current question
4851 4863
 
4852
-        if ($debug) error_log('-- end answer loop --');
4864
+        if ($debug) {
4865
+            error_log('-- end answer loop --');
4866
+        }
4853 4867
 
4854 4868
         $final_answer = true;
4855 4869
 
@@ -4922,7 +4936,9 @@  discard block
 block discarded – undo
4922 4936
             //  some results that haven't been stored in the database yet
4923 4937
             if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION ) {
4924 4938
 
4925
-                if ($debug) error_log('$from AND this is a hotspot kind of question ');
4939
+                if ($debug) {
4940
+                    error_log('$from AND this is a hotspot kind of question ');
4941
+                }
4926 4942
 
4927 4943
                 $my_exe_id = 0;
4928 4944
                 $from_database = 0;
@@ -5109,8 +5125,12 @@  discard block
 block discarded – undo
5109 5125
         // stored by exercise_results.php (using the session)
5110 5126
 
5111 5127
         if ($saved_results) {
5112
-            if ($debug) error_log("Save question results $saved_results");
5113
-            if ($debug) error_log(print_r($choice ,1 ));
5128
+            if ($debug) {
5129
+                error_log("Save question results $saved_results");
5130
+            }
5131
+            if ($debug) {
5132
+                error_log(print_r($choice ,1 ));
5133
+            }
5114 5134
 
5115 5135
             if (empty($choice)) {
5116 5136
                 $choice = 0;
Please login to merge, or discard this patch.
Spacing   +309 added lines, -309 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     public $feedback_type;
31 31
     public $end_time;
32 32
     public $start_time;
33
-    public $questionList;  // array with the list of this exercise's questions
33
+    public $questionList; // array with the list of this exercise's questions
34 34
     /* including question list of the media */
35 35
     public $questionListUncompressed;
36 36
     public $results_disabled;
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         $TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
131 131
         $table_lp_item = Database::get_course_table(TABLE_LP_ITEM);
132 132
 
133
-        $id  = intval($id);
133
+        $id = intval($id);
134 134
         if (empty($this->course_id)) {
135 135
 
136 136
             return false;
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
      */
467 467
     public function isRandom()
468 468
     {
469
-        if($this->random > 0 || $this->random == -1) {
469
+        if ($this->random > 0 || $this->random == -1) {
470 470
             return true;
471 471
         } else {
472 472
             return false;
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
                     $question_media = null;
631 631
                     if (!empty($objQuestionTmp->parent_id)) {
632 632
                         $objQuestionMedia = Question::read($objQuestionTmp->parent_id);
633
-                        $question_media  = Question::getMediaLabel($objQuestionMedia->question);
633
+                        $question_media = Question::getMediaLabel($objQuestionMedia->question);
634 634
                     }
635 635
 
636 636
                     $questionType = Display::tag(
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
                 $cat = new TestCategory();
1033 1033
                 $cat = $cat->getCategory($categoryId);
1034 1034
 
1035
-                $cat = (array)$cat;
1035
+                $cat = (array) $cat;
1036 1036
                 $cat['iid'] = $cat['id'];
1037 1037
                 //*$cat['name'] = $cat['name'];
1038 1038
 
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
      */
1247 1247
     public function updateTitle($title)
1248 1248
     {
1249
-        $this->exercise=$title;
1249
+        $this->exercise = $title;
1250 1250
     }
1251 1251
 
1252 1252
     /**
@@ -1256,7 +1256,7 @@  discard block
 block discarded – undo
1256 1256
      */
1257 1257
     public function updateAttempts($attempts)
1258 1258
     {
1259
-        $this->attempts=$attempts;
1259
+        $this->attempts = $attempts;
1260 1260
     }
1261 1261
 
1262 1262
     /**
@@ -1266,7 +1266,7 @@  discard block
 block discarded – undo
1266 1266
      */
1267 1267
     public function updateFeedbackType($feedback_type)
1268 1268
     {
1269
-        $this->feedback_type=$feedback_type;
1269
+        $this->feedback_type = $feedback_type;
1270 1270
     }
1271 1271
 
1272 1272
     /**
@@ -1277,7 +1277,7 @@  discard block
 block discarded – undo
1277 1277
      */
1278 1278
     public function updateDescription($description)
1279 1279
     {
1280
-        $this->description=$description;
1280
+        $this->description = $description;
1281 1281
     }
1282 1282
 
1283 1283
     /**
@@ -1413,23 +1413,23 @@  discard block
 block discarded – undo
1413 1413
      * @param string $sound - exercise sound file
1414 1414
      * @param string $delete - ask to delete the file
1415 1415
      */
1416
-    public function updateSound($sound,$delete)
1416
+    public function updateSound($sound, $delete)
1417 1417
     {
1418 1418
         global $audioPath, $documentPath;
1419 1419
         $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
1420 1420
 
1421
-        if ($sound['size'] && (strstr($sound['type'],'audio') || strstr($sound['type'],'video'))) {
1422
-            $this->sound=$sound['name'];
1421
+        if ($sound['size'] && (strstr($sound['type'], 'audio') || strstr($sound['type'], 'video'))) {
1422
+            $this->sound = $sound['name'];
1423 1423
 
1424
-            if (@move_uploaded_file($sound['tmp_name'],$audioPath.'/'.$this->sound)) {
1424
+            if (@move_uploaded_file($sound['tmp_name'], $audioPath.'/'.$this->sound)) {
1425 1425
                 $sql = "SELECT 1 FROM $TBL_DOCUMENT
1426
-                        WHERE c_id = ".$this->course_id." AND path='".str_replace($documentPath,'',$audioPath).'/'.$this->sound."'";
1426
+                        WHERE c_id = ".$this->course_id." AND path='".str_replace($documentPath, '', $audioPath).'/'.$this->sound."'";
1427 1427
                 $result = Database::query($sql);
1428 1428
 
1429 1429
                 if (!Database::num_rows($result)) {
1430 1430
                     $id = add_document(
1431 1431
                         $this->course,
1432
-                        str_replace($documentPath,'',$audioPath).'/'.$this->sound,
1432
+                        str_replace($documentPath, '', $audioPath).'/'.$this->sound,
1433 1433
                         'file',
1434 1434
                         $sound['size'],
1435 1435
                         $sound['name']
@@ -1448,8 +1448,8 @@  discard block
 block discarded – undo
1448 1448
                     );
1449 1449
                 }
1450 1450
             }
1451
-        } elseif($delete && is_file($audioPath.'/'.$this->sound)) {
1452
-            $this->sound='';
1451
+        } elseif ($delete && is_file($audioPath.'/'.$this->sound)) {
1452
+            $this->sound = '';
1453 1453
         }
1454 1454
     }
1455 1455
 
@@ -1497,7 +1497,7 @@  discard block
 block discarded – undo
1497 1497
      */
1498 1498
     public function enable()
1499 1499
     {
1500
-        $this->active=1;
1500
+        $this->active = 1;
1501 1501
     }
1502 1502
 
1503 1503
     /**
@@ -1507,7 +1507,7 @@  discard block
 block discarded – undo
1507 1507
      */
1508 1508
     public function disable()
1509 1509
     {
1510
-        $this->active=0;
1510
+        $this->active = 0;
1511 1511
     }
1512 1512
 
1513 1513
     /**
@@ -1635,7 +1635,7 @@  discard block
 block discarded – undo
1635 1635
                 api_get_user_id()
1636 1636
             );
1637 1637
 
1638
-            if (api_get_setting('search_enabled')=='true') {
1638
+            if (api_get_setting('search_enabled') == 'true') {
1639 1639
                 $this->search_engine_edit();
1640 1640
             }
1641 1641
         } else {
@@ -1784,7 +1784,7 @@  discard block
 block discarded – undo
1784 1784
     public function removeFromList($questionId)
1785 1785
     {
1786 1786
         // searches the position of the question ID in the list
1787
-        $pos = array_search($questionId,$this->questionList);
1787
+        $pos = array_search($questionId, $this->questionList);
1788 1788
 
1789 1789
         // question not found
1790 1790
         if ($pos === false) {
@@ -1820,7 +1820,7 @@  discard block
 block discarded – undo
1820 1820
         api_item_property_update($this->course, TOOL_QUIZ, $this->id, 'QuizDeleted', api_get_user_id());
1821 1821
         api_item_property_update($this->course, TOOL_QUIZ, $this->id, 'delete', api_get_user_id());
1822 1822
 
1823
-        if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian') ) {
1823
+        if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) {
1824 1824
             $this->search_engine_delete();
1825 1825
         }
1826 1826
     }
@@ -1829,7 +1829,7 @@  discard block
 block discarded – undo
1829 1829
      * Creates the form to create / edit an exercise
1830 1830
      * @param FormValidator $form
1831 1831
      */
1832
-    public function createForm($form, $type='full')
1832
+    public function createForm($form, $type = 'full')
1833 1833
     {
1834 1834
         if (empty($type)) {
1835 1835
             $type = 'full';
@@ -1860,7 +1860,7 @@  discard block
 block discarded – undo
1860 1860
             'Width' => '100%',
1861 1861
             'Height' => '150',
1862 1862
         );
1863
-        if (is_array($type)){
1863
+        if (is_array($type)) {
1864 1864
             $editor_config = array_merge($editor_config, $type);
1865 1865
         }
1866 1866
 
@@ -1914,7 +1914,7 @@  discard block
 block discarded – undo
1914 1914
                     '2',
1915 1915
                     array('id' => 'exerciseType_2')
1916 1916
                 );
1917
-                $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'),get_lang('FeedbackDisplayOptions')));
1917
+                $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'), get_lang('FeedbackDisplayOptions')));
1918 1918
 
1919 1919
                 // Type of results display on the final page
1920 1920
                 $radios_results_disabled = array();
@@ -1958,8 +1958,8 @@  discard block
 block discarded – undo
1958 1958
                 // Type of questions disposition on page
1959 1959
                 $radios = array();
1960 1960
 
1961
-                $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'),    '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all'));
1962
-                $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one'));
1961
+                $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all'));
1962
+                $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one'));
1963 1963
 
1964 1964
                 $form->addGroup($radios, null, get_lang('QuestionsPerPage'));
1965 1965
 
@@ -1969,32 +1969,32 @@  discard block
 block discarded – undo
1969 1969
 
1970 1970
                     // feedback type
1971 1971
                     $radios_feedback = array();
1972
-                    $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('ExerciseAtTheEndOfTheTest'),'0',array('id' =>'exerciseType_0', 'onclick' => 'check_feedback()'));
1972
+                    $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('ExerciseAtTheEndOfTheTest'), '0', array('id' =>'exerciseType_0', 'onclick' => 'check_feedback()'));
1973 1973
 
1974 1974
                     if (api_get_setting('enable_quiz_scenario') == 'true') {
1975
-                        $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('DirectFeedback'), '1', array('id' =>'exerciseType_1' , 'onclick' => 'check_direct_feedback()'));
1975
+                        $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('DirectFeedback'), '1', array('id' =>'exerciseType_1', 'onclick' => 'check_direct_feedback()'));
1976 1976
                     }
1977
-                    $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'),'2',array('id' =>'exerciseType_2'));
1978
-                    $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'),get_lang('FeedbackDisplayOptions')));
1977
+                    $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'), '2', array('id' =>'exerciseType_2'));
1978
+                    $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'), get_lang('FeedbackDisplayOptions')));
1979 1979
 
1980 1980
                     //$form->addElement('select', 'exerciseFeedbackType',get_lang('FeedbackType'),$feedback_option,'onchange="javascript:feedbackselection()"');
1981 1981
                     $radios_results_disabled = array();
1982 1982
                     $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id'=>'result_disabled_0'));
1983
-                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'),  '1',array('id'=>'result_disabled_1','onclick' => 'check_results_disabled()'));
1984
-                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'),  '2',array('id'=>'result_disabled_2','onclick' => 'check_results_disabled()'));
1985
-                    $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'),'');
1983
+                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id'=>'result_disabled_1', 'onclick' => 'check_results_disabled()'));
1984
+                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2', 'onclick' => 'check_results_disabled()'));
1985
+                    $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), '');
1986 1986
 
1987 1987
                     // Type of questions disposition on page
1988 1988
                     $radios = array();
1989
-                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'),    '1');
1990
-                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2');
1989
+                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1');
1990
+                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2');
1991 1991
                     $form->addGroup($radios, null, get_lang('ExerciseType'));
1992 1992
 
1993 1993
                 } else {
1994 1994
                     //Show options freeze
1995 1995
                     $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id'=>'result_disabled_0'));
1996
-                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'),  '1',array('id'=>'result_disabled_1','onclick' => 'check_results_disabled()'));
1997
-                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'),  '2',array('id'=>'result_disabled_2','onclick' => 'check_results_disabled()'));
1996
+                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id'=>'result_disabled_1', 'onclick' => 'check_results_disabled()'));
1997
+                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2', 'onclick' => 'check_results_disabled()'));
1998 1998
                     $result_disable_group = $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'));
1999 1999
                     $result_disable_group->freeze();
2000 2000
 
@@ -2003,8 +2003,8 @@  discard block
 block discarded – undo
2003 2003
                     $form->addElement('hidden', 'exerciseType', ONE_PER_PAGE);
2004 2004
 
2005 2005
                     // Type of questions disposition on page
2006
-                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'),    '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all'));
2007
-                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one'));
2006
+                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all'));
2007
+                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one'));
2008 2008
 
2009 2009
                     $type_group = $form->addGroup($radios, null, get_lang('QuestionsPerPage'));
2010 2010
                     $type_group->freeze();
@@ -2110,7 +2110,7 @@  discard block
 block discarded – undo
2110 2110
                 $cat = new TestCategory();
2111 2111
                 $cat_form = $cat->returnCategoryForm($this);
2112 2112
                 if (empty($cat_form)) {
2113
-                    $cat_form = '<span class="label label-warning">' . get_lang('NoCategoriesDefined') . '</span>';
2113
+                    $cat_form = '<span class="label label-warning">'.get_lang('NoCategoriesDefined').'</span>';
2114 2114
                 }
2115 2115
                 $form->addElement('label', null, $cat_form);
2116 2116
                 $form->addElement('html', '</div>');
@@ -2179,7 +2179,7 @@  discard block
 block discarded – undo
2179 2179
             );
2180 2180
 
2181 2181
             // Exercise time limit
2182
-            $form->addElement('checkbox', 'activate_start_date_check',null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()'));
2182
+            $form->addElement('checkbox', 'activate_start_date_check', null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()'));
2183 2183
 
2184 2184
             $var = Exercise::selectTimeLimit();
2185 2185
 
@@ -2191,9 +2191,9 @@  discard block
 block discarded – undo
2191 2191
 
2192 2192
             $form->addElement('date_time_picker', 'start_time');
2193 2193
 
2194
-            $form->addElement('html','</div>');
2194
+            $form->addElement('html', '</div>');
2195 2195
 
2196
-            $form->addElement('checkbox', 'activate_end_date_check', null , get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()'));
2196
+            $form->addElement('checkbox', 'activate_end_date_check', null, get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()'));
2197 2197
 
2198 2198
             if (!empty($this->end_time)) {
2199 2199
                 $form->addElement('html', '<div id="end_date_div" style="display:block;">');
@@ -2202,7 +2202,7 @@  discard block
 block discarded – undo
2202 2202
             }
2203 2203
 
2204 2204
             $form->addElement('date_time_picker', 'end_time');
2205
-            $form->addElement('html','</div>');
2205
+            $form->addElement('html', '</div>');
2206 2206
 
2207 2207
             //$check_option=$this->selectType();
2208 2208
             $diplay = 'block';
@@ -2212,10 +2212,10 @@  discard block
 block discarded – undo
2212 2212
                 null,
2213 2213
                 get_lang('SaveTheCorrectAnswersForTheNextAttempt')
2214 2214
             );
2215
-            $form->addElement('html','<div class="clear">&nbsp;</div>');
2215
+            $form->addElement('html', '<div class="clear">&nbsp;</div>');
2216 2216
             $form->addElement('checkbox', 'review_answers', null, get_lang('ReviewAnswers'));
2217 2217
 
2218
-            $form->addElement('html','<div id="divtimecontrol"  style="display:'.$diplay.';">');
2218
+            $form->addElement('html', '<div id="divtimecontrol"  style="display:'.$diplay.';">');
2219 2219
 
2220 2220
             //Timer control
2221 2221
             //$time_hours_option = range(0,12);
@@ -2232,12 +2232,12 @@  discard block
 block discarded – undo
2232 2232
                 )
2233 2233
             );
2234 2234
 
2235
-            $expired_date = (int)$this->selectExpiredTime();
2235
+            $expired_date = (int) $this->selectExpiredTime();
2236 2236
 
2237
-            if (($expired_date!='0')) {
2238
-                $form->addElement('html','<div id="timercontrol" style="display:block;">');
2237
+            if (($expired_date != '0')) {
2238
+                $form->addElement('html', '<div id="timercontrol" style="display:block;">');
2239 2239
             } else {
2240
-                $form->addElement('html','<div id="timercontrol" style="display:none;">');
2240
+                $form->addElement('html', '<div id="timercontrol" style="display:none;">');
2241 2241
             }
2242 2242
             $form->addText(
2243 2243
                 'enabletimercontroltotalminutes',
@@ -2248,7 +2248,7 @@  discard block
 block discarded – undo
2248 2248
                     'cols-size' => [2, 2, 8]
2249 2249
                 ]
2250 2250
             );
2251
-            $form->addElement('html','</div>');
2251
+            $form->addElement('html', '</div>');
2252 2252
 
2253 2253
             $form->addElement(
2254 2254
                 'text',
@@ -2273,7 +2273,7 @@  discard block
 block discarded – undo
2273 2273
             $defaults = array();
2274 2274
 
2275 2275
             if (api_get_setting('search_enabled') === 'true') {
2276
-                require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
2276
+                require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
2277 2277
 
2278 2278
                 $form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument'));
2279 2279
                 $form->addSelectLanguage('language', get_lang('SearchFeatureDocumentLanguage'));
@@ -2281,15 +2281,15 @@  discard block
 block discarded – undo
2281 2281
                 $specific_fields = get_specific_field_list();
2282 2282
 
2283 2283
                 foreach ($specific_fields as $specific_field) {
2284
-                    $form->addElement ('text', $specific_field['code'], $specific_field['name']);
2284
+                    $form->addElement('text', $specific_field['code'], $specific_field['name']);
2285 2285
                     $filter = array(
2286 2286
                         'c_id' => api_get_course_int_id(),
2287 2287
                         'field_id' => $specific_field['id'],
2288 2288
                         'ref_id' => $this->id,
2289
-                        'tool_id' => "'" . TOOL_QUIZ . "'"
2289
+                        'tool_id' => "'".TOOL_QUIZ."'"
2290 2290
                     );
2291 2291
                     $values = get_specific_field_values_list($filter, array('value'));
2292
-                    if ( !empty($values) ) {
2292
+                    if (!empty($values)) {
2293 2293
                         $arr_str_values = array();
2294 2294
                         foreach ($values as $value) {
2295 2295
                             $arr_str_values[] = $value['value'];
@@ -2299,8 +2299,8 @@  discard block
 block discarded – undo
2299 2299
                 }
2300 2300
             }
2301 2301
 
2302
-            $form->addElement('html','</div>');  //End advanced setting
2303
-            $form->addElement('html','</div>');
2302
+            $form->addElement('html', '</div>'); //End advanced setting
2303
+            $form->addElement('html', '</div>');
2304 2304
         }
2305 2305
 
2306 2306
         // submit
@@ -2320,10 +2320,10 @@  discard block
 block discarded – undo
2320 2320
         }
2321 2321
 
2322 2322
         // defaults
2323
-        if ($type=='full') {
2323
+        if ($type == 'full') {
2324 2324
             if ($this->id > 0) {
2325 2325
                 if ($this->random > $this->selectNbrQuestions()) {
2326
-                    $defaults['randomQuestions'] =  $this->selectNbrQuestions();
2326
+                    $defaults['randomQuestions'] = $this->selectNbrQuestions();
2327 2327
                 } else {
2328 2328
                     $defaults['randomQuestions'] = $this->random;
2329 2329
                 }
@@ -2353,7 +2353,7 @@  discard block
 block discarded – undo
2353 2353
                 }
2354 2354
 
2355 2355
                 $defaults['start_time'] = !empty($this->start_time) ? api_get_local_time($this->start_time) : date('Y-m-d 12:00:00');
2356
-                $defaults['end_time'] = empty($this->end_time) ? api_get_local_time($this->end_time) : date('Y-m-d 12:00:00', time()+84600);
2356
+                $defaults['end_time'] = empty($this->end_time) ? api_get_local_time($this->end_time) : date('Y-m-d 12:00:00', time() + 84600);
2357 2357
 
2358 2358
                 // Get expired time
2359 2359
                 if ($this->expired_time != '0') {
@@ -2374,7 +2374,7 @@  discard block
 block discarded – undo
2374 2374
                 $defaults['text_when_finished'] = '';
2375 2375
                 $defaults['start_time'] = date('Y-m-d 12:00:00');
2376 2376
                 $defaults['display_category_name'] = 1;
2377
-                $defaults['end_time']   = date('Y-m-d 12:00:00', time()+84600);
2377
+                $defaults['end_time']   = date('Y-m-d 12:00:00', time() + 84600);
2378 2378
                 $defaults['pass_percentage'] = '';
2379 2379
                 $defaults['end_button'] = $this->selectEndButton();
2380 2380
                 $defaults['question_selection_type'] = 1;
@@ -2474,9 +2474,9 @@  discard block
 block discarded – undo
2474 2474
         }
2475 2475
 
2476 2476
         if ($form->getSubmitValue('randomAnswers') == 1) {
2477
-            $this->random_answers=1;
2477
+            $this->random_answers = 1;
2478 2478
         } else {
2479
-            $this->random_answers=0;
2479
+            $this->random_answers = 0;
2480 2480
         }
2481 2481
         $this->save($type);
2482 2482
     }
@@ -2488,9 +2488,9 @@  discard block
 block discarded – undo
2488 2488
         }
2489 2489
         $course_id = api_get_course_id();
2490 2490
 
2491
-        require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php';
2492
-        require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php';
2493
-        require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
2491
+        require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
2492
+        require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php';
2493
+        require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
2494 2494
 
2495 2495
         $specific_fields = get_specific_field_list();
2496 2496
         $ic_slide = new IndexableChunk();
@@ -2500,7 +2500,7 @@  discard block
 block discarded – undo
2500 2500
             if (isset($_REQUEST[$specific_field['code']])) {
2501 2501
                 $sterms = trim($_REQUEST[$specific_field['code']]);
2502 2502
                 if (!empty($sterms)) {
2503
-                    $all_specific_terms .= ' '. $sterms;
2503
+                    $all_specific_terms .= ' '.$sterms;
2504 2504
                     $sterms = explode(',', $sterms);
2505 2505
                     foreach ($sterms as $sterm) {
2506 2506
                         $ic_slide->addTerm(trim($sterm), $specific_field['code']);
@@ -2517,15 +2517,15 @@  discard block
 block discarded – undo
2517 2517
         $xapian_data = array(
2518 2518
             SE_COURSE_ID => $course_id,
2519 2519
             SE_TOOL_ID => TOOL_QUIZ,
2520
-            SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int)$this->id),
2521
-            SE_USER => (int)api_get_user_id(),
2520
+            SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int) $this->id),
2521
+            SE_USER => (int) api_get_user_id(),
2522 2522
         );
2523 2523
         $ic_slide->xapian_data = serialize($xapian_data);
2524
-        $exercise_description = $all_specific_terms .' '. $this->description;
2524
+        $exercise_description = $all_specific_terms.' '.$this->description;
2525 2525
         $ic_slide->addValue("content", $exercise_description);
2526 2526
 
2527 2527
         $di = new ChamiloIndexer();
2528
-        isset($_POST['language'])? $lang=Database::escape_string($_POST['language']): $lang = 'english';
2528
+        isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english';
2529 2529
         $di->connectDb(NULL, NULL, $lang);
2530 2530
         $di->addChunk($ic_slide);
2531 2531
 
@@ -2544,7 +2544,7 @@  discard block
 block discarded – undo
2544 2544
     function search_engine_edit()
2545 2545
     {
2546 2546
         // update search enchine and its values table if enabled
2547
-        if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) {
2547
+        if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) {
2548 2548
             $course_id = api_get_course_id();
2549 2549
 
2550 2550
             // actually, it consists on delete terms from db,
@@ -2556,9 +2556,9 @@  discard block
 block discarded – undo
2556 2556
             $res = Database::query($sql);
2557 2557
 
2558 2558
             if (Database::num_rows($res) > 0) {
2559
-                require_once(api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php');
2560
-                require_once(api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php');
2561
-                require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php');
2559
+                require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php');
2560
+                require_once(api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php');
2561
+                require_once(api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php');
2562 2562
 
2563 2563
                 $se_ref = Database::fetch_array($res);
2564 2564
                 $specific_fields = get_specific_field_list();
@@ -2569,7 +2569,7 @@  discard block
 block discarded – undo
2569 2569
                     delete_all_specific_field_value($course_id, $specific_field['id'], TOOL_QUIZ, $this->id);
2570 2570
                     if (isset($_REQUEST[$specific_field['code']])) {
2571 2571
                         $sterms = trim($_REQUEST[$specific_field['code']]);
2572
-                        $all_specific_terms .= ' '. $sterms;
2572
+                        $all_specific_terms .= ' '.$sterms;
2573 2573
                         $sterms = explode(',', $sterms);
2574 2574
                         foreach ($sterms as $sterm) {
2575 2575
                             $ic_slide->addTerm(trim($sterm), $specific_field['code']);
@@ -2585,17 +2585,17 @@  discard block
 block discarded – undo
2585 2585
                 $xapian_data = array(
2586 2586
                     SE_COURSE_ID => $course_id,
2587 2587
                     SE_TOOL_ID => TOOL_QUIZ,
2588
-                    SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int)$this->id),
2589
-                    SE_USER => (int)api_get_user_id(),
2588
+                    SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int) $this->id),
2589
+                    SE_USER => (int) api_get_user_id(),
2590 2590
                 );
2591 2591
                 $ic_slide->xapian_data = serialize($xapian_data);
2592
-                $exercise_description = $all_specific_terms .' '. $this->description;
2592
+                $exercise_description = $all_specific_terms.' '.$this->description;
2593 2593
                 $ic_slide->addValue("content", $exercise_description);
2594 2594
 
2595 2595
                 $di = new ChamiloIndexer();
2596
-                isset($_POST['language'])? $lang=Database::escape_string($_POST['language']): $lang = 'english';
2596
+                isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english';
2597 2597
                 $di->connectDb(NULL, NULL, $lang);
2598
-                $di->remove_document((int)$se_ref['search_did']);
2598
+                $di->remove_document((int) $se_ref['search_did']);
2599 2599
                 $di->addChunk($ic_slide);
2600 2600
 
2601 2601
                 //index and return search engine document id
@@ -2620,7 +2620,7 @@  discard block
 block discarded – undo
2620 2620
     function search_engine_delete()
2621 2621
     {
2622 2622
         // remove from search engine if enabled
2623
-        if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian') ) {
2623
+        if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) {
2624 2624
             $course_id = api_get_course_id();
2625 2625
             $tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF);
2626 2626
             $sql = 'SELECT * FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s AND ref_id_second_level IS NULL LIMIT 1';
@@ -2628,19 +2628,19 @@  discard block
 block discarded – undo
2628 2628
             $res = Database::query($sql);
2629 2629
             if (Database::num_rows($res) > 0) {
2630 2630
                 $row = Database::fetch_array($res);
2631
-                require_once(api_get_path(LIBRARY_PATH) .'search/ChamiloIndexer.class.php');
2631
+                require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php');
2632 2632
                 $di = new ChamiloIndexer();
2633
-                $di->remove_document((int)$row['search_did']);
2633
+                $di->remove_document((int) $row['search_did']);
2634 2634
                 unset($di);
2635 2635
                 $tbl_quiz_question = Database::get_course_table(TABLE_QUIZ_QUESTION);
2636
-                foreach ( $this->questionList as $question_i) {
2636
+                foreach ($this->questionList as $question_i) {
2637 2637
                     $sql = 'SELECT type FROM %s WHERE id=%s';
2638 2638
                     $sql = sprintf($sql, $tbl_quiz_question, $question_i);
2639 2639
                     $qres = Database::query($sql);
2640 2640
                     if (Database::num_rows($qres) > 0) {
2641 2641
                         $qrow = Database::fetch_array($qres);
2642 2642
                         $objQuestion = Question::getInstance($qrow['type']);
2643
-                        $objQuestion = Question::read((int)$question_i);
2643
+                        $objQuestion = Question::read((int) $question_i);
2644 2644
                         $objQuestion->search_engine_edit($this->id, FALSE, TRUE);
2645 2645
                         unset($objQuestion);
2646 2646
                     }
@@ -2651,7 +2651,7 @@  discard block
 block discarded – undo
2651 2651
             Database::query($sql);
2652 2652
 
2653 2653
             // remove terms from db
2654
-            require_once api_get_path(LIBRARY_PATH) .'specific_fields_manager.lib.php';
2654
+            require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
2655 2655
             delete_all_values_for_item($course_id, TOOL_QUIZ, $this->id);
2656 2656
         }
2657 2657
     }
@@ -2817,25 +2817,25 @@  discard block
 block discarded – undo
2817 2817
             $lp_id = 0;
2818 2818
         }
2819 2819
         if (empty($lp_item_id)) {
2820
-            $lp_item_id   = 0;
2820
+            $lp_item_id = 0;
2821 2821
         }
2822 2822
         if (empty($lp_item_view_id)) {
2823 2823
             $lp_item_view_id = 0;
2824 2824
         }
2825
-        $condition = ' WHERE exe_exo_id 	= ' . "'" . $this->id . "'" .' AND
2826
-					   exe_user_id 			= ' . "'" . api_get_user_id() . "'" . ' AND
2827
-					   c_id                 = ' . api_get_course_int_id() . ' AND
2828
-					   status 				= ' . "'" . Database::escape_string($status). "'" . ' AND
2829
-					   orig_lp_id 			= ' . "'" . $lp_id . "'" . ' AND
2830
-					   orig_lp_item_id 		= ' . "'" . $lp_item_id . "'" . ' AND
2831
-                       orig_lp_item_view_id = ' . "'" . $lp_item_view_id . "'" . ' AND
2832
-					   session_id 			= ' . "'" . api_get_session_id() . "' LIMIT 1"; //Adding limit 1 just in case
2825
+        $condition = ' WHERE exe_exo_id 	= '."'".$this->id."'".' AND
2826
+					   exe_user_id 			= ' . "'".api_get_user_id()."'".' AND
2827
+					   c_id                 = ' . api_get_course_int_id().' AND
2828
+					   status 				= ' . "'".Database::escape_string($status)."'".' AND
2829
+					   orig_lp_id 			= ' . "'".$lp_id."'".' AND
2830
+					   orig_lp_item_id 		= ' . "'".$lp_item_id."'".' AND
2831
+                       orig_lp_item_view_id = ' . "'".$lp_item_view_id."'".' AND
2832
+					   session_id 			= ' . "'".api_get_session_id()."' LIMIT 1"; //Adding limit 1 just in case
2833 2833
 
2834 2834
         $sql_track = 'SELECT * FROM '.$track_exercises.$condition;
2835 2835
 
2836 2836
         $result = Database::query($sql_track);
2837 2837
         $new_array = array();
2838
-        if (Database::num_rows($result) > 0 ) {
2838
+        if (Database::num_rows($result) > 0) {
2839 2839
             $new_array = Database::fetch_array($result, 'ASSOC');
2840 2840
             $new_array['num_exe'] = Database::num_rows($result);
2841 2841
         }
@@ -2879,12 +2879,12 @@  discard block
 block discarded – undo
2879 2879
         $questionList = array_map('intval', $questionList);
2880 2880
 
2881 2881
         $params = array(
2882
-            'exe_exo_id' => $this->id ,
2882
+            'exe_exo_id' => $this->id,
2883 2883
             'exe_user_id' => api_get_user_id(),
2884 2884
             'c_id' => api_get_course_int_id(),
2885 2885
             'status' =>  'incomplete',
2886 2886
             'session_id'  => api_get_session_id(),
2887
-            'data_tracking'  => implode(',', $questionList) ,
2887
+            'data_tracking'  => implode(',', $questionList),
2888 2888
             'start_date' => api_get_utc_datetime(),
2889 2889
             'orig_lp_id' => $safe_lp_id,
2890 2890
             'orig_lp_item_id'  => $safe_lp_item_id,
@@ -2918,7 +2918,7 @@  discard block
 block discarded – undo
2918 2918
         $nbrQuestions = $this->get_count_question_list();
2919 2919
 
2920 2920
         $all_button = $html = $label = '';
2921
-        $hotspot_get = isset($_POST['hotspot']) ? Security::remove_XSS($_POST['hotspot']):null;
2921
+        $hotspot_get = isset($_POST['hotspot']) ? Security::remove_XSS($_POST['hotspot']) : null;
2922 2922
 
2923 2923
         if ($this->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT && $this->type == ONE_PER_PAGE) {
2924 2924
             $urlTitle = get_lang('ContinueTest');
@@ -2929,7 +2929,7 @@  discard block
 block discarded – undo
2929 2929
 
2930 2930
             $html .= Display::url(
2931 2931
                 $urlTitle,
2932
-                'exercise_submit_modal.php?' . http_build_query([
2932
+                'exercise_submit_modal.php?'.http_build_query([
2933 2933
                     'learnpath_id' => $safe_lp_id,
2934 2934
                     'learnpath_item_id' => $safe_lp_item_id,
2935 2935
                     'learnpath_item_view_id' => $safe_lp_item_view_id,
@@ -2946,7 +2946,7 @@  discard block
 block discarded – undo
2946 2946
                     'data-size' => 'md'
2947 2947
                 ]
2948 2948
             );
2949
-            $html .='<br />';
2949
+            $html .= '<br />';
2950 2950
         } else {
2951 2951
             // User
2952 2952
             if (api_is_allowed_to_session_edit()) {
@@ -2971,7 +2971,7 @@  discard block
 block discarded – undo
2971 2971
 
2972 2972
                     //Next question
2973 2973
                     if (!empty($questions_in_media)) {
2974
-                        $questions_in_media = "['".implode("','",$questions_in_media)."']";
2974
+                        $questions_in_media = "['".implode("','", $questions_in_media)."']";
2975 2975
                         $all_button .= '&nbsp;<a href="javascript://" class="'.$class.'" onclick="save_question_list('.$questions_in_media.'); ">'.$label.'</a>';
2976 2976
                     } else {
2977 2977
                         $all_button .= '&nbsp;<a href="javascript://" class="'.$class.'" onclick="save_now('.$question_id.', \'\', \''.$currentAnswer.'\'); ">'.$label.'</a>';
@@ -2989,7 +2989,7 @@  discard block
 block discarded – undo
2989 2989
                     }
2990 2990
 					$class .= ' question-validate-btn'; // used to select it with jquery
2991 2991
                     $all_button = '&nbsp;<a href="javascript://" class="'.$class.'" onclick="validate_all(); ">'.$all_label.'</a>';
2992
-                    $all_button .= '&nbsp;' . Display::span(null, ['id' => 'save_all_reponse']);
2992
+                    $all_button .= '&nbsp;'.Display::span(null, ['id' => 'save_all_reponse']);
2993 2993
                     $html .= $all_button;
2994 2994
                 }
2995 2995
             }
@@ -3278,11 +3278,11 @@  discard block
 block discarded – undo
3278 3278
             $answer = $objAnswerTmp->selectAnswer($answerId);
3279 3279
             $answerComment = $objAnswerTmp->selectComment($answerId);
3280 3280
             $answerCorrect = $objAnswerTmp->isCorrect($answerId);
3281
-            $answerWeighting = (float)$objAnswerTmp->selectWeighting($answerId);
3281
+            $answerWeighting = (float) $objAnswerTmp->selectWeighting($answerId);
3282 3282
             $answerAutoId = $objAnswerTmp->selectAutoId($answerId);
3283 3283
             $answerIid = isset($objAnswerTmp->iid[$answerId]) ? $objAnswerTmp->iid[$answerId] : '';
3284 3284
 
3285
-            $answer_correct_array[$answerId] = (bool)$answerCorrect;
3285
+            $answer_correct_array[$answerId] = (bool) $answerCorrect;
3286 3286
 
3287 3287
             if ($debug) {
3288 3288
                 error_log("answer auto id: $answerAutoId ");
@@ -3291,7 +3291,7 @@  discard block
 block discarded – undo
3291 3291
 
3292 3292
             // Delineation
3293 3293
             $delineation_cord = $objAnswerTmp->selectHotspotCoordinates(1);
3294
-            $answer_delineation_destination=$objAnswerTmp->selectDestination(1);
3294
+            $answer_delineation_destination = $objAnswerTmp->selectDestination(1);
3295 3295
 
3296 3296
             switch ($answerType) {
3297 3297
                 // for unique answer
@@ -3304,7 +3304,7 @@  discard block
 block discarded – undo
3304 3304
                                     exe_id = '".$exeId."' AND
3305 3305
                                     question_id= '".$questionId."'";
3306 3306
                         $result = Database::query($sql);
3307
-                        $choice = Database::result($result,0,"answer");
3307
+                        $choice = Database::result($result, 0, "answer");
3308 3308
 
3309 3309
                         $studentChoice = $choice == $answerAutoId ? 1 : 0;
3310 3310
                         if ($studentChoice) {
@@ -3355,7 +3355,7 @@  discard block
 block discarded – undo
3355 3355
                     } else {
3356 3356
                         // If no result then the user just hit don't know
3357 3357
                         $studentChoice = 3;
3358
-                        $questionScore  +=  $doubt_score;
3358
+                        $questionScore += $doubt_score;
3359 3359
                     }
3360 3360
                     $totalScore = $questionScore;
3361 3361
                     break;
@@ -3371,17 +3371,17 @@  discard block
 block discarded – undo
3371 3371
                         }
3372 3372
 
3373 3373
                         $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
3374
-                        $real_answers[$answerId] = (bool)$studentChoice;
3374
+                        $real_answers[$answerId] = (bool) $studentChoice;
3375 3375
 
3376 3376
                         if ($studentChoice) {
3377
-                            $questionScore  +=$answerWeighting;
3377
+                            $questionScore += $answerWeighting;
3378 3378
                         }
3379 3379
                     } else {
3380 3380
                         $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
3381
-                        $real_answers[$answerId] = (bool)$studentChoice;
3381
+                        $real_answers[$answerId] = (bool) $studentChoice;
3382 3382
 
3383 3383
                         if (isset($studentChoice)) {
3384
-                            $questionScore  += $answerWeighting;
3384
+                            $questionScore += $answerWeighting;
3385 3385
                         }
3386 3386
                     }
3387 3387
                     $totalScore += $answerWeighting;
@@ -3399,16 +3399,16 @@  discard block
 block discarded – undo
3399 3399
                             $choice[$ind] = 1;
3400 3400
                         }
3401 3401
                         $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
3402
-                        $real_answers[$answerId] = (bool)$studentChoice;
3402
+                        $real_answers[$answerId] = (bool) $studentChoice;
3403 3403
                         if ($studentChoice) {
3404
-                            $questionScore +=$answerWeighting;
3404
+                            $questionScore += $answerWeighting;
3405 3405
                         }
3406 3406
                     } else {
3407 3407
                         $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
3408 3408
                         if (isset($studentChoice)) {
3409 3409
                             $questionScore += $answerWeighting;
3410 3410
                         }
3411
-                        $real_answers[$answerId] = (bool)$studentChoice;
3411
+                        $real_answers[$answerId] = (bool) $studentChoice;
3412 3412
                     }
3413 3413
                     $totalScore += $answerWeighting;
3414 3414
                     if ($debug) error_log("studentChoice: $studentChoice");
@@ -3420,7 +3420,7 @@  discard block
 block discarded – undo
3420 3420
                         $resultans = Database::query($sql);
3421 3421
                         while ($row = Database::fetch_array($resultans)) {
3422 3422
                             $ind = $row['answer'];
3423
-                            $result = explode(':',$ind);
3423
+                            $result = explode(':', $ind);
3424 3424
                             if (isset($result[0])) {
3425 3425
                                 $my_answer_id = isset($result[0]) ? $result[0] : '';
3426 3426
                                 $option = isset($result[1]) ? $result[1] : '';
@@ -3541,10 +3541,10 @@  discard block
 block discarded – undo
3541 3541
                             }
3542 3542
                             // adds the piece of text that is before the blank
3543 3543
                             //and ends with '[' into a general storage array
3544
-                            $real_text[] = api_substr($temp, 0, $pos +1);
3545
-                            $answer .= api_substr($temp, 0, $pos +1);
3544
+                            $real_text[] = api_substr($temp, 0, $pos + 1);
3545
+                            $answer .= api_substr($temp, 0, $pos + 1);
3546 3546
                             //take the string remaining (after the last "[" we found)
3547
-                            $temp = api_substr($temp, $pos +1);
3547
+                            $temp = api_substr($temp, $pos + 1);
3548 3548
                             // quit the loop if there are no more blanks, and update $pos to the position of next ']'
3549 3549
                             if (($pos = api_strpos($temp, ']')) === false) {
3550 3550
                                 // adds the end of the text
@@ -3580,7 +3580,7 @@  discard block
 block discarded – undo
3580 3580
                             //put the contents of the [] answer tag into correct_tags[]
3581 3581
                             $correct_tags[] = api_substr($temp, 0, $pos);
3582 3582
                             $j++;
3583
-                            $temp = api_substr($temp, $pos +1);
3583
+                            $temp = api_substr($temp, $pos + 1);
3584 3584
                         }
3585 3585
                         $answer = '';
3586 3586
                         $real_correct_tags = $correct_tags;
@@ -3603,7 +3603,7 @@  discard block
 block discarded – undo
3603 3603
                                 } elseif (!empty($user_tags[$i])) {
3604 3604
                                     // else if the word entered by the student IS NOT the same as the one defined by the professor
3605 3605
                                     // adds the word in red at the end of the string, and strikes it
3606
-                                    $answer .= '<font color="red"><s>' . $user_tags[$i] . '</s></font>';
3606
+                                    $answer .= '<font color="red"><s>'.$user_tags[$i].'</s></font>';
3607 3607
                                 } else {
3608 3608
                                     // adds a tabulation if no word has been typed by the student
3609 3609
                                     $answer .= ''; // remove &nbsp; that causes issue
@@ -3622,17 +3622,17 @@  discard block
 block discarded – undo
3622 3622
                                 } elseif (!empty ($user_tags[$i])) {
3623 3623
                                     // else if the word entered by the student IS NOT the same as the one defined by the professor
3624 3624
                                     // adds the word in red at the end of the string, and strikes it
3625
-                                    $answer .= '<font color="red"><s>' . $user_tags[$i] . '</s></font>';
3625
+                                    $answer .= '<font color="red"><s>'.$user_tags[$i].'</s></font>';
3626 3626
                                 } else {
3627 3627
                                     // adds a tabulation if no word has been typed by the student
3628
-                                    $answer .= '';  // remove &nbsp; that causes issue
3628
+                                    $answer .= ''; // remove &nbsp; that causes issue
3629 3629
                                 }
3630 3630
                             }
3631 3631
 
3632 3632
                             // adds the correct word, followed by ] to close the blank
3633
-                            $answer .= ' / <font color="green"><b>' . $real_correct_tags[$i] . '</b></font>]';
3634
-                            if (isset($real_text[$i +1])) {
3635
-                                $answer .= $real_text[$i +1];
3633
+                            $answer .= ' / <font color="green"><b>'.$real_correct_tags[$i].'</b></font>]';
3634
+                            if (isset($real_text[$i + 1])) {
3635
+                                $answer .= $real_text[$i + 1];
3636 3636
                             }
3637 3637
                         }
3638 3638
                     } else {
@@ -3753,10 +3753,10 @@  discard block
 block discarded – undo
3753 3753
                         }
3754 3754
                         // adds the piece of text that is before the blank
3755 3755
                         //and ends with '[' into a general storage array
3756
-                        $realText[] = api_substr($temp, 0, $pos +1);
3757
-                        $answer .= api_substr($temp, 0, $pos +1);
3756
+                        $realText[] = api_substr($temp, 0, $pos + 1);
3757
+                        $answer .= api_substr($temp, 0, $pos + 1);
3758 3758
                         //take the string remaining (after the last "[" we found)
3759
-                        $temp = api_substr($temp, $pos +1);
3759
+                        $temp = api_substr($temp, $pos + 1);
3760 3760
                         // quit the loop if there are no more blanks, and update $pos to the position of next ']'
3761 3761
                         if (($pos = api_strpos($temp, ']')) === false) {
3762 3762
                             // adds the end of the text
@@ -3797,7 +3797,7 @@  discard block
 block discarded – undo
3797 3797
                         //put the contents of the [] answer tag into correct_tags[]
3798 3798
                         $correctTags[] = api_substr($temp, 0, $pos);
3799 3799
                         $j++;
3800
-                        $temp = api_substr($temp, $pos +1);
3800
+                        $temp = api_substr($temp, $pos + 1);
3801 3801
                     }
3802 3802
                     $answer = '';
3803 3803
                     $realCorrectTags = $correctTags;
@@ -3817,7 +3817,7 @@  discard block
 block discarded – undo
3817 3817
                         } elseif (!empty($userTags[$i])) {
3818 3818
                             // else if the word entered by the student IS NOT the same as the one defined by the professor
3819 3819
                             // adds the word in red at the end of the string, and strikes it
3820
-                            $answer .= '<font color="red"><s>' . $userTags[$i] . '</s></font>';
3820
+                            $answer .= '<font color="red"><s>'.$userTags[$i].'</s></font>';
3821 3821
                         } else {
3822 3822
                             // adds a tabulation if no word has been typed by the student
3823 3823
                             $answer .= ''; // remove &nbsp; that causes issue
@@ -3827,19 +3827,19 @@  discard block
 block discarded – undo
3827 3827
                         if (
3828 3828
                             $this->results_disabled != EXERCISE_FEEDBACK_TYPE_EXAM
3829 3829
                         ) {
3830
-                            $answer .= ' / <font color="green"><b>' . $realCorrectTags[$i] . '</b></font>';
3830
+                            $answer .= ' / <font color="green"><b>'.$realCorrectTags[$i].'</b></font>';
3831 3831
                         }
3832 3832
 
3833 3833
                         $answer .= ']';
3834 3834
 
3835
-                        if (isset($realText[$i +1])) {
3836
-                            $answer .= $realText[$i +1];
3835
+                        if (isset($realText[$i + 1])) {
3836
+                            $answer .= $realText[$i + 1];
3837 3837
                         }
3838 3838
                     }
3839 3839
                     break;
3840 3840
                 case FREE_ANSWER:
3841 3841
                     if ($from_database) {
3842
-                        $query  = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT."
3842
+                        $query = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT."
3843 3843
                                    WHERE exe_id = '".$exeId."' AND question_id= '".$questionId."'";
3844 3844
                         $resq = Database::query($query);
3845 3845
                         $data = Database::fetch_array($resq);
@@ -3850,9 +3850,9 @@  discard block
 block discarded – undo
3850 3850
                         $questionScore = $data['marks'];
3851 3851
 
3852 3852
                         if ($questionScore == -1) {
3853
-                            $totalScore+= 0;
3853
+                            $totalScore += 0;
3854 3854
                         } else {
3855
-                            $totalScore+= $questionScore;
3855
+                            $totalScore += $questionScore;
3856 3856
                         }
3857 3857
                         if ($questionScore == '') {
3858 3858
                             $questionScore = 0;
@@ -3931,7 +3931,7 @@  discard block
 block discarded – undo
3931 3931
 
3932 3932
                         while ($a_answers = Database::fetch_array($res_answers)) {
3933 3933
                             $i_answer_id = $a_answers['id']; //3
3934
-                            $s_answer_label = $a_answers['answer'];  // your daddy - your mother
3934
+                            $s_answer_label = $a_answers['answer']; // your daddy - your mother
3935 3935
                             $i_answer_correct_answer = $a_answers['correct']; //1 - 2
3936 3936
                             $i_answer_id_auto = $a_answers['id_auto']; // 3 - 4
3937 3937
 
@@ -4001,8 +4001,8 @@  discard block
 block discarded – undo
4001 4001
                                     $user_answer = '';
4002 4002
                                 }
4003 4003
                                 echo '<tr>';
4004
-                                echo '<td>' . $s_answer_label . '</td>';
4005
-                                echo '<td>' . $user_answer;
4004
+                                echo '<td>'.$s_answer_label.'</td>';
4005
+                                echo '<td>'.$user_answer;
4006 4006
 
4007 4007
                                 if (in_array($answerType, [MATCHING, MATCHING_DRAGGABLE])) {
4008 4008
                                     if (isset($real_list[$i_answer_correct_answer]) &&
@@ -4164,7 +4164,7 @@  discard block
 block discarded – undo
4164 4164
                     if ($from_database) {
4165 4165
                         // getting the user answer
4166 4166
                         $TBL_TRACK_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
4167
-                        $query   = "SELECT hotspot_correct, hotspot_coordinate
4167
+                        $query = "SELECT hotspot_correct, hotspot_coordinate
4168 4168
                                     FROM $TBL_TRACK_HOTSPOT
4169 4169
                                     WHERE
4170 4170
                                         hotspot_exe_id = '".$exeId."' AND
@@ -4172,20 +4172,20 @@  discard block
 block discarded – undo
4172 4172
                                         hotspot_answer_id='1'";
4173 4173
                         //by default we take 1 because it's a delineation
4174 4174
                         $resq = Database::query($query);
4175
-                        $row = Database::fetch_array($resq,'ASSOC');
4175
+                        $row = Database::fetch_array($resq, 'ASSOC');
4176 4176
 
4177 4177
                         $choice = $row['hotspot_correct'];
4178 4178
                         $user_answer = $row['hotspot_coordinate'];
4179 4179
 
4180 4180
                         // THIS is very important otherwise the poly_compile will throw an error!!
4181 4181
                         // round-up the coordinates
4182
-                        $coords = explode('/',$user_answer);
4182
+                        $coords = explode('/', $user_answer);
4183 4183
                         $user_array = '';
4184 4184
                         foreach ($coords as $coord) {
4185
-                            list($x,$y) = explode(';',$coord);
4185
+                            list($x, $y) = explode(';', $coord);
4186 4186
                             $user_array .= round($x).';'.round($y).'/';
4187 4187
                         }
4188
-                        $user_array = substr($user_array,0,-1);
4188
+                        $user_array = substr($user_array, 0, -1);
4189 4189
                     } else {
4190 4190
                         if (!empty($studentChoice)) {
4191 4191
                             $newquestionList[] = $questionId;
@@ -4195,13 +4195,13 @@  discard block
 block discarded – undo
4195 4195
                             $studentChoice = $choice[$answerId];
4196 4196
                             $questionScore += $answerWeighting;
4197 4197
 
4198
-                            if ($hotspot_delineation_result[1]==1) {
4198
+                            if ($hotspot_delineation_result[1] == 1) {
4199 4199
                                 $totalScore += $answerWeighting; //adding the total
4200 4200
                             }
4201 4201
                         }
4202 4202
                     }
4203
-                    $_SESSION['hotspot_coord'][1]	= $delineation_cord;
4204
-                    $_SESSION['hotspot_dest'][1]	= $answer_delineation_destination;
4203
+                    $_SESSION['hotspot_coord'][1] = $delineation_cord;
4204
+                    $_SESSION['hotspot_dest'][1] = $answer_delineation_destination;
4205 4205
                     break;
4206 4206
             } // end switch Answertype
4207 4207
 
@@ -4253,7 +4253,7 @@  discard block
 block discarded – undo
4253 4253
                                 $results_disabled,
4254 4254
                                 $showTotalScoreAndUserChoicesInLastAttempt
4255 4255
                             );
4256
-                        } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE ) {
4256
+                        } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) {
4257 4257
                             ExerciseShowFunctions::display_multiple_answer_combination_true_false(
4258 4258
                                 $feedback_type,
4259 4259
                                 $answerType,
@@ -4335,13 +4335,13 @@  discard block
 block discarded – undo
4335 4335
                             $user_answer = $_SESSION['exerciseResultCoordinates'][$questionId];
4336 4336
 
4337 4337
                             //round-up the coordinates
4338
-                            $coords = explode('/',$user_answer);
4338
+                            $coords = explode('/', $user_answer);
4339 4339
                             $user_array = '';
4340 4340
                             foreach ($coords as $coord) {
4341
-                                list($x,$y) = explode(';',$coord);
4341
+                                list($x, $y) = explode(';', $coord);
4342 4342
                                 $user_array .= round($x).';'.round($y).'/';
4343 4343
                             }
4344
-                            $user_array = substr($user_array,0,-1);
4344
+                            $user_array = substr($user_array, 0, -1);
4345 4345
 
4346 4346
                             if ($next) {
4347 4347
                                 $user_answer = $user_array;
@@ -4366,7 +4366,7 @@  discard block
 block discarded – undo
4366 4366
                                 //$overlap = round(polygons_overlap($poly_answer,$poly_user));
4367 4367
                                 // //this is an area in pixels
4368 4368
                                 if ($debug > 0) {
4369
-                                    error_log(__LINE__ . ' - Polygons results are ' . print_r($poly_results, 1), 0);
4369
+                                    error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0);
4370 4370
                                 }
4371 4371
 
4372 4372
                                 if ($overlap < 1) {
@@ -4379,43 +4379,43 @@  discard block
 block discarded – undo
4379 4379
                                     // that is overlapped by the user's polygon
4380 4380
                                     $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100);
4381 4381
                                     if ($debug > 1) {
4382
-                                        error_log(__LINE__ . ' - Final overlap is ' . $final_overlap, 0);
4382
+                                        error_log(__LINE__.' - Final overlap is '.$final_overlap, 0);
4383 4383
                                     }
4384 4384
                                     // the final missing area is the percentage of the initial polygon
4385 4385
                                     // that is not overlapped by the user's polygon
4386 4386
                                     $final_missing = 100 - $final_overlap;
4387 4387
                                     if ($debug > 1) {
4388
-                                        error_log(__LINE__ . ' - Final missing is ' . $final_missing, 0);
4388
+                                        error_log(__LINE__.' - Final missing is '.$final_missing, 0);
4389 4389
                                     }
4390 4390
                                     // the final excess area is the percentage of the initial polygon's size
4391 4391
                                     // that is covered by the user's polygon outside of the initial polygon
4392 4392
                                     $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100);
4393 4393
                                     if ($debug > 1) {
4394
-                                        error_log(__LINE__ . ' - Final excess is ' . $final_excess, 0);
4394
+                                        error_log(__LINE__.' - Final excess is '.$final_excess, 0);
4395 4395
                                     }
4396 4396
                                 }
4397 4397
 
4398 4398
                                 //checking the destination parameters parsing the "@@"
4399
-                                $destination_items= explode('@@', $answerDestination);
4399
+                                $destination_items = explode('@@', $answerDestination);
4400 4400
                                 $threadhold_total = $destination_items[0];
4401
-                                $threadhold_items=explode(';',$threadhold_total);
4401
+                                $threadhold_items = explode(';', $threadhold_total);
4402 4402
                                 $threadhold1 = $threadhold_items[0]; // overlap
4403 4403
                                 $threadhold2 = $threadhold_items[1]; // excess
4404
-                                $threadhold3 = $threadhold_items[2];	 //missing
4404
+                                $threadhold3 = $threadhold_items[2]; //missing
4405 4405
 
4406 4406
                                 // if is delineation
4407
-                                if ($answerId===1) {
4407
+                                if ($answerId === 1) {
4408 4408
                                     //setting colors
4409
-                                    if ($final_overlap>=$threadhold1) {
4410
-                                        $overlap_color=true; //echo 'a';
4409
+                                    if ($final_overlap >= $threadhold1) {
4410
+                                        $overlap_color = true; //echo 'a';
4411 4411
                                     }
4412 4412
                                     //echo $excess.'-'.$threadhold2;
4413
-                                    if ($final_excess<=$threadhold2) {
4414
-                                        $excess_color=true; //echo 'b';
4413
+                                    if ($final_excess <= $threadhold2) {
4414
+                                        $excess_color = true; //echo 'b';
4415 4415
                                     }
4416 4416
                                     //echo '--------'.$missing.'-'.$threadhold3;
4417
-                                    if ($final_missing<=$threadhold3) {
4418
-                                        $missing_color=true; //echo 'c';
4417
+                                    if ($final_missing <= $threadhold3) {
4418
+                                        $missing_color = true; //echo 'c';
4419 4419
                                     }
4420 4420
 
4421 4421
                                     // if pass
@@ -4424,67 +4424,67 @@  discard block
 block discarded – undo
4424 4424
                                         $final_missing <= $threadhold3 &&
4425 4425
                                         $final_excess <= $threadhold2
4426 4426
                                     ) {
4427
-                                        $next=1; //go to the oars
4428
-                                        $result_comment=get_lang('Acceptable');
4429
-                                        $final_answer = 1;	// do not update with  update_exercise_attempt
4427
+                                        $next = 1; //go to the oars
4428
+                                        $result_comment = get_lang('Acceptable');
4429
+                                        $final_answer = 1; // do not update with  update_exercise_attempt
4430 4430
                                     } else {
4431
-                                        $next=0;
4432
-                                        $result_comment=get_lang('Unacceptable');
4433
-                                        $comment=$answerDestination=$objAnswerTmp->selectComment(1);
4434
-                                        $answerDestination=$objAnswerTmp->selectDestination(1);
4431
+                                        $next = 0;
4432
+                                        $result_comment = get_lang('Unacceptable');
4433
+                                        $comment = $answerDestination = $objAnswerTmp->selectComment(1);
4434
+                                        $answerDestination = $objAnswerTmp->selectDestination(1);
4435 4435
                                         //checking the destination parameters parsing the "@@"
4436
-                                        $destination_items= explode('@@', $answerDestination);
4436
+                                        $destination_items = explode('@@', $answerDestination);
4437 4437
                                     }
4438
-                                } elseif($answerId>1) {
4438
+                                } elseif ($answerId > 1) {
4439 4439
                                     if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') {
4440
-                                        if ($debug>0) {
4441
-                                            error_log(__LINE__.' - answerId is of type noerror',0);
4440
+                                        if ($debug > 0) {
4441
+                                            error_log(__LINE__.' - answerId is of type noerror', 0);
4442 4442
                                         }
4443 4443
                                         //type no error shouldn't be treated
4444 4444
                                         $next = 1;
4445 4445
                                         continue;
4446 4446
                                     }
4447
-                                    if ($debug>0) {
4448
-                                        error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR',0);
4447
+                                    if ($debug > 0) {
4448
+                                        error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0);
4449 4449
                                     }
4450 4450
                                     //check the intersection between the oar and the user
4451 4451
                                     //echo 'user';	print_r($x_user_list);		print_r($y_user_list);
4452 4452
                                     //echo 'official';print_r($x_list);print_r($y_list);
4453 4453
                                     //$result = get_intersection_data($x_list,$y_list,$x_user_list,$y_user_list);
4454
-                                    $inter= $result['success'];
4454
+                                    $inter = $result['success'];
4455 4455
 
4456 4456
                                     //$delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId);
4457
-                                    $delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId);
4457
+                                    $delineation_cord = $objAnswerTmp->selectHotspotCoordinates($answerId);
4458 4458
 
4459
-                                    $poly_answer = convert_coordinates($delineation_cord,'|');
4460
-                                    $max_coord = poly_get_max($poly_user,$poly_answer);
4461
-                                    $poly_answer_compiled = poly_compile($poly_answer,$max_coord);
4462
-                                    $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord);
4459
+                                    $poly_answer = convert_coordinates($delineation_cord, '|');
4460
+                                    $max_coord = poly_get_max($poly_user, $poly_answer);
4461
+                                    $poly_answer_compiled = poly_compile($poly_answer, $max_coord);
4462
+                                    $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord);
4463 4463
 
4464 4464
                                     if ($overlap == false) {
4465 4465
                                         //all good, no overlap
4466 4466
                                         $next = 1;
4467 4467
                                         continue;
4468 4468
                                     } else {
4469
-                                        if ($debug>0) {
4470
-                                            error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit',0);
4469
+                                        if ($debug > 0) {
4470
+                                            error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0);
4471 4471
                                         }
4472 4472
                                         $organs_at_risk_hit++;
4473 4473
                                         //show the feedback
4474
-                                        $next=0;
4475
-                                        $comment=$answerDestination=$objAnswerTmp->selectComment($answerId);
4476
-                                        $answerDestination=$objAnswerTmp->selectDestination($answerId);
4477
-
4478
-                                        $destination_items= explode('@@', $answerDestination);
4479
-                                        $try_hotspot=$destination_items[1];
4480
-                                        $lp_hotspot=$destination_items[2];
4481
-                                        $select_question_hotspot=$destination_items[3];
4482
-                                        $url_hotspot=$destination_items[4];
4474
+                                        $next = 0;
4475
+                                        $comment = $answerDestination = $objAnswerTmp->selectComment($answerId);
4476
+                                        $answerDestination = $objAnswerTmp->selectDestination($answerId);
4477
+
4478
+                                        $destination_items = explode('@@', $answerDestination);
4479
+                                        $try_hotspot = $destination_items[1];
4480
+                                        $lp_hotspot = $destination_items[2];
4481
+                                        $select_question_hotspot = $destination_items[3];
4482
+                                        $url_hotspot = $destination_items[4];
4483 4483
                                     }
4484 4484
                                 }
4485 4485
                             } else {	// the first delineation feedback
4486
-                                if ($debug>0) {
4487
-                                    error_log(__LINE__.' first',0);
4486
+                                if ($debug > 0) {
4487
+                                    error_log(__LINE__.' first', 0);
4488 4488
                                 }
4489 4489
                             }
4490 4490
                         } elseif (in_array($answerType, [MATCHING, MATCHING_DRAGGABLE])) {
@@ -4492,7 +4492,7 @@  discard block
 block discarded – undo
4492 4492
                             echo Display::tag('td', $answerMatching[$answerId]);
4493 4493
                             echo Display::tag(
4494 4494
                                 'td',
4495
-                                "$user_answer / " . Display::tag(
4495
+                                "$user_answer / ".Display::tag(
4496 4496
                                     'strong',
4497 4497
                                     $answerMatching[$answerCorrect],
4498 4498
                                     ['style' => 'color: #008000; font-weight: bold;']
@@ -4644,7 +4644,7 @@  discard block
 block discarded – undo
4644 4644
                                     $questionId,
4645 4645
                                     $objQuestionTmp->getFileUrl(),
4646 4646
                                     $results_disabled
4647
-                                ) . '</td>
4647
+                                ).'</td>
4648 4648
                                 </tr>
4649 4649
                                 </table>';
4650 4650
                             break;
@@ -4706,7 +4706,7 @@  discard block
 block discarded – undo
4706 4706
 
4707 4707
                                 //$overlap = round(polygons_overlap($poly_answer,$poly_user)); //this is an area in pixels
4708 4708
                                 if ($debug > 0) {
4709
-                                    error_log(__LINE__ . ' - Polygons results are ' . print_r($poly_results, 1), 0);
4709
+                                    error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0);
4710 4710
                                 }
4711 4711
                                 if ($overlap < 1) {
4712 4712
                                     //shortcut to avoid complicated calculations
@@ -4717,17 +4717,17 @@  discard block
 block discarded – undo
4717 4717
                                     // the final overlap is the percentage of the initial polygon that is overlapped by the user's polygon
4718 4718
                                     $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100);
4719 4719
                                     if ($debug > 1) {
4720
-                                        error_log(__LINE__ . ' - Final overlap is ' . $final_overlap, 0);
4720
+                                        error_log(__LINE__.' - Final overlap is '.$final_overlap, 0);
4721 4721
                                     }
4722 4722
                                     // the final missing area is the percentage of the initial polygon that is not overlapped by the user's polygon
4723 4723
                                     $final_missing = 100 - $final_overlap;
4724 4724
                                     if ($debug > 1) {
4725
-                                        error_log(__LINE__ . ' - Final missing is ' . $final_missing, 0);
4725
+                                        error_log(__LINE__.' - Final missing is '.$final_missing, 0);
4726 4726
                                     }
4727 4727
                                     // 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
4728 4728
                                     $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100);
4729 4729
                                     if ($debug > 1) {
4730
-                                        error_log(__LINE__ . ' - Final excess is ' . $final_excess, 0);
4730
+                                        error_log(__LINE__.' - Final excess is '.$final_excess, 0);
4731 4731
                                     }
4732 4732
                                 }
4733 4733
 
@@ -4737,7 +4737,7 @@  discard block
 block discarded – undo
4737 4737
                                 $threadhold_items = explode(';', $threadhold_total);
4738 4738
                                 $threadhold1 = $threadhold_items[0]; // overlap
4739 4739
                                 $threadhold2 = $threadhold_items[1]; // excess
4740
-                                $threadhold3 = $threadhold_items[2];  //missing
4740
+                                $threadhold3 = $threadhold_items[2]; //missing
4741 4741
                                 // if is delineation
4742 4742
                                 if ($answerId === 1) {
4743 4743
                                     //setting colors
@@ -4769,14 +4769,14 @@  discard block
 block discarded – undo
4769 4769
                                 } elseif ($answerId > 1) {
4770 4770
                                     if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') {
4771 4771
                                         if ($debug > 0) {
4772
-                                            error_log(__LINE__ . ' - answerId is of type noerror', 0);
4772
+                                            error_log(__LINE__.' - answerId is of type noerror', 0);
4773 4773
                                         }
4774 4774
                                         //type no error shouldn't be treated
4775 4775
                                         $next = 1;
4776 4776
                                         continue;
4777 4777
                                     }
4778 4778
                                     if ($debug > 0) {
4779
-                                        error_log(__LINE__ . ' - answerId is >1 so we\'re probably in OAR', 0);
4779
+                                        error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0);
4780 4780
                                     }
4781 4781
                                     //check the intersection between the oar and the user
4782 4782
                                     //echo 'user';	print_r($x_user_list);		print_r($y_user_list);
@@ -4790,7 +4790,7 @@  discard block
 block discarded – undo
4790 4790
                                     $poly_answer = convert_coordinates($delineation_cord, '|');
4791 4791
                                     $max_coord = poly_get_max($poly_user, $poly_answer);
4792 4792
                                     $poly_answer_compiled = poly_compile($poly_answer, $max_coord);
4793
-                                    $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord);
4793
+                                    $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord);
4794 4794
 
4795 4795
                                     if ($overlap == false) {
4796 4796
                                         //all good, no overlap
@@ -4798,7 +4798,7 @@  discard block
 block discarded – undo
4798 4798
                                         continue;
4799 4799
                                     } else {
4800 4800
                                         if ($debug > 0) {
4801
-                                            error_log(__LINE__ . ' - Overlap is ' . $overlap . ': OAR hit', 0);
4801
+                                            error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0);
4802 4802
                                         }
4803 4803
                                         $organs_at_risk_hit++;
4804 4804
                                         //show the feedback
@@ -4810,12 +4810,12 @@  discard block
 block discarded – undo
4810 4810
                                         $try_hotspot = $destination_items[1];
4811 4811
                                         $lp_hotspot = $destination_items[2];
4812 4812
                                         $select_question_hotspot = $destination_items[3];
4813
-                                        $url_hotspot=$destination_items[4];
4813
+                                        $url_hotspot = $destination_items[4];
4814 4814
                                     }
4815 4815
                                 }
4816 4816
                             } else {	// the first delineation feedback
4817 4817
                                 if ($debug > 0) {
4818
-                                    error_log(__LINE__ . ' first', 0);
4818
+                                    error_log(__LINE__.' first', 0);
4819 4819
                                 }
4820 4820
                             }
4821 4821
                             break;
@@ -4837,7 +4837,7 @@  discard block
 block discarded – undo
4837 4837
                             echo Display::tag('td', $answerMatching[$answerId]);
4838 4838
                             echo Display::tag(
4839 4839
                                 'td',
4840
-                                "$user_answer / " . Display::tag(
4840
+                                "$user_answer / ".Display::tag(
4841 4841
                                     'strong',
4842 4842
                                     $answerMatching[$answerCorrect],
4843 4843
                                     ['style' => 'color: #008000; font-weight: bold;']
@@ -4923,7 +4923,7 @@  discard block
 block discarded – undo
4923 4923
             //  we use the results from the session (from_db=0)
4924 4924
             // TODO Change this, because it is wrong to show the user
4925 4925
             //  some results that haven't been stored in the database yet
4926
-            if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION ) {
4926
+            if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION) {
4927 4927
 
4928 4928
                 if ($debug) error_log('$from AND this is a hotspot kind of question ');
4929 4929
 
@@ -4932,19 +4932,19 @@  discard block
 block discarded – undo
4932 4932
                 if ($answerType == HOT_SPOT_DELINEATION) {
4933 4933
                     if (0) {
4934 4934
                         if ($overlap_color) {
4935
-                            $overlap_color='green';
4935
+                            $overlap_color = 'green';
4936 4936
                         } else {
4937
-                            $overlap_color='red';
4937
+                            $overlap_color = 'red';
4938 4938
                         }
4939 4939
                         if ($missing_color) {
4940
-                            $missing_color='green';
4940
+                            $missing_color = 'green';
4941 4941
                         } else {
4942
-                            $missing_color='red';
4942
+                            $missing_color = 'red';
4943 4943
                         }
4944 4944
                         if ($excess_color) {
4945
-                            $excess_color='green';
4945
+                            $excess_color = 'green';
4946 4946
                         } else {
4947
-                            $excess_color='red';
4947
+                            $excess_color = 'red';
4948 4948
                         }
4949 4949
                         if (!is_numeric($final_overlap)) {
4950 4950
                             $final_overlap = 0;
@@ -4956,33 +4956,33 @@  discard block
 block discarded – undo
4956 4956
                             $final_excess = 0;
4957 4957
                         }
4958 4958
 
4959
-                        if ($final_overlap>100) {
4959
+                        if ($final_overlap > 100) {
4960 4960
                             $final_overlap = 100;
4961 4961
                         }
4962 4962
 
4963
-                        $table_resume='<table class="data_table">
4963
+                        $table_resume = '<table class="data_table">
4964 4964
                                 <tr class="row_odd" >
4965 4965
                                     <td></td>
4966
-                                    <td ><b>' . get_lang('Requirements') . '</b></td>
4967
-                                    <td><b>' . get_lang('YourAnswer') . '</b></td>
4966
+                                    <td ><b>' . get_lang('Requirements').'</b></td>
4967
+                                    <td><b>' . get_lang('YourAnswer').'</b></td>
4968 4968
                                 </tr>
4969 4969
                                 <tr class="row_even">
4970
-                                    <td><b>' . get_lang('Overlap') . '</b></td>
4971
-                                    <td>' . get_lang('Min') . ' ' . $threadhold1 . '</td>
4972
-                                    <td><div style="color:' . $overlap_color . '">'
4973
-                                        . (($final_overlap < 0) ? 0 : intval($final_overlap)) . '</div></td>
4970
+                                    <td><b>' . get_lang('Overlap').'</b></td>
4971
+                                    <td>' . get_lang('Min').' '.$threadhold1.'</td>
4972
+                                    <td><div style="color:' . $overlap_color.'">'
4973
+                                        . (($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td>
4974 4974
                                 </tr>
4975 4975
                                 <tr>
4976
-                                    <td><b>' . get_lang('Excess') . '</b></td>
4977
-                                    <td>' . get_lang('Max') . ' ' . $threadhold2 . '</td>
4978
-                                    <td><div style="color:' . $excess_color . '">'
4979
-                                        . (($final_excess < 0) ? 0 : intval($final_excess)) . '</div></td>
4976
+                                    <td><b>' . get_lang('Excess').'</b></td>
4977
+                                    <td>' . get_lang('Max').' '.$threadhold2.'</td>
4978
+                                    <td><div style="color:' . $excess_color.'">'
4979
+                                        . (($final_excess < 0) ? 0 : intval($final_excess)).'</div></td>
4980 4980
                                 </tr>
4981 4981
                                 <tr class="row_even">
4982
-                                    <td><b>' . get_lang('Missing') . '</b></td>
4983
-                                    <td>' . get_lang('Max') . ' ' . $threadhold3 . '</td>
4984
-                                    <td><div style="color:' . $missing_color . '">'
4985
-                                        . (($final_missing < 0) ? 0 : intval($final_missing)) . '</div></td>
4982
+                                    <td><b>' . get_lang('Missing').'</b></td>
4983
+                                    <td>' . get_lang('Max').' '.$threadhold3.'</td>
4984
+                                    <td><div style="color:' . $missing_color.'">'
4985
+                                        . (($final_missing < 0) ? 0 : intval($final_missing)).'</div></td>
4986 4986
                                 </tr>
4987 4987
                             </table>';
4988 4988
                         if ($next == 0) {
@@ -4997,20 +4997,20 @@  discard block
 block discarded – undo
4997 4997
                             $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers);
4998 4998
                         }
4999 4999
 
5000
-                        echo '<h1><div style="color:#333;">' . get_lang('Feedback') . '</div></h1>
5000
+                        echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>
5001 5001
                             <p style="text-align:center">';
5002 5002
 
5003
-                        $message = '<p>' . get_lang('YourDelineation') . '</p>';
5003
+                        $message = '<p>'.get_lang('YourDelineation').'</p>';
5004 5004
                         $message .= $table_resume;
5005
-                        $message .= '<br />' . get_lang('ResultIs') . ' ' . $result_comment . '<br />';
5005
+                        $message .= '<br />'.get_lang('ResultIs').' '.$result_comment.'<br />';
5006 5006
                         if ($organs_at_risk_hit > 0) {
5007
-                            $message .= '<p><b>' . get_lang('OARHit') . '</b></p>';
5007
+                            $message .= '<p><b>'.get_lang('OARHit').'</b></p>';
5008 5008
                         }
5009
-                        $message .='<p>' . $comment . '</p>';
5009
+                        $message .= '<p>'.$comment.'</p>';
5010 5010
                         echo $message;
5011 5011
                     } else {
5012 5012
                         echo $hotspot_delineation_result[0]; //prints message
5013
-                        $from_database = 1;  // the hotspot_solution.swf needs this variable
5013
+                        $from_database = 1; // the hotspot_solution.swf needs this variable
5014 5014
                     }
5015 5015
 
5016 5016
                     //save the score attempts
@@ -5033,12 +5033,12 @@  discard block
 block discarded – undo
5033 5033
                             $exerciseResultCoordinates[$quesId]
5034 5034
                         );
5035 5035
                     } else {
5036
-                        if ($final_answer==0) {
5036
+                        if ($final_answer == 0) {
5037 5037
                             $questionScore = 0;
5038
-                            $answer=0;
5038
+                            $answer = 0;
5039 5039
                             Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0);
5040 5040
                             if (is_array($exerciseResultCoordinates[$quesId])) {
5041
-                                foreach($exerciseResultCoordinates[$quesId] as $idx => $val) {
5041
+                                foreach ($exerciseResultCoordinates[$quesId] as $idx => $val) {
5042 5042
                                     Event::saveExerciseAttemptHotspot(
5043 5043
                                         $exeId,
5044 5044
                                         $quesId,
@@ -5051,7 +5051,7 @@  discard block
 block discarded – undo
5051 5051
                         } else {
5052 5052
                             Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0);
5053 5053
                             if (is_array($exerciseResultCoordinates[$quesId])) {
5054
-                                foreach($exerciseResultCoordinates[$quesId] as $idx => $val) {
5054
+                                foreach ($exerciseResultCoordinates[$quesId] as $idx => $val) {
5055 5055
                                     $hotspotValue = (int) $choice[$idx] === 1 ? 1 : 0;
5056 5056
                                     Event::saveExerciseAttemptHotspot(
5057 5057
                                         $exeId,
@@ -5078,7 +5078,7 @@  discard block
 block discarded – undo
5078 5078
                     echo "
5079 5079
                         <tr>
5080 5080
                             <td colspan=\"2\">
5081
-                                <p><em>" . get_lang('HotSpot') . "</em></p>
5081
+                                <p><em>" . get_lang('HotSpot')."</em></p>
5082 5082
                                 <div id=\"hotspot-solution-$questionId\"></div>
5083 5083
                                 <script>
5084 5084
                                     $(document).on('ready', function () {
@@ -5113,7 +5113,7 @@  discard block
 block discarded – undo
5113 5113
 
5114 5114
         if ($saved_results) {
5115 5115
             if ($debug) error_log("Save question results $saved_results");
5116
-            if ($debug) error_log(print_r($choice ,1 ));
5116
+            if ($debug) error_log(print_r($choice, 1));
5117 5117
 
5118 5118
             if (empty($choice)) {
5119 5119
                 $choice = 0;
@@ -5125,14 +5125,14 @@  discard block
 block discarded – undo
5125 5125
                         $ans = $reply[$i];
5126 5126
                         Event::saveQuestionAttempt(
5127 5127
                             $questionScore,
5128
-                            $ans . ':' . $choice[$ans],
5128
+                            $ans.':'.$choice[$ans],
5129 5129
                             $quesId,
5130 5130
                             $exeId,
5131 5131
                             $i,
5132 5132
                             $this->id
5133 5133
                         );
5134 5134
                         if ($debug) {
5135
-                            error_log('result =>' . $questionScore . ' ' . $ans . ':' . $choice[$ans]);
5135
+                            error_log('result =>'.$questionScore.' '.$ans.':'.$choice[$ans]);
5136 5136
                         }
5137 5137
                     }
5138 5138
                 } else {
@@ -5150,7 +5150,7 @@  discard block
 block discarded – undo
5150 5150
                     $reply = array_keys($choice);
5151 5151
 
5152 5152
                     if ($debug) {
5153
-                        error_log("reply " . print_r($reply, 1) . "");
5153
+                        error_log("reply ".print_r($reply, 1)."");
5154 5154
                     }
5155 5155
                     for ($i = 0; $i < sizeof($reply); $i++) {
5156 5156
                         $ans = $reply[$i];
@@ -5239,7 +5239,7 @@  discard block
 block discarded – undo
5239 5239
 
5240 5240
                 Event::saveQuestionAttempt($questionScore, implode('|', $answer), $quesId, $exeId, 0, $this->id);
5241 5241
             } else {
5242
-                Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0,$this->id);
5242
+                Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id);
5243 5243
             }
5244 5244
         }
5245 5245
 
@@ -5249,8 +5249,8 @@  discard block
 block discarded – undo
5249 5249
 
5250 5250
         if ($saved_results) {
5251 5251
             $stat_table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
5252
-            $sql = 'UPDATE ' . $stat_table . ' SET
5253
-                        exe_result = exe_result + ' . floatval($questionScore) . '
5252
+            $sql = 'UPDATE '.$stat_table.' SET
5253
+                        exe_result = exe_result + ' . floatval($questionScore).'
5254 5254
                     WHERE exe_id = ' . $exeId;
5255 5255
             Database::query($sql);
5256 5256
         }
@@ -5341,7 +5341,7 @@  discard block
 block discarded – undo
5341 5341
         $msg = str_replace("#course#", $courseInfo['name'], $msg1);
5342 5342
 
5343 5343
         if ($origin != 'learnpath') {
5344
-            $msg.= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>';
5344
+            $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>';
5345 5345
         }
5346 5346
         $msg1 = str_replace("#url#", $url_email, $msg);
5347 5347
         $mail_content = $msg1;
@@ -5380,7 +5380,7 @@  discard block
 block discarded – undo
5380 5380
      */
5381 5381
     public function send_notification_for_open_questions($question_list_answers, $origin, $exe_id)
5382 5382
     {
5383
-        if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) {
5383
+        if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) {
5384 5384
             return null;
5385 5385
         }
5386 5386
         // Email configuration settings
@@ -5443,11 +5443,11 @@  discard block
 block discarded – undo
5443 5443
             $msg .= '</table><br />';
5444 5444
 
5445 5445
 
5446
-            $msg1   = str_replace("#exercise#",    $this->exercise, $msg);
5447
-            $msg    = str_replace("#firstName#",   $user_info['firstname'],$msg1);
5448
-            $msg1   = str_replace("#lastName#",    $user_info['lastname'],$msg);
5449
-            $msg    = str_replace("#mail#",        $user_info['email'],$msg1);
5450
-            $msg    = str_replace("#course#",      $course_info['name'],$msg1);
5446
+            $msg1   = str_replace("#exercise#", $this->exercise, $msg);
5447
+            $msg    = str_replace("#firstName#", $user_info['firstname'], $msg1);
5448
+            $msg1   = str_replace("#lastName#", $user_info['lastname'], $msg);
5449
+            $msg    = str_replace("#mail#", $user_info['email'], $msg1);
5450
+            $msg    = str_replace("#course#", $course_info['name'], $msg1);
5451 5451
 
5452 5452
             if ($origin != 'learnpath') {
5453 5453
                 $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>';
@@ -5476,7 +5476,7 @@  discard block
 block discarded – undo
5476 5476
 
5477 5477
     function send_notification_for_oral_questions($question_list_answers, $origin, $exe_id)
5478 5478
     {
5479
-        if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) {
5479
+        if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) {
5480 5480
             return null;
5481 5481
         }
5482 5482
         // Email configuration settings
@@ -5500,7 +5500,7 @@  discard block
 block discarded – undo
5500 5500
             $answer_type = $item['answer_type'];
5501 5501
 
5502 5502
             if (!empty($question) && !empty($answer) && $answer_type == ORAL_EXPRESSION) {
5503
-                $oral_question_list.='<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">'
5503
+                $oral_question_list .= '<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">'
5504 5504
                     .'<tr>'
5505 5505
                         .'<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;'.get_lang('Question').'</td>'
5506 5506
                         .'<td width="473" valign="top" bgcolor="#F3F3F3">'.$question.'</td>'
@@ -5533,7 +5533,7 @@  discard block
 block discarded – undo
5533 5533
                             .'<td>&nbsp;#mail#</td>'
5534 5534
                         .'</tr>'
5535 5535
                     .'</table>';
5536
-            $msg .=  '<br />'.sprintf(get_lang('OralQuestionsAttemptedAreX'),$oral_question_list).'<br />';
5536
+            $msg .= '<br />'.sprintf(get_lang('OralQuestionsAttemptedAreX'), $oral_question_list).'<br />';
5537 5537
             $msg1 = str_replace("#exercise#", $this->exercise, $msg);
5538 5538
             $msg = str_replace("#firstName#", $user_info['firstname'], $msg1);
5539 5539
             $msg1 = str_replace("#lastName#", $user_info['lastname'], $msg);
@@ -5541,7 +5541,7 @@  discard block
 block discarded – undo
5541 5541
             $msg = str_replace("#course#", $course_info['name'], $msg1);
5542 5542
 
5543 5543
             if ($origin != 'learnpath') {
5544
-                $msg.= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>';
5544
+                $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>';
5545 5545
             }
5546 5546
             $msg1 = str_replace("#url#", $url_email, $msg);
5547 5547
             $mail_content = $msg1;
@@ -5607,10 +5607,10 @@  discard block
 block discarded – undo
5607 5607
         }
5608 5608
         $html  = '<div class="question-result">';
5609 5609
         $html .= Display::page_header(
5610
-            Display::return_icon('test-quiz.png', get_lang('Result'),null, ICON_SIZE_MEDIUM).' '.$this->exercise.' : '.get_lang('Result')
5610
+            Display::return_icon('test-quiz.png', get_lang('Result'), null, ICON_SIZE_MEDIUM).' '.$this->exercise.' : '.get_lang('Result')
5611 5611
         );
5612 5612
         $html .= Display::description($array);
5613
-        $html .="</div>";
5613
+        $html .= "</div>";
5614 5614
         return $html;
5615 5615
     }
5616 5616
 
@@ -5727,7 +5727,7 @@  discard block
 block discarded – undo
5727 5727
                     false,
5728 5728
                     $objExercise->selectPropagateNeg()
5729 5729
                 );
5730
-                $totalScore      += $question_result['score'];
5730
+                $totalScore += $question_result['score'];
5731 5731
             }
5732 5732
 
5733 5733
             if ($objExercise->selectPropagateNeg() == 0 && $totalScore < 0) {
@@ -5931,7 +5931,7 @@  discard block
 block discarded – undo
5931 5931
         }
5932 5932
 
5933 5933
         $rawMessage = "";
5934
-        if (!empty($message)){
5934
+        if (!empty($message)) {
5935 5935
             $rawMessage = $message;
5936 5936
             $message = Display::return_message($message, 'warning', false);
5937 5937
         }
@@ -5947,7 +5947,7 @@  discard block
 block discarded – undo
5947 5947
     {
5948 5948
         $TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM);
5949 5949
         $sql = "SELECT max_score FROM $TBL_LP_ITEM
5950
-            WHERE c_id = {$this->course_id} AND item_type = '" . TOOL_QUIZ . "' AND path = '{$this->id}'";
5950
+            WHERE c_id = {$this->course_id} AND item_type = '".TOOL_QUIZ."' AND path = '{$this->id}'";
5951 5951
         $result = Database::query($sql);
5952 5952
         if (Database::num_rows($result) > 0) {
5953 5953
             return true;
@@ -6277,7 +6277,7 @@  discard block
 block discarded – undo
6277 6277
         $sql_track = "SELECT * FROM $track_exercises WHERE exe_id = $exe_id ";
6278 6278
         $result = Database::query($sql_track);
6279 6279
         $new_array = array();
6280
-        if (Database::num_rows($result) > 0 ) {
6280
+        if (Database::num_rows($result) > 0) {
6281 6281
             $new_array = Database::fetch_array($result, 'ASSOC');
6282 6282
 
6283 6283
             $new_array['duration'] = null;
@@ -6289,11 +6289,11 @@  discard block
 block discarded – undo
6289 6289
                 $start_date = api_strtotime($start_date, 'UTC');
6290 6290
                 $end_date = api_strtotime($end_date, 'UTC');
6291 6291
                 if ($start_date && $end_date) {
6292
-                    $mytime = $end_date- $start_date;
6292
+                    $mytime = $end_date - $start_date;
6293 6293
                     $new_learnpath_item = new learnpathItem(null);
6294 6294
                     $time_attemp = $new_learnpath_item->get_scorm_time('js', $mytime);
6295 6295
                     $h = get_lang('h');
6296
-                    $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp);
6296
+                    $time_attemp = str_replace('NaN', '00'.$h.'00\'00"', $time_attemp);
6297 6297
                     $new_array['duration'] = $time_attemp;
6298 6298
                 }
6299 6299
             }
@@ -6315,7 +6315,7 @@  discard block
 block discarded – undo
6315 6315
                     Database::query($sql);
6316 6316
                 }
6317 6317
             } else {
6318
-                $remind_list = explode(',',$exercise_info['questions_to_check']);
6318
+                $remind_list = explode(',', $exercise_info['questions_to_check']);
6319 6319
 
6320 6320
                 $remind_list_string = '';
6321 6321
                 if ($action == 'add') {
@@ -6327,7 +6327,7 @@  discard block
 block discarded – undo
6327 6327
                         }
6328 6328
                         $remind_list_string = implode(',', $remind_list);
6329 6329
                     }
6330
-                } elseif ($action == 'delete')  {
6330
+                } elseif ($action == 'delete') {
6331 6331
                     if (!empty($remind_list)) {
6332 6332
                         if (in_array($question_id, $remind_list)) {
6333 6333
                             $remind_list = array_flip($remind_list);
@@ -6556,7 +6556,7 @@  discard block
 block discarded – undo
6556 6556
                     true
6557 6557
                 );
6558 6558
 
6559
-                $counter += count($mediaQuestions[$questionId]) - 1 ;
6559
+                $counter += count($mediaQuestions[$questionId]) - 1;
6560 6560
                 $before = count($questionList);
6561 6561
                 $wasMedia = true;
6562 6562
                 $nextValue += count($questionList);
@@ -6635,7 +6635,7 @@  discard block
 block discarded – undo
6635 6635
                         // If it was already seen, then merge the previous with
6636 6636
                         // the current category
6637 6637
                         $oldQuestionList = $newCategoryList[$rootElement]['question_list'];
6638
-                        $category['question_list'] = array_merge($oldQuestionList , $category['question_list']);
6638
+                        $category['question_list'] = array_merge($oldQuestionList, $category['question_list']);
6639 6639
                         $newCategoryList[$rootElement] = $category;
6640 6640
                     }
6641 6641
                 }
@@ -6661,7 +6661,7 @@  discard block
 block discarded – undo
6661 6661
 
6662 6662
                 if ($useRootAsCategoryTitle) {
6663 6663
                     if (isset($category['parent_info'])) {
6664
-                        $categoryName  = $category['parent_info']['title'];
6664
+                        $categoryName = $category['parent_info']['title'];
6665 6665
                     }
6666 6666
                 }
6667 6667
                 $html .= '<div class="row">';
@@ -6804,7 +6804,7 @@  discard block
 block discarded – undo
6804 6804
         // end foreach()
6805 6805
 
6806 6806
         if ($this->type == ALL_ON_ONE_PAGE) {
6807
-            $exercise_actions =  $this->show_button($questionId, $currentQuestion);
6807
+            $exercise_actions = $this->show_button($questionId, $currentQuestion);
6808 6808
             echo Display::div($exercise_actions, array('class'=>'exercise_actions'));
6809 6809
         }
6810 6810
     }
@@ -6890,7 +6890,7 @@  discard block
 block discarded – undo
6890 6890
 
6891 6891
             // Showing the question
6892 6892
 
6893
-            $exercise_actions  = null;
6893
+            $exercise_actions = null;
6894 6894
 
6895 6895
             echo '<a id="questionanchor'.$questionId.'"></a><br />';
6896 6896
             echo '<div id="question_div_'.$questionId.'" class="main_question '.$remind_highlight.'" >';
@@ -7162,7 +7162,7 @@  discard block
 block discarded – undo
7162 7162
                         $header .= Display::tag('th', get_lang('Feedback'));
7163 7163
                     }
7164 7164
                     $s .= '<table class="data_table">';
7165
-                    $s.= Display::tag('tr', $header, array('style' => 'text-align:left;'));
7165
+                    $s .= Display::tag('tr', $header, array('style' => 'text-align:left;'));
7166 7166
                 }
7167 7167
             }
7168 7168
 
@@ -7261,7 +7261,7 @@  discard block
 block discarded – undo
7261 7261
                             $s .= '<td>';
7262 7262
                             $s .= $comment;
7263 7263
                             $s .= '</td>';
7264
-                            $s .='</tr>';
7264
+                            $s .= '</tr>';
7265 7265
                         } else {
7266 7266
                             $s .= $answer_input;
7267 7267
                         }
@@ -7275,7 +7275,7 @@  discard block
 block discarded – undo
7275 7275
                             }
7276 7276
                         }
7277 7277
 
7278
-                        $s .='<tr>';
7278
+                        $s .= '<tr>';
7279 7279
                         $s .= Display::tag('td', $answer);
7280 7280
 
7281 7281
                         if (!empty($quiz_question_options)) {
@@ -7302,7 +7302,7 @@  discard block
 block discarded – undo
7302 7302
                             $s .= $comment;
7303 7303
                             $s .= '</td>';
7304 7304
                         }
7305
-                        $s.='</tr>';
7305
+                        $s .= '</tr>';
7306 7306
                     }
7307 7307
                 } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION) {
7308 7308
                     // multiple answers
@@ -7329,16 +7329,16 @@  discard block
 block discarded – undo
7329 7329
                     $answer_input .= '</label>';
7330 7330
 
7331 7331
                     if ($show_comment) {
7332
-                        $s.= '<tr>';
7332
+                        $s .= '<tr>';
7333 7333
                         $s .= '<td>';
7334
-                        $s.= $answer_input;
7334
+                        $s .= $answer_input;
7335 7335
                         $s .= '</td>';
7336 7336
                         $s .= '<td>';
7337 7337
                         $s .= $comment;
7338 7338
                         $s .= '</td>';
7339
-                        $s.= '</tr>';
7339
+                        $s .= '</tr>';
7340 7340
                     } else {
7341
-                        $s.= $answer_input;
7341
+                        $s .= $answer_input;
7342 7342
                     }
7343 7343
                 } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) {
7344 7344
                     $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />';
@@ -7351,7 +7351,7 @@  discard block
 block discarded – undo
7351 7351
                         }
7352 7352
                     }
7353 7353
                     $answer = Security::remove_XSS($answer);
7354
-                    $s .='<tr>';
7354
+                    $s .= '<tr>';
7355 7355
                     $s .= Display::tag('td', $answer);
7356 7356
 
7357 7357
                     foreach ($objQuestionTmp->options as $key => $item) {
@@ -7375,7 +7375,7 @@  discard block
 block discarded – undo
7375 7375
                         $s .= $comment;
7376 7376
                         $s .= '</td>';
7377 7377
                     }
7378
-                    $s.='</tr>';
7378
+                    $s .= '</tr>';
7379 7379
                 } elseif ($answerType == FILL_IN_BLANKS) {
7380 7380
                     list($answer) = explode('::', $answer);
7381 7381
 
@@ -7409,7 +7409,7 @@  discard block
 block discarded – undo
7409 7409
                                     $value = str_replace('&nbsp;', '', trim($value[0]));
7410 7410
                                 }
7411 7411
                                 $correct_item = preg_quote($correct_item);
7412
-                                $correct_item = api_preg_replace('|/|', '\/', $correct_item);   // to prevent error if there is a / in the text to find
7412
+                                $correct_item = api_preg_replace('|/|', '\/', $correct_item); // to prevent error if there is a / in the text to find
7413 7413
                                 $answer = api_preg_replace('/'.$correct_item.'/', Display::input('text', "choice[$questionId][]", $value), $answer, 1);
7414 7414
                             }
7415 7415
                             $i++;
@@ -7466,7 +7466,7 @@  discard block
 block discarded – undo
7466 7466
                         }
7467 7467
 
7468 7468
                         if (!empty($answerCorrect) && !empty($selectedValue)) {
7469
-                            $s.= '<script>
7469
+                            $s .= '<script>
7470 7470
                                 jsPlumb.ready(function() {
7471 7471
                                     jsPlumb.connect({
7472 7472
                                         source: "window_'.$windowId.'",
@@ -7481,14 +7481,14 @@  discard block
 block discarded – undo
7481 7481
                         }
7482 7482
                         $s .= '</select></div></td>';
7483 7483
 
7484
-                        $s.='<td width="45%" valign="top" >';
7484
+                        $s .= '<td width="45%" valign="top" >';
7485 7485
 
7486 7486
                         if (isset($select_items[$lines_count])) {
7487
-                            $s.= '<div id="window_'.$windowId.'_answer" class="window window_right_question">
7487
+                            $s .= '<div id="window_'.$windowId.'_answer" class="window window_right_question">
7488 7488
                                     <b>'.$select_items[$lines_count]['letter'].'.</b> '.$select_items[$lines_count]['answer'].'
7489 7489
                                   </div>';
7490 7490
                         } else {
7491
-                            $s.='&nbsp;';
7491
+                            $s .= '&nbsp;';
7492 7492
                         }
7493 7493
 
7494 7494
                         $s .= '</td>';
@@ -7502,16 +7502,16 @@  discard block
 block discarded – undo
7502 7502
                                 $s .= '<tr>
7503 7503
                                       <td colspan="2"></td>
7504 7504
                                       <td valign="top">';
7505
-                                $s.='<b>'.$select_items[$lines_count]['letter'].'.</b>';
7505
+                                $s .= '<b>'.$select_items[$lines_count]['letter'].'.</b>';
7506 7506
                                 $s .= $select_items[$lines_count]['answer'];
7507
-                                $s.="</td>
7507
+                                $s .= "</td>
7508 7508
                                 </tr>";
7509 7509
                                 $lines_count++;
7510 7510
                             } // end while()
7511 7511
                         }  // end if()
7512 7512
                         $matching_correct_answer++;
7513 7513
                     }
7514
-                } elseif ($answerType ==  DRAGGABLE) {
7514
+                } elseif ($answerType == DRAGGABLE) {
7515 7515
                     // matching type, showing suggestions and answers
7516 7516
                     // TODO: replace $answerId by $numAnswer
7517 7517
                     if ($answerCorrect != 0) {
@@ -7552,7 +7552,7 @@  discard block
 block discarded – undo
7552 7552
                         $s .= '</select>';
7553 7553
 
7554 7554
                         if (!empty($answerCorrect) && !empty($selectedValue)) {
7555
-                            $s.= '<script>
7555
+                            $s .= '<script>
7556 7556
                                 $(function() {
7557 7557
                                     deleteItem($("#'.$questionId.'_'.$selectedValue.'"), $("#drop_'.$windowId.'"));
7558 7558
                                 });
@@ -7560,11 +7560,11 @@  discard block
 block discarded – undo
7560 7560
                         }
7561 7561
 
7562 7562
                         if (isset($select_items[$lines_count])) {
7563
-                            $s.= '<div id="window_'.$windowId.'_answer" class="">
7563
+                            $s .= '<div id="window_'.$windowId.'_answer" class="">
7564 7564
                                     <b>'.$select_items[$lines_count]['letter'].'.</b> '.$select_items[$lines_count]['answer'].'
7565 7565
                                   </div>';
7566 7566
                         } else {
7567
-                            $s.='&nbsp;';
7567
+                            $s .= '&nbsp;';
7568 7568
                         }
7569 7569
                         $lines_count++;
7570 7570
                         //if the left side of the "matching" has been completely
@@ -7573,7 +7573,7 @@  discard block
 block discarded – undo
7573 7573
                         if (($lines_count - 1) == $num_suggestions) {
7574 7574
                             // if it remains answers to shown at the right side
7575 7575
                             while (isset($select_items[$lines_count])) {
7576
-                                $s.='<b>'.$select_items[$lines_count]['letter'].'.</b>';
7576
+                                $s .= '<b>'.$select_items[$lines_count]['letter'].'.</b>';
7577 7577
                                 $s .= $select_items[$lines_count]['answer'];
7578 7578
                                 $lines_count++;
7579 7579
                             }
@@ -7676,9 +7676,9 @@  discard block
 block discarded – undo
7676 7676
 
7677 7677
             if (!$only_questions) {
7678 7678
                 if ($show_title) {
7679
-                    $html .=  TestCategory::getCategoryNamesForQuestion($objQuestionTmp->id);
7680
-                    $html .=  '<div class="question_title">'.$current_item.'. '.$questionName.'</div>';
7681
-                    $html .=  $questionDescription;
7679
+                    $html .= TestCategory::getCategoryNamesForQuestion($objQuestionTmp->id);
7680
+                    $html .= '<div class="question_title">'.$current_item.'. '.$questionName.'</div>';
7681
+                    $html .= $questionDescription;
7682 7682
                 } else {
7683 7683
                     $html .= '<div class="media">';
7684 7684
                     $html .= '<div class="pull-left">';
@@ -7694,11 +7694,11 @@  discard block
 block discarded – undo
7694 7694
                     $html .= '</div>';
7695 7695
                 }
7696 7696
                 //@todo I need to the get the feedback type
7697
-                $html .=  '<input type="hidden" name="hidden_hotspot_id" value="'.$questionId.'" />';
7698
-                $html .=  '<table class="exercise_questions">
7697
+                $html .= '<input type="hidden" name="hidden_hotspot_id" value="'.$questionId.'" />';
7698
+                $html .= '<table class="exercise_questions">
7699 7699
                            <tr>
7700 7700
                             <td valign="top" colspan="2">';
7701
-                $html .=  '</td></tr>';
7701
+                $html .= '</td></tr>';
7702 7702
             }
7703 7703
 
7704 7704
             $canClick = isset($_GET['editQuestion']) ? '0' : (isset($_GET['modifyAnswers']) ? '0' : '1');
Please login to merge, or discard this patch.
main/exercise/UniqueAnswerImage.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -40,22 +40,22 @@  discard block
 block discarded – undo
40 40
 
41 41
         if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) {
42 42
             //Scenario
43
-            $commentTitle = '<th>' . get_lang('Comment') . '</th>';
44
-            $feedbackTitle = '<th>' . get_lang('Scenario') . '</th>';
43
+            $commentTitle = '<th>'.get_lang('Comment').'</th>';
44
+            $feedbackTitle = '<th>'.get_lang('Scenario').'</th>';
45 45
         } else {
46
-            $commentTitle = '<th >' . get_lang('Comment') . '</th>';
46
+            $commentTitle = '<th >'.get_lang('Comment').'</th>';
47 47
         }
48 48
 
49 49
         $html = '<div class="alert alert-success" role="alert">'.get_lang('UniqueAnswerImagePreferredSize200x150').'</div>';
50 50
         $html .= '<table class="table table-striped table-hover">
51 51
             <thead>
52 52
                 <tr style="text-align: center;">
53
-                    <th width="10">' . get_lang('Number') . '</th>
54
-                    <th>' . get_lang('True') . '</th>
55
-                    <th>' . get_lang('Answer') . '</th>
56
-                        ' . $commentTitle . '
57
-                        ' . $feedbackTitle . '
58
-                    <th width="15">' . get_lang('Weighting') . '</th>
53
+                    <th width="10">' . get_lang('Number').'</th>
54
+                    <th>' . get_lang('True').'</th>
55
+                    <th>' . get_lang('Answer').'</th>
56
+                        ' . $commentTitle.'
57
+                        ' . $feedbackTitle.'
58
+                    <th width="15">' . get_lang('Weighting').'</th>
59 59
                 </tr>
60 60
             </thead>
61 61
             <tbody>';
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
                 }
91 91
 
92 92
                 $question = Question::read($questionid);
93
-                $selectQuestion[$questionid] = 'Q' . $key . ' :' . cut(
93
+                $selectQuestion[$questionid] = 'Q'.$key.' :'.cut(
94 94
                     $question->selectTitle(), 20
95 95
                 );
96 96
             }
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
                     $correct = $i;
124 124
                 }
125 125
 
126
-                $defaults['answer[' . $i . ']'] = $answer->answer[$i];
127
-                $defaults['comment[' . $i . ']'] = $answer->comment[$i];
128
-                $defaults['weighting[' . $i . ']'] = float_format(
126
+                $defaults['answer['.$i.']'] = $answer->answer[$i];
127
+                $defaults['comment['.$i.']'] = $answer->comment[$i];
128
+                $defaults['weighting['.$i.']'] = float_format(
129 129
                     $answer->weighting[$i], 1
130 130
                 );
131 131
 
@@ -148,18 +148,18 @@  discard block
 block discarded – undo
148 148
                     $urlResult = $url;
149 149
                 }
150 150
 
151
-                $tempScenario['url' . $i] = $urlResult;
152
-                $tempScenario['try' . $i] = $tryResult;
153
-                $tempScenario['lp' . $i] = $lp;
154
-                $tempScenario['destination' . $i] = $listDestination;
151
+                $tempScenario['url'.$i] = $urlResult;
152
+                $tempScenario['try'.$i] = $tryResult;
153
+                $tempScenario['lp'.$i] = $lp;
154
+                $tempScenario['destination'.$i] = $listDestination;
155 155
             } else {
156 156
                 $defaults['answer[1]'] = get_lang('DefaultUniqueAnswer1');
157 157
                 $defaults['weighting[1]'] = 10;
158 158
                 $defaults['answer[2]'] = get_lang('DefaultUniqueAnswer2');
159 159
                 $defaults['weighting[2]'] = 0;
160 160
 
161
-                $tempScenario['destination' . $i] = array('0');
162
-                $tempScenario['lp' . $i] = array('0');
161
+                $tempScenario['destination'.$i] = array('0');
162
+                $tempScenario['lp'.$i] = array('0');
163 163
             }
164 164
 
165 165
             $defaults['scenario'] = $tempScenario;
@@ -172,50 +172,50 @@  discard block
 block discarded – undo
172 172
             );
173 173
             $renderer->setElementTemplate(
174 174
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
175
-                'counter[' . $i . ']'
175
+                'counter['.$i.']'
176 176
             );
177 177
             $renderer->setElementTemplate(
178 178
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
179
-                'answer[' . $i . ']'
179
+                'answer['.$i.']'
180 180
             );
181 181
             $renderer->setElementTemplate(
182 182
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
183
-                'comment[' . $i . ']'
183
+                'comment['.$i.']'
184 184
             );
185 185
             $renderer->setElementTemplate(
186 186
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
187
-                'weighting[' . $i . ']'
187
+                'weighting['.$i.']'
188 188
             );
189 189
 
190
-            $answerNumber = $form->addElement('text', 'counter[' . $i . ']', null, ' value = "' . $i . '"');
190
+            $answerNumber = $form->addElement('text', 'counter['.$i.']', null, ' value = "'.$i.'"');
191 191
             $answerNumber->freeze();
192 192
 
193 193
             $form->addElement('radio', 'correct', null, null, $i, 'class="checkbox"');
194
-            $form->addHtmlEditor('answer[' . $i . ']', null, null, true, $editorConfig);
194
+            $form->addHtmlEditor('answer['.$i.']', null, null, true, $editorConfig);
195 195
 
196
-            $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required');
196
+            $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required');
197 197
 
198 198
             if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) {
199
-                $form->addHtmlEditor('comment[' . $i . ']', null, null, false, $editorConfig);
199
+                $form->addHtmlEditor('comment['.$i.']', null, null, false, $editorConfig);
200 200
                 // Direct feedback
201 201
                 //Adding extra feedback fields
202 202
                 $group = array();
203
-                $group['try' . $i] = $form->createElement('checkbox', 'try' . $i, null, get_lang('TryAgain'));
204
-                $group['lp' . $i] = $form->createElement(
203
+                $group['try'.$i] = $form->createElement('checkbox', 'try'.$i, null, get_lang('TryAgain'));
204
+                $group['lp'.$i] = $form->createElement(
205 205
                     'select',
206
-                    'lp' . $i,
207
-                    get_lang('SeeTheory') . ': ',
206
+                    'lp'.$i,
207
+                    get_lang('SeeTheory').': ',
208 208
                     $selectLpId
209 209
                 );
210
-                $group['destination' . $i] = $form->createElement(
210
+                $group['destination'.$i] = $form->createElement(
211 211
                     'select',
212
-                    'destination' . $i,
213
-                    get_lang('GoToQuestion') . ': ',
212
+                    'destination'.$i,
213
+                    get_lang('GoToQuestion').': ',
214 214
                     $selectQuestion
215 215
                 );
216
-                $group['url' . $i] = $form->createElement(
217
-                    'text', 'url' . $i,
218
-                    get_lang('Other') . ': ',
216
+                $group['url'.$i] = $form->createElement(
217
+                    'text', 'url'.$i,
218
+                    get_lang('Other').': ',
219 219
                     array(
220 220
                         'class' => 'col-md-2',
221 221
                         'placeholder' => get_lang('Other')
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
                     'scenario'
229 229
                 );
230 230
             } else {
231
-                $form->addHtmlEditor('comment[' . $i . ']', null, null, false, $editorConfig);
231
+                $form->addHtmlEditor('comment['.$i.']', null, null, false, $editorConfig);
232 232
             }
233
-            $form->addText('weighting[' . $i . ']', null, null, array('class' => "col-md-1", 'value' => '0'));
233
+            $form->addText('weighting['.$i.']', null, null, array('class' => "col-md-1", 'value' => '0'));
234 234
             $form->addHtml('</tr>');
235 235
         }
236 236
 
@@ -279,19 +279,19 @@  discard block
 block discarded – undo
279 279
         $numberAnswers = $form->getSubmitValue('nb_answers');
280 280
 
281 281
         for ($i = 1; $i <= $numberAnswers; $i++) {
282
-            $answer = trim(str_replace(['<p>', '</p>'], '', $form->getSubmitValue('answer[' . $i . ']')));
283
-            $comment = trim(str_replace(['<p>', '</p>'], '', $form->getSubmitValue('comment[' . $i . ']')));
284
-            $weighting = trim($form->getSubmitValue('weighting[' . $i . ']'));
282
+            $answer = trim(str_replace(['<p>', '</p>'], '', $form->getSubmitValue('answer['.$i.']')));
283
+            $comment = trim(str_replace(['<p>', '</p>'], '', $form->getSubmitValue('comment['.$i.']')));
284
+            $weighting = trim($form->getSubmitValue('weighting['.$i.']'));
285 285
 
286 286
             $scenario = $form->getSubmitValue('scenario');
287 287
 
288 288
             //$listDestination = $form -> getSubmitValue('destination'.$i);
289 289
             //$destinationStr = $form -> getSubmitValue('destination'.$i);
290 290
 
291
-            $try = $scenario['try' . $i];
292
-            $lp = $scenario['lp' . $i];
293
-            $destination = $scenario['destination' . $i];
294
-            $url = trim($scenario['url' . $i]);
291
+            $try = $scenario['try'.$i];
292
+            $lp = $scenario['lp'.$i];
293
+            $destination = $scenario['destination'.$i];
294
+            $url = trim($scenario['url'.$i]);
295 295
 
296 296
             /*
297 297
               How we are going to parse the destination value
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
             }
341 341
 
342 342
             //1@@1;2;@@2;4;4;@@http://www.chamilo.org
343
-            $dest = $try . '@@' . $lp . '@@' . $destination . '@@' . $url;
343
+            $dest = $try.'@@'.$lp.'@@'.$destination.'@@'.$url;
344 344
 
345 345
             $objAnswer->createAnswer($answer, $goodAnswer, $comment, $weighting, $i, null, null, $dest);
346 346
         }
Please login to merge, or discard this patch.
main/exercise/hotspot_answers.as.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@
 block discarded – undo
18 18
 $objExercise = new Exercise(api_get_course_int_id());
19 19
 $objExercise->read($trackExerciseInfo['exe_exo_id']);
20 20
 $em = Database::getManager();
21
-$documentPath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document';
22
-$picturePath = $documentPath . '/images';
21
+$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
22
+$picturePath = $documentPath.'/images';
23 23
 $pictureName = $objQuestion->selectPicture();
24
-$pictureSize = getimagesize($picturePath . '/' . $objQuestion->selectPicture());
24
+$pictureSize = getimagesize($picturePath.'/'.$objQuestion->selectPicture());
25 25
 $pictureWidth = $pictureSize[0];
26 26
 $pictureHeight = $pictureSize[1];
27 27
 $course_id = api_get_course_int_id();
Please login to merge, or discard this patch.