Completed
Pull Request — 1.11.x (#1421)
by José
46:34 queued 10:32
created
main/exercise/hotpotatoes.lib.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     if ($title == '') {
67 67
         $title = basename($fname);
68 68
     }
69
-    return (string)$title;
69
+    return (string) $title;
70 70
 }
71 71
 
72 72
 /**
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
         if ($src == '') {
177 177
             return '';
178 178
         } else {
179
-            $tmp_src = basename($src) ;
179
+            $tmp_src = basename($src);
180 180
             if ($tmp_src == '') {
181 181
                 return $src;
182 182
             } else {
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 {
199 199
     // Select src tag from img tag.
200 200
     $match = array();
201
-    preg_match("|(src=\".*\" )|U", $imgtag, $match);            //src
201
+    preg_match("|(src=\".*\" )|U", $imgtag, $match); //src
202 202
     list($key, $srctag) = each($match);
203 203
     $src = substr($srctag, 5, (strlen($srctag) - 7));
204 204
     if (stristr($src, 'http') === false) {
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
         while (list($key, $imgtag) = each($match)) {
231 231
             $imgname = GetImgName($imgtag);
232 232
             if ($imgname != '' && !in_array($imgname, $imgparams)) {
233
-                array_push($imgparams, $imgname);    // name (+ type) of the images in the html test
234
-                $imgcount = $imgcount + 1;            // number of images in the html test
233
+                array_push($imgparams, $imgname); // name (+ type) of the images in the html test
234
+                $imgcount = $imgcount + 1; // number of images in the html test
235 235
             }
236 236
         }
237 237
     }
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
                 if ($file != '..') {
405 405
                     $full_name = $folder.'/'.$file;
406 406
                     if (is_dir($full_name)) {
407
-                        $dflag = 1;    // first directory
407
+                        $dflag = 1; // first directory
408 408
                     }
409 409
                 }
410 410
             }
Please login to merge, or discard this patch.
main/exercise/answer.class.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         $objExercise->read($exerciseId);
74 74
 
75 75
         if ($objExercise->random_answers == '1') {
76
-            $this->readOrderedBy('rand()', '');// randomize answers
76
+            $this->readOrderedBy('rand()', ''); // randomize answers
77 77
         } else {
78 78
             $this->read(); // natural order
79 79
         }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
                 ORDER BY position";
115 115
 
116 116
         $result = Database::query($sql);
117
-        $i=1;
117
+        $i = 1;
118 118
 
119 119
         // while a record is found
120 120
         while ($object = Database::fetch_object($result)) {
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             $this->autoId[$i] = $object->id_auto;
131 131
             $i++;
132 132
         }
133
-        $this->nbrAnswers = $i-1;
133
+        $this->nbrAnswers = $i - 1;
134 134
     }
135 135
 
136 136
     /**
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     {
143 143
         foreach ($this->autoId as $key => $autoId) {
144 144
             if ($autoId == $id) {
145
-                $result =  [
145
+                $result = [
146 146
                     'answer' => $this->answer[$key],
147 147
                     'correct' => $this->correct[$key],
148 148
                     'comment' => $this->comment[$key],
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
         $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
167 167
         $questionId = $this->questionId;
168 168
 
169
-        $sql="SELECT id FROM
169
+        $sql = "SELECT id FROM
170 170
               $TBL_ANSWER
171 171
               WHERE c_id = {$this->course_id} AND question_id ='".$questionId."'";
172 172
 
@@ -188,14 +188,14 @@  discard block
 block discarded – undo
188 188
      * @param	string	DESC or ASC
189 189
      * @author 	Frederic Vauthier
190 190
      */
191
-    public function readOrderedBy($field, $order='ASC')
191
+    public function readOrderedBy($field, $order = 'ASC')
192 192
     {
193 193
 		$field = Database::escape_string($field);
194 194
 		if (empty($field)) {
195 195
 			$field = 'position';
196 196
 		}
197 197
 
198
-		if ($order != 'ASC' && $order!='DESC') {
198
+		if ($order != 'ASC' && $order != 'DESC') {
199 199
 			$order = 'ASC';
200 200
 		}
201 201
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
                     c_id = {$this->course_id} AND
231 231
                     question_id='".$questionId."'
232 232
                 ORDER BY $field $order";
233
-		$result=Database::query($sql);
233
+		$result = Database::query($sql);
234 234
 
235 235
 		$i = 1;
236 236
 		// while a record is found
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
             $this->autoId[$i] = $doubt_data->id_auto;
261 261
             $i++;
262 262
 	    }
263
-        $this->nbrAnswers = $i-1;
263
+        $this->nbrAnswers = $i - 1;
264 264
 	}
265 265
 
266 266
 	/**
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
     public function getGradesList()
403 403
      {
404 404
 	 	$list = array();
405
-	 	for ($i = 0; $i<$this->nbrAnswers;$i++){
406
-	 		if(!empty($this->answer[$i])){
405
+	 	for ($i = 0; $i < $this->nbrAnswers; $i++) {
406
+	 		if (!empty($this->answer[$i])) {
407 407
 	 			$list[$i] = $this->weighting[$i];
408 408
 	 		}
409 409
 	 	}
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 	 	$sql = "SELECT type FROM $TBL_QUESTIONS
422 422
 	 	        WHERE c_id = {$this->course_id} AND id = '".$this->questionId."'";
423 423
 	 	$res = Database::query($sql);
424
-	 	if (Database::num_rows($res)<=0){
424
+	 	if (Database::num_rows($res) <= 0) {
425 425
 	 		return null;
426 426
 	 	}
427 427
 	 	$row = Database::fetch_array($res);
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
         $correctList = [];
594 594
         $answerList = [];
595 595
 
596
-		for ($i=1; $i <= $this->new_nbrAnswers; $i++) {
596
+		for ($i = 1; $i <= $this->new_nbrAnswers; $i++) {
597 597
 			$answer = $this->new_answer[$i];
598 598
 			$correct = $this->new_correct[$i];
599 599
 			$comment = $this->new_comment[$i];
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
             $destination_options = Question::readQuestionOption($newQuestionId, $course_info['real_id']);
749 749
             $i = 0;
750 750
             if (!empty($destination_options)) {
751
-                foreach($destination_options as $item) {
751
+                foreach ($destination_options as $item) {
752 752
                     $fixed_list[$new_option_list[$i]] = $item['id'];
753 753
                     $i++;
754 754
                 }
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 			// inserts new answers into data base
761 761
 			$c_id = $course_info['real_id'];
762 762
 
763
-			for ($i=1;$i <= $this->nbrAnswers;$i++) {
763
+			for ($i = 1; $i <= $this->nbrAnswers; $i++) {
764 764
                 if ($this->course['id'] != $course_info['id']) {
765 765
                     $this->answer[$i] = DocumentManager::replace_urls_inside_content_html_from_copy_course(
766 766
                         $this->answer[$i],
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 1 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/hotspot_save.inc.php 1 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 1 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
         $editor_config = array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '125');
40 40
 
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
         }
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
         $i = 666;
210 210
         $form->addHtml('<tr>');
211 211
 
212
-        $defaults['answer[' . $i . ']'] = get_lang('DontKnow');
213
-        $defaults['weighting[' . $i . ']'] = 0;
212
+        $defaults['answer['.$i.']'] = get_lang('DontKnow');
213
+        $defaults['weighting['.$i.']'] = 0;
214 214
         $defaults['scenario'] = $temp_scenario;
215 215
         $renderer = & $form->defaultRenderer();
216 216
 
@@ -220,31 +220,31 @@  discard block
 block discarded – undo
220 220
         );
221 221
         $renderer->setElementTemplate(
222 222
             '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
223
-            'counter[' . $i . ']'
223
+            'counter['.$i.']'
224 224
         );
225 225
         $renderer->setElementTemplate(
226 226
             '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
227
-            'answer[' . $i . ']'
227
+            'answer['.$i.']'
228 228
         );
229 229
         $renderer->setElementTemplate(
230 230
             '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
231
-            'comment[' . $i . ']'
231
+            'comment['.$i.']'
232 232
         );
233 233
         $renderer->setElementTemplate(
234 234
             '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
235
-            'weighting[' . $i . ']'
235
+            'weighting['.$i.']'
236 236
         );
237 237
 
238
-        $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="-"');
238
+        $answer_number = $form->addElement('text', 'counter['.$i.']', null, 'value="-"');
239 239
         $answer_number->freeze();
240 240
 
241
-        $form->addElement('hidden', 'position[' . $i . ']', '666');
241
+        $form->addElement('hidden', 'position['.$i.']', '666');
242 242
 
243 243
         $form->addElement('radio', 'correct', null, null, $i, 'class="checkbox" style="margin-left: 0em;"');
244
-        $form->addElement('html_editor', 'answer[' . $i . ']', null, array(), $editor_config);
244
+        $form->addElement('html_editor', 'answer['.$i.']', null, array(), $editor_config);
245 245
 
246
-        $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required');
247
-        $form->addElement('html_editor', 'comment[' . $i . ']', null, array(), $editor_config);
246
+        $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required');
247
+        $form->addElement('html_editor', 'comment['.$i.']', null, array(), $editor_config);
248 248
 
249 249
         //$form->addElement('select', 'destination'.$i, get_lang('SelectQuestion').' : ',$select_question,'multiple');
250 250
 
@@ -298,9 +298,9 @@  discard block
 block discarded – undo
298 298
 		    $minus = 0;
299 299
 		}
300 300
 
301
-		for ($i=1 ; $i <= $nb_answers - $minus; $i++) {
302
-		    $position   = trim($form -> getSubmitValue('position['.$i.']'));
303
-        	$answer     = trim($form -> getSubmitValue('answer['.$i.']'));
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');
@@ -308,8 +308,8 @@  discard block
 block discarded – undo
308 308
            	//$list_destination = $form -> getSubmitValue('destination'.$i);
309 309
            	//$destination_str = $form -> getSubmitValue('destination'.$i);
310 310
 
311
- 		    $try           = $scenario['try'.$i];
312
-            $lp            = $scenario['lp'.$i];
311
+ 		    $try = $scenario['try'.$i];
312
+            $lp = $scenario['lp'.$i];
313 313
  			$destination   = $scenario['destination'.$i];
314 314
  			$url           = trim($scenario['url'.$i]);
315 315
 
@@ -333,34 +333,34 @@  discard block
 block discarded – undo
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 338
         	if ($goodAnswer) {
339 339
         		$nbrGoodAnswers++;
340 340
         		$weighting = abs($weighting);
341
-        		if($weighting > 0) {
341
+        		if ($weighting > 0) {
342 342
                     $questionWeighting += $weighting;
343 343
                 }
344 344
         	}
345 345
 
346 346
  			if (empty($try))
347
- 				$try=0;
347
+ 				$try = 0;
348 348
 
349 349
  			if (empty($lp)) {
350
- 				$lp=0;
350
+ 				$lp = 0;
351 351
  			}
352 352
 
353 353
  			if (empty($destination)) {
354
- 				$destination=0;
354
+ 				$destination = 0;
355 355
  			}
356 356
 
357
- 			if ($url=='') {
358
- 				$url=0;
357
+ 			if ($url == '') {
358
+ 				$url = 0;
359 359
  			}
360 360
 
361 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);
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
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
         $answer     = trim($form -> getSubmitValue('answer['.$i.']'));
369 369
         $comment    = trim($form -> getSubmitValue('comment['.$i.']'));
370 370
         $weighting  = trim($form -> getSubmitValue('weighting['.$i.']'));
371
-        $goodAnswer= ($correct == $i) ? true : false;
371
+        $goodAnswer = ($correct == $i) ? true : false;
372 372
         $dest       = '';
373 373
 
374
-        $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest);
374
+        $objAnswer -> createAnswer($answer, $goodAnswer, $comment, $weighting, $i, NULL, NULL, $dest);
375 375
 
376 376
     	// saves the answers into the data base
377 377
         $objAnswer -> save();
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 	function return_header($feedback_type = null, $counter = null, $score = null)
385 385
     {
386 386
 	    $header = parent::return_header($feedback_type, $counter, $score);
387
-	    $header .= '<table class="'.$this->question_table_class .'">
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>
Please login to merge, or discard this patch.
main/exercise/hotspot_admin.inc.php 1 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.
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.