@@ -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>'; |
@@ -58,7 +58,7 @@ |
||
58 | 58 | * @param null $feedback_type |
59 | 59 | * @param null $counter |
60 | 60 | * @param null $score |
61 | - * @return null|string |
|
61 | + * @return string |
|
62 | 62 | */ |
63 | 63 | function return_header($feedback_type = null, $counter = null, $score = null) |
64 | 64 | { |
@@ -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]); ?>" /> |
@@ -366,8 +366,9 @@ discard block |
||
366 | 366 | if ($answerType == HOT_SPOT_DELINEATION) { |
367 | 367 | // the magic happens here ... |
368 | 368 | // we do this to not count the if no error section |
369 | - if ($nbrAnswers >= 2) |
|
370 | - $nbrAnswers--; |
|
369 | + if ($nbrAnswers >= 2) { |
|
370 | + $nbrAnswers--; |
|
371 | + } |
|
371 | 372 | } |
372 | 373 | |
373 | 374 | $reponse = array(); |
@@ -679,12 +680,15 @@ discard block |
||
679 | 680 | |
680 | 681 | for ($k = 1; $k <= 100; $k++) { |
681 | 682 | $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"'; |
|
683 | + if ($k == $threadhold1[$i]) { |
|
684 | + $selected1 = 'selected="selected"'; |
|
685 | + } |
|
686 | + if ($k == $threadhold2[$i]) { |
|
687 | + $selected2 = 'selected="selected"'; |
|
688 | + } |
|
689 | + if ($k == $threadhold3[$i]) { |
|
690 | + $selected3 = 'selected="selected"'; |
|
691 | + } |
|
688 | 692 | $option1.='<option ' . $selected1 . ' >' . $k . ' % </option>'; |
689 | 693 | $option2.='<option ' . $selected2 . ' >' . $k . ' % </option>'; |
690 | 694 | $option3.='<option ' . $selected3 . '>' . $k . ' %</option>'; |
@@ -731,7 +735,10 @@ discard block |
||
731 | 735 | <div class="checkbox"> |
732 | 736 | <p> |
733 | 737 | <label> |
734 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
738 | + <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) { |
|
739 | + echo'checked'; |
|
740 | +} |
|
741 | +?> /> |
|
735 | 742 | <?php echo get_lang('TryAgain'); ?> |
736 | 743 | </label> |
737 | 744 | </p> |
@@ -784,7 +791,10 @@ discard block |
||
784 | 791 | <div class="checkbox"> |
785 | 792 | <p> |
786 | 793 | <label> |
787 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
794 | + <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) { |
|
795 | + echo'checked'; |
|
796 | +} |
|
797 | +?> /> |
|
788 | 798 | <?php echo get_lang('TryAgain'); ?> |
789 | 799 | </label> |
790 | 800 | </p> |
@@ -823,7 +833,10 @@ discard block |
||
823 | 833 | <th ><?php echo get_lang('OAR'); ?>*</th> |
824 | 834 | <?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?> |
825 | 835 | <th colspan="2" ><?php echo get_lang('Comment'); ?></th> |
826 | - <th ><?php if ($answerType == HOT_SPOT_DELINEATION) echo get_lang('Scenario'); ?></th> |
|
836 | + <th ><?php if ($answerType == HOT_SPOT_DELINEATION) { |
|
837 | + echo get_lang('Scenario'); |
|
838 | +} |
|
839 | +?></th> |
|
827 | 840 | <?php } else { ?> |
828 | 841 | <th colspan="3" ><?php echo get_lang('Comment'); ?></th> |
829 | 842 | <?php } ?> |
@@ -849,7 +862,10 @@ discard block |
||
849 | 862 | <div class="checkbox"> |
850 | 863 | <p> |
851 | 864 | <label> |
852 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) echo'checked'; ?> /> |
|
865 | + <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) { |
|
866 | + echo'checked'; |
|
867 | +} |
|
868 | +?> /> |
|
853 | 869 | <?php echo get_lang('TryAgain'); ?> |
854 | 870 | </label> |
855 | 871 | </p> |
@@ -998,7 +1014,10 @@ discard block |
||
998 | 1014 | <div class="checkbox"> |
999 | 1015 | <p> |
1000 | 1016 | <label> |
1001 | - <input type="checkbox" class="checkbox" name="try_noerror" <?php if ($try_noerror == 1) echo'checked'; ?> /> |
|
1017 | + <input type="checkbox" class="checkbox" name="try_noerror" <?php if ($try_noerror == 1) { |
|
1018 | + echo'checked'; |
|
1019 | +} |
|
1020 | +?> /> |
|
1002 | 1021 | <?php echo get_lang('TryAgain'); ?> |
1003 | 1022 | </label> |
1004 | 1023 | </p> |
@@ -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 | } |
@@ -17,15 +17,15 @@ |
||
17 | 17 | $answerOrderId = count($_SESSION['exerciseResult'][$questionId]['ids'])+1; |
18 | 18 | if ($_GET['answerId'] == "0") // click is NOT on a hotspot |
19 | 19 | { |
20 | - $hit = 0; |
|
21 | - $answerId = NULL; |
|
20 | + $hit = 0; |
|
21 | + $answerId = NULL; |
|
22 | 22 | } |
23 | 23 | else // user clicked ON a hotspot |
24 | 24 | { |
25 | - $hit = 1; |
|
26 | - $answerId = api_substr($_GET['answerId'],22,2); |
|
27 | - // Save into session |
|
28 | - $_SESSION['exerciseResult'][$questionId][$answerId] = $hit; |
|
25 | + $hit = 1; |
|
26 | + $answerId = api_substr($_GET['answerId'],22,2); |
|
27 | + // Save into session |
|
28 | + $_SESSION['exerciseResult'][$questionId][$answerId] = $hit; |
|
29 | 29 | } |
30 | 30 | //round-up the coordinates |
31 | 31 | $coords = explode('/',$coordinates); |
@@ -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. |
@@ -15,12 +15,13 @@ |
||
15 | 15 | $exerciseId = $objExcercise->selectId(); |
16 | 16 | // Save clicking order |
17 | 17 | $answerOrderId = count($_SESSION['exerciseResult'][$questionId]['ids'])+1; |
18 | -if ($_GET['answerId'] == "0") // click is NOT on a hotspot |
|
18 | +if ($_GET['answerId'] == "0") { |
|
19 | + // click is NOT on a hotspot |
|
19 | 20 | { |
20 | 21 | $hit = 0; |
21 | - $answerId = NULL; |
|
22 | 22 | } |
23 | -else // user clicked ON a hotspot |
|
23 | + $answerId = NULL; |
|
24 | +} else // user clicked ON a hotspot |
|
24 | 25 | { |
25 | 26 | $hit = 1; |
26 | 27 | $answerId = api_substr($_GET['answerId'],22,2); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $objExercise->read($exerciseId); |
74 | 74 | |
75 | 75 | if ($objExercise->random_answers == '1') { |
76 | - $this->readOrderedBy('rand()', '');// randomize answers |
|
76 | + $this->readOrderedBy('rand()', ''); // randomize answers |
|
77 | 77 | } else { |
78 | 78 | $this->read(); // natural order |
79 | 79 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | ORDER BY position"; |
115 | 115 | |
116 | 116 | $result = Database::query($sql); |
117 | - $i=1; |
|
117 | + $i = 1; |
|
118 | 118 | |
119 | 119 | // while a record is found |
120 | 120 | while ($object = Database::fetch_object($result)) { |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $this->autoId[$i] = $object->id_auto; |
131 | 131 | $i++; |
132 | 132 | } |
133 | - $this->nbrAnswers = $i-1; |
|
133 | + $this->nbrAnswers = $i - 1; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | { |
143 | 143 | foreach ($this->autoId as $key => $autoId) { |
144 | 144 | if ($autoId == $id) { |
145 | - $result = [ |
|
145 | + $result = [ |
|
146 | 146 | 'answer' => $this->answer[$key], |
147 | 147 | 'correct' => $this->correct[$key], |
148 | 148 | 'comment' => $this->comment[$key], |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER); |
167 | 167 | $questionId = $this->questionId; |
168 | 168 | |
169 | - $sql="SELECT id FROM |
|
169 | + $sql = "SELECT id FROM |
|
170 | 170 | $TBL_ANSWER |
171 | 171 | WHERE c_id = {$this->course_id} AND question_id ='".$questionId."'"; |
172 | 172 | |
@@ -188,14 +188,14 @@ discard block |
||
188 | 188 | * @param string DESC or ASC |
189 | 189 | * @author Frederic Vauthier |
190 | 190 | */ |
191 | - public function readOrderedBy($field, $order='ASC') |
|
191 | + public function readOrderedBy($field, $order = 'ASC') |
|
192 | 192 | { |
193 | 193 | $field = Database::escape_string($field); |
194 | 194 | if (empty($field)) { |
195 | 195 | $field = 'position'; |
196 | 196 | } |
197 | 197 | |
198 | - if ($order != 'ASC' && $order!='DESC') { |
|
198 | + if ($order != 'ASC' && $order != 'DESC') { |
|
199 | 199 | $order = 'ASC'; |
200 | 200 | } |
201 | 201 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | c_id = {$this->course_id} AND |
231 | 231 | question_id='".$questionId."' |
232 | 232 | ORDER BY $field $order"; |
233 | - $result=Database::query($sql); |
|
233 | + $result = Database::query($sql); |
|
234 | 234 | |
235 | 235 | $i = 1; |
236 | 236 | // while a record is found |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | $this->autoId[$i] = $doubt_data->id_auto; |
261 | 261 | $i++; |
262 | 262 | } |
263 | - $this->nbrAnswers = $i-1; |
|
263 | + $this->nbrAnswers = $i - 1; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -402,8 +402,8 @@ discard block |
||
402 | 402 | public function getGradesList() |
403 | 403 | { |
404 | 404 | $list = array(); |
405 | - for ($i = 0; $i<$this->nbrAnswers;$i++){ |
|
406 | - if(!empty($this->answer[$i])){ |
|
405 | + for ($i = 0; $i < $this->nbrAnswers; $i++) { |
|
406 | + if (!empty($this->answer[$i])) { |
|
407 | 407 | $list[$i] = $this->weighting[$i]; |
408 | 408 | } |
409 | 409 | } |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | $sql = "SELECT type FROM $TBL_QUESTIONS |
422 | 422 | WHERE c_id = {$this->course_id} AND id = '".$this->questionId."'"; |
423 | 423 | $res = Database::query($sql); |
424 | - if (Database::num_rows($res)<=0){ |
|
424 | + if (Database::num_rows($res) <= 0) { |
|
425 | 425 | return null; |
426 | 426 | } |
427 | 427 | $row = Database::fetch_array($res); |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | $correctList = []; |
594 | 594 | $answerList = []; |
595 | 595 | |
596 | - for ($i=1; $i <= $this->new_nbrAnswers; $i++) { |
|
596 | + for ($i = 1; $i <= $this->new_nbrAnswers; $i++) { |
|
597 | 597 | $answer = $this->new_answer[$i]; |
598 | 598 | $correct = $this->new_correct[$i]; |
599 | 599 | $comment = $this->new_comment[$i]; |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | $destination_options = Question::readQuestionOption($newQuestionId, $course_info['real_id']); |
749 | 749 | $i = 0; |
750 | 750 | if (!empty($destination_options)) { |
751 | - foreach($destination_options as $item) { |
|
751 | + foreach ($destination_options as $item) { |
|
752 | 752 | $fixed_list[$new_option_list[$i]] = $item['id']; |
753 | 753 | $i++; |
754 | 754 | } |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | // inserts new answers into data base |
761 | 761 | $c_id = $course_info['real_id']; |
762 | 762 | |
763 | - for ($i=1;$i <= $this->nbrAnswers;$i++) { |
|
763 | + for ($i = 1; $i <= $this->nbrAnswers; $i++) { |
|
764 | 764 | if ($this->course['id'] != $course_info['id']) { |
765 | 765 | $this->answer[$i] = DocumentManager::replace_urls_inside_content_html_from_copy_course( |
766 | 766 | $this->answer[$i], |
@@ -155,12 +155,12 @@ discard block |
||
155 | 155 | return []; |
156 | 156 | } |
157 | 157 | |
158 | - /** |
|
159 | - * returns all answer ids from this question Id |
|
160 | - * |
|
161 | - * @author Yoselyn Castillo |
|
162 | - * @return array - $id (answer ids) |
|
163 | - */ |
|
158 | + /** |
|
159 | + * returns all answer ids from this question Id |
|
160 | + * |
|
161 | + * @author Yoselyn Castillo |
|
162 | + * @return array - $id (answer ids) |
|
163 | + */ |
|
164 | 164 | public function selectAnswerId() |
165 | 165 | { |
166 | 166 | $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | return $id; |
183 | - } |
|
183 | + } |
|
184 | 184 | |
185 | 185 | /** |
186 | 186 | * Reads answer information from the data base ordered by parameter |
@@ -190,23 +190,23 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function readOrderedBy($field, $order='ASC') |
192 | 192 | { |
193 | - $field = Database::escape_string($field); |
|
194 | - if (empty($field)) { |
|
195 | - $field = 'position'; |
|
196 | - } |
|
193 | + $field = Database::escape_string($field); |
|
194 | + if (empty($field)) { |
|
195 | + $field = 'position'; |
|
196 | + } |
|
197 | 197 | |
198 | - if ($order != 'ASC' && $order!='DESC') { |
|
199 | - $order = 'ASC'; |
|
200 | - } |
|
198 | + if ($order != 'ASC' && $order!='DESC') { |
|
199 | + $order = 'ASC'; |
|
200 | + } |
|
201 | 201 | |
202 | - $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER); |
|
203 | - $TBL_QUIZ = Database::get_course_table(TABLE_QUIZ_QUESTION); |
|
204 | - $questionId = intval($this->questionId); |
|
202 | + $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER); |
|
203 | + $TBL_QUIZ = Database::get_course_table(TABLE_QUIZ_QUESTION); |
|
204 | + $questionId = intval($this->questionId); |
|
205 | 205 | |
206 | - $sql = "SELECT type FROM $TBL_QUIZ |
|
206 | + $sql = "SELECT type FROM $TBL_QUIZ |
|
207 | 207 | WHERE c_id = {$this->course_id} AND id = $questionId"; |
208 | - $result_question = Database::query($sql); |
|
209 | - $questionType = Database::fetch_array($result_question); |
|
208 | + $result_question = Database::query($sql); |
|
209 | + $questionType = Database::fetch_array($result_question); |
|
210 | 210 | |
211 | 211 | if ($questionType['type'] == DRAGGABLE) { |
212 | 212 | // Random is done by submit.js.tpl |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | return true; |
216 | 216 | } |
217 | 217 | |
218 | - $sql = "SELECT |
|
218 | + $sql = "SELECT |
|
219 | 219 | answer, |
220 | 220 | correct, |
221 | 221 | comment, |
@@ -230,16 +230,16 @@ discard block |
||
230 | 230 | c_id = {$this->course_id} AND |
231 | 231 | question_id='".$questionId."' |
232 | 232 | ORDER BY $field $order"; |
233 | - $result=Database::query($sql); |
|
234 | - |
|
235 | - $i = 1; |
|
236 | - // while a record is found |
|
237 | - $doubt_data = null; |
|
238 | - while ($object = Database::fetch_object($result)) { |
|
239 | - if ($questionType['type'] == UNIQUE_ANSWER_NO_OPTION && $object->position == 666) { |
|
240 | - $doubt_data = $object; |
|
233 | + $result=Database::query($sql); |
|
234 | + |
|
235 | + $i = 1; |
|
236 | + // while a record is found |
|
237 | + $doubt_data = null; |
|
238 | + while ($object = Database::fetch_object($result)) { |
|
239 | + if ($questionType['type'] == UNIQUE_ANSWER_NO_OPTION && $object->position == 666) { |
|
240 | + $doubt_data = $object; |
|
241 | 241 | continue; |
242 | - } |
|
242 | + } |
|
243 | 243 | $this->answer[$i] = $object->answer; |
244 | 244 | $this->correct[$i] = $object->correct; |
245 | 245 | $this->comment[$i] = $object->comment; |
@@ -250,9 +250,9 @@ discard block |
||
250 | 250 | $this->destination[$i] = $object->destination; |
251 | 251 | $this->autoId[$i] = $object->id_auto; |
252 | 252 | $i++; |
253 | - } |
|
253 | + } |
|
254 | 254 | |
255 | - if ($questionType['type'] == UNIQUE_ANSWER_NO_OPTION && !empty($doubt_data)) { |
|
255 | + if ($questionType['type'] == UNIQUE_ANSWER_NO_OPTION && !empty($doubt_data)) { |
|
256 | 256 | $this->answer[$i] = $doubt_data->answer; |
257 | 257 | $this->correct[$i] = $doubt_data->correct; |
258 | 258 | $this->comment[$i] = $doubt_data->comment; |
@@ -263,86 +263,86 @@ discard block |
||
263 | 263 | $this->destination[$i] = $doubt_data->destination; |
264 | 264 | $this->autoId[$i] = $doubt_data->id_auto; |
265 | 265 | $i++; |
266 | - } |
|
266 | + } |
|
267 | 267 | $this->nbrAnswers = $i-1; |
268 | - } |
|
269 | - |
|
270 | - /** |
|
271 | - * returns the autoincrement id identificator |
|
272 | - * |
|
273 | - * @author Juan Carlos Ra�a |
|
274 | - * @return integer - answer num |
|
275 | - */ |
|
268 | + } |
|
269 | + |
|
270 | + /** |
|
271 | + * returns the autoincrement id identificator |
|
272 | + * |
|
273 | + * @author Juan Carlos Ra�a |
|
274 | + * @return integer - answer num |
|
275 | + */ |
|
276 | 276 | public function selectAutoId($id) |
277 | 277 | { |
278 | - return isset($this->autoId[$id]) ? $this->autoId[$id] : 0; |
|
279 | - } |
|
280 | - |
|
281 | - /** |
|
282 | - * returns the number of answers in this question |
|
283 | - * |
|
284 | - * @author Olivier Brouckaert |
|
285 | - * @return integer - number of answers |
|
286 | - */ |
|
287 | - public function selectNbrAnswers() |
|
278 | + return isset($this->autoId[$id]) ? $this->autoId[$id] : 0; |
|
279 | + } |
|
280 | + |
|
281 | + /** |
|
282 | + * returns the number of answers in this question |
|
283 | + * |
|
284 | + * @author Olivier Brouckaert |
|
285 | + * @return integer - number of answers |
|
286 | + */ |
|
287 | + public function selectNbrAnswers() |
|
288 | 288 | { |
289 | - return $this->nbrAnswers; |
|
290 | - } |
|
291 | - |
|
292 | - /** |
|
293 | - * returns the question ID which the answers belong to |
|
294 | - * |
|
295 | - * @author Olivier Brouckaert |
|
296 | - * @return integer - the question ID |
|
297 | - */ |
|
298 | - public function selectQuestionId() |
|
289 | + return $this->nbrAnswers; |
|
290 | + } |
|
291 | + |
|
292 | + /** |
|
293 | + * returns the question ID which the answers belong to |
|
294 | + * |
|
295 | + * @author Olivier Brouckaert |
|
296 | + * @return integer - the question ID |
|
297 | + */ |
|
298 | + public function selectQuestionId() |
|
299 | 299 | { |
300 | - return $this->questionId; |
|
301 | - } |
|
302 | - |
|
303 | - /** |
|
304 | - * returns the question ID of the destination question |
|
305 | - * |
|
306 | - * @author Julio Montoya |
|
307 | - * @return integer - the question ID |
|
308 | - */ |
|
309 | - public function selectDestination($id) |
|
300 | + return $this->questionId; |
|
301 | + } |
|
302 | + |
|
303 | + /** |
|
304 | + * returns the question ID of the destination question |
|
305 | + * |
|
306 | + * @author Julio Montoya |
|
307 | + * @return integer - the question ID |
|
308 | + */ |
|
309 | + public function selectDestination($id) |
|
310 | 310 | { |
311 | - return isset($this->destination[$id]) ? $this->destination[$id] : null; |
|
312 | - } |
|
311 | + return isset($this->destination[$id]) ? $this->destination[$id] : null; |
|
312 | + } |
|
313 | 313 | |
314 | 314 | /** |
315 | - * returns the answer title |
|
316 | - * |
|
317 | - * @author Olivier Brouckaert |
|
318 | - * @param - integer $id - answer ID |
|
319 | - * @return string - answer title |
|
320 | - */ |
|
321 | - public function selectAnswer($id) |
|
322 | - { |
|
323 | - return isset($this->answer[$id]) ? $this->answer[$id] : null; |
|
324 | - } |
|
325 | - |
|
326 | - /** |
|
327 | - * return array answer by id else return a bool |
|
328 | - */ |
|
329 | - public function selectAnswerByAutoId($auto_id) |
|
330 | - { |
|
331 | - $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER); |
|
332 | - |
|
333 | - $auto_id = intval($auto_id); |
|
334 | - $sql = "SELECT id, answer, id_auto FROM $TBL_ANSWER |
|
315 | + * returns the answer title |
|
316 | + * |
|
317 | + * @author Olivier Brouckaert |
|
318 | + * @param - integer $id - answer ID |
|
319 | + * @return string - answer title |
|
320 | + */ |
|
321 | + public function selectAnswer($id) |
|
322 | + { |
|
323 | + return isset($this->answer[$id]) ? $this->answer[$id] : null; |
|
324 | + } |
|
325 | + |
|
326 | + /** |
|
327 | + * return array answer by id else return a bool |
|
328 | + */ |
|
329 | + public function selectAnswerByAutoId($auto_id) |
|
330 | + { |
|
331 | + $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER); |
|
332 | + |
|
333 | + $auto_id = intval($auto_id); |
|
334 | + $sql = "SELECT id, answer, id_auto FROM $TBL_ANSWER |
|
335 | 335 | WHERE c_id = {$this->course_id} AND id_auto='$auto_id'"; |
336 | - $rs = Database::query($sql); |
|
336 | + $rs = Database::query($sql); |
|
337 | 337 | |
338 | - if (Database::num_rows($rs) > 0) { |
|
339 | - $row = Database::fetch_array($rs, 'ASSOC'); |
|
338 | + if (Database::num_rows($rs) > 0) { |
|
339 | + $row = Database::fetch_array($rs, 'ASSOC'); |
|
340 | 340 | |
341 | - return $row; |
|
342 | - } |
|
341 | + return $row; |
|
342 | + } |
|
343 | 343 | |
344 | - return false; |
|
345 | - } |
|
344 | + return false; |
|
345 | + } |
|
346 | 346 | |
347 | 347 | /** |
348 | 348 | * returns the answer title from an answer's position |
@@ -351,18 +351,18 @@ discard block |
||
351 | 351 | * @param - integer $id - answer ID |
352 | 352 | * @return bool - answer title |
353 | 353 | */ |
354 | - public function selectAnswerIdByPosition($pos) |
|
355 | - { |
|
356 | - foreach ($this->position as $k => $v) { |
|
357 | - if ($v != $pos) { |
|
358 | - continue; |
|
359 | - } |
|
354 | + public function selectAnswerIdByPosition($pos) |
|
355 | + { |
|
356 | + foreach ($this->position as $k => $v) { |
|
357 | + if ($v != $pos) { |
|
358 | + continue; |
|
359 | + } |
|
360 | 360 | |
361 | - return $k; |
|
362 | - } |
|
361 | + return $k; |
|
362 | + } |
|
363 | 363 | |
364 | - return false; |
|
365 | - } |
|
364 | + return false; |
|
365 | + } |
|
366 | 366 | |
367 | 367 | /** |
368 | 368 | * Returns a list of answers |
@@ -371,18 +371,18 @@ discard block |
||
371 | 371 | * of (id, answer, comment, grade) and grade=weighting |
372 | 372 | */ |
373 | 373 | public function getAnswersList($decode = false) |
374 | - { |
|
375 | - $list = array(); |
|
376 | - for ($i = 1; $i <= $this->nbrAnswers; $i++) { |
|
377 | - if (!empty($this->answer[$i])) { |
|
378 | - |
|
379 | - //Avoid problems when parsing elements with accents |
|
380 | - if ($decode) { |
|
381 | - $this->answer[$i] = api_html_entity_decode($this->answer[$i], ENT_QUOTES, api_get_system_encoding()); |
|
382 | - $this->comment[$i] = api_html_entity_decode($this->comment[$i], ENT_QUOTES, api_get_system_encoding()); |
|
383 | - } |
|
384 | - |
|
385 | - $list[] = array( |
|
374 | + { |
|
375 | + $list = array(); |
|
376 | + for ($i = 1; $i <= $this->nbrAnswers; $i++) { |
|
377 | + if (!empty($this->answer[$i])) { |
|
378 | + |
|
379 | + //Avoid problems when parsing elements with accents |
|
380 | + if ($decode) { |
|
381 | + $this->answer[$i] = api_html_entity_decode($this->answer[$i], ENT_QUOTES, api_get_system_encoding()); |
|
382 | + $this->comment[$i] = api_html_entity_decode($this->comment[$i], ENT_QUOTES, api_get_system_encoding()); |
|
383 | + } |
|
384 | + |
|
385 | + $list[] = array( |
|
386 | 386 | 'id' => $i, |
387 | 387 | 'answer' => $this->answer[$i], |
388 | 388 | 'comment' => $this->comment[$i], |
@@ -391,134 +391,134 @@ discard block |
||
391 | 391 | 'hotspot_type' => $this->hotspot_type[$i], |
392 | 392 | 'correct' => $this->correct[$i], |
393 | 393 | 'destination' => $this->destination[$i] |
394 | - ); |
|
394 | + ); |
|
395 | + } |
|
395 | 396 | } |
396 | - } |
|
397 | 397 | |
398 | - return $list; |
|
399 | - } |
|
398 | + return $list; |
|
399 | + } |
|
400 | 400 | |
401 | - /** |
|
402 | - * Returns a list of grades |
|
403 | - * @author Yannick Warnier <[email protected]> |
|
404 | - * @return array List of grades where grade=weighting (?) |
|
405 | - */ |
|
401 | + /** |
|
402 | + * Returns a list of grades |
|
403 | + * @author Yannick Warnier <[email protected]> |
|
404 | + * @return array List of grades where grade=weighting (?) |
|
405 | + */ |
|
406 | 406 | public function getGradesList() |
407 | - { |
|
408 | - $list = array(); |
|
409 | - for ($i = 0; $i<$this->nbrAnswers;$i++){ |
|
410 | - if(!empty($this->answer[$i])){ |
|
411 | - $list[$i] = $this->weighting[$i]; |
|
412 | - } |
|
413 | - } |
|
414 | - return $list; |
|
415 | - } |
|
416 | - |
|
417 | - /** |
|
418 | - * Returns the question type |
|
419 | - * @author Yannick Warnier <[email protected]> |
|
420 | - * @return integer The type of the question this answer is bound to |
|
421 | - */ |
|
407 | + { |
|
408 | + $list = array(); |
|
409 | + for ($i = 0; $i<$this->nbrAnswers;$i++){ |
|
410 | + if(!empty($this->answer[$i])){ |
|
411 | + $list[$i] = $this->weighting[$i]; |
|
412 | + } |
|
413 | + } |
|
414 | + return $list; |
|
415 | + } |
|
416 | + |
|
417 | + /** |
|
418 | + * Returns the question type |
|
419 | + * @author Yannick Warnier <[email protected]> |
|
420 | + * @return integer The type of the question this answer is bound to |
|
421 | + */ |
|
422 | 422 | public function getQuestionType() |
423 | - { |
|
424 | - $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); |
|
425 | - $sql = "SELECT type FROM $TBL_QUESTIONS |
|
423 | + { |
|
424 | + $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); |
|
425 | + $sql = "SELECT type FROM $TBL_QUESTIONS |
|
426 | 426 | WHERE c_id = {$this->course_id} AND id = '".$this->questionId."'"; |
427 | - $res = Database::query($sql); |
|
428 | - if (Database::num_rows($res)<=0){ |
|
429 | - return null; |
|
430 | - } |
|
431 | - $row = Database::fetch_array($res); |
|
432 | - |
|
433 | - return $row['type']; |
|
434 | - } |
|
435 | - |
|
436 | - |
|
437 | - /** |
|
438 | - * tells if answer is correct or not |
|
439 | - * |
|
440 | - * @author Olivier Brouckaert |
|
441 | - * @param - integer $id - answer ID |
|
442 | - * @return integer - 0 if bad answer, not 0 if good answer |
|
443 | - */ |
|
427 | + $res = Database::query($sql); |
|
428 | + if (Database::num_rows($res)<=0){ |
|
429 | + return null; |
|
430 | + } |
|
431 | + $row = Database::fetch_array($res); |
|
432 | + |
|
433 | + return $row['type']; |
|
434 | + } |
|
435 | + |
|
436 | + |
|
437 | + /** |
|
438 | + * tells if answer is correct or not |
|
439 | + * |
|
440 | + * @author Olivier Brouckaert |
|
441 | + * @param - integer $id - answer ID |
|
442 | + * @return integer - 0 if bad answer, not 0 if good answer |
|
443 | + */ |
|
444 | 444 | public function isCorrect($id) |
445 | - { |
|
446 | - return isset($this->correct[$id]) ? $this->correct[$id] : null; |
|
447 | - } |
|
448 | - |
|
449 | - /** |
|
450 | - * returns answer comment |
|
451 | - * |
|
452 | - * @author Olivier Brouckaert |
|
453 | - * @param - integer $id - answer ID |
|
454 | - * @return string - answer comment |
|
455 | - */ |
|
445 | + { |
|
446 | + return isset($this->correct[$id]) ? $this->correct[$id] : null; |
|
447 | + } |
|
448 | + |
|
449 | + /** |
|
450 | + * returns answer comment |
|
451 | + * |
|
452 | + * @author Olivier Brouckaert |
|
453 | + * @param - integer $id - answer ID |
|
454 | + * @return string - answer comment |
|
455 | + */ |
|
456 | 456 | public function selectComment($id) |
457 | - { |
|
457 | + { |
|
458 | 458 | return isset($this->comment[$id]) ? $this->comment[$id] : null; |
459 | - } |
|
460 | - |
|
461 | - /** |
|
462 | - * returns answer weighting |
|
463 | - * |
|
464 | - * @author Olivier Brouckaert |
|
465 | - * @param - integer $id - answer ID |
|
466 | - * @return integer - answer weighting |
|
467 | - */ |
|
459 | + } |
|
460 | + |
|
461 | + /** |
|
462 | + * returns answer weighting |
|
463 | + * |
|
464 | + * @author Olivier Brouckaert |
|
465 | + * @param - integer $id - answer ID |
|
466 | + * @return integer - answer weighting |
|
467 | + */ |
|
468 | 468 | public function selectWeighting($id) |
469 | - { |
|
470 | - return isset($this->weighting[$id]) ? $this->weighting[$id] : null; |
|
471 | - } |
|
472 | - |
|
473 | - /** |
|
474 | - * returns answer position |
|
475 | - * |
|
476 | - * @author Olivier Brouckaert |
|
477 | - * @param - integer $id - answer ID |
|
478 | - * @return integer - answer position |
|
479 | - */ |
|
480 | - function selectPosition($id) |
|
481 | - { |
|
482 | - return isset($this->position[$id]) ? $this->position[$id] : null; |
|
483 | - } |
|
484 | - |
|
485 | - /** |
|
486 | - * returns answer hotspot coordinates |
|
487 | - * |
|
488 | - * @author Olivier Brouckaert |
|
489 | - * @param integer Answer ID |
|
490 | - * @return integer Answer position |
|
491 | - */ |
|
469 | + { |
|
470 | + return isset($this->weighting[$id]) ? $this->weighting[$id] : null; |
|
471 | + } |
|
472 | + |
|
473 | + /** |
|
474 | + * returns answer position |
|
475 | + * |
|
476 | + * @author Olivier Brouckaert |
|
477 | + * @param - integer $id - answer ID |
|
478 | + * @return integer - answer position |
|
479 | + */ |
|
480 | + function selectPosition($id) |
|
481 | + { |
|
482 | + return isset($this->position[$id]) ? $this->position[$id] : null; |
|
483 | + } |
|
484 | + |
|
485 | + /** |
|
486 | + * returns answer hotspot coordinates |
|
487 | + * |
|
488 | + * @author Olivier Brouckaert |
|
489 | + * @param integer Answer ID |
|
490 | + * @return integer Answer position |
|
491 | + */ |
|
492 | 492 | public function selectHotspotCoordinates($id) |
493 | - { |
|
494 | - return isset($this->hotspot_coordinates[$id]) ? $this->hotspot_coordinates[$id] : null; |
|
495 | - } |
|
496 | - |
|
497 | - /** |
|
498 | - * returns answer hotspot type |
|
499 | - * |
|
500 | - * @author Toon Keppens |
|
501 | - * @param integer Answer ID |
|
502 | - * @return integer Answer position |
|
503 | - */ |
|
493 | + { |
|
494 | + return isset($this->hotspot_coordinates[$id]) ? $this->hotspot_coordinates[$id] : null; |
|
495 | + } |
|
496 | + |
|
497 | + /** |
|
498 | + * returns answer hotspot type |
|
499 | + * |
|
500 | + * @author Toon Keppens |
|
501 | + * @param integer Answer ID |
|
502 | + * @return integer Answer position |
|
503 | + */ |
|
504 | 504 | public function selectHotspotType($id) |
505 | - { |
|
506 | - return isset($this->hotspot_type[$id]) ? $this->hotspot_type[$id] : null; |
|
507 | - } |
|
508 | - |
|
509 | - /** |
|
510 | - * Creates a new answer |
|
511 | - * |
|
512 | - * @author Olivier Brouckaert |
|
513 | - * @param string $answer answer title |
|
514 | - * @param integer $correct 0 if bad answer, not 0 if good answer |
|
515 | - * @param string $comment answer comment |
|
516 | - * @param integer $weighting answer weighting |
|
517 | - * @param integer $position answer position |
|
518 | - * @param array $new_hotspot_coordinates Coordinates for hotspot exercises (optional) |
|
519 | - * @param integer $new_hotspot_type Type for hotspot exercises (optional) |
|
505 | + { |
|
506 | + return isset($this->hotspot_type[$id]) ? $this->hotspot_type[$id] : null; |
|
507 | + } |
|
508 | + |
|
509 | + /** |
|
510 | + * Creates a new answer |
|
511 | + * |
|
512 | + * @author Olivier Brouckaert |
|
513 | + * @param string $answer answer title |
|
514 | + * @param integer $correct 0 if bad answer, not 0 if good answer |
|
515 | + * @param string $comment answer comment |
|
516 | + * @param integer $weighting answer weighting |
|
517 | + * @param integer $position answer position |
|
518 | + * @param array $new_hotspot_coordinates Coordinates for hotspot exercises (optional) |
|
519 | + * @param integer $new_hotspot_type Type for hotspot exercises (optional) |
|
520 | 520 | * @param string $destination |
521 | - */ |
|
521 | + */ |
|
522 | 522 | public function createAnswer( |
523 | 523 | $answer, |
524 | 524 | $correct, |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | $new_hotspot_type = null, |
530 | 530 | $destination = '' |
531 | 531 | ) { |
532 | - $this->new_nbrAnswers++; |
|
532 | + $this->new_nbrAnswers++; |
|
533 | 533 | $id = $this->new_nbrAnswers; |
534 | 534 | $this->new_answer[$id] = $answer; |
535 | 535 | $this->new_correct[$id] = $correct; |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | $this->new_hotspot_coordinates[$id] = $new_hotspot_coordinates; |
540 | 540 | $this->new_hotspot_type[$id] = $new_hotspot_type; |
541 | 541 | $this->new_destination[$id] = $destination; |
542 | - } |
|
542 | + } |
|
543 | 543 | |
544 | 544 | /** |
545 | 545 | * Updates an answer |
@@ -582,31 +582,31 @@ discard block |
||
582 | 582 | ]; |
583 | 583 | |
584 | 584 | Database::update($answerTable, $params, ['id_auto = ?' => $autoId]); |
585 | - } |
|
585 | + } |
|
586 | 586 | |
587 | - /** |
|
588 | - * Records answers into the data base |
|
589 | - * |
|
590 | - * @author Olivier Brouckaert |
|
591 | - */ |
|
587 | + /** |
|
588 | + * Records answers into the data base |
|
589 | + * |
|
590 | + * @author Olivier Brouckaert |
|
591 | + */ |
|
592 | 592 | public function save() |
593 | 593 | { |
594 | - $answerTable = Database::get_course_table(TABLE_QUIZ_ANSWER); |
|
595 | - $questionId = intval($this->questionId); |
|
594 | + $answerTable = Database::get_course_table(TABLE_QUIZ_ANSWER); |
|
595 | + $questionId = intval($this->questionId); |
|
596 | 596 | |
597 | - $c_id = $this->course['real_id']; |
|
597 | + $c_id = $this->course['real_id']; |
|
598 | 598 | $correctList = []; |
599 | 599 | $answerList = []; |
600 | 600 | |
601 | - for ($i=1; $i <= $this->new_nbrAnswers; $i++) { |
|
602 | - $answer = $this->new_answer[$i]; |
|
603 | - $correct = $this->new_correct[$i]; |
|
604 | - $comment = $this->new_comment[$i]; |
|
605 | - $weighting = $this->new_weighting[$i]; |
|
606 | - $position = $this->new_position[$i]; |
|
607 | - $hotspot_coordinates = $this->new_hotspot_coordinates[$i]; |
|
608 | - $hotspot_type = $this->new_hotspot_type[$i]; |
|
609 | - $destination = $this->new_destination[$i]; |
|
601 | + for ($i=1; $i <= $this->new_nbrAnswers; $i++) { |
|
602 | + $answer = $this->new_answer[$i]; |
|
603 | + $correct = $this->new_correct[$i]; |
|
604 | + $comment = $this->new_comment[$i]; |
|
605 | + $weighting = $this->new_weighting[$i]; |
|
606 | + $position = $this->new_position[$i]; |
|
607 | + $hotspot_coordinates = $this->new_hotspot_coordinates[$i]; |
|
608 | + $hotspot_type = $this->new_hotspot_type[$i]; |
|
609 | + $destination = $this->new_destination[$i]; |
|
610 | 610 | $autoId = $this->selectAutoId($i); |
611 | 611 | |
612 | 612 | if (!isset($this->position[$i])) { |
@@ -704,36 +704,36 @@ discard block |
||
704 | 704 | } |
705 | 705 | } |
706 | 706 | |
707 | - // moves $new_* arrays |
|
708 | - $this->answer = $this->new_answer; |
|
709 | - $this->correct = $this->new_correct; |
|
710 | - $this->comment = $this->new_comment; |
|
711 | - $this->weighting = $this->new_weighting; |
|
712 | - $this->position = $this->new_position; |
|
713 | - $this->hotspot_coordinates = $this->new_hotspot_coordinates; |
|
714 | - $this->hotspot_type = $this->new_hotspot_type; |
|
715 | - |
|
716 | - $this->nbrAnswers = $this->new_nbrAnswers; |
|
717 | - $this->destination = $this->new_destination; |
|
718 | - // clears $new_* arrays |
|
719 | - |
|
720 | - $this->cancel(); |
|
721 | - } |
|
722 | - |
|
723 | - /** |
|
724 | - * Duplicates answers by copying them into another question |
|
725 | - * |
|
726 | - * @author Olivier Brouckaert |
|
727 | - * @param int question id |
|
707 | + // moves $new_* arrays |
|
708 | + $this->answer = $this->new_answer; |
|
709 | + $this->correct = $this->new_correct; |
|
710 | + $this->comment = $this->new_comment; |
|
711 | + $this->weighting = $this->new_weighting; |
|
712 | + $this->position = $this->new_position; |
|
713 | + $this->hotspot_coordinates = $this->new_hotspot_coordinates; |
|
714 | + $this->hotspot_type = $this->new_hotspot_type; |
|
715 | + |
|
716 | + $this->nbrAnswers = $this->new_nbrAnswers; |
|
717 | + $this->destination = $this->new_destination; |
|
718 | + // clears $new_* arrays |
|
719 | + |
|
720 | + $this->cancel(); |
|
721 | + } |
|
722 | + |
|
723 | + /** |
|
724 | + * Duplicates answers by copying them into another question |
|
725 | + * |
|
726 | + * @author Olivier Brouckaert |
|
727 | + * @param int question id |
|
728 | 728 | * @param array destination course info (result of the function api_get_course_info() ) |
729 | - */ |
|
729 | + */ |
|
730 | 730 | public function duplicate($newQuestionId, $course_info = null) |
731 | 731 | { |
732 | 732 | if (empty($course_info)) { |
733 | 733 | $course_info = $this->course; |
734 | 734 | } |
735 | 735 | |
736 | - $TBL_REPONSES = Database :: get_course_table(TABLE_QUIZ_ANSWER); |
|
736 | + $TBL_REPONSES = Database :: get_course_table(TABLE_QUIZ_ANSWER); |
|
737 | 737 | $fixed_list = array(); |
738 | 738 | |
739 | 739 | if (self::getQuestionType() == MULTIPLE_ANSWER_TRUE_FALSE || |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | |
748 | 748 | if (!empty($origin_options)) { |
749 | 749 | foreach ($origin_options as $item) { |
750 | - $new_option_list[] = $item['id']; |
|
750 | + $new_option_list[] = $item['id']; |
|
751 | 751 | } |
752 | 752 | } |
753 | 753 | |
@@ -761,12 +761,12 @@ discard block |
||
761 | 761 | } |
762 | 762 | } |
763 | 763 | |
764 | - // if at least one answer |
|
765 | - if ($this->nbrAnswers) { |
|
766 | - // inserts new answers into data base |
|
767 | - $c_id = $course_info['real_id']; |
|
764 | + // if at least one answer |
|
765 | + if ($this->nbrAnswers) { |
|
766 | + // inserts new answers into data base |
|
767 | + $c_id = $course_info['real_id']; |
|
768 | 768 | |
769 | - for ($i=1;$i <= $this->nbrAnswers;$i++) { |
|
769 | + for ($i=1;$i <= $this->nbrAnswers;$i++) { |
|
770 | 770 | if ($this->course['id'] != $course_info['id']) { |
771 | 771 | $this->answer[$i] = DocumentManager::replace_urls_inside_content_html_from_copy_course( |
772 | 772 | $this->answer[$i], |
@@ -780,8 +780,8 @@ discard block |
||
780 | 780 | ); |
781 | 781 | } |
782 | 782 | |
783 | - $answer = $this->answer[$i]; |
|
784 | - $correct = $this->correct[$i]; |
|
783 | + $answer = $this->answer[$i]; |
|
784 | + $correct = $this->correct[$i]; |
|
785 | 785 | |
786 | 786 | if (self::getQuestionType() == MULTIPLE_ANSWER_TRUE_FALSE || |
787 | 787 | self::getQuestionType() == MULTIPLE_ANSWER_TRUE_FALSE |
@@ -789,12 +789,12 @@ discard block |
||
789 | 789 | $correct = $fixed_list[intval($correct)]; |
790 | 790 | } |
791 | 791 | |
792 | - $comment = $this->comment[$i]; |
|
793 | - $weighting = $this->weighting[$i]; |
|
794 | - $position = $this->position[$i]; |
|
795 | - $hotspot_coordinates = $this->hotspot_coordinates[$i]; |
|
796 | - $hotspot_type = $this->hotspot_type[$i]; |
|
797 | - $destination = $this->destination[$i]; |
|
792 | + $comment = $this->comment[$i]; |
|
793 | + $weighting = $this->weighting[$i]; |
|
794 | + $position = $this->position[$i]; |
|
795 | + $hotspot_coordinates = $this->hotspot_coordinates[$i]; |
|
796 | + $hotspot_type = $this->hotspot_type[$i]; |
|
797 | + $destination = $this->destination[$i]; |
|
798 | 798 | |
799 | 799 | $params = [ |
800 | 800 | 'c_id' => $c_id, |
@@ -814,9 +814,9 @@ discard block |
||
814 | 814 | $sql = "UPDATE $TBL_REPONSES SET id = iid, id_auto = iid WHERE iid = $id"; |
815 | 815 | Database::query($sql); |
816 | 816 | } |
817 | - } |
|
817 | + } |
|
818 | 818 | } |
819 | - } |
|
819 | + } |
|
820 | 820 | |
821 | 821 | /** |
822 | 822 | * Get the necessary JavaScript for some answers |
@@ -187,6 +187,7 @@ discard block |
||
187 | 187 | * Reads answer information from the data base ordered by parameter |
188 | 188 | * @param string Field we want to order by |
189 | 189 | * @param string DESC or ASC |
190 | + * @param string $field |
|
190 | 191 | * @author Frederic Vauthier |
191 | 192 | */ |
192 | 193 | public function readOrderedBy($field, $order='ASC') |
@@ -308,6 +309,7 @@ discard block |
||
308 | 309 | * returns the question ID of the destination question |
309 | 310 | * |
310 | 311 | * @author Julio Montoya |
312 | + * @param integer $id |
|
311 | 313 | * @return integer - the question ID |
312 | 314 | */ |
313 | 315 | public function selectDestination($id) |
@@ -329,6 +331,7 @@ discard block |
||
329 | 331 | |
330 | 332 | /** |
331 | 333 | * return array answer by id else return a bool |
334 | + * @param integer $auto_id |
|
332 | 335 | */ |
333 | 336 | public function selectAnswerByAutoId($auto_id) |
334 | 337 | { |
@@ -467,6 +470,7 @@ discard block |
||
467 | 470 | * |
468 | 471 | * @author Olivier Brouckaert |
469 | 472 | * @param - integer $id - answer ID |
473 | + * @param integer $id |
|
470 | 474 | * @return integer - answer weighting |
471 | 475 | */ |
472 | 476 | public function selectWeighting($id) |
@@ -491,6 +495,7 @@ discard block |
||
491 | 495 | * |
492 | 496 | * @author Olivier Brouckaert |
493 | 497 | * @param integer Answer ID |
498 | + * @param integer $id |
|
494 | 499 | * @return integer Answer position |
495 | 500 | */ |
496 | 501 | public function selectHotspotCoordinates($id) |
@@ -503,6 +508,7 @@ discard block |
||
503 | 508 | * |
504 | 509 | * @author Toon Keppens |
505 | 510 | * @param integer Answer ID |
511 | + * @param integer $id |
|
506 | 512 | * @return integer Answer position |
507 | 513 | */ |
508 | 514 | public function selectHotspotType($id) |
@@ -729,6 +735,7 @@ discard block |
||
729 | 735 | * @author Olivier Brouckaert |
730 | 736 | * @param int question id |
731 | 737 | * @param array destination course info (result of the function api_get_course_info() ) |
738 | + * @param string $newQuestionId |
|
732 | 739 | */ |
733 | 740 | public function duplicate($newQuestionId, $course_info = null) |
734 | 741 | { |
@@ -11,40 +11,40 @@ discard block |
||
11 | 11 | * Code |
12 | 12 | */ |
13 | 13 | require_once '../inc/global.inc.php'; |
14 | -$this_section=SECTION_COURSES; |
|
14 | +$this_section = SECTION_COURSES; |
|
15 | 15 | api_protect_course_script(true); |
16 | 16 | |
17 | -$show=(isset($_GET['show']) && $_GET['show'] == 'result')?'result':'test'; // moved down to fix bug: http://www.dokeos.com/forum/viewtopic.php?p=18609#18609 |
|
17 | +$show = (isset($_GET['show']) && $_GET['show'] == 'result') ? 'result' : 'test'; // moved down to fix bug: http://www.dokeos.com/forum/viewtopic.php?p=18609#18609 |
|
18 | 18 | |
19 | 19 | /* Constants and variables */ |
20 | -$is_allowedToEdit = api_is_allowed_to_edit(null,true); |
|
20 | +$is_allowedToEdit = api_is_allowed_to_edit(null, true); |
|
21 | 21 | $is_tutor = api_is_allowed_to_edit(true); |
22 | 22 | |
23 | -if (!$is_allowedToEdit){ |
|
23 | +if (!$is_allowedToEdit) { |
|
24 | 24 | header('Location: /main/exercice/exercise.php?cidReq='.Security::remove_XSS($_GET['cidReq'])); |
25 | 25 | exit; |
26 | 26 | } |
27 | 27 | |
28 | -$interbreadcrumb[]= array ('url' => 'exercise_report.php?'.api_get_cidreq(),'name' => get_lang('Exercises')); |
|
29 | -$interbreadcrumb[]= array ('url' => 'exercise_report.php?filter=2&'.api_get_cidreq(),'name' => get_lang('StudentScore')); |
|
30 | -$interbreadcrumb[]= array ('url' => 'exercise_history.php?exe_id='.intval($_GET['exe_id']).'&'.api_get_cidreq(), 'name' => get_lang('Details')); |
|
28 | +$interbreadcrumb[] = array('url' => 'exercise_report.php?'.api_get_cidreq(), 'name' => get_lang('Exercises')); |
|
29 | +$interbreadcrumb[] = array('url' => 'exercise_report.php?filter=2&'.api_get_cidreq(), 'name' => get_lang('StudentScore')); |
|
30 | +$interbreadcrumb[] = array('url' => 'exercise_history.php?exe_id='.intval($_GET['exe_id']).'&'.api_get_cidreq(), 'name' => get_lang('Details')); |
|
31 | 31 | |
32 | 32 | $TBL_USER = Database::get_main_table(TABLE_MAIN_USER); |
33 | -$TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST); |
|
33 | +$TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST); |
|
34 | 34 | $TBL_EXERCISES_QUESTION = Database::get_course_table(TABLE_QUIZ_QUESTION); |
35 | -$TBL_TRACK_ATTEMPT_RECORDING= Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING); |
|
36 | -Display::display_header($nameTools,get_lang('Exercise')); |
|
35 | +$TBL_TRACK_ATTEMPT_RECORDING = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING); |
|
36 | +Display::display_header($nameTools, get_lang('Exercise')); |
|
37 | 37 | |
38 | 38 | if (isset($_GET['message'])) { |
39 | 39 | if (in_array($_GET['message'], array('ExerciseEdited'))) { |
40 | - $my_message_history=Security::remove_XSS($_GET['message']); |
|
40 | + $my_message_history = Security::remove_XSS($_GET['message']); |
|
41 | 41 | Display::display_confirmation_message(get_lang($my_message_history)); |
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | 45 | echo '<div class="actions">'; |
46 | -echo '<a href="exercise_report.php?' . api_get_cidreq() . '&filter=2">' . |
|
47 | - Display :: return_icon('back.png', get_lang('BackToResultList'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
46 | +echo '<a href="exercise_report.php?'.api_get_cidreq().'&filter=2">'. |
|
47 | + Display :: return_icon('back.png', get_lang('BackToResultList'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
48 | 48 | echo '</div>'; |
49 | 49 | |
50 | 50 | ?> |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | <?php |
61 | 61 | |
62 | 62 | $sql = "SELECT *, quiz_question.question, firstname, lastname FROM $TBL_TRACK_ATTEMPT_RECORDING t, $TBL_USER,$TBL_EXERCISES_QUESTION quiz_question |
63 | - WHERE quiz_question.id = question_id AND user_id = author AND exe_id = '".(int)$_GET['exe_id']."' ORDER BY position"; |
|
63 | + WHERE quiz_question.id = question_id AND user_id = author AND exe_id = '".(int) $_GET['exe_id']."' ORDER BY position"; |
|
64 | 64 | $query = Database::query($sql); |
65 | -while($row = Database::fetch_array($query)){ |
|
65 | +while ($row = Database::fetch_array($query)) { |
|
66 | 66 | echo '<tr'; |
67 | - if ($i%2==0) { |
|
67 | + if ($i % 2 == 0) { |
|
68 | 68 | echo 'class="row_odd"'; |
69 | 69 | } else { |
70 | 70 | echo 'class="row_even"'; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | if (!empty($gradebook) && $gradebook == 'view') { |
110 | 110 | $interbreadcrumb[] = array( |
111 | - 'url' => '../gradebook/' . $_SESSION['gradebook_dest'], |
|
111 | + 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
|
112 | 112 | 'name' => get_lang('ToolGradebook') |
113 | 113 | ); |
114 | 114 | } |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | ); |
699 | 699 | |
700 | 700 | // Exercise results |
701 | - $actions .='<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'. |
|
701 | + $actions .= '<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'. |
|
702 | 702 | Display :: return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>'; |
703 | 703 | |
704 | 704 | // Export |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | } |
763 | 763 | } |
764 | 764 | |
765 | - $actions .='<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'. |
|
765 | + $actions .= '<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'. |
|
766 | 766 | Display :: return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>'; |
767 | 767 | $actions .= Display::url(Display::return_icon('cd.gif', get_lang('CopyExercise')), '', array('onclick' => "javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('AreYouSureToCopy'), ENT_QUOTES, $charset))." ".addslashes($row['title'])."?"."')) return false;", 'href' => 'exercise.php?'.api_get_cidreq().'&choice=copy_exercise&sec_token='.$token.'&exerciseId='.$row['id'])); |
768 | 768 | } |
@@ -952,7 +952,7 @@ discard block |
||
952 | 952 | $item .= Display::tag('td', $actions, array('class' => 'td_actions')); |
953 | 953 | } else { |
954 | 954 | if ($isDrhOfCourse) { |
955 | - $actions ='<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'. |
|
955 | + $actions = '<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'. |
|
956 | 956 | Display :: return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>'; |
957 | 957 | $item .= Display::tag('td', $actions, array('class' => 'td_actions')); |
958 | 958 | } |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | 'tr', |
963 | 963 | $item, |
964 | 964 | array( |
965 | - 'id' => 'exercise_list_' . $my_exercise_id, |
|
965 | + 'id' => 'exercise_list_'.$my_exercise_id, |
|
966 | 966 | ) |
967 | 967 | ); |
968 | 968 | |
@@ -1033,7 +1033,7 @@ discard block |
||
1033 | 1033 | 'adminhp.php?'.api_get_cidreq().'&hotpotatoesName='.$path |
1034 | 1034 | ); |
1035 | 1035 | |
1036 | - $actions .='<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'. |
|
1036 | + $actions .= '<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'. |
|
1037 | 1037 | Display :: return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>'; |
1038 | 1038 | |
1039 | 1039 | // if active |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | $actions .= ' <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=disable&page='.$page.'&file='.$path.'">'. |
1043 | 1043 | Display::return_icon('visible.png', get_lang('Deactivate'), '', ICON_SIZE_SMALL).'</a>'; |
1044 | 1044 | } else { // else if not active |
1045 | - $actions .=' <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=enable&page='.$page.'&file='.$path.'">'. |
|
1045 | + $actions .= ' <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=enable&page='.$page.'&file='.$path.'">'. |
|
1046 | 1046 | Display::return_icon('invisible.png', get_lang('Activate'), '', ICON_SIZE_SMALL).'</a>'; |
1047 | 1047 | } |
1048 | 1048 | $actions .= '<a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=delete&file='.$path.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('AreYouSureToDeleteJS'), ENT_QUOTES, $charset).' '.$title."?").'\')) return false;">'. |
@@ -1075,7 +1075,7 @@ discard block |
||
1075 | 1075 | $item .= Display::tag('td', $attemptText); |
1076 | 1076 | |
1077 | 1077 | if ($isDrhOfCourse) { |
1078 | - $actions ='<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'. |
|
1078 | + $actions = '<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'. |
|
1079 | 1079 | Display :: return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>'; |
1080 | 1080 | |
1081 | 1081 | $item .= Display::tag('td', $actions, array('class' => 'td_actions')); |