@@ -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 |
@@ -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]; |
@@ -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 ($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) { |
@@ -512,11 +512,11 @@ discard block |
||
512 | 512 | } |
513 | 513 | |
514 | 514 | if ($debug > 0) { |
515 | - echo str_repeat(' ', 2) . '$usedInSeveralExercises is untrue' . "<br />\n"; |
|
515 | + echo str_repeat(' ', 2).'$usedInSeveralExercises is untrue'."<br />\n"; |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | if ($debug > 0) { |
519 | - echo str_repeat(' ', 4) . '$answerType is HOT_SPOT' . "<br />\n"; |
|
519 | + echo str_repeat(' ', 4).'$answerType is HOT_SPOT'."<br />\n"; |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | if ($answerType == HOT_SPOT_DELINEATION) { |
@@ -554,13 +554,13 @@ discard block |
||
554 | 554 | ); |
555 | 555 | } |
556 | 556 | |
557 | - Display::tag('h3', get_lang('Question') . ": " . $questionName . ' <img src="../img/info3.gif" title="' . strip_tags(get_lang('HotspotChoose')) . '" alt="' . strip_tags(get_lang('HotspotChoose')) . '" />'); |
|
557 | + Display::tag('h3', get_lang('Question').": ".$questionName.' <img src="../img/info3.gif" title="'.strip_tags(get_lang('HotspotChoose')).'" alt="'.strip_tags(get_lang('HotspotChoose')).'" />'); |
|
558 | 558 | |
559 | 559 | if (!empty($msgErr)) { |
560 | 560 | Display::display_normal_message($msgErr); //main API |
561 | 561 | } |
562 | 562 | |
563 | - $hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&hotspotadmin=' . $modifyAnswers . '&exerciseId=' . $exerciseId . '&' . api_get_cidreq(); |
|
563 | + $hotspot_admin_url = api_get_path(WEB_CODE_PATH).'exercice/admin.php?'.api_get_cidreq().'&hotspotadmin='.$modifyAnswers.'&exerciseId='.$exerciseId.'&'.api_get_cidreq(); |
|
564 | 564 | ?> |
565 | 565 | <form method="post" action="<?php echo $hotspot_admin_url; ?>" class="form-horizontal" id="frm_exercise" name="frm_exercise"> |
566 | 566 | <div class="form-group"> |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | <th><?php echo get_lang('Comment'); ?></th> |
600 | 600 | <?php |
601 | 601 | if ($answerType == HOT_SPOT_DELINEATION) { |
602 | - echo '<th >' . get_lang('Scenario') . '</th>'; |
|
602 | + echo '<th >'.get_lang('Scenario').'</th>'; |
|
603 | 603 | } |
604 | 604 | ?> |
605 | 605 | <?php |
@@ -631,37 +631,37 @@ discard block |
||
631 | 631 | $isSelected = true; |
632 | 632 | $selected = 'selected="selected"'; |
633 | 633 | } |
634 | - $option_lp.='<option value="' . $id . '" ' . $selected . '>' . $details['lp_name'] . '</option>'; |
|
634 | + $option_lp .= '<option value="'.$id.'" '.$selected.'>'.$details['lp_name'].'</option>'; |
|
635 | 635 | } |
636 | 636 | |
637 | 637 | if ($isSelected) { |
638 | - $option_lp = '<option value="0">' . get_lang('SelectTargetLP') . '</option>' . $option_lp; |
|
638 | + $option_lp = '<option value="0">'.get_lang('SelectTargetLP').'</option>'.$option_lp; |
|
639 | 639 | } else { |
640 | - $option_lp = '<option value="0" selected="selected" >' . get_lang('SelectTargetLP') . '</option>' . $option_lp; |
|
640 | + $option_lp = '<option value="0" selected="selected" >'.get_lang('SelectTargetLP').'</option>'.$option_lp; |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | // Feedback SELECT |
644 | 644 | $question_list = $objExercise->selectQuestionList(); |
645 | 645 | $option_feed = ''; |
646 | - $option_feed.='<option value="0">' . get_lang('SelectTargetQuestion') . '</option>'; |
|
646 | + $option_feed .= '<option value="0">'.get_lang('SelectTargetQuestion').'</option>'; |
|
647 | 647 | |
648 | 648 | foreach ($question_list as $key => $questionid) { |
649 | 649 | $selected = ''; |
650 | 650 | $question = Question::read($questionid); |
651 | - $val = 'Q' . $key . ' :' . substrwords($question->selectTitle(), ICON_SIZE_SMALL); |
|
651 | + $val = 'Q'.$key.' :'.substrwords($question->selectTitle(), ICON_SIZE_SMALL); |
|
652 | 652 | $select_lp_id[$id] = $details['lp_name']; |
653 | 653 | |
654 | 654 | if ($questionid == $select_question[$i]) { |
655 | 655 | $selected = 'selected="selected"'; |
656 | 656 | } |
657 | 657 | |
658 | - $option_feed.='<option value="' . $questionid . '" ' . $selected . ' >' . $val . '</option>'; |
|
658 | + $option_feed .= '<option value="'.$questionid.'" '.$selected.' >'.$val.'</option>'; |
|
659 | 659 | } |
660 | 660 | |
661 | 661 | if ($select_question[$i] == -1) { |
662 | - $option_feed .= '<option value="-1" selected="selected" >' . get_lang('ExitTest') . '</option>'; |
|
662 | + $option_feed .= '<option value="-1" selected="selected" >'.get_lang('ExitTest').'</option>'; |
|
663 | 663 | } else { |
664 | - $option_feed .= '<option value="-1">' . get_lang('ExitTest') . '</option>'; |
|
664 | + $option_feed .= '<option value="-1">'.get_lang('ExitTest').'</option>'; |
|
665 | 665 | } |
666 | 666 | |
667 | 667 | //-------- IF it is a delineation |
@@ -675,9 +675,9 @@ discard block |
||
675 | 675 | $selected2 = 'selected="selected"'; |
676 | 676 | if ($k == $threadhold3[$i]) |
677 | 677 | $selected3 = 'selected="selected"'; |
678 | - $option1.='<option ' . $selected1 . ' >' . $k . ' % </option>'; |
|
679 | - $option2.='<option ' . $selected2 . ' >' . $k . ' % </option>'; |
|
680 | - $option3.='<option ' . $selected3 . '>' . $k . ' %</option>'; |
|
678 | + $option1 .= '<option '.$selected1.' >'.$k.' % </option>'; |
|
679 | + $option2 .= '<option '.$selected2.' >'.$k.' % </option>'; |
|
680 | + $option3 .= '<option '.$selected3.'>'.$k.' %</option>'; |
|
681 | 681 | } |
682 | 682 | ?> |
683 | 683 | <tr> |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | <div class="checkbox"> |
722 | 722 | <p> |
723 | 723 | <label> |
724 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
724 | + <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
725 | 725 | <?php echo get_lang('TryAgain'); ?> |
726 | 726 | </label> |
727 | 727 | </p> |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | <div class="checkbox"> |
775 | 775 | <p> |
776 | 776 | <label> |
777 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
777 | + <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
778 | 778 | <?php echo get_lang('TryAgain'); ?> |
779 | 779 | </label> |
780 | 780 | </p> |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | <div class="checkbox"> |
840 | 840 | <p> |
841 | 841 | <label> |
842 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
842 | + <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
843 | 843 | <?php echo get_lang('TryAgain'); ?> |
844 | 844 | </label> |
845 | 845 | </p> |
@@ -879,12 +879,12 @@ discard block |
||
879 | 879 | <input class="form-control" type="text" name="reponse[<?php echo $i; ?>]" value="<?php echo Security::remove_XSS($responseValue); ?>" /> |
880 | 880 | </td> |
881 | 881 | <?php |
882 | - $form = new FormValidator('form_' . $i); |
|
882 | + $form = new FormValidator('form_'.$i); |
|
883 | 883 | $config = array( |
884 | 884 | 'ToolbarSet' => 'TestProposedAnswer', |
885 | 885 | 'cols-size' => [0, 12, 0] |
886 | 886 | ); |
887 | - $form->addHtmlEditor('comment[' . $i . ']', null, false, false, $config); |
|
887 | + $form->addHtmlEditor('comment['.$i.']', null, false, false, $config); |
|
888 | 888 | $renderer = $form->defaultRenderer(); |
889 | 889 | $form_template = '{content}'; |
890 | 890 | $renderer->setFormTemplate($form_template); |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | {element}'; |
894 | 894 | $renderer->setElementTemplate($element_template); |
895 | 895 | |
896 | - $form->setDefaults(array('comment[' . $i . ']' => $commentValue)); |
|
896 | + $form->setDefaults(array('comment['.$i.']' => $commentValue)); |
|
897 | 897 | $return = $form->return_form(); |
898 | 898 | ?> |
899 | 899 | <td colspan="2" align="left" ><?php echo $return; ?></td> |
@@ -932,36 +932,36 @@ discard block |
||
932 | 932 | $selected = 'selected="selected"'; |
933 | 933 | $isSelected = true; |
934 | 934 | } |
935 | - $option_lp.='<option value="' . $id . '" ' . $selected . '>' . $details['lp_name'] . '</option>'; |
|
935 | + $option_lp .= '<option value="'.$id.'" '.$selected.'>'.$details['lp_name'].'</option>'; |
|
936 | 936 | } |
937 | 937 | |
938 | 938 | if ($isSelected) { |
939 | - $option_lp = '<option value="0">' . get_lang('SelectTargetLP') . '</option>' . $option_lp; |
|
939 | + $option_lp = '<option value="0">'.get_lang('SelectTargetLP').'</option>'.$option_lp; |
|
940 | 940 | } else { |
941 | - $option_lp = '<option value="0" selected="selected" >' . get_lang('SelectTargetLP') . '</option>' . $option_lp; |
|
941 | + $option_lp = '<option value="0" selected="selected" >'.get_lang('SelectTargetLP').'</option>'.$option_lp; |
|
942 | 942 | } |
943 | 943 | |
944 | 944 | // Feedback SELECT |
945 | 945 | $question_list = $objExercise->selectQuestionList(); |
946 | 946 | $option_feed = ''; |
947 | - $option_feed.='<option value="0">' . get_lang('SelectTargetQuestion') . '</option>'; |
|
947 | + $option_feed .= '<option value="0">'.get_lang('SelectTargetQuestion').'</option>'; |
|
948 | 948 | $details = isset($details) ? $details : null; |
949 | 949 | $id = isset($id) ? $id : 0; |
950 | 950 | $selectQuestionNoError = isset($selectQuestionNoError) ? $selectQuestionNoError : null; |
951 | 951 | foreach ($question_list as $key => $questionid) { |
952 | 952 | $selected = ''; |
953 | 953 | $question = Question::read($questionid); |
954 | - $val = 'Q' . $key . ' :' . substrwords($question->selectTitle(), ICON_SIZE_SMALL); |
|
954 | + $val = 'Q'.$key.' :'.substrwords($question->selectTitle(), ICON_SIZE_SMALL); |
|
955 | 955 | $select_lp_id[$id] = $details['lp_name']; |
956 | 956 | if ($questionid == $selectQuestionNoError) { |
957 | 957 | $selected = 'selected="selected"'; |
958 | 958 | } |
959 | - $option_feed.='<option value="' . $questionid . '" ' . $selected . ' >' . $val . '</option>'; |
|
959 | + $option_feed .= '<option value="'.$questionid.'" '.$selected.' >'.$val.'</option>'; |
|
960 | 960 | } |
961 | 961 | if ($selectQuestionNoError == -1) { |
962 | - $option_feed.='<option value="-1" selected="selected" >' . get_lang('ExitTest') . '</option>'; |
|
962 | + $option_feed .= '<option value="-1" selected="selected" >'.get_lang('ExitTest').'</option>'; |
|
963 | 963 | } else { |
964 | - $option_feed.='<option value="-1">' . get_lang('ExitTest') . '</option>'; |
|
964 | + $option_feed .= '<option value="-1">'.get_lang('ExitTest').'</option>'; |
|
965 | 965 | } |
966 | 966 | |
967 | 967 | if ($answerType == HOT_SPOT_DELINEATION) { |
@@ -1052,6 +1052,6 @@ discard block |
||
1052 | 1052 | </script> |
1053 | 1053 | <?php |
1054 | 1054 | if ($debug > 0) { |
1055 | - echo str_repeat(' ', 0) . '$modifyAnswers was set - end' . "<br />\n"; |
|
1055 | + echo str_repeat(' ', 0).'$modifyAnswers was set - end'."<br />\n"; |
|
1056 | 1056 | } |
1057 | 1057 | } |
@@ -34,18 +34,18 @@ discard block |
||
34 | 34 | $html = '<table class="data_table"> |
35 | 35 | <tr> |
36 | 36 | <th width="10px"> |
37 | - ' . get_lang('Number') . ' |
|
37 | + ' . get_lang('Number').' |
|
38 | 38 | </th> |
39 | 39 | <th width="10px"> |
40 | - ' . get_lang('True') . ' |
|
40 | + ' . get_lang('True').' |
|
41 | 41 | </th> |
42 | 42 | <th width="50%"> |
43 | - ' . get_lang('Answer') . ' |
|
43 | + ' . get_lang('Answer').' |
|
44 | 44 | </th>'; |
45 | 45 | |
46 | - $html .='<th>' . get_lang('Comment') . '</th>'; |
|
47 | - $html .='</tr>'; |
|
48 | - $form->addElement('label', get_lang('Answers') . '<br /> <img src="../img/fill_field.png">', $html); |
|
46 | + $html .= '<th>'.get_lang('Comment').'</th>'; |
|
47 | + $html .= '</tr>'; |
|
48 | + $form->addElement('label', get_lang('Answers').'<br /> <img src="../img/fill_field.png">', $html); |
|
49 | 49 | $defaults = array(); |
50 | 50 | $correct = 0; |
51 | 51 | $answer = false; |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | for ($i = 1; $i <= $nb_answers; ++$i) { |
78 | 78 | /* si la reponse est de type objet */ |
79 | 79 | if (is_object($answer)) { |
80 | - $defaults['answer[' . $i . ']'] = $answer->answer[$i]; |
|
81 | - $defaults['comment[' . $i . ']'] = $answer->comment[$i]; |
|
82 | - $defaults['correct[' . $i . ']'] = $answer->correct[$i]; |
|
80 | + $defaults['answer['.$i.']'] = $answer->answer[$i]; |
|
81 | + $defaults['comment['.$i.']'] = $answer->comment[$i]; |
|
82 | + $defaults['correct['.$i.']'] = $answer->correct[$i]; |
|
83 | 83 | |
84 | 84 | // start |
85 | 85 | $scoreA = $answer->weighting[$i]; |
@@ -101,16 +101,16 @@ discard block |
||
101 | 101 | $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'comment['.$i.']'); |
102 | 102 | //$renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'weighting['.$i.']'); |
103 | 103 | |
104 | - $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"'); |
|
104 | + $answer_number = $form->addElement('text', 'counter['.$i.']', null, 'value="'.$i.'"'); |
|
105 | 105 | $answer_number->freeze(); |
106 | 106 | |
107 | - $form->addElement('checkbox', 'correct[' . $i . ']', null, null, 'class="checkbox"'); |
|
108 | - $boxes_names[] = 'correct[' . $i . ']'; |
|
107 | + $form->addElement('checkbox', 'correct['.$i.']', null, null, 'class="checkbox"'); |
|
108 | + $boxes_names[] = 'correct['.$i.']'; |
|
109 | 109 | |
110 | - $form->addElement('html_editor', 'answer[' . $i . ']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); |
|
111 | - $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required'); |
|
110 | + $form->addElement('html_editor', 'answer['.$i.']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); |
|
111 | + $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required'); |
|
112 | 112 | |
113 | - $form->addElement('html_editor', 'comment[' . $i . ']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); |
|
113 | + $form->addElement('html_editor', 'comment['.$i.']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); |
|
114 | 114 | |
115 | 115 | $form->addElement('html', '</tr>'); |
116 | 116 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | // Reponses correctes |
177 | 177 | $nbr_corrects = 0; |
178 | 178 | for ($i = 1; $i <= $nb_answers; $i++) { |
179 | - $goodAnswer = trim($form->getSubmitValue('correct[' . $i . ']')); |
|
179 | + $goodAnswer = trim($form->getSubmitValue('correct['.$i.']')); |
|
180 | 180 | if ($goodAnswer) { |
181 | 181 | $nbr_corrects++; |
182 | 182 | } |
@@ -195,9 +195,9 @@ discard block |
||
195 | 195 | $test = $form->getSubmitValue('pts'); |
196 | 196 | |
197 | 197 | for ($i = 1; $i <= $nb_answers; $i++) { |
198 | - $answer = trim($form->getSubmitValue('answer[' . $i . ']')); |
|
199 | - $comment = trim($form->getSubmitValue('comment[' . $i . ']')); |
|
200 | - $goodAnswer = trim($form->getSubmitValue('correct[' . $i . ']')); |
|
198 | + $answer = trim($form->getSubmitValue('answer['.$i.']')); |
|
199 | + $comment = trim($form->getSubmitValue('comment['.$i.']')); |
|
200 | + $goodAnswer = trim($form->getSubmitValue('correct['.$i.']')); |
|
201 | 201 | |
202 | 202 | if ($goodAnswer) { |
203 | 203 | $weighting = abs($answer_score); |
@@ -225,12 +225,12 @@ discard block |
||
225 | 225 | $score = null |
226 | 226 | ) { |
227 | 227 | $header = parent::return_header($feedback_type, $counter, $score); |
228 | - $header .= '<table class="'.$this->question_table_class .'"> |
|
228 | + $header .= '<table class="'.$this->question_table_class.'"> |
|
229 | 229 | <tr> |
230 | - <th>' . get_lang("Choice") . '</th> |
|
231 | - <th>' . get_lang("ExpectedChoice") . '</th> |
|
232 | - <th>' . get_lang("Answer") . '</th>'; |
|
233 | - $header .= '<th>' . get_lang("Comment") . '</th>'; |
|
230 | + <th>' . get_lang("Choice").'</th> |
|
231 | + <th>' . get_lang("ExpectedChoice").'</th> |
|
232 | + <th>' . get_lang("Answer").'</th>'; |
|
233 | + $header .= '<th>'.get_lang("Comment").'</th>'; |
|
234 | 234 | $header .= '</tr>'; |
235 | 235 | |
236 | 236 | return $header; |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $objExcercise = $_SESSION['objExercise']; |
15 | 15 | $exerciseId = $objExcercise->selectId(); |
16 | 16 | // Save clicking order |
17 | -$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['ids'])+1; |
|
17 | +$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['ids']) + 1; |
|
18 | 18 | if ($_GET['answerId'] == "0") // click is NOT on a hotspot |
19 | 19 | { |
20 | 20 | $hit = 0; |
@@ -23,18 +23,18 @@ discard block |
||
23 | 23 | else // user clicked ON a hotspot |
24 | 24 | { |
25 | 25 | $hit = 1; |
26 | - $answerId = api_substr($_GET['answerId'],22,2); |
|
26 | + $answerId = api_substr($_GET['answerId'], 22, 2); |
|
27 | 27 | // Save into session |
28 | 28 | $_SESSION['exerciseResult'][$questionId][$answerId] = $hit; |
29 | 29 | } |
30 | 30 | //round-up the coordinates |
31 | -$coords = explode('/',$coordinates); |
|
31 | +$coords = explode('/', $coordinates); |
|
32 | 32 | $coordinates = ''; |
33 | 33 | foreach ($coords as $coord) { |
34 | - list($x,$y) = explode(';',$coord); |
|
34 | + list($x, $y) = explode(';', $coord); |
|
35 | 35 | $coordinates .= round($x).';'.round($y).'/'; |
36 | 36 | } |
37 | -$coordinates = substr($coordinates,0,-1); |
|
37 | +$coordinates = substr($coordinates, 0, -1); |
|
38 | 38 | |
39 | 39 | $TBL_TRACK_E_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT); |
40 | 40 | // Save into db |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | 'quiz_id' => $exerciseId, |
45 | 45 | 'question_id' => $questionId, |
46 | 46 | 'answer_id' => $answerId, |
47 | - 'correct' => $hit , |
|
47 | + 'correct' => $hit, |
|
48 | 48 | 'coordinate' => $coordinates |
49 | 49 | ]; |
50 | 50 | // Save insert id into session if users changes answer. |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | $learnpath_item_id = Security::remove_XSS($_REQUEST['learnpath_item_id']); |
51 | 51 | } |
52 | 52 | |
53 | -$_SESSION['hotspot_coord']=array(); |
|
54 | -$newquestionList= $_SESSION['newquestionList']; |
|
55 | -$questionList = $_SESSION['questionList']; |
|
53 | +$_SESSION['hotspot_coord'] = array(); |
|
54 | +$newquestionList = $_SESSION['newquestionList']; |
|
55 | +$questionList = $_SESSION['questionList']; |
|
56 | 56 | |
57 | 57 | $exerciseId = intval($_GET['exerciseId']); |
58 | 58 | $exerciseType = intval($_GET['exerciseType']); |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | |
79 | 79 | $choice_value = ''; |
80 | 80 | |
81 | -$user_array = substr($user_array,0,-1); |
|
81 | +$user_array = substr($user_array, 0, -1); |
|
82 | 82 | |
83 | -if (isset($_GET['choice'])){ |
|
83 | +if (isset($_GET['choice'])) { |
|
84 | 84 | $choice_value = intval($_GET['choice']); |
85 | 85 | } |
86 | 86 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | $choice = array(); |
130 | -$questionid= $questionList[$questionNum]; |
|
130 | +$questionid = $questionList[$questionNum]; |
|
131 | 131 | // $choice_value => value of the user selection |
132 | 132 | $choice[$questionid] = isset($choice_value) ? $choice_value : null; |
133 | 133 | |
@@ -144,11 +144,11 @@ discard block |
||
144 | 144 | $exerciseResult = $choice; |
145 | 145 | } else { |
146 | 146 | // gets the question ID from $choice. It is the key of the array |
147 | - list($key)=array_keys($choice); |
|
147 | + list($key) = array_keys($choice); |
|
148 | 148 | // if the user didn't already answer this question |
149 | - if(!isset($exerciseResult[$key])) { |
|
149 | + if (!isset($exerciseResult[$key])) { |
|
150 | 150 | // stores the user answer into the array |
151 | - $exerciseResult[$key]=$choice[$key]; |
|
151 | + $exerciseResult[$key] = $choice[$key]; |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | } |
@@ -174,26 +174,26 @@ discard block |
||
174 | 174 | |
175 | 175 | // creates a temporary Question object |
176 | 176 | if (in_array($questionid, $questionList)) { |
177 | - $objQuestionTmp = Question :: read($questionid); |
|
178 | - $questionName =$objQuestionTmp->selectTitle(); |
|
179 | - $questionDescription=$objQuestionTmp->selectDescription(); |
|
180 | - $questionWeighting =$objQuestionTmp->selectWeighting(); |
|
181 | - $answerType =$objQuestionTmp->selectType(); |
|
182 | - $quesId =$objQuestionTmp->selectId(); //added by priya saini |
|
177 | + $objQuestionTmp = Question :: read($questionid); |
|
178 | + $questionName = $objQuestionTmp->selectTitle(); |
|
179 | + $questionDescription = $objQuestionTmp->selectDescription(); |
|
180 | + $questionWeighting = $objQuestionTmp->selectWeighting(); |
|
181 | + $answerType = $objQuestionTmp->selectType(); |
|
182 | + $quesId = $objQuestionTmp->selectId(); //added by priya saini |
|
183 | 183 | } |
184 | 184 | |
185 | -$objAnswerTmp=new Answer($questionid); |
|
186 | -$nbrAnswers=$objAnswerTmp->selectNbrAnswers(); |
|
185 | +$objAnswerTmp = new Answer($questionid); |
|
186 | +$nbrAnswers = $objAnswerTmp->selectNbrAnswers(); |
|
187 | 187 | //echo 'answe_type '.$answerType;echo '<br />'; |
188 | 188 | |
189 | 189 | $choice = $exerciseResult[$questionid]; |
190 | -$destination=array(); |
|
191 | -$comment=''; |
|
192 | -$next=1; |
|
190 | +$destination = array(); |
|
191 | +$comment = ''; |
|
192 | +$next = 1; |
|
193 | 193 | $_SESSION['hotspot_coord'] = array(); |
194 | 194 | $_SESSION['hotspot_dest'] = array(); |
195 | 195 | |
196 | -$overlap_color = $missing_color = $excess_color=false; |
|
196 | +$overlap_color = $missing_color = $excess_color = false; |
|
197 | 197 | $organs_at_risk_hit = 0; |
198 | 198 | $wrong_results = false; |
199 | 199 | $hot_spot_load = false; |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $totalScore = 0; |
203 | 203 | |
204 | 204 | if (!empty($choice_value)) { |
205 | - for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) { |
|
205 | + for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) { |
|
206 | 206 | $answer = $objAnswerTmp->selectAnswer($answerId); |
207 | 207 | $answerComment = $objAnswerTmp->selectComment($answerId); |
208 | 208 | $answerDestination = $objAnswerTmp->selectDestination($answerId); |
@@ -213,29 +213,29 @@ discard block |
||
213 | 213 | |
214 | 214 | //delineation |
215 | 215 | $delineation_cord = $objAnswerTmp->selectHotspotCoordinates(1); |
216 | - $answer_delineation_destination=$objAnswerTmp->selectDestination(1); |
|
217 | - if ($dbg_local>0) { error_log(__LINE__.' answerId: '.$answerId.'('.$answerType.') - user delineation_cord: '.$delineation_cord.' - $answer_delineation_destination: '.$answer_delineation_destination,0);} |
|
216 | + $answer_delineation_destination = $objAnswerTmp->selectDestination(1); |
|
217 | + if ($dbg_local > 0) { error_log(__LINE__.' answerId: '.$answerId.'('.$answerType.') - user delineation_cord: '.$delineation_cord.' - $answer_delineation_destination: '.$answer_delineation_destination, 0); } |
|
218 | 218 | |
219 | - switch($answerType) { |
|
219 | + switch ($answerType) { |
|
220 | 220 | // for unique answer |
221 | 221 | case UNIQUE_ANSWER : |
222 | - $studentChoice = ($choice_value == $numAnswer)?1:0; |
|
222 | + $studentChoice = ($choice_value == $numAnswer) ? 1 : 0; |
|
223 | 223 | if ($studentChoice) { |
224 | - $questionScore +=$answerWeighting; |
|
225 | - $totalScore +=$answerWeighting; |
|
226 | - $newquestionList[]=$questionid; |
|
224 | + $questionScore += $answerWeighting; |
|
225 | + $totalScore += $answerWeighting; |
|
226 | + $newquestionList[] = $questionid; |
|
227 | 227 | } |
228 | 228 | break; |
229 | 229 | case HOT_SPOT_DELINEATION : |
230 | - $studentChoice=$choice[$answerId]; |
|
230 | + $studentChoice = $choice[$answerId]; |
|
231 | 231 | if ($studentChoice) { |
232 | - $newquestionList[]=$questionid; |
|
232 | + $newquestionList[] = $questionid; |
|
233 | 233 | } |
234 | - if ($answerId===1) { |
|
235 | - $questionScore +=$answerWeighting; |
|
236 | - $totalScore +=$answerWeighting; |
|
237 | - $_SESSION['hotspot_coord'][1] =$delineation_cord; |
|
238 | - $_SESSION['hotspot_dest'][1] =$answer_delineation_destination; |
|
234 | + if ($answerId === 1) { |
|
235 | + $questionScore += $answerWeighting; |
|
236 | + $totalScore += $answerWeighting; |
|
237 | + $_SESSION['hotspot_coord'][1] = $delineation_cord; |
|
238 | + $_SESSION['hotspot_dest'][1] = $answer_delineation_destination; |
|
239 | 239 | } |
240 | 240 | break; |
241 | 241 | } |
@@ -247,27 +247,27 @@ discard block |
||
247 | 247 | $destination = $answerDestination; |
248 | 248 | $comment = $answerComment; |
249 | 249 | } |
250 | - } elseif($answerType == HOT_SPOT_DELINEATION) { |
|
250 | + } elseif ($answerType == HOT_SPOT_DELINEATION) { |
|
251 | 251 | if ($next) { |
252 | - if ($dbg_local>0) { error_log(__LINE__.' - next',0);} |
|
252 | + if ($dbg_local > 0) { error_log(__LINE__.' - next', 0); } |
|
253 | 253 | $hot_spot_load = true; //apparently the script is called twice |
254 | 254 | $user_answer = $user_array; |
255 | - $_SESSION['exerciseResultCoordinates'][$questionid]=$user_answer; //needed for exercise_result.php |
|
255 | + $_SESSION['exerciseResultCoordinates'][$questionid] = $user_answer; //needed for exercise_result.php |
|
256 | 256 | |
257 | 257 | // we compare only the delineation not the other points |
258 | - $answer_question = $_SESSION['hotspot_coord'][1]; |
|
259 | - $answerDestination = $_SESSION['hotspot_dest'][1]; |
|
258 | + $answer_question = $_SESSION['hotspot_coord'][1]; |
|
259 | + $answerDestination = $_SESSION['hotspot_dest'][1]; |
|
260 | 260 | |
261 | - $poly_user = convert_coordinates($user_answer,'/'); |
|
262 | - $poly_answer = convert_coordinates($answer_question,'|'); |
|
263 | - $max_coord = poly_get_max($poly_user,$poly_answer); |
|
261 | + $poly_user = convert_coordinates($user_answer, '/'); |
|
262 | + $poly_answer = convert_coordinates($answer_question, '|'); |
|
263 | + $max_coord = poly_get_max($poly_user, $poly_answer); |
|
264 | 264 | |
265 | 265 | if (empty($_GET['hotspot'])) { //no user response |
266 | 266 | $overlap = -2; |
267 | 267 | } else { |
268 | - $poly_user_compiled = poly_compile($poly_user,$max_coord); |
|
269 | - $poly_answer_compiled = poly_compile($poly_answer,$max_coord); |
|
270 | - $poly_results = poly_result($poly_answer_compiled,$poly_user_compiled,$max_coord); |
|
268 | + $poly_user_compiled = poly_compile($poly_user, $max_coord); |
|
269 | + $poly_answer_compiled = poly_compile($poly_answer, $max_coord); |
|
270 | + $poly_results = poly_result($poly_answer_compiled, $poly_user_compiled, $max_coord); |
|
271 | 271 | |
272 | 272 | $overlap = $poly_results['both']; |
273 | 273 | $poly_answer_area = $poly_results['s1']; |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | } |
278 | 278 | |
279 | 279 | //$overlap = round(polygons_overlap($poly_answer,$poly_user)); //this is an area in pixels |
280 | - if ($dbg_local>0) { error_log(__LINE__.' - Polygons results are '.print_r($poly_results,1),0);} |
|
280 | + if ($dbg_local > 0) { error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0); } |
|
281 | 281 | if ($overlap < 1) { |
282 | 282 | //shortcut to avoid complicated calculations |
283 | 283 | $final_overlap = 0; |
@@ -285,27 +285,27 @@ discard block |
||
285 | 285 | $final_excess = 100; |
286 | 286 | } else { |
287 | 287 | // the final overlap is the percentage of the initial polygon that is overlapped by the user's polygon |
288 | - $final_overlap = round(((float)$overlap / (float)$poly_answer_area)*100); |
|
289 | - if ($dbg_local>1) { error_log(__LINE__.' - Final overlap is '.$final_overlap,0);} |
|
288 | + $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100); |
|
289 | + if ($dbg_local > 1) { error_log(__LINE__.' - Final overlap is '.$final_overlap, 0); } |
|
290 | 290 | // the final missing area is the percentage of the initial polygon that is not overlapped by the user's polygon |
291 | 291 | $final_missing = 100 - $final_overlap; |
292 | - if ($dbg_local>1) { error_log(__LINE__.' - Final missing is '.$final_missing,0);} |
|
292 | + if ($dbg_local > 1) { error_log(__LINE__.' - Final missing is '.$final_missing, 0); } |
|
293 | 293 | // the final excess area is the percentage of the initial polygon's size that is covered by the user's polygon outside of the initial polygon |
294 | - $final_excess = round((((float)$poly_user_area-(float)$overlap)/(float)$poly_answer_area)*100); |
|
295 | - if ($dbg_local>1) { error_log(__LINE__.' - Final excess is '.$final_excess,0);} |
|
294 | + $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100); |
|
295 | + if ($dbg_local > 1) { error_log(__LINE__.' - Final excess is '.$final_excess, 0); } |
|
296 | 296 | } |
297 | 297 | |
298 | - $destination_items= explode('@@', $answerDestination); |
|
298 | + $destination_items = explode('@@', $answerDestination); |
|
299 | 299 | $threadhold_total = $destination_items[0]; |
300 | - $threadhold_items=explode(';',$threadhold_total); |
|
300 | + $threadhold_items = explode(';', $threadhold_total); |
|
301 | 301 | $threadhold1 = $threadhold_items[0]; // overlap |
302 | 302 | $threadhold2 = $threadhold_items[1]; // excess |
303 | - $threadhold3 = $threadhold_items[2]; //missing |
|
303 | + $threadhold3 = $threadhold_items[2]; //missing |
|
304 | 304 | |
305 | 305 | // echo $final_overlap.' '.$threadhold1 .' - '. $final_missing.' '. $threadhold2 .' - '. $final_excess.' '. $threadhold3; |
306 | 306 | |
307 | 307 | // if is delineation |
308 | - if ($answerId===1) { |
|
308 | + if ($answerId === 1) { |
|
309 | 309 | //setting colors |
310 | 310 | if ($final_overlap >= $threadhold1) { |
311 | 311 | $overlap_color = true; //echo 'a'; |
@@ -321,40 +321,40 @@ discard block |
||
321 | 321 | |
322 | 322 | // if pass |
323 | 323 | //if ($final_overlap>=$threadhold1 && $final_missing<=$threadhold2 && $final_excess<=$threadhold3) { |
324 | - if ($final_overlap>=$threadhold1 && $final_missing<=$threadhold3 && $final_excess<=$threadhold2) { |
|
325 | - $next=1; //go to the oars |
|
326 | - $result_comment=get_lang('Acceptable'); |
|
324 | + if ($final_overlap >= $threadhold1 && $final_missing <= $threadhold3 && $final_excess <= $threadhold2) { |
|
325 | + $next = 1; //go to the oars |
|
326 | + $result_comment = get_lang('Acceptable'); |
|
327 | 327 | } else { |
328 | - $next=1; //Go to the oars. If $next = 0 we will show this message: "One (or more) area at risk has been hit" instead of the table resume with the results |
|
328 | + $next = 1; //Go to the oars. If $next = 0 we will show this message: "One (or more) area at risk has been hit" instead of the table resume with the results |
|
329 | 329 | $wrong_results = true; |
330 | - $result_comment=get_lang('Unacceptable'); |
|
331 | - $special_comment = $comment=$answerDestination=$objAnswerTmp->selectComment(1); |
|
332 | - $answerDestination=$objAnswerTmp->selectDestination(1); |
|
333 | - $destination_items= explode('@@', $answerDestination); |
|
334 | - $try_hotspot=$destination_items[1]; |
|
335 | - $lp_hotspot=$destination_items[2]; |
|
336 | - $select_question_hotspot=$destination_items[3]; |
|
337 | - $url_hotspot=$destination_items[4]; |
|
330 | + $result_comment = get_lang('Unacceptable'); |
|
331 | + $special_comment = $comment = $answerDestination = $objAnswerTmp->selectComment(1); |
|
332 | + $answerDestination = $objAnswerTmp->selectDestination(1); |
|
333 | + $destination_items = explode('@@', $answerDestination); |
|
334 | + $try_hotspot = $destination_items[1]; |
|
335 | + $lp_hotspot = $destination_items[2]; |
|
336 | + $select_question_hotspot = $destination_items[3]; |
|
337 | + $url_hotspot = $destination_items[4]; |
|
338 | 338 | //echo 'show the feedback'; |
339 | 339 | } |
340 | - } elseif($answerId>1) { |
|
340 | + } elseif ($answerId > 1) { |
|
341 | 341 | if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') { |
342 | - if ($dbg_local>0) { error_log(__LINE__.' - answerId is of type noerror',0);} |
|
342 | + if ($dbg_local > 0) { error_log(__LINE__.' - answerId is of type noerror', 0); } |
|
343 | 343 | //type no error shouldn't be treated |
344 | 344 | $next = 1; |
345 | 345 | continue; |
346 | 346 | } |
347 | - if ($dbg_local>0) { error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR',0);} |
|
347 | + if ($dbg_local > 0) { error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0); } |
|
348 | 348 | //check the intersection between the oar and the user |
349 | 349 | //echo 'user'; print_r($x_user_list); print_r($y_user_list); |
350 | 350 | //echo 'official';print_r($x_list);print_r($y_list); |
351 | 351 | //$result = get_intersection_data($x_list,$y_list,$x_user_list,$y_user_list); |
352 | 352 | |
353 | 353 | //$delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId); |
354 | - $delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId); //getting the oars coordinates |
|
354 | + $delineation_cord = $objAnswerTmp->selectHotspotCoordinates($answerId); //getting the oars coordinates |
|
355 | 355 | |
356 | - $poly_answer = convert_coordinates($delineation_cord,'|'); |
|
357 | - $max_coord = poly_get_max($poly_user,$poly_answer); //getting max coordinates |
|
356 | + $poly_answer = convert_coordinates($delineation_cord, '|'); |
|
357 | + $max_coord = poly_get_max($poly_user, $poly_answer); //getting max coordinates |
|
358 | 358 | $test = false; |
359 | 359 | // if ($answerId == 2 ){$test = true;} for test oars |
360 | 360 | |
@@ -362,9 +362,9 @@ discard block |
||
362 | 362 | $overlap = false; |
363 | 363 | } else { |
364 | 364 | // poly_compile really works tested with gnuplot |
365 | - $poly_user_compiled = poly_compile($poly_user,$max_coord,$test);//$poly_user is already set when answerid = 1 |
|
366 | - $poly_answer_compiled = poly_compile($poly_answer,$max_coord,$test); |
|
367 | - $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord); |
|
365 | + $poly_user_compiled = poly_compile($poly_user, $max_coord, $test); //$poly_user is already set when answerid = 1 |
|
366 | + $poly_answer_compiled = poly_compile($poly_answer, $max_coord, $test); |
|
367 | + $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord); |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | if ($overlap == false) { |
@@ -372,42 +372,42 @@ discard block |
||
372 | 372 | $next = 1; |
373 | 373 | continue; |
374 | 374 | } else { |
375 | - if ($dbg_local>0) { error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit',0);} |
|
375 | + if ($dbg_local > 0) { error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0); } |
|
376 | 376 | |
377 | 377 | $organs_at_risk_hit++; |
378 | 378 | //show the feedback |
379 | - $next=1; |
|
380 | - $comment=$answerDestination=$objAnswerTmp->selectComment($answerId); |
|
381 | - $answerDestination=$objAnswerTmp->selectDestination($answerId); |
|
382 | - $destination_items= explode('@@', $answerDestination); |
|
383 | - $try_hotspot=$destination_items[1]; |
|
384 | - $lp_hotspot=$destination_items[2]; |
|
385 | - $select_question_hotspot=$destination_items[3]; |
|
386 | - $url_hotspot=$destination_items[4]; |
|
379 | + $next = 1; |
|
380 | + $comment = $answerDestination = $objAnswerTmp->selectComment($answerId); |
|
381 | + $answerDestination = $objAnswerTmp->selectDestination($answerId); |
|
382 | + $destination_items = explode('@@', $answerDestination); |
|
383 | + $try_hotspot = $destination_items[1]; |
|
384 | + $lp_hotspot = $destination_items[2]; |
|
385 | + $select_question_hotspot = $destination_items[3]; |
|
386 | + $url_hotspot = $destination_items[4]; |
|
387 | 387 | } |
388 | 388 | } |
389 | 389 | } else { |
390 | 390 | // the first delineation feedback |
391 | - if ($dbg_local>0) { error_log(__LINE__.' first',0);} |
|
391 | + if ($dbg_local > 0) { error_log(__LINE__.' first', 0); } |
|
392 | 392 | //we send the error |
393 | 393 | } |
394 | 394 | } |
395 | 395 | } |
396 | 396 | |
397 | 397 | if ($overlap_color) { |
398 | - $overlap_color='green'; |
|
398 | + $overlap_color = 'green'; |
|
399 | 399 | } else { |
400 | - $overlap_color='red'; |
|
400 | + $overlap_color = 'red'; |
|
401 | 401 | } |
402 | 402 | if ($missing_color) { |
403 | - $missing_color='green'; |
|
403 | + $missing_color = 'green'; |
|
404 | 404 | } else { |
405 | - $missing_color='red'; |
|
405 | + $missing_color = 'red'; |
|
406 | 406 | } |
407 | 407 | if ($excess_color) { |
408 | - $excess_color='green'; |
|
408 | + $excess_color = 'green'; |
|
409 | 409 | } else { |
410 | - $excess_color='red'; |
|
410 | + $excess_color = 'red'; |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | if (!is_numeric($final_overlap)) { |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | $final_excess = 0; |
422 | 422 | } |
423 | 423 | |
424 | - if ($final_excess>100) { |
|
424 | + if ($final_excess > 100) { |
|
425 | 425 | $final_excess = 100; |
426 | 426 | } |
427 | 427 | |
@@ -436,26 +436,26 @@ discard block |
||
436 | 436 | <tr class="row_even"> |
437 | 437 | <td><b>'.get_lang('Overlap').'</b></td> |
438 | 438 | <td>'.get_lang('Min').' '.$threadhold1.'</td> |
439 | - <td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0)?0:intval($final_overlap)).'</div></td> |
|
439 | + <td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td> |
|
440 | 440 | </tr> |
441 | 441 | |
442 | 442 | <tr> |
443 | 443 | <td><b>'.get_lang('Excess').'</b></td> |
444 | 444 | <td>'.get_lang('Max').' '.$threadhold2.'</td> |
445 | - <td><div style="color:'.$excess_color.'">'.(($final_excess < 0)?0:intval($final_excess)).'</div></td> |
|
445 | + <td><div style="color:'.$excess_color.'">'.(($final_excess < 0) ? 0 : intval($final_excess)).'</div></td> |
|
446 | 446 | </tr> |
447 | 447 | |
448 | 448 | <tr class="row_even"> |
449 | 449 | <td><b>'.get_lang('Missing').'</b></td> |
450 | 450 | <td>'.get_lang('Max').' '.$threadhold3.'</td> |
451 | - <td><div style="color:'.$missing_color.'">'.(($final_missing < 0)?0:intval($final_missing)).'</div></td> |
|
451 | + <td><div style="color:'.$missing_color.'">'.(($final_missing < 0) ? 0 : intval($final_missing)).'</div></td> |
|
452 | 452 | </tr> |
453 | 453 | </table>'; |
454 | 454 | //var_dump($final_overlap, $threadhold1 , $final_missing, $threadhold2 , $final_excess, $threadhold3); |
455 | 455 | } |
456 | 456 | $_SESSION['newquestionList'] = $newquestionList; |
457 | 457 | |
458 | -$links=''; |
|
458 | +$links = ''; |
|
459 | 459 | |
460 | 460 | if (isset($choice_value) && $choice_value == -1) { |
461 | 461 | if ($answerType != HOT_SPOT_DELINEATION) { |
@@ -467,32 +467,32 @@ discard block |
||
467 | 467 | |
468 | 468 | if ($answerType != HOT_SPOT_DELINEATION) { |
469 | 469 | if (!empty($destination)) { |
470 | - $item_list = explode('@@',$destination); |
|
470 | + $item_list = explode('@@', $destination); |
|
471 | 471 | //print_R($item_list); |
472 | 472 | $try = $item_list[0]; |
473 | 473 | $lp = $item_list[1]; |
474 | - $destinationid= $item_list[2]; |
|
475 | - $url=$item_list[3]; |
|
474 | + $destinationid = $item_list[2]; |
|
475 | + $url = $item_list[3]; |
|
476 | 476 | } |
477 | - $table_resume=''; |
|
477 | + $table_resume = ''; |
|
478 | 478 | } else { |
479 | 479 | $try = $try_hotspot; |
480 | 480 | $lp = $lp_hotspot; |
481 | - $destinationid= $select_question_hotspot; |
|
482 | - $url=$url_hotspot; |
|
483 | - if ($organs_at_risk_hit==0 && $wrong_results==false ) { |
|
481 | + $destinationid = $select_question_hotspot; |
|
482 | + $url = $url_hotspot; |
|
483 | + if ($organs_at_risk_hit == 0 && $wrong_results == false) { |
|
484 | 484 | // no error = no oar and no wrong result for delineation |
485 | 485 | //show if no error |
486 | 486 | //echo 'no error'; |
487 | - $comment= $answerComment = $objAnswerTmp->selectComment($nbrAnswers); |
|
488 | - $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers); |
|
487 | + $comment = $answerComment = $objAnswerTmp->selectComment($nbrAnswers); |
|
488 | + $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers); |
|
489 | 489 | |
490 | 490 | //we send the error |
491 | - $destination_items= explode('@@', $answerDestination); |
|
492 | - $try=$destination_items[1]; |
|
493 | - $lp=$destination_items[2]; |
|
494 | - $destinationid=$destination_items[3]; |
|
495 | - $url=$destination_items[4]; |
|
491 | + $destination_items = explode('@@', $answerDestination); |
|
492 | + $try = $destination_items[1]; |
|
493 | + $lp = $destination_items[2]; |
|
494 | + $destinationid = $destination_items[3]; |
|
495 | + $url = $destination_items[4]; |
|
496 | 496 | $exerciseResult[$questionid] = 1; |
497 | 497 | } else { |
498 | 498 | $exerciseResult[$questionid] = 0; |
@@ -500,35 +500,35 @@ discard block |
||
500 | 500 | } |
501 | 501 | |
502 | 502 | // the link to retry the question |
503 | -if (isset($try) && $try==1) { |
|
504 | - $num_value_array= (array_keys($questionList, $questionid)); |
|
505 | - $links.= Display :: return_icon('reload.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />'; |
|
503 | +if (isset($try) && $try == 1) { |
|
504 | + $num_value_array = (array_keys($questionList, $questionid)); |
|
505 | + $links .= Display :: return_icon('reload.gif', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />'; |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | // the link to theory (a learning path) |
509 | 509 | if (!empty($lp)) { |
510 | - $lp_url= api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp; |
|
510 | + $lp_url = api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp; |
|
511 | 511 | $list = new LearnpathList(api_get_user_id()); |
512 | 512 | $flat_list = $list->get_flat_list(); |
513 | - $links.= Display :: return_icon('theory.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />'; |
|
513 | + $links .= Display :: return_icon('theory.gif', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />'; |
|
514 | 514 | } |
515 | -$links.='<br />'; |
|
515 | +$links .= '<br />'; |
|
516 | 516 | |
517 | 517 | // the link to an external website or link |
518 | 518 | if (!empty($url)) { |
519 | - $links.= Display :: return_icon('link.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />'; |
|
519 | + $links .= Display :: return_icon('link.gif', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />'; |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | // the link to finish the test |
523 | -if ($destinationid==-1) { |
|
524 | - $links.= Display :: return_icon('finish.gif', '', array ('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />'; |
|
523 | +if ($destinationid == -1) { |
|
524 | + $links .= Display :: return_icon('finish.gif', '', array('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />'; |
|
525 | 525 | } else { |
526 | 526 | // the link to other question |
527 | - if (in_array($destinationid,$questionList)) { |
|
527 | + if (in_array($destinationid, $questionList)) { |
|
528 | 528 | $objQuestionTmp = Question :: read($destinationid); |
529 | - $questionName=$objQuestionTmp->selectTitle(); |
|
530 | - $num_value_array= (array_keys($questionList, $destinationid)); |
|
531 | - $links.= Display :: return_icon('quiz.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />'; |
|
529 | + $questionName = $objQuestionTmp->selectTitle(); |
|
530 | + $num_value_array = (array_keys($questionList, $destinationid)); |
|
531 | + $links .= Display :: return_icon('quiz.gif', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />'; |
|
532 | 532 | } |
533 | 533 | } |
534 | 534 | |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | } |
546 | 546 | </script>'; |
547 | 547 | |
548 | -if ($links!='') { |
|
548 | +if ($links != '') { |
|
549 | 549 | /*echo '<div id="ModalContent" style="padding-bottom:30px;padding-top:10px;padding-left:20px;padding-right:20px;"> |
550 | 550 | <a onclick="self.parent.tb_remove();" href="#" style="float:right; margin-top:-10px;">'.api_ucfirst(get_lang('Close')).'</a>';*/ |
551 | 551 | echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>'; |
@@ -554,15 +554,15 @@ discard block |
||
554 | 554 | if ($organs_at_risk_hit > 0) { |
555 | 555 | //$message='<p>'.get_lang('YourDelineation').'</p>'; |
556 | 556 | //$message.=$table_resume; |
557 | - $message.='<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />'; |
|
557 | + $message .= '<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />'; |
|
558 | 558 | //if ($wrong_results) { } |
559 | - $message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>'; |
|
560 | - $message.='<p>'.$comment.'</p>'; |
|
559 | + $message .= '<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>'; |
|
560 | + $message .= '<p>'.$comment.'</p>'; |
|
561 | 561 | } else { |
562 | - $message='<p>'.get_lang('YourDelineation').'</p>'; |
|
563 | - $message.=$table_resume; |
|
564 | - $message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
565 | - $message.='<p>'.$comment.'</p>'; |
|
562 | + $message = '<p>'.get_lang('YourDelineation').'</p>'; |
|
563 | + $message .= $table_resume; |
|
564 | + $message .= '<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
565 | + $message .= '<p>'.$comment.'</p>'; |
|
566 | 566 | } |
567 | 567 | echo $message; |
568 | 568 | } else { |
@@ -571,10 +571,10 @@ discard block |
||
571 | 571 | echo '<h3>'.$links.'</h3>'; |
572 | 572 | echo '</div>'; |
573 | 573 | |
574 | - $_SESSION['hot_spot_result']=$message; |
|
574 | + $_SESSION['hot_spot_result'] = $message; |
|
575 | 575 | $_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]); |
576 | 576 | //reseting the exerciseResult variable |
577 | - Session::write('exerciseResult',$exerciseResult); |
|
577 | + Session::write('exerciseResult', $exerciseResult); |
|
578 | 578 | |
579 | 579 | //save this variables just in case the exercise loads an LP with other exercise |
580 | 580 | $_SESSION['objExerciseExtra'.$exerciseId] = $_SESSION['objExercise']; |