@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | .sortable({ |
109 | 109 | cursor: "move", // works? |
110 | 110 | update: function(event, ui) { |
111 | - var order = $(this).sortable("serialize") + "&a=update_question_order&exercise_id=<?php echo intval($_GET['exerciseId']);?>"; |
|
111 | + var order = $(this).sortable("serialize") + "&a=update_question_order&exercise_id=<?php echo intval($_GET['exerciseId']); ?>"; |
|
112 | 112 | $.post("<?php echo $ajax_url ?>", order, function(reponse){ |
113 | 113 | $("#message").html(reponse); |
114 | 114 | }); |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | echo "<div class='table-responsive'>"; |
142 | 142 | echo "<table class='table table-condensed'>"; |
143 | 143 | echo "<tr>"; |
144 | - echo "<th style=\"width: 50%;\">" .get_lang('Questions'). "</th>"; |
|
145 | - echo "<th style=\"width: 6%;\">" .get_lang('Type'). "</th>"; |
|
146 | - echo "<th style=\"width: 22%; text-align:center;\">" .get_lang('Category'). "</th>"; |
|
147 | - echo "<th style=\"width: 6%;\">" .get_lang('Difficulty'). "</th>"; |
|
148 | - echo "<th style=\"width: 16%; float:left;\">" .get_lang('Score'). "</th>"; |
|
144 | + echo "<th style=\"width: 50%;\">".get_lang('Questions')."</th>"; |
|
145 | + echo "<th style=\"width: 6%;\">".get_lang('Type')."</th>"; |
|
146 | + echo "<th style=\"width: 22%; text-align:center;\">".get_lang('Category')."</th>"; |
|
147 | + echo "<th style=\"width: 6%;\">".get_lang('Difficulty')."</th>"; |
|
148 | + echo "<th style=\"width: 16%; float:left;\">".get_lang('Score')."</th>"; |
|
149 | 149 | echo "</tr>"; |
150 | 150 | echo "</table>"; |
151 | 151 | echo "</div>"; |
@@ -172,15 +172,14 @@ discard block |
||
172 | 172 | $question_class = get_class($objQuestionTmp); |
173 | 173 | |
174 | 174 | $clone_link = '<a href="'.api_get_self().'?'.api_get_cidreq().'&clone_question='.$id.'">'. |
175 | - Display::return_icon('cd.gif',get_lang('Copy'), array(), ICON_SIZE_SMALL).'</a>'; |
|
175 | + Display::return_icon('cd.gif', get_lang('Copy'), array(), ICON_SIZE_SMALL).'</a>'; |
|
176 | 176 | $edit_link = ($objQuestionTmp->type == CALCULATED_ANSWER && $objQuestionTmp->isAnswered()) ? |
177 | 177 | '<a>'.Display::return_icon( |
178 | 178 | 'edit_na.png', |
179 | 179 | get_lang('QuestionEditionNotAvailableBecauseItIsAlreadyAnsweredHoweverYouCanCopyItAndModifyTheCopy'), |
180 | 180 | array(), |
181 | 181 | ICON_SIZE_SMALL |
182 | - ).'</a>' : |
|
183 | - '<a href="'.api_get_self().'?'.api_get_cidreq().'&type='. |
|
182 | + ).'</a>' : '<a href="'.api_get_self().'?'.api_get_cidreq().'&type='. |
|
184 | 183 | $objQuestionTmp->selectType().'&myid=1&editQuestion='.$id.'">'. |
185 | 184 | Display::return_icon( |
186 | 185 | 'edit.png', |
@@ -190,16 +189,16 @@ discard block |
||
190 | 189 | ).'</a>'; |
191 | 190 | $delete_link = null; |
192 | 191 | if ($objExercise->edit_exercise_in_lp == true) { |
193 | - $delete_link = '<a id="delete_'.$id.'" class="opener" href="'.api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId.'&deleteQuestion='.$id.'" >'.Display::return_icon('delete.png',get_lang('RemoveFromTest'), array(), ICON_SIZE_SMALL).'</a>'; |
|
192 | + $delete_link = '<a id="delete_'.$id.'" class="opener" href="'.api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId.'&deleteQuestion='.$id.'" >'.Display::return_icon('delete.png', get_lang('RemoveFromTest'), array(), ICON_SIZE_SMALL).'</a>'; |
|
194 | 193 | } |
195 | 194 | |
196 | - $edit_link = Display::tag('div', $edit_link, array('style'=>'float:left; padding:0px; margin:0px')); |
|
197 | - $clone_link = Display::tag('div', $clone_link, array('style'=>'float:left; padding:0px; margin:0px')); |
|
195 | + $edit_link = Display::tag('div', $edit_link, array('style'=>'float:left; padding:0px; margin:0px')); |
|
196 | + $clone_link = Display::tag('div', $clone_link, array('style'=>'float:left; padding:0px; margin:0px')); |
|
198 | 197 | $delete_link = Display::tag('div', $delete_link, array('style'=>'float:left; padding:0px; margin:0px')); |
199 | 198 | $actions = Display::tag( |
200 | 199 | 'div', |
201 | 200 | $edit_link.$clone_link.$delete_link, |
202 | - array('class'=>'edition','style'=>'width:100px; right:10px; margin-top: 8px; position: absolute; top: 10%;') |
|
201 | + array('class'=>'edition', 'style'=>'width:100px; right:10px; margin-top: 8px; position: absolute; top: 10%;') |
|
203 | 202 | ); |
204 | 203 | |
205 | 204 | $title = Security::remove_XSS($objQuestionTmp->selectTitle()); |
@@ -248,7 +247,7 @@ discard block |
||
248 | 247 | echo $actions; |
249 | 248 | echo '</div>'; |
250 | 249 | echo '<div class="question-list-description-block">'; |
251 | - echo '<p class="lead">' . get_lang($question_class) . '</p>'; |
|
250 | + echo '<p class="lead">'.get_lang($question_class).'</p>'; |
|
252 | 251 | //echo get_lang('Level').': '.$objQuestionTmp->selectLevel(); |
253 | 252 | ExerciseLib::showQuestion($id, false, null, null, false, true, false, true, $objExercise->feedback_type, true); |
254 | 253 | echo '</div>'; |
@@ -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]; |
@@ -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. |
@@ -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], |
@@ -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"'; |