@@ -21,7 +21,7 @@ |
||
21 | 21 | } |
22 | 22 | |
23 | 23 | // the breadcrumbs |
24 | -$interbreadcrumb[]= array ( |
|
24 | +$interbreadcrumb[] = array( |
|
25 | 25 | "url" => api_get_path(WEB_CODE_PATH)."exercice/exercise.php?".api_get_cidreq(), |
26 | 26 | "name" => get_lang('Exercises') |
27 | 27 | ); |
@@ -241,13 +241,13 @@ discard block |
||
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
244 | - * abstract function which creates the form to create / edit the answers of the question |
|
245 | - * @param FormValidator $form |
|
246 | - */ |
|
244 | + * abstract function which creates the form to create / edit the answers of the question |
|
245 | + * @param FormValidator $form |
|
246 | + */ |
|
247 | 247 | public function processAnswersCreation($form) |
248 | 248 | { |
249 | - $questionWeighting = $nbrGoodAnswers = 0; |
|
250 | - $objAnswer = new Answer($this->id); |
|
249 | + $questionWeighting = $nbrGoodAnswers = 0; |
|
250 | + $objAnswer = new Answer($this->id); |
|
251 | 251 | $nb_answers = $form->getSubmitValue('nb_answers'); |
252 | 252 | //$options_count = $form->getSubmitValue('options_count'); |
253 | 253 | $course_id = api_get_course_int_id(); |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | $course_id, |
270 | 270 | $i |
271 | 271 | ); |
272 | - $correct[$i] = $last_id; |
|
272 | + $correct[$i] = $last_id; |
|
273 | 273 | } |
274 | 274 | } |
275 | 275 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | |
281 | 281 | $sorted_by_position = array(); |
282 | 282 | foreach ($new_options as $item) { |
283 | - $sorted_by_position[$item['position']] = $item; |
|
283 | + $sorted_by_position[$item['position']] = $item; |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /* Saving quiz_question.extra values that has the correct scores of |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | } |
294 | 294 | $this->setExtra(implode(':', $extra_values)); |
295 | 295 | |
296 | - for ($i = 1; $i <= $nb_answers; $i++) { |
|
296 | + for ($i = 1; $i <= $nb_answers; $i++) { |
|
297 | 297 | $answer = trim($form->getSubmitValue('answer['.$i.']')); |
298 | 298 | $comment = trim($form->getSubmitValue('comment['.$i.']')); |
299 | 299 | $goodAnswer = trim($form->getSubmitValue('correct['.$i.']')); |
@@ -302,18 +302,18 @@ discard block |
||
302 | 302 | // change the default values from the form 1 and 2 by the correct "option id" registered |
303 | 303 | $goodAnswer = $sorted_by_position[$goodAnswer]['id']; |
304 | 304 | } |
305 | - $questionWeighting += $extra_values[0]; //By default 0 has the correct answers |
|
305 | + $questionWeighting += $extra_values[0]; //By default 0 has the correct answers |
|
306 | 306 | |
307 | - $objAnswer->createAnswer($answer, $goodAnswer, $comment,'',$i); |
|
307 | + $objAnswer->createAnswer($answer, $goodAnswer, $comment,'',$i); |
|
308 | 308 | } |
309 | 309 | |
310 | - // saves the answers into the data base |
|
310 | + // saves the answers into the data base |
|
311 | 311 | $objAnswer->save(); |
312 | 312 | |
313 | 313 | // sets the total weighting of the question |
314 | 314 | $this->updateWeighting($questionWeighting); |
315 | 315 | $this->save(); |
316 | - } |
|
316 | + } |
|
317 | 317 | |
318 | 318 | /** |
319 | 319 | * @param int $feedback_type |
@@ -324,17 +324,17 @@ discard block |
||
324 | 324 | function return_header($feedback_type = null, $counter = null, $score = null) |
325 | 325 | { |
326 | 326 | $header = parent::return_header($feedback_type, $counter, $score); |
327 | - $header .= '<table class="'.$this->question_table_class .'"> |
|
327 | + $header .= '<table class="'.$this->question_table_class .'"> |
|
328 | 328 | <tr> |
329 | 329 | <th>'.get_lang("Choice").'</th> |
330 | 330 | <th>'. get_lang("ExpectedChoice").'</th> |
331 | 331 | <th>'. get_lang("Answer").'</th>'; |
332 | - if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { |
|
333 | - $header .= '<th>'.get_lang("Comment").'</th>'; |
|
334 | - } else { |
|
335 | - $header .= '<th> </th>'; |
|
336 | - } |
|
332 | + if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { |
|
333 | + $header .= '<th>'.get_lang("Comment").'</th>'; |
|
334 | + } else { |
|
335 | + $header .= '<th> </th>'; |
|
336 | + } |
|
337 | 337 | $header .= '</tr>'; |
338 | 338 | return $header; |
339 | - } |
|
339 | + } |
|
340 | 340 | } |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | $html = '<table class="table table-striped table-hover">'; |
45 | 45 | $html .= '<thead>'; |
46 | 46 | $html .= '<tr>'; |
47 | - $html .= '<th>' . get_lang('Number') . '</th>'; |
|
48 | - $html .= '<th>' . get_lang('True') . '</th>'; |
|
49 | - $html .= '<th>' . get_lang('False') . '</th>'; |
|
50 | - $html .= '<th>' . get_lang('Answer') . '</th>'; |
|
47 | + $html .= '<th>'.get_lang('Number').'</th>'; |
|
48 | + $html .= '<th>'.get_lang('True').'</th>'; |
|
49 | + $html .= '<th>'.get_lang('False').'</th>'; |
|
50 | + $html .= '<th>'.get_lang('Answer').'</th>'; |
|
51 | 51 | |
52 | 52 | // show column comment when feedback is enable |
53 | 53 | if ($obj_ex->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) { |
54 | - $html .= '<th>' . get_lang('Comment') . '</th>'; |
|
54 | + $html .= '<th>'.get_lang('Comment').'</th>'; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | $html .= '</tr>'; |
@@ -89,19 +89,19 @@ discard block |
||
89 | 89 | |
90 | 90 | $renderer->setElementTemplate( |
91 | 91 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
92 | - 'correct[' . $i . ']' |
|
92 | + 'correct['.$i.']' |
|
93 | 93 | ); |
94 | 94 | $renderer->setElementTemplate( |
95 | 95 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
96 | - 'counter[' . $i . ']' |
|
96 | + 'counter['.$i.']' |
|
97 | 97 | ); |
98 | 98 | $renderer->setElementTemplate( |
99 | 99 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
100 | - 'answer[' . $i . ']' |
|
100 | + 'answer['.$i.']' |
|
101 | 101 | ); |
102 | 102 | $renderer->setElementTemplate( |
103 | 103 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
104 | - 'comment[' . $i . ']' |
|
104 | + 'comment['.$i.']' |
|
105 | 105 | ); |
106 | 106 | |
107 | 107 | $answer_number = $form->addElement( |
@@ -114,15 +114,15 @@ discard block |
||
114 | 114 | $answer_number->freeze(); |
115 | 115 | |
116 | 116 | if (is_object($answer)) { |
117 | - $defaults['answer[' . $i . ']'] = $answer->answer[$i]; |
|
118 | - $defaults['comment[' . $i . ']'] = $answer->comment[$i]; |
|
117 | + $defaults['answer['.$i.']'] = $answer->answer[$i]; |
|
118 | + $defaults['comment['.$i.']'] = $answer->comment[$i]; |
|
119 | 119 | $correct = $answer->correct[$i]; |
120 | - $defaults['correct[' . $i . ']'] = $correct; |
|
120 | + $defaults['correct['.$i.']'] = $correct; |
|
121 | 121 | |
122 | 122 | $j = 1; |
123 | 123 | if (!empty($optionData)) { |
124 | 124 | foreach ($optionData as $id => $data) { |
125 | - $form->addElement('radio', 'correct[' . $i . ']', null, null, $id); |
|
125 | + $form->addElement('radio', 'correct['.$i.']', null, null, $id); |
|
126 | 126 | $j++; |
127 | 127 | if ($j == 3) { |
128 | 128 | break; |
@@ -130,15 +130,15 @@ discard block |
||
130 | 130 | } |
131 | 131 | } |
132 | 132 | } else { |
133 | - $form->addElement('radio', 'correct[' . $i . ']', null, null, 1); |
|
134 | - $form->addElement('radio', 'correct[' . $i . ']', null, null, 2); |
|
133 | + $form->addElement('radio', 'correct['.$i.']', null, null, 1); |
|
134 | + $form->addElement('radio', 'correct['.$i.']', null, null, 2); |
|
135 | 135 | |
136 | - $defaults['answer[' . $i . ']'] = ''; |
|
137 | - $defaults['comment[' . $i . ']'] = ''; |
|
138 | - $defaults['correct[' . $i . ']'] = ''; |
|
136 | + $defaults['answer['.$i.']'] = ''; |
|
137 | + $defaults['comment['.$i.']'] = ''; |
|
138 | + $defaults['correct['.$i.']'] = ''; |
|
139 | 139 | } |
140 | 140 | |
141 | - $boxes_names[] = 'correct[' . $i . ']'; |
|
141 | + $boxes_names[] = 'correct['.$i.']'; |
|
142 | 142 | |
143 | 143 | $form->addHtmlEditor( |
144 | 144 | "answer[$i]", |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | if ($obj_ex->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) { |
153 | 153 | $form->addElement( |
154 | 154 | 'html_editor', |
155 | - 'comment[' . $i . ']', |
|
155 | + 'comment['.$i.']', |
|
156 | 156 | null, |
157 | 157 | array(), |
158 | 158 | array( |
@@ -170,22 +170,22 @@ discard block |
||
170 | 170 | |
171 | 171 | $correctInputTemplate = '<div class="form-group">'; |
172 | 172 | $correctInputTemplate .= '<label class="col-sm-2 control-label">'; |
173 | - $correctInputTemplate .= '<span class="form_required">*</span>' . get_lang('Score'); |
|
173 | + $correctInputTemplate .= '<span class="form_required">*</span>'.get_lang('Score'); |
|
174 | 174 | $correctInputTemplate .= '</label>'; |
175 | 175 | $correctInputTemplate .= '<div class="col-sm-8">'; |
176 | 176 | $correctInputTemplate .= '<table>'; |
177 | 177 | $correctInputTemplate .= '<tr>'; |
178 | 178 | $correctInputTemplate .= '<td>'; |
179 | - $correctInputTemplate .= get_lang('Correct') . '{element}'; |
|
179 | + $correctInputTemplate .= get_lang('Correct').'{element}'; |
|
180 | 180 | $correctInputTemplate .= '<!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->'; |
181 | 181 | $correctInputTemplate .= '</td>'; |
182 | 182 | |
183 | 183 | $wrongInputTemplate = '<td>'; |
184 | - $wrongInputTemplate .= get_lang('Wrong') . '{element}'; |
|
184 | + $wrongInputTemplate .= get_lang('Wrong').'{element}'; |
|
185 | 185 | $wrongInputTemplate .= '<!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->'; |
186 | 186 | $wrongInputTemplate .= '</td>'; |
187 | 187 | |
188 | - $doubtScoreInputTemplate = '<td>' . get_lang('DoubtScore') . '<br>{element}'; |
|
188 | + $doubtScoreInputTemplate = '<td>'.get_lang('DoubtScore').'<br>{element}'; |
|
189 | 189 | $doubtScoreInputTemplate .= '<!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->'; |
190 | 190 | $doubtScoreInputTemplate .= '</td>'; |
191 | 191 | $doubtScoreInputTemplate .= '</tr>'; |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | if (!empty($scores)) { |
216 | 216 | for ($i = 1; $i <= 3; $i++) { |
217 | - $defaults['option[' . $i . ']'] = $scores[$i - 1]; |
|
217 | + $defaults['option['.$i.']'] = $scores[$i - 1]; |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | Question::updateQuestionOption($id, $optionData, $course_id); |
263 | 263 | } |
264 | 264 | } else { |
265 | - for ($i=1 ; $i <= 3 ; $i++) { |
|
265 | + for ($i = 1; $i <= 3; $i++) { |
|
266 | 266 | $last_id = Question::saveQuestionOption( |
267 | 267 | $this->id, |
268 | 268 | $this->options[$i], |
@@ -287,9 +287,9 @@ discard block |
||
287 | 287 | the true, false, doubt options registered in this format |
288 | 288 | XX:YY:ZZZ where XX is a float score value.*/ |
289 | 289 | $extra_values = array(); |
290 | - for ($i=1 ; $i <= 3 ; $i++) { |
|
290 | + for ($i = 1; $i <= 3; $i++) { |
|
291 | 291 | $score = trim($form -> getSubmitValue('option['.$i.']')); |
292 | - $extra_values[]= $score; |
|
292 | + $extra_values[] = $score; |
|
293 | 293 | } |
294 | 294 | $this->setExtra(implode(':', $extra_values)); |
295 | 295 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | } |
305 | 305 | $questionWeighting += $extra_values[0]; //By default 0 has the correct answers |
306 | 306 | |
307 | - $objAnswer->createAnswer($answer, $goodAnswer, $comment,'',$i); |
|
307 | + $objAnswer->createAnswer($answer, $goodAnswer, $comment, '', $i); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | // saves the answers into the data base |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | function return_header($feedback_type = null, $counter = null, $score = null) |
325 | 325 | { |
326 | 326 | $header = parent::return_header($feedback_type, $counter, $score); |
327 | - $header .= '<table class="'.$this->question_table_class .'"> |
|
327 | + $header .= '<table class="'.$this->question_table_class.'"> |
|
328 | 328 | <tr> |
329 | 329 | <th>'.get_lang("Choice").'</th> |
330 | 330 | <th>'. get_lang("ExpectedChoice").'</th> |
@@ -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 |
@@ -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 '../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 |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | ), |
134 | 134 | array('ToolbarSet' => 'TestQuestionDescription', 'Width' => '100%', 'Height' => '350')); |
135 | 135 | |
136 | - $form->addRule('answer', get_lang('GiveText'),'required'); |
|
137 | - $form->addRule('answer', get_lang('DefineBlanks'),'regex','/\[.*\]/'); |
|
136 | + $form->addRule('answer', get_lang('GiveText'), 'required'); |
|
137 | + $form->addRule('answer', get_lang('DefineBlanks'), 'regex', '/\[.*\]/'); |
|
138 | 138 | |
139 | 139 | $form->addElement('label', null, get_lang('IfYouWantOnlyIntegerValuesWriteBothLimitsWithoutDecimals')); |
140 | 140 | $form->addElement('html', '<div id="blanks_weighting"></div>'); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $form->setDefaults(array('weighting' => '10')); |
162 | 162 | |
163 | 163 | $form->addElement('text', 'answerVariations', get_lang('AnswerVariations')); |
164 | - $form->addRule('answerVariations', get_lang('GiveAnswerVariations'),'required'); |
|
164 | + $form->addRule('answerVariations', get_lang('GiveAnswerVariations'), 'required'); |
|
165 | 165 | $form->setDefaults(array('answerVariations' => '1')); |
166 | 166 | |
167 | 167 | global $text; |
@@ -201,22 +201,21 @@ discard block |
||
201 | 201 | $answerVariations = $form->getSubmitValue('answerVariations'); |
202 | 202 | $this->weighting = $form->getSubmitValue('weighting'); |
203 | 203 | // Create as many answers as $answerVariations |
204 | - for ($j=0 ; $j < $answerVariations; $j++) { |
|
204 | + for ($j = 0; $j < $answerVariations; $j++) { |
|
205 | 205 | $auxAnswer = $answer; |
206 | 206 | $auxFormula = $formula; |
207 | 207 | $nb = preg_match_all('/\[[^\]]*\]/', $auxAnswer, $blanks); |
208 | 208 | if ($nb > 0) { |
209 | - for ($i=0 ; $i < $nb; ++$i) { |
|
209 | + for ($i = 0; $i < $nb; ++$i) { |
|
210 | 210 | $blankItem = $blanks[0][$i]; |
211 | 211 | $replace = array("[", "]"); |
212 | 212 | $newBlankItem = str_replace($replace, "", $blankItem); |
213 | 213 | $newBlankItem = "[".trim($newBlankItem)."]"; |
214 | 214 | // take random float values when one or both edge values have a decimal point |
215 | 215 | $randomValue = |
216 | - (strpos($lowestValues[$i],'.') !== false || |
|
217 | - strpos($highestValues[$i],'.') !== false) ? |
|
218 | - mt_rand($lowestValues[$i]*100,$highestValues[$i]*100)/100 : |
|
219 | - mt_rand($lowestValues[$i],$highestValues[$i]); |
|
216 | + (strpos($lowestValues[$i], '.') !== false || |
|
217 | + strpos($highestValues[$i], '.') !== false) ? |
|
218 | + mt_rand($lowestValues[$i] * 100, $highestValues[$i] * 100) / 100 : mt_rand($lowestValues[$i], $highestValues[$i]); |
|
220 | 219 | $auxAnswer = str_replace($blankItem, $randomValue, $auxAnswer); |
221 | 220 | $auxFormula = str_replace($blankItem, $randomValue, $auxFormula); |
222 | 221 | } |
@@ -250,7 +249,7 @@ discard block |
||
250 | 249 | function return_header($feedback_type = null, $counter = null, $score = null) |
251 | 250 | { |
252 | 251 | $header = parent::return_header($feedback_type, $counter, $score); |
253 | - $header .= '<table class="'.$this->question_table_class .'"> |
|
252 | + $header .= '<table class="'.$this->question_table_class.'"> |
|
254 | 253 | <tr> |
255 | 254 | <th>'.get_lang("Answer").'</th> |
256 | 255 | </tr>'; |
@@ -72,12 +72,12 @@ discard block |
||
72 | 72 | for ($i = 1; $i <= $answer->nbrAnswers; $i++) { |
73 | 73 | if ($answer->isCorrect($i)) { |
74 | 74 | $nb_matches++; |
75 | - $defaults['answer[' . $nb_matches . ']'] = $answer->selectAnswer($i); |
|
76 | - $defaults['weighting[' . $nb_matches . ']'] = float_format($answer->selectWeighting($i), 1); |
|
77 | - $defaults['matches[' . $nb_matches . ']'] = $answer->correct[$i]; |
|
75 | + $defaults['answer['.$nb_matches.']'] = $answer->selectAnswer($i); |
|
76 | + $defaults['weighting['.$nb_matches.']'] = float_format($answer->selectWeighting($i), 1); |
|
77 | + $defaults['matches['.$nb_matches.']'] = $answer->correct[$i]; |
|
78 | 78 | } else { |
79 | 79 | $nb_options++; |
80 | - $defaults['option[' . $nb_options . ']'] = $answer->selectAnswer($i); |
|
80 | + $defaults['option['.$nb_options.']'] = $answer->selectAnswer($i); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | } |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | $html = '<table class="table table-striped table-hover"> |
109 | 109 | <thead> |
110 | 110 | <tr> |
111 | - <th width="5%">' . get_lang('Number') . '</th> |
|
112 | - <th width="70%">' . get_lang('Answer') . '</th> |
|
113 | - <th width="15%">' . get_lang('MatchesTo') . '</th> |
|
114 | - <th width="10%">' . get_lang('Weighting') . '</th> |
|
111 | + <th width="5%">' . get_lang('Number').'</th> |
|
112 | + <th width="70%">' . get_lang('Answer').'</th> |
|
113 | + <th width="15%">' . get_lang('MatchesTo').'</th> |
|
114 | + <th width="10%">' . get_lang('Weighting').'</th> |
|
115 | 115 | </tr> |
116 | 116 | </thead> |
117 | 117 | <tbody>'; |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | $html = '<table class="table table-striped table-hover"> |
163 | 163 | <thead> |
164 | 164 | <tr> |
165 | - <th width="15%">' . get_lang('Number') . '</th> |
|
166 | - <th width="85%">' . get_lang('Answer') . '</th> |
|
165 | + <th width="15%">' . get_lang('Number').'</th> |
|
166 | + <th width="85%">' . get_lang('Answer').'</th> |
|
167 | 167 | </tr> |
168 | 168 | </thead> |
169 | 169 | <tbody>'; |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | |
186 | 186 | $form->addHtml('<tr>'); |
187 | 187 | |
188 | - $form->addHtml('<td>' . chr(64 + $i) . '</td>'); |
|
188 | + $form->addHtml('<td>'.chr(64 + $i).'</td>'); |
|
189 | 189 | $form->addText("option[$i]", null); |
190 | 190 | |
191 | 191 | $form->addHtml('</tr>'); |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | public function return_header($feedback_type = null, $counter = null, $score = null) |
268 | 268 | { |
269 | 269 | $header = parent::return_header($feedback_type, $counter, $score); |
270 | - $header .= '<table class="'.$this->question_table_class .'">'; |
|
270 | + $header .= '<table class="'.$this->question_table_class.'">'; |
|
271 | 271 | $header .= '<tr> |
272 | 272 | <th>'.get_lang('ElementList').'</th> |
273 | 273 | <th>'.get_lang('CorrespondsTo').'</th> |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | if (isset($_GET['editQuestion'])) { |
14 | - $objQuestion = Question::read ($_GET['editQuestion']); |
|
14 | + $objQuestion = Question::read($_GET['editQuestion']); |
|
15 | 15 | $action = api_get_self()."?".api_get_cidreq()."&myid=1&modifyQuestion=".$modifyQuestion."&editQuestion=".$objQuestion->id; |
16 | 16 | } else { |
17 | 17 | $objQuestion = Question :: getInstance($_REQUEST['answerType']); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | if (is_object($objQuestion)) { |
22 | 22 | // FORM CREATION |
23 | - $form = new FormValidator('question_admin_form','post', $action); |
|
23 | + $form = new FormValidator('question_admin_form', 'post', $action); |
|
24 | 24 | if (isset($_GET['editQuestion'])) { |
25 | 25 | $class = "btn btn-default"; |
26 | 26 | $text = get_lang('ModifyQuestion'); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | // redirect |
64 | 64 | if ($objQuestion->type != HOT_SPOT && $objQuestion->type != HOT_SPOT_DELINEATION) { |
65 | - if(isset($_GET['editQuestion'])) { |
|
65 | + if (isset($_GET['editQuestion'])) { |
|
66 | 66 | echo '<script type="text/javascript">window.location.href="admin.php?exerciseId='.$exerciseId.'&'.api_get_cidreq().'&message=ItemUpdated"</script>'; |
67 | 67 | } else { |
68 | 68 | //New question |
@@ -17,25 +17,25 @@ |
||
17 | 17 | $hotspotId = $_GET['hotspotId']; |
18 | 18 | $exerciseId = $objExcercise->selectId(); |
19 | 19 | if ($_GET['answerId'] == "0") { // click is NOT on a hotspot |
20 | - $hit = 0; |
|
21 | - $answerId = $hotspotId; |
|
20 | + $hit = 0; |
|
21 | + $answerId = $hotspotId; |
|
22 | 22 | |
23 | - // remove from session |
|
24 | - unset($_SESSION['exerciseResult'][$questionId][$answerId]); |
|
23 | + // remove from session |
|
24 | + unset($_SESSION['exerciseResult'][$questionId][$answerId]); |
|
25 | 25 | |
26 | - // Save clicking order |
|
27 | - //$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['order'])+1; |
|
28 | - //$_SESSION['exerciseResult'][$questionId]['order'][$answerOrderId] = $answerId; |
|
26 | + // Save clicking order |
|
27 | + //$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['order'])+1; |
|
28 | + //$_SESSION['exerciseResult'][$questionId]['order'][$answerOrderId] = $answerId; |
|
29 | 29 | } else { // user clicked ON a hotspot |
30 | - $hit = 1; |
|
31 | - $answerId = $hotspotId; |
|
30 | + $hit = 1; |
|
31 | + $answerId = $hotspotId; |
|
32 | 32 | |
33 | - // Save into session |
|
34 | - $_SESSION['exerciseResult'][$questionId][$answerId] = $hit; |
|
33 | + // Save into session |
|
34 | + $_SESSION['exerciseResult'][$questionId][$answerId] = $hit; |
|
35 | 35 | |
36 | - // Save clicking order |
|
37 | - //$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['order'])+1; |
|
38 | - //$_SESSION['exerciseResult'][$questionId]['order'][$answerOrderId] = $answerId; |
|
36 | + // Save clicking order |
|
37 | + //$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['order'])+1; |
|
38 | + //$_SESSION['exerciseResult'][$questionId]['order'][$answerOrderId] = $answerId; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | //round-up the coordinates |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $questionId = $_GET['questionId']; |
15 | 15 | $coordinates = $_GET['coord']; |
16 | 16 | $objExcercise = $_SESSION['objExercise']; |
17 | -$hotspotId = $_GET['hotspotId']; |
|
17 | +$hotspotId = $_GET['hotspotId']; |
|
18 | 18 | $exerciseId = $objExcercise->selectId(); |
19 | 19 | if ($_GET['answerId'] == "0") { // click is NOT on a hotspot |
20 | 20 | $hit = 0; |
@@ -39,15 +39,15 @@ discard block |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | //round-up the coordinates |
42 | -$coords = explode('/',$coordinates); |
|
42 | +$coords = explode('/', $coordinates); |
|
43 | 43 | $coordinates = ''; |
44 | 44 | foreach ($coords as $coord) { |
45 | - list($x,$y) = explode(';',$coord); |
|
45 | + list($x, $y) = explode(';', $coord); |
|
46 | 46 | $coordinates .= round($x).';'.round($y).'/'; |
47 | 47 | } |
48 | -$coordinates = substr($coordinates,0,-1); |
|
48 | +$coordinates = substr($coordinates, 0, -1); |
|
49 | 49 | |
50 | -$TBL_TRACK_E_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT); |
|
50 | +$TBL_TRACK_E_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT); |
|
51 | 51 | |
52 | 52 | // update db |
53 | 53 | $update_id = $_SESSION['exerciseResult'][$questionId]['ids'][$answerId]; |
@@ -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]); ?>" /> |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | if ($modifyIn) { |
27 | 27 | if ($debug > 0) { |
28 | - echo '$modifyIn was set' . "<br />\n"; |
|
28 | + echo '$modifyIn was set'."<br />\n"; |
|
29 | 29 | } |
30 | 30 | // if the user has chosen to modify the question only in the current exercise |
31 | 31 | if ($modifyIn == 'thisExercise') { |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | unset($buttonBack); |
65 | 65 | } |
66 | 66 | |
67 | -$hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&exerciseId=' . $exerciseId; |
|
67 | +$hotspot_admin_url = api_get_path(WEB_CODE_PATH).'exercice/admin.php?'.api_get_cidreq().'&exerciseId='.$exerciseId; |
|
68 | 68 | |
69 | 69 | // the answer form has been submitted |
70 | 70 | $submitAnswers = isset($_POST['submitAnswers']) ? true : false; |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | if ($submitAnswers || $buttonBack) { |
75 | 75 | if ($answerType == HOT_SPOT) { |
76 | 76 | if ($debug > 0) { |
77 | - echo '$submitAnswers or $buttonBack was set' . "<br />\n"; |
|
77 | + echo '$submitAnswers or $buttonBack was set'."<br />\n"; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | $questionWeighting = $nbrGoodAnswers = 0; |
81 | 81 | for ($i = 1; $i <= $nbrAnswers; $i++) { |
82 | 82 | if ($debug > 0) { |
83 | - echo str_repeat(' ', 4) . '$answerType is HOT_SPOT' . "<br />\n"; |
|
83 | + echo str_repeat(' ', 4).'$answerType is HOT_SPOT'."<br />\n"; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | $reponse[$i] = trim($reponse[$i]); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | if (empty($msgErr)) { |
115 | 115 | for ($i = 1; $i <= $nbrAnswers; $i++) { |
116 | 116 | if ($debug > 0) { |
117 | - echo str_repeat(' ', 4) . '$answerType is HOT_SPOT' . "<br />\n"; |
|
117 | + echo str_repeat(' ', 4).'$answerType is HOT_SPOT'."<br />\n"; |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | $reponse[$i] = trim($reponse[$i]); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $weighting[$i] = ($weighting[$i]); //it can be float |
123 | 123 | |
124 | 124 | if ($weighting[$i]) { |
125 | - $questionWeighting+=$weighting[$i]; |
|
125 | + $questionWeighting += $weighting[$i]; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | // creates answer |
@@ -145,15 +145,15 @@ discard block |
||
145 | 145 | |
146 | 146 | $editQuestion = $questionId; |
147 | 147 | unset($modifyAnswers); |
148 | - echo '<script type="text/javascript">window.location.href="' . $hotspot_admin_url . '&message=ItemUpdated"</script>'; |
|
148 | + echo '<script type="text/javascript">window.location.href="'.$hotspot_admin_url.'&message=ItemUpdated"</script>'; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | if ($debug > 0) { |
152 | - echo '$modifyIn was set - end' . "<br />\n"; |
|
152 | + echo '$modifyIn was set - end'."<br />\n"; |
|
153 | 153 | } |
154 | 154 | } else { |
155 | 155 | if ($debug > 0) { |
156 | - echo '$submitAnswers or $buttonBack was set' . "<br />\n"; |
|
156 | + echo '$submitAnswers or $buttonBack was set'."<br />\n"; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | $questionWeighting = $nbrGoodAnswers = 0; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | |
169 | 169 | for ($i = 1; $i <= $nbrAnswers; $i++) { |
170 | 170 | if ($debug > 0) { |
171 | - echo str_repeat(' ', 4) . '$answerType is HOT_SPOT' . "<br />\n"; |
|
171 | + echo str_repeat(' ', 4).'$answerType is HOT_SPOT'."<br />\n"; |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | $reponse[$i] = trim($reponse[$i]); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | $threadhold3_str = intval($threadhold3[$i]); |
194 | 194 | } |
195 | 195 | |
196 | - $threadhold_total = $threadhold1_str . ';' . $threadhold2_str . ';' . $threadhold3_str; |
|
196 | + $threadhold_total = $threadhold1_str.';'.$threadhold2_str.';'.$threadhold3_str; |
|
197 | 197 | |
198 | 198 | if (isset($try[$i]) && $try[$i] == 'on') { |
199 | 199 | $try_str = 1; |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $question_str = $select_question[$i]; |
220 | 220 | } |
221 | 221 | |
222 | - $destination[$i] = $threadhold_total . '@@' . $try_str . '@@' . $lp_str . '@@' . $question_str . '@@' . $url_str; |
|
222 | + $destination[$i] = $threadhold_total.'@@'.$try_str.'@@'.$lp_str.'@@'.$question_str.'@@'.$url_str; |
|
223 | 223 | |
224 | 224 | // checks if field is empty |
225 | 225 | if (empty($reponse[$i]) && $reponse[$i] != '0') { |
@@ -277,12 +277,12 @@ discard block |
||
277 | 277 | $question_str = $selectQuestionNoError; |
278 | 278 | } |
279 | 279 | |
280 | - $destination_noerror = $threadhold_total . '@@' . $try_str . '@@' . $lp_str . '@@' . $question_str . '@@' . $url_str; |
|
280 | + $destination_noerror = $threadhold_total.'@@'.$try_str.'@@'.$lp_str.'@@'.$question_str.'@@'.$url_str; |
|
281 | 281 | |
282 | 282 | if (empty($msgErr)) { |
283 | 283 | for ($i = 1; $i <= $nbrAnswers; $i++) { |
284 | 284 | if ($debug > 0) { |
285 | - echo str_repeat(' ', 4) . '$answerType is HOT_SPOT' . "<br />\n"; |
|
285 | + echo str_repeat(' ', 4).'$answerType is HOT_SPOT'."<br />\n"; |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | $reponse[$i] = trim($reponse[$i]); |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $weighting[$i] = ($weighting[$i]); //it can be float |
291 | 291 | |
292 | 292 | if ($weighting[$i]) { |
293 | - $questionWeighting+=$weighting[$i]; |
|
293 | + $questionWeighting += $weighting[$i]; |
|
294 | 294 | } |
295 | 295 | // creates answer |
296 | 296 | $objAnswer->createAnswer( |
@@ -325,14 +325,14 @@ discard block |
||
325 | 325 | $editQuestion = $questionId; |
326 | 326 | unset($modifyAnswers); |
327 | 327 | |
328 | - echo '<script type="text/javascript">window.location.href="' . $hotspot_admin_url . '&message=ItemUpdated"</script>'; |
|
328 | + echo '<script type="text/javascript">window.location.href="'.$hotspot_admin_url.'&message=ItemUpdated"</script>'; |
|
329 | 329 | } |
330 | 330 | } |
331 | 331 | } |
332 | 332 | |
333 | 333 | if ($modifyAnswers) { |
334 | 334 | if ($debug > 0) { |
335 | - echo str_repeat(' ', 0) . '$modifyAnswers is set' . "<br />\n"; |
|
335 | + echo str_repeat(' ', 0).'$modifyAnswers is set'."<br />\n"; |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | // construction of the Answer object |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | Session::write('objAnswer', $objAnswer); |
341 | 341 | |
342 | 342 | if ($debug > 0) { |
343 | - echo str_repeat(' ', 2) . '$answerType is HOT_SPOT' . "<br />\n"; |
|
343 | + echo str_repeat(' ', 2).'$answerType is HOT_SPOT'."<br />\n"; |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | if ($answerType == HOT_SPOT_DELINEATION) { |
@@ -521,11 +521,11 @@ discard block |
||
521 | 521 | } |
522 | 522 | |
523 | 523 | if ($debug > 0) { |
524 | - echo str_repeat(' ', 2) . '$usedInSeveralExercises is untrue' . "<br />\n"; |
|
524 | + echo str_repeat(' ', 2).'$usedInSeveralExercises is untrue'."<br />\n"; |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | if ($debug > 0) { |
528 | - echo str_repeat(' ', 4) . '$answerType is HOT_SPOT' . "<br />\n"; |
|
528 | + echo str_repeat(' ', 4).'$answerType is HOT_SPOT'."<br />\n"; |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | if ($answerType == HOT_SPOT_DELINEATION) { |
@@ -565,14 +565,14 @@ discard block |
||
565 | 565 | |
566 | 566 | Display::tag( |
567 | 567 | 'h3', |
568 | - get_lang('Question') . ": " . $questionName . Display::return_icon('info3.gif', strip_tags(get_lang('HotspotChoose'))) |
|
568 | + get_lang('Question').": ".$questionName.Display::return_icon('info3.gif', strip_tags(get_lang('HotspotChoose'))) |
|
569 | 569 | ); |
570 | 570 | |
571 | 571 | if (!empty($msgErr)) { |
572 | 572 | Display::display_normal_message($msgErr); //main API |
573 | 573 | } |
574 | 574 | |
575 | - $hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&hotspotadmin=' . $modifyAnswers . '&exerciseId=' . $exerciseId . '&' . api_get_cidreq(); |
|
575 | + $hotspot_admin_url = api_get_path(WEB_CODE_PATH).'exercice/admin.php?'.api_get_cidreq().'&hotspotadmin='.$modifyAnswers.'&exerciseId='.$exerciseId.'&'.api_get_cidreq(); |
|
576 | 576 | ?> |
577 | 577 | <form method="post" action="<?php echo $hotspot_admin_url; ?>" class="form-horizontal" id="frm_exercise" name="frm_exercise"> |
578 | 578 | <div class="form-group"> |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | <th><?php echo get_lang('Comment'); ?></th> |
612 | 612 | <?php |
613 | 613 | if ($answerType == HOT_SPOT_DELINEATION) { |
614 | - echo '<th >' . get_lang('Scenario') . '</th>'; |
|
614 | + echo '<th >'.get_lang('Scenario').'</th>'; |
|
615 | 615 | } |
616 | 616 | ?> |
617 | 617 | <?php |
@@ -643,36 +643,36 @@ discard block |
||
643 | 643 | $isSelected = true; |
644 | 644 | $selected = 'selected="selected"'; |
645 | 645 | } |
646 | - $option_lp.='<option value="' . $id . '" ' . $selected . '>' . $details['lp_name'] . '</option>'; |
|
646 | + $option_lp .= '<option value="'.$id.'" '.$selected.'>'.$details['lp_name'].'</option>'; |
|
647 | 647 | } |
648 | 648 | |
649 | 649 | if ($isSelected) { |
650 | - $option_lp = '<option value="0">' . get_lang('SelectTargetLP') . '</option>' . $option_lp; |
|
650 | + $option_lp = '<option value="0">'.get_lang('SelectTargetLP').'</option>'.$option_lp; |
|
651 | 651 | } else { |
652 | - $option_lp = '<option value="0" selected="selected" >' . get_lang('SelectTargetLP') . '</option>' . $option_lp; |
|
652 | + $option_lp = '<option value="0" selected="selected" >'.get_lang('SelectTargetLP').'</option>'.$option_lp; |
|
653 | 653 | } |
654 | 654 | |
655 | 655 | // Feedback SELECT |
656 | 656 | $question_list = $objExercise->selectQuestionList(); |
657 | 657 | $option_feed = ''; |
658 | - $option_feed.='<option value="0">' . get_lang('SelectTargetQuestion') . '</option>'; |
|
658 | + $option_feed .= '<option value="0">'.get_lang('SelectTargetQuestion').'</option>'; |
|
659 | 659 | |
660 | 660 | foreach ($question_list as $key => $questionid) { |
661 | 661 | $selected = ''; |
662 | 662 | $question = Question::read($questionid); |
663 | - $val = 'Q' . $key . ' :' . substrwords($question->selectTitle(), ICON_SIZE_SMALL); |
|
663 | + $val = 'Q'.$key.' :'.substrwords($question->selectTitle(), ICON_SIZE_SMALL); |
|
664 | 664 | |
665 | 665 | if (isset($select_question[$i]) && $questionid == $select_question[$i]) { |
666 | 666 | $selected = 'selected="selected"'; |
667 | 667 | } |
668 | 668 | |
669 | - $option_feed.='<option value="' . $questionid . '" ' . $selected . ' >' . $val . '</option>'; |
|
669 | + $option_feed .= '<option value="'.$questionid.'" '.$selected.' >'.$val.'</option>'; |
|
670 | 670 | } |
671 | 671 | |
672 | 672 | if (isset($select_question[$i]) && $select_question[$i] == -1) { |
673 | - $option_feed .= '<option value="-1" selected="selected" >' . get_lang('ExitTest') . '</option>'; |
|
673 | + $option_feed .= '<option value="-1" selected="selected" >'.get_lang('ExitTest').'</option>'; |
|
674 | 674 | } else { |
675 | - $option_feed .= '<option value="-1">' . get_lang('ExitTest') . '</option>'; |
|
675 | + $option_feed .= '<option value="-1">'.get_lang('ExitTest').'</option>'; |
|
676 | 676 | } |
677 | 677 | |
678 | 678 | //-------- IF it is a delineation |
@@ -688,9 +688,9 @@ discard block |
||
688 | 688 | $selected2 = 'selected="selected"'; |
689 | 689 | if ($k == $threadhold3[$i]) |
690 | 690 | $selected3 = 'selected="selected"'; |
691 | - $option1.='<option ' . $selected1 . ' >' . $k . ' % </option>'; |
|
692 | - $option2.='<option ' . $selected2 . ' >' . $k . ' % </option>'; |
|
693 | - $option3.='<option ' . $selected3 . '>' . $k . ' %</option>'; |
|
691 | + $option1 .= '<option '.$selected1.' >'.$k.' % </option>'; |
|
692 | + $option2 .= '<option '.$selected2.' >'.$k.' % </option>'; |
|
693 | + $option3 .= '<option '.$selected3.'>'.$k.' %</option>'; |
|
694 | 694 | } |
695 | 695 | ?> |
696 | 696 | <tr> |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | <div class="checkbox"> |
735 | 735 | <p> |
736 | 736 | <label> |
737 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
737 | + <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
738 | 738 | <?php echo get_lang('TryAgain'); ?> |
739 | 739 | </label> |
740 | 740 | </p> |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | <div class="checkbox"> |
788 | 788 | <p> |
789 | 789 | <label> |
790 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
790 | + <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
791 | 791 | <?php echo get_lang('TryAgain'); ?> |
792 | 792 | </label> |
793 | 793 | </p> |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | <div class="checkbox"> |
853 | 853 | <p> |
854 | 854 | <label> |
855 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) echo'checked'; ?> /> |
|
855 | + <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) echo'checked'; ?> /> |
|
856 | 856 | <?php echo get_lang('TryAgain'); ?> |
857 | 857 | </label> |
858 | 858 | </p> |
@@ -892,12 +892,12 @@ discard block |
||
892 | 892 | <input class="form-control" type="text" name="reponse[<?php echo $i; ?>]" value="<?php echo Security::remove_XSS($responseValue); ?>" /> |
893 | 893 | </td> |
894 | 894 | <?php |
895 | - $form = new FormValidator('form_' . $i); |
|
895 | + $form = new FormValidator('form_'.$i); |
|
896 | 896 | $config = array( |
897 | 897 | 'ToolbarSet' => 'TestProposedAnswer', |
898 | 898 | 'cols-size' => [0, 12, 0] |
899 | 899 | ); |
900 | - $form->addHtmlEditor('comment[' . $i . ']', null, false, false, $config); |
|
900 | + $form->addHtmlEditor('comment['.$i.']', null, false, false, $config); |
|
901 | 901 | $renderer = $form->defaultRenderer(); |
902 | 902 | $form_template = '{content}'; |
903 | 903 | $renderer->setFormTemplate($form_template); |
@@ -906,7 +906,7 @@ discard block |
||
906 | 906 | {element}'; |
907 | 907 | $renderer->setElementTemplate($element_template); |
908 | 908 | |
909 | - $form->setDefaults(array('comment[' . $i . ']' => $commentValue)); |
|
909 | + $form->setDefaults(array('comment['.$i.']' => $commentValue)); |
|
910 | 910 | $return = $form->return_form(); |
911 | 911 | ?> |
912 | 912 | <td colspan="2" align="left" ><?php echo $return; ?></td> |
@@ -945,36 +945,36 @@ discard block |
||
945 | 945 | $selected = 'selected="selected"'; |
946 | 946 | $isSelected = true; |
947 | 947 | } |
948 | - $option_lp.='<option value="' . $id . '" ' . $selected . '>' . $details['lp_name'] . '</option>'; |
|
948 | + $option_lp .= '<option value="'.$id.'" '.$selected.'>'.$details['lp_name'].'</option>'; |
|
949 | 949 | } |
950 | 950 | |
951 | 951 | if ($isSelected) { |
952 | - $option_lp = '<option value="0">' . get_lang('SelectTargetLP') . '</option>' . $option_lp; |
|
952 | + $option_lp = '<option value="0">'.get_lang('SelectTargetLP').'</option>'.$option_lp; |
|
953 | 953 | } else { |
954 | - $option_lp = '<option value="0" selected="selected" >' . get_lang('SelectTargetLP') . '</option>' . $option_lp; |
|
954 | + $option_lp = '<option value="0" selected="selected" >'.get_lang('SelectTargetLP').'</option>'.$option_lp; |
|
955 | 955 | } |
956 | 956 | |
957 | 957 | // Feedback SELECT |
958 | 958 | $question_list = $objExercise->selectQuestionList(); |
959 | 959 | $option_feed = ''; |
960 | - $option_feed.='<option value="0">' . get_lang('SelectTargetQuestion') . '</option>'; |
|
960 | + $option_feed .= '<option value="0">'.get_lang('SelectTargetQuestion').'</option>'; |
|
961 | 961 | $details = isset($details) ? $details : null; |
962 | 962 | $id = isset($id) ? $id : 0; |
963 | 963 | $selectQuestionNoError = isset($selectQuestionNoError) ? $selectQuestionNoError : null; |
964 | 964 | foreach ($question_list as $key => $questionid) { |
965 | 965 | $selected = ''; |
966 | 966 | $question = Question::read($questionid); |
967 | - $val = 'Q' . $key . ' :' . substrwords($question->selectTitle(), ICON_SIZE_SMALL); |
|
967 | + $val = 'Q'.$key.' :'.substrwords($question->selectTitle(), ICON_SIZE_SMALL); |
|
968 | 968 | $select_lp_id[$id] = $details['lp_name']; |
969 | 969 | if ($questionid == $selectQuestionNoError) { |
970 | 970 | $selected = 'selected="selected"'; |
971 | 971 | } |
972 | - $option_feed.='<option value="' . $questionid . '" ' . $selected . ' >' . $val . '</option>'; |
|
972 | + $option_feed .= '<option value="'.$questionid.'" '.$selected.' >'.$val.'</option>'; |
|
973 | 973 | } |
974 | 974 | if ($selectQuestionNoError == -1) { |
975 | - $option_feed.='<option value="-1" selected="selected" >' . get_lang('ExitTest') . '</option>'; |
|
975 | + $option_feed .= '<option value="-1" selected="selected" >'.get_lang('ExitTest').'</option>'; |
|
976 | 976 | } else { |
977 | - $option_feed.='<option value="-1">' . get_lang('ExitTest') . '</option>'; |
|
977 | + $option_feed .= '<option value="-1">'.get_lang('ExitTest').'</option>'; |
|
978 | 978 | } |
979 | 979 | |
980 | 980 | if ($answerType == HOT_SPOT_DELINEATION) { |
@@ -1065,6 +1065,6 @@ discard block |
||
1065 | 1065 | </script> |
1066 | 1066 | <?php |
1067 | 1067 | if ($debug > 0) { |
1068 | - echo str_repeat(' ', 0) . '$modifyAnswers was set - end' . "<br />\n"; |
|
1068 | + echo str_repeat(' ', 0).'$modifyAnswers was set - end'."<br />\n"; |
|
1069 | 1069 | } |
1070 | 1070 | } |
@@ -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> |