Completed
Push — 1.11.x ( ca7787...41c0f2 )
by José
31:51
created
main/exercise/qti2.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 }
22 22
 
23 23
 // the breadcrumbs
24
-$interbreadcrumb[]= array (
25
-    "url" => api_get_path(WEB_CODE_PATH) . "exercise/exercise.php?".api_get_cidreq(),
24
+$interbreadcrumb[] = array(
25
+    "url" => api_get_path(WEB_CODE_PATH)."exercise/exercise.php?".api_get_cidreq(),
26 26
     "name" => get_lang('Exercises')
27 27
 );
28 28
 $is_allowedToEdit = api_is_allowed_to_edit(null, true);
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 {
35 35
     $name_tools = get_lang('ImportQtiQuiz');
36 36
     $form  = '<div class="actions">';
37
-    $form .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercise/exercise.php?show=test&'.api_get_cidreq().'">'.
37
+    $form .= '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/exercise.php?show=test&'.api_get_cidreq().'">'.
38 38
         Display :: return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>';
39 39
     $form .= '</div>';
40 40
     $formValidator = new FormValidator(
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         $imported = ch_qti2_import_file($_FILES['userFile']);
85 85
 
86 86
         if (is_numeric($imported) && !empty($imported)) {
87
-            header('Location: '.api_get_path(WEB_CODE_PATH) . 'exercise/admin.php?'.api_get_cidreq().'&exerciseId='.$imported);
87
+            header('Location: '.api_get_path(WEB_CODE_PATH).'exercise/admin.php?'.api_get_cidreq().'&exerciseId='.$imported);
88 88
             exit;
89 89
         } else {
90 90
             $message = Display::return_message(get_lang($imported));
Please login to merge, or discard this patch.
main/exercise/unique_answer.class.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -59,21 +59,21 @@  discard block
 block discarded – undo
59 59
 
60 60
         if ($obj_ex->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) {
61 61
             //Scenario
62
-            $comment_title = '<th width="20%">' . get_lang('Comment') . '</th>';
63
-            $feedback_title = '<th width="20%">' . get_lang('Scenario') . '</th>';
62
+            $comment_title = '<th width="20%">'.get_lang('Comment').'</th>';
63
+            $feedback_title = '<th width="20%">'.get_lang('Scenario').'</th>';
64 64
         } else {
65
-            $comment_title = '<th width="40%">' . get_lang('Comment') . '</th>';
65
+            $comment_title = '<th width="40%">'.get_lang('Comment').'</th>';
66 66
         }
67 67
 
68 68
         $html = '<table class="table table-striped table-hover">
69 69
             <thead>
70 70
                 <tr style="text-align: center;">
71
-                    <th width="5%">' . get_lang('Number') . '</th>
72
-                    <th width="5%"> ' . get_lang('True') . '</th>
73
-                    <th width="40%">' . get_lang('Answer') . '</th>
74
-                        ' . $comment_title . '
75
-                        ' . $feedback_title . '
76
-                    <th width="10%">' . get_lang('Weighting') . '</th>
71
+                    <th width="5%">' . get_lang('Number').'</th>
72
+                    <th width="5%"> ' . get_lang('True').'</th>
73
+                    <th width="40%">' . get_lang('Answer').'</th>
74
+                        ' . $comment_title.'
75
+                        ' . $feedback_title.'
76
+                    <th width="10%">' . get_lang('Weighting').'</th>
77 77
                 </tr>
78 78
             </thead>
79 79
             <tbody>';
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
                     continue;
104 104
                 }
105 105
                 $question = Question::read($questionid);
106
-                $select_question[$questionid] = 'Q' . $key . ' :' . cut(
106
+                $select_question[$questionid] = 'Q'.$key.' :'.cut(
107 107
                     $question->selectTitle(), 20
108 108
                 );
109 109
             }
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
                 if ($answer->correct[$i]) {
135 135
                     $correct = $i;
136 136
                 }
137
-                $defaults['answer[' . $i . ']'] = $answer->answer[$i];
138
-                $defaults['comment[' . $i . ']'] = $answer->comment[$i];
139
-                $defaults['weighting[' . $i . ']'] = float_format(
137
+                $defaults['answer['.$i.']'] = $answer->answer[$i];
138
+                $defaults['comment['.$i.']'] = $answer->comment[$i];
139
+                $defaults['weighting['.$i.']'] = float_format(
140 140
                     $answer->weighting[$i],
141 141
                     1
142 142
                 );
@@ -159,18 +159,18 @@  discard block
 block discarded – undo
159 159
                     $url_result = $url;
160 160
                 }
161 161
 
162
-                $temp_scenario['url' . $i] = $url_result;
163
-                $temp_scenario['try' . $i] = $try_result;
164
-                $temp_scenario['lp' . $i] = $lp;
165
-                $temp_scenario['destination' . $i] = $list_dest;
162
+                $temp_scenario['url'.$i] = $url_result;
163
+                $temp_scenario['try'.$i] = $try_result;
164
+                $temp_scenario['lp'.$i] = $lp;
165
+                $temp_scenario['destination'.$i] = $list_dest;
166 166
             } else {
167 167
                 $defaults['answer[1]'] = get_lang('DefaultUniqueAnswer1');
168 168
                 $defaults['weighting[1]'] = 10;
169 169
                 $defaults['answer[2]'] = get_lang('DefaultUniqueAnswer2');
170 170
                 $defaults['weighting[2]'] = 0;
171 171
 
172
-                $temp_scenario['destination' . $i] = array('0');
173
-                $temp_scenario['lp' . $i] = array('0');
172
+                $temp_scenario['destination'.$i] = array('0');
173
+                $temp_scenario['lp'.$i] = array('0');
174 174
             }
175 175
             $defaults['scenario'] = $temp_scenario;
176 176
 
@@ -182,62 +182,62 @@  discard block
 block discarded – undo
182 182
             );
183 183
             $renderer->setElementTemplate(
184 184
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
185
-                'counter[' . $i . ']'
185
+                'counter['.$i.']'
186 186
             );
187 187
             $renderer->setElementTemplate(
188 188
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
189
-                'answer[' . $i . ']'
189
+                'answer['.$i.']'
190 190
             );
191 191
             $renderer->setElementTemplate(
192 192
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
193
-                'comment[' . $i . ']'
193
+                'comment['.$i.']'
194 194
             );
195 195
             $renderer->setElementTemplate(
196 196
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
197
-                'weighting[' . $i . ']'
197
+                'weighting['.$i.']'
198 198
             );
199 199
 
200 200
             $answer_number = $form->addElement(
201
-                'text', 'counter[' . $i . ']', null, ' value = "' . $i . '"'
201
+                'text', 'counter['.$i.']', null, ' value = "'.$i.'"'
202 202
             );
203 203
             $answer_number->freeze();
204 204
             $form->addElement(
205 205
                 'radio', 'correct', null, null, $i, 'class="checkbox"'
206 206
             );
207 207
 
208
-            $form->addHtmlEditor('answer[' . $i . ']', null, null, true, $editor_config);
208
+            $form->addHtmlEditor('answer['.$i.']', null, null, true, $editor_config);
209 209
 
210 210
             $form->addRule(
211
-                'answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required'
211
+                'answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required'
212 212
             );
213 213
 
214 214
             if ($obj_ex->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) {
215
-                $form->addHtmlEditor('comment[' . $i . ']', null, null, false, $editor_config);
215
+                $form->addHtmlEditor('comment['.$i.']', null, null, false, $editor_config);
216 216
                 // Direct feedback
217 217
                 //Adding extra feedback fields
218 218
                 $group = array();
219
-                $group['try' . $i] = $form->createElement(
219
+                $group['try'.$i] = $form->createElement(
220 220
                     'checkbox',
221
-                    'try' . $i,
221
+                    'try'.$i,
222 222
                     null,
223 223
                     get_lang('TryAgain')
224 224
                 );
225
-                $group['lp' . $i] = $form->createElement(
225
+                $group['lp'.$i] = $form->createElement(
226 226
                     'select',
227
-                    'lp' . $i,
228
-                    get_lang('SeeTheory') . ': ',
227
+                    'lp'.$i,
228
+                    get_lang('SeeTheory').': ',
229 229
                     $select_lp_id
230 230
                 );
231
-                $group['destination' . $i] = $form->createElement(
231
+                $group['destination'.$i] = $form->createElement(
232 232
                     'select',
233
-                    'destination' . $i,
234
-                    get_lang('GoToQuestion') . ': ',
233
+                    'destination'.$i,
234
+                    get_lang('GoToQuestion').': ',
235 235
                     $select_question
236 236
                 );
237
-                $group['url' . $i] = $form->createElement(
237
+                $group['url'.$i] = $form->createElement(
238 238
                     'text',
239
-                    'url' . $i,
240
-                    get_lang('Other') . ': ',
239
+                    'url'.$i,
240
+                    get_lang('Other').': ',
241 241
                     array(
242 242
                         'class' => 'col-md-2',
243 243
                         'placeholder' => get_lang('Other')
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
                     'scenario'
251 251
                 );
252 252
             } else {
253
-                $form->addHtmlEditor('comment[' . $i . ']', null, null, false, $editor_config);
253
+                $form->addHtmlEditor('comment['.$i.']', null, null, false, $editor_config);
254 254
             }
255
-            $form->addText('weighting[' . $i . ']', null, null, array('value' => '0'));
255
+            $form->addText('weighting['.$i.']', null, null, array('value' => '0'));
256 256
             $form->addHtml('</tr>');
257 257
         }
258 258
 
@@ -306,19 +306,19 @@  discard block
 block discarded – undo
306 306
         $nb_answers = $form->getSubmitValue('nb_answers');
307 307
 
308 308
         for ($i = 1; $i <= $nb_answers; $i++) {
309
-            $answer = trim($form->getSubmitValue('answer[' . $i . ']'));
310
-            $comment = trim($form->getSubmitValue('comment[' . $i . ']'));
311
-            $weighting = trim($form->getSubmitValue('weighting[' . $i . ']'));
309
+            $answer = trim($form->getSubmitValue('answer['.$i.']'));
310
+            $comment = trim($form->getSubmitValue('comment['.$i.']'));
311
+            $weighting = trim($form->getSubmitValue('weighting['.$i.']'));
312 312
 
313 313
             $scenario = $form->getSubmitValue('scenario');
314 314
 
315 315
             //$list_destination = $form -> getSubmitValue('destination'.$i);
316 316
             //$destination_str = $form -> getSubmitValue('destination'.$i);
317 317
 
318
-            $try = $scenario['try' . $i];
319
-            $lp = $scenario['lp' . $i];
320
-            $destination = $scenario['destination' . $i];
321
-            $url = trim($scenario['url' . $i]);
318
+            $try = $scenario['try'.$i];
319
+            $lp = $scenario['lp'.$i];
320
+            $destination = $scenario['destination'.$i];
321
+            $url = trim($scenario['url'.$i]);
322 322
 
323 323
             /*
324 324
             How we are going to parse the destination value
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
             }
367 367
 
368 368
             //1@@1;2;@@2;4;4;@@http://www.chamilo.org
369
-            $dest = $try . '@@' . $lp . '@@' . $destination . '@@' . $url;
369
+            $dest = $try.'@@'.$lp.'@@'.$destination.'@@'.$url;
370 370
             $objAnswer->createAnswer(
371 371
                 $answer,
372 372
                 $goodAnswer,
@@ -400,12 +400,12 @@  discard block
 block discarded – undo
400 400
         $score = null
401 401
     ) {
402 402
         $header = parent::return_header($feedback_type, $counter, $score);
403
-        $header .= '<table class="' . $this->question_table_class . '">
403
+        $header .= '<table class="'.$this->question_table_class.'">
404 404
 			<tr>
405
-				<th>' . get_lang("Choice") . '</th>
406
-				<th>' . get_lang("ExpectedChoice") . '</th>
407
-				<th>' . get_lang("Answer") . '</th>';
408
-        $header .= '<th>' . get_lang("Comment") . '</th>';
405
+				<th>' . get_lang("Choice").'</th>
406
+				<th>' . get_lang("ExpectedChoice").'</th>
407
+				<th>' . get_lang("Answer").'</th>';
408
+        $header .= '<th>'.get_lang("Comment").'</th>';
409 409
         $header .= '</tr>';
410 410
 
411 411
         return $header;
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
         if ($correct) {
470 470
             $sql = "UPDATE $tbl_quiz_question
471 471
                     SET ponderation = (ponderation + $score)
472
-                    WHERE c_id = $course_id AND id = " . $question_id;
472
+                    WHERE c_id = $course_id AND id = ".$question_id;
473 473
             Database::query($sql);
474 474
         }
475 475
     }
Please login to merge, or discard this patch.
main/exercise/freeanswer.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,9 +60,9 @@
 block discarded – undo
60 60
             $score['revised'] = false;
61 61
         }
62 62
         $header = parent::return_header($feedback_type, $counter, $score);
63
-        $header .= '<table class="' . $this->question_table_class . '" >
63
+        $header .= '<table class="'.$this->question_table_class.'" >
64 64
         <tr>
65
-        <th>' . get_lang("Answer") . '</th>
65
+        <th>' . get_lang("Answer").'</th>
66 66
         </tr>';
67 67
 
68 68
         return $header;
Please login to merge, or discard this patch.
main/exercise/export/qti2/qti2_classes.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
      */
15 15
     public function setAnswer()
16 16
     {
17
-        switch($this->type) {
17
+        switch ($this->type) {
18 18
             case MCUA:
19 19
                 $answer = new ImsAnswerMultipleChoice($this->id);
20 20
 
@@ -77,21 +77,21 @@  discard block
 block discarded – undo
77 77
     {
78 78
         // @todo getAnswersList() converts the answers using api_html_entity_decode()
79 79
 		$this->answerList = $this->getAnswersList(true);
80
-        $out  = '    <choiceInteraction responseIdentifier="' . $questionIdent . '" >' . "\n";
81
-        $out .= '      <prompt><![CDATA['.formatExerciseQtiTitle($questionStatment) . ']]></prompt>'. "\n";
80
+        $out  = '    <choiceInteraction responseIdentifier="'.$questionIdent.'" >'."\n";
81
+        $out .= '      <prompt><![CDATA['.formatExerciseQtiTitle($questionStatment).']]></prompt>'."\n";
82 82
 		if (is_array($this->answerList)) {
83 83
 	        foreach ($this->answerList as $current_answer) {
84
-	            $out .= '<simpleChoice identifier="answer_' . $current_answer['id'] . '" fixed="false">
84
+	            $out .= '<simpleChoice identifier="answer_'.$current_answer['id'].'" fixed="false">
85 85
                          <![CDATA['.formatExerciseQtiTitle($current_answer['answer']).']]>';
86 86
 	            if (isset($current_answer['comment']) && $current_answer['comment'] != '') {
87
-	                $out .= '<feedbackInline identifier="answer_' . $current_answer['id'] . '">
87
+	                $out .= '<feedbackInline identifier="answer_'.$current_answer['id'].'">
88 88
 	                         <![CDATA['.formatExerciseQtiTitle($current_answer['comment']).']]>
89 89
 	                         </feedbackInline>';
90 90
 	            }
91
-	            $out .= '</simpleChoice>'. "\n";
91
+	            $out .= '</simpleChoice>'."\n";
92 92
 	        }
93 93
 		}
94
-        $out .= '    </choiceInteraction>'. "\n";
94
+        $out .= '    </choiceInteraction>'."\n";
95 95
 
96 96
         return $out;
97 97
     }
@@ -106,32 +106,32 @@  discard block
 block discarded – undo
106 106
 		$type = $this->getQuestionType();
107 107
         if ($type == MCMA)  $cardinality = 'multiple'; else $cardinality = 'single';
108 108
 
109
-        $out = '  <responseDeclaration identifier="' . $questionIdent . '" cardinality="' . $cardinality . '" baseType="identifier">' . "\n";
109
+        $out = '  <responseDeclaration identifier="'.$questionIdent.'" cardinality="'.$cardinality.'" baseType="identifier">'."\n";
110 110
 
111 111
         // Match the correct answers.
112 112
 
113
-        $out .= '    <correctResponse>'. "\n";
113
+        $out .= '    <correctResponse>'."\n";
114 114
 		if (is_array($this->answerList)) {
115
-	        foreach($this->answerList as $current_answer) {
115
+	        foreach ($this->answerList as $current_answer) {
116 116
 	            if ($current_answer['correct']) {
117
-	                $out .= '      <value>answer_'. $current_answer['id'] .'</value>'. "\n";
117
+	                $out .= '      <value>answer_'.$current_answer['id'].'</value>'."\n";
118 118
 	            }
119 119
 	        }
120 120
 		}
121
-        $out .= '    </correctResponse>'. "\n";
121
+        $out .= '    </correctResponse>'."\n";
122 122
 
123 123
         //Add the grading
124 124
 
125
-        $out .= '    <mapping>'. "\n";
125
+        $out .= '    <mapping>'."\n";
126 126
 		if (is_array($this->answerList)) {
127
-	        foreach($this->answerList as $current_answer) {
127
+	        foreach ($this->answerList as $current_answer) {
128 128
 	            if (isset($current_answer['grade'])) {
129
-	                $out .= ' <mapEntry mapKey="answer_'. $current_answer['id'] .'" mappedValue="'.$current_answer['grade'].'" />'. "\n";
129
+	                $out .= ' <mapEntry mapKey="answer_'.$current_answer['id'].'" mappedValue="'.$current_answer['grade'].'" />'."\n";
130 130
 	            }
131 131
 	        }
132 132
 		}
133
-        $out .= '    </mapping>'. "\n";
134
-        $out .= '  </responseDeclaration>'. "\n";
133
+        $out .= '    </mapping>'."\n";
134
+        $out .= '  </responseDeclaration>'."\n";
135 135
 
136 136
         return $out;
137 137
     }
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
                 $key = $answer['id'];
159 159
                 $answer = $answer['answer'];
160 160
                 $len = api_strlen($answer);
161
-                $text = str_replace('['.$answer.']','<textEntryInteraction responseIdentifier="fill_'.$key.'" expectedLength="'.api_strlen($answer).'"/>', $text);
161
+                $text = str_replace('['.$answer.']', '<textEntryInteraction responseIdentifier="fill_'.$key.'" expectedLength="'.api_strlen($answer).'"/>', $text);
162 162
             }
163 163
         }
164 164
         $out = $text;
@@ -178,17 +178,17 @@  discard block
 block discarded – undo
178 178
 	        foreach ($this->answerList as $answer) {
179 179
 	        	$answerKey = $answer['id'];
180 180
 	        	$answer = $answer['answer'];
181
-	            $out .= '  <responseDeclaration identifier="fill_' . $answerKey . '" cardinality="single" baseType="identifier">' . "\n";
182
-	            $out .= '    <correctResponse>'. "\n";
183
-                $out .= '      <value><![CDATA['.formatExerciseQtiTitle($answer).']]></value>'. "\n";
184
-	            $out .= '    </correctResponse>'. "\n";
181
+	            $out .= '  <responseDeclaration identifier="fill_'.$answerKey.'" cardinality="single" baseType="identifier">'."\n";
182
+	            $out .= '    <correctResponse>'."\n";
183
+                $out .= '      <value><![CDATA['.formatExerciseQtiTitle($answer).']]></value>'."\n";
184
+	            $out .= '    </correctResponse>'."\n";
185 185
 	            if (isset($this->gradeList[$answerKey])) {
186
-	                $out .= '    <mapping>'. "\n";
187
-	                $out .= '      <mapEntry mapKey="'.$answer.'" mappedValue="'.$this->gradeList[$answerKey].'"/>'. "\n";
188
-	                $out .= '    </mapping>'. "\n";
186
+	                $out .= '    <mapping>'."\n";
187
+	                $out .= '      <mapEntry mapKey="'.$answer.'" mappedValue="'.$this->gradeList[$answerKey].'"/>'."\n";
188
+	                $out .= '    </mapping>'."\n";
189 189
 	            }
190 190
 
191
-	            $out .= '  </responseDeclaration>'. "\n";
191
+	            $out .= '  </responseDeclaration>'."\n";
192 192
 	        }
193 193
 		}
194 194
 
@@ -212,12 +212,12 @@  discard block
 block discarded – undo
212 212
 
213 213
         $out = "";
214 214
 
215
-        $out .= '<matchInteraction responseIdentifier="' . $questionIdent . '" maxAssociations="'. $maxAssociation .'">'. "\n";
215
+        $out .= '<matchInteraction responseIdentifier="'.$questionIdent.'" maxAssociations="'.$maxAssociation.'">'."\n";
216 216
         $out .= $questionStatment;
217 217
 
218 218
         //add left column
219 219
 
220
-        $out .= '  <simpleMatchSet>'. "\n";
220
+        $out .= '  <simpleMatchSet>'."\n";
221 221
 		if (is_array($this->leftList)) {
222 222
 	        foreach ($this->leftList as $leftKey=>$leftElement) {
223 223
 	            $out .= '
@@ -227,24 +227,24 @@  discard block
 block discarded – undo
227 227
 	        }
228 228
     	}
229 229
 
230
-        $out .= '  </simpleMatchSet>'. "\n";
230
+        $out .= '  </simpleMatchSet>'."\n";
231 231
 
232 232
         //add right column
233 233
 
234
-        $out .= '  <simpleMatchSet>'. "\n";
234
+        $out .= '  <simpleMatchSet>'."\n";
235 235
 
236 236
         $i = 0;
237 237
 
238 238
 		if (is_array($this->rightList)) {
239
-	        foreach($this->rightList as $rightKey=>$rightElement) {
239
+	        foreach ($this->rightList as $rightKey=>$rightElement) {
240 240
 	            $out .= '<simpleAssociableChoice identifier="right_'.$i.'" >
241 241
 	                    <![CDATA['.formatExerciseQtiTitle($rightElement['answer']).']]>
242 242
 	                    </simpleAssociableChoice>'. "\n";
243 243
 	            $i++;
244 244
 	        }
245 245
 		}
246
-        $out .= '  </simpleMatchSet>'. "\n";
247
-        $out .= '</matchInteraction>'. "\n";
246
+        $out .= '  </simpleMatchSet>'."\n";
247
+        $out .= '</matchInteraction>'."\n";
248 248
 
249 249
         return $out;
250 250
     }
@@ -255,32 +255,32 @@  discard block
 block discarded – undo
255 255
     public function imsExportResponsesDeclaration($questionIdent)
256 256
     {
257 257
 		$this->answerList = $this->getAnswersList(true);
258
-        $out =  '  <responseDeclaration identifier="' . $questionIdent . '" cardinality="single" baseType="identifier">' . "\n";
259
-        $out .= '    <correctResponse>' . "\n";
258
+        $out = '  <responseDeclaration identifier="'.$questionIdent.'" cardinality="single" baseType="identifier">'."\n";
259
+        $out .= '    <correctResponse>'."\n";
260 260
 
261 261
         $gradeArray = array();
262 262
 		if (is_array($this->leftList)) {
263 263
 	        foreach ($this->leftList as $leftKey=>$leftElement) {
264
-	            $i=0;
264
+	            $i = 0;
265 265
 	            foreach ($this->rightList as $rightKey=>$rightElement) {
266 266
 	                if (($leftElement['match'] == $rightElement['code'])) {
267
-	                    $out .= '      <value>left_' . $leftKey . ' right_'.$i.'</value>'. "\n";
267
+	                    $out .= '      <value>left_'.$leftKey.' right_'.$i.'</value>'."\n";
268 268
 
269
-	                    $gradeArray['left_' . $leftKey . ' right_'.$i] = $leftElement['grade'];
269
+	                    $gradeArray['left_'.$leftKey.' right_'.$i] = $leftElement['grade'];
270 270
 	                }
271 271
 	                $i++;
272 272
 	            }
273 273
 	        }
274 274
 		}
275
-        $out .= '    </correctResponse>'. "\n";
276
-        $out .= '    <mapping>' . "\n";
275
+        $out .= '    </correctResponse>'."\n";
276
+        $out .= '    <mapping>'."\n";
277 277
         if (is_array($gradeArray)) {
278 278
 	        foreach ($gradeArray as $gradeKey=>$grade) {
279
-	            $out .= '          <mapEntry mapKey="'.$gradeKey.'" mappedValue="'.$grade.'"/>' . "\n";
279
+	            $out .= '          <mapEntry mapKey="'.$gradeKey.'" mappedValue="'.$grade.'"/>'."\n";
280 280
 	        }
281 281
         }
282
-        $out .= '    </mapping>' . "\n";
283
-        $out .= '  </responseDeclaration>'. "\n";
282
+        $out .= '    </mapping>'."\n";
283
+        $out .= '  </responseDeclaration>'."\n";
284 284
 
285 285
         return $out;
286 286
     }
@@ -296,12 +296,12 @@  discard block
 block discarded – undo
296 296
      * TODO update this to match hot spots instead of copying matching
297 297
      * Export the question part as a matrix-choice, with only one possible answer per line.
298 298
      */
299
-    public function imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='')
299
+    public function imsExportResponses($questionIdent, $questionStatment, $questionDesc = '', $questionMedia = '')
300 300
     {
301 301
 		$this->answerList = $this->getAnswersList(true);
302 302
 		$questionMedia = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/images/'.$questionMedia;
303 303
 		$mimetype = mime_content_type($questionMedia);
304
-		if(empty($mimetype)){
304
+		if (empty($mimetype)) {
305 305
 			$mimetype = 'image/jpeg';
306 306
 		}
307 307
 
@@ -317,26 +317,26 @@  discard block
 block discarded – undo
317 317
 	        	//coords are transformed according to QTIv2 rules here: http://www.imsproject.org/question/qtiv2p1pd/imsqti_infov2p1pd.html#element10663
318 318
 	        	$coords = '';
319 319
 	        	$type = 'default';
320
-	        	switch($answer['hotspot_type']){
320
+	        	switch ($answer['hotspot_type']) {
321 321
 	        		case 'square':
322 322
 	        			$type = 'rect';
323 323
 						$res = array();
324
-						$coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/',$answer['hotspot_coord'],$res);
325
-						$coords = $res[1].','.$res[2].','.((int)$res[1]+(int)$res[3]).",".((int)$res[2]+(int)$res[4]);
324
+						$coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/', $answer['hotspot_coord'], $res);
325
+						$coords = $res[1].','.$res[2].','.((int) $res[1] + (int) $res[3]).",".((int) $res[2] + (int) $res[4]);
326 326
 	        			break;
327 327
 	        		case 'circle':
328 328
 	        			$type = 'circle';
329 329
 			 			$res = array();
330
-						$coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/',$answer['hotspot_coord'],$res);
331
-						$coords = $res[1].','.$res[2].','.sqrt(pow(($res[1]-$res[3]),2)+pow(($res[2]-$res[4])));
330
+						$coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/', $answer['hotspot_coord'], $res);
331
+						$coords = $res[1].','.$res[2].','.sqrt(pow(($res[1] - $res[3]), 2) + pow(($res[2] - $res[4])));
332 332
 	        			break;
333 333
 	        		case 'poly':
334 334
 	        			$type = 'poly';
335
-						$coords = str_replace(array(';','|'),array(',',','),$answer['hotspot_coord']);
335
+						$coords = str_replace(array(';', '|'), array(',', ','), $answer['hotspot_coord']);
336 336
 	        			break;
337 337
 	        		 case 'delineation' :
338 338
 	        			$type = 'delineation';
339
-						$coords = str_replace(array(';','|'),array(',',','),$answer['hotspot_coord']);
339
+						$coords = str_replace(array(';', '|'), array(',', ','), $answer['hotspot_coord']);
340 340
 	        			break;
341 341
 	        	}
342 342
 	            $text .= '        <hotspotChoice shape="'.$type.'" coords="'.$coords.'" identifier="'.$key.'"/>'."\n";
@@ -356,18 +356,18 @@  discard block
 block discarded – undo
356 356
 		$this->answerList = $this->getAnswersList(true);
357 357
 		$this->gradeList = $this->getGradesList();
358 358
         $out = '';
359
-        $out .= '  <responseDeclaration identifier="hotspot_'.$questionIdent.'" cardinality="ordered" baseType="identifier">' . "\n";
360
-        $out .= '    <correctResponse>'. "\n";
359
+        $out .= '  <responseDeclaration identifier="hotspot_'.$questionIdent.'" cardinality="ordered" baseType="identifier">'."\n";
360
+        $out .= '    <correctResponse>'."\n";
361 361
 
362 362
 		if (is_array($this->answerList)) {
363
-	        foreach ($this->answerList as $answerKey=>$answer)  {
363
+	        foreach ($this->answerList as $answerKey=>$answer) {
364 364
 	        	$answerKey = $answer['id'];
365 365
 	        	$answer = $answer['answer'];
366 366
 	            $out .= '<value><![CDATA['.formatExerciseQtiTitle($answerKey).']]></value>';
367 367
 	        }
368 368
 		}
369
-        $out .= '    </correctResponse>'. "\n";
370
-        $out .= '  </responseDeclaration>'. "\n";
369
+        $out .= '    </correctResponse>'."\n";
370
+        $out .= '  </responseDeclaration>'."\n";
371 371
 
372 372
        return $out;
373 373
     }
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
      * TODO implement
384 384
      * Export the question part as a matrix-choice, with only one possible answer per line.
385 385
      */
386
-    public function imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='')
386
+    public function imsExportResponses($questionIdent, $questionStatment, $questionDesc = '', $questionMedia = '')
387 387
 	{
388 388
 		return '';
389 389
 	}
Please login to merge, or discard this patch.
main/exercise/UniqueAnswerImage.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -40,22 +40,22 @@  discard block
 block discarded – undo
40 40
 
41 41
         if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) {
42 42
             //Scenario
43
-            $commentTitle = '<th>' . get_lang('Comment') . '</th>';
44
-            $feedbackTitle = '<th>' . get_lang('Scenario') . '</th>';
43
+            $commentTitle = '<th>'.get_lang('Comment').'</th>';
44
+            $feedbackTitle = '<th>'.get_lang('Scenario').'</th>';
45 45
         } else {
46
-            $commentTitle = '<th >' . get_lang('Comment') . '</th>';
46
+            $commentTitle = '<th >'.get_lang('Comment').'</th>';
47 47
         }
48 48
 
49 49
         $html = '<div class="alert alert-success" role="alert">'.get_lang('UniqueAnswerImagePreferredSize200x150').'</div>';
50 50
         $html .= '<table class="table table-striped table-hover">
51 51
             <thead>
52 52
                 <tr style="text-align: center;">
53
-                    <th width="10">' . get_lang('Number') . '</th>
54
-                    <th>' . get_lang('True') . '</th>
55
-                    <th>' . get_lang('Answer') . '</th>
56
-                        ' . $commentTitle . '
57
-                        ' . $feedbackTitle . '
58
-                    <th width="15">' . get_lang('Weighting') . '</th>
53
+                    <th width="10">' . get_lang('Number').'</th>
54
+                    <th>' . get_lang('True').'</th>
55
+                    <th>' . get_lang('Answer').'</th>
56
+                        ' . $commentTitle.'
57
+                        ' . $feedbackTitle.'
58
+                    <th width="15">' . get_lang('Weighting').'</th>
59 59
                 </tr>
60 60
             </thead>
61 61
             <tbody>';
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
                 }
91 91
 
92 92
                 $question = Question::read($questionid);
93
-                $selectQuestion[$questionid] = 'Q' . $key . ' :' . cut(
93
+                $selectQuestion[$questionid] = 'Q'.$key.' :'.cut(
94 94
                     $question->selectTitle(), 20
95 95
                 );
96 96
             }
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
                     $correct = $i;
124 124
                 }
125 125
 
126
-                $defaults['answer[' . $i . ']'] = $answer->answer[$i];
127
-                $defaults['comment[' . $i . ']'] = $answer->comment[$i];
128
-                $defaults['weighting[' . $i . ']'] = float_format(
126
+                $defaults['answer['.$i.']'] = $answer->answer[$i];
127
+                $defaults['comment['.$i.']'] = $answer->comment[$i];
128
+                $defaults['weighting['.$i.']'] = float_format(
129 129
                     $answer->weighting[$i], 1
130 130
                 );
131 131
 
@@ -148,18 +148,18 @@  discard block
 block discarded – undo
148 148
                     $urlResult = $url;
149 149
                 }
150 150
 
151
-                $tempScenario['url' . $i] = $urlResult;
152
-                $tempScenario['try' . $i] = $tryResult;
153
-                $tempScenario['lp' . $i] = $lp;
154
-                $tempScenario['destination' . $i] = $listDestination;
151
+                $tempScenario['url'.$i] = $urlResult;
152
+                $tempScenario['try'.$i] = $tryResult;
153
+                $tempScenario['lp'.$i] = $lp;
154
+                $tempScenario['destination'.$i] = $listDestination;
155 155
             } else {
156 156
                 $defaults['answer[1]'] = get_lang('DefaultUniqueAnswer1');
157 157
                 $defaults['weighting[1]'] = 10;
158 158
                 $defaults['answer[2]'] = get_lang('DefaultUniqueAnswer2');
159 159
                 $defaults['weighting[2]'] = 0;
160 160
 
161
-                $tempScenario['destination' . $i] = array('0');
162
-                $tempScenario['lp' . $i] = array('0');
161
+                $tempScenario['destination'.$i] = array('0');
162
+                $tempScenario['lp'.$i] = array('0');
163 163
             }
164 164
 
165 165
             $defaults['scenario'] = $tempScenario;
@@ -172,50 +172,50 @@  discard block
 block discarded – undo
172 172
             );
173 173
             $renderer->setElementTemplate(
174 174
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
175
-                'counter[' . $i . ']'
175
+                'counter['.$i.']'
176 176
             );
177 177
             $renderer->setElementTemplate(
178 178
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
179
-                'answer[' . $i . ']'
179
+                'answer['.$i.']'
180 180
             );
181 181
             $renderer->setElementTemplate(
182 182
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
183
-                'comment[' . $i . ']'
183
+                'comment['.$i.']'
184 184
             );
185 185
             $renderer->setElementTemplate(
186 186
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
187
-                'weighting[' . $i . ']'
187
+                'weighting['.$i.']'
188 188
             );
189 189
 
190
-            $answerNumber = $form->addElement('text', 'counter[' . $i . ']', null, ' value = "' . $i . '"');
190
+            $answerNumber = $form->addElement('text', 'counter['.$i.']', null, ' value = "'.$i.'"');
191 191
             $answerNumber->freeze();
192 192
 
193 193
             $form->addElement('radio', 'correct', null, null, $i, 'class="checkbox"');
194
-            $form->addHtmlEditor('answer[' . $i . ']', null, null, true, $editorConfig);
194
+            $form->addHtmlEditor('answer['.$i.']', null, null, true, $editorConfig);
195 195
 
196
-            $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required');
196
+            $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required');
197 197
 
198 198
             if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) {
199
-                $form->addHtmlEditor('comment[' . $i . ']', null, null, false, $editorConfig);
199
+                $form->addHtmlEditor('comment['.$i.']', null, null, false, $editorConfig);
200 200
                 // Direct feedback
201 201
                 //Adding extra feedback fields
202 202
                 $group = array();
203
-                $group['try' . $i] = $form->createElement('checkbox', 'try' . $i, null, get_lang('TryAgain'));
204
-                $group['lp' . $i] = $form->createElement(
203
+                $group['try'.$i] = $form->createElement('checkbox', 'try'.$i, null, get_lang('TryAgain'));
204
+                $group['lp'.$i] = $form->createElement(
205 205
                     'select',
206
-                    'lp' . $i,
207
-                    get_lang('SeeTheory') . ': ',
206
+                    'lp'.$i,
207
+                    get_lang('SeeTheory').': ',
208 208
                     $selectLpId
209 209
                 );
210
-                $group['destination' . $i] = $form->createElement(
210
+                $group['destination'.$i] = $form->createElement(
211 211
                     'select',
212
-                    'destination' . $i,
213
-                    get_lang('GoToQuestion') . ': ',
212
+                    'destination'.$i,
213
+                    get_lang('GoToQuestion').': ',
214 214
                     $selectQuestion
215 215
                 );
216
-                $group['url' . $i] = $form->createElement(
217
-                    'text', 'url' . $i,
218
-                    get_lang('Other') . ': ',
216
+                $group['url'.$i] = $form->createElement(
217
+                    'text', 'url'.$i,
218
+                    get_lang('Other').': ',
219 219
                     array(
220 220
                         'class' => 'col-md-2',
221 221
                         'placeholder' => get_lang('Other')
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
                     'scenario'
229 229
                 );
230 230
             } else {
231
-                $form->addHtmlEditor('comment[' . $i . ']', null, null, false, $editorConfig);
231
+                $form->addHtmlEditor('comment['.$i.']', null, null, false, $editorConfig);
232 232
             }
233
-            $form->addText('weighting[' . $i . ']', null, null, array('class' => "col-md-1", 'value' => '0'));
233
+            $form->addText('weighting['.$i.']', null, null, array('class' => "col-md-1", 'value' => '0'));
234 234
             $form->addHtml('</tr>');
235 235
         }
236 236
 
@@ -279,19 +279,19 @@  discard block
 block discarded – undo
279 279
         $numberAnswers = $form->getSubmitValue('nb_answers');
280 280
 
281 281
         for ($i = 1; $i <= $numberAnswers; $i++) {
282
-            $answer = trim(str_replace(['<p>', '</p>'], '', $form->getSubmitValue('answer[' . $i . ']')));
283
-            $comment = trim(str_replace(['<p>', '</p>'], '', $form->getSubmitValue('comment[' . $i . ']')));
284
-            $weighting = trim($form->getSubmitValue('weighting[' . $i . ']'));
282
+            $answer = trim(str_replace(['<p>', '</p>'], '', $form->getSubmitValue('answer['.$i.']')));
283
+            $comment = trim(str_replace(['<p>', '</p>'], '', $form->getSubmitValue('comment['.$i.']')));
284
+            $weighting = trim($form->getSubmitValue('weighting['.$i.']'));
285 285
 
286 286
             $scenario = $form->getSubmitValue('scenario');
287 287
 
288 288
             //$listDestination = $form -> getSubmitValue('destination'.$i);
289 289
             //$destinationStr = $form -> getSubmitValue('destination'.$i);
290 290
 
291
-            $try = $scenario['try' . $i];
292
-            $lp = $scenario['lp' . $i];
293
-            $destination = $scenario['destination' . $i];
294
-            $url = trim($scenario['url' . $i]);
291
+            $try = $scenario['try'.$i];
292
+            $lp = $scenario['lp'.$i];
293
+            $destination = $scenario['destination'.$i];
294
+            $url = trim($scenario['url'.$i]);
295 295
 
296 296
             /*
297 297
               How we are going to parse the destination value
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
             }
341 341
 
342 342
             //1@@1;2;@@2;4;4;@@http://www.chamilo.org
343
-            $dest = $try . '@@' . $lp . '@@' . $destination . '@@' . $url;
343
+            $dest = $try.'@@'.$lp.'@@'.$destination.'@@'.$url;
344 344
 
345 345
             $objAnswer->createAnswer($answer, $goodAnswer, $comment, $weighting, $i, null, null, $dest);
346 346
         }
Please login to merge, or discard this patch.
main/exercise/hotspot_answers.as.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@
 block discarded – undo
18 18
 $objExercise = new Exercise(api_get_course_int_id());
19 19
 $objExercise->read($trackExerciseInfo['exe_exo_id']);
20 20
 $em = Database::getManager();
21
-$documentPath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document';
22
-$picturePath = $documentPath . '/images';
21
+$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
22
+$picturePath = $documentPath.'/images';
23 23
 $pictureName = $objQuestion->selectPicture();
24
-$pictureSize = getimagesize($picturePath . '/' . $objQuestion->selectPicture());
24
+$pictureSize = getimagesize($picturePath.'/'.$objQuestion->selectPicture());
25 25
 $pictureWidth = $pictureSize[0];
26 26
 $pictureHeight = $pictureSize[1];
27 27
 $course_id = api_get_course_int_id();
Please login to merge, or discard this patch.
main/lp/scormResource.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
                         }
70 70
                     }
71 71
                     //$keep_href = '';
72
-                    if ($element->hasAttributes()){ //in some cases we get here with an empty attributes array
72
+                    if ($element->hasAttributes()) { //in some cases we get here with an empty attributes array
73 73
                         // TODO: Find when and why we get such a case (empty array).
74 74
                         $attributes = $element->attributes;
75 75
                         foreach ($attributes as $attrib) {
Please login to merge, or discard this patch.
main/lp/blank.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 Display::display_reduced_header();
17 17
 
18 18
 if (isset($_GET['error'])) {
19
-    switch ($_GET['error']){
19
+    switch ($_GET['error']) {
20 20
         case 'document_deleted':
21 21
             echo '<br /><br />';
22 22
             Display::display_error_message(get_lang('DocumentHasBeenDeleted'));
Please login to merge, or discard this patch.
main/lp/lp_ajax_save_item.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         // Set status to completed for hotpotatoes if score > 80%.
164 164
         if ($my_type == 'hotpotatoes') {
165 165
             if ((empty($status) || $status == 'undefined' || $status == 'not attempted') && $max > 0) {
166
-                if (($score/$max) > 0.8) {
166
+                if (($score / $max) > 0.8) {
167 167
                     $myStatus = 'completed';
168 168
                     if ($debug > 1) {
169 169
                         error_log('Calling set_status('.$myStatus.') for hotpotatoes', 0);
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
                         error_log('Done calling set_status for hotpotatoes - now '.$myLPI->get_status(false), 0);
175 175
                     }
176 176
                 }
177
-            } elseif ($status == 'completed' && $max > 0 && ($score/$max) < 0.8) {
177
+            } elseif ($status == 'completed' && $max > 0 && ($score / $max) < 0.8) {
178 178
                 $myStatus = 'failed';
179 179
                 if ($debug > 1) {
180 180
                     error_log('Calling set_status('.$myStatus.') for hotpotatoes', 0);
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
             $myLPI->current_data = $suspend;
368 368
         }
369 369
 
370
-        if (isset($location) && $location != '' && $location!='undefined') {
370
+        if (isset($location) && $location != '' && $location != 'undefined') {
371 371
             $myLPI->set_lesson_location($location);
372 372
         }
373 373
 
Please login to merge, or discard this patch.