@@ -15,24 +15,24 @@ |
||
15 | 15 | $answerId = intval($_GET['answerId']); |
16 | 16 | |
17 | 17 | if ($_GET['type'] == "square" || $_GET['type'] == "circle") { |
18 | - $hotspot_type = $_GET['type']; |
|
19 | - $hotspot_coordinates = $_GET['x'].";".$_GET['y']."|".$_GET['width']."|".$_GET['height']; |
|
18 | + $hotspot_type = $_GET['type']; |
|
19 | + $hotspot_coordinates = $_GET['x'].";".$_GET['y']."|".$_GET['width']."|".$_GET['height']; |
|
20 | 20 | } |
21 | 21 | if ($_GET['type'] == "poly" || $_GET['type'] == "delineation" || $_GET['type'] == "oar") { |
22 | - $hotspot_type = $_GET['type']; |
|
23 | - $tmp_coord = explode(",",$_GET['co']); |
|
24 | - $i = 0; |
|
25 | - $hotspot_coordinates = ""; |
|
26 | - foreach ($tmp_coord as $coord) { |
|
27 | - if ($i%2 == 0) { |
|
28 | - $delimiter = ";"; |
|
29 | - } else { |
|
30 | - $delimiter = "|"; |
|
31 | - } |
|
32 | - $hotspot_coordinates .= $coord.$delimiter; |
|
33 | - $i++; |
|
34 | - } |
|
35 | - $hotspot_coordinates = api_substr($hotspot_coordinates,0,-2); |
|
22 | + $hotspot_type = $_GET['type']; |
|
23 | + $tmp_coord = explode(",",$_GET['co']); |
|
24 | + $i = 0; |
|
25 | + $hotspot_coordinates = ""; |
|
26 | + foreach ($tmp_coord as $coord) { |
|
27 | + if ($i%2 == 0) { |
|
28 | + $delimiter = ";"; |
|
29 | + } else { |
|
30 | + $delimiter = "|"; |
|
31 | + } |
|
32 | + $hotspot_coordinates .= $coord.$delimiter; |
|
33 | + $i++; |
|
34 | + } |
|
35 | + $hotspot_coordinates = api_substr($hotspot_coordinates,0,-2); |
|
36 | 36 | } |
37 | 37 | $course_id = api_get_course_int_id(); |
38 | 38 | $sql = "UPDATE $TBL_ANSWER SET |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER); |
14 | 14 | $questionId = intval($_GET['questionId']); |
15 | -$answerId = intval($_GET['answerId']); |
|
15 | +$answerId = intval($_GET['answerId']); |
|
16 | 16 | |
17 | 17 | if ($_GET['type'] == "square" || $_GET['type'] == "circle") { |
18 | 18 | $hotspot_type = $_GET['type']; |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | } |
21 | 21 | if ($_GET['type'] == "poly" || $_GET['type'] == "delineation" || $_GET['type'] == "oar") { |
22 | 22 | $hotspot_type = $_GET['type']; |
23 | - $tmp_coord = explode(",",$_GET['co']); |
|
23 | + $tmp_coord = explode(",", $_GET['co']); |
|
24 | 24 | $i = 0; |
25 | 25 | $hotspot_coordinates = ""; |
26 | 26 | foreach ($tmp_coord as $coord) { |
27 | - if ($i%2 == 0) { |
|
27 | + if ($i % 2 == 0) { |
|
28 | 28 | $delimiter = ";"; |
29 | 29 | } else { |
30 | 30 | $delimiter = "|"; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $hotspot_coordinates .= $coord.$delimiter; |
33 | 33 | $i++; |
34 | 34 | } |
35 | - $hotspot_coordinates = api_substr($hotspot_coordinates,0,-2); |
|
35 | + $hotspot_coordinates = api_substr($hotspot_coordinates, 0, -2); |
|
36 | 36 | } |
37 | 37 | $course_id = api_get_course_int_id(); |
38 | 38 | $sql = "UPDATE $TBL_ANSWER SET |
@@ -146,15 +146,17 @@ discard block |
||
146 | 146 | $list_dest = $item_list[2]; |
147 | 147 | $url = $item_list[3]; |
148 | 148 | |
149 | - if ($try == 0) |
|
150 | - $try_result = 0; |
|
151 | - else |
|
152 | - $try_result = 1; |
|
149 | + if ($try == 0) { |
|
150 | + $try_result = 0; |
|
151 | + } else { |
|
152 | + $try_result = 1; |
|
153 | + } |
|
153 | 154 | |
154 | - if ($url == 0) |
|
155 | - $url_result = ''; |
|
156 | - else |
|
157 | - $url_result = $url; |
|
155 | + if ($url == 0) { |
|
156 | + $url_result = ''; |
|
157 | + } else { |
|
158 | + $url_result = $url; |
|
159 | + } |
|
158 | 160 | |
159 | 161 | $temp_scenario['url' . $i] = $url_result; |
160 | 162 | $temp_scenario['try' . $i] = $try_result; |
@@ -343,8 +345,9 @@ discard block |
||
343 | 345 | } |
344 | 346 | } |
345 | 347 | |
346 | - if (empty($try)) |
|
347 | - $try=0; |
|
348 | + if (empty($try)) { |
|
349 | + $try=0; |
|
350 | + } |
|
348 | 351 | |
349 | 352 | if (empty($lp)) { |
350 | 353 | $lp=0; |
@@ -14,20 +14,20 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class UniqueAnswerNoOption extends Question |
16 | 16 | { |
17 | - public static $typePicture = 'mcuao.png'; |
|
18 | - public static $explanationLangVar = 'UniqueAnswerNoOption'; |
|
17 | + public static $typePicture = 'mcuao.png'; |
|
18 | + public static $explanationLangVar = 'UniqueAnswerNoOption'; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Constructor |
|
22 | - */ |
|
23 | - public function __construct() |
|
20 | + /** |
|
21 | + * Constructor |
|
22 | + */ |
|
23 | + public function __construct() |
|
24 | 24 | { |
25 | - parent::__construct(); |
|
26 | - $this -> type = UNIQUE_ANSWER_NO_OPTION; |
|
27 | - $this -> isContent = $this-> getIsContent(); |
|
28 | - } |
|
25 | + parent::__construct(); |
|
26 | + $this -> type = UNIQUE_ANSWER_NO_OPTION; |
|
27 | + $this -> isContent = $this-> getIsContent(); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
30 | + /** |
|
31 | 31 | * function which redifines Question::createAnswersForm |
32 | 32 | * @param the formvalidator instance |
33 | 33 | * @param the answers number to display |
@@ -283,37 +283,37 @@ discard block |
||
283 | 283 | } |
284 | 284 | |
285 | 285 | /** |
286 | - * Function which creates the form to create / edit the answers of the question |
|
287 | - * @param the formvalidator instance |
|
288 | - * @param the answers number to display |
|
289 | - */ |
|
290 | - function processAnswersCreation($form) |
|
286 | + * Function which creates the form to create / edit the answers of the question |
|
287 | + * @param the formvalidator instance |
|
288 | + * @param the answers number to display |
|
289 | + */ |
|
290 | + function processAnswersCreation($form) |
|
291 | 291 | { |
292 | - $questionWeighting = $nbrGoodAnswers = 0; |
|
293 | - $correct = $form -> getSubmitValue('correct'); |
|
294 | - $objAnswer = new Answer($this->id); |
|
295 | - $nb_answers = $form -> getSubmitValue('nb_answers'); |
|
296 | - $minus = 1; |
|
297 | - if ($form -> getSubmitValue('new_question')) { |
|
298 | - $minus = 0; |
|
299 | - } |
|
300 | - |
|
301 | - for ($i=1 ; $i <= $nb_answers - $minus; $i++) { |
|
302 | - $position = trim($form -> getSubmitValue('position['.$i.']')); |
|
303 | - $answer = trim($form -> getSubmitValue('answer['.$i.']')); |
|
292 | + $questionWeighting = $nbrGoodAnswers = 0; |
|
293 | + $correct = $form -> getSubmitValue('correct'); |
|
294 | + $objAnswer = new Answer($this->id); |
|
295 | + $nb_answers = $form -> getSubmitValue('nb_answers'); |
|
296 | + $minus = 1; |
|
297 | + if ($form -> getSubmitValue('new_question')) { |
|
298 | + $minus = 0; |
|
299 | + } |
|
300 | + |
|
301 | + for ($i=1 ; $i <= $nb_answers - $minus; $i++) { |
|
302 | + $position = trim($form -> getSubmitValue('position['.$i.']')); |
|
303 | + $answer = trim($form -> getSubmitValue('answer['.$i.']')); |
|
304 | 304 | $comment = trim($form -> getSubmitValue('comment['.$i.']')); |
305 | 305 | $weighting = trim($form -> getSubmitValue('weighting['.$i.']')); |
306 | 306 | $scenario = $form -> getSubmitValue('scenario'); |
307 | 307 | |
308 | - //$list_destination = $form -> getSubmitValue('destination'.$i); |
|
309 | - //$destination_str = $form -> getSubmitValue('destination'.$i); |
|
308 | + //$list_destination = $form -> getSubmitValue('destination'.$i); |
|
309 | + //$destination_str = $form -> getSubmitValue('destination'.$i); |
|
310 | 310 | |
311 | - $try = $scenario['try'.$i]; |
|
311 | + $try = $scenario['try'.$i]; |
|
312 | 312 | $lp = $scenario['lp'.$i]; |
313 | - $destination = $scenario['destination'.$i]; |
|
314 | - $url = trim($scenario['url'.$i]); |
|
313 | + $destination = $scenario['destination'.$i]; |
|
314 | + $url = trim($scenario['url'.$i]); |
|
315 | 315 | |
316 | - /* |
|
316 | + /* |
|
317 | 317 | How we are going to parse the destination value |
318 | 318 | |
319 | 319 | here we parse the destination value which is a string |
@@ -326,41 +326,41 @@ discard block |
||
326 | 326 | selected_questions= ids of questions |
327 | 327 | url= an url |
328 | 328 | */ |
329 | - /* |
|
329 | + /* |
|
330 | 330 | $destination_str=''; |
331 | 331 | foreach ($list_destination as $destination_id) |
332 | 332 | { |
333 | 333 | $destination_str.=$destination_id.';'; |
334 | 334 | }*/ |
335 | 335 | |
336 | - $goodAnswer= ($correct == $i) ? true : false; |
|
336 | + $goodAnswer= ($correct == $i) ? true : false; |
|
337 | 337 | |
338 | - if ($goodAnswer) { |
|
339 | - $nbrGoodAnswers++; |
|
340 | - $weighting = abs($weighting); |
|
341 | - if($weighting > 0) { |
|
338 | + if ($goodAnswer) { |
|
339 | + $nbrGoodAnswers++; |
|
340 | + $weighting = abs($weighting); |
|
341 | + if($weighting > 0) { |
|
342 | 342 | $questionWeighting += $weighting; |
343 | 343 | } |
344 | - } |
|
344 | + } |
|
345 | 345 | |
346 | - if (empty($try)) |
|
347 | - $try=0; |
|
346 | + if (empty($try)) |
|
347 | + $try=0; |
|
348 | 348 | |
349 | - if (empty($lp)) { |
|
350 | - $lp=0; |
|
351 | - } |
|
349 | + if (empty($lp)) { |
|
350 | + $lp=0; |
|
351 | + } |
|
352 | 352 | |
353 | - if (empty($destination)) { |
|
354 | - $destination=0; |
|
355 | - } |
|
353 | + if (empty($destination)) { |
|
354 | + $destination=0; |
|
355 | + } |
|
356 | 356 | |
357 | - if ($url=='') { |
|
358 | - $url=0; |
|
359 | - } |
|
357 | + if ($url=='') { |
|
358 | + $url=0; |
|
359 | + } |
|
360 | 360 | |
361 | - //1@@1;2;@@2;4;4;@@http://www.chamilo.org |
|
362 | - $dest= $try.'@@'.$lp.'@@'.$destination.'@@'.$url; |
|
363 | - $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest); |
|
361 | + //1@@1;2;@@2;4;4;@@http://www.chamilo.org |
|
362 | + $dest= $try.'@@'.$lp.'@@'.$destination.'@@'.$url; |
|
363 | + $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | //Create 666 answer |
@@ -373,18 +373,18 @@ discard block |
||
373 | 373 | |
374 | 374 | $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest); |
375 | 375 | |
376 | - // saves the answers into the data base |
|
376 | + // saves the answers into the data base |
|
377 | 377 | $objAnswer -> save(); |
378 | 378 | |
379 | 379 | // sets the total weighting of the question |
380 | 380 | $this -> updateWeighting($questionWeighting); |
381 | 381 | $this -> save(); |
382 | - } |
|
382 | + } |
|
383 | 383 | |
384 | - function return_header($feedback_type = null, $counter = null, $score = null) |
|
384 | + function return_header($feedback_type = null, $counter = null, $score = null) |
|
385 | 385 | { |
386 | - $header = parent::return_header($feedback_type, $counter, $score); |
|
387 | - $header .= '<table class="'.$this->question_table_class .'"> |
|
386 | + $header = parent::return_header($feedback_type, $counter, $score); |
|
387 | + $header .= '<table class="'.$this->question_table_class .'"> |
|
388 | 388 | <tr> |
389 | 389 | <th>'.get_lang("Choice").'</th> |
390 | 390 | <th>'. get_lang("ExpectedChoice").'</th> |
@@ -392,5 +392,5 @@ discard block |
||
392 | 392 | $header .= '<th>'.get_lang("Comment").'</th>'; |
393 | 393 | $header .= '</tr>'; |
394 | 394 | return $header; |
395 | - } |
|
395 | + } |
|
396 | 396 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | $editor_config = array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '125'); |
41 | 41 | //this line define how many question by default appear when creating a choice question |
42 | - $nb_answers = isset($_POST['nb_answers']) ? (int) $_POST['nb_answers'] : 3; // The previous default value was 2. See task #1759. |
|
42 | + $nb_answers = isset($_POST['nb_answers']) ? (int) $_POST['nb_answers'] : 3; // The previous default value was 2. See task #1759. |
|
43 | 43 | $nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0)); |
44 | 44 | |
45 | 45 | /* |
@@ -55,20 +55,20 @@ discard block |
||
55 | 55 | if ($obj_ex->selectFeedbackType() == 1) { |
56 | 56 | $editor_config['Width'] = '250'; |
57 | 57 | $editor_config['Height'] = '110'; |
58 | - $comment_title = '<th width="50%" >' . get_lang('Comment') . '</th>'; |
|
59 | - $feedback_title = '<th width="50%" >' . get_lang('Scenario') . '</th>'; |
|
58 | + $comment_title = '<th width="50%" >'.get_lang('Comment').'</th>'; |
|
59 | + $feedback_title = '<th width="50%" >'.get_lang('Scenario').'</th>'; |
|
60 | 60 | } else { |
61 | - $comment_title = '<th width="50%">' . get_lang('Comment') . '</th>'; |
|
61 | + $comment_title = '<th width="50%">'.get_lang('Comment').'</th>'; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | $html = '<table class="table table-striped table-hover">'; |
65 | 65 | $html .= '<thead>'; |
66 | 66 | $html .= '<tr>'; |
67 | - $html .= '<th>' . get_lang('Number') . '</th>'; |
|
68 | - $html .= '<th>' . get_lang('True') . '</th>'; |
|
69 | - $html .= '<th width="50%">' . get_lang('Answer') . '</th>'; |
|
70 | - $html .= $comment_title . $feedback_title; |
|
71 | - $html .= '<th>' . get_lang('Weighting') . '</th>'; |
|
67 | + $html .= '<th>'.get_lang('Number').'</th>'; |
|
68 | + $html .= '<th>'.get_lang('True').'</th>'; |
|
69 | + $html .= '<th width="50%">'.get_lang('Answer').'</th>'; |
|
70 | + $html .= $comment_title.$feedback_title; |
|
71 | + $html .= '<th>'.get_lang('Weighting').'</th>'; |
|
72 | 72 | $html .= '</tr>'; |
73 | 73 | $html .= '</thead>'; |
74 | 74 | $html .= '<tbody>'; |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | $weight_result = '0'; |
136 | 136 | } |
137 | 137 | |
138 | - $defaults['answer[' . $i . ']'] = $answer_result; |
|
139 | - $defaults['comment[' . $i . ']'] = $answer->comment[$i]; |
|
140 | - $defaults['weighting[' . $i . ']'] = $weight_result; |
|
138 | + $defaults['answer['.$i.']'] = $answer_result; |
|
139 | + $defaults['comment['.$i.']'] = $answer->comment[$i]; |
|
140 | + $defaults['weighting['.$i.']'] = $weight_result; |
|
141 | 141 | |
142 | 142 | $item_list = explode('@@', $answer->destination[$i]); |
143 | 143 | |
@@ -156,10 +156,10 @@ discard block |
||
156 | 156 | else |
157 | 157 | $url_result = $url; |
158 | 158 | |
159 | - $temp_scenario['url' . $i] = $url_result; |
|
160 | - $temp_scenario['try' . $i] = $try_result; |
|
161 | - $temp_scenario['lp' . $i] = $lp; |
|
162 | - $temp_scenario['destination' . $i] = $list_dest; |
|
159 | + $temp_scenario['url'.$i] = $url_result; |
|
160 | + $temp_scenario['try'.$i] = $try_result; |
|
161 | + $temp_scenario['lp'.$i] = $lp; |
|
162 | + $temp_scenario['destination'.$i] = $list_dest; |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
@@ -172,30 +172,30 @@ discard block |
||
172 | 172 | ); |
173 | 173 | $renderer->setElementTemplate( |
174 | 174 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
175 | - 'counter[' . $i . ']' |
|
175 | + 'counter['.$i.']' |
|
176 | 176 | ); |
177 | 177 | $renderer->setElementTemplate( |
178 | 178 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
179 | - 'answer[' . $i . ']' |
|
179 | + 'answer['.$i.']' |
|
180 | 180 | ); |
181 | 181 | $renderer->setElementTemplate( |
182 | 182 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
183 | - 'comment[' . $i . ']' |
|
183 | + 'comment['.$i.']' |
|
184 | 184 | ); |
185 | 185 | $renderer->setElementTemplate( |
186 | 186 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
187 | - 'weighting[' . $i . ']' |
|
187 | + 'weighting['.$i.']' |
|
188 | 188 | ); |
189 | 189 | |
190 | - $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"'); |
|
190 | + $answer_number = $form->addElement('text', 'counter['.$i.']', null, 'value="'.$i.'"'); |
|
191 | 191 | $answer_number->freeze(); |
192 | 192 | |
193 | 193 | |
194 | 194 | $form->addElement('radio', 'correct', null, null, $i, 'class="checkbox" style="margin-left: 0em;"'); |
195 | - $form->addElement('html_editor', 'answer[' . $i . ']', null, array(), $editor_config); |
|
195 | + $form->addElement('html_editor', 'answer['.$i.']', null, array(), $editor_config); |
|
196 | 196 | |
197 | - $form->addElement('html_editor', 'comment[' . $i . ']', null, array(), $editor_config); |
|
198 | - $form->addElement('text', 'weighting[' . $i . ']', null, array('style' => 'width: 60px;', 'value' => '0')); |
|
197 | + $form->addElement('html_editor', 'comment['.$i.']', null, array(), $editor_config); |
|
198 | + $form->addElement('text', 'weighting['.$i.']', null, array('style' => 'width: 60px;', 'value' => '0')); |
|
199 | 199 | $form->addElement('html', '</tr>'); |
200 | 200 | $i++; |
201 | 201 | } |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | $form->addHtml('<tr>'); |
211 | 211 | |
212 | 212 | $defaults["counter[$i]"] = '-'; |
213 | - $defaults['answer[' . $i . ']'] = get_lang('DontKnow'); |
|
214 | - $defaults['weighting[' . $i . ']'] = '0'; |
|
213 | + $defaults['answer['.$i.']'] = get_lang('DontKnow'); |
|
214 | + $defaults['weighting['.$i.']'] = '0'; |
|
215 | 215 | $defaults['scenario'] = $temp_scenario; |
216 | 216 | $renderer = & $form->defaultRenderer(); |
217 | 217 | |
@@ -221,32 +221,32 @@ discard block |
||
221 | 221 | ); |
222 | 222 | $renderer->setElementTemplate( |
223 | 223 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
224 | - 'counter[' . $i . ']' |
|
224 | + 'counter['.$i.']' |
|
225 | 225 | ); |
226 | 226 | $renderer->setElementTemplate( |
227 | 227 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
228 | - 'answer[' . $i . ']' |
|
228 | + 'answer['.$i.']' |
|
229 | 229 | ); |
230 | 230 | $renderer->setElementTemplate( |
231 | 231 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
232 | - 'comment[' . $i . ']' |
|
232 | + 'comment['.$i.']' |
|
233 | 233 | ); |
234 | 234 | $renderer->setElementTemplate( |
235 | 235 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
236 | - 'weighting[' . $i . ']' |
|
236 | + 'weighting['.$i.']' |
|
237 | 237 | ); |
238 | 238 | |
239 | 239 | $form |
240 | - ->addElement('text', 'counter[' . $i . ']', null) |
|
240 | + ->addElement('text', 'counter['.$i.']', null) |
|
241 | 241 | ->freeze(); |
242 | 242 | |
243 | - $form->addElement('hidden', 'position[' . $i . ']', '666'); |
|
243 | + $form->addElement('hidden', 'position['.$i.']', '666'); |
|
244 | 244 | |
245 | 245 | $form->addElement('radio', 'correct', null, null, $i, ['class' => 'checkbox', 'disabled' => true]); |
246 | - $form->addElement('html_editor', 'answer[' . $i . ']', null, array(), $editor_config); |
|
246 | + $form->addElement('html_editor', 'answer['.$i.']', null, array(), $editor_config); |
|
247 | 247 | |
248 | - $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required'); |
|
249 | - $form->addElement('html_editor', 'comment[' . $i . ']', null, array(), $editor_config); |
|
248 | + $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required'); |
|
249 | + $form->addElement('html_editor', 'comment['.$i.']', null, array(), $editor_config); |
|
250 | 250 | |
251 | 251 | //$form->addElement('select', 'destination'.$i, get_lang('SelectQuestion').' : ',$select_question,'multiple'); |
252 | 252 | |
@@ -302,9 +302,9 @@ discard block |
||
302 | 302 | $minus = 0; |
303 | 303 | } |
304 | 304 | |
305 | - for ($i=1 ; $i <= $nb_answers - $minus; $i++) { |
|
306 | - $position = trim($form -> getSubmitValue('position['.$i.']')); |
|
307 | - $answer = trim($form -> getSubmitValue('answer['.$i.']')); |
|
305 | + for ($i = 1; $i <= $nb_answers - $minus; $i++) { |
|
306 | + $position = trim($form -> getSubmitValue('position['.$i.']')); |
|
307 | + $answer = trim($form -> getSubmitValue('answer['.$i.']')); |
|
308 | 308 | $comment = trim($form -> getSubmitValue('comment['.$i.']')); |
309 | 309 | $weighting = trim($form -> getSubmitValue('weighting['.$i.']')); |
310 | 310 | $scenario = $form -> getSubmitValue('scenario'); |
@@ -312,8 +312,8 @@ discard block |
||
312 | 312 | //$list_destination = $form -> getSubmitValue('destination'.$i); |
313 | 313 | //$destination_str = $form -> getSubmitValue('destination'.$i); |
314 | 314 | |
315 | - $try = $scenario['try'.$i]; |
|
316 | - $lp = $scenario['lp'.$i]; |
|
315 | + $try = $scenario['try'.$i]; |
|
316 | + $lp = $scenario['lp'.$i]; |
|
317 | 317 | $destination = $scenario['destination'.$i]; |
318 | 318 | $url = trim($scenario['url'.$i]); |
319 | 319 | |
@@ -337,34 +337,34 @@ discard block |
||
337 | 337 | $destination_str.=$destination_id.';'; |
338 | 338 | }*/ |
339 | 339 | |
340 | - $goodAnswer= ($correct == $i) ? true : false; |
|
340 | + $goodAnswer = ($correct == $i) ? true : false; |
|
341 | 341 | |
342 | 342 | if ($goodAnswer) { |
343 | 343 | $nbrGoodAnswers++; |
344 | 344 | $weighting = abs($weighting); |
345 | - if($weighting > 0) { |
|
345 | + if ($weighting > 0) { |
|
346 | 346 | $questionWeighting += $weighting; |
347 | 347 | } |
348 | 348 | } |
349 | 349 | |
350 | 350 | if (empty($try)) |
351 | - $try=0; |
|
351 | + $try = 0; |
|
352 | 352 | |
353 | 353 | if (empty($lp)) { |
354 | - $lp=0; |
|
354 | + $lp = 0; |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | if (empty($destination)) { |
358 | - $destination=0; |
|
358 | + $destination = 0; |
|
359 | 359 | } |
360 | 360 | |
361 | - if ($url=='') { |
|
362 | - $url=0; |
|
361 | + if ($url == '') { |
|
362 | + $url = 0; |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | //1@@1;2;@@2;4;4;@@http://www.chamilo.org |
366 | - $dest= $try.'@@'.$lp.'@@'.$destination.'@@'.$url; |
|
367 | - $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest); |
|
366 | + $dest = $try.'@@'.$lp.'@@'.$destination.'@@'.$url; |
|
367 | + $objAnswer -> createAnswer($answer, $goodAnswer, $comment, $weighting, $i, NULL, NULL, $dest); |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | //Create 666 answer |
@@ -372,10 +372,10 @@ discard block |
||
372 | 372 | $answer = trim($form -> getSubmitValue('answer['.$i.']')); |
373 | 373 | $comment = trim($form -> getSubmitValue('comment['.$i.']')); |
374 | 374 | $weighting = trim($form -> getSubmitValue('weighting['.$i.']')); |
375 | - $goodAnswer= ($correct == $i) ? true : false; |
|
375 | + $goodAnswer = ($correct == $i) ? true : false; |
|
376 | 376 | $dest = ''; |
377 | 377 | |
378 | - $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest); |
|
378 | + $objAnswer -> createAnswer($answer, $goodAnswer, $comment, $weighting, $i, NULL, NULL, $dest); |
|
379 | 379 | |
380 | 380 | // saves the answers into the data base |
381 | 381 | $objAnswer -> save(); |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | function return_header($feedback_type = null, $counter = null, $score = null) |
389 | 389 | { |
390 | 390 | $header = parent::return_header($feedback_type, $counter, $score); |
391 | - $header .= '<table class="'.$this->question_table_class .'"> |
|
391 | + $header .= '<table class="'.$this->question_table_class.'"> |
|
392 | 392 | <tr> |
393 | 393 | <th>'.get_lang("Choice").'</th> |
394 | 394 | <th>'. get_lang("ExpectedChoice").'</th> |
@@ -907,10 +907,10 @@ |
||
907 | 907 | <?php } else { ?> |
908 | 908 | <input class="form-control" type="text" name="weighting[<?php echo $i; ?>]" value="<?php echo (isset($weighting[$i]) ? $weighting[$i] : 10); ?>" /> |
909 | 909 | <?php |
910 | - } |
|
911 | - } |
|
912 | - if ($answerType == HOT_SPOT) { |
|
913 | - ?> |
|
910 | + } |
|
911 | + } |
|
912 | + if ($answerType == HOT_SPOT) { |
|
913 | + ?> |
|
914 | 914 | <input class="form-control" type="text" name="weighting[<?php echo $i; ?>]" value="<?php echo (isset($weighting[$i]) ? $weighting[$i] : 10); ?>" /> |
915 | 915 | <input type="hidden" name="hotspot_coordinates[<?php echo $i; ?>]" value="<?php echo (empty($hotspot_coordinates[$i]) ? '0;0|0|0' : $hotspot_coordinates[$i]); ?>" /> |
916 | 916 | <input type="hidden" name="hotspot_type[<?php echo $i; ?>]" value="<?php echo (empty($hotspot_type[$i]) ? 'square' : $hotspot_type[$i]); ?>" /> |
@@ -679,12 +679,15 @@ discard block |
||
679 | 679 | $option1 = $option2 = $option3 = ''; |
680 | 680 | for ($k = 1; $k <= 100; $k++) { |
681 | 681 | $selected1 = $selected2 = $selected3 = ''; |
682 | - if ($k == $threadhold1[$i]) |
|
683 | - $selected1 = 'selected="selected"'; |
|
684 | - if ($k == $threadhold2[$i]) |
|
685 | - $selected2 = 'selected="selected"'; |
|
686 | - if ($k == $threadhold3[$i]) |
|
687 | - $selected3 = 'selected="selected"'; |
|
682 | + if ($k == $threadhold1[$i]) { |
|
683 | + $selected1 = 'selected="selected"'; |
|
684 | + } |
|
685 | + if ($k == $threadhold2[$i]) { |
|
686 | + $selected2 = 'selected="selected"'; |
|
687 | + } |
|
688 | + if ($k == $threadhold3[$i]) { |
|
689 | + $selected3 = 'selected="selected"'; |
|
690 | + } |
|
688 | 691 | $option1.='<option ' . $selected1 . ' >' . $k . ' % </option>'; |
689 | 692 | $option2.='<option ' . $selected2 . ' >' . $k . ' % </option>'; |
690 | 693 | $option3.='<option ' . $selected3 . '>' . $k . ' %</option>'; |
@@ -731,7 +734,10 @@ discard block |
||
731 | 734 | <div class="checkbox"> |
732 | 735 | <p> |
733 | 736 | <label> |
734 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
737 | + <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) { |
|
738 | + echo'checked'; |
|
739 | +} |
|
740 | +?> /> |
|
735 | 741 | <?php echo get_lang('TryAgain'); ?> |
736 | 742 | </label> |
737 | 743 | </p> |
@@ -784,7 +790,10 @@ discard block |
||
784 | 790 | <div class="checkbox"> |
785 | 791 | <p> |
786 | 792 | <label> |
787 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
793 | + <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) { |
|
794 | + echo'checked'; |
|
795 | +} |
|
796 | +?> /> |
|
788 | 797 | <?php echo get_lang('TryAgain'); ?> |
789 | 798 | </label> |
790 | 799 | </p> |
@@ -823,7 +832,10 @@ discard block |
||
823 | 832 | <th ><?php echo get_lang('OAR'); ?>*</th> |
824 | 833 | <?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?> |
825 | 834 | <th colspan="2" ><?php echo get_lang('Comment'); ?></th> |
826 | - <th ><?php if ($answerType == HOT_SPOT_DELINEATION) echo get_lang('Scenario'); ?></th> |
|
835 | + <th ><?php if ($answerType == HOT_SPOT_DELINEATION) { |
|
836 | + echo get_lang('Scenario'); |
|
837 | +} |
|
838 | +?></th> |
|
827 | 839 | <?php } else { ?> |
828 | 840 | <th colspan="3" ><?php echo get_lang('Comment'); ?></th> |
829 | 841 | <?php } ?> |
@@ -849,7 +861,10 @@ discard block |
||
849 | 861 | <div class="checkbox"> |
850 | 862 | <p> |
851 | 863 | <label> |
852 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) echo'checked'; ?> /> |
|
864 | + <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) { |
|
865 | + echo'checked'; |
|
866 | +} |
|
867 | +?> /> |
|
853 | 868 | <?php echo get_lang('TryAgain'); ?> |
854 | 869 | </label> |
855 | 870 | </p> |
@@ -998,7 +1013,10 @@ discard block |
||
998 | 1013 | <div class="checkbox"> |
999 | 1014 | <p> |
1000 | 1015 | <label> |
1001 | - <input type="checkbox" class="checkbox" name="try_noerror" <?php if ($try_noerror == 1) echo'checked'; ?> /> |
|
1016 | + <input type="checkbox" class="checkbox" name="try_noerror" <?php if ($try_noerror == 1) { |
|
1017 | + echo'checked'; |
|
1018 | +} |
|
1019 | +?> /> |
|
1002 | 1020 | <?php echo get_lang('TryAgain'); ?> |
1003 | 1021 | </label> |
1004 | 1022 | </p> |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | if ($modifyIn) { |
28 | 28 | if ($debug > 0) { |
29 | - echo '$modifyIn was set' . "<br />\n"; |
|
29 | + echo '$modifyIn was set'."<br />\n"; |
|
30 | 30 | } |
31 | 31 | // if the user has chosen to modify the question only in the current exercise |
32 | 32 | if ($modifyIn == 'thisExercise') { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | unset($buttonBack); |
66 | 66 | } |
67 | 67 | |
68 | -$hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercise/admin.php?' . api_get_cidreq() . '&exerciseId=' . $exerciseId; |
|
68 | +$hotspot_admin_url = api_get_path(WEB_CODE_PATH).'exercise/admin.php?'.api_get_cidreq().'&exerciseId='.$exerciseId; |
|
69 | 69 | |
70 | 70 | // the answer form has been submitted |
71 | 71 | $submitAnswers = isset($_POST['submitAnswers']) ? true : false; |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | if ($submitAnswers || $buttonBack) { |
76 | 76 | if ($answerType == HOT_SPOT) { |
77 | 77 | if ($debug > 0) { |
78 | - echo '$submitAnswers or $buttonBack was set' . "<br />\n"; |
|
78 | + echo '$submitAnswers or $buttonBack was set'."<br />\n"; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | $questionWeighting = $nbrGoodAnswers = 0; |
82 | 82 | for ($i = 1; $i <= $nbrAnswers; $i++) { |
83 | 83 | if ($debug > 0) { |
84 | - echo str_repeat(' ', 4) . '$answerType is HOT_SPOT' . "<br />\n"; |
|
84 | + echo str_repeat(' ', 4).'$answerType is HOT_SPOT'."<br />\n"; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | $reponse[$i] = trim($reponse[$i]); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | if (empty($msgErr)) { |
116 | 116 | for ($i = 1; $i <= $nbrAnswers; $i++) { |
117 | 117 | if ($debug > 0) { |
118 | - echo str_repeat(' ', 4) . '$answerType is HOT_SPOT' . "<br />\n"; |
|
118 | + echo str_repeat(' ', 4).'$answerType is HOT_SPOT'."<br />\n"; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | $reponse[$i] = trim($reponse[$i]); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $weighting[$i] = ($weighting[$i]); //it can be float |
124 | 124 | |
125 | 125 | if ($weighting[$i]) { |
126 | - $questionWeighting+=$weighting[$i]; |
|
126 | + $questionWeighting += $weighting[$i]; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | // creates answer |
@@ -146,15 +146,15 @@ discard block |
||
146 | 146 | |
147 | 147 | $editQuestion = $questionId; |
148 | 148 | unset($modifyAnswers); |
149 | - echo '<script type="text/javascript">window.location.href="' . $hotspot_admin_url . '&message=ItemUpdated"</script>'; |
|
149 | + echo '<script type="text/javascript">window.location.href="'.$hotspot_admin_url.'&message=ItemUpdated"</script>'; |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | if ($debug > 0) { |
153 | - echo '$modifyIn was set - end' . "<br />\n"; |
|
153 | + echo '$modifyIn was set - end'."<br />\n"; |
|
154 | 154 | } |
155 | 155 | } else { |
156 | 156 | if ($debug > 0) { |
157 | - echo '$submitAnswers or $buttonBack was set' . "<br />\n"; |
|
157 | + echo '$submitAnswers or $buttonBack was set'."<br />\n"; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | $questionWeighting = $nbrGoodAnswers = 0; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | for ($i = 1; $i <= $nbrAnswers; $i++) { |
171 | 171 | if ($debug > 0) { |
172 | - echo str_repeat(' ', 4) . '$answerType is HOT_SPOT' . "<br />\n"; |
|
172 | + echo str_repeat(' ', 4).'$answerType is HOT_SPOT'."<br />\n"; |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | $reponse[$i] = trim($reponse[$i]); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $threadhold3_str = intval($threadhold3[$i]); |
195 | 195 | } |
196 | 196 | |
197 | - $threadhold_total = $threadhold1_str . ';' . $threadhold2_str . ';' . $threadhold3_str; |
|
197 | + $threadhold_total = $threadhold1_str.';'.$threadhold2_str.';'.$threadhold3_str; |
|
198 | 198 | |
199 | 199 | if (isset($try[$i]) && $try[$i] == 'on') { |
200 | 200 | $try_str = 1; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $question_str = $select_question[$i]; |
221 | 221 | } |
222 | 222 | |
223 | - $destination[$i] = $threadhold_total . '@@' . $try_str . '@@' . $lp_str . '@@' . $question_str . '@@' . $url_str; |
|
223 | + $destination[$i] = $threadhold_total.'@@'.$try_str.'@@'.$lp_str.'@@'.$question_str.'@@'.$url_str; |
|
224 | 224 | |
225 | 225 | // checks if field is empty |
226 | 226 | if (empty($reponse[$i]) && $reponse[$i] != '0') { |
@@ -278,12 +278,12 @@ discard block |
||
278 | 278 | $question_str = $selectQuestionNoError; |
279 | 279 | } |
280 | 280 | |
281 | - $destination_noerror = $threadhold_total . '@@' . $try_str . '@@' . $lp_str . '@@' . $question_str . '@@' . $url_str; |
|
281 | + $destination_noerror = $threadhold_total.'@@'.$try_str.'@@'.$lp_str.'@@'.$question_str.'@@'.$url_str; |
|
282 | 282 | |
283 | 283 | if (empty($msgErr)) { |
284 | 284 | for ($i = 1; $i <= $nbrAnswers; $i++) { |
285 | 285 | if ($debug > 0) { |
286 | - echo str_repeat(' ', 4) . '$answerType is HOT_SPOT' . "<br />\n"; |
|
286 | + echo str_repeat(' ', 4).'$answerType is HOT_SPOT'."<br />\n"; |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | $reponse[$i] = trim($reponse[$i]); |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | $weighting[$i] = ($weighting[$i]); //it can be float |
292 | 292 | |
293 | 293 | if ($weighting[$i]) { |
294 | - $questionWeighting+=$weighting[$i]; |
|
294 | + $questionWeighting += $weighting[$i]; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | // creates answer |
@@ -326,14 +326,14 @@ discard block |
||
326 | 326 | |
327 | 327 | $editQuestion = $questionId; |
328 | 328 | unset($modifyAnswers); |
329 | - echo '<script type="text/javascript">window.location.href="' . $hotspot_admin_url . '&message=ItemUpdated"</script>'; |
|
329 | + echo '<script type="text/javascript">window.location.href="'.$hotspot_admin_url.'&message=ItemUpdated"</script>'; |
|
330 | 330 | } |
331 | 331 | } |
332 | 332 | } |
333 | 333 | |
334 | 334 | if ($modifyAnswers) { |
335 | 335 | if ($debug > 0) { |
336 | - echo str_repeat(' ', 0) . '$modifyAnswers is set' . "<br />\n"; |
|
336 | + echo str_repeat(' ', 0).'$modifyAnswers is set'."<br />\n"; |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | // construction of the Answer object |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | Session::write('objAnswer', $objAnswer); |
342 | 342 | |
343 | 343 | if ($debug > 0) { |
344 | - echo str_repeat(' ', 2) . '$answerType is HOT_SPOT' . "<br />\n"; |
|
344 | + echo str_repeat(' ', 2).'$answerType is HOT_SPOT'."<br />\n"; |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | if ($answerType == HOT_SPOT_DELINEATION) { |
@@ -523,11 +523,11 @@ discard block |
||
523 | 523 | } |
524 | 524 | |
525 | 525 | if ($debug > 0) { |
526 | - echo str_repeat(' ', 2) . '$usedInSeveralExercises is untrue' . "<br />\n"; |
|
526 | + echo str_repeat(' ', 2).'$usedInSeveralExercises is untrue'."<br />\n"; |
|
527 | 527 | } |
528 | 528 | |
529 | 529 | if ($debug > 0) { |
530 | - echo str_repeat(' ', 4) . '$answerType is HOT_SPOT' . "<br />\n"; |
|
530 | + echo str_repeat(' ', 4).'$answerType is HOT_SPOT'."<br />\n"; |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | if ($answerType == HOT_SPOT_DELINEATION) { |
@@ -567,14 +567,14 @@ discard block |
||
567 | 567 | |
568 | 568 | Display::tag( |
569 | 569 | 'h3', |
570 | - get_lang('Question') . ": " . $questionName . Display::return_icon('info3.gif', strip_tags(get_lang('HotspotChoose'))) |
|
570 | + get_lang('Question').": ".$questionName.Display::return_icon('info3.gif', strip_tags(get_lang('HotspotChoose'))) |
|
571 | 571 | ); |
572 | 572 | |
573 | 573 | if (!empty($msgErr)) { |
574 | 574 | Display::display_normal_message($msgErr); //main API |
575 | 575 | } |
576 | 576 | |
577 | - $hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercise/admin.php?' . api_get_cidreq() . '&hotspotadmin=' . $modifyAnswers . '&exerciseId=' . $exerciseId . '&' . api_get_cidreq(); |
|
577 | + $hotspot_admin_url = api_get_path(WEB_CODE_PATH).'exercise/admin.php?'.api_get_cidreq().'&hotspotadmin='.$modifyAnswers.'&exerciseId='.$exerciseId.'&'.api_get_cidreq(); |
|
578 | 578 | ?> |
579 | 579 | <form method="post" action="<?php echo $hotspot_admin_url; ?>" class="form-horizontal" id="frm_exercise" name="frm_exercise"> |
580 | 580 | <div class="form-group"> |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | <th><?php echo get_lang('Comment'); ?></th> |
612 | 612 | <?php |
613 | 613 | if ($answerType == HOT_SPOT_DELINEATION) { |
614 | - echo '<th >' . get_lang('Scenario') . '</th>'; |
|
614 | + echo '<th >'.get_lang('Scenario').'</th>'; |
|
615 | 615 | } |
616 | 616 | } else { ?> |
617 | 617 | <th colspan="2"> |
@@ -640,36 +640,36 @@ discard block |
||
640 | 640 | $isSelected = true; |
641 | 641 | $selected = 'selected="selected"'; |
642 | 642 | } |
643 | - $option_lp.='<option value="' . $id . '" ' . $selected . '>' . $details['lp_name'] . '</option>'; |
|
643 | + $option_lp .= '<option value="'.$id.'" '.$selected.'>'.$details['lp_name'].'</option>'; |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | if ($isSelected) { |
647 | - $option_lp = '<option value="0">' . get_lang('SelectTargetLP') . '</option>' . $option_lp; |
|
647 | + $option_lp = '<option value="0">'.get_lang('SelectTargetLP').'</option>'.$option_lp; |
|
648 | 648 | } else { |
649 | - $option_lp = '<option value="0" selected="selected" >' . get_lang('SelectTargetLP') . '</option>' . $option_lp; |
|
649 | + $option_lp = '<option value="0" selected="selected" >'.get_lang('SelectTargetLP').'</option>'.$option_lp; |
|
650 | 650 | } |
651 | 651 | |
652 | 652 | // Feedback SELECT |
653 | 653 | $question_list = $objExercise->selectQuestionList(); |
654 | 654 | $option_feed = ''; |
655 | - $option_feed.='<option value="0">' . get_lang('SelectTargetQuestion') . '</option>'; |
|
655 | + $option_feed .= '<option value="0">'.get_lang('SelectTargetQuestion').'</option>'; |
|
656 | 656 | |
657 | 657 | foreach ($question_list as $key => $questionid) { |
658 | 658 | $selected = ''; |
659 | 659 | $question = Question::read($questionid); |
660 | - $val = 'Q' . $key . ' :' . substrwords($question->selectTitle(), ICON_SIZE_SMALL); |
|
660 | + $val = 'Q'.$key.' :'.substrwords($question->selectTitle(), ICON_SIZE_SMALL); |
|
661 | 661 | |
662 | 662 | if (isset($select_question[$i]) && $questionid == $select_question[$i]) { |
663 | 663 | $selected = 'selected="selected"'; |
664 | 664 | } |
665 | 665 | |
666 | - $option_feed.='<option value="' . $questionid . '" ' . $selected . ' >' . $val . '</option>'; |
|
666 | + $option_feed .= '<option value="'.$questionid.'" '.$selected.' >'.$val.'</option>'; |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | if (isset($select_question[$i]) && $select_question[$i] == -1) { |
670 | - $option_feed .= '<option value="-1" selected="selected" >' . get_lang('ExitTest') . '</option>'; |
|
670 | + $option_feed .= '<option value="-1" selected="selected" >'.get_lang('ExitTest').'</option>'; |
|
671 | 671 | } else { |
672 | - $option_feed .= '<option value="-1">' . get_lang('ExitTest') . '</option>'; |
|
672 | + $option_feed .= '<option value="-1">'.get_lang('ExitTest').'</option>'; |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | //-------- IF it is a delineation |
@@ -683,9 +683,9 @@ discard block |
||
683 | 683 | $selected2 = 'selected="selected"'; |
684 | 684 | if ($k == $threadhold3[$i]) |
685 | 685 | $selected3 = 'selected="selected"'; |
686 | - $option1.='<option ' . $selected1 . ' >' . $k . ' % </option>'; |
|
687 | - $option2.='<option ' . $selected2 . ' >' . $k . ' % </option>'; |
|
688 | - $option3.='<option ' . $selected3 . '>' . $k . ' %</option>'; |
|
686 | + $option1 .= '<option '.$selected1.' >'.$k.' % </option>'; |
|
687 | + $option2 .= '<option '.$selected2.' >'.$k.' % </option>'; |
|
688 | + $option3 .= '<option '.$selected3.'>'.$k.' %</option>'; |
|
689 | 689 | } |
690 | 690 | ?> |
691 | 691 | <tr> |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | <div class="checkbox"> |
730 | 730 | <p> |
731 | 731 | <label> |
732 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
732 | + <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
733 | 733 | <?php echo get_lang('TryAgain'); ?> |
734 | 734 | </label> |
735 | 735 | </p> |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | <div class="checkbox"> |
783 | 783 | <p> |
784 | 784 | <label> |
785 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
785 | + <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
786 | 786 | <?php echo get_lang('TryAgain'); ?> |
787 | 787 | </label> |
788 | 788 | </p> |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | <div class="checkbox"> |
848 | 848 | <p> |
849 | 849 | <label> |
850 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) echo'checked'; ?> /> |
|
850 | + <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) echo'checked'; ?> /> |
|
851 | 851 | <?php echo get_lang('TryAgain'); ?> |
852 | 852 | </label> |
853 | 853 | </p> |
@@ -887,12 +887,12 @@ discard block |
||
887 | 887 | <input class="form-control" type="text" name="reponse[<?php echo $i; ?>]" value="<?php echo Security::remove_XSS($responseValue); ?>" /> |
888 | 888 | </td> |
889 | 889 | <?php |
890 | - $form = new FormValidator('form_' . $i); |
|
890 | + $form = new FormValidator('form_'.$i); |
|
891 | 891 | $config = array( |
892 | 892 | 'ToolbarSet' => 'TestProposedAnswer', |
893 | 893 | 'cols-size' => [0, 12, 0] |
894 | 894 | ); |
895 | - $form->addHtmlEditor('comment[' . $i . ']', null, false, false, $config); |
|
895 | + $form->addHtmlEditor('comment['.$i.']', null, false, false, $config); |
|
896 | 896 | $renderer = $form->defaultRenderer(); |
897 | 897 | $form_template = '{content}'; |
898 | 898 | $renderer->setFormTemplate($form_template); |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | {element}'; |
902 | 902 | $renderer->setElementTemplate($element_template); |
903 | 903 | |
904 | - $form->setDefaults(array('comment[' . $i . ']' => $commentValue)); |
|
904 | + $form->setDefaults(array('comment['.$i.']' => $commentValue)); |
|
905 | 905 | $return = $form->return_form(); |
906 | 906 | ?> |
907 | 907 | <td colspan="2" align="left" ><?php echo $return; ?></td> |
@@ -938,35 +938,35 @@ discard block |
||
938 | 938 | $selected = 'selected="selected"'; |
939 | 939 | $isSelected = true; |
940 | 940 | } |
941 | - $option_lp.='<option value="' . $id . '" ' . $selected . '>' . $details['lp_name'] . '</option>'; |
|
941 | + $option_lp .= '<option value="'.$id.'" '.$selected.'>'.$details['lp_name'].'</option>'; |
|
942 | 942 | } |
943 | 943 | |
944 | 944 | if ($isSelected) { |
945 | - $option_lp = '<option value="0">' . get_lang('SelectTargetLP') . '</option>' . $option_lp; |
|
945 | + $option_lp = '<option value="0">'.get_lang('SelectTargetLP').'</option>'.$option_lp; |
|
946 | 946 | } else { |
947 | - $option_lp = '<option value="0" selected="selected" >' . get_lang('SelectTargetLP') . '</option>' . $option_lp; |
|
947 | + $option_lp = '<option value="0" selected="selected" >'.get_lang('SelectTargetLP').'</option>'.$option_lp; |
|
948 | 948 | } |
949 | 949 | |
950 | 950 | // Feedback SELECT |
951 | 951 | $question_list = $objExercise->selectQuestionList(); |
952 | 952 | $option_feed = ''; |
953 | - $option_feed.='<option value="0">' . get_lang('SelectTargetQuestion') . '</option>'; |
|
953 | + $option_feed .= '<option value="0">'.get_lang('SelectTargetQuestion').'</option>'; |
|
954 | 954 | $details = isset($details) ? $details : null; |
955 | 955 | $id = isset($id) ? $id : 0; |
956 | 956 | $selectQuestionNoError = isset($selectQuestionNoError) ? $selectQuestionNoError : null; |
957 | 957 | foreach ($question_list as $key => $questionid) { |
958 | 958 | $selected = ''; |
959 | 959 | $question = Question::read($questionid); |
960 | - $val = 'Q' . $key . ' :' . substrwords($question->selectTitle(), ICON_SIZE_SMALL); |
|
960 | + $val = 'Q'.$key.' :'.substrwords($question->selectTitle(), ICON_SIZE_SMALL); |
|
961 | 961 | if ($questionid == $selectQuestionNoError) { |
962 | 962 | $selected = 'selected="selected"'; |
963 | 963 | } |
964 | - $option_feed.='<option value="' . $questionid . '" ' . $selected . ' >' . $val . '</option>'; |
|
964 | + $option_feed .= '<option value="'.$questionid.'" '.$selected.' >'.$val.'</option>'; |
|
965 | 965 | } |
966 | 966 | if ($selectQuestionNoError == -1) { |
967 | - $option_feed.='<option value="-1" selected="selected" >' . get_lang('ExitTest') . '</option>'; |
|
967 | + $option_feed .= '<option value="-1" selected="selected" >'.get_lang('ExitTest').'</option>'; |
|
968 | 968 | } else { |
969 | - $option_feed.='<option value="-1">' . get_lang('ExitTest') . '</option>'; |
|
969 | + $option_feed .= '<option value="-1">'.get_lang('ExitTest').'</option>'; |
|
970 | 970 | } |
971 | 971 | |
972 | 972 | if ($answerType == HOT_SPOT_DELINEATION) { |
@@ -1057,6 +1057,6 @@ discard block |
||
1057 | 1057 | </script> |
1058 | 1058 | <?php |
1059 | 1059 | if ($debug > 0) { |
1060 | - echo str_repeat(' ', 0) . '$modifyAnswers was set - end' . "<br />\n"; |
|
1060 | + echo str_repeat(' ', 0).'$modifyAnswers was set - end'."<br />\n"; |
|
1061 | 1061 | } |
1062 | 1062 | } |
@@ -13,14 +13,14 @@ discard block |
||
13 | 13 | $nameTools=get_lang('ExerciseManagement'); |
14 | 14 | |
15 | 15 | if (isset($_SESSION['gradebook'])){ |
16 | - $gradebook= $_SESSION['gradebook']; |
|
16 | + $gradebook= $_SESSION['gradebook']; |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | if (!empty($gradebook) && $gradebook=='view') { |
20 | - $interbreadcrumb[]= array ( |
|
21 | - 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
|
22 | - 'name' => get_lang('ToolGradebook') |
|
23 | - ); |
|
20 | + $interbreadcrumb[]= array ( |
|
21 | + 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
|
22 | + 'name' => get_lang('ToolGradebook') |
|
23 | + ); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | $interbreadcrumb[]=array("url" => "exercise.php","name" => get_lang('Exercises')); |
@@ -31,24 +31,24 @@ discard block |
||
31 | 31 | <?php echo "Add Feedback"; ?> |
32 | 32 | </h4> |
33 | 33 | <?php |
34 | - $id = $_REQUEST['question']; |
|
35 | - $objQuestionTmp = Question::read($id); |
|
36 | - echo "<tr><td><b>".get_lang('Question')." : </b>"; |
|
37 | - echo $objQuestionTmp->selectTitle(); |
|
38 | - echo "</td></tr>"; |
|
39 | - echo " <br><tr><td><b><br>".get_lang('Answer')." : </b></td></tr>"; |
|
40 | - $objAnswerTmp=new Answer($id); |
|
41 | - $num = $objAnswerTmp->selectNbrAnswers(); |
|
42 | - $objAnswerTmp->read(); |
|
43 | - for($i=1;$i<=$num;$i++) |
|
44 | - { |
|
45 | - echo "<tr><td width='10%'> "; |
|
46 | - $ans = $objAnswerTmp->answer[$i]; |
|
34 | + $id = $_REQUEST['question']; |
|
35 | + $objQuestionTmp = Question::read($id); |
|
36 | + echo "<tr><td><b>".get_lang('Question')." : </b>"; |
|
37 | + echo $objQuestionTmp->selectTitle(); |
|
38 | + echo "</td></tr>"; |
|
39 | + echo " <br><tr><td><b><br>".get_lang('Answer')." : </b></td></tr>"; |
|
40 | + $objAnswerTmp=new Answer($id); |
|
41 | + $num = $objAnswerTmp->selectNbrAnswers(); |
|
42 | + $objAnswerTmp->read(); |
|
43 | + for($i=1;$i<=$num;$i++) |
|
44 | + { |
|
45 | + echo "<tr><td width='10%'> "; |
|
46 | + $ans = $objAnswerTmp->answer[$i]; |
|
47 | 47 | |
48 | - $form = new FormValidator('feedbackform','post',api_get_self()."?".api_get_cidreq()."&modifyQuestion=".$modifyQuestion."&newQuestion=".$newQuestion); |
|
49 | - $obj_registration_form = new HTML_QuickForm('frmRegistration', 'POST'); |
|
50 | - $renderer =& $obj_registration_form->defaultRenderer(); |
|
51 | - $renderer->setCustomElementTemplate( |
|
48 | + $form = new FormValidator('feedbackform','post',api_get_self()."?".api_get_cidreq()."&modifyQuestion=".$modifyQuestion."&newQuestion=".$newQuestion); |
|
49 | + $obj_registration_form = new HTML_QuickForm('frmRegistration', 'POST'); |
|
50 | + $renderer =& $obj_registration_form->defaultRenderer(); |
|
51 | + $renderer->setCustomElementTemplate( |
|
52 | 52 | '<tr> |
53 | 53 | <td align="left" style="" valign="top" width=30%>{label} |
54 | 54 | <!-- BEGIN required --><span style="color: #ff0000">*</span><!-- END required --> |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | <!-- BEGIN error --><br /><span style="color: #ff0000;font-size:10px">{error}</span><!-- END error --> |
58 | 58 | </td> |
59 | 59 | </tr>'); |
60 | - $form->addHtmlEditor('Feedback', $i.'.'.$ans, false, false, array('ToolbarSet' => 'TestAnswerFeedback', 'Width' => '600', 'Height' => '200')); |
|
61 | - $form->display(); |
|
62 | - echo "</td>"; |
|
63 | - }?> |
|
60 | + $form->addHtmlEditor('Feedback', $i.'.'.$ans, false, false, array('ToolbarSet' => 'TestAnswerFeedback', 'Width' => '600', 'Height' => '200')); |
|
61 | + $form->display(); |
|
62 | + echo "</td>"; |
|
63 | + }?> |
|
64 | 64 | <form name="frm" action="javascript: void(0);" method="post"> |
65 | 65 | Click Ok to finish <input type="submit" value="Ok" /> |
66 | 66 | </form> |
@@ -8,23 +8,23 @@ discard block |
||
8 | 8 | * @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $ |
9 | 9 | */ |
10 | 10 | require_once __DIR__.'/../inc/global.inc.php'; |
11 | -$this_section=SECTION_COURSES; |
|
11 | +$this_section = SECTION_COURSES; |
|
12 | 12 | |
13 | -$nameTools=get_lang('ExerciseManagement'); |
|
13 | +$nameTools = get_lang('ExerciseManagement'); |
|
14 | 14 | |
15 | -if (isset($_SESSION['gradebook'])){ |
|
16 | - $gradebook= $_SESSION['gradebook']; |
|
15 | +if (isset($_SESSION['gradebook'])) { |
|
16 | + $gradebook = $_SESSION['gradebook']; |
|
17 | 17 | } |
18 | 18 | |
19 | -if (!empty($gradebook) && $gradebook=='view') { |
|
20 | - $interbreadcrumb[]= array ( |
|
19 | +if (!empty($gradebook) && $gradebook == 'view') { |
|
20 | + $interbreadcrumb[] = array( |
|
21 | 21 | 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
22 | 22 | 'name' => get_lang('ToolGradebook') |
23 | 23 | ); |
24 | 24 | } |
25 | 25 | |
26 | -$interbreadcrumb[]=array("url" => "exercise.php","name" => get_lang('Exercises')); |
|
27 | -Display::display_header($nameTools,"Exercises"); |
|
26 | +$interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises')); |
|
27 | +Display::display_header($nameTools, "Exercises"); |
|
28 | 28 | ?> |
29 | 29 | <table border="0" align="center" cellpadding="2" cellspacing="2" width="100%"> |
30 | 30 | <h4> |
@@ -37,17 +37,17 @@ discard block |
||
37 | 37 | echo $objQuestionTmp->selectTitle(); |
38 | 38 | echo "</td></tr>"; |
39 | 39 | echo " <br><tr><td><b><br>".get_lang('Answer')." : </b></td></tr>"; |
40 | - $objAnswerTmp=new Answer($id); |
|
40 | + $objAnswerTmp = new Answer($id); |
|
41 | 41 | $num = $objAnswerTmp->selectNbrAnswers(); |
42 | 42 | $objAnswerTmp->read(); |
43 | - for($i=1;$i<=$num;$i++) |
|
43 | + for ($i = 1; $i <= $num; $i++) |
|
44 | 44 | { |
45 | 45 | echo "<tr><td width='10%'> "; |
46 | - $ans = $objAnswerTmp->answer[$i]; |
|
46 | + $ans = $objAnswerTmp->answer[$i]; |
|
47 | 47 | |
48 | - $form = new FormValidator('feedbackform','post',api_get_self()."?".api_get_cidreq()."&modifyQuestion=".$modifyQuestion."&newQuestion=".$newQuestion); |
|
48 | + $form = new FormValidator('feedbackform', 'post', api_get_self()."?".api_get_cidreq()."&modifyQuestion=".$modifyQuestion."&newQuestion=".$newQuestion); |
|
49 | 49 | $obj_registration_form = new HTML_QuickForm('frmRegistration', 'POST'); |
50 | - $renderer =& $obj_registration_form->defaultRenderer(); |
|
50 | + $renderer = & $obj_registration_form->defaultRenderer(); |
|
51 | 51 | $renderer->setCustomElementTemplate( |
52 | 52 | '<tr> |
53 | 53 | <td align="left" style="" valign="top" width=30%>{label} |
@@ -14,19 +14,19 @@ discard block |
||
14 | 14 | $hotspot_lang_file = api_get_path(SYS_LANG_PATH); |
15 | 15 | |
16 | 16 | if(isset($_GET['lang'])) { |
17 | - //$search = array('../','\\0','\\'); |
|
18 | - $lang = urldecode($_GET['lang']); |
|
19 | - if (preg_match('/^[a-zA-Z0-9\._-]+$/', $lang)) { |
|
20 | - //$lang = str_replace($search,$replace,urldecode($_GET['lang'])); |
|
21 | - if(file_exists($hotspot_lang_file . $lang . '/hotspot.inc.php')) |
|
22 | - $hotspot_lang_file .= $lang . '/hotspot.inc.php'; |
|
23 | - else |
|
24 | - $hotspot_lang_file .= 'english/hotspot.inc.php'; |
|
25 | - } else { |
|
26 | - $hotspot_lang_file .= 'english/hotspot.inc.php'; |
|
27 | - } |
|
17 | + //$search = array('../','\\0','\\'); |
|
18 | + $lang = urldecode($_GET['lang']); |
|
19 | + if (preg_match('/^[a-zA-Z0-9\._-]+$/', $lang)) { |
|
20 | + //$lang = str_replace($search,$replace,urldecode($_GET['lang'])); |
|
21 | + if(file_exists($hotspot_lang_file . $lang . '/hotspot.inc.php')) |
|
22 | + $hotspot_lang_file .= $lang . '/hotspot.inc.php'; |
|
23 | + else |
|
24 | + $hotspot_lang_file .= 'english/hotspot.inc.php'; |
|
25 | + } else { |
|
26 | + $hotspot_lang_file .= 'english/hotspot.inc.php'; |
|
27 | + } |
|
28 | 28 | } else { |
29 | - $hotspot_lang_file .= 'english/hotspot.inc.php'; |
|
29 | + $hotspot_lang_file .= 'english/hotspot.inc.php'; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $file = file($hotspot_lang_file); |
@@ -35,23 +35,23 @@ discard block |
||
35 | 35 | |
36 | 36 | foreach($file as $value) |
37 | 37 | { |
38 | - $explode = explode('=', $value); |
|
38 | + $explode = explode('=', $value); |
|
39 | 39 | |
40 | - if(count($explode) > 1) |
|
41 | - { |
|
42 | - $explode[0] = trim($explode[0]); |
|
43 | - $explode[0] = '&' . substr($explode[0], 1, strlen($explode[0])); |
|
40 | + if(count($explode) > 1) |
|
41 | + { |
|
42 | + $explode[0] = trim($explode[0]); |
|
43 | + $explode[0] = '&' . substr($explode[0], 1, strlen($explode[0])); |
|
44 | 44 | |
45 | - $explode[1] = trim($explode[1]); |
|
46 | - $explode[1] = substr($explode[1], 0, strlen($explode[1]) - 1); |
|
47 | - $explode[1] = str_replace('"', '', $explode[1]); |
|
45 | + $explode[1] = trim($explode[1]); |
|
46 | + $explode[1] = substr($explode[1], 0, strlen($explode[1]) - 1); |
|
47 | + $explode[1] = str_replace('"', '', $explode[1]); |
|
48 | 48 | |
49 | - $temp[] = $explode[0] . '=' . $explode[1]; |
|
50 | - } |
|
49 | + $temp[] = $explode[0] . '=' . $explode[1]; |
|
50 | + } |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | foreach($temp as $value) |
54 | 54 | { |
55 | - echo $value . ' '; |
|
55 | + echo $value . ' '; |
|
56 | 56 | } |
57 | 57 | ?> |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | |
14 | 14 | $hotspot_lang_file = api_get_path(SYS_LANG_PATH); |
15 | 15 | |
16 | -if(isset($_GET['lang'])) { |
|
16 | +if (isset($_GET['lang'])) { |
|
17 | 17 | //$search = array('../','\\0','\\'); |
18 | 18 | $lang = urldecode($_GET['lang']); |
19 | 19 | if (preg_match('/^[a-zA-Z0-9\._-]+$/', $lang)) { |
20 | 20 | //$lang = str_replace($search,$replace,urldecode($_GET['lang'])); |
21 | - if(file_exists($hotspot_lang_file . $lang . '/hotspot.inc.php')) |
|
22 | - $hotspot_lang_file .= $lang . '/hotspot.inc.php'; |
|
21 | + if (file_exists($hotspot_lang_file.$lang.'/hotspot.inc.php')) |
|
22 | + $hotspot_lang_file .= $lang.'/hotspot.inc.php'; |
|
23 | 23 | else |
24 | 24 | $hotspot_lang_file .= 'english/hotspot.inc.php'; |
25 | 25 | } else { |
@@ -33,25 +33,25 @@ discard block |
||
33 | 33 | |
34 | 34 | $temp = array(); |
35 | 35 | |
36 | -foreach($file as $value) |
|
36 | +foreach ($file as $value) |
|
37 | 37 | { |
38 | 38 | $explode = explode('=', $value); |
39 | 39 | |
40 | - if(count($explode) > 1) |
|
40 | + if (count($explode) > 1) |
|
41 | 41 | { |
42 | 42 | $explode[0] = trim($explode[0]); |
43 | - $explode[0] = '&' . substr($explode[0], 1, strlen($explode[0])); |
|
43 | + $explode[0] = '&'.substr($explode[0], 1, strlen($explode[0])); |
|
44 | 44 | |
45 | 45 | $explode[1] = trim($explode[1]); |
46 | 46 | $explode[1] = substr($explode[1], 0, strlen($explode[1]) - 1); |
47 | 47 | $explode[1] = str_replace('"', '', $explode[1]); |
48 | 48 | |
49 | - $temp[] = $explode[0] . '=' . $explode[1]; |
|
49 | + $temp[] = $explode[0].'='.$explode[1]; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | -foreach($temp as $value) |
|
53 | +foreach ($temp as $value) |
|
54 | 54 | { |
55 | - echo $value . ' '; |
|
55 | + echo $value.' '; |
|
56 | 56 | } |
57 | 57 | ?> |
@@ -18,10 +18,11 @@ |
||
18 | 18 | $lang = urldecode($_GET['lang']); |
19 | 19 | if (preg_match('/^[a-zA-Z0-9\._-]+$/', $lang)) { |
20 | 20 | //$lang = str_replace($search,$replace,urldecode($_GET['lang'])); |
21 | - if(file_exists($hotspot_lang_file . $lang . '/hotspot.inc.php')) |
|
22 | - $hotspot_lang_file .= $lang . '/hotspot.inc.php'; |
|
23 | - else |
|
24 | - $hotspot_lang_file .= 'english/hotspot.inc.php'; |
|
21 | + if(file_exists($hotspot_lang_file . $lang . '/hotspot.inc.php')) { |
|
22 | + $hotspot_lang_file .= $lang . '/hotspot.inc.php'; |
|
23 | + } else { |
|
24 | + $hotspot_lang_file .= 'english/hotspot.inc.php'; |
|
25 | + } |
|
25 | 26 | } else { |
26 | 27 | $hotspot_lang_file .= 'english/hotspot.inc.php'; |
27 | 28 | } |
@@ -51,17 +51,17 @@ |
||
51 | 51 | $result = Database::query($sql); |
52 | 52 | $exercises['-'] = '-'.get_lang('SelectExercise').'-'; |
53 | 53 | while ($row = Database :: fetch_array($result)) { |
54 | - $exercises[$row['id']] = cut($row['title'], EXERCISE_MAX_NAME_SIZE); |
|
54 | + $exercises[$row['id']] = cut($row['title'], EXERCISE_MAX_NAME_SIZE); |
|
55 | 55 | } |
56 | 56 | $form->addElement('select', 'exercise', get_lang('Exercise'), $exercises); |
57 | 57 | |
58 | 58 | // generate default content |
59 | 59 | $form->addElement( |
60 | - 'checkbox', |
|
61 | - 'is_content', |
|
62 | - null, |
|
63 | - get_lang('GenerateDefaultContent'), |
|
64 | - array('checked' => true) |
|
60 | + 'checkbox', |
|
61 | + 'is_content', |
|
62 | + null, |
|
63 | + get_lang('GenerateDefaultContent'), |
|
64 | + array('checked' => true) |
|
65 | 65 | ); |
66 | 66 | |
67 | 67 | // the submit button |
@@ -8,21 +8,21 @@ discard block |
||
8 | 8 | require_once __DIR__.'/../inc/global.inc.php'; |
9 | 9 | |
10 | 10 | // the section (tabs) |
11 | -$this_section=SECTION_COURSES; |
|
11 | +$this_section = SECTION_COURSES; |
|
12 | 12 | |
13 | 13 | // notice for unauthorized people. |
14 | 14 | api_protect_course_script(true); |
15 | 15 | |
16 | 16 | // breadcrumbs |
17 | -$interbreadcrumb[]=array("url" => "exercise.php","name" => get_lang('Exercises')); |
|
17 | +$interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises')); |
|
18 | 18 | |
19 | 19 | // Tool name |
20 | -$nameTools=get_lang('AddQuestionToExercise'); |
|
20 | +$nameTools = get_lang('AddQuestionToExercise'); |
|
21 | 21 | |
22 | 22 | // The form |
23 | -$form = new FormValidator('add_question','post',api_get_self().'?'.api_get_cidreq()); |
|
23 | +$form = new FormValidator('add_question', 'post', api_get_self().'?'.api_get_cidreq()); |
|
24 | 24 | // form title |
25 | -$form->addElement('header','',get_lang('AddQuestionToExercise')); |
|
25 | +$form->addElement('header', '', get_lang('AddQuestionToExercise')); |
|
26 | 26 | |
27 | 27 | $question_list = Question::get_question_type_list(); |
28 | 28 | $question_list_options = array(); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | ); |
39 | 39 | |
40 | 40 | //session id |
41 | -$session_id = api_get_session_id(); |
|
41 | +$session_id = api_get_session_id(); |
|
42 | 42 | |
43 | 43 | // the exercises |
44 | 44 | $tbl_exercises = Database :: get_course_table(TABLE_QUIZ_TEST); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | Display::display_header($nameTools); |
99 | 99 | |
100 | 100 | echo '<div class="actions">'; |
101 | - echo '<a href="exercise.php?show=test">'.Display :: return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
101 | + echo '<a href="exercise.php?show=test">'.Display :: return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
102 | 102 | echo '</div>'; |
103 | 103 | |
104 | 104 | // displaying the form |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | } |
32 | 32 | // The breadcrumbs. |
33 | 33 | $interbreadcrumb[] = array( |
34 | - 'url' => api_get_path(WEB_CODE_PATH) . '.exercise/exercise.php?' . api_get_cidreq(), |
|
34 | + 'url' => api_get_path(WEB_CODE_PATH).'.exercise/exercise.php?'.api_get_cidreq(), |
|
35 | 35 | 'name' => get_lang('Exercises') |
36 | 36 | ); |
37 | 37 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $_course, |
154 | 154 | $_FILES['userFile'], |
155 | 155 | $document_sys_path, |
156 | - $uploadPath . '/' . $fld, |
|
156 | + $uploadPath.'/'.$fld, |
|
157 | 157 | api_get_user_id(), |
158 | 158 | null, |
159 | 159 | null, |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $imgparams = $_POST['imgparams']; |
166 | 166 | $checked = CheckImageName($imgparams, $filename); |
167 | 167 | if ($checked) { |
168 | - $imgcount = $imgcount-1; |
|
168 | + $imgcount = $imgcount - 1; |
|
169 | 169 | } else { |
170 | 170 | $dialogBox .= $filename.' '.get_lang('NameNotEqual'); |
171 | 171 | my_delete($document_sys_path.$uploadPath.'/'.$fld.'/'.$filename); |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | } |
167 | 167 | |
168 | 168 | |
169 | - /** |
|
170 | - * abstract function which creates the form to create / edit the answers of the question |
|
171 | - * @param the formvalidator instance |
|
172 | - * @param the answers number to display |
|
173 | - */ |
|
174 | - function processAnswersCreation($form) |
|
169 | + /** |
|
170 | + * abstract function which creates the form to create / edit the answers of the question |
|
171 | + * @param the formvalidator instance |
|
172 | + * @param the answers number to display |
|
173 | + */ |
|
174 | + function processAnswersCreation($form) |
|
175 | 175 | { |
176 | 176 | $questionWeighting = $nbrGoodAnswers = 0; |
177 | 177 | $objAnswer = new Answer($this->id); |
@@ -201,12 +201,12 @@ discard block |
||
201 | 201 | // sets the total weighting of the question |
202 | 202 | $this->updateWeighting($questionWeighting); |
203 | 203 | $this->save(); |
204 | - } |
|
204 | + } |
|
205 | 205 | |
206 | - function return_header($feedback_type = null, $counter = null, $score = null) |
|
206 | + function return_header($feedback_type = null, $counter = null, $score = null) |
|
207 | 207 | { |
208 | - $header = parent::return_header($feedback_type, $counter, $score); |
|
209 | - $header .= '<table class="'.$this->question_table_class .'"> |
|
208 | + $header = parent::return_header($feedback_type, $counter, $score); |
|
209 | + $header .= '<table class="'.$this->question_table_class .'"> |
|
210 | 210 | <tr> |
211 | 211 | <th>'.get_lang("Choice").'</th> |
212 | 212 | <th>'. get_lang("ExpectedChoice").'</th> |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $header .= '<th>'.get_lang("Comment").'</th>'; |
215 | 215 | $header .= '</tr>'; |
216 | 216 | return $header; |
217 | - } |
|
217 | + } |
|
218 | 218 | |
219 | 219 | |
220 | 220 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | 'Height' => '125' |
41 | 41 | ); |
42 | 42 | |
43 | - $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 4; // The previous default value was 2. See task #1759. |
|
43 | + $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 4; // The previous default value was 2. See task #1759. |
|
44 | 44 | $nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0)); |
45 | 45 | |
46 | 46 | $obj_ex = Session::read('objExercise'); |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | $html = '<table class="table table-striped table-hover"> |
51 | 51 | <thead> |
52 | 52 | <tr> |
53 | - <th width="10">' . get_lang('Number') . '</th> |
|
54 | - <th width="10">' . get_lang('True') . '</th> |
|
55 | - <th width="50%">' . get_lang('Answer') . '</th> |
|
56 | - <th width="50%">' . get_lang('Comment') . '</th> |
|
57 | - <th width="10">' . get_lang('Weighting') . '</th> |
|
53 | + <th width="10">' . get_lang('Number').'</th> |
|
54 | + <th width="10">' . get_lang('True').'</th> |
|
55 | + <th width="50%">' . get_lang('Answer').'</th> |
|
56 | + <th width="50%">' . get_lang('Comment').'</th> |
|
57 | + <th width="10">' . get_lang('Weighting').'</th> |
|
58 | 58 | </tr> |
59 | 59 | </thead> |
60 | 60 | <tbody>'; |
@@ -84,10 +84,10 @@ discard block |
||
84 | 84 | $form->addHtml('<tr>'); |
85 | 85 | |
86 | 86 | if (is_object($answer)) { |
87 | - $defaults['answer[' . $i . ']'] = $answer->answer[$i]; |
|
88 | - $defaults['comment[' . $i . ']'] = $answer->comment[$i]; |
|
89 | - $defaults['weighting[' . $i . ']'] = float_format($answer->weighting[$i], 1); |
|
90 | - $defaults['correct[' . $i . ']'] = $answer->correct[$i]; |
|
87 | + $defaults['answer['.$i.']'] = $answer->answer[$i]; |
|
88 | + $defaults['comment['.$i.']'] = $answer->comment[$i]; |
|
89 | + $defaults['weighting['.$i.']'] = float_format($answer->weighting[$i], 1); |
|
90 | + $defaults['correct['.$i.']'] = $answer->correct[$i]; |
|
91 | 91 | } else { |
92 | 92 | $defaults['answer[1]'] = get_lang('DefaultMultipleAnswer2'); |
93 | 93 | $defaults['comment[1]'] = get_lang('DefaultMultipleComment2'); |
@@ -103,38 +103,38 @@ discard block |
||
103 | 103 | |
104 | 104 | $renderer->setElementTemplate( |
105 | 105 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
106 | - 'correct[' . $i . ']' |
|
106 | + 'correct['.$i.']' |
|
107 | 107 | ); |
108 | 108 | $renderer->setElementTemplate( |
109 | 109 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
110 | - 'counter[' . $i . ']' |
|
110 | + 'counter['.$i.']' |
|
111 | 111 | ); |
112 | 112 | $renderer->setElementTemplate( |
113 | 113 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
114 | - 'answer[' . $i . ']' |
|
114 | + 'answer['.$i.']' |
|
115 | 115 | ); |
116 | 116 | $renderer->setElementTemplate( |
117 | 117 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
118 | - 'comment[' . $i . ']' |
|
118 | + 'comment['.$i.']' |
|
119 | 119 | ); |
120 | 120 | $renderer->setElementTemplate( |
121 | 121 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
122 | - 'weighting[' . $i . ']' |
|
122 | + 'weighting['.$i.']' |
|
123 | 123 | ); |
124 | 124 | |
125 | - $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"'); |
|
125 | + $answer_number = $form->addElement('text', 'counter['.$i.']', null, 'value="'.$i.'"'); |
|
126 | 126 | $answer_number->freeze(); |
127 | 127 | |
128 | - $form->addElement('checkbox', 'correct[' . $i . ']', null, null, |
|
128 | + $form->addElement('checkbox', 'correct['.$i.']', null, null, |
|
129 | 129 | 'class="checkbox" style="margin-left: 0em;"'); |
130 | - $boxes_names[] = 'correct[' . $i . ']'; |
|
130 | + $boxes_names[] = 'correct['.$i.']'; |
|
131 | 131 | |
132 | 132 | $form->addHtmlEditor("answer[$i]", null, null, true, $editorConfig); |
133 | - $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required'); |
|
133 | + $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required'); |
|
134 | 134 | |
135 | 135 | $form->addHtmlEditor("comment[$i]", null, null, true, $editorConfig); |
136 | 136 | |
137 | - $form->addElement('text', 'weighting[' . $i . ']', null, array('style' => "width: 60px;", 'value' => '0')); |
|
137 | + $form->addElement('text', 'weighting['.$i.']', null, array('style' => "width: 60px;", 'value' => '0')); |
|
138 | 138 | $form->addHtml('</tr>'); |
139 | 139 | } |
140 | 140 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $objAnswer = new Answer($this->id); |
180 | 180 | $nb_answers = $form->getSubmitValue('nb_answers'); |
181 | 181 | |
182 | - for($i=1 ; $i <= $nb_answers ; $i++) { |
|
182 | + for ($i = 1; $i <= $nb_answers; $i++) { |
|
183 | 183 | $answer = trim(str_replace(['<p>', '</p>'], '', $form -> getSubmitValue('answer['.$i.']'))); |
184 | 184 | $comment = trim(str_replace(['<p>', '</p>'], '', $form -> getSubmitValue('comment['.$i.']'))); |
185 | 185 | $weighting = trim($form -> getSubmitValue('weighting['.$i.']')); |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | $weighting = abs($weighting); |
192 | 192 | $weighting = -$weighting; |
193 | 193 | } |
194 | - if($weighting > 0) { |
|
194 | + if ($weighting > 0) { |
|
195 | 195 | $questionWeighting += $weighting; |
196 | 196 | } |
197 | - $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i); |
|
197 | + $objAnswer -> createAnswer($answer, $goodAnswer, $comment, $weighting, $i); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | // saves the answers into the data base |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | function return_header($feedback_type = null, $counter = null, $score = null) |
209 | 209 | { |
210 | 210 | $header = parent::return_header($feedback_type, $counter, $score); |
211 | - $header .= '<table class="'.$this->question_table_class .'"> |
|
211 | + $header .= '<table class="'.$this->question_table_class.'"> |
|
212 | 212 | <tr> |
213 | 213 | <th>'.get_lang("Choice").'</th> |
214 | 214 | <th>'. get_lang("ExpectedChoice").'</th> |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | Display::addFlash( |
249 | 249 | Display::return_message(get_lang('MessageSent')) |
250 | 250 | ); |
251 | - header('Location: ' . api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId); |
|
251 | + header('Location: '.api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId); |
|
252 | 252 | exit; |
253 | 253 | } |
254 | 254 | } |
@@ -278,8 +278,8 @@ discard block |
||
278 | 278 | api_is_course_tutor() || api_is_course_coach() |
279 | 279 | ) { |
280 | 280 | $actions .= '<a href="admin.php?exerciseId='.intval($_GET['exerciseId']).'">'.Display :: return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>'; |
281 | - $actions .='<a href="live_stats.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'">'.Display :: return_icon('activity_monitor.png', get_lang('LiveResults'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
282 | - $actions .='<a href="stats.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'">'.Display :: return_icon('statistics.png', get_lang('ReportByQuestion'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
281 | + $actions .= '<a href="live_stats.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'">'.Display :: return_icon('activity_monitor.png', get_lang('LiveResults'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
282 | + $actions .= '<a href="stats.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'">'.Display :: return_icon('statistics.png', get_lang('ReportByQuestion'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
283 | 283 | |
284 | 284 | $actions .= '<a id="export_opener" href="'.api_get_self().'?export_report=1&exerciseId='.intval($_GET['exerciseId']).'" >'. |
285 | 285 | Display::return_icon('save.png', get_lang('Export'), '', ICON_SIZE_MEDIUM).'</a>'; |