Completed
Push — 1.10.x ( ba9367...ff0ff6 )
by Julito
118:58 queued 74:08
created
main/exercice/stats.php 2 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 $result = $objExercise->read($exercise_id);
13 13
 
14 14
 if (!$result) {
15
-	api_not_allowed(true);
15
+    api_not_allowed(true);
16 16
 }
17 17
 
18 18
 $sessionId = api_get_session_id();
@@ -29,17 +29,17 @@  discard block
 block discarded – undo
29 29
 $data = array();
30 30
 // Question title 	# of students who tool it 	Lowest score 	Average 	Highest score 	Maximum score
31 31
 $headers = array(
32
-	get_lang('Question'),
32
+    get_lang('Question'),
33 33
     get_lang('QuestionType'),
34 34
     get_lang('NumberStudentWhoSelectedIt'),
35
-	get_lang('LowestScore'),
36
-	get_lang('AverageScore'),
37
-	get_lang('HighestScore'),
38
-	get_lang('Weighting')
35
+    get_lang('LowestScore'),
36
+    get_lang('AverageScore'),
37
+    get_lang('HighestScore'),
38
+    get_lang('Weighting')
39 39
 );
40 40
 
41 41
 if (!empty($question_list)) {
42
-	foreach ($question_list as $question_id) {
42
+    foreach ($question_list as $question_id) {
43 43
         $question_obj = Question::read($question_id);
44 44
 
45 45
         $exercise_stats = ExerciseLib::get_student_stats_by_question(
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         $data[$question_id]['average_score'] = round($exercise_stats['average'], 2);
74 74
         $data[$question_id]['highest_score'] = round($exercise_stats['max'], 2);
75 75
         $data[$question_id]['max_score'] = round($question_obj->weighting, 2);
76
-	}
76
+    }
77 77
 }
78 78
 
79 79
 // Format A table
@@ -81,37 +81,37 @@  discard block
 block discarded – undo
81 81
 $row = 0;
82 82
 $column = 0;
83 83
 foreach ($headers as $header) {
84
-	$table->setHeaderContents($row, $column, $header);
85
-	$column++;
84
+    $table->setHeaderContents($row, $column, $header);
85
+    $column++;
86 86
 }
87 87
 $row++;
88 88
 foreach ($data as $row_table) {
89
-	$column = 0;
90
-	foreach ($row_table as $cell) {
91
-		$table->setCellContents($row, $column, $cell);
92
-		$table->updateCellAttributes($row, $column, 'align="center"');
93
-		$column++;
94
-	}
95
-	$table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true);
96
-	$row++;
89
+    $column = 0;
90
+    foreach ($row_table as $cell) {
91
+        $table->setCellContents($row, $column, $cell);
92
+        $table->updateCellAttributes($row, $column, 'align="center"');
93
+        $column++;
94
+    }
95
+    $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true);
96
+    $row++;
97 97
 }
98 98
 $content = $table->toHtml();
99 99
 
100 100
 // Format B
101 101
 
102 102
 $headers = array(
103
-	get_lang('Question'),
104
-	get_lang('Answer'),
105
-	get_lang('Correct'),
106
-	get_lang('NumberStudentWhoSelectedIt')
103
+    get_lang('Question'),
104
+    get_lang('Answer'),
105
+    get_lang('Correct'),
106
+    get_lang('NumberStudentWhoSelectedIt')
107 107
 );
108 108
 
109 109
 $data = array();
110 110
 
111 111
 if (!empty($question_list)) {
112 112
     $id = 0;
113
-	foreach ($question_list as $question_id) {
114
-		$question_obj = Question::read($question_id);
113
+    foreach ($question_list as $question_id) {
114
+        $question_obj = Question::read($question_id);
115 115
         $exercise_stats = ExerciseLib::get_student_stats_by_question(
116 116
             $question_id,
117 117
             $exercise_id,
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         );
121 121
 
122 122
         $answer = new Answer($question_id);
123
-		$answer_count = $answer->selectNbrAnswers();
123
+        $answer_count = $answer->selectNbrAnswers();
124 124
 
125 125
         for ($answer_id = 1; $answer_id <= $answer_count; $answer_id++) {
126 126
             $answer_info = $answer->selectAnswer($answer_id);
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
                         $correct = '';
176 176
 
177 177
                         for ($i = 1; $i <= $answer_count; $i++) {
178
-                             $is_correct_i = $answer->isCorrect($i);
179
-                             if ($is_correct_i != 0 && $is_correct_i == $answer_id) {
180
-                                 $correct = $answer->selectAnswer($i);
181
-                                 break;
182
-                             }
178
+                                $is_correct_i = $answer->isCorrect($i);
179
+                                if ($is_correct_i != 0 && $is_correct_i == $answer_id) {
180
+                                    $correct = $answer->selectAnswer($i);
181
+                                    break;
182
+                                }
183 183
                         }
184 184
                         $data[$id]['answer'] = $correct;
185 185
                         $data[$id]['correct'] = $answer_info;
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
             }
246 246
             $id++;
247 247
         }
248
-	}
248
+    }
249 249
 }
250 250
 
251 251
 // Format A table
@@ -253,19 +253,19 @@  discard block
 block discarded – undo
253 253
 $row = 0;
254 254
 $column = 0;
255 255
 foreach ($headers as $header) {
256
-	$table->setHeaderContents($row, $column, $header);
257
-	$column++;
256
+    $table->setHeaderContents($row, $column, $header);
257
+    $column++;
258 258
 }
259 259
 $row++;
260 260
 foreach ($data as $row_table) {
261
-	$column = 0;
262
-	foreach ($row_table as $cell) {
263
-		$table->setCellContents($row, $column, $cell);
264
-		$table->updateCellAttributes($row, $column, 'align="center"');
265
-		$column++;
266
-	}
267
-	$table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true);
268
-	$row++;
261
+    $column = 0;
262
+    foreach ($row_table as $cell) {
263
+        $table->setCellContents($row, $column, $cell);
264
+        $table->updateCellAttributes($row, $column, 'align="center"');
265
+        $column++;
266
+    }
267
+    $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true);
268
+    $row++;
269 269
 }
270 270
 $content .= $table->toHtml();
271 271
 
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
         $data[$question_id]['type'] = $question_obj->get_question_type_name();
62 62
         $percentange = 0;
63 63
         if ($count_students) {
64
-            $percentange = $count_users / $count_students*100;
64
+            $percentange = $count_users / $count_students * 100;
65 65
         }
66 66
 
67 67
         $data[$question_id]['students_who_try_exercise'] = Display::bar_progress(
68 68
             $percentange,
69 69
             false,
70
-            $count_users .' / '.$count_students
70
+            $count_users.' / '.$count_students
71 71
         );
72 72
         $data[$question_id]['lowest_score'] = round($exercise_stats['min'], 2);
73 73
         $data[$question_id]['average_score'] = round($exercise_stats['average'], 2);
@@ -142,23 +142,23 @@  discard block
 block discarded – undo
142 142
                         } else {
143 143
                             $data[$id]['name'] = '-';
144 144
                         }
145
-                        $data[$id]['answer'] 	= $answer_item;
145
+                        $data[$id]['answer'] = $answer_item;
146 146
 
147 147
                         $answer_item = api_substr($answer_item, 1);
148
-                        $answer_item = api_substr($answer_item, 0, api_strlen($answer_item) -1);
148
+                        $answer_item = api_substr($answer_item, 0, api_strlen($answer_item) - 1);
149 149
                         
150
-                        $data[$id]['answer'] 	= $answer_item;
150
+                        $data[$id]['answer'] = $answer_item;
151 151
 
152
-                        $data[$id]['correct'] 	= '-';
152
+                        $data[$id]['correct'] = '-';
153 153
 
154 154
                         $count = ExerciseLib::getNumberStudentsFillBlanksAnwserCount($question_id, $exercise_id);
155 155
                         $count = $count[$counter];
156 156
                         
157 157
                         $percentange = 0;
158 158
                         if (!empty($count_students)) {
159
-                            $percentange = $count/$count_students*100;
159
+                            $percentange = $count / $count_students * 100;
160 160
                         }
161
-                        $data[$id]['attempts'] = Display::bar_progress($percentange, false, $count .' / '.$count_students);
161
+                        $data[$id]['attempts'] = Display::bar_progress($percentange, false, $count.' / '.$count_students);
162 162
                         $id++;
163 163
                         $counter++;
164 164
                     }
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
                         );
195 195
                         $percentange = 0;
196 196
                         if (!empty($count_students)) {
197
-                            $percentange = $count/$count_students*100;
197
+                            $percentange = $count / $count_students * 100;
198 198
                         }
199
-                        $data[$id]['attempts'] = Display::bar_progress($percentange, false, $count .' / '.$count_students);
199
+                        $data[$id]['attempts'] = Display::bar_progress($percentange, false, $count.' / '.$count_students);
200 200
                     }
201 201
                     break;
202 202
                 case HOT_SPOT:
@@ -217,9 +217,9 @@  discard block
 block discarded – undo
217 217
                     );
218 218
                     $percentange = 0;
219 219
                     if (!empty($count_students)) {
220
-                        $percentange = $count/$count_students*100;
220
+                        $percentange = $count / $count_students * 100;
221 221
                     }
222
-                    $data[$id]['attempts'] = Display::bar_progress($percentange, false, $count .' / '.$count_students);
222
+                    $data[$id]['attempts'] = Display::bar_progress($percentange, false, $count.' / '.$count_students);
223 223
                     break;
224 224
                 default:
225 225
                     if ($answer_id == 1) {
@@ -239,9 +239,9 @@  discard block
 block discarded – undo
239 239
                     );
240 240
                     $percentange = 0;
241 241
                     if (!empty($count_students)) {
242
-                        $percentange = $count/$count_students*100;
242
+                        $percentange = $count / $count_students * 100;
243 243
                     }
244
-                    $data[$id]['attempts'] = Display::bar_progress($percentange, false, $count .' / '.$count_students);
244
+                    $data[$id]['attempts'] = Display::bar_progress($percentange, false, $count.' / '.$count_students);
245 245
             }
246 246
             $id++;
247 247
         }
@@ -273,8 +273,8 @@  discard block
 block discarded – undo
273 273
 $interbreadcrumb[] = array("url" => "admin.php?exerciseId=$exercise_id&".api_get_cidreq(), "name" => $objExercise->name);
274 274
 
275 275
 $tpl = new Template(get_lang('ReportByQuestion'));
276
-$actions = '<a href="exercise_report.php?exerciseId='.intval($_GET['exerciseId']).'&'.api_get_cidreq().'">' .
277
-    Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
276
+$actions = '<a href="exercise_report.php?exerciseId='.intval($_GET['exerciseId']).'&'.api_get_cidreq().'">'.
277
+    Display :: return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>';
278 278
 $actions = Display::div($actions, array('class'=> 'actions'));
279 279
 $content = $actions.$content;
280 280
 $tpl->assign('content', $content);
Please login to merge, or discard this patch.
main/exercice/qti2.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 }
22 22
 
23 23
 // the breadcrumbs
24
-$interbreadcrumb[]= array (
24
+$interbreadcrumb[] = array(
25 25
     "url" => api_get_path(WEB_CODE_PATH)."exercice/exercise.php?".api_get_cidreq(),
26 26
     "name" => get_lang('Exercises')
27 27
 );
Please login to merge, or discard this patch.
main/exercice/multiple_answer_true_false.class.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
     }
242 242
 
243 243
     /**
244
-	 * abstract function which creates the form to create / edit the answers of the question
245
-	 * @param FormValidator $form
246
-	 */
244
+     * abstract function which creates the form to create / edit the answers of the question
245
+     * @param FormValidator $form
246
+     */
247 247
     public function processAnswersCreation($form)
248 248
     {
249
-		$questionWeighting = $nbrGoodAnswers = 0;
250
-		$objAnswer = new Answer($this->id);
249
+        $questionWeighting = $nbrGoodAnswers = 0;
250
+        $objAnswer = new Answer($this->id);
251 251
         $nb_answers = $form->getSubmitValue('nb_answers');
252 252
         //$options_count    = $form->getSubmitValue('options_count');
253 253
         $course_id = api_get_course_int_id();
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
                     $course_id,
270 270
                     $i
271 271
                 );
272
-               $correct[$i] = $last_id;
272
+                $correct[$i] = $last_id;
273 273
             }
274 274
         }
275 275
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 
281 281
         $sorted_by_position = array();
282 282
         foreach ($new_options as $item) {
283
-        	$sorted_by_position[$item['position']] = $item;
283
+            $sorted_by_position[$item['position']] = $item;
284 284
         }
285 285
 
286 286
         /* Saving quiz_question.extra values that has the correct scores of
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
         }
294 294
         $this->setExtra(implode(':', $extra_values));
295 295
 
296
-		for ($i = 1; $i <= $nb_answers; $i++) {
296
+        for ($i = 1; $i <= $nb_answers; $i++) {
297 297
             $answer = trim($form->getSubmitValue('answer['.$i.']'));
298 298
             $comment = trim($form->getSubmitValue('comment['.$i.']'));
299 299
             $goodAnswer = trim($form->getSubmitValue('correct['.$i.']'));
@@ -302,18 +302,18 @@  discard block
 block discarded – undo
302 302
                 // change the default values from the form 1 and 2 by the correct "option id" registered
303 303
                 $goodAnswer = $sorted_by_position[$goodAnswer]['id'];
304 304
             }
305
-    	    $questionWeighting += $extra_values[0]; //By default 0 has the correct answers
305
+            $questionWeighting += $extra_values[0]; //By default 0 has the correct answers
306 306
 
307
-        	$objAnswer->createAnswer($answer, $goodAnswer, $comment,'',$i);
307
+            $objAnswer->createAnswer($answer, $goodAnswer, $comment,'',$i);
308 308
         }
309 309
 
310
-    	// saves the answers into the data base
310
+        // saves the answers into the data base
311 311
         $objAnswer->save();
312 312
 
313 313
         // sets the total weighting of the question
314 314
         $this->updateWeighting($questionWeighting);
315 315
         $this->save();
316
-	}
316
+    }
317 317
 
318 318
     /**
319 319
      * @param int $feedback_type
@@ -324,17 +324,17 @@  discard block
 block discarded – undo
324 324
     function return_header($feedback_type = null, $counter = null, $score = null)
325 325
     {
326 326
         $header = parent::return_header($feedback_type, $counter, $score);
327
-  	    $header .= '<table class="'.$this->question_table_class .'">
327
+            $header .= '<table class="'.$this->question_table_class .'">
328 328
 		<tr>
329 329
 			<th>'.get_lang("Choice").'</th>
330 330
 			<th>'. get_lang("ExpectedChoice").'</th>
331 331
 			<th>'. get_lang("Answer").'</th>';
332
-			if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
333
-				$header .= '<th>'.get_lang("Comment").'</th>';
334
-			} else {
335
-				$header .= '<th>&nbsp;</th>';
336
-			}
332
+            if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
333
+                $header .= '<th>'.get_lang("Comment").'</th>';
334
+            } else {
335
+                $header .= '<th>&nbsp;</th>';
336
+            }
337 337
         $header .= '</tr>';
338 338
         return $header;
339
-	}
339
+    }
340 340
 }
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -44,14 +44,14 @@  discard block
 block discarded – undo
44 44
         $html = '<table class="table table-striped table-hover">';
45 45
         $html .= '<thead>';
46 46
         $html .= '<tr>';
47
-        $html .= '<th>' . get_lang('Number') . '</th>';
48
-        $html .= '<th>' . get_lang('True') . '</th>';
49
-        $html .= '<th>' . get_lang('False') . '</th>';
50
-        $html .= '<th>' . get_lang('Answer') . '</th>';
47
+        $html .= '<th>'.get_lang('Number').'</th>';
48
+        $html .= '<th>'.get_lang('True').'</th>';
49
+        $html .= '<th>'.get_lang('False').'</th>';
50
+        $html .= '<th>'.get_lang('Answer').'</th>';
51 51
 
52 52
         // show column comment when feedback is enable
53 53
         if ($obj_ex->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) {
54
-            $html .= '<th>' . get_lang('Comment') . '</th>';
54
+            $html .= '<th>'.get_lang('Comment').'</th>';
55 55
         }
56 56
 
57 57
         $html .= '</tr>';
@@ -89,19 +89,19 @@  discard block
 block discarded – undo
89 89
 
90 90
             $renderer->setElementTemplate(
91 91
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
92
-                'correct[' . $i . ']'
92
+                'correct['.$i.']'
93 93
             );
94 94
             $renderer->setElementTemplate(
95 95
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
96
-                'counter[' . $i . ']'
96
+                'counter['.$i.']'
97 97
             );
98 98
             $renderer->setElementTemplate(
99 99
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
100
-                'answer[' . $i . ']'
100
+                'answer['.$i.']'
101 101
             );
102 102
             $renderer->setElementTemplate(
103 103
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
104
-                'comment[' . $i . ']'
104
+                'comment['.$i.']'
105 105
             );
106 106
 
107 107
             $answer_number = $form->addElement(
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
             $answer_number->freeze();
115 115
 
116 116
             if (is_object($answer)) {
117
-                $defaults['answer[' . $i . ']'] = $answer->answer[$i];
118
-                $defaults['comment[' . $i . ']'] = $answer->comment[$i];
117
+                $defaults['answer['.$i.']'] = $answer->answer[$i];
118
+                $defaults['comment['.$i.']'] = $answer->comment[$i];
119 119
                 $correct = $answer->correct[$i];
120
-                $defaults['correct[' . $i . ']'] = $correct;
120
+                $defaults['correct['.$i.']'] = $correct;
121 121
 
122 122
                 $j = 1;
123 123
                 if (!empty($optionData)) {
124 124
                     foreach ($optionData as $id => $data) {
125
-                        $form->addElement('radio', 'correct[' . $i . ']', null, null, $id);
125
+                        $form->addElement('radio', 'correct['.$i.']', null, null, $id);
126 126
                         $j++;
127 127
                         if ($j == 3) {
128 128
                             break;
@@ -130,15 +130,15 @@  discard block
 block discarded – undo
130 130
                     }
131 131
                 }
132 132
             } else {
133
-                $form->addElement('radio', 'correct[' . $i . ']', null, null, 1);
134
-                $form->addElement('radio', 'correct[' . $i . ']', null, null, 2);
133
+                $form->addElement('radio', 'correct['.$i.']', null, null, 1);
134
+                $form->addElement('radio', 'correct['.$i.']', null, null, 2);
135 135
 
136
-                $defaults['answer[' . $i . ']'] = '';
137
-                $defaults['comment[' . $i . ']'] = '';
138
-                $defaults['correct[' . $i . ']'] = '';
136
+                $defaults['answer['.$i.']'] = '';
137
+                $defaults['comment['.$i.']'] = '';
138
+                $defaults['correct['.$i.']'] = '';
139 139
             }
140 140
 
141
-            $boxes_names[] = 'correct[' . $i . ']';
141
+            $boxes_names[] = 'correct['.$i.']';
142 142
 
143 143
             $form->addHtmlEditor(
144 144
                 "answer[$i]",
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             if ($obj_ex->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) {
153 153
                 $form->addElement(
154 154
                     'html_editor',
155
-                    'comment[' . $i . ']',
155
+                    'comment['.$i.']',
156 156
                     null,
157 157
                     array(),
158 158
                     array(
@@ -170,22 +170,22 @@  discard block
 block discarded – undo
170 170
 
171 171
         $correctInputTemplate = '<div class="form-group">';
172 172
         $correctInputTemplate .= '<label class="col-sm-2 control-label">';
173
-        $correctInputTemplate .= '<span class="form_required">*</span>' . get_lang('Score');
173
+        $correctInputTemplate .= '<span class="form_required">*</span>'.get_lang('Score');
174 174
         $correctInputTemplate .= '</label>';
175 175
         $correctInputTemplate .= '<div class="col-sm-8">';
176 176
         $correctInputTemplate .= '<table>';
177 177
         $correctInputTemplate .= '<tr>';
178 178
         $correctInputTemplate .= '<td>';
179
-        $correctInputTemplate .= get_lang('Correct') . '{element}';
179
+        $correctInputTemplate .= get_lang('Correct').'{element}';
180 180
         $correctInputTemplate .= '<!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->';
181 181
         $correctInputTemplate .= '</td>';
182 182
 
183 183
         $wrongInputTemplate = '<td>';
184
-        $wrongInputTemplate .= get_lang('Wrong') . '{element}';
184
+        $wrongInputTemplate .= get_lang('Wrong').'{element}';
185 185
         $wrongInputTemplate .= '<!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->';
186 186
         $wrongInputTemplate .= '</td>';
187 187
 
188
-        $doubtScoreInputTemplate = '<td>' . get_lang('DoubtScore') . '<br>{element}';
188
+        $doubtScoreInputTemplate = '<td>'.get_lang('DoubtScore').'<br>{element}';
189 189
         $doubtScoreInputTemplate .= '<!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->';
190 190
         $doubtScoreInputTemplate .= '</td>';
191 191
         $doubtScoreInputTemplate .= '</tr>';
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 
215 215
             if (!empty($scores)) {
216 216
                 for ($i = 1; $i <= 3; $i++) {
217
-                    $defaults['option[' . $i . ']'] = $scores[$i - 1];
217
+                    $defaults['option['.$i.']'] = $scores[$i - 1];
218 218
                 }
219 219
             }
220 220
         }
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
                 Question::updateQuestionOption($id, $optionData, $course_id);
263 263
             }
264 264
         } else {
265
-            for ($i=1 ; $i <= 3 ; $i++) {
265
+            for ($i = 1; $i <= 3; $i++) {
266 266
                 $last_id = Question::saveQuestionOption(
267 267
                     $this->id,
268 268
                     $this->options[$i],
@@ -287,9 +287,9 @@  discard block
 block discarded – undo
287 287
         the true, false, doubt options registered in this format
288 288
         XX:YY:ZZZ where XX is a float score value.*/
289 289
         $extra_values = array();
290
-        for ($i=1 ; $i <= 3 ; $i++) {
290
+        for ($i = 1; $i <= 3; $i++) {
291 291
             $score = trim($form -> getSubmitValue('option['.$i.']'));
292
-            $extra_values[]= $score;
292
+            $extra_values[] = $score;
293 293
         }
294 294
         $this->setExtra(implode(':', $extra_values));
295 295
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
             }
305 305
     	    $questionWeighting += $extra_values[0]; //By default 0 has the correct answers
306 306
 
307
-        	$objAnswer->createAnswer($answer, $goodAnswer, $comment,'',$i);
307
+        	$objAnswer->createAnswer($answer, $goodAnswer, $comment, '', $i);
308 308
         }
309 309
 
310 310
     	// saves the answers into the data base
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
     function return_header($feedback_type = null, $counter = null, $score = null)
325 325
     {
326 326
         $header = parent::return_header($feedback_type, $counter, $score);
327
-  	    $header .= '<table class="'.$this->question_table_class .'">
327
+  	    $header .= '<table class="'.$this->question_table_class.'">
328 328
 		<tr>
329 329
 			<th>'.get_lang("Choice").'</th>
330 330
 			<th>'. get_lang("ExpectedChoice").'</th>
Please login to merge, or discard this patch.
main/exercice/hotspot_save.inc.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -15,24 +15,24 @@
 block discarded – undo
15 15
 $answerId 	= intval($_GET['answerId']);
16 16
 
17 17
 if ($_GET['type'] == "square" || $_GET['type'] == "circle") {
18
-	$hotspot_type = $_GET['type'];
19
-	$hotspot_coordinates = $_GET['x'].";".$_GET['y']."|".$_GET['width']."|".$_GET['height'];
18
+    $hotspot_type = $_GET['type'];
19
+    $hotspot_coordinates = $_GET['x'].";".$_GET['y']."|".$_GET['width']."|".$_GET['height'];
20 20
 }
21 21
 if ($_GET['type'] == "poly" || $_GET['type'] == "delineation" || $_GET['type'] == "oar") {
22
-	$hotspot_type = $_GET['type'];
23
-	$tmp_coord = explode(",",$_GET['co']);
24
-	$i = 0;
25
-	$hotspot_coordinates = "";
26
-	foreach ($tmp_coord as $coord) {
27
-		if ($i%2 == 0) {
28
-			$delimiter = ";";
29
-		} else {
30
-			$delimiter = "|";
31
-		}
32
-		$hotspot_coordinates .= $coord.$delimiter;
33
-		$i++;
34
-	}
35
-	$hotspot_coordinates = api_substr($hotspot_coordinates,0,-2);
22
+    $hotspot_type = $_GET['type'];
23
+    $tmp_coord = explode(",",$_GET['co']);
24
+    $i = 0;
25
+    $hotspot_coordinates = "";
26
+    foreach ($tmp_coord as $coord) {
27
+        if ($i%2 == 0) {
28
+            $delimiter = ";";
29
+        } else {
30
+            $delimiter = "|";
31
+        }
32
+        $hotspot_coordinates .= $coord.$delimiter;
33
+        $i++;
34
+    }
35
+    $hotspot_coordinates = api_substr($hotspot_coordinates,0,-2);
36 36
 }
37 37
 $course_id = api_get_course_int_id();
38 38
 $sql = "UPDATE $TBL_ANSWER SET
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
14 14
 $questionId = intval($_GET['questionId']);
15
-$answerId 	= intval($_GET['answerId']);
15
+$answerId = intval($_GET['answerId']);
16 16
 
17 17
 if ($_GET['type'] == "square" || $_GET['type'] == "circle") {
18 18
 	$hotspot_type = $_GET['type'];
@@ -20,11 +20,11 @@  discard block
 block discarded – undo
20 20
 }
21 21
 if ($_GET['type'] == "poly" || $_GET['type'] == "delineation" || $_GET['type'] == "oar") {
22 22
 	$hotspot_type = $_GET['type'];
23
-	$tmp_coord = explode(",",$_GET['co']);
23
+	$tmp_coord = explode(",", $_GET['co']);
24 24
 	$i = 0;
25 25
 	$hotspot_coordinates = "";
26 26
 	foreach ($tmp_coord as $coord) {
27
-		if ($i%2 == 0) {
27
+		if ($i % 2 == 0) {
28 28
 			$delimiter = ";";
29 29
 		} else {
30 30
 			$delimiter = "|";
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 		$hotspot_coordinates .= $coord.$delimiter;
33 33
 		$i++;
34 34
 	}
35
-	$hotspot_coordinates = api_substr($hotspot_coordinates,0,-2);
35
+	$hotspot_coordinates = api_substr($hotspot_coordinates, 0, -2);
36 36
 }
37 37
 $course_id = api_get_course_int_id();
38 38
 $sql = "UPDATE $TBL_ANSWER SET
Please login to merge, or discard this patch.
main/exercice/question_create.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -51,17 +51,17 @@
 block discarded – undo
51 51
 $result = Database::query($sql);
52 52
 $exercises['-'] = '-'.get_lang('SelectExercise').'-';
53 53
 while ($row = Database :: fetch_array($result)) {
54
-	$exercises[$row['id']] = cut($row['title'], EXERCISE_MAX_NAME_SIZE);
54
+    $exercises[$row['id']] = cut($row['title'], EXERCISE_MAX_NAME_SIZE);
55 55
 }
56 56
 $form->addElement('select', 'exercise', get_lang('Exercise'), $exercises);
57 57
 
58 58
 // generate default content
59 59
 $form->addElement(
60
-	'checkbox',
61
-	'is_content',
62
-	null,
63
-	get_lang('GenerateDefaultContent'),
64
-	array('checked' => true)
60
+    'checkbox',
61
+    'is_content',
62
+    null,
63
+    get_lang('GenerateDefaultContent'),
64
+    array('checked' => true)
65 65
 );
66 66
 
67 67
 // the submit button
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,21 +8,21 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
main/exercice/calculated_answer.class.php 1 patch
Spacing   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>';
Please login to merge, or discard this patch.
main/exercice/matching.class.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>
Please login to merge, or discard this patch.
main/exercice/question_admin.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
main/exercice/hotspot_updatescore.inc.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -17,25 +17,25 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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];
Please login to merge, or discard this patch.