Completed
Push — 1.11.x ( 78f130...f6f5c2 )
by José
50:40 queued 24:26
created
main/exercise/admin.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -362,9 +362,10 @@
 block discarded – undo
362 362
 
363 363
 if ($inATest) {
364 364
     echo '<div class="actions">';
365
-    if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid']))
366
-        echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/admin.php?exerciseId='.$exerciseId.'&'.api_get_cidreq().'">'.
365
+    if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid'])) {
366
+            echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/admin.php?exerciseId='.$exerciseId.'&'.api_get_cidreq().'">'.
367 367
             Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
368
+    }
368 369
 
369 370
     if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) &&  !isset($_GET['editQuestion'])) {
370 371
         echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/exercise.php?'.api_get_cidreq().'">'.
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
  */
49 49
 
50 50
 require_once '../inc/global.inc.php';
51
-$current_course_tool  = TOOL_QUIZ;
51
+$current_course_tool = TOOL_QUIZ;
52 52
 $this_section = SECTION_COURSES;
53 53
 
54 54
 // Access control
@@ -64,20 +64,20 @@  discard block
 block discarded – undo
64 64
 
65 65
 /*  stripslashes POST data  */
66 66
 if ($_SERVER['REQUEST_METHOD'] == 'POST') {
67
-    foreach($_POST as $key=>$val) {
68
-        if(is_string($val)) {
69
-            $_POST[$key]=stripslashes($val);
70
-        } elseif(is_array($val)) {
71
-            foreach($val as $key2=>$val2) {
72
-                $_POST[$key][$key2]=stripslashes($val2);
67
+    foreach ($_POST as $key=>$val) {
68
+        if (is_string($val)) {
69
+            $_POST[$key] = stripslashes($val);
70
+        } elseif (is_array($val)) {
71
+            foreach ($val as $key2=>$val2) {
72
+                $_POST[$key][$key2] = stripslashes($val2);
73 73
             }
74 74
         }
75
-        $GLOBALS[$key]=$_POST[$key];
75
+        $GLOBALS[$key] = $_POST[$key];
76 76
     }
77 77
 }
78 78
 
79 79
 if (empty($exerciseId)) {
80
-    $exerciseId = isset($_GET['exerciseId']) ? intval($_GET['exerciseId']):'0';
80
+    $exerciseId = isset($_GET['exerciseId']) ? intval($_GET['exerciseId']) : '0';
81 81
 }
82 82
 
83 83
 $newQuestion = isset($_GET['newQuestion']) ? $_GET['newQuestion'] : 0;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 if (!empty($_GET['action']) && $_GET['action'] == 'exportqti2' && !empty($_GET['questionId'])) {
152 152
     require_once 'export/qti2/qti2_export.php';
153 153
     $export = export_question_qti($_GET['questionId'], true);
154
-    $qid = (int)$_GET['questionId'];
154
+    $qid = (int) $_GET['questionId'];
155 155
     $archive_path = api_get_path(SYS_ARCHIVE_PATH);
156 156
     $temp_dir_short = uniqid();
157 157
     $temp_zip_dir = $archive_path."/".$temp_dir_short;
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 if (!$fromExercise) {
196 196
     // gets the right exercise ID, and if 0 creates a new exercise
197 197
     if (!$exerciseId = $objExercise->selectId()) {
198
-        $modifyExercise='yes';
198
+        $modifyExercise = 'yes';
199 199
     }
200 200
 }
201 201
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     } else {
246 246
         // goes back to the question viewing
247 247
         $editQuestion = $modifyQuestion;
248
-        unset($newQuestion,$modifyQuestion);
248
+        unset($newQuestion, $modifyQuestion);
249 249
     }
250 250
 }
251 251
 
@@ -281,27 +281,27 @@  discard block
 block discarded – undo
281 281
     $nameTools = get_lang('QuestionManagement');
282 282
 }
283 283
 
284
-if (isset($_SESSION['gradebook'])){
285
-    $gradebook=	$_SESSION['gradebook'];
284
+if (isset($_SESSION['gradebook'])) {
285
+    $gradebook = $_SESSION['gradebook'];
286 286
 }
287 287
 
288
-if (!empty($gradebook) && $gradebook=='view') {
289
-    $interbreadcrumb[]= array(
288
+if (!empty($gradebook) && $gradebook == 'view') {
289
+    $interbreadcrumb[] = array(
290 290
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
291 291
         'name' => get_lang('ToolGradebook')
292 292
     );
293 293
 }
294 294
 
295
-$interbreadcrumb[] = array("url" => "exercise.php","name" => get_lang('Exercises'));
296
-if (isset($_GET['newQuestion']) || isset($_GET['editQuestion']) ) {
295
+$interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises'));
296
+if (isset($_GET['newQuestion']) || isset($_GET['editQuestion'])) {
297 297
     $interbreadcrumb[] = array("url" => "admin.php?exerciseId=".$objExercise->id, "name" => $objExercise->name);
298 298
 } else {
299 299
     $interbreadcrumb[] = array("url" => "#", "name" => $objExercise->name);
300 300
 }
301 301
 
302 302
 // shows a link to go back to the question pool
303
-if (!$exerciseId && $nameTools != get_lang('ExerciseManagement')){
304
-    $interbreadcrumb[]=array(
303
+if (!$exerciseId && $nameTools != get_lang('ExerciseManagement')) {
304
+    $interbreadcrumb[] = array(
305 305
         "url" => api_get_path(WEB_CODE_PATH)."exercise/question_pool.php?fromExercise=$fromExercise&".api_get_cidreq(),
306 306
         "name" => get_lang('QuestionPool')
307 307
     );
@@ -309,10 +309,10 @@  discard block
 block discarded – undo
309 309
 
310 310
 // if the question is duplicated, disable the link of tool name
311 311
 if ($modifyIn == 'thisExercise') {
312
-    if($buttonBack)	{
313
-        $modifyIn='allExercises';
312
+    if ($buttonBack) {
313
+        $modifyIn = 'allExercises';
314 314
     } else {
315
-        $noPHP_SELF=true;
315
+        $noPHP_SELF = true;
316 316
     }
317 317
 }
318 318
 $htmlHeadXtra[] = '<script>
@@ -344,10 +344,10 @@  discard block
 block discarded – undo
344 344
 $htmlHeadXtra[] = $template->fetch('default/exercise/submit.js.tpl');
345 345
 $htmlHeadXtra[] = api_get_js('d3/jquery.xcolor.js');
346 346
 
347
-$htmlHeadXtra[] = '<link rel="stylesheet" href="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/css/hotspot.css">';
348
-$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/js/hotspot.js"></script>';
347
+$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/css/hotspot.css">';
348
+$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/hotspot.js"></script>';
349 349
 
350
-Display::display_header($nameTools,'Exercise');
350
+Display::display_header($nameTools, 'Exercise');
351 351
 /*
352 352
 if ($objExercise->exercise_was_added_in_lp) {
353 353
     if ($objExercise->force_edit_exercise_in_lp == true) {
@@ -364,22 +364,22 @@  discard block
 block discarded – undo
364 364
     echo '<div class="actions">';
365 365
     if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid']))
366 366
         echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/admin.php?exerciseId='.$exerciseId.'&'.api_get_cidreq().'">'.
367
-            Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
367
+            Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>';
368 368
 
369
-    if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) &&  !isset($_GET['editQuestion'])) {
369
+    if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) && !isset($_GET['editQuestion'])) {
370 370
         echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/exercise.php?'.api_get_cidreq().'">'.
371
-            Display::return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>';
371
+            Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>';
372 372
     }
373 373
     echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/overview.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'&preview=1">'.
374
-        Display::return_icon('preview_view.png', get_lang('Preview'),'',ICON_SIZE_MEDIUM).'</a>';
374
+        Display::return_icon('preview_view.png', get_lang('Preview'), '', ICON_SIZE_MEDIUM).'</a>';
375 375
 
376 376
     echo Display::url(
377
-        Display::return_icon('test_results.png', get_lang('Results'),'',ICON_SIZE_MEDIUM),
377
+        Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_MEDIUM),
378 378
         api_get_path(WEB_CODE_PATH).'exercise/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id
379 379
     );
380 380
 
381 381
     echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id.'">'.
382
-        Display::return_icon('settings.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>';
382
+        Display::return_icon('settings.png', get_lang('ModifyExercise'), '', ICON_SIZE_MEDIUM).'</a>';
383 383
 
384 384
     $maxScoreAllQuestions = 0;
385 385
     if (!empty($objExercise->questionList)) {
@@ -397,13 +397,13 @@  discard block
 block discarded – undo
397 397
     // we are in create a new question from question pool not in a test
398 398
     echo '<div class="actions">';
399 399
     echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/admin.php?'.api_get_cidreq().'">'.
400
-        Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
400
+        Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>';
401 401
     echo '</div>';
402 402
 } else {
403 403
     // If we are in question_pool but not in an test, go back to question create in pool
404 404
     echo '<div class="actions">';
405 405
     echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/question_pool.php?'.api_get_cidreq().'">'.
406
-        Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).
406
+        Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).
407 407
         '</a>';
408 408
     echo '</div>';
409 409
 }
Please login to merge, or discard this patch.
main/exercise/exercice.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,4 +7,4 @@
 block discarded – undo
7 7
 // directly to exercise.php. This redirection is enabled for 1.10.x (2015-04-21)
8 8
 // The final goal of this file is to be removed in a few years time, if
9 9
 // considered realistically not harmful
10
-require __DIR__ . '/exercise.php';
10
+require __DIR__.'/exercise.php';
Please login to merge, or discard this patch.
main/exercise/MatchingDraggable.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
                 for ($i = 1; $i <= $answer->nbrAnswers; $i++) {
68 68
                     if ($answer->isCorrect($i)) {
69 69
                         $nb_matches++;
70
-                        $defaults['answer[' . $nb_matches . ']'] = $answer->selectAnswer($i);
71
-                        $defaults['weighting[' . $nb_matches . ']'] = float_format($answer->selectWeighting($i), 1);
72
-                        $defaults['matches[' . $nb_matches . ']'] = $answer->correct[$i];
70
+                        $defaults['answer['.$nb_matches.']'] = $answer->selectAnswer($i);
71
+                        $defaults['weighting['.$nb_matches.']'] = float_format($answer->selectWeighting($i), 1);
72
+                        $defaults['matches['.$nb_matches.']'] = $answer->correct[$i];
73 73
                     } else {
74 74
                         $nb_options++;
75
-                        $defaults['option[' . $nb_options . ']'] = $answer->selectAnswer($i);
75
+                        $defaults['option['.$nb_options.']'] = $answer->selectAnswer($i);
76 76
                     }
77 77
                 }
78 78
             }
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
         $html = '<table class="table table-striped table-hover">
104 104
             <thead>
105 105
                 <tr>
106
-                    <th width="10">' . get_lang('Number') . '</th>
107
-                    <th width="85%">' . get_lang('Answer') . '</th>
108
-                    <th width="15%">' . get_lang('MatchesTo') . '</th>
109
-                    <th width="10">' . get_lang('Weighting') . '</th>
106
+                    <th width="10">' . get_lang('Number').'</th>
107
+                    <th width="85%">' . get_lang('Answer').'</th>
108
+                    <th width="15%">' . get_lang('MatchesTo').'</th>
109
+                    <th width="10">' . get_lang('Weighting').'</th>
110 110
                 </tr>
111 111
             </thead>
112 112
             <tbody>';
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
         $html = '<table class="table table-striped table-hover">
155 155
             <thead>
156 156
                 <tr>
157
-                    <th width="15%">' . get_lang('Number') . '</th>
158
-                    <th width="85%">' . get_lang('Answer') . '</th>
157
+                    <th width="15%">' . get_lang('Number').'</th>
158
+                    <th width="85%">' . get_lang('Answer').'</th>
159 159
                 </tr>
160 160
             </thead>
161 161
             <tbody>';
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
             );
177 177
 
178 178
             $form->addHtml('<tr>');
179
-            $form->addHtml('<td>' . chr(64 + $i) . '</td>');
179
+            $form->addHtml('<td>'.chr(64 + $i).'</td>');
180 180
             $form->addText("option[$i]", null);
181 181
             $form->addHtml('</tr>');
182 182
         }
@@ -258,10 +258,10 @@  discard block
 block discarded – undo
258 258
     public function return_header($feedback_type = null, $counter = null, $score = null)
259 259
     {
260 260
         $header = parent::return_header($feedback_type, $counter, $score);
261
-        $header .= '<table class="' . $this->question_table_class . '">
261
+        $header .= '<table class="'.$this->question_table_class.'">
262 262
                 <tr>
263
-                    <th>' . get_lang('ElementList') . '</th>
264
-                    <th>' . get_lang('CorrespondsTo') . '</th>
263
+                    <th>' . get_lang('ElementList').'</th>
264
+                    <th>' . get_lang('CorrespondsTo').'</th>
265 265
                 </tr>';
266 266
 
267 267
         return $header;
Please login to merge, or discard this patch.
main/exercise/multiple_answer_true_false.class.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
     }
242 242
 
243 243
     /**
244
-	 * abstract function which creates the form to create / edit the answers of the question
245
-	 * @param FormValidator $form
246
-	 */
244
+     * abstract function which creates the form to create / edit the answers of the question
245
+     * @param FormValidator $form
246
+     */
247 247
     public function processAnswersCreation($form)
248 248
     {
249
-		$questionWeighting = $nbrGoodAnswers = 0;
250
-		$objAnswer = new Answer($this->id);
249
+        $questionWeighting = $nbrGoodAnswers = 0;
250
+        $objAnswer = new Answer($this->id);
251 251
         $nb_answers = $form->getSubmitValue('nb_answers');
252 252
         //$options_count    = $form->getSubmitValue('options_count');
253 253
         $course_id = api_get_course_int_id();
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
                     $course_id,
270 270
                     $i
271 271
                 );
272
-               $correct[$i] = $last_id;
272
+                $correct[$i] = $last_id;
273 273
             }
274 274
         }
275 275
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 
281 281
         $sorted_by_position = array();
282 282
         foreach ($new_options as $item) {
283
-        	$sorted_by_position[$item['position']] = $item;
283
+            $sorted_by_position[$item['position']] = $item;
284 284
         }
285 285
 
286 286
         /* Saving quiz_question.extra values that has the correct scores of
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
         }
294 294
         $this->setExtra(implode(':', $extra_values));
295 295
 
296
-		for ($i = 1; $i <= $nb_answers; $i++) {
296
+        for ($i = 1; $i <= $nb_answers; $i++) {
297 297
             $answer = trim($form->getSubmitValue('answer['.$i.']'));
298 298
             $comment = trim($form->getSubmitValue('comment['.$i.']'));
299 299
             $goodAnswer = trim($form->getSubmitValue('correct['.$i.']'));
@@ -302,18 +302,18 @@  discard block
 block discarded – undo
302 302
                 // change the default values from the form 1 and 2 by the correct "option id" registered
303 303
                 $goodAnswer = $sorted_by_position[$goodAnswer]['id'];
304 304
             }
305
-    	    $questionWeighting += $extra_values[0]; //By default 0 has the correct answers
305
+            $questionWeighting += $extra_values[0]; //By default 0 has the correct answers
306 306
 
307
-        	$objAnswer->createAnswer($answer, $goodAnswer, $comment,'',$i);
307
+            $objAnswer->createAnswer($answer, $goodAnswer, $comment,'',$i);
308 308
         }
309 309
 
310
-    	// saves the answers into the data base
310
+        // saves the answers into the data base
311 311
         $objAnswer->save();
312 312
 
313 313
         // sets the total weighting of the question
314 314
         $this->updateWeighting($questionWeighting);
315 315
         $this->save();
316
-	}
316
+    }
317 317
 
318 318
     /**
319 319
      * @param int $feedback_type
@@ -324,17 +324,17 @@  discard block
 block discarded – undo
324 324
     function return_header($feedback_type = null, $counter = null, $score = null)
325 325
     {
326 326
         $header = parent::return_header($feedback_type, $counter, $score);
327
-  	    $header .= '<table class="'.$this->question_table_class .'">
327
+            $header .= '<table class="'.$this->question_table_class .'">
328 328
 		<tr>
329 329
 			<th>'.get_lang("Choice").'</th>
330 330
 			<th>'. get_lang("ExpectedChoice").'</th>
331 331
 			<th>'. get_lang("Answer").'</th>';
332
-			if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
333
-				$header .= '<th>'.get_lang("Comment").'</th>';
334
-			} else {
335
-				$header .= '<th>&nbsp;</th>';
336
-			}
332
+            if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
333
+                $header .= '<th>'.get_lang("Comment").'</th>';
334
+            } else {
335
+                $header .= '<th>&nbsp;</th>';
336
+            }
337 337
         $header .= '</tr>';
338 338
         return $header;
339
-	}
339
+    }
340 340
 }
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -44,14 +44,14 @@  discard block
 block discarded – undo
44 44
         $html = '<table class="table table-striped table-hover">';
45 45
         $html .= '<thead>';
46 46
         $html .= '<tr>';
47
-        $html .= '<th>' . get_lang('Number') . '</th>';
48
-        $html .= '<th>' . get_lang('True') . '</th>';
49
-        $html .= '<th>' . get_lang('False') . '</th>';
50
-        $html .= '<th>' . get_lang('Answer') . '</th>';
47
+        $html .= '<th>'.get_lang('Number').'</th>';
48
+        $html .= '<th>'.get_lang('True').'</th>';
49
+        $html .= '<th>'.get_lang('False').'</th>';
50
+        $html .= '<th>'.get_lang('Answer').'</th>';
51 51
 
52 52
         // show column comment when feedback is enable
53 53
         if ($obj_ex->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) {
54
-            $html .= '<th>' . get_lang('Comment') . '</th>';
54
+            $html .= '<th>'.get_lang('Comment').'</th>';
55 55
         }
56 56
 
57 57
         $html .= '</tr>';
@@ -89,19 +89,19 @@  discard block
 block discarded – undo
89 89
 
90 90
             $renderer->setElementTemplate(
91 91
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
92
-                'correct[' . $i . ']'
92
+                'correct['.$i.']'
93 93
             );
94 94
             $renderer->setElementTemplate(
95 95
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
96
-                'counter[' . $i . ']'
96
+                'counter['.$i.']'
97 97
             );
98 98
             $renderer->setElementTemplate(
99 99
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
100
-                'answer[' . $i . ']'
100
+                'answer['.$i.']'
101 101
             );
102 102
             $renderer->setElementTemplate(
103 103
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
104
-                'comment[' . $i . ']'
104
+                'comment['.$i.']'
105 105
             );
106 106
 
107 107
             $answer_number = $form->addElement(
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
             $answer_number->freeze();
115 115
 
116 116
             if (is_object($answer)) {
117
-                $defaults['answer[' . $i . ']'] = $answer->answer[$i];
118
-                $defaults['comment[' . $i . ']'] = $answer->comment[$i];
117
+                $defaults['answer['.$i.']'] = $answer->answer[$i];
118
+                $defaults['comment['.$i.']'] = $answer->comment[$i];
119 119
                 $correct = $answer->correct[$i];
120
-                $defaults['correct[' . $i . ']'] = $correct;
120
+                $defaults['correct['.$i.']'] = $correct;
121 121
 
122 122
                 $j = 1;
123 123
                 if (!empty($optionData)) {
124 124
                     foreach ($optionData as $id => $data) {
125
-                        $form->addElement('radio', 'correct[' . $i . ']', null, null, $id);
125
+                        $form->addElement('radio', 'correct['.$i.']', null, null, $id);
126 126
                         $j++;
127 127
                         if ($j == 3) {
128 128
                             break;
@@ -130,15 +130,15 @@  discard block
 block discarded – undo
130 130
                     }
131 131
                 }
132 132
             } else {
133
-                $form->addElement('radio', 'correct[' . $i . ']', null, null, 1);
134
-                $form->addElement('radio', 'correct[' . $i . ']', null, null, 2);
133
+                $form->addElement('radio', 'correct['.$i.']', null, null, 1);
134
+                $form->addElement('radio', 'correct['.$i.']', null, null, 2);
135 135
 
136
-                $defaults['answer[' . $i . ']'] = '';
137
-                $defaults['comment[' . $i . ']'] = '';
138
-                $defaults['correct[' . $i . ']'] = '';
136
+                $defaults['answer['.$i.']'] = '';
137
+                $defaults['comment['.$i.']'] = '';
138
+                $defaults['correct['.$i.']'] = '';
139 139
             }
140 140
 
141
-            $boxes_names[] = 'correct[' . $i . ']';
141
+            $boxes_names[] = 'correct['.$i.']';
142 142
 
143 143
             $form->addHtmlEditor(
144 144
                 "answer[$i]",
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             if ($obj_ex->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) {
153 153
                 $form->addElement(
154 154
                     'html_editor',
155
-                    'comment[' . $i . ']',
155
+                    'comment['.$i.']',
156 156
                     null,
157 157
                     array(),
158 158
                     array(
@@ -170,22 +170,22 @@  discard block
 block discarded – undo
170 170
 
171 171
         $correctInputTemplate = '<div class="form-group">';
172 172
         $correctInputTemplate .= '<label class="col-sm-2 control-label">';
173
-        $correctInputTemplate .= '<span class="form_required">*</span>' . get_lang('Score');
173
+        $correctInputTemplate .= '<span class="form_required">*</span>'.get_lang('Score');
174 174
         $correctInputTemplate .= '</label>';
175 175
         $correctInputTemplate .= '<div class="col-sm-8">';
176 176
         $correctInputTemplate .= '<table>';
177 177
         $correctInputTemplate .= '<tr>';
178 178
         $correctInputTemplate .= '<td>';
179
-        $correctInputTemplate .= get_lang('Correct') . '{element}';
179
+        $correctInputTemplate .= get_lang('Correct').'{element}';
180 180
         $correctInputTemplate .= '<!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->';
181 181
         $correctInputTemplate .= '</td>';
182 182
 
183 183
         $wrongInputTemplate = '<td>';
184
-        $wrongInputTemplate .= get_lang('Wrong') . '{element}';
184
+        $wrongInputTemplate .= get_lang('Wrong').'{element}';
185 185
         $wrongInputTemplate .= '<!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->';
186 186
         $wrongInputTemplate .= '</td>';
187 187
 
188
-        $doubtScoreInputTemplate = '<td>' . get_lang('DoubtScore') . '<br>{element}';
188
+        $doubtScoreInputTemplate = '<td>'.get_lang('DoubtScore').'<br>{element}';
189 189
         $doubtScoreInputTemplate .= '<!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->';
190 190
         $doubtScoreInputTemplate .= '</td>';
191 191
         $doubtScoreInputTemplate .= '</tr>';
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 
215 215
             if (!empty($scores)) {
216 216
                 for ($i = 1; $i <= 3; $i++) {
217
-                    $defaults['option[' . $i . ']'] = $scores[$i - 1];
217
+                    $defaults['option['.$i.']'] = $scores[$i - 1];
218 218
                 }
219 219
             }
220 220
         }
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
                 Question::updateQuestionOption($id, $optionData, $course_id);
263 263
             }
264 264
         } else {
265
-            for ($i=1 ; $i <= 3 ; $i++) {
265
+            for ($i = 1; $i <= 3; $i++) {
266 266
                 $last_id = Question::saveQuestionOption(
267 267
                     $this->id,
268 268
                     $this->options[$i],
@@ -287,9 +287,9 @@  discard block
 block discarded – undo
287 287
         the true, false, doubt options registered in this format
288 288
         XX:YY:ZZZ where XX is a float score value.*/
289 289
         $extra_values = array();
290
-        for ($i=1 ; $i <= 3 ; $i++) {
290
+        for ($i = 1; $i <= 3; $i++) {
291 291
             $score = trim($form -> getSubmitValue('option['.$i.']'));
292
-            $extra_values[]= $score;
292
+            $extra_values[] = $score;
293 293
         }
294 294
         $this->setExtra(implode(':', $extra_values));
295 295
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
             }
305 305
     	    $questionWeighting += $extra_values[0]; //By default 0 has the correct answers
306 306
 
307
-        	$objAnswer->createAnswer($answer, $goodAnswer, $comment,'',$i);
307
+        	$objAnswer->createAnswer($answer, $goodAnswer, $comment, '', $i);
308 308
         }
309 309
 
310 310
     	// saves the answers into the data base
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
     function return_header($feedback_type = null, $counter = null, $score = null)
325 325
     {
326 326
         $header = parent::return_header($feedback_type, $counter, $score);
327
-  	    $header .= '<table class="'.$this->question_table_class .'">
327
+  	    $header .= '<table class="'.$this->question_table_class.'">
328 328
 		<tr>
329 329
 			<th>'.get_lang("Choice").'</th>
330 330
 			<th>'. get_lang("ExpectedChoice").'</th>
Please login to merge, or discard this patch.
main/exercise/question.class.php 2 patches
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -607,10 +607,11 @@
 block discarded – undo
607 607
             $current_width = $current_image_size['width'];
608 608
             $current_height = $current_image_size['height'];
609 609
 
610
-            if ($current_width < $Max && $current_height < $Max)
611
-                return true;
612
-            elseif ($current_height == "")
613
-                return false;
610
+            if ($current_width < $Max && $current_height < $Max) {
611
+                            return true;
612
+            } elseif ($current_height == "") {
613
+                            return false;
614
+            }
614 615
 
615 616
             // Resize according to height.
616 617
             if ($Dimension == "height") {
Please login to merge, or discard this patch.
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     public $type;
23 23
     public $level;
24 24
     public $picture;
25
-    public $exerciseList;  // array with the list of exercises which this question is in
25
+    public $exerciseList; // array with the list of exercises which this question is in
26 26
     public $category_list;
27 27
     public $parent_id;
28 28
     public $category;
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
             'multiple_answer_combination_true_false.class.php',
48 48
             'MultipleAnswerCombinationTrueFalse'
49 49
         ),
50
-        GLOBAL_MULTIPLE_ANSWER => array('global_multiple_answer.class.php' , 'GlobalMultipleAnswer'),
51
-        CALCULATED_ANSWER => array('calculated_answer.class.php' , 'CalculatedAnswer'),
50
+        GLOBAL_MULTIPLE_ANSWER => array('global_multiple_answer.class.php', 'GlobalMultipleAnswer'),
51
+        CALCULATED_ANSWER => array('calculated_answer.class.php', 'CalculatedAnswer'),
52 52
         UNIQUE_ANSWER_IMAGE => ['UniqueAnswerImage.php', 'UniqueAnswerImage'],
53 53
         DRAGGABLE => ['Draggable.php', 'Draggable'],
54 54
         MATCHING_DRAGGABLE => ['MatchingDraggable.php', 'MatchingDraggable']
@@ -107,14 +107,14 @@  discard block
 block discarded – undo
107 107
         $id = intval($id);
108 108
 
109 109
         if (!empty($course_id)) {
110
-            $course_info =  api_get_course_info_by_id($course_id);
110
+            $course_info = api_get_course_info_by_id($course_id);
111 111
         } else {
112 112
             $course_info = api_get_course_info();
113 113
         }
114 114
 
115 115
         $course_id = $course_info['real_id'];
116 116
 
117
-        if (empty($course_id) || $course_id == -1 ) {
117
+        if (empty($course_id) || $course_id == -1) {
118 118
 
119 119
             return false;
120 120
         }
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
     public function selectPicturePath()
270 270
     {
271 271
         if (!empty($this->picture)) {
272
-            return api_get_path(WEB_COURSE_PATH) . $this->course['path'] . '/document/images/' . $this->picture;
272
+            return api_get_path(WEB_COURSE_PATH).$this->course['path'].'/document/images/'.$this->picture;
273 273
         }
274 274
 
275 275
         return '';
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
      */
307 307
     public function updateTitle($title)
308 308
     {
309
-        $this->question=$title;
309
+        $this->question = $title;
310 310
     }
311 311
 
312 312
     /**
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
                     // DO nothing
406 406
                 } else {
407 407
                     $sql = "INSERT INTO $TBL_QUESTION_REL_CATEGORY (c_id, question_id, category_id)
408
-                            VALUES (" . api_get_course_int_id() . ", $question_id, $category_id)";
408
+                            VALUES (".api_get_course_int_id().", $question_id, $category_id)";
409 409
                     Database::query($sql);
410 410
                 }
411 411
             }
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
             $sql = "SELECT count(*) AS nb FROM $table
433 433
                     WHERE
434 434
                         question_id = $question_id AND
435
-                        c_id=" . api_get_course_int_id();
435
+                        c_id=".api_get_course_int_id();
436 436
             $res = Database::query($sql);
437 437
             $row = Database::fetch_array($res);
438 438
             if ($row['nb'] > 0) {
@@ -440,11 +440,11 @@  discard block
 block discarded – undo
440 440
                         SET category_id = $category_id
441 441
                         WHERE
442 442
                             question_id = $question_id AND
443
-                            c_id = " . api_get_course_int_id();
443
+                            c_id = ".api_get_course_int_id();
444 444
                 Database::query($sql);
445 445
             } else {
446 446
                 $sql = "INSERT INTO $table (c_id, question_id, category_id)
447
-                        VALUES (" . api_get_course_int_id().", $question_id, $category_id)";
447
+                        VALUES (".api_get_course_int_id().", $question_id, $category_id)";
448 448
                 Database::query($sql);
449 449
             }
450 450
         }
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
         $sql = "DELETE FROM $table
463 463
                 WHERE
464 464
                     question_id = $question_id AND
465
-                    c_id = " . api_get_course_int_id();
465
+                    c_id = ".api_get_course_int_id();
466 466
         Database::query($sql);
467 467
     }
468 468
 
@@ -515,11 +515,11 @@  discard block
 block discarded – undo
515 515
             ) {
516 516
                 // removes old answers
517 517
                 $sql = "DELETE FROM $TBL_REPONSES
518
-                        WHERE c_id = $course_id AND question_id = " . intval($this->id);
518
+                        WHERE c_id = $course_id AND question_id = ".intval($this->id);
519 519
                 Database::query($sql);
520 520
             }
521 521
 
522
-            $this->type=$type;
522
+            $this->type = $type;
523 523
         }
524 524
     }
525 525
 
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
         if (!file_exists($picturePath)) {
544 544
             if (mkdir($picturePath, api_get_permissions_for_new_directories())) {
545 545
                 // document path
546
-                $documentPath = api_get_path(SYS_COURSE_PATH) . $this->course['path'] . "/document";
546
+                $documentPath = api_get_path(SYS_COURSE_PATH).$this->course['path']."/document";
547 547
                 $path = str_replace($documentPath, '', $picturePath);
548 548
                 $title_path = basename($picturePath);
549 549
                 $doc_id = add_document($this->course, $path, 'folder', 0, $title_path);
@@ -559,14 +559,14 @@  discard block
 block discarded – undo
559 559
 
560 560
         // if the question has got an ID
561 561
         if ($this->id) {
562
-            $this->picture = 'quiz-' . $this->id . '.jpg';
562
+            $this->picture = 'quiz-'.$this->id.'.jpg';
563 563
             $o_img = new Image($Picture);
564
-            $o_img->send_image($picturePath . '/' . $this->picture, -1, 'jpg');
564
+            $o_img->send_image($picturePath.'/'.$this->picture, -1, 'jpg');
565 565
             $document_id = add_document(
566 566
                 $this->course,
567
-                '/images/' . $this->picture,
567
+                '/images/'.$this->picture,
568 568
                 'file',
569
-                filesize($picturePath . '/' . $this->picture),
569
+                filesize($picturePath.'/'.$this->picture),
570 570
                 $this->picture
571 571
             );
572 572
             if ($document_id) {
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
         // if the question has an ID
601 601
         if ($this->id) {
602 602
             // Get dimensions from current image.
603
-            $my_image = new Image($picturePath . '/' . $this->picture);
603
+            $my_image = new Image($picturePath.'/'.$this->picture);
604 604
 
605 605
             $current_image_size = $my_image->get_image_size();
606 606
             $current_width = $current_image_size['width'];
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
             }
641 641
 
642 642
             $my_image->resize($new_width, $new_height);
643
-            $result = $my_image->send_image($picturePath . '/' . $this->picture);
643
+            $result = $my_image->send_image($picturePath.'/'.$this->picture);
644 644
 
645 645
             if ($result) {
646 646
                 return true;
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
             $picture = $this->picture;
666 666
             $this->picture = '';
667 667
 
668
-            return @unlink($picturePath . '/' . $picture) ? true : false;
668
+            return @unlink($picturePath.'/'.$picture) ? true : false;
669 669
         }
670 670
 
671 671
         return false;
@@ -682,27 +682,27 @@  discard block
 block discarded – undo
682 682
     {
683 683
         $course_id = $course_info['real_id'];
684 684
         $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION);
685
-        $destination_path = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document/images';
686
-        $source_path = api_get_path(SYS_COURSE_PATH) . $this->course['path'] . '/document/images';
685
+        $destination_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document/images';
686
+        $source_path = api_get_path(SYS_COURSE_PATH).$this->course['path'].'/document/images';
687 687
 
688 688
         // if the question has got an ID and if the picture exists
689 689
         if ($this->id && !empty($this->picture)) {
690 690
             $picture = explode('.', $this->picture);
691 691
             $extension = $picture[sizeof($picture) - 1];
692
-            $picture = 'quiz-' . $questionId . '.' . $extension;
693
-            $result = @copy($source_path . '/' . $this->picture, $destination_path . '/' . $picture) ? true : false;
692
+            $picture = 'quiz-'.$questionId.'.'.$extension;
693
+            $result = @copy($source_path.'/'.$this->picture, $destination_path.'/'.$picture) ? true : false;
694 694
             // If copy was correct then add to the database
695 695
             if ($result) {
696 696
                 $sql = "UPDATE $TBL_QUESTIONS SET
697
-                        picture = '" . Database::escape_string($picture) . "'
698
-                        WHERE c_id = $course_id AND id='" . intval($questionId) . "'";
697
+                        picture = '".Database::escape_string($picture)."'
698
+                        WHERE c_id = $course_id AND id='".intval($questionId)."'";
699 699
                 Database::query($sql);
700 700
 
701 701
                 $document_id = add_document(
702 702
                     $course_info,
703
-                    '/images/' . $picture,
703
+                    '/images/'.$picture,
704 704
                     'file',
705
-                    filesize($destination_path . '/' . $picture),
705
+                    filesize($destination_path.'/'.$picture),
706 706
                     $picture
707 707
                 );
708 708
                 if ($document_id) {
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
         $Extension = $PictureName[sizeof($PictureName) - 1];
738 738
 
739 739
         // saves the picture into a temporary file
740
-        @move_uploaded_file($Picture, $picturePath . '/tmp.' . $Extension);
740
+        @move_uploaded_file($Picture, $picturePath.'/tmp.'.$Extension);
741 741
     }
742 742
 
743 743
     /**
@@ -771,15 +771,15 @@  discard block
 block discarded – undo
771 771
 
772 772
         // if the question has got an ID and if the picture exists
773 773
         if ($this->id) {
774
-            if (file_exists($picturePath . '/tmp.jpg')) {
774
+            if (file_exists($picturePath.'/tmp.jpg')) {
775 775
                 $Extension = 'jpg';
776
-            } elseif (file_exists($picturePath . '/tmp.gif')) {
776
+            } elseif (file_exists($picturePath.'/tmp.gif')) {
777 777
                 $Extension = 'gif';
778
-            } elseif (file_exists($picturePath . '/tmp.png')) {
778
+            } elseif (file_exists($picturePath.'/tmp.png')) {
779 779
                 $Extension = 'png';
780 780
             }
781
-            $this->picture = 'quiz-' . $this->id . '.' . $Extension;
782
-            return @rename($picturePath . '/tmp.' . $Extension, $picturePath . '/' . $this->picture) ? true : false;
781
+            $this->picture = 'quiz-'.$this->id.'.'.$Extension;
782
+            return @rename($picturePath.'/tmp.'.$Extension, $picturePath.'/'.$this->picture) ? true : false;
783 783
         }
784 784
         return false;
785 785
     }
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
         $category = $this->category;
810 810
 
811 811
         // question already exists
812
-        if(!empty($id)) {
812
+        if (!empty($id)) {
813 813
 
814 814
             $params = [
815 815
                 'question' => $question,
@@ -855,12 +855,12 @@  discard block
 block discarded – undo
855 855
                     $TBL_EXERCISE_QUESTION as test_question
856 856
                     WHERE
857 857
                         question.id = test_question.question_id AND
858
-                        test_question.exercice_id = " . intval($exerciseId) . " AND
858
+                        test_question.exercice_id = ".intval($exerciseId)." AND
859 859
                         question.c_id = $c_id AND
860 860
                         test_question.c_id = $c_id ";
861
-            $result	= Database::query($sql);
862
-            $current_position = Database::result($result,0,0);
863
-            $this->updatePosition($current_position+1);
861
+            $result = Database::query($sql);
862
+            $current_position = Database::result($result, 0, 0);
863
+            $this->updatePosition($current_position + 1);
864 864
             $position = $this->position;
865 865
 
866 866
             $params = [
@@ -956,10 +956,10 @@  discard block
 block discarded – undo
956 956
         }
957 957
     }
958 958
 
959
-    public function search_engine_edit($exerciseId, $addQs=false, $rmQs=false)
959
+    public function search_engine_edit($exerciseId, $addQs = false, $rmQs = false)
960 960
     {
961 961
         // update search engine and its values table if enabled
962
-        if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) {
962
+        if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) {
963 963
             $course_id = api_get_course_id();
964 964
             // get search_did
965 965
             $tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF);
@@ -977,8 +977,8 @@  discard block
 block discarded – undo
977 977
             $res = Database::query($sql);
978 978
 
979 979
             if (Database::num_rows($res) > 0 || $addQs) {
980
-                require_once(api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php');
981
-                require_once(api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php');
980
+                require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php');
981
+                require_once(api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php');
982 982
 
983 983
                 $di = new ChamiloIndexer();
984 984
                 if ($addQs) {
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
 
992 992
                 // retrieve others exercise ids
993 993
                 $se_ref = Database::fetch_array($res);
994
-                $se_doc = $di->get_document((int)$se_ref['search_did']);
994
+                $se_doc = $di->get_document((int) $se_ref['search_did']);
995 995
                 if ($se_doc !== FALSE) {
996 996
                     if (($se_doc_data = $di->get_document_data($se_doc)) !== FALSE) {
997 997
                         $se_doc_data = unserialize($se_doc_data);
@@ -1029,16 +1029,16 @@  discard block
 block discarded – undo
1029 1029
                     SE_DATA => array(
1030 1030
                         'type' => SE_DOCTYPE_EXERCISE_QUESTION,
1031 1031
                         'exercise_ids' => $question_exercises,
1032
-                        'question_id' => (int)$this->id
1032
+                        'question_id' => (int) $this->id
1033 1033
                     ),
1034
-                    SE_USER => (int)api_get_user_id(),
1034
+                    SE_USER => (int) api_get_user_id(),
1035 1035
                 );
1036 1036
                 $ic_slide->xapian_data = serialize($xapian_data);
1037 1037
                 $ic_slide->addValue("content", $this->description);
1038 1038
 
1039 1039
                 //TODO: index answers, see also form validation on question_admin.inc.php
1040 1040
 
1041
-                $di->remove_document((int)$se_ref['search_did']);
1041
+                $di->remove_document((int) $se_ref['search_did']);
1042 1042
                 $di->addChunk($ic_slide);
1043 1043
 
1044 1044
                 //index and return search engine document id
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
             $count = $new_exercise->selectNbrQuestions();
1118 1118
             $count++;
1119 1119
             $sql = "INSERT INTO $exerciseRelQuestionTable (c_id, question_id, exercice_id, question_order)
1120
-                    VALUES ({$this->course['real_id']}, " . intval($id) . ", " . intval($exerciseId) . ", '$count')";
1120
+                    VALUES ({$this->course['real_id']}, ".intval($id).", ".intval($exerciseId).", '$count')";
1121 1121
             Database::query($sql);
1122 1122
 
1123 1123
             // we do not want to reindex if we had just saved adnd indexed the question
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
         $course_id = api_get_course_int_id();
1147 1147
 
1148 1148
         // exercise not found
1149
-        if($pos === false) {
1149
+        if ($pos === false) {
1150 1150
             return false;
1151 1151
         } else {
1152 1152
             // deletes the position in the array containing the wanted exercise ID
@@ -1156,17 +1156,17 @@  discard block
 block discarded – undo
1156 1156
                     FROM $TBL_EXERCISE_QUESTION
1157 1157
                     WHERE
1158 1158
                         c_id = $course_id
1159
-                        AND question_id = " . intval($id) . "
1159
+                        AND question_id = ".intval($id)."
1160 1160
                         AND exercice_id = " . intval($exerciseId);
1161 1161
             $res = Database::query($sql);
1162
-            if (Database::num_rows($res)>0) {
1162
+            if (Database::num_rows($res) > 0) {
1163 1163
                 $row = Database::fetch_array($res);
1164 1164
                 if (!empty($row['question_order'])) {
1165 1165
                     $sql = "UPDATE $TBL_EXERCISE_QUESTION
1166 1166
                         SET question_order = question_order-1
1167 1167
                         WHERE
1168 1168
                             c_id = $course_id
1169
-                            AND exercice_id = " . intval($exerciseId) . "
1169
+                            AND exercice_id = ".intval($exerciseId)."
1170 1170
                             AND question_order > " . $row['question_order'];
1171 1171
                     Database::query($sql);
1172 1172
                 }
@@ -1175,7 +1175,7 @@  discard block
 block discarded – undo
1175 1175
             $sql = "DELETE FROM $TBL_EXERCISE_QUESTION
1176 1176
                     WHERE
1177 1177
                         c_id = $course_id
1178
-                        AND question_id = " . intval($id) . "
1178
+                        AND question_id = ".intval($id)."
1179 1179
                         AND exercice_id = " . intval($exerciseId);
1180 1180
             Database::query($sql);
1181 1181
 
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
                                 SET question_order = question_order-1
1217 1217
                                 WHERE
1218 1218
                                     c_id= $course_id
1219
-                                    AND exercice_id = " . intval($row['exercice_id']) . "
1219
+                                    AND exercice_id = ".intval($row['exercice_id'])."
1220 1220
                                     AND question_order > " . $row['question_order'];
1221 1221
                         Database::query($sql);
1222 1222
                     }
@@ -1224,22 +1224,22 @@  discard block
 block discarded – undo
1224 1224
             }
1225 1225
 
1226 1226
             $sql = "DELETE FROM $TBL_EXERCISE_QUESTION
1227
-                    WHERE c_id = $course_id AND question_id = " . $id;
1227
+                    WHERE c_id = $course_id AND question_id = ".$id;
1228 1228
             Database::query($sql);
1229 1229
 
1230 1230
             $sql = "DELETE FROM $TBL_QUESTIONS
1231
-                    WHERE c_id = $course_id AND id = " . $id;
1231
+                    WHERE c_id = $course_id AND id = ".$id;
1232 1232
             Database::query($sql);
1233 1233
 
1234 1234
             $sql = "DELETE FROM $TBL_REPONSES
1235
-                    WHERE c_id = $course_id AND question_id = " . $id;
1235
+                    WHERE c_id = $course_id AND question_id = ".$id;
1236 1236
             Database::query($sql);
1237 1237
 
1238 1238
             // remove the category of this question in the question_rel_category table
1239 1239
             $sql = "DELETE FROM $TBL_QUIZ_QUESTION_REL_CATEGORY
1240 1240
                     WHERE 
1241 1241
                         c_id = $course_id AND 
1242
-                        question_id = " . $id;
1242
+                        question_id = ".$id;
1243 1243
             Database::query($sql);
1244 1244
 
1245 1245
             api_item_property_update(
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
                 if (class_exists($class_name)) {
1409 1409
                     return new $class_name();
1410 1410
                 } else {
1411
-                    echo 'Can\'t instanciate class ' . $class_name . ' of type ' . $type;
1411
+                    echo 'Can\'t instanciate class '.$class_name.' of type '.$type;
1412 1412
                 }
1413 1413
             }
1414 1414
         }
@@ -1450,7 +1450,7 @@  discard block
 block discarded – undo
1450 1450
 
1451 1451
         // Question type
1452 1452
         $answerType = isset($_REQUEST['answerType']) ? intval($_REQUEST['answerType']) : null;
1453
-        $form->addElement('hidden','answerType', $answerType);
1453
+        $form->addElement('hidden', 'answerType', $answerType);
1454 1454
 
1455 1455
         // html editor
1456 1456
         $editorConfig = array(
@@ -1458,7 +1458,7 @@  discard block
 block discarded – undo
1458 1458
             'Height' => '150'
1459 1459
         );
1460 1460
 
1461
-        if (!api_is_allowed_to_edit(null,true)) {
1461
+        if (!api_is_allowed_to_edit(null, true)) {
1462 1462
             $editorConfig['UserStatus'] = 'student';
1463 1463
         }
1464 1464
 
@@ -1595,7 +1595,7 @@  discard block
 block discarded – undo
1595 1595
 
1596 1596
         if ($feedback_type == 1) {
1597 1597
             //2. but if it is a feedback DIRECT we only show the UNIQUE_ANSWER type that is currently available
1598
-            $question_type_custom_list = array (
1598
+            $question_type_custom_list = array(
1599 1599
                 UNIQUE_ANSWER => self::$questionTypes[UNIQUE_ANSWER],
1600 1600
                 HOT_SPOT_DELINEATION => self::$questionTypes[HOT_SPOT_DELINEATION]
1601 1601
             );
@@ -1611,14 +1611,14 @@  discard block
 block discarded – undo
1611 1611
             require_once $a_type[0];
1612 1612
             // get the picture of the type and the langvar which describes it
1613 1613
             $img = $explanation = '';
1614
-            eval('$img = ' . $a_type[1] . '::$typePicture;');
1615
-            eval('$explanation = get_lang(' . $a_type[1] . '::$explanationLangVar);');
1614
+            eval('$img = '.$a_type[1].'::$typePicture;');
1615
+            eval('$explanation = get_lang('.$a_type[1].'::$explanationLangVar);');
1616 1616
             echo '<li>';
1617 1617
             echo '<div class="icon-image">';
1618 1618
 
1619 1619
 
1620
-            $icon = '<a href="admin.php?' . api_get_cidreq() . '&newQuestion=yes&answerType=' . $i . '">' .
1621
-                Display::return_icon($img, $explanation, null, ICON_SIZE_BIG) . '</a>';
1620
+            $icon = '<a href="admin.php?'.api_get_cidreq().'&newQuestion=yes&answerType='.$i.'">'.
1621
+                Display::return_icon($img, $explanation, null, ICON_SIZE_BIG).'</a>';
1622 1622
 
1623 1623
             if ($objExercise->force_edit_exercise_in_lp === false) {
1624 1624
                 if ($objExercise->exercise_was_added_in_lp == true) {
@@ -1639,9 +1639,9 @@  discard block
 block discarded – undo
1639 1639
             echo Display::return_icon('database_na.png', get_lang('GetExistingQuestion'), null, ICON_SIZE_BIG);
1640 1640
         } else {
1641 1641
             if ($feedback_type == 1) {
1642
-                echo $url = "<a href=\"question_pool.php?" . api_get_cidreq() . "&type=1&fromExercise=$exerciseId\">";
1642
+                echo $url = "<a href=\"question_pool.php?".api_get_cidreq()."&type=1&fromExercise=$exerciseId\">";
1643 1643
             } else {
1644
-                echo $url = '<a href="question_pool.php?' . api_get_cidreq() . '&fromExercise=' . $exerciseId . '">';
1644
+                echo $url = '<a href="question_pool.php?'.api_get_cidreq().'&fromExercise='.$exerciseId.'">';
1645 1645
             }
1646 1646
             echo Display::return_icon('database.png', get_lang('GetExistingQuestion'), null, ICON_SIZE_BIG);
1647 1647
         }
@@ -1778,7 +1778,7 @@  discard block
 block discarded – undo
1778 1778
             $header .= $this->show_media_content();
1779 1779
         }
1780 1780
 
1781
-        $header .= Display::page_subheader2($counter_label . ". " . $question_title);
1781
+        $header .= Display::page_subheader2($counter_label.". ".$question_title);
1782 1782
         $header .= Display::div(
1783 1783
             "<div class=\"rib rib-$class\"><h3>$score_label</h3></div> <h4>{$score['result']}</h4>",
1784 1784
             array('class' => 'ribbon')
@@ -1800,7 +1800,7 @@  discard block
 block discarded – undo
1800 1800
     public function create_question(
1801 1801
         $quiz_id,
1802 1802
         $question_name,
1803
-        $question_description = "" ,
1803
+        $question_description = "",
1804 1804
         $max_score = 0,
1805 1805
         $type = 1,
1806 1806
         $level = 1
@@ -1870,8 +1870,8 @@  discard block
 block discarded – undo
1870 1870
         require_once $tabQuestionList[$type][0];
1871 1871
 
1872 1872
         $img = $explanation = null;
1873
-        eval('$img = ' . $tabQuestionList[$type][1] . '::$typePicture;');
1874
-        eval('$explanation = get_lang(' . $tabQuestionList[$type][1] . '::$explanationLangVar);');
1873
+        eval('$img = '.$tabQuestionList[$type][1].'::$typePicture;');
1874
+        eval('$explanation = get_lang('.$tabQuestionList[$type][1].'::$explanationLangVar);');
1875 1875
         return array($img, $explanation);
1876 1876
     }
1877 1877
 
@@ -1936,7 +1936,7 @@  discard block
 block discarded – undo
1936 1936
         $media_list[0] = get_lang('NoMedia');
1937 1937
 
1938 1938
         if (!empty($medias)) {
1939
-            foreach($medias as $media) {
1939
+            foreach ($medias as $media) {
1940 1940
                 $media_list[$media['id']] = empty($media['question']) ? get_lang('Untitled') : $media['question'];
1941 1941
             }
1942 1942
         }
Please login to merge, or discard this patch.
main/exercise/hotspot_save.inc.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -15,24 +15,24 @@
 block discarded – undo
15 15
 $answerId 	= intval($_GET['answerId']);
16 16
 
17 17
 if ($_GET['type'] == "square" || $_GET['type'] == "circle") {
18
-	$hotspot_type = $_GET['type'];
19
-	$hotspot_coordinates = $_GET['x'].";".$_GET['y']."|".$_GET['width']."|".$_GET['height'];
18
+    $hotspot_type = $_GET['type'];
19
+    $hotspot_coordinates = $_GET['x'].";".$_GET['y']."|".$_GET['width']."|".$_GET['height'];
20 20
 }
21 21
 if ($_GET['type'] == "poly" || $_GET['type'] == "delineation" || $_GET['type'] == "oar") {
22
-	$hotspot_type = $_GET['type'];
23
-	$tmp_coord = explode(",",$_GET['co']);
24
-	$i = 0;
25
-	$hotspot_coordinates = "";
26
-	foreach ($tmp_coord as $coord) {
27
-		if ($i%2 == 0) {
28
-			$delimiter = ";";
29
-		} else {
30
-			$delimiter = "|";
31
-		}
32
-		$hotspot_coordinates .= $coord.$delimiter;
33
-		$i++;
34
-	}
35
-	$hotspot_coordinates = api_substr($hotspot_coordinates,0,-2);
22
+    $hotspot_type = $_GET['type'];
23
+    $tmp_coord = explode(",",$_GET['co']);
24
+    $i = 0;
25
+    $hotspot_coordinates = "";
26
+    foreach ($tmp_coord as $coord) {
27
+        if ($i%2 == 0) {
28
+            $delimiter = ";";
29
+        } else {
30
+            $delimiter = "|";
31
+        }
32
+        $hotspot_coordinates .= $coord.$delimiter;
33
+        $i++;
34
+    }
35
+    $hotspot_coordinates = api_substr($hotspot_coordinates,0,-2);
36 36
 }
37 37
 $course_id = api_get_course_int_id();
38 38
 $sql = "UPDATE $TBL_ANSWER SET
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
14 14
 $questionId = intval($_GET['questionId']);
15
-$answerId 	= intval($_GET['answerId']);
15
+$answerId = intval($_GET['answerId']);
16 16
 
17 17
 if ($_GET['type'] == "square" || $_GET['type'] == "circle") {
18 18
 	$hotspot_type = $_GET['type'];
@@ -20,11 +20,11 @@  discard block
 block discarded – undo
20 20
 }
21 21
 if ($_GET['type'] == "poly" || $_GET['type'] == "delineation" || $_GET['type'] == "oar") {
22 22
 	$hotspot_type = $_GET['type'];
23
-	$tmp_coord = explode(",",$_GET['co']);
23
+	$tmp_coord = explode(",", $_GET['co']);
24 24
 	$i = 0;
25 25
 	$hotspot_coordinates = "";
26 26
 	foreach ($tmp_coord as $coord) {
27
-		if ($i%2 == 0) {
27
+		if ($i % 2 == 0) {
28 28
 			$delimiter = ";";
29 29
 		} else {
30 30
 			$delimiter = "|";
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 		$hotspot_coordinates .= $coord.$delimiter;
33 33
 		$i++;
34 34
 	}
35
-	$hotspot_coordinates = api_substr($hotspot_coordinates,0,-2);
35
+	$hotspot_coordinates = api_substr($hotspot_coordinates, 0, -2);
36 36
 }
37 37
 $course_id = api_get_course_int_id();
38 38
 $sql = "UPDATE $TBL_ANSWER SET
Please login to merge, or discard this patch.
main/exercise/unique_answer_no_option.class.php 3 patches
Braces   +13 added lines, -10 removed lines patch added patch discarded remove patch
@@ -146,15 +146,17 @@  discard block
 block discarded – undo
146 146
                     $list_dest = $item_list[2];
147 147
                     $url = $item_list[3];
148 148
 
149
-                    if ($try == 0)
150
-                        $try_result = 0;
151
-                    else
152
-                        $try_result = 1;
149
+                    if ($try == 0) {
150
+                                            $try_result = 0;
151
+                    } else {
152
+                                            $try_result = 1;
153
+                    }
153 154
 
154
-                    if ($url == 0)
155
-                        $url_result = '';
156
-                    else
157
-                        $url_result = $url;
155
+                    if ($url == 0) {
156
+                                            $url_result = '';
157
+                    } else {
158
+                                            $url_result = $url;
159
+                    }
158 160
 
159 161
                     $temp_scenario['url' . $i] = $url_result;
160 162
                     $temp_scenario['try' . $i] = $try_result;
@@ -343,8 +345,9 @@  discard block
 block discarded – undo
343 345
                 }
344 346
         	}
345 347
 
346
- 			if (empty($try))
347
- 				$try=0;
348
+ 			if (empty($try)) {
349
+ 			 				$try=0;
350
+ 			}
348 351
 
349 352
  			if (empty($lp)) {
350 353
  				$lp=0;
Please login to merge, or discard this patch.
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -14,20 +14,20 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class UniqueAnswerNoOption extends Question
16 16
 {
17
-	public static $typePicture = 'mcuao.png';
18
-	public static $explanationLangVar = 'UniqueAnswerNoOption';
17
+    public static $typePicture = 'mcuao.png';
18
+    public static $explanationLangVar = 'UniqueAnswerNoOption';
19 19
 
20
-	/**
21
-	 * Constructor
22
-	 */
23
-	public function __construct()
20
+    /**
21
+     * Constructor
22
+     */
23
+    public function __construct()
24 24
     {
25
-		parent::__construct();
26
-		$this -> type = UNIQUE_ANSWER_NO_OPTION;
27
-		$this -> isContent = $this-> getIsContent();
28
-	}
25
+        parent::__construct();
26
+        $this -> type = UNIQUE_ANSWER_NO_OPTION;
27
+        $this -> isContent = $this-> getIsContent();
28
+    }
29 29
 
30
-	/**
30
+    /**
31 31
      * function which redifines Question::createAnswersForm
32 32
      * @param the formvalidator instance
33 33
      * @param the answers number to display
@@ -283,37 +283,37 @@  discard block
 block discarded – undo
283 283
     }
284 284
 
285 285
     /**
286
-	 * Function which creates the form to create / edit the answers of the question
287
-	 * @param the formvalidator instance
288
-	 * @param the answers number to display
289
-	 */
290
-	function processAnswersCreation($form)
286
+     * Function which creates the form to create / edit the answers of the question
287
+     * @param the formvalidator instance
288
+     * @param the answers number to display
289
+     */
290
+    function processAnswersCreation($form)
291 291
     {
292
-		$questionWeighting = $nbrGoodAnswers = 0;
293
-		$correct = $form -> getSubmitValue('correct');
294
-		$objAnswer = new Answer($this->id);
295
-		$nb_answers = $form -> getSubmitValue('nb_answers');
296
-		$minus = 1;
297
-		if ($form -> getSubmitValue('new_question')) {
298
-		    $minus = 0;
299
-		}
300
-
301
-		for ($i=1 ; $i <= $nb_answers - $minus; $i++) {
302
-		    $position   = trim($form -> getSubmitValue('position['.$i.']'));
303
-        	$answer     = trim($form -> getSubmitValue('answer['.$i.']'));
292
+        $questionWeighting = $nbrGoodAnswers = 0;
293
+        $correct = $form -> getSubmitValue('correct');
294
+        $objAnswer = new Answer($this->id);
295
+        $nb_answers = $form -> getSubmitValue('nb_answers');
296
+        $minus = 1;
297
+        if ($form -> getSubmitValue('new_question')) {
298
+            $minus = 0;
299
+        }
300
+
301
+        for ($i=1 ; $i <= $nb_answers - $minus; $i++) {
302
+            $position   = trim($form -> getSubmitValue('position['.$i.']'));
303
+            $answer     = trim($form -> getSubmitValue('answer['.$i.']'));
304 304
             $comment    = trim($form -> getSubmitValue('comment['.$i.']'));
305 305
             $weighting  = trim($form -> getSubmitValue('weighting['.$i.']'));
306 306
             $scenario   = $form -> getSubmitValue('scenario');
307 307
 
308
-           	//$list_destination = $form -> getSubmitValue('destination'.$i);
309
-           	//$destination_str = $form -> getSubmitValue('destination'.$i);
308
+                //$list_destination = $form -> getSubmitValue('destination'.$i);
309
+                //$destination_str = $form -> getSubmitValue('destination'.$i);
310 310
 
311
- 		    $try           = $scenario['try'.$i];
311
+                $try           = $scenario['try'.$i];
312 312
             $lp            = $scenario['lp'.$i];
313
- 			$destination   = $scenario['destination'.$i];
314
- 			$url           = trim($scenario['url'.$i]);
313
+                $destination   = $scenario['destination'.$i];
314
+                $url           = trim($scenario['url'.$i]);
315 315
 
316
- 			/*
316
+                /*
317 317
  			How we are going to parse the destination value
318 318
 
319 319
 			here we parse the destination value which is a string
@@ -326,41 +326,41 @@  discard block
 block discarded – undo
326 326
 			selected_questions= ids of questions
327 327
 			url= an url
328 328
 			*/
329
-			/*
329
+            /*
330 330
  			$destination_str='';
331 331
  			foreach ($list_destination as $destination_id)
332 332
  			{
333 333
  				$destination_str.=$destination_id.';';
334 334
  			}*/
335 335
 
336
-        	$goodAnswer= ($correct == $i) ? true : false;
336
+            $goodAnswer= ($correct == $i) ? true : false;
337 337
 
338
-        	if ($goodAnswer) {
339
-        		$nbrGoodAnswers++;
340
-        		$weighting = abs($weighting);
341
-        		if($weighting > 0) {
338
+            if ($goodAnswer) {
339
+                $nbrGoodAnswers++;
340
+                $weighting = abs($weighting);
341
+                if($weighting > 0) {
342 342
                     $questionWeighting += $weighting;
343 343
                 }
344
-        	}
344
+            }
345 345
 
346
- 			if (empty($try))
347
- 				$try=0;
346
+                if (empty($try))
347
+                    $try=0;
348 348
 
349
- 			if (empty($lp)) {
350
- 				$lp=0;
351
- 			}
349
+                if (empty($lp)) {
350
+                    $lp=0;
351
+                }
352 352
 
353
- 			if (empty($destination)) {
354
- 				$destination=0;
355
- 			}
353
+                if (empty($destination)) {
354
+                    $destination=0;
355
+                }
356 356
 
357
- 			if ($url=='') {
358
- 				$url=0;
359
- 			}
357
+                if ($url=='') {
358
+                    $url=0;
359
+                }
360 360
 
361
- 			//1@@1;2;@@2;4;4;@@http://www.chamilo.org
362
-			$dest= $try.'@@'.$lp.'@@'.$destination.'@@'.$url;
363
-        	$objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest);
361
+                //1@@1;2;@@2;4;4;@@http://www.chamilo.org
362
+            $dest= $try.'@@'.$lp.'@@'.$destination.'@@'.$url;
363
+            $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest);
364 364
         }
365 365
 
366 366
         //Create 666 answer
@@ -373,18 +373,18 @@  discard block
 block discarded – undo
373 373
 
374 374
         $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest);
375 375
 
376
-    	// saves the answers into the data base
376
+        // saves the answers into the data base
377 377
         $objAnswer -> save();
378 378
 
379 379
         // sets the total weighting of the question
380 380
         $this -> updateWeighting($questionWeighting);
381 381
         $this -> save();
382
-	}
382
+    }
383 383
 
384
-	function return_header($feedback_type = null, $counter = null, $score = null)
384
+    function return_header($feedback_type = null, $counter = null, $score = null)
385 385
     {
386
-	    $header = parent::return_header($feedback_type, $counter, $score);
387
-	    $header .= '<table class="'.$this->question_table_class .'">
386
+        $header = parent::return_header($feedback_type, $counter, $score);
387
+        $header .= '<table class="'.$this->question_table_class .'">
388 388
 			<tr>
389 389
 				<th>'.get_lang("Choice").'</th>
390 390
 				<th>'. get_lang("ExpectedChoice").'</th>
@@ -392,5 +392,5 @@  discard block
 block discarded – undo
392 392
         $header .= '<th>'.get_lang("Comment").'</th>';
393 393
         $header .= '</tr>';
394 394
         return $header;
395
-	}
395
+    }
396 396
 }
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
         $editor_config = array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '125');
41 41
         //this line define how many question by default appear when creating a choice question
42
-        $nb_answers = isset($_POST['nb_answers']) ? (int) $_POST['nb_answers'] : 3;  // The previous default value was 2. See task #1759.
42
+        $nb_answers = isset($_POST['nb_answers']) ? (int) $_POST['nb_answers'] : 3; // The previous default value was 2. See task #1759.
43 43
         $nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0));
44 44
 
45 45
         /*
@@ -55,20 +55,20 @@  discard block
 block discarded – undo
55 55
         if ($obj_ex->selectFeedbackType() == 1) {
56 56
             $editor_config['Width'] = '250';
57 57
             $editor_config['Height'] = '110';
58
-            $comment_title = '<th width="50%" >' . get_lang('Comment') . '</th>';
59
-            $feedback_title = '<th width="50%" >' . get_lang('Scenario') . '</th>';
58
+            $comment_title = '<th width="50%" >'.get_lang('Comment').'</th>';
59
+            $feedback_title = '<th width="50%" >'.get_lang('Scenario').'</th>';
60 60
         } else {
61
-            $comment_title = '<th width="50%">' . get_lang('Comment') . '</th>';
61
+            $comment_title = '<th width="50%">'.get_lang('Comment').'</th>';
62 62
         }
63 63
 
64 64
         $html = '<table class="table table-striped table-hover">';
65 65
         $html .= '<thead>';
66 66
         $html .= '<tr>';
67
-        $html .= '<th>' . get_lang('Number') . '</th>';
68
-        $html .= '<th>' . get_lang('True') . '</th>';
69
-        $html .= '<th width="50%">' . get_lang('Answer') . '</th>';
70
-        $html .= $comment_title . $feedback_title;
71
-        $html .= '<th>' . get_lang('Weighting') . '</th>';
67
+        $html .= '<th>'.get_lang('Number').'</th>';
68
+        $html .= '<th>'.get_lang('True').'</th>';
69
+        $html .= '<th width="50%">'.get_lang('Answer').'</th>';
70
+        $html .= $comment_title.$feedback_title;
71
+        $html .= '<th>'.get_lang('Weighting').'</th>';
72 72
         $html .= '</tr>';
73 73
         $html .= '</thead>';
74 74
         $html .= '<tbody>';
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
                         $weight_result = '0';
136 136
                     }
137 137
 
138
-                    $defaults['answer[' . $i . ']'] = $answer_result;
139
-                    $defaults['comment[' . $i . ']'] = $answer->comment[$i];
140
-                    $defaults['weighting[' . $i . ']'] = $weight_result;
138
+                    $defaults['answer['.$i.']'] = $answer_result;
139
+                    $defaults['comment['.$i.']'] = $answer->comment[$i];
140
+                    $defaults['weighting['.$i.']'] = $weight_result;
141 141
 
142 142
                     $item_list = explode('@@', $answer->destination[$i]);
143 143
 
@@ -156,10 +156,10 @@  discard block
 block discarded – undo
156 156
                     else
157 157
                         $url_result = $url;
158 158
 
159
-                    $temp_scenario['url' . $i] = $url_result;
160
-                    $temp_scenario['try' . $i] = $try_result;
161
-                    $temp_scenario['lp' . $i] = $lp;
162
-                    $temp_scenario['destination' . $i] = $list_dest;
159
+                    $temp_scenario['url'.$i] = $url_result;
160
+                    $temp_scenario['try'.$i] = $try_result;
161
+                    $temp_scenario['lp'.$i] = $lp;
162
+                    $temp_scenario['destination'.$i] = $list_dest;
163 163
                 }
164 164
             }
165 165
 
@@ -172,30 +172,30 @@  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
-            $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"');
190
+            $answer_number = $form->addElement('text', 'counter['.$i.']', null, 'value="'.$i.'"');
191 191
             $answer_number->freeze();
192 192
 
193 193
 
194 194
             $form->addElement('radio', 'correct', null, null, $i, 'class="checkbox" style="margin-left: 0em;"');
195
-            $form->addElement('html_editor', 'answer[' . $i . ']', null, array(), $editor_config);
195
+            $form->addElement('html_editor', 'answer['.$i.']', null, array(), $editor_config);
196 196
 
197
-            $form->addElement('html_editor', 'comment[' . $i . ']', null, array(), $editor_config);
198
-            $form->addElement('text', 'weighting[' . $i . ']', null, array('style' => 'width: 60px;', 'value' => '0'));
197
+            $form->addElement('html_editor', 'comment['.$i.']', null, array(), $editor_config);
198
+            $form->addElement('text', 'weighting['.$i.']', null, array('style' => 'width: 60px;', 'value' => '0'));
199 199
             $form->addElement('html', '</tr>');
200 200
             $i++;
201 201
         }
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
         $form->addHtml('<tr>');
211 211
 
212 212
         $defaults["counter[$i]"] = '-';
213
-        $defaults['answer[' . $i . ']'] = get_lang('DontKnow');
214
-        $defaults['weighting[' . $i . ']'] = '0';
213
+        $defaults['answer['.$i.']'] = get_lang('DontKnow');
214
+        $defaults['weighting['.$i.']'] = '0';
215 215
         $defaults['scenario'] = $temp_scenario;
216 216
         $renderer = & $form->defaultRenderer();
217 217
 
@@ -221,32 +221,32 @@  discard block
 block discarded – undo
221 221
         );
222 222
         $renderer->setElementTemplate(
223 223
             '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
224
-            'counter[' . $i . ']'
224
+            'counter['.$i.']'
225 225
         );
226 226
         $renderer->setElementTemplate(
227 227
             '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
228
-            'answer[' . $i . ']'
228
+            'answer['.$i.']'
229 229
         );
230 230
         $renderer->setElementTemplate(
231 231
             '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
232
-            'comment[' . $i . ']'
232
+            'comment['.$i.']'
233 233
         );
234 234
         $renderer->setElementTemplate(
235 235
             '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
236
-            'weighting[' . $i . ']'
236
+            'weighting['.$i.']'
237 237
         );
238 238
 
239 239
         $form
240
-            ->addElement('text', 'counter[' . $i . ']', null)
240
+            ->addElement('text', 'counter['.$i.']', null)
241 241
             ->freeze();
242 242
 
243
-        $form->addElement('hidden', 'position[' . $i . ']', '666');
243
+        $form->addElement('hidden', 'position['.$i.']', '666');
244 244
 
245 245
         $form->addElement('radio', 'correct', null, null, $i, ['class' => 'checkbox', 'disabled' => true]);
246
-        $form->addElement('html_editor', 'answer[' . $i . ']', null, array(), $editor_config);
246
+        $form->addElement('html_editor', 'answer['.$i.']', null, array(), $editor_config);
247 247
 
248
-        $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required');
249
-        $form->addElement('html_editor', 'comment[' . $i . ']', null, array(), $editor_config);
248
+        $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required');
249
+        $form->addElement('html_editor', 'comment['.$i.']', null, array(), $editor_config);
250 250
 
251 251
         //$form->addElement('select', 'destination'.$i, get_lang('SelectQuestion').' : ',$select_question,'multiple');
252 252
 
@@ -302,9 +302,9 @@  discard block
 block discarded – undo
302 302
 		    $minus = 0;
303 303
 		}
304 304
 
305
-		for ($i=1 ; $i <= $nb_answers - $minus; $i++) {
306
-		    $position   = trim($form -> getSubmitValue('position['.$i.']'));
307
-        	$answer     = trim($form -> getSubmitValue('answer['.$i.']'));
305
+		for ($i = 1; $i <= $nb_answers - $minus; $i++) {
306
+		    $position = trim($form -> getSubmitValue('position['.$i.']'));
307
+        	$answer = trim($form -> getSubmitValue('answer['.$i.']'));
308 308
             $comment    = trim($form -> getSubmitValue('comment['.$i.']'));
309 309
             $weighting  = trim($form -> getSubmitValue('weighting['.$i.']'));
310 310
             $scenario   = $form -> getSubmitValue('scenario');
@@ -312,8 +312,8 @@  discard block
 block discarded – undo
312 312
            	//$list_destination = $form -> getSubmitValue('destination'.$i);
313 313
            	//$destination_str = $form -> getSubmitValue('destination'.$i);
314 314
 
315
- 		    $try           = $scenario['try'.$i];
316
-            $lp            = $scenario['lp'.$i];
315
+ 		    $try = $scenario['try'.$i];
316
+            $lp = $scenario['lp'.$i];
317 317
  			$destination   = $scenario['destination'.$i];
318 318
  			$url           = trim($scenario['url'.$i]);
319 319
 
@@ -337,34 +337,34 @@  discard block
 block discarded – undo
337 337
  				$destination_str.=$destination_id.';';
338 338
  			}*/
339 339
 
340
-        	$goodAnswer= ($correct == $i) ? true : false;
340
+        	$goodAnswer = ($correct == $i) ? true : false;
341 341
 
342 342
         	if ($goodAnswer) {
343 343
         		$nbrGoodAnswers++;
344 344
         		$weighting = abs($weighting);
345
-        		if($weighting > 0) {
345
+        		if ($weighting > 0) {
346 346
                     $questionWeighting += $weighting;
347 347
                 }
348 348
         	}
349 349
 
350 350
  			if (empty($try))
351
- 				$try=0;
351
+ 				$try = 0;
352 352
 
353 353
  			if (empty($lp)) {
354
- 				$lp=0;
354
+ 				$lp = 0;
355 355
  			}
356 356
 
357 357
  			if (empty($destination)) {
358
- 				$destination=0;
358
+ 				$destination = 0;
359 359
  			}
360 360
 
361
- 			if ($url=='') {
362
- 				$url=0;
361
+ 			if ($url == '') {
362
+ 				$url = 0;
363 363
  			}
364 364
 
365 365
  			//1@@1;2;@@2;4;4;@@http://www.chamilo.org
366
-			$dest= $try.'@@'.$lp.'@@'.$destination.'@@'.$url;
367
-        	$objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest);
366
+			$dest = $try.'@@'.$lp.'@@'.$destination.'@@'.$url;
367
+        	$objAnswer -> createAnswer($answer, $goodAnswer, $comment, $weighting, $i, NULL, NULL, $dest);
368 368
         }
369 369
 
370 370
         //Create 666 answer
@@ -372,10 +372,10 @@  discard block
 block discarded – undo
372 372
         $answer     = trim($form -> getSubmitValue('answer['.$i.']'));
373 373
         $comment    = trim($form -> getSubmitValue('comment['.$i.']'));
374 374
         $weighting  = trim($form -> getSubmitValue('weighting['.$i.']'));
375
-        $goodAnswer= ($correct == $i) ? true : false;
375
+        $goodAnswer = ($correct == $i) ? true : false;
376 376
         $dest       = '';
377 377
 
378
-        $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest);
378
+        $objAnswer -> createAnswer($answer, $goodAnswer, $comment, $weighting, $i, NULL, NULL, $dest);
379 379
 
380 380
     	// saves the answers into the data base
381 381
         $objAnswer -> save();
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 	function return_header($feedback_type = null, $counter = null, $score = null)
389 389
     {
390 390
 	    $header = parent::return_header($feedback_type, $counter, $score);
391
-	    $header .= '<table class="'.$this->question_table_class .'">
391
+	    $header .= '<table class="'.$this->question_table_class.'">
392 392
 			<tr>
393 393
 				<th>'.get_lang("Choice").'</th>
394 394
 				<th>'. get_lang("ExpectedChoice").'</th>
Please login to merge, or discard this patch.
main/exercise/hotspot_admin.inc.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -907,10 +907,10 @@
 block discarded – undo
907 907
                                         <?php } else { ?>
908 908
                                             <input class="form-control" type="text" name="weighting[<?php echo $i; ?>]" value="<?php echo (isset($weighting[$i]) ? $weighting[$i] : 10); ?>" />
909 909
                                                    <?php
910
-                                               }
911
-                                           }
912
-                                           if ($answerType == HOT_SPOT) {
913
-                                               ?>
910
+                                                }
911
+                                            }
912
+                                            if ($answerType == HOT_SPOT) {
913
+                                                ?>
914 914
                                         <input class="form-control" type="text" name="weighting[<?php echo $i; ?>]" value="<?php echo (isset($weighting[$i]) ? $weighting[$i] : 10); ?>" />
915 915
                                         <input type="hidden" name="hotspot_coordinates[<?php echo $i; ?>]" value="<?php echo (empty($hotspot_coordinates[$i]) ? '0;0|0|0' : $hotspot_coordinates[$i]); ?>" />
916 916
                                         <input type="hidden" name="hotspot_type[<?php echo $i; ?>]" value="<?php echo (empty($hotspot_type[$i]) ? 'square' : $hotspot_type[$i]); ?>" />
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 if ($modifyIn) {
27 27
     if ($debug > 0) {
28
-        echo '$modifyIn was set' . "<br />\n";
28
+        echo '$modifyIn was set'."<br />\n";
29 29
     }
30 30
     // if the user has chosen to modify the question only in the current exercise
31 31
     if ($modifyIn == 'thisExercise') {
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     unset($buttonBack);
65 65
 }
66 66
 
67
-$hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercise/admin.php?' . api_get_cidreq() . '&exerciseId=' . $exerciseId;
67
+$hotspot_admin_url = api_get_path(WEB_CODE_PATH).'exercise/admin.php?'.api_get_cidreq().'&exerciseId='.$exerciseId;
68 68
 
69 69
 // the answer form has been submitted
70 70
 $submitAnswers = isset($_POST['submitAnswers']) ? true : false;
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
 if ($submitAnswers || $buttonBack) {
75 75
     if ($answerType == HOT_SPOT) {
76 76
         if ($debug > 0) {
77
-            echo '$submitAnswers or $buttonBack was set' . "<br />\n";
77
+            echo '$submitAnswers or $buttonBack was set'."<br />\n";
78 78
         }
79 79
 
80 80
         $questionWeighting = $nbrGoodAnswers = 0;
81 81
         for ($i = 1; $i <= $nbrAnswers; $i++) {
82 82
             if ($debug > 0) {
83
-                echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n";
83
+                echo str_repeat('&nbsp;', 4).'$answerType is HOT_SPOT'."<br />\n";
84 84
             }
85 85
 
86 86
             $reponse[$i] = trim($reponse[$i]);
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         if (empty($msgErr)) {
115 115
             for ($i = 1; $i <= $nbrAnswers; $i++) {
116 116
                 if ($debug > 0) {
117
-                    echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n";
117
+                    echo str_repeat('&nbsp;', 4).'$answerType is HOT_SPOT'."<br />\n";
118 118
                 }
119 119
 
120 120
                 $reponse[$i] = trim($reponse[$i]);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
                 $weighting[$i] = ($weighting[$i]); //it can be float
123 123
 
124 124
                 if ($weighting[$i]) {
125
-                    $questionWeighting+=$weighting[$i];
125
+                    $questionWeighting += $weighting[$i];
126 126
                 }
127 127
 
128 128
                 // creates answer
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
 
146 146
             $editQuestion = $questionId;
147 147
             unset($modifyAnswers);
148
-            echo '<script type="text/javascript">window.location.href="' . $hotspot_admin_url . '&message=ItemUpdated"</script>';
148
+            echo '<script type="text/javascript">window.location.href="'.$hotspot_admin_url.'&message=ItemUpdated"</script>';
149 149
         }
150 150
 
151 151
         if ($debug > 0) {
152
-            echo '$modifyIn was set - end' . "<br />\n";
152
+            echo '$modifyIn was set - end'."<br />\n";
153 153
         }
154 154
     } else {
155 155
         if ($debug > 0) {
156
-            echo '$submitAnswers or $buttonBack was set' . "<br />\n";
156
+            echo '$submitAnswers or $buttonBack was set'."<br />\n";
157 157
         }
158 158
 
159 159
         $questionWeighting = $nbrGoodAnswers = 0;
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
         for ($i = 1; $i <= $nbrAnswers; $i++) {
170 170
             if ($debug > 0) {
171
-                echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n";
171
+                echo str_repeat('&nbsp;', 4).'$answerType is HOT_SPOT'."<br />\n";
172 172
             }
173 173
 
174 174
             $reponse[$i] = trim($reponse[$i]);
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
                 $threadhold3_str = intval($threadhold3[$i]);
194 194
             }
195 195
 
196
-            $threadhold_total = $threadhold1_str . ';' . $threadhold2_str . ';' . $threadhold3_str;
196
+            $threadhold_total = $threadhold1_str.';'.$threadhold2_str.';'.$threadhold3_str;
197 197
 
198 198
             if (isset($try[$i]) && $try[$i] == 'on') {
199 199
                 $try_str = 1;
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
                 $question_str = $select_question[$i];
220 220
             }
221 221
 
222
-            $destination[$i] = $threadhold_total . '@@' . $try_str . '@@' . $lp_str . '@@' . $question_str . '@@' . $url_str;
222
+            $destination[$i] = $threadhold_total.'@@'.$try_str.'@@'.$lp_str.'@@'.$question_str.'@@'.$url_str;
223 223
 
224 224
             // checks if field is empty
225 225
             if (empty($reponse[$i]) && $reponse[$i] != '0') {
@@ -277,12 +277,12 @@  discard block
 block discarded – undo
277 277
             $question_str = $selectQuestionNoError;
278 278
         }
279 279
 
280
-        $destination_noerror = $threadhold_total . '@@' . $try_str . '@@' . $lp_str . '@@' . $question_str . '@@' . $url_str;
280
+        $destination_noerror = $threadhold_total.'@@'.$try_str.'@@'.$lp_str.'@@'.$question_str.'@@'.$url_str;
281 281
 
282 282
         if (empty($msgErr)) {
283 283
             for ($i = 1; $i <= $nbrAnswers; $i++) {
284 284
                 if ($debug > 0) {
285
-                    echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n";
285
+                    echo str_repeat('&nbsp;', 4).'$answerType is HOT_SPOT'."<br />\n";
286 286
                 }
287 287
 
288 288
                 $reponse[$i] = trim($reponse[$i]);
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
                 $weighting[$i] = ($weighting[$i]); //it can be float
291 291
 
292 292
                 if ($weighting[$i]) {
293
-                    $questionWeighting+=$weighting[$i];
293
+                    $questionWeighting += $weighting[$i];
294 294
                 }
295 295
                 // creates answer
296 296
                 $objAnswer->createAnswer(
@@ -325,14 +325,14 @@  discard block
 block discarded – undo
325 325
             $editQuestion = $questionId;
326 326
             unset($modifyAnswers);
327 327
 
328
-            echo '<script type="text/javascript">window.location.href="' . $hotspot_admin_url . '&message=ItemUpdated"</script>';
328
+            echo '<script type="text/javascript">window.location.href="'.$hotspot_admin_url.'&message=ItemUpdated"</script>';
329 329
         }
330 330
     }
331 331
 }
332 332
 
333 333
 if ($modifyAnswers) {
334 334
     if ($debug > 0) {
335
-        echo str_repeat('&nbsp;', 0) . '$modifyAnswers is set' . "<br />\n";
335
+        echo str_repeat('&nbsp;', 0).'$modifyAnswers is set'."<br />\n";
336 336
     }
337 337
 
338 338
     // construction of the Answer object
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
     Session::write('objAnswer', $objAnswer);
341 341
 
342 342
     if ($debug > 0) {
343
-        echo str_repeat('&nbsp;', 2) . '$answerType is HOT_SPOT' . "<br />\n";
343
+        echo str_repeat('&nbsp;', 2).'$answerType is HOT_SPOT'."<br />\n";
344 344
     }
345 345
 
346 346
     if ($answerType == HOT_SPOT_DELINEATION) {
@@ -521,11 +521,11 @@  discard block
 block discarded – undo
521 521
     }
522 522
 
523 523
     if ($debug > 0) {
524
-        echo str_repeat('&nbsp;', 2) . '$usedInSeveralExercises is untrue' . "<br />\n";
524
+        echo str_repeat('&nbsp;', 2).'$usedInSeveralExercises is untrue'."<br />\n";
525 525
     }
526 526
 
527 527
     if ($debug > 0) {
528
-        echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n";
528
+        echo str_repeat('&nbsp;', 4).'$answerType is HOT_SPOT'."<br />\n";
529 529
     }
530 530
 
531 531
     if ($answerType == HOT_SPOT_DELINEATION) {
@@ -565,14 +565,14 @@  discard block
 block discarded – undo
565 565
 
566 566
     Display::tag(
567 567
         'h3',
568
-        get_lang('Question') . ": " . $questionName . Display::return_icon('info3.gif', strip_tags(get_lang('HotspotChoose')))
568
+        get_lang('Question').": ".$questionName.Display::return_icon('info3.gif', strip_tags(get_lang('HotspotChoose')))
569 569
     );
570 570
 
571 571
     if (!empty($msgErr)) {
572 572
         Display::display_normal_message($msgErr); //main API
573 573
     }
574 574
 
575
-    $hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercise/admin.php?' . api_get_cidreq() . '&hotspotadmin=' . $modifyAnswers . '&exerciseId=' . $exerciseId . '&' . api_get_cidreq();
575
+    $hotspot_admin_url = api_get_path(WEB_CODE_PATH).'exercise/admin.php?'.api_get_cidreq().'&hotspotadmin='.$modifyAnswers.'&exerciseId='.$exerciseId.'&'.api_get_cidreq();
576 576
     ?>
577 577
     <form method="post" action="<?php echo $hotspot_admin_url; ?>" class="form-horizontal" id="frm_exercise" name="frm_exercise">
578 578
         <div class="form-group">
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
                                 <th><?php echo get_lang('Comment'); ?></th>
612 612
                                 <?php
613 613
                                 if ($answerType == HOT_SPOT_DELINEATION) {
614
-                                    echo '<th >' . get_lang('Scenario') . '</th>';
614
+                                    echo '<th >'.get_lang('Scenario').'</th>';
615 615
                                 }
616 616
                                 ?>
617 617
                                 <?php
@@ -643,36 +643,36 @@  discard block
 block discarded – undo
643 643
                                         $isSelected = true;
644 644
                                         $selected = 'selected="selected"';
645 645
                                     }
646
-                                    $option_lp.='<option value="' . $id . '" ' . $selected . '>' . $details['lp_name'] . '</option>';
646
+                                    $option_lp .= '<option value="'.$id.'" '.$selected.'>'.$details['lp_name'].'</option>';
647 647
                                 }
648 648
 
649 649
                                 if ($isSelected) {
650
-                                    $option_lp = '<option value="0">' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
650
+                                    $option_lp = '<option value="0">'.get_lang('SelectTargetLP').'</option>'.$option_lp;
651 651
                                 } else {
652
-                                    $option_lp = '<option value="0" selected="selected" >' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
652
+                                    $option_lp = '<option value="0" selected="selected" >'.get_lang('SelectTargetLP').'</option>'.$option_lp;
653 653
                                 }
654 654
 
655 655
                                 // Feedback SELECT
656 656
                                 $question_list = $objExercise->selectQuestionList();
657 657
                                 $option_feed = '';
658
-                                $option_feed.='<option value="0">' . get_lang('SelectTargetQuestion') . '</option>';
658
+                                $option_feed .= '<option value="0">'.get_lang('SelectTargetQuestion').'</option>';
659 659
 
660 660
                                 foreach ($question_list as $key => $questionid) {
661 661
                                     $selected = '';
662 662
                                     $question = Question::read($questionid);
663
-                                    $val = 'Q' . $key . ' :' . substrwords($question->selectTitle(), ICON_SIZE_SMALL);
663
+                                    $val = 'Q'.$key.' :'.substrwords($question->selectTitle(), ICON_SIZE_SMALL);
664 664
 
665 665
                                     if (isset($select_question[$i]) && $questionid == $select_question[$i]) {
666 666
                                         $selected = 'selected="selected"';
667 667
                                     }
668 668
 
669
-                                    $option_feed.='<option value="' . $questionid . '" ' . $selected . ' >' . $val . '</option>';
669
+                                    $option_feed .= '<option value="'.$questionid.'" '.$selected.' >'.$val.'</option>';
670 670
                                 }
671 671
 
672 672
                                 if (isset($select_question[$i]) && $select_question[$i] == -1) {
673
-                                    $option_feed .= '<option value="-1" selected="selected" >' . get_lang('ExitTest') . '</option>';
673
+                                    $option_feed .= '<option value="-1" selected="selected" >'.get_lang('ExitTest').'</option>';
674 674
                                 } else {
675
-                                    $option_feed .= '<option value="-1">' . get_lang('ExitTest') . '</option>';
675
+                                    $option_feed .= '<option value="-1">'.get_lang('ExitTest').'</option>';
676 676
                                 }
677 677
 
678 678
                                 //-------- IF it is a delineation
@@ -688,9 +688,9 @@  discard block
 block discarded – undo
688 688
                                             $selected2 = 'selected="selected"';
689 689
                                         if ($k == $threadhold3[$i])
690 690
                                             $selected3 = 'selected="selected"';
691
-                                        $option1.='<option ' . $selected1 . ' >' . $k . ' % </option>';
692
-                                        $option2.='<option ' . $selected2 . ' >' . $k . ' % </option>';
693
-                                        $option3.='<option ' . $selected3 . '>' . $k . ' %</option>';
691
+                                        $option1 .= '<option '.$selected1.' >'.$k.' % </option>';
692
+                                        $option2 .= '<option '.$selected2.' >'.$k.' % </option>';
693
+                                        $option3 .= '<option '.$selected3.'>'.$k.' %</option>';
694 694
                                     }
695 695
                                     ?>
696 696
                                     <tr>
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
                                                 <div class="checkbox">
735 735
                                                     <p>
736 736
                                                         <label>
737
-                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]"  <?php if ($try[$i] == 1) echo'checked'; ?> />
737
+                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]"  <?php if ($try[$i] == 1) echo'checked'; ?> />
738 738
                                                             <?php echo get_lang('TryAgain'); ?>
739 739
                                                         </label>
740 740
                                                     </p>
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
                                                             <div class="checkbox">
788 788
                                                                 <p>
789 789
                                                                     <label>
790
-                                                                        <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
790
+                                                                        <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
791 791
                                                                         <?php echo get_lang('TryAgain'); ?>
792 792
                                                                     </label>
793 793
                                                                 </p>
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
                                                 <div class="checkbox">
853 853
                                                     <p>
854 854
                                                         <label>
855
-                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) echo'checked'; ?> />
855
+                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) echo'checked'; ?> />
856 856
                                                             <?php echo get_lang('TryAgain'); ?>
857 857
                                                         </label>
858 858
                                                     </p>
@@ -892,12 +892,12 @@  discard block
 block discarded – undo
892 892
                                         <input class="form-control" type="text" name="reponse[<?php echo $i; ?>]" value="<?php echo Security::remove_XSS($responseValue); ?>" />
893 893
                                     </td>
894 894
                                     <?php
895
-                                    $form = new FormValidator('form_' . $i);
895
+                                    $form = new FormValidator('form_'.$i);
896 896
                                     $config = array(
897 897
                                         'ToolbarSet' => 'TestProposedAnswer',
898 898
                                         'cols-size' => [0, 12, 0]
899 899
                                     );
900
-                                    $form->addHtmlEditor('comment[' . $i . ']', null, false, false, $config);
900
+                                    $form->addHtmlEditor('comment['.$i.']', null, false, false, $config);
901 901
                                     $renderer = $form->defaultRenderer();
902 902
                                     $form_template = '{content}';
903 903
                                     $renderer->setFormTemplate($form_template);
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
                                         {element}';
907 907
                                     $renderer->setElementTemplate($element_template);
908 908
 
909
-                                    $form->setDefaults(array('comment[' . $i . ']' => $commentValue));
909
+                                    $form->setDefaults(array('comment['.$i.']' => $commentValue));
910 910
                                     $return = $form->return_form();
911 911
                                     ?>
912 912
                                     <td colspan="2" align="left" ><?php echo $return; ?></td>
@@ -945,36 +945,36 @@  discard block
 block discarded – undo
945 945
                                 $selected = 'selected="selected"';
946 946
                                 $isSelected = true;
947 947
                             }
948
-                            $option_lp.='<option value="' . $id . '" ' . $selected . '>' . $details['lp_name'] . '</option>';
948
+                            $option_lp .= '<option value="'.$id.'" '.$selected.'>'.$details['lp_name'].'</option>';
949 949
                         }
950 950
 
951 951
                         if ($isSelected) {
952
-                            $option_lp = '<option value="0">' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
952
+                            $option_lp = '<option value="0">'.get_lang('SelectTargetLP').'</option>'.$option_lp;
953 953
                         } else {
954
-                            $option_lp = '<option value="0" selected="selected" >' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
954
+                            $option_lp = '<option value="0" selected="selected" >'.get_lang('SelectTargetLP').'</option>'.$option_lp;
955 955
                         }
956 956
 
957 957
                         // Feedback SELECT
958 958
                         $question_list = $objExercise->selectQuestionList();
959 959
                         $option_feed = '';
960
-                        $option_feed.='<option value="0">' . get_lang('SelectTargetQuestion') . '</option>';
960
+                        $option_feed .= '<option value="0">'.get_lang('SelectTargetQuestion').'</option>';
961 961
                         $details = isset($details) ? $details : null;
962 962
                         $id = isset($id) ? $id : 0;
963 963
                         $selectQuestionNoError = isset($selectQuestionNoError) ? $selectQuestionNoError : null;
964 964
                         foreach ($question_list as $key => $questionid) {
965 965
                             $selected = '';
966 966
                             $question = Question::read($questionid);
967
-                            $val = 'Q' . $key . ' :' . substrwords($question->selectTitle(), ICON_SIZE_SMALL);
967
+                            $val = 'Q'.$key.' :'.substrwords($question->selectTitle(), ICON_SIZE_SMALL);
968 968
                             $select_lp_id[$id] = $details['lp_name'];
969 969
                             if ($questionid == $selectQuestionNoError) {
970 970
                                 $selected = 'selected="selected"';
971 971
                             }
972
-                            $option_feed.='<option value="' . $questionid . '" ' . $selected . ' >' . $val . '</option>';
972
+                            $option_feed .= '<option value="'.$questionid.'" '.$selected.' >'.$val.'</option>';
973 973
                         }
974 974
                         if ($selectQuestionNoError == -1) {
975
-                            $option_feed.='<option value="-1" selected="selected" >' . get_lang('ExitTest') . '</option>';
975
+                            $option_feed .= '<option value="-1" selected="selected" >'.get_lang('ExitTest').'</option>';
976 976
                         } else {
977
-                            $option_feed.='<option value="-1">' . get_lang('ExitTest') . '</option>';
977
+                            $option_feed .= '<option value="-1">'.get_lang('ExitTest').'</option>';
978 978
                         }
979 979
 
980 980
                         if ($answerType == HOT_SPOT_DELINEATION) {
@@ -1065,6 +1065,6 @@  discard block
 block discarded – undo
1065 1065
     </script>
1066 1066
     <?php
1067 1067
     if ($debug > 0) {
1068
-        echo str_repeat('&nbsp;', 0) . '$modifyAnswers was set - end' . "<br />\n";
1068
+        echo str_repeat('&nbsp;', 0).'$modifyAnswers was set - end'."<br />\n";
1069 1069
     }
1070 1070
 }
Please login to merge, or discard this patch.
Braces   +29 added lines, -11 removed lines patch added patch discarded remove patch
@@ -679,12 +679,15 @@  discard block
 block discarded – undo
679 679
                                     $option1 = $option2 = $option3 = '';
680 680
                                     for ($k = 1; $k <= 100; $k++) {
681 681
                                         $selected1 = $selected2 = $selected3 = '';
682
-                                        if ($k == $threadhold1[$i])
683
-                                            $selected1 = 'selected="selected"';
684
-                                        if ($k == $threadhold2[$i])
685
-                                            $selected2 = 'selected="selected"';
686
-                                        if ($k == $threadhold3[$i])
687
-                                            $selected3 = 'selected="selected"';
682
+                                        if ($k == $threadhold1[$i]) {
683
+                                                                                    $selected1 = 'selected="selected"';
684
+                                        }
685
+                                        if ($k == $threadhold2[$i]) {
686
+                                                                                    $selected2 = 'selected="selected"';
687
+                                        }
688
+                                        if ($k == $threadhold3[$i]) {
689
+                                                                                    $selected3 = 'selected="selected"';
690
+                                        }
688 691
                                         $option1.='<option ' . $selected1 . ' >' . $k . ' % </option>';
689 692
                                         $option2.='<option ' . $selected2 . ' >' . $k . ' % </option>';
690 693
                                         $option3.='<option ' . $selected3 . '>' . $k . ' %</option>';
@@ -731,7 +734,10 @@  discard block
 block discarded – undo
731 734
                                                 <div class="checkbox">
732 735
                                                     <p>
733 736
                                                         <label>
734
-                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]"  <?php if ($try[$i] == 1) echo'checked'; ?> />
737
+                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]"  <?php if ($try[$i] == 1) {
738
+    echo'checked';
739
+}
740
+?> />
735 741
                                                             <?php echo get_lang('TryAgain'); ?>
736 742
                                                         </label>
737 743
                                                     </p>
@@ -784,7 +790,10 @@  discard block
 block discarded – undo
784 790
                                                             <div class="checkbox">
785 791
                                                                 <p>
786 792
                                                                     <label>
787
-                                                                        <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
793
+                                                                        <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) {
794
+    echo'checked';
795
+}
796
+?> />
788 797
                                                                         <?php echo get_lang('TryAgain'); ?>
789 798
                                                                     </label>
790 799
                                                                 </p>
@@ -823,7 +832,10 @@  discard block
 block discarded – undo
823 832
                                             <th ><?php echo get_lang('OAR'); ?>*</th>
824 833
                                             <?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?>
825 834
                                                 <th colspan="2" ><?php echo get_lang('Comment'); ?></th>
826
-                                                <th ><?php if ($answerType == HOT_SPOT_DELINEATION) echo get_lang('Scenario'); ?></th>
835
+                                                <th ><?php if ($answerType == HOT_SPOT_DELINEATION) {
836
+    echo get_lang('Scenario');
837
+}
838
+?></th>
827 839
                                             <?php } else { ?>
828 840
                                                 <th colspan="3" ><?php echo get_lang('Comment'); ?></th>
829 841
                                             <?php } ?>
@@ -849,7 +861,10 @@  discard block
 block discarded – undo
849 861
                                                 <div class="checkbox">
850 862
                                                     <p>
851 863
                                                         <label>
852
-                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) echo'checked'; ?> />
864
+                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) {
865
+    echo'checked';
866
+}
867
+?> />
853 868
                                                             <?php echo get_lang('TryAgain'); ?>
854 869
                                                         </label>
855 870
                                                     </p>
@@ -998,7 +1013,10 @@  discard block
 block discarded – undo
998 1013
                                         <div class="checkbox">
999 1014
                                             <p>
1000 1015
                                                 <label>
1001
-                                                    <input type="checkbox" class="checkbox" name="try_noerror" <?php if ($try_noerror == 1) echo'checked'; ?> />
1016
+                                                    <input type="checkbox" class="checkbox" name="try_noerror" <?php if ($try_noerror == 1) {
1017
+    echo'checked';
1018
+}
1019
+?> />
1002 1020
                                                     <?php echo get_lang('TryAgain'); ?>
1003 1021
                                                 </label>
1004 1022
                                             </p>
Please login to merge, or discard this patch.
main/exercise/upload_exercise.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 require_once '../inc/global.inc.php';
16 16
 
17
-require_once api_get_path(LIBRARY_PATH) . 'pear/excelreader/reader.php';
17
+require_once api_get_path(LIBRARY_PATH).'pear/excelreader/reader.php';
18 18
 
19 19
 // Security check
20 20
 $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
@@ -59,14 +59,14 @@  discard block
 block discarded – undo
59 59
 function lp_upload_quiz_actions()
60 60
 {
61 61
     $return = '<a href="exercise.php?'.api_get_cidReq().'">'.
62
-        Display::return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>';
62
+        Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>';
63 63
     return $return;
64 64
 }
65 65
 
66 66
 function lp_upload_quiz_secondary_actions()
67 67
 {
68
-    $return = '<a href="exercise_report.php?' . api_get_cidreq() . '">' .
69
-        Display :: return_icon('reporting32.png', get_lang('Tracking')) . get_lang('Tracking') . '</a>';
68
+    $return = '<a href="exercise_report.php?'.api_get_cidreq().'">'.
69
+        Display :: return_icon('reporting32.png', get_lang('Tracking')).get_lang('Tracking').'</a>';
70 70
     return $return;
71 71
 }
72 72
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     $table->setHeaderContents(0, 1, '#');
105 105
 
106 106
     $row = 1;
107
-    foreach ($tableList as $key => $label ) {
107
+    foreach ($tableList as $key => $label) {
108 108
         $table->setCellContents($row, 0, $label);
109 109
         $table->setCellContents($row, 1, $key);
110 110
         $row++;
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
                                     $comment = $feedback_true_list[$i][2];
444 444
                                 } else {
445 445
                                     $comment = $feedback_false_list[$i][2];
446
-                                    $floatVal = (float)$answer_data[3];
446
+                                    $floatVal = (float) $answer_data[3];
447 447
                                     if (is_numeric($floatVal)) {
448 448
                                         $score = $answer_data[3];
449 449
                                     }
Please login to merge, or discard this patch.