@@ -72,6 +72,7 @@ discard block |
||
72 | 72 | /** |
73 | 73 | * Return the XML flow for the possible answers. |
74 | 74 | * |
75 | + * @param string $questionStatment |
|
75 | 76 | */ |
76 | 77 | public function imsExportResponses($questionIdent, $questionStatment) |
77 | 78 | { |
@@ -147,6 +148,7 @@ discard block |
||
147 | 148 | * Export the text with missing words. |
148 | 149 | * |
149 | 150 | * |
151 | + * @param string $questionStatment |
|
150 | 152 | */ |
151 | 153 | public function imsExportResponses($questionIdent, $questionStatment) |
152 | 154 | { |
@@ -204,6 +206,7 @@ discard block |
||
204 | 206 | { |
205 | 207 | /** |
206 | 208 | * Export the question part as a matrix-choice, with only one possible answer per line. |
209 | + * @param string $questionStatment |
|
207 | 210 | */ |
208 | 211 | public function imsExportResponses($questionIdent, $questionStatment) |
209 | 212 | { |
@@ -295,6 +298,7 @@ discard block |
||
295 | 298 | /** |
296 | 299 | * TODO update this to match hot spots instead of copying matching |
297 | 300 | * Export the question part as a matrix-choice, with only one possible answer per line. |
301 | + * @param string $questionStatment |
|
298 | 302 | */ |
299 | 303 | public function imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='') |
300 | 304 | { |
@@ -382,6 +386,7 @@ discard block |
||
382 | 386 | /** |
383 | 387 | * TODO implement |
384 | 388 | * Export the question part as a matrix-choice, with only one possible answer per line. |
389 | + * @param string $questionStatment |
|
385 | 390 | */ |
386 | 391 | public function imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='') |
387 | 392 | { |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | |
56 | 56 | function createAnswersForm($form) |
57 | 57 | { |
58 | - return true; |
|
58 | + return true; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | function processAnswersCreation($form) |
62 | 62 | { |
63 | - return true; |
|
63 | + return true; |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | /** |
@@ -76,21 +76,21 @@ discard block |
||
76 | 76 | public function imsExportResponses($questionIdent, $questionStatment) |
77 | 77 | { |
78 | 78 | // @todo getAnswersList() converts the answers using api_html_entity_decode() |
79 | - $this->answerList = $this->getAnswersList(true); |
|
79 | + $this->answerList = $this->getAnswersList(true); |
|
80 | 80 | $out = ' <choiceInteraction responseIdentifier="' . $questionIdent . '" >' . "\n"; |
81 | 81 | $out .= ' <prompt><![CDATA['.formatExerciseQtiTitle($questionStatment) . ']]></prompt>'. "\n"; |
82 | - if (is_array($this->answerList)) { |
|
83 | - foreach ($this->answerList as $current_answer) { |
|
84 | - $out .= '<simpleChoice identifier="answer_' . $current_answer['id'] . '" fixed="false"> |
|
82 | + if (is_array($this->answerList)) { |
|
83 | + foreach ($this->answerList as $current_answer) { |
|
84 | + $out .= '<simpleChoice identifier="answer_' . $current_answer['id'] . '" fixed="false"> |
|
85 | 85 | <![CDATA['.formatExerciseQtiTitle($current_answer['answer']).']]>'; |
86 | - if (isset($current_answer['comment']) && $current_answer['comment'] != '') { |
|
87 | - $out .= '<feedbackInline identifier="answer_' . $current_answer['id'] . '"> |
|
86 | + if (isset($current_answer['comment']) && $current_answer['comment'] != '') { |
|
87 | + $out .= '<feedbackInline identifier="answer_' . $current_answer['id'] . '"> |
|
88 | 88 | <![CDATA['.formatExerciseQtiTitle($current_answer['comment']).']]> |
89 | 89 | </feedbackInline>'; |
90 | - } |
|
91 | - $out .= '</simpleChoice>'. "\n"; |
|
92 | - } |
|
93 | - } |
|
90 | + } |
|
91 | + $out .= '</simpleChoice>'. "\n"; |
|
92 | + } |
|
93 | + } |
|
94 | 94 | $out .= ' </choiceInteraction>'. "\n"; |
95 | 95 | |
96 | 96 | return $out; |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function imsExportResponsesDeclaration($questionIdent) |
104 | 104 | { |
105 | - $this->answerList = $this->getAnswersList(true); |
|
106 | - $type = $this->getQuestionType(); |
|
105 | + $this->answerList = $this->getAnswersList(true); |
|
106 | + $type = $this->getQuestionType(); |
|
107 | 107 | if ($type == MCMA) $cardinality = 'multiple'; else $cardinality = 'single'; |
108 | 108 | |
109 | 109 | $out = ' <responseDeclaration identifier="' . $questionIdent . '" cardinality="' . $cardinality . '" baseType="identifier">' . "\n"; |
@@ -111,25 +111,25 @@ discard block |
||
111 | 111 | // Match the correct answers. |
112 | 112 | |
113 | 113 | $out .= ' <correctResponse>'. "\n"; |
114 | - if (is_array($this->answerList)) { |
|
115 | - foreach($this->answerList as $current_answer) { |
|
116 | - if ($current_answer['correct']) { |
|
117 | - $out .= ' <value>answer_'. $current_answer['id'] .'</value>'. "\n"; |
|
118 | - } |
|
119 | - } |
|
120 | - } |
|
114 | + if (is_array($this->answerList)) { |
|
115 | + foreach($this->answerList as $current_answer) { |
|
116 | + if ($current_answer['correct']) { |
|
117 | + $out .= ' <value>answer_'. $current_answer['id'] .'</value>'. "\n"; |
|
118 | + } |
|
119 | + } |
|
120 | + } |
|
121 | 121 | $out .= ' </correctResponse>'. "\n"; |
122 | 122 | |
123 | 123 | //Add the grading |
124 | 124 | |
125 | 125 | $out .= ' <mapping>'. "\n"; |
126 | - if (is_array($this->answerList)) { |
|
127 | - foreach($this->answerList as $current_answer) { |
|
128 | - if (isset($current_answer['grade'])) { |
|
129 | - $out .= ' <mapEntry mapKey="answer_'. $current_answer['id'] .'" mappedValue="'.$current_answer['grade'].'" />'. "\n"; |
|
130 | - } |
|
131 | - } |
|
132 | - } |
|
126 | + if (is_array($this->answerList)) { |
|
127 | + foreach($this->answerList as $current_answer) { |
|
128 | + if (isset($current_answer['grade'])) { |
|
129 | + $out .= ' <mapEntry mapKey="answer_'. $current_answer['id'] .'" mappedValue="'.$current_answer['grade'].'" />'. "\n"; |
|
130 | + } |
|
131 | + } |
|
132 | + } |
|
133 | 133 | $out .= ' </mapping>'. "\n"; |
134 | 134 | $out .= ' </responseDeclaration>'. "\n"; |
135 | 135 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function imsExportResponses($questionIdent, $questionStatment) |
152 | 152 | { |
153 | - $this->answerList = $this->getAnswersList(true); |
|
153 | + $this->answerList = $this->getAnswersList(true); |
|
154 | 154 | $text = ''; |
155 | 155 | $text .= $this->answerText; |
156 | 156 | if (is_array($this->answerList)) { |
@@ -171,28 +171,28 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function imsExportResponsesDeclaration($questionIdent) |
173 | 173 | { |
174 | - $this->answerList = $this->getAnswersList(true); |
|
175 | - $this->gradeList = $this->getGradesList(); |
|
174 | + $this->answerList = $this->getAnswersList(true); |
|
175 | + $this->gradeList = $this->getGradesList(); |
|
176 | 176 | $out = ''; |
177 | - if (is_array($this->answerList)) { |
|
178 | - foreach ($this->answerList as $answer) { |
|
179 | - $answerKey = $answer['id']; |
|
180 | - $answer = $answer['answer']; |
|
181 | - $out .= ' <responseDeclaration identifier="fill_' . $answerKey . '" cardinality="single" baseType="identifier">' . "\n"; |
|
182 | - $out .= ' <correctResponse>'. "\n"; |
|
177 | + if (is_array($this->answerList)) { |
|
178 | + foreach ($this->answerList as $answer) { |
|
179 | + $answerKey = $answer['id']; |
|
180 | + $answer = $answer['answer']; |
|
181 | + $out .= ' <responseDeclaration identifier="fill_' . $answerKey . '" cardinality="single" baseType="identifier">' . "\n"; |
|
182 | + $out .= ' <correctResponse>'. "\n"; |
|
183 | 183 | $out .= ' <value><![CDATA['.formatExerciseQtiTitle($answer).']]></value>'. "\n"; |
184 | - $out .= ' </correctResponse>'. "\n"; |
|
185 | - if (isset($this->gradeList[$answerKey])) { |
|
186 | - $out .= ' <mapping>'. "\n"; |
|
187 | - $out .= ' <mapEntry mapKey="'.$answer.'" mappedValue="'.$this->gradeList[$answerKey].'"/>'. "\n"; |
|
188 | - $out .= ' </mapping>'. "\n"; |
|
189 | - } |
|
190 | - |
|
191 | - $out .= ' </responseDeclaration>'. "\n"; |
|
192 | - } |
|
193 | - } |
|
194 | - |
|
195 | - return $out; |
|
184 | + $out .= ' </correctResponse>'. "\n"; |
|
185 | + if (isset($this->gradeList[$answerKey])) { |
|
186 | + $out .= ' <mapping>'. "\n"; |
|
187 | + $out .= ' <mapEntry mapKey="'.$answer.'" mappedValue="'.$this->gradeList[$answerKey].'"/>'. "\n"; |
|
188 | + $out .= ' </mapping>'. "\n"; |
|
189 | + } |
|
190 | + |
|
191 | + $out .= ' </responseDeclaration>'. "\n"; |
|
192 | + } |
|
193 | + } |
|
194 | + |
|
195 | + return $out; |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public function imsExportResponses($questionIdent, $questionStatment) |
209 | 209 | { |
210 | - $this->answerList = $this->getAnswersList(true); |
|
211 | - $maxAssociation = max(count($this->leftList), count($this->rightList)); |
|
210 | + $this->answerList = $this->getAnswersList(true); |
|
211 | + $maxAssociation = max(count($this->leftList), count($this->rightList)); |
|
212 | 212 | |
213 | 213 | $out = ""; |
214 | 214 | |
@@ -218,14 +218,14 @@ discard block |
||
218 | 218 | //add left column |
219 | 219 | |
220 | 220 | $out .= ' <simpleMatchSet>'. "\n"; |
221 | - if (is_array($this->leftList)) { |
|
222 | - foreach ($this->leftList as $leftKey=>$leftElement) { |
|
223 | - $out .= ' |
|
221 | + if (is_array($this->leftList)) { |
|
222 | + foreach ($this->leftList as $leftKey=>$leftElement) { |
|
223 | + $out .= ' |
|
224 | 224 | <simpleAssociableChoice identifier="left_'.$leftKey.'" > |
225 | 225 | <![CDATA['.formatExerciseQtiTitle($leftElement['answer']).']]> |
226 | 226 | </simpleAssociableChoice>'. "\n"; |
227 | - } |
|
228 | - } |
|
227 | + } |
|
228 | + } |
|
229 | 229 | |
230 | 230 | $out .= ' </simpleMatchSet>'. "\n"; |
231 | 231 | |
@@ -235,14 +235,14 @@ discard block |
||
235 | 235 | |
236 | 236 | $i = 0; |
237 | 237 | |
238 | - if (is_array($this->rightList)) { |
|
239 | - foreach($this->rightList as $rightKey=>$rightElement) { |
|
240 | - $out .= '<simpleAssociableChoice identifier="right_'.$i.'" > |
|
238 | + if (is_array($this->rightList)) { |
|
239 | + foreach($this->rightList as $rightKey=>$rightElement) { |
|
240 | + $out .= '<simpleAssociableChoice identifier="right_'.$i.'" > |
|
241 | 241 | <![CDATA['.formatExerciseQtiTitle($rightElement['answer']).']]> |
242 | 242 | </simpleAssociableChoice>'. "\n"; |
243 | - $i++; |
|
244 | - } |
|
245 | - } |
|
243 | + $i++; |
|
244 | + } |
|
245 | + } |
|
246 | 246 | $out .= ' </simpleMatchSet>'. "\n"; |
247 | 247 | $out .= '</matchInteraction>'. "\n"; |
248 | 248 | |
@@ -254,30 +254,30 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function imsExportResponsesDeclaration($questionIdent) |
256 | 256 | { |
257 | - $this->answerList = $this->getAnswersList(true); |
|
257 | + $this->answerList = $this->getAnswersList(true); |
|
258 | 258 | $out = ' <responseDeclaration identifier="' . $questionIdent . '" cardinality="single" baseType="identifier">' . "\n"; |
259 | 259 | $out .= ' <correctResponse>' . "\n"; |
260 | 260 | |
261 | 261 | $gradeArray = array(); |
262 | - if (is_array($this->leftList)) { |
|
263 | - foreach ($this->leftList as $leftKey=>$leftElement) { |
|
264 | - $i=0; |
|
265 | - foreach ($this->rightList as $rightKey=>$rightElement) { |
|
266 | - if (($leftElement['match'] == $rightElement['code'])) { |
|
267 | - $out .= ' <value>left_' . $leftKey . ' right_'.$i.'</value>'. "\n"; |
|
268 | - |
|
269 | - $gradeArray['left_' . $leftKey . ' right_'.$i] = $leftElement['grade']; |
|
270 | - } |
|
271 | - $i++; |
|
272 | - } |
|
273 | - } |
|
274 | - } |
|
262 | + if (is_array($this->leftList)) { |
|
263 | + foreach ($this->leftList as $leftKey=>$leftElement) { |
|
264 | + $i=0; |
|
265 | + foreach ($this->rightList as $rightKey=>$rightElement) { |
|
266 | + if (($leftElement['match'] == $rightElement['code'])) { |
|
267 | + $out .= ' <value>left_' . $leftKey . ' right_'.$i.'</value>'. "\n"; |
|
268 | + |
|
269 | + $gradeArray['left_' . $leftKey . ' right_'.$i] = $leftElement['grade']; |
|
270 | + } |
|
271 | + $i++; |
|
272 | + } |
|
273 | + } |
|
274 | + } |
|
275 | 275 | $out .= ' </correctResponse>'. "\n"; |
276 | 276 | $out .= ' <mapping>' . "\n"; |
277 | 277 | if (is_array($gradeArray)) { |
278 | - foreach ($gradeArray as $gradeKey=>$grade) { |
|
279 | - $out .= ' <mapEntry mapKey="'.$gradeKey.'" mappedValue="'.$grade.'"/>' . "\n"; |
|
280 | - } |
|
278 | + foreach ($gradeArray as $gradeKey=>$grade) { |
|
279 | + $out .= ' <mapEntry mapKey="'.$gradeKey.'" mappedValue="'.$grade.'"/>' . "\n"; |
|
280 | + } |
|
281 | 281 | } |
282 | 282 | $out .= ' </mapping>' . "\n"; |
283 | 283 | $out .= ' </responseDeclaration>'. "\n"; |
@@ -298,49 +298,49 @@ discard block |
||
298 | 298 | */ |
299 | 299 | public function imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='') |
300 | 300 | { |
301 | - $this->answerList = $this->getAnswersList(true); |
|
302 | - $questionMedia = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/images/'.$questionMedia; |
|
303 | - $mimetype = mime_content_type($questionMedia); |
|
304 | - if(empty($mimetype)){ |
|
305 | - $mimetype = 'image/jpeg'; |
|
306 | - } |
|
307 | - |
|
308 | - $text = ' <p>'.$questionStatment.'</p>'."\n"; |
|
309 | - $text .= ' <graphicOrderInteraction responseIdentifier="hotspot_'.$questionIdent.'">'."\n"; |
|
310 | - $text .= ' <prompt>'.$questionDesc.'</prompt>'."\n"; |
|
311 | - $text .= ' <object type="'.$mimetype.'" width="250" height="230" data="'.$questionMedia.'">-</object>'."\n"; |
|
301 | + $this->answerList = $this->getAnswersList(true); |
|
302 | + $questionMedia = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/images/'.$questionMedia; |
|
303 | + $mimetype = mime_content_type($questionMedia); |
|
304 | + if(empty($mimetype)){ |
|
305 | + $mimetype = 'image/jpeg'; |
|
306 | + } |
|
307 | + |
|
308 | + $text = ' <p>'.$questionStatment.'</p>'."\n"; |
|
309 | + $text .= ' <graphicOrderInteraction responseIdentifier="hotspot_'.$questionIdent.'">'."\n"; |
|
310 | + $text .= ' <prompt>'.$questionDesc.'</prompt>'."\n"; |
|
311 | + $text .= ' <object type="'.$mimetype.'" width="250" height="230" data="'.$questionMedia.'">-</object>'."\n"; |
|
312 | 312 | if (is_array($this->answerList)) { |
313 | - foreach ($this->answerList as $key=>$answer) { |
|
314 | - $key = $answer['id']; |
|
315 | - $answerTxt = $answer['answer']; |
|
316 | - $len = api_strlen($answerTxt); |
|
317 | - //coords are transformed according to QTIv2 rules here: http://www.imsproject.org/question/qtiv2p1pd/imsqti_infov2p1pd.html#element10663 |
|
318 | - $coords = ''; |
|
319 | - $type = 'default'; |
|
320 | - switch($answer['hotspot_type']){ |
|
321 | - case 'square': |
|
322 | - $type = 'rect'; |
|
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]); |
|
326 | - break; |
|
327 | - case 'circle': |
|
328 | - $type = 'circle'; |
|
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]))); |
|
332 | - break; |
|
333 | - case 'poly': |
|
334 | - $type = 'poly'; |
|
335 | - $coords = str_replace(array(';','|'),array(',',','),$answer['hotspot_coord']); |
|
336 | - break; |
|
337 | - case 'delineation' : |
|
338 | - $type = 'delineation'; |
|
339 | - $coords = str_replace(array(';','|'),array(',',','),$answer['hotspot_coord']); |
|
340 | - break; |
|
341 | - } |
|
342 | - $text .= ' <hotspotChoice shape="'.$type.'" coords="'.$coords.'" identifier="'.$key.'"/>'."\n"; |
|
343 | - } |
|
313 | + foreach ($this->answerList as $key=>$answer) { |
|
314 | + $key = $answer['id']; |
|
315 | + $answerTxt = $answer['answer']; |
|
316 | + $len = api_strlen($answerTxt); |
|
317 | + //coords are transformed according to QTIv2 rules here: http://www.imsproject.org/question/qtiv2p1pd/imsqti_infov2p1pd.html#element10663 |
|
318 | + $coords = ''; |
|
319 | + $type = 'default'; |
|
320 | + switch($answer['hotspot_type']){ |
|
321 | + case 'square': |
|
322 | + $type = 'rect'; |
|
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]); |
|
326 | + break; |
|
327 | + case 'circle': |
|
328 | + $type = 'circle'; |
|
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]))); |
|
332 | + break; |
|
333 | + case 'poly': |
|
334 | + $type = 'poly'; |
|
335 | + $coords = str_replace(array(';','|'),array(',',','),$answer['hotspot_coord']); |
|
336 | + break; |
|
337 | + case 'delineation' : |
|
338 | + $type = 'delineation'; |
|
339 | + $coords = str_replace(array(';','|'),array(',',','),$answer['hotspot_coord']); |
|
340 | + break; |
|
341 | + } |
|
342 | + $text .= ' <hotspotChoice shape="'.$type.'" coords="'.$coords.'" identifier="'.$key.'"/>'."\n"; |
|
343 | + } |
|
344 | 344 | } |
345 | 345 | $text .= ' </graphicOrderInteraction>'."\n"; |
346 | 346 | $out = $text; |
@@ -353,23 +353,23 @@ discard block |
||
353 | 353 | */ |
354 | 354 | public function imsExportResponsesDeclaration($questionIdent) |
355 | 355 | { |
356 | - $this->answerList = $this->getAnswersList(true); |
|
357 | - $this->gradeList = $this->getGradesList(); |
|
356 | + $this->answerList = $this->getAnswersList(true); |
|
357 | + $this->gradeList = $this->getGradesList(); |
|
358 | 358 | $out = ''; |
359 | 359 | $out .= ' <responseDeclaration identifier="hotspot_'.$questionIdent.'" cardinality="ordered" baseType="identifier">' . "\n"; |
360 | 360 | $out .= ' <correctResponse>'. "\n"; |
361 | 361 | |
362 | - if (is_array($this->answerList)) { |
|
363 | - foreach ($this->answerList as $answerKey=>$answer) { |
|
364 | - $answerKey = $answer['id']; |
|
365 | - $answer = $answer['answer']; |
|
366 | - $out .= '<value><![CDATA['.formatExerciseQtiTitle($answerKey).']]></value>'; |
|
367 | - } |
|
368 | - } |
|
362 | + if (is_array($this->answerList)) { |
|
363 | + foreach ($this->answerList as $answerKey=>$answer) { |
|
364 | + $answerKey = $answer['id']; |
|
365 | + $answer = $answer['answer']; |
|
366 | + $out .= '<value><![CDATA['.formatExerciseQtiTitle($answerKey).']]></value>'; |
|
367 | + } |
|
368 | + } |
|
369 | 369 | $out .= ' </correctResponse>'. "\n"; |
370 | 370 | $out .= ' </responseDeclaration>'. "\n"; |
371 | 371 | |
372 | - return $out; |
|
372 | + return $out; |
|
373 | 373 | } |
374 | 374 | } |
375 | 375 | |
@@ -384,14 +384,14 @@ discard block |
||
384 | 384 | * Export the question part as a matrix-choice, with only one possible answer per line. |
385 | 385 | */ |
386 | 386 | public function imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='') |
387 | - { |
|
388 | - return ''; |
|
389 | - } |
|
387 | + { |
|
388 | + return ''; |
|
389 | + } |
|
390 | 390 | /** |
391 | 391 | * |
392 | 392 | */ |
393 | 393 | public function imsExportResponsesDeclaration($questionIdent) |
394 | 394 | { |
395 | - return ''; |
|
395 | + return ''; |
|
396 | 396 | } |
397 | 397 | } |
@@ -14,7 +14,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -104,7 +104,11 @@ |
||
104 | 104 | { |
105 | 105 | $this->answerList = $this->getAnswersList(true); |
106 | 106 | $type = $this->getQuestionType(); |
107 | - if ($type == MCMA) $cardinality = 'multiple'; else $cardinality = 'single'; |
|
107 | + if ($type == MCMA) { |
|
108 | + $cardinality = 'multiple'; |
|
109 | + } else { |
|
110 | + $cardinality = 'single'; |
|
111 | + } |
|
108 | 112 | |
109 | 113 | $out = ' <responseDeclaration identifier="' . $questionIdent . '" cardinality="' . $cardinality . '" baseType="identifier">' . "\n"; |
110 | 114 |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * @param reference Reference to the array to search |
260 | 260 | * @param string Node we are looking for in the array |
261 | 261 | * @param string $node |
262 | - * @return mixed Node name or false if not found |
|
262 | + * @return false|string Node name or false if not found |
|
263 | 263 | */ |
264 | 264 | function myarraysearch(&$array, $node) |
265 | 265 | { |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * Searches an image name into an array. |
281 | 281 | * @param reference Reference to an array to search |
282 | 282 | * @param string String to look for |
283 | - * @return mixed String given if found, false otherwise |
|
283 | + * @return false|string String given if found, false otherwise |
|
284 | 284 | * @uses myarraysearch This function is just an additional layer on the myarraysearch() function |
285 | 285 | */ |
286 | 286 | function CheckImageName(&$imgparams, $string) |
@@ -344,7 +344,7 @@ |
||
344 | 344 | if (is_dir($full_name)) { |
345 | 345 | $filelist[] = $file; |
346 | 346 | } |
347 | - } |
|
347 | + } |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | } |
@@ -66,7 +66,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -1143,10 +1143,11 @@ |
||
1143 | 1143 | $result_last_attempt = Database::query($sql); |
1144 | 1144 | if (Database :: num_rows($result_last_attempt) > 0) { |
1145 | 1145 | $id_last_attempt = Database :: result($result_last_attempt, 0, 0); |
1146 | - if ($count_attempts > 0) |
|
1147 | - echo '<a href="../exercise/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin)?'tracking':$origin).'"> |
|
1146 | + if ($count_attempts > 0) { |
|
1147 | + echo '<a href="../exercise/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin)?'tracking':$origin).'"> |
|
1148 | 1148 | '.Display::return_icon('quiz.gif').' |
1149 | 1149 | </a>'; |
1150 | + } |
|
1150 | 1151 | } |
1151 | 1152 | echo '</td>'; |
1152 | 1153 |
@@ -67,52 +67,52 @@ discard block |
||
67 | 67 | if (isset($_GET['details'])) { |
68 | 68 | if ($origin === 'user_course') { |
69 | 69 | if (empty ($cidReq)) { |
70 | - $interbreadcrumb[] = array ( |
|
71 | - "url" => api_get_path(WEB_COURSE_PATH) . $courseInfo['directory'], |
|
70 | + $interbreadcrumb[] = array( |
|
71 | + "url" => api_get_path(WEB_COURSE_PATH).$courseInfo['directory'], |
|
72 | 72 | 'name' => $courseInfo['title'] |
73 | 73 | ); |
74 | 74 | } |
75 | - $interbreadcrumb[] = array ( |
|
76 | - "url" => "../user/user.php?cidReq=" . $course_code, |
|
75 | + $interbreadcrumb[] = array( |
|
76 | + "url" => "../user/user.php?cidReq=".$course_code, |
|
77 | 77 | "name" => get_lang("Users") |
78 | 78 | ); |
79 | 79 | } else |
80 | 80 | if ($origin === 'tracking_course') { |
81 | - $interbreadcrumb[] = array ( |
|
82 | - "url" => "../tracking/courseLog.php?cidReq=".$course_code.'&id_session=' . api_get_session_id(), |
|
81 | + $interbreadcrumb[] = array( |
|
82 | + "url" => "../tracking/courseLog.php?cidReq=".$course_code.'&id_session='.api_get_session_id(), |
|
83 | 83 | "name" => get_lang("Tracking") |
84 | 84 | ); |
85 | 85 | } else |
86 | 86 | if ($origin === 'resume_session') { |
87 | - $interbreadcrumb[] = array ( |
|
87 | + $interbreadcrumb[] = array( |
|
88 | 88 | 'url' => "../session/session_list.php", |
89 | 89 | "name" => get_lang('SessionList') |
90 | 90 | ); |
91 | - $interbreadcrumb[] = array ( |
|
92 | - 'url' => "../session/resume_session.php?id_session=" . $sessionId, |
|
91 | + $interbreadcrumb[] = array( |
|
92 | + 'url' => "../session/resume_session.php?id_session=".$sessionId, |
|
93 | 93 | "name" => get_lang('SessionOverview') |
94 | 94 | ); |
95 | 95 | } else { |
96 | - $interbreadcrumb[] = array ( |
|
97 | - "url" => api_is_student_boss()?"#":"index.php", |
|
96 | + $interbreadcrumb[] = array( |
|
97 | + "url" => api_is_student_boss() ? "#" : "index.php", |
|
98 | 98 | "name" => get_lang('MySpace') |
99 | 99 | ); |
100 | 100 | if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) { |
101 | - $interbreadcrumb[] = array ( |
|
102 | - "url" => "student.php?id_coach=" . Security :: remove_XSS($_GET['id_coach']), |
|
101 | + $interbreadcrumb[] = array( |
|
102 | + "url" => "student.php?id_coach=".Security :: remove_XSS($_GET['id_coach']), |
|
103 | 103 | "name" => get_lang("CoachStudents") |
104 | 104 | ); |
105 | - $interbreadcrumb[] = array ( |
|
106 | - "url" => "myStudents.php?student=" . $student_id. '&id_coach=' . Security :: remove_XSS($_GET['id_coach']), |
|
105 | + $interbreadcrumb[] = array( |
|
106 | + "url" => "myStudents.php?student=".$student_id.'&id_coach='.Security :: remove_XSS($_GET['id_coach']), |
|
107 | 107 | "name" => get_lang("StudentDetails") |
108 | 108 | ); |
109 | 109 | } else { |
110 | - $interbreadcrumb[] = array ( |
|
110 | + $interbreadcrumb[] = array( |
|
111 | 111 | "url" => "student.php", |
112 | 112 | "name" => get_lang("MyStudents") |
113 | 113 | ); |
114 | - $interbreadcrumb[] = array ( |
|
115 | - "url" => "myStudents.php?student=" . $student_id, |
|
114 | + $interbreadcrumb[] = array( |
|
115 | + "url" => "myStudents.php?student=".$student_id, |
|
116 | 116 | "name" => get_lang("StudentDetails") |
117 | 117 | ); |
118 | 118 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $nameTools = get_lang("DetailsStudentInCourse"); |
121 | 121 | } else { |
122 | 122 | if ($origin == 'resume_session') { |
123 | - $interbreadcrumb[] = array ( |
|
123 | + $interbreadcrumb[] = array( |
|
124 | 124 | 'url' => "../session/session_list.php", |
125 | 125 | "name" => get_lang('SessionList') |
126 | 126 | ); |
@@ -131,24 +131,24 @@ discard block |
||
131 | 131 | ); |
132 | 132 | } |
133 | 133 | } else { |
134 | - $interbreadcrumb[] = array ( |
|
135 | - "url" => api_is_student_boss()?"#":"index.php", |
|
134 | + $interbreadcrumb[] = array( |
|
135 | + "url" => api_is_student_boss() ? "#" : "index.php", |
|
136 | 136 | "name" => get_lang('MySpace') |
137 | 137 | ); |
138 | 138 | if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) { |
139 | 139 | if ($sessionId) { |
140 | - $interbreadcrumb[] = array ( |
|
141 | - "url" => "student.php?id_coach=" . Security :: remove_XSS($_GET['id_coach']) . "&id_session=" . $sessionId, |
|
140 | + $interbreadcrumb[] = array( |
|
141 | + "url" => "student.php?id_coach=".Security :: remove_XSS($_GET['id_coach'])."&id_session=".$sessionId, |
|
142 | 142 | "name" => get_lang("CoachStudents") |
143 | 143 | ); |
144 | 144 | } else { |
145 | - $interbreadcrumb[] = array ( |
|
146 | - "url" => "student.php?id_coach=" . Security :: remove_XSS($_GET['id_coach']), |
|
145 | + $interbreadcrumb[] = array( |
|
146 | + "url" => "student.php?id_coach=".Security :: remove_XSS($_GET['id_coach']), |
|
147 | 147 | "name" => get_lang("CoachStudents") |
148 | 148 | ); |
149 | 149 | } |
150 | 150 | } else { |
151 | - $interbreadcrumb[] = array ( |
|
151 | + $interbreadcrumb[] = array( |
|
152 | 152 | "url" => "student.php", |
153 | 153 | "name" => get_lang("MyStudents") |
154 | 154 | ); |
@@ -330,28 +330,28 @@ discard block |
||
330 | 330 | // Actions bar |
331 | 331 | echo '<div class="actions">'; |
332 | 332 | echo '<a href="javascript: window.history.go(-1);">'. |
333 | - Display::return_icon('back.png', get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
333 | + Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
334 | 334 | |
335 | 335 | echo '<a href="javascript: void(0);" onclick="javascript: window.print();">'. |
336 | - Display::return_icon('printer.png', get_lang('Print'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
336 | + Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
337 | 337 | |
338 | - echo '<a href="' . api_get_self() . '?' . Security :: remove_XSS($_SERVER['QUERY_STRING']) . '&export=csv">'. |
|
339 | - Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a> '; |
|
338 | + echo '<a href="'.api_get_self().'?'.Security :: remove_XSS($_SERVER['QUERY_STRING']).'&export=csv">'. |
|
339 | + Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a> '; |
|
340 | 340 | |
341 | - echo '<a href="' . api_get_self() . '?' . Security :: remove_XSS($_SERVER['QUERY_STRING']) . '&export=xls">'. |
|
342 | - Display::return_icon('export_excel.png', get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).'</a> '; |
|
341 | + echo '<a href="'.api_get_self().'?'.Security :: remove_XSS($_SERVER['QUERY_STRING']).'&export=xls">'. |
|
342 | + Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a> '; |
|
343 | 343 | |
344 | 344 | if (!empty ($user_info['email'])) { |
345 | 345 | $send_mail = '<a href="mailto:'.$user_info['email'].'">'. |
346 | - Display :: return_icon('mail_send.png', get_lang('SendMail'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
346 | + Display :: return_icon('mail_send.png', get_lang('SendMail'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
347 | 347 | } else { |
348 | - $send_mail = Display :: return_icon('mail_send_na.png', get_lang('SendMail'),'',ICON_SIZE_MEDIUM); |
|
348 | + $send_mail = Display :: return_icon('mail_send_na.png', get_lang('SendMail'), '', ICON_SIZE_MEDIUM); |
|
349 | 349 | } |
350 | 350 | echo $send_mail; |
351 | 351 | if (!empty($student_id) && !empty($course_code)) { |
352 | 352 | // Only show link to connection details if course and student were defined in the URL |
353 | - echo '<a href="access_details.php?student=' . $student_id . '&course=' . $course_code . '&origin=' . $origin. '&cidReq='.$course_code.'&id_session='.$sessionId.'">'. |
|
354 | - Display :: return_icon('statistics.png', get_lang('AccessDetails'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
353 | + echo '<a href="access_details.php?student='.$student_id.'&course='.$course_code.'&origin='.$origin.'&cidReq='.$course_code.'&id_session='.$sessionId.'">'. |
|
354 | + Display :: return_icon('statistics.png', get_lang('AccessDetails'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
355 | 355 | } |
356 | 356 | if (api_can_login_as($student_id)) { |
357 | 357 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_list.php?action=login_as&user_id='.$student_id.'&sec_token='.$token.'">'. |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | |
361 | 361 | echo Display::url( |
362 | 362 | Display::return_icon('skill-badges.png', get_lang('AssignSkill'), null, ICON_SIZE_MEDIUM), |
363 | - api_get_path(WEB_CODE_PATH) . 'badge/assign.php?' . http_build_query(['user' => $student_id]) |
|
363 | + api_get_path(WEB_CODE_PATH).'badge/assign.php?'.http_build_query(['user' => $student_id]) |
|
364 | 364 | ); |
365 | 365 | |
366 | 366 | |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | $csv_content[] = array( |
422 | 422 | get_lang('Information', '') |
423 | 423 | ); |
424 | - $csv_content[] = array ( |
|
424 | + $csv_content[] = array( |
|
425 | 425 | get_lang('Name', ''), |
426 | 426 | get_lang('Email', ''), |
427 | 427 | get_lang('Tel', '') |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | strip_tags($first_connection_date), |
450 | 450 | strip_tags($last_connection_date), |
451 | 451 | $time_spent_on_the_course, |
452 | - $avg_student_progress . '%', |
|
452 | + $avg_student_progress.'%', |
|
453 | 453 | $avg_student_score |
454 | 454 | ); |
455 | 455 | |
@@ -479,19 +479,19 @@ discard block |
||
479 | 479 | </thead> |
480 | 480 | <tbody> |
481 | 481 | <tr> |
482 | - <td><?php echo get_lang('Name') . ' : '.$user_info['complete_name']; ?></td> |
|
482 | + <td><?php echo get_lang('Name').' : '.$user_info['complete_name']; ?></td> |
|
483 | 483 | </tr> |
484 | 484 | <tr> |
485 | - <td><?php echo get_lang('Email') . ' : '; |
|
485 | + <td><?php echo get_lang('Email').' : '; |
|
486 | 486 | if (!empty ($user_info['email'])) { |
487 | - echo '<a href="mailto:' . $user_info['email'] . '">' . $user_info['email'] . '</a>'; |
|
487 | + echo '<a href="mailto:'.$user_info['email'].'">'.$user_info['email'].'</a>'; |
|
488 | 488 | } else { |
489 | 489 | echo get_lang('NoEmail'); |
490 | 490 | } ?> |
491 | 491 | </td> |
492 | 492 | </tr> |
493 | 493 | <tr> |
494 | - <td> <?php echo get_lang('Tel') . ' : '; |
|
494 | + <td> <?php echo get_lang('Tel').' : '; |
|
495 | 495 | if (!empty ($user_info['phone'])) { |
496 | 496 | echo $user_info['phone']; |
497 | 497 | } else { |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | </td> |
502 | 502 | </tr> |
503 | 503 | <tr> |
504 | - <td> <?php echo get_lang('OfficialCode') . ' : '; |
|
504 | + <td> <?php echo get_lang('OfficialCode').' : '; |
|
505 | 505 | if (!empty ($user_info['official_code'])) { |
506 | 506 | echo $user_info['official_code']; |
507 | 507 | } else { |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | </td> |
512 | 512 | </tr> |
513 | 513 | <tr> |
514 | - <td><?php echo get_lang('OnLine') . ' : '.$online; ?> </td> |
|
514 | + <td><?php echo get_lang('OnLine').' : '.$online; ?> </td> |
|
515 | 515 | </tr> |
516 | 516 | <?php |
517 | 517 | |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | if ($timezone !== null) { |
526 | 526 | ?> |
527 | 527 | <tr> |
528 | - <td> <?php echo get_lang('Timezone') . ' : '.$timezone; ?> </td> |
|
528 | + <td> <?php echo get_lang('Timezone').' : '.$timezone; ?> </td> |
|
529 | 529 | </tr> |
530 | 530 | <?php |
531 | 531 | } |
@@ -672,9 +672,9 @@ discard block |
||
672 | 672 | } |
673 | 673 | |
674 | 674 | if (!empty($access_start_date) && !empty($access_end_date)) { |
675 | - $date_session = get_lang('From') . ' ' . $access_start_date . ' ' . get_lang('Until') . ' ' . $access_end_date; |
|
675 | + $date_session = get_lang('From').' '.$access_start_date.' '.get_lang('Until').' '.$access_end_date; |
|
676 | 676 | } |
677 | - $title = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.($date_session?' ('.$date_session.')':''); |
|
677 | + $title = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.($date_session ? ' ('.$date_session.')' : ''); |
|
678 | 678 | } |
679 | 679 | |
680 | 680 | // Courses |
@@ -729,16 +729,16 @@ discard block |
||
729 | 729 | $scoretotal = array(); |
730 | 730 | if (isset($cats) && isset($cats[0])) { |
731 | 731 | if (!empty($sId)) { |
732 | - $scoretotal= $cats[0]->calc_score($student_id, null, $courseCodeItem, $sId); |
|
732 | + $scoretotal = $cats[0]->calc_score($student_id, null, $courseCodeItem, $sId); |
|
733 | 733 | } else { |
734 | - $scoretotal= $cats[0]->calc_score($student_id, null, $courseCodeItem); |
|
734 | + $scoretotal = $cats[0]->calc_score($student_id, null, $courseCodeItem); |
|
735 | 735 | } |
736 | 736 | } |
737 | 737 | |
738 | 738 | $scoretotal_display = '0/0 (0%)'; |
739 | 739 | if (!empty($scoretotal)) { |
740 | 740 | $scoretotal_display = |
741 | - round($scoretotal[0], 1 ).'/'. |
|
741 | + round($scoretotal[0], 1).'/'. |
|
742 | 742 | round($scoretotal[1], 1). |
743 | 743 | ' ('.round(($scoretotal[0] / $scoretotal[1]) * 100, 2).' %)'; |
744 | 744 | } |
@@ -759,9 +759,9 @@ discard block |
||
759 | 759 | ); |
760 | 760 | |
761 | 761 | echo '<tr> |
762 | - <td ><a href="' .$courseInfoItem['course_public_url'] .'?id_session=' . $sId . '">'. |
|
762 | + <td ><a href="' .$courseInfoItem['course_public_url'].'?id_session='.$sId.'">'. |
|
763 | 763 | $courseInfoItem['title'].'</a></td> |
764 | - <td >'.$time_spent_on_course .'</td> |
|
764 | + <td >'.$time_spent_on_course.'</td> |
|
765 | 765 | <td >'.$progress.'</td> |
766 | 766 | <td >'.$score.'</td> |
767 | 767 | <td >'.$attendances_faults_avg.'</td> |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | <table class="table table-striped table-hover"> |
830 | 830 | <thead> |
831 | 831 | <tr> |
832 | - <th><?php echo get_lang('LearningPath');?></th> |
|
832 | + <th><?php echo get_lang('LearningPath'); ?></th> |
|
833 | 833 | <th> |
834 | 834 | <?php |
835 | 835 | echo get_lang('Time').' '; |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | if (!empty($start_time)) { |
932 | 932 | $start_time = api_convert_and_format_date($start_time, DATE_TIME_FORMAT_LONG); |
933 | 933 | } else { |
934 | - $start_time = '-'; |
|
934 | + $start_time = '-'; |
|
935 | 935 | } |
936 | 936 | |
937 | 937 | if (!empty($total_time)) { |
@@ -968,8 +968,8 @@ discard block |
||
968 | 968 | $csv_content[] = array( |
969 | 969 | api_html_entity_decode(stripslashes($lp_name), ENT_QUOTES, $charset), |
970 | 970 | api_time_to_hms($total_time), |
971 | - $score . '%', |
|
972 | - $score_latest . '%', |
|
971 | + $score.'%', |
|
972 | + $score_latest.'%', |
|
973 | 973 | $progress.'%', |
974 | 974 | $start_time |
975 | 975 | ); |
@@ -1008,7 +1008,7 @@ discard block |
||
1008 | 1008 | if ($any_result === true) { |
1009 | 1009 | $from = ''; |
1010 | 1010 | if ($from_myspace) { |
1011 | - $from ='&from=myspace'; |
|
1011 | + $from = '&from=myspace'; |
|
1012 | 1012 | } |
1013 | 1013 | $link = Display::url( |
1014 | 1014 | Display::return_icon('2rightarrow.png', get_lang('Details')), |
@@ -1021,14 +1021,14 @@ discard block |
||
1021 | 1021 | echo '<td>'; |
1022 | 1022 | if ($any_result === true) { |
1023 | 1023 | echo '<a href="myStudents.php?action=reset_lp&sec_token='.$token.'&cidReq='.$course_code.'&course='.$course_code.'&details='.Security::remove_XSS($_GET['details']).'&origin='.$origin.'&lp_id='.$learnpath->getId().'&student='.$user_info['user_id'].'&details=true&id_session='.$sessionId.'">'; |
1024 | - echo Display::return_icon('clean.png', get_lang('Clean'),'',ICON_SIZE_SMALL).'</a>'; |
|
1024 | + echo Display::return_icon('clean.png', get_lang('Clean'), '', ICON_SIZE_SMALL).'</a>'; |
|
1025 | 1025 | echo '</a>'; |
1026 | 1026 | } |
1027 | 1027 | echo '</td>'; |
1028 | 1028 | echo '</tr>'; |
1029 | 1029 | } |
1030 | 1030 | $data_learnpath[$i][] = $lp_name; |
1031 | - $data_learnpath[$i][] = $progress . '%'; |
|
1031 | + $data_learnpath[$i][] = $progress.'%'; |
|
1032 | 1032 | } |
1033 | 1033 | ?> |
1034 | 1034 | </tbody> |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | <thead> |
1045 | 1045 | <tr> |
1046 | 1046 | <th><?php echo get_lang('Exercises'); ?></th> |
1047 | - <th><?php echo get_lang('LearningPath');?></th> |
|
1047 | + <th><?php echo get_lang('LearningPath'); ?></th> |
|
1048 | 1048 | <th><?php echo get_lang('AvgCourseScore').' '.Display :: return_icon('info3.gif', get_lang('AverageScore'), array('align' => 'absmiddle', 'hspace' => '3px')) ?></th> |
1049 | 1049 | <th><?php echo get_lang('Attempts'); ?></th> |
1050 | 1050 | <th><?php echo get_lang('LatestAttempt'); ?></th> |
@@ -1063,7 +1063,7 @@ discard block |
||
1063 | 1063 | ); |
1064 | 1064 | |
1065 | 1065 | $t_quiz = Database :: get_course_table(TABLE_QUIZ_TEST); |
1066 | - $sql = "SELECT quiz.title, id FROM " . $t_quiz . " AS quiz |
|
1066 | + $sql = "SELECT quiz.title, id FROM ".$t_quiz." AS quiz |
|
1067 | 1067 | WHERE |
1068 | 1068 | quiz.c_id = ".$courseInfo['real_id']." AND |
1069 | 1069 | (quiz.session_id = $sessionId OR quiz.session_id = 0) AND |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | echo '<td>'; |
1129 | 1129 | |
1130 | 1130 | if ($count_attempts > 0) { |
1131 | - echo $score_percentage . '%'; |
|
1131 | + echo $score_percentage.'%'; |
|
1132 | 1132 | } else { |
1133 | 1133 | echo '-'; |
1134 | 1134 | $score_percentage = 0; |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | echo '<td>'.$count_attempts.'</td>'; |
1139 | 1139 | echo '<td>'; |
1140 | 1140 | |
1141 | - $sql = 'SELECT exe_id FROM ' . $tbl_stats_exercices . ' |
|
1141 | + $sql = 'SELECT exe_id FROM '.$tbl_stats_exercices.' |
|
1142 | 1142 | WHERE |
1143 | 1143 | exe_exo_id = "'.$exercise_id.'" AND |
1144 | 1144 | exe_user_id ="'.$student_id.'" AND |
@@ -1151,7 +1151,7 @@ discard block |
||
1151 | 1151 | if (Database :: num_rows($result_last_attempt) > 0) { |
1152 | 1152 | $id_last_attempt = Database :: result($result_last_attempt, 0, 0); |
1153 | 1153 | if ($count_attempts > 0) |
1154 | - echo '<a href="../exercise/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin)?'tracking':$origin).'"> |
|
1154 | + echo '<a href="../exercise/exercise_show.php?id='.$id_last_attempt.'&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin) ? 'tracking' : $origin).'"> |
|
1155 | 1155 | '.Display::return_icon('quiz.gif').' |
1156 | 1156 | </a>'; |
1157 | 1157 | } |
@@ -1159,11 +1159,11 @@ discard block |
||
1159 | 1159 | |
1160 | 1160 | echo '<td>'; |
1161 | 1161 | $all_attempt_url = "../exercise/exercise_report.php?exerciseId=$exercise_id&cidReq=$course_code&filter_by_user=$student_id&id_session=$sessionId"; |
1162 | - echo Display::url(Display::return_icon('test_results.png', get_lang('AllAttempts'), array(), ICON_SIZE_SMALL), $all_attempt_url ); |
|
1162 | + echo Display::url(Display::return_icon('test_results.png', get_lang('AllAttempts'), array(), ICON_SIZE_SMALL), $all_attempt_url); |
|
1163 | 1163 | |
1164 | 1164 | echo '</td></tr>'; |
1165 | 1165 | $data_exercices[$i][] = $exercices['title']; |
1166 | - $data_exercices[$i][] = $score_percentage . '%'; |
|
1166 | + $data_exercices[$i][] = $score_percentage.'%'; |
|
1167 | 1167 | $data_exercices[$i][] = $count_attempts; |
1168 | 1168 | |
1169 | 1169 | $csv_content[] = array( |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | $survey_list = SurveyManager::get_surveys($course_code, $sessionId); |
1192 | 1192 | |
1193 | 1193 | $survey_data = array(); |
1194 | - foreach($survey_list as $survey) { |
|
1194 | + foreach ($survey_list as $survey) { |
|
1195 | 1195 | $user_list = SurveyManager::get_people_who_filled_survey($survey['survey_id'], false, $courseInfo['real_id']); |
1196 | 1196 | $survey_done = Display::return_icon("accept_na.png", get_lang('NoAnswer'), array(), ICON_SIZE_SMALL); |
1197 | 1197 | if (in_array($student_id, $user_list)) { |
@@ -1216,7 +1216,7 @@ discard block |
||
1216 | 1216 | $column = 0; |
1217 | 1217 | $table->setCellContents($row, $column, $data); |
1218 | 1218 | $class = 'class="row_odd"'; |
1219 | - if($row % 2) { |
|
1219 | + if ($row % 2) { |
|
1220 | 1220 | $class = 'class="row_even"'; |
1221 | 1221 | } |
1222 | 1222 | $table->setRowAttributes($row, $class, true); |
@@ -17,7 +17,7 @@ |
||
17 | 17 | $result = $objExercise->read($exercise_id); |
18 | 18 | |
19 | 19 | if (!$result) { |
20 | - api_not_allowed(true); |
|
20 | + api_not_allowed(true); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | $interbreadcrumb[] = array( |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $url = api_get_path(WEB_AJAX_PATH).'exercise.ajax.php?a=get_live_stats&exercise_id='.$objExercise->id.'&minutes='.$minutes; |
42 | 42 | |
43 | 43 | //The order is important you need to check the the $column variable in the model.ajax.php file |
44 | -$columns = array(get_lang('FirstName'), get_lang('LastName'), get_lang('Time'), get_lang('QuestionsAlreadyAnswered'), get_lang('Score')); |
|
44 | +$columns = array(get_lang('FirstName'), get_lang('LastName'), get_lang('Time'), get_lang('QuestionsAlreadyAnswered'), get_lang('Score')); |
|
45 | 45 | |
46 | 46 | //Column config |
47 | 47 | $column_model = array( |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | |
94 | 94 | $(function() { |
95 | 95 | <?php |
96 | - echo Display::grid_js('live_stats', $url, $columns, $column_model, $extra_params, array(), null, true); |
|
96 | + echo Display::grid_js('live_stats', $url, $columns, $column_model, $extra_params, array(), null, true); |
|
97 | 97 | ?> |
98 | 98 | refreshGrid(); |
99 | 99 | }); |
100 | 100 | </script> |
101 | 101 | <?php |
102 | 102 | |
103 | -$actions = '<a href="exercise_report.php?exerciseId='.intval($_GET['exerciseId']).'&'.api_get_cidreq().'">' . |
|
104 | - Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
103 | +$actions = '<a href="exercise_report.php?exerciseId='.intval($_GET['exerciseId']).'&'.api_get_cidreq().'">'. |
|
104 | + Display :: return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
105 | 105 | echo $actions = Display::div($actions, array('class'=> 'actions')); |
106 | 106 | |
107 | 107 | echo Display::grid_html('live_stats'); |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
181 | - * abstract function which creates the form to create/edit the answers of the question |
|
182 | - * @param FormValidator $form |
|
183 | - */ |
|
181 | + * abstract function which creates the form to create/edit the answers of the question |
|
182 | + * @param FormValidator $form |
|
183 | + */ |
|
184 | 184 | public function processAnswersCreation($form) |
185 | 185 | { |
186 | 186 | $questionWeighting = $nbrGoodAnswers = 0; |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | // sets the total weighting of the question |
222 | 222 | $this->updateWeighting($questionWeighting); |
223 | 223 | $this->save(); |
224 | - } |
|
224 | + } |
|
225 | 225 | |
226 | 226 | function return_header($feedback_type = null, $counter = null, $score = null) |
227 | 227 | { |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | $html = '<table class="table table-striped table-hover">'; |
40 | 40 | $html .= '<thead>'; |
41 | 41 | $html .= '<tr>'; |
42 | - $html .= '<th width="10">' . get_lang('Number') . '</th>'; |
|
43 | - $html .= '<th width="10">' . get_lang('True') . '</th>'; |
|
44 | - $html .= '<th width="50%">' . get_lang('Comment') . '</th>'; |
|
45 | - $html .= '<th width="50%">' . get_lang('Answer') . '</th>'; |
|
42 | + $html .= '<th width="10">'.get_lang('Number').'</th>'; |
|
43 | + $html .= '<th width="10">'.get_lang('True').'</th>'; |
|
44 | + $html .= '<th width="50%">'.get_lang('Comment').'</th>'; |
|
45 | + $html .= '<th width="50%">'.get_lang('Answer').'</th>'; |
|
46 | 46 | $html .= '</tr>'; |
47 | 47 | $html .= '</thead>'; |
48 | 48 | $html .= '<tbody>'; |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | $form->addHtml('<tr>'); |
75 | 75 | |
76 | 76 | if (is_object($answer)) { |
77 | - $defaults['answer[' . $i . ']'] = $answer->answer[$i]; |
|
78 | - $defaults['comment[' . $i . ']'] = $answer->comment[$i]; |
|
79 | - $defaults['weighting[' . $i . ']'] = float_format($answer->weighting[$i], 1); |
|
80 | - $defaults['correct[' . $i . ']'] = $answer->correct[$i]; |
|
77 | + $defaults['answer['.$i.']'] = $answer->answer[$i]; |
|
78 | + $defaults['comment['.$i.']'] = $answer->comment[$i]; |
|
79 | + $defaults['weighting['.$i.']'] = float_format($answer->weighting[$i], 1); |
|
80 | + $defaults['correct['.$i.']'] = $answer->correct[$i]; |
|
81 | 81 | } else { |
82 | 82 | $defaults['answer[1]'] = get_lang('DefaultMultipleAnswer2'); |
83 | 83 | $defaults['comment[1]'] = get_lang('DefaultMultipleComment2'); |
@@ -93,44 +93,44 @@ discard block |
||
93 | 93 | |
94 | 94 | $renderer->setElementTemplate( |
95 | 95 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
96 | - 'correct[' . $i . ']' |
|
96 | + 'correct['.$i.']' |
|
97 | 97 | ); |
98 | 98 | $renderer->setElementTemplate( |
99 | 99 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
100 | - 'counter[' . $i . ']' |
|
100 | + 'counter['.$i.']' |
|
101 | 101 | ); |
102 | 102 | $renderer->setElementTemplate( |
103 | 103 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
104 | - 'answer[' . $i . ']' |
|
104 | + 'answer['.$i.']' |
|
105 | 105 | ); |
106 | 106 | $renderer->setElementTemplate( |
107 | 107 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
108 | - 'comment[' . $i . ']' |
|
108 | + 'comment['.$i.']' |
|
109 | 109 | ); |
110 | 110 | |
111 | - $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"'); |
|
111 | + $answer_number = $form->addElement('text', 'counter['.$i.']', null, 'value="'.$i.'"'); |
|
112 | 112 | $answer_number->freeze(); |
113 | 113 | |
114 | 114 | $form->addElement('checkbox', |
115 | - 'correct[' . $i . ']', |
|
115 | + 'correct['.$i.']', |
|
116 | 116 | null, |
117 | 117 | null, |
118 | 118 | 'class="checkbox" style="margin-left: 0em;"' |
119 | 119 | ); |
120 | - $boxes_names[] = 'correct[' . $i . ']'; |
|
120 | + $boxes_names[] = 'correct['.$i.']'; |
|
121 | 121 | |
122 | 122 | $form->addElement( |
123 | 123 | 'html_editor', |
124 | - 'answer[' . $i . ']', |
|
124 | + 'answer['.$i.']', |
|
125 | 125 | null, |
126 | 126 | array(), |
127 | 127 | array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100') |
128 | 128 | ); |
129 | - $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required'); |
|
129 | + $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required'); |
|
130 | 130 | |
131 | 131 | $form->addElement( |
132 | 132 | 'html_editor', |
133 | - 'comment[' . $i . ']', |
|
133 | + 'comment['.$i.']', |
|
134 | 134 | null, |
135 | 135 | array(), |
136 | 136 | array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100') |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | function return_header($feedback_type = null, $counter = null, $score = null) |
227 | 227 | { |
228 | 228 | $header = parent::return_header($feedback_type, $counter, $score); |
229 | - $header .= '<table class="'.$this->question_table_class .'"> |
|
229 | + $header .= '<table class="'.$this->question_table_class.'"> |
|
230 | 230 | <tr> |
231 | 231 | <th>'.get_lang("Choice").'</th> |
232 | 232 | <th>'. get_lang("ExpectedChoice").'</th> |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | api_not_allowed($show_headers); |
27 | 27 | } |
28 | 28 | |
29 | -$is_allowedToEdit = api_is_allowed_to_edit(null,true) || $is_courseTutor; |
|
29 | +$is_allowedToEdit = api_is_allowed_to_edit(null, true) || $is_courseTutor; |
|
30 | 30 | |
31 | 31 | //Getting results from the exe_id. This variable also contain all the information about the exercise |
32 | 32 | $track_exercise_info = ExerciseLib::get_exercise_track_exercise_info($id); |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
56 | -$htmlHeadXtra[] = '<link rel="stylesheet" href="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/css/hotspot.css">'; |
|
57 | -$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/js/hotspot.js"></script>'; |
|
56 | +$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/css/hotspot.css">'; |
|
57 | +$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/hotspot.js"></script>'; |
|
58 | 58 | |
59 | 59 | if ($show_headers) { |
60 | 60 | $interbreadcrumb[] = array( |
@@ -70,7 +70,7 @@ |
||
70 | 70 | $htmlHeadXtra[] = '<style> |
71 | 71 | body { background: none;} |
72 | 72 | </style>'; |
73 | - Display::display_reduced_header(); |
|
73 | + Display::display_reduced_header(); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | $message = Session::read('attempt_remaining'); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | $result = $objExercise->read($exercise_id); |
13 | 13 | |
14 | 14 | if (!$result) { |
15 | - api_not_allowed(true); |
|
15 | + api_not_allowed(true); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | $sessionId = api_get_session_id(); |
@@ -29,17 +29,17 @@ discard block |
||
29 | 29 | $data = array(); |
30 | 30 | // Question title # of students who tool it Lowest score Average Highest score Maximum score |
31 | 31 | $headers = array( |
32 | - get_lang('Question'), |
|
32 | + get_lang('Question'), |
|
33 | 33 | get_lang('QuestionType'), |
34 | 34 | get_lang('NumberStudentWhoSelectedIt'), |
35 | - get_lang('LowestScore'), |
|
36 | - get_lang('AverageScore'), |
|
37 | - get_lang('HighestScore'), |
|
38 | - get_lang('Weighting') |
|
35 | + get_lang('LowestScore'), |
|
36 | + get_lang('AverageScore'), |
|
37 | + get_lang('HighestScore'), |
|
38 | + get_lang('Weighting') |
|
39 | 39 | ); |
40 | 40 | |
41 | 41 | if (!empty($question_list)) { |
42 | - foreach ($question_list as $question_id) { |
|
42 | + foreach ($question_list as $question_id) { |
|
43 | 43 | $question_obj = Question::read($question_id); |
44 | 44 | |
45 | 45 | $exercise_stats = ExerciseLib::get_student_stats_by_question( |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $data[$question_id]['average_score'] = round($exercise_stats['average'], 2); |
74 | 74 | $data[$question_id]['highest_score'] = round($exercise_stats['max'], 2); |
75 | 75 | $data[$question_id]['max_score'] = round($question_obj->weighting, 2); |
76 | - } |
|
76 | + } |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | // Format A table |
@@ -81,37 +81,37 @@ discard block |
||
81 | 81 | $row = 0; |
82 | 82 | $column = 0; |
83 | 83 | foreach ($headers as $header) { |
84 | - $table->setHeaderContents($row, $column, $header); |
|
85 | - $column++; |
|
84 | + $table->setHeaderContents($row, $column, $header); |
|
85 | + $column++; |
|
86 | 86 | } |
87 | 87 | $row++; |
88 | 88 | foreach ($data as $row_table) { |
89 | - $column = 0; |
|
90 | - foreach ($row_table as $cell) { |
|
91 | - $table->setCellContents($row, $column, $cell); |
|
92 | - $table->updateCellAttributes($row, $column, 'align="center"'); |
|
93 | - $column++; |
|
94 | - } |
|
95 | - $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true); |
|
96 | - $row++; |
|
89 | + $column = 0; |
|
90 | + foreach ($row_table as $cell) { |
|
91 | + $table->setCellContents($row, $column, $cell); |
|
92 | + $table->updateCellAttributes($row, $column, 'align="center"'); |
|
93 | + $column++; |
|
94 | + } |
|
95 | + $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true); |
|
96 | + $row++; |
|
97 | 97 | } |
98 | 98 | $content = $table->toHtml(); |
99 | 99 | |
100 | 100 | // Format B |
101 | 101 | |
102 | 102 | $headers = array( |
103 | - get_lang('Question'), |
|
104 | - get_lang('Answer'), |
|
105 | - get_lang('Correct'), |
|
106 | - get_lang('NumberStudentWhoSelectedIt') |
|
103 | + get_lang('Question'), |
|
104 | + get_lang('Answer'), |
|
105 | + get_lang('Correct'), |
|
106 | + get_lang('NumberStudentWhoSelectedIt') |
|
107 | 107 | ); |
108 | 108 | |
109 | 109 | $data = array(); |
110 | 110 | |
111 | 111 | if (!empty($question_list)) { |
112 | 112 | $id = 0; |
113 | - foreach ($question_list as $question_id) { |
|
114 | - $question_obj = Question::read($question_id); |
|
113 | + foreach ($question_list as $question_id) { |
|
114 | + $question_obj = Question::read($question_id); |
|
115 | 115 | $exercise_stats = ExerciseLib::get_student_stats_by_question( |
116 | 116 | $question_id, |
117 | 117 | $exercise_id, |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | ); |
121 | 121 | |
122 | 122 | $answer = new Answer($question_id); |
123 | - $answer_count = $answer->selectNbrAnswers(); |
|
123 | + $answer_count = $answer->selectNbrAnswers(); |
|
124 | 124 | |
125 | 125 | for ($answer_id = 1; $answer_id <= $answer_count; $answer_id++) { |
126 | 126 | $answer_info = $answer->selectAnswer($answer_id); |
@@ -175,11 +175,11 @@ discard block |
||
175 | 175 | $correct = ''; |
176 | 176 | |
177 | 177 | for ($i = 1; $i <= $answer_count; $i++) { |
178 | - $is_correct_i = $answer->isCorrect($i); |
|
179 | - if ($is_correct_i != 0 && $is_correct_i == $answer_id) { |
|
180 | - $correct = $answer->selectAnswer($i); |
|
181 | - break; |
|
182 | - } |
|
178 | + $is_correct_i = $answer->isCorrect($i); |
|
179 | + if ($is_correct_i != 0 && $is_correct_i == $answer_id) { |
|
180 | + $correct = $answer->selectAnswer($i); |
|
181 | + break; |
|
182 | + } |
|
183 | 183 | } |
184 | 184 | $data[$id]['answer'] = $correct; |
185 | 185 | $data[$id]['correct'] = $answer_info; |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | } |
246 | 246 | $id++; |
247 | 247 | } |
248 | - } |
|
248 | + } |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | // Format A table |
@@ -253,19 +253,19 @@ discard block |
||
253 | 253 | $row = 0; |
254 | 254 | $column = 0; |
255 | 255 | foreach ($headers as $header) { |
256 | - $table->setHeaderContents($row, $column, $header); |
|
257 | - $column++; |
|
256 | + $table->setHeaderContents($row, $column, $header); |
|
257 | + $column++; |
|
258 | 258 | } |
259 | 259 | $row++; |
260 | 260 | foreach ($data as $row_table) { |
261 | - $column = 0; |
|
262 | - foreach ($row_table as $cell) { |
|
263 | - $table->setCellContents($row, $column, $cell); |
|
264 | - $table->updateCellAttributes($row, $column, 'align="center"'); |
|
265 | - $column++; |
|
266 | - } |
|
267 | - $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true); |
|
268 | - $row++; |
|
261 | + $column = 0; |
|
262 | + foreach ($row_table as $cell) { |
|
263 | + $table->setCellContents($row, $column, $cell); |
|
264 | + $table->updateCellAttributes($row, $column, 'align="center"'); |
|
265 | + $column++; |
|
266 | + } |
|
267 | + $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true); |
|
268 | + $row++; |
|
269 | 269 | } |
270 | 270 | $content .= $table->toHtml(); |
271 | 271 |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | $data[$question_id]['type'] = $question_obj->get_question_type_name(); |
62 | 62 | $percentange = 0; |
63 | 63 | if ($count_students) { |
64 | - $percentange = $count_users / $count_students*100; |
|
64 | + $percentange = $count_users / $count_students * 100; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | $data[$question_id]['students_who_try_exercise'] = Display::bar_progress( |
68 | 68 | $percentange, |
69 | 69 | false, |
70 | - $count_users .' / '.$count_students |
|
70 | + $count_users.' / '.$count_students |
|
71 | 71 | ); |
72 | 72 | $data[$question_id]['lowest_score'] = round($exercise_stats['min'], 2); |
73 | 73 | $data[$question_id]['average_score'] = round($exercise_stats['average'], 2); |
@@ -142,23 +142,23 @@ discard block |
||
142 | 142 | } else { |
143 | 143 | $data[$id]['name'] = '-'; |
144 | 144 | } |
145 | - $data[$id]['answer'] = $answer_item; |
|
145 | + $data[$id]['answer'] = $answer_item; |
|
146 | 146 | |
147 | 147 | $answer_item = api_substr($answer_item, 1); |
148 | - $answer_item = api_substr($answer_item, 0, api_strlen($answer_item) -1); |
|
148 | + $answer_item = api_substr($answer_item, 0, api_strlen($answer_item) - 1); |
|
149 | 149 | |
150 | - $data[$id]['answer'] = $answer_item; |
|
150 | + $data[$id]['answer'] = $answer_item; |
|
151 | 151 | |
152 | - $data[$id]['correct'] = '-'; |
|
152 | + $data[$id]['correct'] = '-'; |
|
153 | 153 | |
154 | 154 | $count = ExerciseLib::getNumberStudentsFillBlanksAnwserCount($question_id, $exercise_id); |
155 | 155 | $count = $count[$counter]; |
156 | 156 | |
157 | 157 | $percentange = 0; |
158 | 158 | if (!empty($count_students)) { |
159 | - $percentange = $count/$count_students*100; |
|
159 | + $percentange = $count / $count_students * 100; |
|
160 | 160 | } |
161 | - $data[$id]['attempts'] = Display::bar_progress($percentange, false, $count .' / '.$count_students); |
|
161 | + $data[$id]['attempts'] = Display::bar_progress($percentange, false, $count.' / '.$count_students); |
|
162 | 162 | $id++; |
163 | 163 | $counter++; |
164 | 164 | } |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | ); |
195 | 195 | $percentange = 0; |
196 | 196 | if (!empty($count_students)) { |
197 | - $percentange = $count/$count_students*100; |
|
197 | + $percentange = $count / $count_students * 100; |
|
198 | 198 | } |
199 | - $data[$id]['attempts'] = Display::bar_progress($percentange, false, $count .' / '.$count_students); |
|
199 | + $data[$id]['attempts'] = Display::bar_progress($percentange, false, $count.' / '.$count_students); |
|
200 | 200 | } |
201 | 201 | break; |
202 | 202 | case HOT_SPOT: |
@@ -217,9 +217,9 @@ discard block |
||
217 | 217 | ); |
218 | 218 | $percentange = 0; |
219 | 219 | if (!empty($count_students)) { |
220 | - $percentange = $count/$count_students*100; |
|
220 | + $percentange = $count / $count_students * 100; |
|
221 | 221 | } |
222 | - $data[$id]['attempts'] = Display::bar_progress($percentange, false, $count .' / '.$count_students); |
|
222 | + $data[$id]['attempts'] = Display::bar_progress($percentange, false, $count.' / '.$count_students); |
|
223 | 223 | break; |
224 | 224 | default: |
225 | 225 | if ($answer_id == 1) { |
@@ -239,9 +239,9 @@ discard block |
||
239 | 239 | ); |
240 | 240 | $percentange = 0; |
241 | 241 | if (!empty($count_students)) { |
242 | - $percentange = $count/$count_students*100; |
|
242 | + $percentange = $count / $count_students * 100; |
|
243 | 243 | } |
244 | - $data[$id]['attempts'] = Display::bar_progress($percentange, false, $count .' / '.$count_students); |
|
244 | + $data[$id]['attempts'] = Display::bar_progress($percentange, false, $count.' / '.$count_students); |
|
245 | 245 | } |
246 | 246 | $id++; |
247 | 247 | } |
@@ -273,8 +273,8 @@ discard block |
||
273 | 273 | $interbreadcrumb[] = array("url" => "admin.php?exerciseId=$exercise_id&".api_get_cidreq(), "name" => $objExercise->name); |
274 | 274 | |
275 | 275 | $tpl = new Template(get_lang('ReportByQuestion')); |
276 | -$actions = '<a href="exercise_report.php?exerciseId='.intval($_GET['exerciseId']).'&'.api_get_cidreq().'">' . |
|
277 | - Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
276 | +$actions = '<a href="exercise_report.php?exerciseId='.intval($_GET['exerciseId']).'&'.api_get_cidreq().'">'. |
|
277 | + Display :: return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
278 | 278 | $actions = Display::div($actions, array('class'=> 'actions')); |
279 | 279 | $content = $actions.$content; |
280 | 280 | $tpl->assign('content', $content); |
@@ -34,20 +34,20 @@ discard block |
||
34 | 34 | $html = '<table class="data_table"> |
35 | 35 | <tr> |
36 | 36 | <th width="10px"> |
37 | - ' . get_lang('Number') . ' |
|
37 | + ' . get_lang('Number').' |
|
38 | 38 | </th> |
39 | 39 | <th width="10px"> |
40 | - ' . get_lang('True') . ' |
|
40 | + ' . get_lang('True').' |
|
41 | 41 | </th> |
42 | 42 | <th width="50%"> |
43 | - ' . get_lang('Answer') . ' |
|
43 | + ' . get_lang('Answer').' |
|
44 | 44 | </th>'; |
45 | 45 | |
46 | - $html .='<th>' . get_lang('Comment') . '</th>'; |
|
47 | - $html .='</tr>'; |
|
46 | + $html .= '<th>'.get_lang('Comment').'</th>'; |
|
47 | + $html .= '</tr>'; |
|
48 | 48 | $form->addElement( |
49 | 49 | 'label', |
50 | - get_lang('Answers') . |
|
50 | + get_lang('Answers'). |
|
51 | 51 | '<br /> '.Display::return_icon('fill_field.png'), |
52 | 52 | $html |
53 | 53 | ); |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | for ($i = 1; $i <= $nb_answers; ++$i) { |
83 | 83 | /* si la reponse est de type objet */ |
84 | 84 | if (is_object($answer)) { |
85 | - $defaults['answer[' . $i . ']'] = $answer->answer[$i]; |
|
86 | - $defaults['comment[' . $i . ']'] = $answer->comment[$i]; |
|
87 | - $defaults['correct[' . $i . ']'] = $answer->correct[$i]; |
|
85 | + $defaults['answer['.$i.']'] = $answer->answer[$i]; |
|
86 | + $defaults['comment['.$i.']'] = $answer->comment[$i]; |
|
87 | + $defaults['correct['.$i.']'] = $answer->correct[$i]; |
|
88 | 88 | |
89 | 89 | // start |
90 | 90 | $scoreA = $answer->weighting[$i]; |
@@ -106,16 +106,16 @@ discard block |
||
106 | 106 | $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'comment['.$i.']'); |
107 | 107 | //$renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'weighting['.$i.']'); |
108 | 108 | |
109 | - $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"'); |
|
109 | + $answer_number = $form->addElement('text', 'counter['.$i.']', null, 'value="'.$i.'"'); |
|
110 | 110 | $answer_number->freeze(); |
111 | 111 | |
112 | - $form->addElement('checkbox', 'correct[' . $i . ']', null, null, 'class="checkbox"'); |
|
113 | - $boxes_names[] = 'correct[' . $i . ']'; |
|
112 | + $form->addElement('checkbox', 'correct['.$i.']', null, null, 'class="checkbox"'); |
|
113 | + $boxes_names[] = 'correct['.$i.']'; |
|
114 | 114 | |
115 | - $form->addElement('html_editor', 'answer[' . $i . ']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); |
|
116 | - $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required'); |
|
115 | + $form->addElement('html_editor', 'answer['.$i.']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); |
|
116 | + $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required'); |
|
117 | 117 | |
118 | - $form->addElement('html_editor', 'comment[' . $i . ']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); |
|
118 | + $form->addElement('html_editor', 'comment['.$i.']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); |
|
119 | 119 | |
120 | 120 | $form->addElement('html', '</tr>'); |
121 | 121 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | // Reponses correctes |
182 | 182 | $nbr_corrects = 0; |
183 | 183 | for ($i = 1; $i <= $nb_answers; $i++) { |
184 | - $goodAnswer = trim($form->getSubmitValue('correct[' . $i . ']')); |
|
184 | + $goodAnswer = trim($form->getSubmitValue('correct['.$i.']')); |
|
185 | 185 | if ($goodAnswer) { |
186 | 186 | $nbr_corrects++; |
187 | 187 | } |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | $test = $form->getSubmitValue('pts'); |
201 | 201 | |
202 | 202 | for ($i = 1; $i <= $nb_answers; $i++) { |
203 | - $answer = trim($form->getSubmitValue('answer[' . $i . ']')); |
|
204 | - $comment = trim($form->getSubmitValue('comment[' . $i . ']')); |
|
205 | - $goodAnswer = trim($form->getSubmitValue('correct[' . $i . ']')); |
|
203 | + $answer = trim($form->getSubmitValue('answer['.$i.']')); |
|
204 | + $comment = trim($form->getSubmitValue('comment['.$i.']')); |
|
205 | + $goodAnswer = trim($form->getSubmitValue('correct['.$i.']')); |
|
206 | 206 | |
207 | 207 | if ($goodAnswer) { |
208 | 208 | $weighting = abs($answer_score); |
@@ -230,12 +230,12 @@ discard block |
||
230 | 230 | $score = null |
231 | 231 | ) { |
232 | 232 | $header = parent::return_header($feedback_type, $counter, $score); |
233 | - $header .= '<table class="'.$this->question_table_class .'"> |
|
233 | + $header .= '<table class="'.$this->question_table_class.'"> |
|
234 | 234 | <tr> |
235 | - <th>' . get_lang("Choice") . '</th> |
|
236 | - <th>' . get_lang("ExpectedChoice") . '</th> |
|
237 | - <th>' . get_lang("Answer") . '</th>'; |
|
238 | - $header .= '<th>' . get_lang("Comment") . '</th>'; |
|
235 | + <th>' . get_lang("Choice").'</th> |
|
236 | + <th>' . get_lang("ExpectedChoice").'</th> |
|
237 | + <th>' . get_lang("Answer").'</th>'; |
|
238 | + $header .= '<th>'.get_lang("Comment").'</th>'; |
|
239 | 239 | $header .= '</tr>'; |
240 | 240 | |
241 | 241 | return $header; |
@@ -98,10 +98,10 @@ |
||
98 | 98 | }*/ |
99 | 99 | } |
100 | 100 | |
101 | - // This is a good answer, count + 1 for nmbr of clicks |
|
102 | - if ($answers['weighting'][$i] > 0) { |
|
103 | - $nmbrTries++; |
|
104 | - } |
|
101 | + // This is a good answer, count + 1 for nmbr of clicks |
|
102 | + if ($answers['weighting'][$i] > 0) { |
|
103 | + $nmbrTries++; |
|
104 | + } |
|
105 | 105 | |
106 | 106 | $hotSpot['coord'] = $answers['hotspot_coordinates'][$i]; |
107 | 107 | $data['hotspots'][] = $hotSpot; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | api_protect_course_script(false); |
12 | 12 | |
13 | -$isAllowedToEdit = api_is_allowed_to_edit(null,true); |
|
13 | +$isAllowedToEdit = api_is_allowed_to_edit(null, true); |
|
14 | 14 | |
15 | 15 | if (!$isAllowedToEdit) { |
16 | 16 | api_not_allowed(true); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $objQuestion = Question::read($questionId); |
23 | 23 | $_course = api_get_course_info(); |
24 | 24 | |
25 | -$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
25 | +$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
26 | 26 | |
27 | 27 | $picturePath = $documentPath.'/images'; |
28 | 28 | $pictureName = $objQuestion->selectPicture(); |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | $answers = $_SESSION['tmp_answers']; |
66 | 66 | $nbrAnswers = count($answers['answer']); |
67 | 67 | |
68 | -for ($i=1;$i <= $nbrAnswers; $i++) { |
|
68 | +for ($i = 1; $i <= $nbrAnswers; $i++) { |
|
69 | 69 | $hotSpot = []; |
70 | 70 | $hotSpot['id'] = null; |
71 | - $hotSpot['answer']= $answers['answer'][$i]; |
|
71 | + $hotSpot['answer'] = $answers['answer'][$i]; |
|
72 | 72 | |
73 | 73 | if ($answer_type == HOT_SPOT_DELINEATION) { |
74 | - if ($i==1) { |
|
74 | + if ($i == 1) { |
|
75 | 75 | $hotSpot['type'] = 'delineation'; |
76 | 76 | } else { |
77 | 77 | $hotSpot['type'] = 'oar'; |