Completed
Push — 1.11.x ( 81dbf4...6ab6ac )
by José
86:12 queued 55:54
created
main/exercise/export/qti2/qti2_export.php 1 patch
Indentation   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -34,21 +34,21 @@  discard block
 block discarded – undo
34 34
      *
35 35
      * @param Ims2Question $question Ims2Question object we want to export.
36 36
      */
37
-     function __construct($question)
38
-     {
37
+        function __construct($question)
38
+        {
39 39
         $this->question = $question;
40 40
         $this->answer = $this->question->setAnswer();
41 41
         $this->questionIdent = "QST_" . $question->id ;
42
-     }
43
-
44
-     /**
45
-      * Start the XML flow.
46
-      *
47
-      * This opens the <item> block, with correct attributes.
48
-      *
49
-      */
50
-      function start_item()
51
-      {
42
+        }
43
+
44
+        /**
45
+         * Start the XML flow.
46
+         *
47
+         * This opens the <item> block, with correct attributes.
48
+         *
49
+         */
50
+        function start_item()
51
+        {
52 52
         $string = '<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1"
53 53
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
54 54
                     xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p1 imsqti_v2p1.xsd"
@@ -56,55 +56,55 @@  discard block
 block discarded – undo
56 56
                     title="'.htmlspecialchars(formatExerciseQtiTitle($this->question->selectTitle())).'">'."\n";
57 57
 
58 58
         return $string;
59
-      }
60
-
61
-      /**
62
-       * End the XML flow, closing the </item> tag.
63
-       *
64
-       */
65
-      function end_item()
66
-      {
59
+        }
60
+
61
+        /**
62
+         * End the XML flow, closing the </item> tag.
63
+         *
64
+         */
65
+        function end_item()
66
+        {
67 67
         return "</assessmentItem>\n";
68
-      }
69
-
70
-     /**
71
-      * Start the itemBody
72
-      *
73
-      */
74
-     function start_item_body()
75
-     {
68
+        }
69
+
70
+        /**
71
+         * Start the itemBody
72
+         *
73
+         */
74
+        function start_item_body()
75
+        {
76 76
         return '  <itemBody>' . "\n";
77
-     }
78
-
79
-     /**
80
-      * End the itemBody part.
81
-      *
82
-      */
83
-     function end_item_body()
84
-     {
77
+        }
78
+
79
+        /**
80
+         * End the itemBody part.
81
+         *
82
+         */
83
+        function end_item_body()
84
+        {
85 85
         return "  </itemBody>\n";
86
-     }
87
-
88
-     /**
89
-      * add the response processing template used.
90
-      *
91
-      */
92
-
93
-      function add_response_processing()
94
-      {
95
-          return '  <responseProcessing template="http://www.imsglobal.org/question/qti_v2p1/rptemplates/map_correct"/>' . "\n";
96
-      }
97
-
98
-     /**
99
-      * Export the question as an IMS/QTI Item.
100
-      *
101
-      * This is a default behaviour, some classes may want to override this.
102
-      *
103
-      * @param $standalone: Boolean stating if it should be exported as a stand-alone question
104
-      * @return string string, the XML flow for an Item.
105
-      */
106
-     function export($standalone = false)
107
-     {
86
+        }
87
+
88
+        /**
89
+         * add the response processing template used.
90
+         *
91
+         */
92
+
93
+        function add_response_processing()
94
+        {
95
+            return '  <responseProcessing template="http://www.imsglobal.org/question/qti_v2p1/rptemplates/map_correct"/>' . "\n";
96
+        }
97
+
98
+        /**
99
+         * Export the question as an IMS/QTI Item.
100
+         *
101
+         * This is a default behaviour, some classes may want to override this.
102
+         *
103
+         * @param $standalone: Boolean stating if it should be exported as a stand-alone question
104
+         * @return string string, the XML flow for an Item.
105
+         */
106
+        function export($standalone = false)
107
+        {
108 108
         $head = $foot = "";
109 109
 
110 110
         if ($standalone) {
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
             .$foot;
132 132
 
133 133
         return $res;
134
-     }
134
+        }
135 135
 }
136 136
 
137 137
 /**
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
     function export_presentation()
195 195
     {
196 196
         $out = "<presentation_material><flow_mat><material>\n"
197
-             . "  <mattext><![CDATA[" . formatExerciseQtiDescription($this->exercise->selectDescription()) . "]]></mattext>\n"
198
-             . "</material></flow_mat></presentation_material>\n";
197
+                . "  <mattext><![CDATA[" . formatExerciseQtiDescription($this->exercise->selectDescription()) . "]]></mattext>\n"
198
+                . "</material></flow_mat></presentation_material>\n";
199 199
         return $out;
200 200
     }
201 201
 
@@ -209,15 +209,15 @@  discard block
 block discarded – undo
209 209
         $out = '';
210 210
         if ($n = $this->exercise->getShuffle()) {
211 211
             $out.= "<selection_ordering>"
212
-                 . "  <selection>\n"
213
-                 . "    <selection_number>" . $n . "</selection_number>\n"
214
-                 . "  </selection>\n"
215
-                 . '  <order order_type="Random" />'
216
-                 . "\n</selection_ordering>\n";
212
+                    . "  <selection>\n"
213
+                    . "    <selection_number>" . $n . "</selection_number>\n"
214
+                    . "  </selection>\n"
215
+                    . '  <order order_type="Random" />'
216
+                    . "\n</selection_ordering>\n";
217 217
         } else {
218 218
             $out.= '<selection_ordering sequence_type="Normal">' . "\n"
219
-                 . "  <selection />\n"
220
-                 . "</selection_ordering>\n";
219
+                    . "  <selection />\n"
220
+                    . "</selection_ordering>\n";
221 221
         }
222 222
 
223 223
         return $out;
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
     {
232 232
         $out = "";
233 233
         foreach ($this->exercise->selectQuestionList() as $q) {
234
-        	$out .= export_question_qti($q, false);
234
+            $out .= export_question_qti($q, false);
235 235
         }
236 236
         return $out;
237 237
     }
@@ -248,18 +248,18 @@  discard block
 block discarded – undo
248 248
         $head = $foot = "";
249 249
         if ($standalone) {
250 250
             $head = '<?xml version = "1.0" encoding = "UTF-8" standalone = "no"?>' . "\n"
251
-                  . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n"
252
-                  . "<questestinterop>\n";
251
+                    . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n"
252
+                    . "<questestinterop>\n";
253 253
             $foot = "</questestinterop>\n";
254 254
         }
255 255
         $out = $head
256
-             . $this->start_section()
257
-             . $this->export_duration()
258
-             . $this->export_presentation()
259
-             . $this->export_ordering()
260
-             . $this->export_questions()
261
-             . $this->end_section()
262
-             . $foot;
256
+                . $this->start_section()
257
+                . $this->export_duration()
258
+                . $this->export_presentation()
259
+                . $this->export_ordering()
260
+                . $this->export_questions()
261
+                . $this->end_section()
262
+                . $foot;
263 263
 
264 264
         return $out;
265 265
     }
@@ -306,97 +306,97 @@  discard block
 block discarded – undo
306 306
      * @return ImsItem
307 307
      * @author Anamd Tihon
308 308
      */
309
-     function __construct($question)
310
-     {
309
+        function __construct($question)
310
+        {
311 311
         $this->question = $question;
312 312
         $this->answer = $question->answer;
313 313
         $this->questionIdent = "QST_" . $question->selectId() ;
314
-     }
315
-
316
-     /**
317
-      * Start the XML flow.
318
-      *
319
-      * This opens the <item> block, with correct attributes.
320
-      *
321
-      * @author Amand Tihon <[email protected]>
322
-      */
323
-      function start_item()
324
-      {
314
+        }
315
+
316
+        /**
317
+         * Start the XML flow.
318
+         *
319
+         * This opens the <item> block, with correct attributes.
320
+         *
321
+         * @author Amand Tihon <[email protected]>
322
+         */
323
+        function start_item()
324
+        {
325 325
         return '<item title="' . cleanAttribute(formatExerciseQtiDescription($this->question->selectTitle())) . '" ident="' . $this->questionIdent . '">' . "\n";
326
-      }
327
-
328
-      /**
329
-       * End the XML flow, closing the </item> tag.
330
-       *
331
-       * @author Amand Tihon <[email protected]>
332
-       */
333
-      function end_item()
334
-      {
326
+        }
327
+
328
+        /**
329
+         * End the XML flow, closing the </item> tag.
330
+         *
331
+         * @author Amand Tihon <[email protected]>
332
+         */
333
+        function end_item()
334
+        {
335 335
         return "</item>\n";
336
-      }
337
-
338
-     /**
339
-      * Create the opening, with the question itself.
340
-      *
341
-      * This means it opens the <presentation> but doesn't close it, as this is the role of end_presentation().
342
-      * In between, the export_responses from the subclass should have been called.
343
-      *
344
-      * @author Amand Tihon <[email protected]>
345
-      */
346
-     function start_presentation()
347
-     {
336
+        }
337
+
338
+        /**
339
+         * Create the opening, with the question itself.
340
+         *
341
+         * This means it opens the <presentation> but doesn't close it, as this is the role of end_presentation().
342
+         * In between, the export_responses from the subclass should have been called.
343
+         *
344
+         * @author Amand Tihon <[email protected]>
345
+         */
346
+        function start_presentation()
347
+        {
348 348
         return '<presentation label="' . $this->questionIdent . '"><flow>' . "\n"
349
-             . '<material><mattext>' . formatExerciseQtiDescription($this->question->selectDescription()) . "</mattext></material>\n";
350
-     }
351
-
352
-     /**
353
-      * End the </presentation> part, opened by export_header.
354
-      *
355
-      * @author Amand Tihon <[email protected]>
356
-      */
357
-     function end_presentation()
358
-     {
349
+                . '<material><mattext>' . formatExerciseQtiDescription($this->question->selectDescription()) . "</mattext></material>\n";
350
+        }
351
+
352
+        /**
353
+         * End the </presentation> part, opened by export_header.
354
+         *
355
+         * @author Amand Tihon <[email protected]>
356
+         */
357
+        function end_presentation()
358
+        {
359 359
         return "</flow></presentation>\n";
360
-     }
361
-
362
-     /**
363
-      * Start the response processing, and declare the default variable, SCORE, at 0 in the outcomes.
364
-      *
365
-      * @author Amand Tihon <[email protected]>
366
-      */
367
-     function start_processing()
368
-     {
360
+        }
361
+
362
+        /**
363
+         * Start the response processing, and declare the default variable, SCORE, at 0 in the outcomes.
364
+         *
365
+         * @author Amand Tihon <[email protected]>
366
+         */
367
+        function start_processing()
368
+        {
369 369
         return '<resprocessing><outcomes><decvar vartype="Integer" defaultval="0" /></outcomes>' . "\n";
370
-     }
371
-
372
-     /**
373
-      * End the response processing part.
374
-      *
375
-      * @author Amand Tihon <[email protected]>
376
-      */
377
-     function end_processing()
378
-     {
370
+        }
371
+
372
+        /**
373
+         * End the response processing part.
374
+         *
375
+         * @author Amand Tihon <[email protected]>
376
+         */
377
+        function end_processing()
378
+        {
379 379
         return "</resprocessing>\n";
380
-     }
381
-
382
-     /**
383
-      * Export the question as an IMS/QTI Item.
384
-      *
385
-      * This is a default behaviour, some classes may want to override this.
386
-      *
387
-      * @param $standalone: Boolean stating if it should be exported as a stand-alone question
388
-      * @return string string, the XML flow for an Item.
389
-      * @author Amand Tihon <[email protected]>
390
-      */
391
-     function export($standalone = False)
392
-     {
380
+        }
381
+
382
+        /**
383
+         * Export the question as an IMS/QTI Item.
384
+         *
385
+         * This is a default behaviour, some classes may want to override this.
386
+         *
387
+         * @param $standalone: Boolean stating if it should be exported as a stand-alone question
388
+         * @return string string, the XML flow for an Item.
389
+         * @author Amand Tihon <[email protected]>
390
+         */
391
+        function export($standalone = False)
392
+        {
393 393
         global $charset;
394 394
         $head = $foot = "";
395 395
 
396 396
         if ($standalone) {
397 397
             $head = '<?xml version = "1.0" encoding = "'.$charset.'" standalone = "no"?>' . "\n"
398
-                  . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n"
399
-                  . "<questestinterop>\n";
398
+                    . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n"
399
+                    . "<questestinterop>\n";
400 400
             $foot = "</questestinterop>\n";
401 401
         }
402 402
 
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
             . $this->answer->imsExportFeedback($this->questionIdent)
412 412
             . $this->end_item()
413 413
             . $foot;
414
-     }
414
+        }
415 415
 }
416 416
 
417 417
 /**
@@ -450,9 +450,9 @@  discard block
 block discarded – undo
450 450
     $question->type = $qst->type;
451 451
     $question->question = $qst->question;
452 452
     $question->description = $qst->description;
453
-	$question->weighting=$qst->weighting;
454
-	$question->position=$qst->position;
455
-	$question->picture=$qst->picture;
453
+    $question->weighting=$qst->weighting;
454
+    $question->position=$qst->position;
455
+    $question->picture=$qst->picture;
456 456
     $ims = new ImsAssessmentItem($question);
457 457
 
458 458
     return $ims->export($standalone);
Please login to merge, or discard this patch.
main/exercise/answer.class.php 1 patch
Indentation   +319 added lines, -319 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
     public $new_destination; // id of the next question if feedback option is set to Directfeedback
38 38
     public $course; //Course information
39 39
     public $iid;
40
-	public $questionJSId;
41
-	public $standalone;
40
+    public $questionJSId;
41
+    public $standalone;
42 42
 
43 43
     /**
44 44
      * constructor of the class
@@ -159,12 +159,12 @@  discard block
 block discarded – undo
159 159
         return [];
160 160
     }
161 161
 
162
-     /**
163
-     * returns all answer ids from this question Id
164
-     *
165
-     * @author Yoselyn Castillo
166
-     * @return array - $id (answer ids)
167
-     */
162
+        /**
163
+         * returns all answer ids from this question Id
164
+         *
165
+         * @author Yoselyn Castillo
166
+         * @return array - $id (answer ids)
167
+         */
168 168
     public function selectAnswerId()
169 169
     {
170 170
         $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
         }
185 185
 
186 186
         return $id;
187
-	}
187
+    }
188 188
 
189 189
     /**
190 190
      * Reads answer information from the data base ordered by parameter
@@ -195,23 +195,23 @@  discard block
 block discarded – undo
195 195
      */
196 196
     public function readOrderedBy($field, $order='ASC')
197 197
     {
198
-		$field = Database::escape_string($field);
199
-		if (empty($field)) {
200
-			$field = 'position';
201
-		}
198
+        $field = Database::escape_string($field);
199
+        if (empty($field)) {
200
+            $field = 'position';
201
+        }
202 202
 
203
-		if ($order != 'ASC' && $order!='DESC') {
204
-			$order = 'ASC';
205
-		}
203
+        if ($order != 'ASC' && $order!='DESC') {
204
+            $order = 'ASC';
205
+        }
206 206
 
207
-		$TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
208
-		$TBL_QUIZ = Database::get_course_table(TABLE_QUIZ_QUESTION);
209
-		$questionId = intval($this->questionId);
207
+        $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
208
+        $TBL_QUIZ = Database::get_course_table(TABLE_QUIZ_QUESTION);
209
+        $questionId = intval($this->questionId);
210 210
 
211
-		$sql = "SELECT type FROM $TBL_QUIZ
211
+        $sql = "SELECT type FROM $TBL_QUIZ
212 212
 		        WHERE c_id = {$this->course_id} AND id = $questionId";
213
-		$result_question = Database::query($sql);
214
-		$questionType = Database::fetch_array($result_question);
213
+        $result_question = Database::query($sql);
214
+        $questionType = Database::fetch_array($result_question);
215 215
 
216 216
         if ($questionType['type'] == DRAGGABLE) {
217 217
             // Random is done by submit.js.tpl
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
             return true;
221 221
         }
222 222
 
223
-		$sql = "SELECT
223
+        $sql = "SELECT
224 224
 		            answer,
225 225
 		            correct,
226 226
 		            comment,
@@ -236,16 +236,16 @@  discard block
 block discarded – undo
236 236
                     c_id = {$this->course_id} AND
237 237
                     question_id='".$questionId."'
238 238
                 ORDER BY $field $order";
239
-		$result=Database::query($sql);
240
-
241
-		$i = 1;
242
-		// while a record is found
243
-		$doubt_data = null;
244
-		while ($object = Database::fetch_object($result)) {
245
-		    if ($questionType['type'] == UNIQUE_ANSWER_NO_OPTION && $object->position == 666) {
246
-		        $doubt_data = $object;
239
+        $result=Database::query($sql);
240
+
241
+        $i = 1;
242
+        // while a record is found
243
+        $doubt_data = null;
244
+        while ($object = Database::fetch_object($result)) {
245
+            if ($questionType['type'] == UNIQUE_ANSWER_NO_OPTION && $object->position == 666) {
246
+                $doubt_data = $object;
247 247
                 continue;
248
-		    }
248
+            }
249 249
             $this->answer[$i] = $object->answer;
250 250
             $this->correct[$i] = $object->correct;
251 251
             $this->comment[$i] = $object->comment;
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
             $this->autoId[$i] = $object->id_auto;
258 258
             $this->iid[$i] = $object->iid;
259 259
             $i++;
260
-		}
260
+        }
261 261
 
262
-		if ($questionType['type'] == UNIQUE_ANSWER_NO_OPTION && !empty($doubt_data)) {
262
+        if ($questionType['type'] == UNIQUE_ANSWER_NO_OPTION && !empty($doubt_data)) {
263 263
             $this->answer[$i] = $doubt_data->answer;
264 264
             $this->correct[$i] = $doubt_data->correct;
265 265
             $this->comment[$i] = $doubt_data->comment;
@@ -271,88 +271,88 @@  discard block
 block discarded – undo
271 271
             $this->autoId[$i] = $doubt_data->id_auto;
272 272
             $this->iid[$i] = $doubt_data->iid;
273 273
             $i++;
274
-	    }
274
+        }
275 275
         $this->nbrAnswers = $i-1;
276
-	}
277
-
278
-	/**
279
-	 * returns the autoincrement id identificator
280
-	 *
281
-	 * @author Juan Carlos Ra�a
282
-	 * @return integer - answer num
283
-	 */
276
+    }
277
+
278
+    /**
279
+     * returns the autoincrement id identificator
280
+     *
281
+     * @author Juan Carlos Ra�a
282
+     * @return integer - answer num
283
+     */
284 284
     public function selectAutoId($id)
285 285
     {
286
-		return isset($this->autoId[$id]) ? $this->autoId[$id] : 0;
287
-	}
288
-
289
-	/**
290
-	 * returns the number of answers in this question
291
-	 *
292
-	 * @author Olivier Brouckaert
293
-	 * @return integer - number of answers
294
-	 */
295
-	public function selectNbrAnswers()
286
+        return isset($this->autoId[$id]) ? $this->autoId[$id] : 0;
287
+    }
288
+
289
+    /**
290
+     * returns the number of answers in this question
291
+     *
292
+     * @author Olivier Brouckaert
293
+     * @return integer - number of answers
294
+     */
295
+    public function selectNbrAnswers()
296 296
     {
297
-		return $this->nbrAnswers;
298
-	}
299
-
300
-	/**
301
-	 * returns the question ID which the answers belong to
302
-	 *
303
-	 * @author Olivier Brouckaert
304
-	 * @return integer - the question ID
305
-	 */
306
-	public function selectQuestionId()
297
+        return $this->nbrAnswers;
298
+    }
299
+
300
+    /**
301
+     * returns the question ID which the answers belong to
302
+     *
303
+     * @author Olivier Brouckaert
304
+     * @return integer - the question ID
305
+     */
306
+    public function selectQuestionId()
307 307
     {
308
-		return $this->questionId;
309
-	}
310
-
311
-	/**
312
-	 * returns the question ID of the destination question
313
-	 *
314
-	 * @author Julio Montoya
315
-	 * @param integer $id
316
-	 * @return integer - the question ID
317
-	 */
318
-	public function selectDestination($id)
308
+        return $this->questionId;
309
+    }
310
+
311
+    /**
312
+     * returns the question ID of the destination question
313
+     *
314
+     * @author Julio Montoya
315
+     * @param integer $id
316
+     * @return integer - the question ID
317
+     */
318
+    public function selectDestination($id)
319 319
     {
320
-		return isset($this->destination[$id]) ? $this->destination[$id] : null;
321
-	}
320
+        return isset($this->destination[$id]) ? $this->destination[$id] : null;
321
+    }
322 322
 
323 323
     /**
324
-	 * returns the answer title
325
-	 *
326
-	 * @author Olivier Brouckaert
327
-	 * @param - integer $id - answer ID
328
-	 * @return string - answer title
329
-	 */
330
-	public function selectAnswer($id)
331
-	{
332
-		return isset($this->answer[$id]) ? $this->answer[$id] : null;
333
-	}
334
-
335
-	/**
336
-	 * return array answer by id else return a bool
337
-	 * @param integer $auto_id
338
-	 */
339
-	public function selectAnswerByAutoId($auto_id)
340
-	{
341
-		$TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
342
-
343
-		$auto_id = intval($auto_id);
344
-		$sql = "SELECT id, answer, id_auto FROM $TBL_ANSWER
324
+     * returns the answer title
325
+     *
326
+     * @author Olivier Brouckaert
327
+     * @param - integer $id - answer ID
328
+     * @return string - answer title
329
+     */
330
+    public function selectAnswer($id)
331
+    {
332
+        return isset($this->answer[$id]) ? $this->answer[$id] : null;
333
+    }
334
+
335
+    /**
336
+     * return array answer by id else return a bool
337
+     * @param integer $auto_id
338
+     */
339
+    public function selectAnswerByAutoId($auto_id)
340
+    {
341
+        $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
342
+
343
+        $auto_id = intval($auto_id);
344
+        $sql = "SELECT id, answer, id_auto FROM $TBL_ANSWER
345 345
 				WHERE c_id = {$this->course_id} AND id_auto='$auto_id'";
346
-		$rs = Database::query($sql);
346
+        $rs = Database::query($sql);
347 347
 
348
-		if (Database::num_rows($rs) > 0) {
349
-			$row = Database::fetch_array($rs, 'ASSOC');
348
+        if (Database::num_rows($rs) > 0) {
349
+            $row = Database::fetch_array($rs, 'ASSOC');
350 350
 
351
-			return $row;
352
-		}
351
+            return $row;
352
+        }
353 353
 
354
-		return false;
355
-	}
354
+        return false;
355
+    }
356 356
 
357 357
     /**
358 358
      * returns the answer title from an answer's position
@@ -361,18 +361,18 @@  discard block
 block discarded – undo
361 361
      * @param - integer $id - answer ID
362 362
      * @return bool - answer title
363 363
      */
364
-	public function selectAnswerIdByPosition($pos)
365
-	{
366
-		foreach ($this->position as $k => $v) {
367
-			if ($v != $pos) {
368
-				continue;
369
-			}
364
+    public function selectAnswerIdByPosition($pos)
365
+    {
366
+        foreach ($this->position as $k => $v) {
367
+            if ($v != $pos) {
368
+                continue;
369
+            }
370 370
 
371
-			return $k;
372
-		}
371
+            return $k;
372
+        }
373 373
 
374
-		return false;
375
-	}
374
+        return false;
375
+    }
376 376
 
377 377
     /**
378 378
      * Returns a list of answers
@@ -381,18 +381,18 @@  discard block
 block discarded – undo
381 381
      * of (id, answer, comment, grade) and grade=weighting
382 382
      */
383 383
     public function getAnswersList($decode = false)
384
-     {
385
-	 	$list = array();
386
-         for ($i = 1; $i <= $this->nbrAnswers; $i++) {
387
-             if (!empty($this->answer[$i])) {
388
-
389
-	 			//Avoid problems when parsing elements with accents
390
-	 			if ($decode) {
391
-	        		$this->answer[$i] 	= api_html_entity_decode($this->answer[$i], ENT_QUOTES, api_get_system_encoding());
392
-	        		$this->comment[$i]	= api_html_entity_decode($this->comment[$i], ENT_QUOTES, api_get_system_encoding());
393
-	 			}
394
-
395
-	 			$list[] = array(
384
+        {
385
+            $list = array();
386
+            for ($i = 1; $i <= $this->nbrAnswers; $i++) {
387
+                if (!empty($this->answer[$i])) {
388
+
389
+                    //Avoid problems when parsing elements with accents
390
+                    if ($decode) {
391
+                    $this->answer[$i] 	= api_html_entity_decode($this->answer[$i], ENT_QUOTES, api_get_system_encoding());
392
+                    $this->comment[$i]	= api_html_entity_decode($this->comment[$i], ENT_QUOTES, api_get_system_encoding());
393
+                    }
394
+
395
+                    $list[] = array(
396 396
                     'id' => $i,
397 397
                     'answer' => $this->answer[$i],
398 398
                     'comment' => $this->comment[$i],
@@ -401,137 +401,137 @@  discard block
 block discarded – undo
401 401
                     'hotspot_type' => $this->hotspot_type[$i],
402 402
                     'correct' => $this->correct[$i],
403 403
                     'destination' => $this->destination[$i]
404
-				);
404
+                );
405
+            }
405 406
             }
406
-	 	}
407 407
 
408
-	 	return $list;
409
-	 }
408
+            return $list;
409
+        }
410 410
 
411
-	/**
412
-	 * Returns a list of grades
413
-	 * @author Yannick Warnier <[email protected]>
414
-	 * @return array	List of grades where grade=weighting (?)
415
-	 */
411
+    /**
412
+     * Returns a list of grades
413
+     * @author Yannick Warnier <[email protected]>
414
+     * @return array	List of grades where grade=weighting (?)
415
+     */
416 416
     public function getGradesList()
417
-     {
418
-	 	$list = array();
419
-	 	for ($i = 0; $i<$this->nbrAnswers;$i++){
420
-	 		if(!empty($this->answer[$i])){
421
-	 			$list[$i] = $this->weighting[$i];
422
-	 		}
423
-	 	}
424
-	 	return $list;
425
-	 }
426
-
427
-	 /**
428
-	  * Returns the question type
429
-	  * @author	Yannick Warnier <[email protected]>
430
-	  * @return	integer	The type of the question this answer is bound to
431
-	  */
417
+        {
418
+            $list = array();
419
+            for ($i = 0; $i<$this->nbrAnswers;$i++){
420
+                if(!empty($this->answer[$i])){
421
+                    $list[$i] = $this->weighting[$i];
422
+                }
423
+            }
424
+            return $list;
425
+        }
426
+
427
+        /**
428
+         * Returns the question type
429
+         * @author	Yannick Warnier <[email protected]>
430
+         * @return	integer	The type of the question this answer is bound to
431
+         */
432 432
     public function getQuestionType()
433
-     {
434
-	 	$TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION);
435
-	 	$sql = "SELECT type FROM $TBL_QUESTIONS
433
+        {
434
+            $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION);
435
+            $sql = "SELECT type FROM $TBL_QUESTIONS
436 436
 	 	        WHERE c_id = {$this->course_id} AND id = '".$this->questionId."'";
437
-	 	$res = Database::query($sql);
438
-	 	if (Database::num_rows($res)<=0){
439
-	 		return null;
440
-	 	}
441
-	 	$row = Database::fetch_array($res);
442
-
443
-	 	return $row['type'];
444
-	 }
445
-
446
-
447
-	/**
448
-	 * tells if answer is correct or not
449
-	 *
450
-	 * @author Olivier Brouckaert
451
-	 * @param - integer $id - answer ID
452
-	 * @return integer - 0 if bad answer, not 0 if good answer
453
-	 */
437
+            $res = Database::query($sql);
438
+            if (Database::num_rows($res)<=0){
439
+                return null;
440
+            }
441
+            $row = Database::fetch_array($res);
442
+
443
+            return $row['type'];
444
+        }
445
+
446
+
447
+    /**
448
+     * tells if answer is correct or not
449
+     *
450
+     * @author Olivier Brouckaert
451
+     * @param - integer $id - answer ID
452
+     * @return integer - 0 if bad answer, not 0 if good answer
453
+     */
454 454
     public function isCorrect($id)
455
-	{
456
-		return isset($this->correct[$id]) ? $this->correct[$id] : null;
457
-	}
458
-
459
-	/**
460
-	 * returns answer comment
461
-	 *
462
-	 * @author Olivier Brouckaert
463
-	 * @param - integer $id - answer ID
464
-	 * @return string - answer comment
465
-	 */
455
+    {
456
+        return isset($this->correct[$id]) ? $this->correct[$id] : null;
457
+    }
458
+
459
+    /**
460
+     * returns answer comment
461
+     *
462
+     * @author Olivier Brouckaert
463
+     * @param - integer $id - answer ID
464
+     * @return string - answer comment
465
+     */
466 466
     public function selectComment($id)
467
-	{
467
+    {
468 468
         return isset($this->comment[$id]) ? $this->comment[$id] : null;
469
-	}
470
-
471
-	/**
472
-	 * returns answer weighting
473
-	 *
474
-	 * @author Olivier Brouckaert
475
-	 * @param - integer $id - answer ID
476
-	 * @param integer $id
477
-	 * @return integer - answer weighting
478
-	 */
469
+    }
470
+
471
+    /**
472
+     * returns answer weighting
473
+     *
474
+     * @author Olivier Brouckaert
475
+     * @param - integer $id - answer ID
476
+     * @param integer $id
477
+     * @return integer - answer weighting
478
+     */
479 479
     public function selectWeighting($id)
480
-	{
481
-		return isset($this->weighting[$id]) ? $this->weighting[$id] : null;
482
-	}
483
-
484
-	/**
485
-	 * returns answer position
486
-	 *
487
-	 * @author Olivier Brouckaert
488
-	 * @param - integer $id - answer ID
489
-	 * @return integer - answer position
490
-	 */
491
-	function selectPosition($id)
492
-	{
493
-		return isset($this->position[$id]) ? $this->position[$id] : null;
494
-	}
495
-
496
-	/**
497
-	 * returns answer hotspot coordinates
498
-	 *
499
-	 * @author	Olivier Brouckaert
500
-	 * @param	integer	Answer ID
501
-	 * @param integer $id
502
-	 * @return	integer	Answer position
503
-	 */
480
+    {
481
+        return isset($this->weighting[$id]) ? $this->weighting[$id] : null;
482
+    }
483
+
484
+    /**
485
+     * returns answer position
486
+     *
487
+     * @author Olivier Brouckaert
488
+     * @param - integer $id - answer ID
489
+     * @return integer - answer position
490
+     */
491
+    function selectPosition($id)
492
+    {
493
+        return isset($this->position[$id]) ? $this->position[$id] : null;
494
+    }
495
+
496
+    /**
497
+     * returns answer hotspot coordinates
498
+     *
499
+     * @author	Olivier Brouckaert
500
+     * @param	integer	Answer ID
501
+     * @param integer $id
502
+     * @return	integer	Answer position
503
+     */
504 504
     public function selectHotspotCoordinates($id)
505
-	{
506
-		return isset($this->hotspot_coordinates[$id]) ? $this->hotspot_coordinates[$id] : null;
507
-	}
508
-
509
-	/**
510
-	 * returns answer hotspot type
511
-	 *
512
-	 * @author	Toon Keppens
513
-	 * @param	integer		Answer ID
514
-	 * @param integer $id
515
-	 * @return	integer		Answer position
516
-	 */
505
+    {
506
+        return isset($this->hotspot_coordinates[$id]) ? $this->hotspot_coordinates[$id] : null;
507
+    }
508
+
509
+    /**
510
+     * returns answer hotspot type
511
+     *
512
+     * @author	Toon Keppens
513
+     * @param	integer		Answer ID
514
+     * @param integer $id
515
+     * @return	integer		Answer position
516
+     */
517 517
     public function selectHotspotType($id)
518
-	{
519
-		return isset($this->hotspot_type[$id]) ? $this->hotspot_type[$id] : null;
520
-	}
521
-
522
-	/**
523
-	 * Creates a new answer
524
-	 *
525
-	 * @author Olivier Brouckaert
526
-	 * @param string 	$answer answer title
527
-	 * @param integer 	$correct 0 if bad answer, not 0 if good answer
528
-	 * @param string 	$comment answer comment
529
-	 * @param integer 	$weighting answer weighting
530
-	 * @param integer 	$position answer position
531
-	 * @param array    $new_hotspot_coordinates Coordinates for hotspot exercises (optional)
532
-	 * @param integer	$new_hotspot_type Type for hotspot exercises (optional)
518
+    {
519
+        return isset($this->hotspot_type[$id]) ? $this->hotspot_type[$id] : null;
520
+    }
521
+
522
+    /**
523
+     * Creates a new answer
524
+     *
525
+     * @author Olivier Brouckaert
526
+     * @param string 	$answer answer title
527
+     * @param integer 	$correct 0 if bad answer, not 0 if good answer
528
+     * @param string 	$comment answer comment
529
+     * @param integer 	$weighting answer weighting
530
+     * @param integer 	$position answer position
531
+     * @param array    $new_hotspot_coordinates Coordinates for hotspot exercises (optional)
532
+     * @param integer	$new_hotspot_type Type for hotspot exercises (optional)
533 533
      * @param string   $destination
534
-	 */
534
+     */
535 535
     public function createAnswer(
536 536
         $answer,
537 537
         $correct,
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
         $new_hotspot_type = null,
543 543
         $destination = ''
544 544
     ) {
545
-		$this->new_nbrAnswers++;
545
+        $this->new_nbrAnswers++;
546 546
         $id = $this->new_nbrAnswers;
547 547
         $this->new_answer[$id] = $answer;
548 548
         $this->new_correct[$id] = $correct;
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
         $this->new_hotspot_coordinates[$id] = $new_hotspot_coordinates;
553 553
         $this->new_hotspot_type[$id] = $new_hotspot_type;
554 554
         $this->new_destination[$id] = $destination;
555
-	}
555
+    }
556 556
 
557 557
     /**
558 558
      * Updates an answer
@@ -595,32 +595,32 @@  discard block
 block discarded – undo
595 595
 
596 596
         $em->merge($quizAnswer);
597 597
         $em->flush();
598
-	}
598
+    }
599 599
 
600
-	/**
601
-	 * Records answers into the data base
602
-	 *
603
-	 * @author Olivier Brouckaert
604
-	 */
600
+    /**
601
+     * Records answers into the data base
602
+     *
603
+     * @author Olivier Brouckaert
604
+     */
605 605
     public function save()
606 606
     {
607
-		$answerTable = Database::get_course_table(TABLE_QUIZ_ANSWER);
607
+        $answerTable = Database::get_course_table(TABLE_QUIZ_ANSWER);
608 608
         $em = Database::getManager();
609
-		$questionId = intval($this->questionId);
609
+        $questionId = intval($this->questionId);
610 610
 
611
-		$c_id = $this->course['real_id'];
611
+        $c_id = $this->course['real_id'];
612 612
         $correctList = [];
613 613
         $answerList = [];
614 614
 
615
-		for ($i=1; $i <= $this->new_nbrAnswers; $i++) {
616
-			$answer = $this->new_answer[$i];
617
-			$correct = isset($this->new_correct[$i]) ? $this->new_correct[$i] : '';
618
-			$comment = isset($this->new_comment[$i]) ? $this->new_comment[$i] : '';
619
-			$weighting = isset($this->new_weighting[$i]) ? $this->new_weighting[$i] : '';
620
-			$position = isset($this->new_position[$i]) ? $this->new_position[$i] : '';
621
-			$hotspot_coordinates = isset($this->new_hotspot_coordinates[$i]) ? $this->new_hotspot_coordinates[$i] : '';
622
-			$hotspot_type = isset($this->new_hotspot_type[$i]) ? $this->new_hotspot_type[$i] : '';
623
-			$destination = isset($this->new_destination[$i]) ? $this->new_destination[$i] : '';
615
+        for ($i=1; $i <= $this->new_nbrAnswers; $i++) {
616
+            $answer = $this->new_answer[$i];
617
+            $correct = isset($this->new_correct[$i]) ? $this->new_correct[$i] : '';
618
+            $comment = isset($this->new_comment[$i]) ? $this->new_comment[$i] : '';
619
+            $weighting = isset($this->new_weighting[$i]) ? $this->new_weighting[$i] : '';
620
+            $position = isset($this->new_position[$i]) ? $this->new_position[$i] : '';
621
+            $hotspot_coordinates = isset($this->new_hotspot_coordinates[$i]) ? $this->new_hotspot_coordinates[$i] : '';
622
+            $hotspot_type = isset($this->new_hotspot_type[$i]) ? $this->new_hotspot_type[$i] : '';
623
+            $destination = isset($this->new_destination[$i]) ? $this->new_destination[$i] : '';
624 624
             $autoId = $this->selectAutoId($i);
625 625
             $iid = isset($this->iid[$i]) ? $this->iid[$i] : 0;
626 626
 
@@ -663,11 +663,11 @@  discard block
 block discarded – undo
663 663
 
664 664
                         $correctAnswerId = $answer->selectAnswerIdByPosition($correct);
665 665
 
666
-						// Continue to avoid matching question bug if $correctAnswerId returns false
667
-						// See : https://support.chamilo.org/issues/8334
668
-						if ($questionType == MATCHING && !$correctAnswerId) {
669
-							continue;
670
-						}
666
+                        // Continue to avoid matching question bug if $correctAnswerId returns false
667
+                        // See : https://support.chamilo.org/issues/8334
668
+                        if ($questionType == MATCHING && !$correctAnswerId) {
669
+                            continue;
670
+                        }
671 671
 
672 672
                         $correctAnswerAutoId = $answer->selectAutoId($correct);
673 673
 
@@ -734,28 +734,28 @@  discard block
 block discarded – undo
734 734
             }
735 735
         }
736 736
 
737
-		// moves $new_* arrays
738
-		$this->answer = $this->new_answer;
739
-		$this->correct = $this->new_correct;
740
-		$this->comment = $this->new_comment;
741
-		$this->weighting = $this->new_weighting;
742
-		$this->position = $this->new_position;
743
-		$this->hotspot_coordinates = $this->new_hotspot_coordinates;
744
-		$this->hotspot_type = $this->new_hotspot_type;
745
-		$this->nbrAnswers = $this->new_nbrAnswers;
746
-		$this->destination = $this->new_destination;
747
-
748
-		$this->cancel();
749
-	}
750
-
751
-	/**
752
-	 * Duplicates answers by copying them into another question
753
-	 *
754
-	 * @author Olivier Brouckaert
755
-	 * @param  int question id
737
+        // moves $new_* arrays
738
+        $this->answer = $this->new_answer;
739
+        $this->correct = $this->new_correct;
740
+        $this->comment = $this->new_comment;
741
+        $this->weighting = $this->new_weighting;
742
+        $this->position = $this->new_position;
743
+        $this->hotspot_coordinates = $this->new_hotspot_coordinates;
744
+        $this->hotspot_type = $this->new_hotspot_type;
745
+        $this->nbrAnswers = $this->new_nbrAnswers;
746
+        $this->destination = $this->new_destination;
747
+
748
+        $this->cancel();
749
+    }
750
+
751
+    /**
752
+     * Duplicates answers by copying them into another question
753
+     *
754
+     * @author Olivier Brouckaert
755
+     * @param  int question id
756 756
      * @param  array destination course info (result of the function api_get_course_info() )
757 757
      * @param string $newQuestionId
758
-	 */
758
+     */
759 759
     public function duplicate($newQuestionId, $course_info = null)
760 760
     {
761 761
         if (empty($course_info)) {
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 
776 776
             if (!empty($origin_options)) {
777 777
                 foreach ($origin_options as $item) {
778
-            	   $new_option_list[] = $item['id'];
778
+                    $new_option_list[] = $item['id'];
779 779
                 }
780 780
             }
781 781
 
@@ -789,12 +789,12 @@  discard block
 block discarded – undo
789 789
             }
790 790
         }
791 791
 
792
-		// if at least one answer
793
-		if ($this->nbrAnswers) {
794
-			// inserts new answers into data base
795
-			$c_id = $course_info['real_id'];
792
+        // if at least one answer
793
+        if ($this->nbrAnswers) {
794
+            // inserts new answers into data base
795
+            $c_id = $course_info['real_id'];
796 796
 
797
-			for ($i=1;$i <= $this->nbrAnswers;$i++) {
797
+            for ($i=1;$i <= $this->nbrAnswers;$i++) {
798 798
                 if ($this->course['id'] != $course_info['id']) {
799 799
                     $this->answer[$i] = DocumentManager::replace_urls_inside_content_html_from_copy_course(
800 800
                         $this->answer[$i],
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
                     );
809 809
                 }
810 810
 
811
-				$correct = $this->correct[$i];
811
+                $correct = $this->correct[$i];
812 812
 
813 813
                 if (self::getQuestionType() == MULTIPLE_ANSWER_TRUE_FALSE ||
814 814
                     self::getQuestionType() == MULTIPLE_ANSWER_TRUE_FALSE
@@ -840,9 +840,9 @@  discard block
 block discarded – undo
840 840
 
841 841
                 $em->merge($quizAnswer);
842 842
                 $em->flush();
843
-			}
843
+            }
844 844
         }
845
-	}
845
+    }
846 846
 
847 847
     /**
848 848
      * Get the necessary JavaScript for some answers
@@ -860,25 +860,25 @@  discard block
 block discarded – undo
860 860
             </script>";
861 861
     }
862 862
 
863
-	/**
864
-	 * Check if a answer is correct by an answer auto id
865
-	 * @param $needle int The answer auto id
866
-	 * @return bool
867
-	 */
868
-	public function isCorrectByAutoId($needle)
869
-	{
870
-		$key = 0;
871
-
872
-		foreach ($this->autoId as $autoIdKey => $autoId) {
873
-			if ($autoId == $needle) {
874
-				$key = $autoIdKey;
875
-			}
876
-		}
877
-
878
-		if (!$key) {
879
-			return false;
880
-		}
881
-
882
-		return $this->isCorrect($key) ? true : false;
883
-	}
863
+    /**
864
+     * Check if a answer is correct by an answer auto id
865
+     * @param $needle int The answer auto id
866
+     * @return bool
867
+     */
868
+    public function isCorrectByAutoId($needle)
869
+    {
870
+        $key = 0;
871
+
872
+        foreach ($this->autoId as $autoIdKey => $autoId) {
873
+            if ($autoId == $needle) {
874
+                $key = $autoIdKey;
875
+            }
876
+        }
877
+
878
+        if (!$key) {
879
+            return false;
880
+        }
881
+
882
+        return $this->isCorrect($key) ? true : false;
883
+    }
884 884
 }
Please login to merge, or discard this patch.
main/ticket/status.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@
 block discarded – undo
101 101
         "categories.php?action=delete&id={$row['id']}"
102 102
     );
103 103
 
104
-	return $result;
104
+    return $result;
105 105
 }
106 106
 
107 107
 Display::display_header($plugin->get_lang('MyTickets'));
Please login to merge, or discard this patch.
main/ticket/priorities.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@
 block discarded – undo
101 101
         "categories.php?action=delete&id={$row['id']}"
102 102
     );
103 103
 
104
-	return $result;
104
+    return $result;
105 105
 }
106 106
 
107 107
 Display::display_header($plugin->get_lang('MyTickets'));
Please login to merge, or discard this patch.
main/exercise/TestCategory.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
     public $name;
16 16
     public $description;
17 17
 
18
-	/**
19
-	 * Constructor of the class Category
18
+    /**
19
+     * Constructor of the class Category
20 20
      */
21 21
     public function __construct()
22 22
     {
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
         return  false;
50 50
     }
51 51
 
52
-	/**
52
+    /**
53 53
      * add TestCategory in the database if name doesn't already exists
54
-	 */
54
+     */
55 55
     public function addCategoryInBDD()
56 56
     {
57 57
         $table = Database :: get_course_table(TABLE_QUIZ_QUESTION_CATEGORY);
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         $category = $this->getCategory($id);
111 111
 
112 112
         if ($category) {
113
-           $sql = "DELETE FROM $table
113
+            $sql = "DELETE FROM $table
114 114
                    WHERE id= $id AND c_id=".$course_id;
115 115
             Database::query($sql);
116 116
 
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
         }
133 133
 
134 134
         return false;
135
-	}
135
+    }
136 136
 
137
-	/**
137
+    /**
138 138
      * Modify category name or description of category with id=in_id
139
-	 */
139
+     */
140 140
     public function modifyCategory()
141 141
     {
142 142
         $table = Database :: get_course_table(TABLE_QUIZ_QUESTION_CATEGORY);
@@ -167,30 +167,30 @@  discard block
 block discarded – undo
167 167
         }
168 168
 
169 169
         return false;
170
-	}
170
+    }
171 171
 
172
-	/**
172
+    /**
173 173
      * Gets the number of question of category id=in_id
174
-	 */
174
+     */
175 175
     public function getCategoryQuestionsNumber()
176 176
     {
177
-		$table = Database::get_course_table(TABLE_QUIZ_QUESTION_REL_CATEGORY);
178
-		$in_id = intval($this->id);
179
-		$sql = "SELECT count(*) AS nb
177
+        $table = Database::get_course_table(TABLE_QUIZ_QUESTION_REL_CATEGORY);
178
+        $in_id = intval($this->id);
179
+        $sql = "SELECT count(*) AS nb
180 180
 		        FROM $table
181 181
 		        WHERE category_id=$in_id AND c_id=".api_get_course_int_id();
182
-		$res = Database::query($sql);
183
-		$row = Database::fetch_array($res);
182
+        $res = Database::query($sql);
183
+        $row = Database::fetch_array($res);
184 184
 
185
-		return $row['nb'];
186
-	}
185
+        return $row['nb'];
186
+    }
187 187
 
188
-	/**
188
+    /**
189 189
      * Return an array of all Category objects in the database
190
-	 * If in_field=="" Return an array of all category objects in the database
191
-	 * Otherwise, return an array of all in_field value
192
-	 * in the database (in_field = id or name or description)
193
-	 *
190
+     * If in_field=="" Return an array of all category objects in the database
191
+     * Otherwise, return an array of all in_field value
192
+     * in the database (in_field = id or name or description)
193
+     *
194 194
      * @param string $in_field
195 195
      * @param int $courseId
196 196
      * @return array
@@ -493,10 +493,10 @@  discard block
 block discarded – undo
493 493
      * @param int exercise
494 494
      * @param array $check_in_question_list
495 495
      * @param array $categoriesAddedInExercise
496
-    *
497
-    * @param int $exerciseId
498
-    * @return array
499
-    */
496
+     *
497
+     * @param int $exerciseId
498
+     * @return array
499
+     */
500 500
     static function getQuestionsByCat(
501 501
         $exerciseId,
502 502
         $check_in_question_list = array(),
@@ -622,9 +622,9 @@  discard block
 block discarded – undo
622 622
     }
623 623
 
624 624
     /**
625
-    * Display signs [+] and/or (>0) after question title if question has options
626
-    * scoreAlwaysPositive and/or uncheckedMayScore
627
-    */
625
+     * Display signs [+] and/or (>0) after question title if question has options
626
+     * scoreAlwaysPositive and/or uncheckedMayScore
627
+     */
628 628
     public function displayQuestionOption($in_objQuestion)
629 629
     {
630 630
         if ($in_objQuestion->type == MULTIPLE_ANSWER && $in_objQuestion->scoreAlwaysPositive) {
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
      * key of $tabCategoryQuestions are the category id (0 for not in a category)
641 641
      * value is the array of question id of this category
642 642
      * Sort question by Category
643
-    */
643
+     */
644 644
     public static function sortTabByBracketLabel($in_tab)
645 645
     {
646 646
         $tabResult = array();
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
      * count the number of questions in all categories, and return the max
694 694
      * @param int $exerciseId
695 695
      * @author - hubert borderiou
696
-    */
696
+     */
697 697
     public static function getNumberMaxQuestionByCat($exerciseId)
698 698
     {
699 699
         $res_num_max = 0;
Please login to merge, or discard this patch.
main/gradebook/lib/fe/dataform.class.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,19 +8,19 @@
 block discarded – undo
8 8
  */
9 9
 class DataForm extends FormValidator
10 10
 {
11
-	const TYPE_IMPORT = 1;
12
-	const TYPE_EXPORT = 2;
13
-	const TYPE_EXPORT_PDF = 3;
11
+    const TYPE_IMPORT = 1;
12
+    const TYPE_EXPORT = 2;
13
+    const TYPE_EXPORT_PDF = 3;
14 14
 
15
-	/**
16
-	 * Builds a form containing form items based on a given parameter
17
-	 * @param int form_type 1=import, 2=export
18
-	 * @param obj cat_obj the category object
19
-	 * @param obj res_obj the result object
20
-	 * @param string form name
21
-	 * @param method
22
-	 * @param action
23
-	 */
15
+    /**
16
+     * Builds a form containing form items based on a given parameter
17
+     * @param int form_type 1=import, 2=export
18
+     * @param obj cat_obj the category object
19
+     * @param obj res_obj the result object
20
+     * @param string form name
21
+     * @param method
22
+     * @param action
23
+     */
24 24
     public function __construct($form_type, $form_name, $method = 'post', $action = null, $target = '', $locked_status)
25 25
     {
26 26
         parent:: __construct($form_name, $method, $action, $target);
Please login to merge, or discard this patch.
main/exercise/result.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
     $htmlHeadXtra[] = '<style>
71 71
         body { background: none;}
72 72
     </style>';
73
-	Display::display_reduced_header();
73
+    Display::display_reduced_header();
74 74
 }
75 75
 
76 76
 $message = Session::read('attempt_remaining');
Please login to merge, or discard this patch.
main/exercise/export/scorm/scorm_classes.php 1 patch
Indentation   +773 added lines, -773 removed lines patch added patch discarded remove patch
@@ -20,140 +20,140 @@  discard block
 block discarded – undo
20 20
 {
21 21
     public $js_id;
22 22
     public $answer;
23
-	/**
24
-	 * Returns the HTML + JS flow corresponding to one question
25
-	 *
26
-	 * @param int $questionId The question ID
27
-	 * @param bool $standalone (ie including XML tag, DTD declaration, etc)
28
-	 * @param int  $js_id The JavaScript ID for this question.
29
-	 * Due to the nature of interactions, we must have a natural sequence for
30
-	 * questions in the generated JavaScript.
31
-	 * @param integer $js_id
23
+    /**
24
+     * Returns the HTML + JS flow corresponding to one question
25
+     *
26
+     * @param int $questionId The question ID
27
+     * @param bool $standalone (ie including XML tag, DTD declaration, etc)
28
+     * @param int  $js_id The JavaScript ID for this question.
29
+     * Due to the nature of interactions, we must have a natural sequence for
30
+     * questions in the generated JavaScript.
31
+     * @param integer $js_id
32 32
      * @return string|array
33
-	 */
34
-	public static function export_question($questionId, $standalone = true, $js_id)
35
-	{
36
-		$question = new ScormQuestion();
37
-		$qst = $question->read($questionId);
38
-		if (!$qst) {
39
-			return '';
40
-		}
41
-		$question->id = $qst->id;
42
-		$question->js_id = $js_id;
43
-		$question->type = $qst->type;
44
-		$question->question = $qst->question;
45
-		$question->description = $qst->description;
46
-		$question->weighting=$qst->weighting;
47
-		$question->position=$qst->position;
48
-		$question->picture=$qst->picture;
49
-		$assessmentItem = new ScormAssessmentItem($question, $standalone);
50
-
51
-		return $assessmentItem->export();
52
-	}
53
-
54
-	/**
55
-	 * Include the correct answer class and create answer
56
-	 */
57
-	public function setAnswer()
58
-	{
59
-		switch ($this->type) {
60
-			case MCUA:
61
-				$this->answer = new ScormAnswerMultipleChoice($this->id);
62
-				$this->answer->questionJSId = $this->js_id;
63
-				break;
64
-			case MCMA:
65
-			case GLOBAL_MULTIPLE_ANSWER:
66
-				$this->answer = new ScormAnswerMultipleChoice($this->id);
67
-				$this->answer->questionJSId = $this->js_id;
68
-				break;
69
-			case TF:
70
-				$this->answer = new ScormAnswerTrueFalse($this->id);
71
-				$this->answer->questionJSId = $this->js_id;
72
-				break;
73
-			case FIB:
74
-				$this->answer = new ScormAnswerFillInBlanks($this->id);
75
-				$this->answer->questionJSId = $this->js_id;
76
-				break;
77
-			case MATCHING:
78
-			case MATCHING_DRAGGABLE:
79
-			case DRAGGABLE:
80
-				$this->answer = new ScormAnswerMatching($this->id);
81
-				$this->answer->questionJSId = $this->js_id;
82
-				break;
83
-			case ORAL_EXPRESSION:
84
-			case FREE_ANSWER:
85
-				$this->answer = new ScormAnswerFree($this->id);
86
-				$this->answer->questionJSId = $this->js_id;
87
-				break;
88
-			case HOT_SPOT:
89
-				$this->answer = new ScormAnswerHotspot($this->id);
90
-				$this->answer->questionJSId = $this->js_id;
91
-				break;
92
-			case MULTIPLE_ANSWER_COMBINATION:
93
-				$this->answer = new ScormAnswerMultipleChoice($this->id);
94
-				$this->answer->questionJSId = $this->js_id;
95
-				break;
96
-			case HOT_SPOT_ORDER:
97
-				$this->answer = new ScormAnswerHotspot($this->id);
98
-				$this->answer->questionJSId = $this->js_id;
99
-				break;
100
-			case HOT_SPOT_DELINEATION:
101
-				$this->answer = new ScormAnswerHotspot($this->id);
102
-				$this->answer->questionJSId = $this->js_id;
103
-				break;
104
-			// not supported
105
-			case UNIQUE_ANSWER_NO_OPTION:
106
-			case MULTIPLE_ANSWER_TRUE_FALSE:
107
-			case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE:
108
-			case UNIQUE_ANSWER_IMAGE:
109
-			case CALCULATED_ANSWER:
110
-				$this->answer = new ScormAnswerMultipleChoice($this->id);
111
-				$this->answer->questionJSId = $this->js_id;
112
-				break;
113
-			default:
114
-				$this->answer = new stdClass();
115
-				$this->answer->questionJSId = $this->js_id;
116
-				break;
117
-		}
118
-
119
-		return true;
120
-	}
121
-
122
-	function export()
123
-	{
124
-		$html = $this->getQuestionHTML();
125
-		$js = $this->getQuestionJS();
126
-
127
-		if (is_object($this->answer) && $this->answer instanceof Answer) {
128
-			list($js2, $html2) = $this->answer->export();
129
-			$js .= $js2;
130
-			$html .= $html2;
131
-		} else {
132
-			throw new \Exception('Question not supported. Exercise: '.$this->selectTitle());
133
-		}
134
-
135
-		return array($js, $html);
136
-	}
137
-
138
-	function createAnswersForm($form)
139
-	{
140
-		return true;
141
-	}
142
-
143
-	function processAnswersCreation($form)
144
-	{
145
-		return true;
146
-	}
147
-
148
-	/**
149
-	 * Returns an HTML-formatted question
150
-	 */
151
-	function getQuestionHTML()
152
-	{
33
+     */
34
+    public static function export_question($questionId, $standalone = true, $js_id)
35
+    {
36
+        $question = new ScormQuestion();
37
+        $qst = $question->read($questionId);
38
+        if (!$qst) {
39
+            return '';
40
+        }
41
+        $question->id = $qst->id;
42
+        $question->js_id = $js_id;
43
+        $question->type = $qst->type;
44
+        $question->question = $qst->question;
45
+        $question->description = $qst->description;
46
+        $question->weighting=$qst->weighting;
47
+        $question->position=$qst->position;
48
+        $question->picture=$qst->picture;
49
+        $assessmentItem = new ScormAssessmentItem($question, $standalone);
50
+
51
+        return $assessmentItem->export();
52
+    }
53
+
54
+    /**
55
+     * Include the correct answer class and create answer
56
+     */
57
+    public function setAnswer()
58
+    {
59
+        switch ($this->type) {
60
+            case MCUA:
61
+                $this->answer = new ScormAnswerMultipleChoice($this->id);
62
+                $this->answer->questionJSId = $this->js_id;
63
+                break;
64
+            case MCMA:
65
+            case GLOBAL_MULTIPLE_ANSWER:
66
+                $this->answer = new ScormAnswerMultipleChoice($this->id);
67
+                $this->answer->questionJSId = $this->js_id;
68
+                break;
69
+            case TF:
70
+                $this->answer = new ScormAnswerTrueFalse($this->id);
71
+                $this->answer->questionJSId = $this->js_id;
72
+                break;
73
+            case FIB:
74
+                $this->answer = new ScormAnswerFillInBlanks($this->id);
75
+                $this->answer->questionJSId = $this->js_id;
76
+                break;
77
+            case MATCHING:
78
+            case MATCHING_DRAGGABLE:
79
+            case DRAGGABLE:
80
+                $this->answer = new ScormAnswerMatching($this->id);
81
+                $this->answer->questionJSId = $this->js_id;
82
+                break;
83
+            case ORAL_EXPRESSION:
84
+            case FREE_ANSWER:
85
+                $this->answer = new ScormAnswerFree($this->id);
86
+                $this->answer->questionJSId = $this->js_id;
87
+                break;
88
+            case HOT_SPOT:
89
+                $this->answer = new ScormAnswerHotspot($this->id);
90
+                $this->answer->questionJSId = $this->js_id;
91
+                break;
92
+            case MULTIPLE_ANSWER_COMBINATION:
93
+                $this->answer = new ScormAnswerMultipleChoice($this->id);
94
+                $this->answer->questionJSId = $this->js_id;
95
+                break;
96
+            case HOT_SPOT_ORDER:
97
+                $this->answer = new ScormAnswerHotspot($this->id);
98
+                $this->answer->questionJSId = $this->js_id;
99
+                break;
100
+            case HOT_SPOT_DELINEATION:
101
+                $this->answer = new ScormAnswerHotspot($this->id);
102
+                $this->answer->questionJSId = $this->js_id;
103
+                break;
104
+            // not supported
105
+            case UNIQUE_ANSWER_NO_OPTION:
106
+            case MULTIPLE_ANSWER_TRUE_FALSE:
107
+            case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE:
108
+            case UNIQUE_ANSWER_IMAGE:
109
+            case CALCULATED_ANSWER:
110
+                $this->answer = new ScormAnswerMultipleChoice($this->id);
111
+                $this->answer->questionJSId = $this->js_id;
112
+                break;
113
+            default:
114
+                $this->answer = new stdClass();
115
+                $this->answer->questionJSId = $this->js_id;
116
+                break;
117
+        }
118
+
119
+        return true;
120
+    }
121
+
122
+    function export()
123
+    {
124
+        $html = $this->getQuestionHTML();
125
+        $js = $this->getQuestionJS();
126
+
127
+        if (is_object($this->answer) && $this->answer instanceof Answer) {
128
+            list($js2, $html2) = $this->answer->export();
129
+            $js .= $js2;
130
+            $html .= $html2;
131
+        } else {
132
+            throw new \Exception('Question not supported. Exercise: '.$this->selectTitle());
133
+        }
134
+
135
+        return array($js, $html);
136
+    }
137
+
138
+    function createAnswersForm($form)
139
+    {
140
+        return true;
141
+    }
142
+
143
+    function processAnswersCreation($form)
144
+    {
145
+        return true;
146
+    }
147
+
148
+    /**
149
+     * Returns an HTML-formatted question
150
+     */
151
+    function getQuestionHTML()
152
+    {
153 153
         $title = $this->selectTitle();
154 154
         $description = $this->selectDescription();
155
-		$cols = 2;
156
-		$s = '<tr>
155
+        $cols = 2;
156
+        $s = '<tr>
157 157
 			<td colspan="'.$cols.'" id="question_'.$this->id.'_title" valign="middle" style="background-color:#d6d6d6;">
158 158
 			'.$title.'
159 159
 			</td>
@@ -163,16 +163,16 @@  discard block
 block discarded – undo
163 163
 			<i>'.$description.'</i>
164 164
 			</td>
165 165
 			</tr>';
166
-		return $s;
167
-	}
166
+        return $s;
167
+    }
168 168
 
169
-	/**
170
-	 * Return the JavaScript code bound to the question
171
-	 */
172
-	public function getQuestionJS()
173
-	{
174
-		$weight = $this->selectWeighting();
175
-		$js = 'questions.push('.$this->js_id.');'."\n";
169
+    /**
170
+     * Return the JavaScript code bound to the question
171
+     */
172
+    public function getQuestionJS()
173
+    {
174
+        $weight = $this->selectWeighting();
175
+        $js = 'questions.push('.$this->js_id.');'."\n";
176 176
 
177 177
         switch ($this->type) {
178 178
             case ORAL_EXPRESSION:
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
                 $script .= file_get_contents(api_get_path(LIBRARY_PATH) . 'wami-recorder/gui.js');
182 182
                 $js .= $script;*/
183 183
                 break;
184
-           case HOT_SPOT:
184
+            case HOT_SPOT:
185 185
                 //put the max score to 0 to avoid discounting the points of
186 186
                 //non-exported quiz types in the SCORM
187 187
                 $weight = 0;
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
         }
190 190
         $js .= 'questions_score_max['.$this->js_id.'] = '.$weight.";";
191 191
 
192
-		return $js;
193
-	}
192
+        return $js;
193
+    }
194 194
 }
195 195
 
196 196
 /**
@@ -200,29 +200,29 @@  discard block
 block discarded – undo
200 200
  */
201 201
 class ScormAnswerMultipleChoice extends Answer
202 202
 {
203
-	/**
204
-	 * Return HTML code for possible answers
205
-	 */
206
-	function export()
207
-	{
208
-		$js = '';
209
-		$html = '<tr><td colspan="2"><table width="100%">';
210
-		$type = $this->getQuestionType();
211
-		$jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();';
212
-		$jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;';
203
+    /**
204
+     * Return HTML code for possible answers
205
+     */
206
+    function export()
207
+    {
208
+        $js = '';
209
+        $html = '<tr><td colspan="2"><table width="100%">';
210
+        $type = $this->getQuestionType();
211
+        $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();';
212
+        $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;';
213 213
 
214 214
         $jstmpw .= 'questions_answers_correct['.$this->questionJSId.'] = new Array();';
215 215
 
216
-		//not sure if we are going to export also the MULTIPLE_ANSWER_COMBINATION to SCORM
217
-		//if ($type == MCMA  || $type == MULTIPLE_ANSWER_COMBINATION ) {
218
-		if ($type == MCMA) {
216
+        //not sure if we are going to export also the MULTIPLE_ANSWER_COMBINATION to SCORM
217
+        //if ($type == MCMA  || $type == MULTIPLE_ANSWER_COMBINATION ) {
218
+        if ($type == MCMA) {
219 219
             $id = 1;
220
-			$jstmp = '';
221
-			$jstmpc = '';
220
+            $jstmp = '';
221
+            $jstmpc = '';
222 222
             foreach ($this->answer as $i => $answer) {
223
-				$identifier = 'question_'.$this->questionJSId.'_multiple_'.$i;
224
-				$html .=
225
-					'<tr>
223
+                $identifier = 'question_'.$this->questionJSId.'_multiple_'.$i;
224
+                $html .=
225
+                    '<tr>
226 226
 					<td align="center" width="5%">
227 227
 					<input name="'.$identifier.'" id="'.$identifier.'" value="'.$i.'" type="checkbox" />
228 228
 					</td>
@@ -231,19 +231,19 @@  discard block
 block discarded – undo
231 231
 					</td>
232 232
 					</tr>';
233 233
 
234
-				$jstmp .= $i.',';
234
+                $jstmp .= $i.',';
235 235
                 if ($this->correct[$i]) {
236 236
                     $jstmpc .= $i.',';
237 237
                 }
238
-				$jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.']['.$i.'] = '.$this->weighting[$i].";";
238
+                $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.']['.$i.'] = '.$this->weighting[$i].";";
239 239
                 $jstmpw .= 'questions_answers_correct['.$this->questionJSId.']['.$i.'] = '.$this->correct[$i].';';
240
-				$id++;
241
-			}
242
-			$js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');'."\n";
240
+                $id++;
241
+            }
242
+            $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');'."\n";
243 243
             $js .= 'questions_types['.$this->questionJSId.'] = \'mcma\';'."\n";
244
-			$js .= $jstmpw;
245
-		} elseif ($type == MULTIPLE_ANSWER_COMBINATION) {
246
-	    	$js = '';
244
+            $js .= $jstmpw;
245
+        } elseif ($type == MULTIPLE_ANSWER_COMBINATION) {
246
+            $js = '';
247 247
             $id = 1;
248 248
             $jstmp = '';
249 249
             $jstmpc = '';
@@ -270,15 +270,15 @@  discard block
 block discarded – undo
270 270
             $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');';
271 271
             $js .= 'questions_types['.$this->questionJSId.'] = "exact";';
272 272
             $js .= $jstmpw;
273
-		} else {
274
-			$id = 1;
275
-			$jstmp = '';
276
-			$jstmpc = '';
273
+        } else {
274
+            $id = 1;
275
+            $jstmp = '';
276
+            $jstmpc = '';
277 277
             foreach ($this->answer as $i => $answer) {
278 278
                 $identifier = 'question_'.$this->questionJSId.'_unique_'.$i;
279
-				$identifier_name = 'question_'.$this->questionJSId.'_unique_answer';
280
-				$html .=
281
-					'<tr>
279
+                $identifier_name = 'question_'.$this->questionJSId.'_unique_answer';
280
+                $html .=
281
+                    '<tr>
282 282
 					<td align="center" width="5%">
283 283
 					<input name="'.$identifier_name.'" id="'.$identifier.'" value="'.$i.'" type="checkbox"/>
284 284
 					</td>
@@ -286,22 +286,22 @@  discard block
 block discarded – undo
286 286
 					<label for="'.$identifier.'">' . Security::remove_XSS($this->answer[$i]) . '</label>
287 287
 					</td>
288 288
 					</tr>';
289
-				$jstmp .= $i.',';
289
+                $jstmp .= $i.',';
290 290
                 if ($this->correct[$i]) {
291 291
                     $jstmpc .= $i;
292 292
                 }
293
-				$jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.']['.$i.'] = '.$this->weighting[$i].";";
293
+                $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.']['.$i.'] = '.$this->weighting[$i].";";
294 294
                 $jstmpw .= 'questions_answers_correct['.$this->questionJSId.']['.$i.'] = '.$this->correct[$i].';';
295
-				$id++;
296
-			}
297
-			$js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');';
298
-			$js .= 'questions_types['.$this->questionJSId.'] = \'mcua\';';
299
-			$js .= $jstmpw;
300
-		}
301
-		$html .= '</table></td></tr>';
302
-
303
-		return array($js, $html);
304
-	}
295
+                $id++;
296
+            }
297
+            $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');';
298
+            $js .= 'questions_types['.$this->questionJSId.'] = \'mcua\';';
299
+            $js .= $jstmpw;
300
+        }
301
+        $html .= '</table></td></tr>';
302
+
303
+        return array($js, $html);
304
+    }
305 305
 }
306 306
 
307 307
 /**
@@ -310,21 +310,21 @@  discard block
 block discarded – undo
310 310
  */
311 311
 class ScormAnswerTrueFalse extends Answer
312 312
 {
313
-	/**
314
-	 * Return the XML flow for the possible answers.
315
-	 * That's one <response_lid>, containing several <flow_label>
316
-	 *
317
-	 * @author Amand Tihon <[email protected]>
318
-	 */
319
-	function export()
320
-	{
321
-		$js = '';
322
-		$html = '<tr><td colspan="2"><table width="100%">';
323
-		$identifier = 'question_'.$this->questionJSId.'_tf';
324
-		$identifier_true  = $identifier.'_true';
325
-		$identifier_false = $identifier.'_false';
326
-		$html .=
327
-			'<tr>
313
+    /**
314
+     * Return the XML flow for the possible answers.
315
+     * That's one <response_lid>, containing several <flow_label>
316
+     *
317
+     * @author Amand Tihon <[email protected]>
318
+     */
319
+    function export()
320
+    {
321
+        $js = '';
322
+        $html = '<tr><td colspan="2"><table width="100%">';
323
+        $identifier = 'question_'.$this->questionJSId.'_tf';
324
+        $identifier_true  = $identifier.'_true';
325
+        $identifier_false = $identifier.'_false';
326
+        $html .=
327
+            '<tr>
328 328
 				<td align="center" width="5%">
329 329
 				<input name="'.$identifier_true.'" id="'.$identifier_true.'" value="'.$this->trueGrade.'" type="radio" />
330 330
 				</td>
@@ -332,8 +332,8 @@  discard block
 block discarded – undo
332 332
 				<label for="'.$identifier_true.'">' . get_lang('True') . '</label>
333 333
 				</td>
334 334
 				</tr>';
335
-		$html .=
336
-			'<tr>
335
+        $html .=
336
+            '<tr>
337 337
 			<td align="center" width="5%">
338 338
 			<input name="'.$identifier_false.'" id="'.$identifier_false.'" value="'.$this->falseGrade.'" type="radio" />
339 339
 			</td>
@@ -341,20 +341,20 @@  discard block
 block discarded – undo
341 341
 			<label for="'.$identifier_false.'">' . get_lang('False') . '</label>
342 342
 			</td>
343 343
 			</tr></table></td></tr>';
344
-		$js .= 'questions_answers['.$this->questionJSId.'] = new Array(\'true\',\'false\');'."\n";
345
-		$js .= 'questions_types['.$this->questionJSId.'] = \'tf\';'."\n";
346
-		if ($this->response === 'TRUE') {
347
-			$js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array(\'true\');'."\n";
348
-		} else {
349
-			$js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array(\'false\');'."\n";
350
-		}
351
-		$jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n";
352
-		$jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n";
353
-		$jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][1] = '.$this->weighting[1].";\n";
354
-		$js .= $jstmpw;
355
-
356
-		return array($js, $html);
357
-	}
344
+        $js .= 'questions_answers['.$this->questionJSId.'] = new Array(\'true\',\'false\');'."\n";
345
+        $js .= 'questions_types['.$this->questionJSId.'] = \'tf\';'."\n";
346
+        if ($this->response === 'TRUE') {
347
+            $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array(\'true\');'."\n";
348
+        } else {
349
+            $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array(\'false\');'."\n";
350
+        }
351
+        $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n";
352
+        $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n";
353
+        $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][1] = '.$this->weighting[1].";\n";
354
+        $js .= $jstmpw;
355
+
356
+        return array($js, $html);
357
+    }
358 358
 }
359 359
 
360 360
 /**
@@ -363,76 +363,76 @@  discard block
 block discarded – undo
363 363
  */
364 364
 class ScormAnswerFillInBlanks extends Answer
365 365
 {
366
-	/**
367
-	 * Export the text with missing words.
368
-	 *
369
-	 * As a side effect, it stores two lists in the class :
370
-	 * the missing words and their respective weightings.
371
-	 */
372
-	function export()
373
-	{
374
-		global $charset;
375
-		$js = '';
376
-		$html = '<tr><td colspan="2"><table width="100%">';
377
-		// get all enclosed answers
378
-		$blankList = array();
379
-		// build replacement
380
-		$replacementList = array();
381
-		foreach ($this->answer as $i => $answer) {
382
-			$blankList[] = '['.$answer.']';
383
-		}
384
-
385
-		// splits text and weightings that are joined with the character '::'
386
-		list($answer,$weight)=explode('::',$answer);
387
-		$weights = explode(',',$weight);
388
-		// because [] is parsed here we follow this procedure:
389
-		// 1. find everything between the [ and ] tags
390
-		$i=1;
391
-		$jstmp = '';
392
-		$jstmpc = '';
393
-		$jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n";
394
-		$jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n";
395
-		$startlocations=api_strpos($answer,'[');
396
-		$endlocations=api_strpos($answer,']');
397
-		while ($startlocations !== false && $endlocations !== false) {
398
-			$texstring = api_substr($answer,$startlocations,($endlocations-$startlocations)+1);
399
-			$answer = api_substr_replace(
366
+    /**
367
+     * Export the text with missing words.
368
+     *
369
+     * As a side effect, it stores two lists in the class :
370
+     * the missing words and their respective weightings.
371
+     */
372
+    function export()
373
+    {
374
+        global $charset;
375
+        $js = '';
376
+        $html = '<tr><td colspan="2"><table width="100%">';
377
+        // get all enclosed answers
378
+        $blankList = array();
379
+        // build replacement
380
+        $replacementList = array();
381
+        foreach ($this->answer as $i => $answer) {
382
+            $blankList[] = '['.$answer.']';
383
+        }
384
+
385
+        // splits text and weightings that are joined with the character '::'
386
+        list($answer,$weight)=explode('::',$answer);
387
+        $weights = explode(',',$weight);
388
+        // because [] is parsed here we follow this procedure:
389
+        // 1. find everything between the [ and ] tags
390
+        $i=1;
391
+        $jstmp = '';
392
+        $jstmpc = '';
393
+        $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n";
394
+        $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n";
395
+        $startlocations=api_strpos($answer,'[');
396
+        $endlocations=api_strpos($answer,']');
397
+        while ($startlocations !== false && $endlocations !== false) {
398
+            $texstring = api_substr($answer,$startlocations,($endlocations-$startlocations)+1);
399
+            $answer = api_substr_replace(
400 400
                 $answer,
401 401
                 '<input type="text" name="question_'.$this->questionJSId.'_fib_'.$i.'" id="question_'.$this->questionJSId.'_fib_'.$i.'" size="10" value="" />',
402 402
                 $startlocations,
403 403
                 ($endlocations-$startlocations)+1
404 404
             );
405 405
             $jstmp .= $i.',';
406
-			if (!empty($texstring)) {
407
-				$sub = api_substr($texstring, 1, -1);
408
-				if (!empty($sub)) {
409
-					$jstmpc .= "'" . api_htmlentities($sub, ENT_QUOTES, $charset) . "',";
410
-				}
411
-			}
406
+            if (!empty($texstring)) {
407
+                $sub = api_substr($texstring, 1, -1);
408
+                if (!empty($sub)) {
409
+                    $jstmpc .= "'" . api_htmlentities($sub, ENT_QUOTES, $charset) . "',";
410
+                }
411
+            }
412 412
             $my_weight = explode('@', $weights[$i - 1]);
413 413
             if (count($my_weight) == 2) {
414 414
                 $weight_db = $my_weight[0];
415 415
             } else {
416 416
                 $weight_db = $my_weight[0];
417 417
             }
418
-			$jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.']['.$i.'] = '.$weight_db.";\n";
419
-			$i++;
420
-			$startlocations = api_strpos($answer, '[');
421
-			$endlocations = api_strpos($answer, ']');
422
-		}
418
+            $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.']['.$i.'] = '.$weight_db.";\n";
419
+            $i++;
420
+            $startlocations = api_strpos($answer, '[');
421
+            $endlocations = api_strpos($answer, ']');
422
+        }
423 423
 
424
-		$html .= '<tr>
424
+        $html .= '<tr>
425 425
 			<td>
426 426
 			'.$answer.'
427 427
 			</td>
428 428
 			</tr></table></td></tr>';
429
-		$js .= 'questions_answers['.$this->questionJSId.'] = new Array('.api_substr($jstmp,0,-1).');'."\n";
430
-		$js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array('.api_substr($jstmpc,0,-1).');'."\n";
431
-		$js .= 'questions_types['.$this->questionJSId.'] = \'fib\';'."\n";
432
-		$js .= $jstmpw;
429
+        $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.api_substr($jstmp,0,-1).');'."\n";
430
+        $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array('.api_substr($jstmpc,0,-1).');'."\n";
431
+        $js .= 'questions_types['.$this->questionJSId.'] = \'fib\';'."\n";
432
+        $js .= $jstmpw;
433 433
 
434
-		return array($js,$html);
435
-	}
434
+        return array($js,$html);
435
+    }
436 436
 }
437 437
 
438 438
 /**
@@ -441,65 +441,65 @@  discard block
 block discarded – undo
441 441
  */
442 442
 class ScormAnswerMatching extends Answer
443 443
 {
444
-	/**
445
-	 * Export the question part as a matrix-choice, with only one possible answer per line.
446
-	 * @author Amand Tihon <[email protected]>
447
-	 */
448
-	function export()
449
-	{
450
-		$js = '';
451
-		$html = '<tr><td colspan="2"><table width="100%">';
452
-		// prepare list of right proposition to allow
453
-		// - easiest display
454
-		// - easiest randomisation if needed one day
455
-		// (here I use array_values to change array keys from $code1 $code2 ... to 0 1 ...)
456
-
457
-		// get max length of displayed array
458
-
459
-		$nbrAnswers = $this->selectNbrAnswers();
460
-		$cpt1='A';
461
-		$cpt2=1;
462
-		$Select = array();
463
-		$qId = $this->questionJSId;
464
-		$s = '';
465
-		$jstmp = '';
466
-		$jstmpc = '';
467
-		$jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n";
468
-		$jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n";
469
-
470
-		for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
471
-			$identifier = 'question_'.$qId.'_matching_';
472
-			$answer=$this->selectAnswer($answerId);
473
-			$answerCorrect=$this->isCorrect($answerId);
474
-			$weight=$this->selectWeighting($answerId);
475
-			$jstmp .= $answerId.',';
476
-
477
-			if (!$answerCorrect) {
478
-				// options (A, B, C, ...) that will be put into the list-box
479
-				$Select[$answerId]['Lettre']=$cpt1;
480
-				// answers that will be shown at the right side
481
-				$Select[$answerId]['Reponse'] = $answer;
482
-				$cpt1++;
483
-			} else {
484
-				$s.='<tr>';
485
-				$s.='<td width="40%" valign="top"><b>'.$cpt2.'</b>.&nbsp;'.$answer."</td>";
486
-				$s.='<td width="20%" align="center">&nbsp;&nbsp;<select name="'.$identifier.$cpt2.'" id="'.$identifier.$cpt2.'">';
487
-				$s.=' <option value="0">--</option>';
488
-				// fills the list-box
444
+    /**
445
+     * Export the question part as a matrix-choice, with only one possible answer per line.
446
+     * @author Amand Tihon <[email protected]>
447
+     */
448
+    function export()
449
+    {
450
+        $js = '';
451
+        $html = '<tr><td colspan="2"><table width="100%">';
452
+        // prepare list of right proposition to allow
453
+        // - easiest display
454
+        // - easiest randomisation if needed one day
455
+        // (here I use array_values to change array keys from $code1 $code2 ... to 0 1 ...)
456
+
457
+        // get max length of displayed array
458
+
459
+        $nbrAnswers = $this->selectNbrAnswers();
460
+        $cpt1='A';
461
+        $cpt2=1;
462
+        $Select = array();
463
+        $qId = $this->questionJSId;
464
+        $s = '';
465
+        $jstmp = '';
466
+        $jstmpc = '';
467
+        $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n";
468
+        $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n";
469
+
470
+        for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
471
+            $identifier = 'question_'.$qId.'_matching_';
472
+            $answer=$this->selectAnswer($answerId);
473
+            $answerCorrect=$this->isCorrect($answerId);
474
+            $weight=$this->selectWeighting($answerId);
475
+            $jstmp .= $answerId.',';
476
+
477
+            if (!$answerCorrect) {
478
+                // options (A, B, C, ...) that will be put into the list-box
479
+                $Select[$answerId]['Lettre']=$cpt1;
480
+                // answers that will be shown at the right side
481
+                $Select[$answerId]['Reponse'] = $answer;
482
+                $cpt1++;
483
+            } else {
484
+                $s.='<tr>';
485
+                $s.='<td width="40%" valign="top"><b>'.$cpt2.'</b>.&nbsp;'.$answer."</td>";
486
+                $s.='<td width="20%" align="center">&nbsp;&nbsp;<select name="'.$identifier.$cpt2.'" id="'.$identifier.$cpt2.'">';
487
+                $s.=' <option value="0">--</option>';
488
+                // fills the list-box
489 489
                 foreach ($Select as $key => $val) {
490 490
                     $s .= '<option value="'.$key.'">'.$val['Lettre'].'</option>';
491 491
                 }  // end foreach()
492 492
 
493
-				$s.='</select>&nbsp;&nbsp;</td>';
494
-				$s.='<td width="40%" valign="top">';
493
+                $s.='</select>&nbsp;&nbsp;</td>';
494
+                $s.='<td width="40%" valign="top">';
495 495
                 if (isset($Select[$cpt2])) {
496 496
                     $s .= '<b>'.$Select[$cpt2]['Lettre'].'.</b> '.$Select[$cpt2]['Reponse'];
497 497
                 } else {
498 498
                     $s .= '&nbsp;';
499 499
                 }
500
-				$s.="</td></tr>";
500
+                $s.="</td></tr>";
501 501
 
502
-				$jstmpc .= '['.$answerCorrect.','.$cpt2.'],';
502
+                $jstmpc .= '['.$answerCorrect.','.$cpt2.'],';
503 503
 
504 504
                 $my_weight = explode('@', $weight);
505 505
                 if (count($my_weight) == 2) {
@@ -507,32 +507,32 @@  discard block
 block discarded – undo
507 507
                 } else {
508 508
                     $weight = $my_weight[0];
509 509
                 }
510
-				$jstmpw .= 'questions_answers_ponderation['.$qId.']['.$cpt2.'] = '.$weight.";\n";
511
-				$cpt2++;
512
-
513
-				// if the left side of the "matching" has been completely shown
514
-				if ($answerId == $nbrAnswers) {
515
-					// if there remain answers to be shown on the right side
516
-					while (isset($Select[$cpt2])) {
517
-						$s.= '<tr>';
518
-						$s.= '<td width="60%" colspan="2">&nbsp;</td>';
519
-						$s.= '<td width="40%" valign="top">';
520
-						$s.= '<b>'.$Select[$cpt2]['Lettre'].'.</b> '.$Select[$cpt2]['Reponse'];
521
-						$s.= "</td></tr>";
522
-						$cpt2++;
523
-					}	// end while()
524
-				}  // end if()
525
-			}
526
-		}
527
-		$js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');'."\n";
528
-		$js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array('.substr($jstmpc,0,-1).');'."\n";
529
-		$js .= 'questions_types['.$this->questionJSId.'] = \'matching\';'."\n";
530
-		$js .= $jstmpw;
531
-		$html .= $s;
532
-		$html .= '</table></td></tr>' . "\n";
533
-
534
-		return array($js, $html);
535
-	}
510
+                $jstmpw .= 'questions_answers_ponderation['.$qId.']['.$cpt2.'] = '.$weight.";\n";
511
+                $cpt2++;
512
+
513
+                // if the left side of the "matching" has been completely shown
514
+                if ($answerId == $nbrAnswers) {
515
+                    // if there remain answers to be shown on the right side
516
+                    while (isset($Select[$cpt2])) {
517
+                        $s.= '<tr>';
518
+                        $s.= '<td width="60%" colspan="2">&nbsp;</td>';
519
+                        $s.= '<td width="40%" valign="top">';
520
+                        $s.= '<b>'.$Select[$cpt2]['Lettre'].'.</b> '.$Select[$cpt2]['Reponse'];
521
+                        $s.= "</td></tr>";
522
+                        $cpt2++;
523
+                    }	// end while()
524
+                }  // end if()
525
+            }
526
+        }
527
+        $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');'."\n";
528
+        $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array('.substr($jstmpc,0,-1).');'."\n";
529
+        $js .= 'questions_types['.$this->questionJSId.'] = \'matching\';'."\n";
530
+        $js .= $jstmpw;
531
+        $html .= $s;
532
+        $html .= '</table></td></tr>' . "\n";
533
+
534
+        return array($js, $html);
535
+    }
536 536
 }
537 537
 
538 538
 /**
@@ -541,19 +541,19 @@  discard block
 block discarded – undo
541 541
  */
542 542
 class ScormAnswerFree extends Answer
543 543
 {
544
-	/**
545
-	 * Export the text with missing words.
546
-	 *
547
-	 * As a side effect, it stores two lists in the class :
548
-	 * the missing words and their respective weightings.
549
-	 *
550
-	 */
551
-	function export()
552
-	{
553
-		$js = '';
544
+    /**
545
+     * Export the text with missing words.
546
+     *
547
+     * As a side effect, it stores two lists in the class :
548
+     * the missing words and their respective weightings.
549
+     *
550
+     */
551
+    function export()
552
+    {
553
+        $js = '';
554 554
         $identifier = 'question_'.$this->questionJSId.'_free';
555
-		// currently the free answers cannot be displayed, so ignore the textarea
556
-		$html = '<tr><td colspan="2">';
555
+        // currently the free answers cannot be displayed, so ignore the textarea
556
+        $html = '<tr><td colspan="2">';
557 557
         $type = $this->getQuestionType();
558 558
 
559 559
         if ($type == ORAL_EXPRESSION) {
@@ -565,21 +565,21 @@  discard block
 block discarded – undo
565 565
             $layout = $template->get_template('document/record_audio.tpl');
566 566
             $html .= $template->fetch($layout);*/
567 567
 
568
-			$html = '<tr><td colspan="2">'.get_lang('ThisItemIsNotExportable').'</td></tr>';
568
+            $html = '<tr><td colspan="2">'.get_lang('ThisItemIsNotExportable').'</td></tr>';
569 569
 
570 570
             return array($js, $html);
571 571
         }
572 572
 
573 573
         $html .= '<textarea minlength="20" name="'.$identifier.'" id="'.$identifier.'" ></textarea>';
574 574
         $html .= '</td></tr>';
575
-		$js .= 'questions_answers['.$this->questionJSId.'] = new Array();';
576
-		$js .= 'questions_answers_correct['.$this->questionJSId.'] = "";';
577
-		$js .= 'questions_types['.$this->questionJSId.'] = \'free\';';
578
-		$jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = "0";';
579
-		$js .= $jstmpw;
580
-
581
-		return array($js, $html);
582
-	}
575
+        $js .= 'questions_answers['.$this->questionJSId.'] = new Array();';
576
+        $js .= 'questions_answers_correct['.$this->questionJSId.'] = "";';
577
+        $js .= 'questions_types['.$this->questionJSId.'] = \'free\';';
578
+        $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = "0";';
579
+        $js .= $jstmpw;
580
+
581
+        return array($js, $html);
582
+    }
583 583
 }
584 584
 /**
585 585
  * This class handles the SCORM export of hotpot questions
@@ -587,63 +587,63 @@  discard block
 block discarded – undo
587 587
  */
588 588
 class ScormAnswerHotspot extends Answer
589 589
 {
590
-	/**
591
-	 * Returns the javascript code that goes with HotSpot exercises
592
-	 * @return string	The JavaScript code
593
-	 */
594
-	function get_js_header()
595
-	{
596
-		if ($this->standalone) {
597
-			$header = '<script>';
598
-			$header .= file_get_contents('../inc/lib/javascript/hotspot/js/hotspot.js');
599
-			$header .= '</script>';
600
-			//because this header closes so many times the <script> tag, we have to reopen our own
601
-			$header .= '<script>';
602
-			$header .= 'questions_answers['.$this->questionJSId.'] = new Array();'."\n";
603
-			$header .= 'questions_answers_correct['.$this->questionJSId.'] = new Array();'."\n";
604
-			$header .= 'questions_types['.$this->questionJSId.'] = \'hotspot\';'."\n";
605
-			$jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n";
606
-			$jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n";
607
-			$jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][1] = 0;'.";\n";
608
-			$header .= $jstmpw;
609
-		} else {
610
-			$header = '';
611
-			$header .= 'questions_answers['.$this->questionJSId.'] = new Array();'."\n";
612
-			$header .= 'questions_answers_correct['.$this->questionJSId.'] = new Array();'."\n";
613
-			$header .= 'questions_types['.$this->questionJSId.'] = \'hotspot\';'."\n";
614
-			$jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n";
615
-			$jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n";
616
-			$jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][1] = 0;'."\n";
617
-			$header .= $jstmpw;
618
-		}
619
-
620
-		return $header;
621
-	}
622
-	/**
623
-	 * Export the text with missing words.
624
-	 *
625
-	 * As a side effect, it stores two lists in the class :
626
-	 * the missing words and their respective weightings.
627
-	 *
628
-	 */
629
-	function export()
630
-	{
631
-		$js = $this->get_js_header();
632
-		$html = '<tr><td colspan="2"><table width="100%">';
633
-		// some javascript must be added for that kind of questions
634
-		$html .= '';
635
-
636
-		// Get the answers, make a list
637
-		$nbrAnswers=$this->selectNbrAnswers();
638
-
639
-		$answer_list = '<div style="padding: 10px; margin-left: -8px; border: 1px solid #4271b5; height: 448px; width: 200px;"><b>'.get_lang('HotspotZones').'</b><ol>';
590
+    /**
591
+     * Returns the javascript code that goes with HotSpot exercises
592
+     * @return string	The JavaScript code
593
+     */
594
+    function get_js_header()
595
+    {
596
+        if ($this->standalone) {
597
+            $header = '<script>';
598
+            $header .= file_get_contents('../inc/lib/javascript/hotspot/js/hotspot.js');
599
+            $header .= '</script>';
600
+            //because this header closes so many times the <script> tag, we have to reopen our own
601
+            $header .= '<script>';
602
+            $header .= 'questions_answers['.$this->questionJSId.'] = new Array();'."\n";
603
+            $header .= 'questions_answers_correct['.$this->questionJSId.'] = new Array();'."\n";
604
+            $header .= 'questions_types['.$this->questionJSId.'] = \'hotspot\';'."\n";
605
+            $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n";
606
+            $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n";
607
+            $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][1] = 0;'.";\n";
608
+            $header .= $jstmpw;
609
+        } else {
610
+            $header = '';
611
+            $header .= 'questions_answers['.$this->questionJSId.'] = new Array();'."\n";
612
+            $header .= 'questions_answers_correct['.$this->questionJSId.'] = new Array();'."\n";
613
+            $header .= 'questions_types['.$this->questionJSId.'] = \'hotspot\';'."\n";
614
+            $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n";
615
+            $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n";
616
+            $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][1] = 0;'."\n";
617
+            $header .= $jstmpw;
618
+        }
619
+
620
+        return $header;
621
+    }
622
+    /**
623
+     * Export the text with missing words.
624
+     *
625
+     * As a side effect, it stores two lists in the class :
626
+     * the missing words and their respective weightings.
627
+     *
628
+     */
629
+    function export()
630
+    {
631
+        $js = $this->get_js_header();
632
+        $html = '<tr><td colspan="2"><table width="100%">';
633
+        // some javascript must be added for that kind of questions
634
+        $html .= '';
635
+
636
+        // Get the answers, make a list
637
+        $nbrAnswers=$this->selectNbrAnswers();
638
+
639
+        $answer_list = '<div style="padding: 10px; margin-left: -8px; border: 1px solid #4271b5; height: 448px; width: 200px;"><b>'.get_lang('HotspotZones').'</b><ol>';
640 640
         for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
641 641
             $answer_list .= '<li>'.$this->selectAnswer($answerId).'</li>';
642 642
         }
643 643
         $answer_list .= '</ol></div>';
644
-		$canClick = true;
645
-		$relPath = api_get_path(REL_PATH);
646
-		$html .= <<<HTML
644
+        $canClick = true;
645
+        $relPath = api_get_path(REL_PATH);
646
+        $html .= <<<HTML
647 647
             <tr>
648 648
                 <td>
649 649
                     <div id="hotspot-{$this->questionJSId}"></div>
@@ -663,13 +663,13 @@  discard block
 block discarded – undo
663 663
                 </td>
664 664
             <tr>
665 665
 HTML;
666
-		$html .= '</table></td></tr>';
666
+        $html .= '</table></td></tr>';
667 667
 
668
-		// currently the free answers cannot be displayed, so ignore the textarea
669
-		$html = '<tr><td colspan="2">'.get_lang('ThisItemIsNotExportable').'</td></tr>';
668
+        // currently the free answers cannot be displayed, so ignore the textarea
669
+        $html = '<tr><td colspan="2">'.get_lang('ThisItemIsNotExportable').'</td></tr>';
670 670
 
671
-		return array($js, $html);
672
-	}
671
+        return array($js, $html);
672
+    }
673 673
 }
674 674
 
675 675
 /**
@@ -684,32 +684,32 @@  discard block
 block discarded – undo
684 684
  */
685 685
 class ScormAssessmentItem
686 686
 {
687
-	public $question;
688
-	public $question_ident;
689
-	public $answer;
690
-	public $standalone;
691
-
692
-	/**
693
-	 * Constructor.
694
-	 *
695
-	 * @param ScormQuestion $question The Question object we want to export.
696
-	 */
697
-	public function __construct($question, $standalone = false)
698
-	{
699
-		$this->question = $question;
700
-		$this->question->setAnswer();
701
-		$this->questionIdent = "QST_" . $question->id ;
702
-		$this->standalone = $standalone;
703
-	}
704
-
705
-	/**
706
-	 * Start the XML flow.
707
-	 *
708
-	 * This opens the <item> block, with correct attributes.
709
-	 *
710
-	 */
711
-	function start_page()
712
-	{
687
+    public $question;
688
+    public $question_ident;
689
+    public $answer;
690
+    public $standalone;
691
+
692
+    /**
693
+     * Constructor.
694
+     *
695
+     * @param ScormQuestion $question The Question object we want to export.
696
+     */
697
+    public function __construct($question, $standalone = false)
698
+    {
699
+        $this->question = $question;
700
+        $this->question->setAnswer();
701
+        $this->questionIdent = "QST_" . $question->id ;
702
+        $this->standalone = $standalone;
703
+    }
704
+
705
+    /**
706
+     * Start the XML flow.
707
+     *
708
+     * This opens the <item> block, with correct attributes.
709
+     *
710
+     */
711
+    function start_page()
712
+    {
713 713
         $head = '';
714 714
         if ($this->standalone) {
715 715
             $charset = 'UTF-8';
@@ -717,89 +717,89 @@  discard block
 block discarded – undo
717 717
             $head .= '<html>';
718 718
         }
719 719
 
720
-		return $head;
721
-	}
720
+        return $head;
721
+    }
722 722
 
723
-	/**
724
-	 * End the XML flow, closing the </item> tag.
725
-	 *
726
-	 */
727
-	function end_page()
723
+    /**
724
+     * End the XML flow, closing the </item> tag.
725
+     *
726
+     */
727
+    function end_page()
728
+    {
729
+        if ($this->standalone) {
730
+            return '</html>';
731
+        }
732
+
733
+        return '';
734
+    }
735
+
736
+    /**
737
+     * Start document header
738
+     */
739
+    function start_header()
740
+    {
741
+        if ($this->standalone) {
742
+            return '<head>';
743
+        }
744
+
745
+        return '';
746
+    }
747
+
748
+    /**
749
+     * Print CSS inclusion
750
+     */
751
+    function css()
752
+    {
753
+        $css = '';
754
+        if ($this->standalone) {
755
+            $css = '<style type="text/css" media="screen, projection">';
756
+            $css .= '/*<![CDATA[*/'."\n";
757
+            $css .= '/*]]>*/'."\n";
758
+            $css .= '</style>'."\n";
759
+            $css .= '<style type="text/css" media="print">';
760
+            $css .= '/*<![CDATA[*/'."\n";
761
+            $css .= '/*]]>*/'."\n";
762
+            $css .= '</style>';
763
+        }
764
+
765
+        return $css;
766
+    }
767
+
768
+    /**
769
+     * End document header
770
+     */
771
+    function end_header()
772
+    {
773
+        if ($this->standalone) {
774
+            return '</head>';
775
+        }
776
+
777
+        return '';
778
+    }
779
+    /**
780
+     * Start the itemBody
781
+     *
782
+     */
783
+    function start_js()
728 784
     {
729
-		if ($this->standalone) {
730
-			return '</html>';
731
-		}
732
-
733
-		return '';
734
-	}
735
-
736
-	/**
737
-	 * Start document header
738
-	 */
739
-	function start_header()
740
-	{
741
-		if ($this->standalone) {
742
-			return '<head>';
743
-		}
744
-
745
-		return '';
746
-	}
747
-
748
-	/**
749
-	 * Print CSS inclusion
750
-	 */
751
-	function css()
752
-	{
753
-		$css = '';
754
-		if ($this->standalone) {
755
-			$css = '<style type="text/css" media="screen, projection">';
756
-			$css .= '/*<![CDATA[*/'."\n";
757
-			$css .= '/*]]>*/'."\n";
758
-			$css .= '</style>'."\n";
759
-			$css .= '<style type="text/css" media="print">';
760
-			$css .= '/*<![CDATA[*/'."\n";
761
-			$css .= '/*]]>*/'."\n";
762
-			$css .= '</style>';
763
-		}
764
-
765
-		return $css;
766
-	}
767
-
768
-	/**
769
-	 * End document header
770
-	 */
771
-	function end_header()
772
-	{
773
-		if ($this->standalone) {
774
-			return '</head>';
775
-		}
776
-
777
-		return '';
778
-	}
779
-	/**
780
-	 * Start the itemBody
781
-	 *
782
-	 */
783
-	function start_js()
784
-	{
785 785
         $js = '<script type="text/javascript" src="assets/api_wrapper.js"></script>';
786
-		if ($this->standalone) {
787
-			return '<script>';
788
-		}
789
-		return $js;
790
-	}
791
-
792
-	/**
793
-	 * Common JS functions
794
-	 */
795
-	function common_js()
796
-	{
797
-		$js = 'var questions = new Array();';
798
-		$js .= 'var questions_answers = new Array();';
799
-		$js .= 'var questions_answers_correct = new Array();';
800
-		$js .= 'var questions_types = new Array();';
801
-		$js .= "\n" .
802
-			'/**
786
+        if ($this->standalone) {
787
+            return '<script>';
788
+        }
789
+        return $js;
790
+    }
791
+
792
+    /**
793
+     * Common JS functions
794
+     */
795
+    function common_js()
796
+    {
797
+        $js = 'var questions = new Array();';
798
+        $js .= 'var questions_answers = new Array();';
799
+        $js .= 'var questions_answers_correct = new Array();';
800
+        $js .= 'var questions_types = new Array();';
801
+        $js .= "\n" .
802
+            '/**
803 803
              * Assigns any event handler to any element
804 804
              * @param	object	Element on which the event is added
805 805
              * @param	string	Name of event
@@ -834,79 +834,79 @@  discard block
 block discarded – undo
834 834
             	addEvent(window,\'unload\',unloadPage,false);
835 835
             }'."\n\n";
836 836
 
837
-		$js .= '';
838
-		$js .= 'addEvent(window,\'load\',addListeners,false);'."\n";
837
+        $js .= '';
838
+        $js .= 'addEvent(window,\'load\',addListeners,false);'."\n";
839 839
         if ($this->standalone) {
840 840
             return $js."\n";
841 841
         }
842
-		return '';
843
-	}
844
-
845
-	/**
846
-	 * End the itemBody part.
847
-	 *
848
-	 */
849
-	function end_js()
850
-	{
842
+        return '';
843
+    }
844
+
845
+    /**
846
+     * End the itemBody part.
847
+     *
848
+     */
849
+    function end_js()
850
+    {
851 851
         if ($this->standalone) {
852 852
             return '</script>';
853 853
         }
854 854
 
855 855
         return '';
856
-	}
857
-
858
-	/**
859
-	 * Start the itemBody
860
-	 *
861
-	 */
862
-	function start_body()
863
-	{
864
-		if ($this->standalone) {
865
-			return '<body><form id="dokeos_scorm_form" method="post" action="">';
866
-		}
867
-
868
-		return '';
869
-	}
870
-
871
-	/**
872
-	 * End the itemBody part.
873
-	 *
874
-	 */
875
-	function end_body()
876
-	{
877
-		if ($this->standalone) {
878
-			return '<br /><input class="btn" type="button" id="dokeos_scorm_submit" name="dokeos_scorm_submit" value="OK" /></form></body>';
879
-		}
880
-
881
-		return '';
882
-	}
883
-
884
-	/**
885
-	 * Export the question as a SCORM Item.
886
-	 * This is a default behaviour, some classes may want to override this.
887
-	 * @return string|array A string, the XML flow for an Item.
888
-	 */
889
-	function export()
890
-	{
891
-		list($js, $html) = $this->question->export();
892
-		if ($this->standalone) {
893
-			$res = $this->start_page()
894
-				. $this->start_header()
895
-				. $this->css()
896
-				. $this->start_js()
897
-				. $this->common_js()
898
-				. $js
899
-				. $this->end_js()
900
-				. $this->end_header()
901
-				. $this->start_body()
856
+    }
857
+
858
+    /**
859
+     * Start the itemBody
860
+     *
861
+     */
862
+    function start_body()
863
+    {
864
+        if ($this->standalone) {
865
+            return '<body><form id="dokeos_scorm_form" method="post" action="">';
866
+        }
867
+
868
+        return '';
869
+    }
870
+
871
+    /**
872
+     * End the itemBody part.
873
+     *
874
+     */
875
+    function end_body()
876
+    {
877
+        if ($this->standalone) {
878
+            return '<br /><input class="btn" type="button" id="dokeos_scorm_submit" name="dokeos_scorm_submit" value="OK" /></form></body>';
879
+        }
880
+
881
+        return '';
882
+    }
883
+
884
+    /**
885
+     * Export the question as a SCORM Item.
886
+     * This is a default behaviour, some classes may want to override this.
887
+     * @return string|array A string, the XML flow for an Item.
888
+     */
889
+    function export()
890
+    {
891
+        list($js, $html) = $this->question->export();
892
+        if ($this->standalone) {
893
+            $res = $this->start_page()
894
+                . $this->start_header()
895
+                . $this->css()
896
+                . $this->start_js()
897
+                . $this->common_js()
898
+                . $js
899
+                . $this->end_js()
900
+                . $this->end_header()
901
+                . $this->start_body()
902 902
                 . $html
903
-				. $this->end_body()
904
-				. $this->end_page();
905
-			return $res;
906
-		} else {
907
-			return array($js, $html);
908
-		}
909
-	}
903
+                . $this->end_body()
904
+                . $this->end_page();
905
+            return $res;
906
+        } else {
907
+            return array($js, $html);
908
+        }
909
+    }
910 910
 }
911 911
 
912 912
 /**
@@ -923,103 +923,103 @@  discard block
 block discarded – undo
923 923
  */
924 924
 class ScormSection
925 925
 {
926
-	public $exercise;
927
-	public $standalone;
928
-
929
-	/**
930
-	 * Send a complete exercise in SCORM format, from its ID
931
-	 *
932
-	 * @param Exercise $exercise The exercise to export
933
-	 * @param boolean $standalone Wether it should include XML tag and DTD line.
934
-	 * @return string XML as a string, or an empty string if there's no exercise with given ID.
935
-	 */
936
-	public static function export_exercise_to_scorm(Exercise $exercise, $standalone = true)
937
-	{
938
-		$ims = new ScormSection($exercise);
939
-		$xml = $ims->export($standalone);
940
-
941
-		return $xml;
942
-	}
943
-
944
-	/**
945
-	 * Constructor.
946
-	 * @param Exercise $exe The Exercise instance to export
947
-	 * @author Amand Tihon <[email protected]>
948
-	 */
949
-	public function __construct($exe)
950
-	{
951
-		$this->exercise = $exe;
952
-	}
953
-
954
-	/**
955
-	 * Start the XML flow.
956
-	 *
957
-	 * This opens the <item> block, with correct attributes.
958
-	 *
959
-	 */
960
-	function start_page()
961
-	{
926
+    public $exercise;
927
+    public $standalone;
928
+
929
+    /**
930
+     * Send a complete exercise in SCORM format, from its ID
931
+     *
932
+     * @param Exercise $exercise The exercise to export
933
+     * @param boolean $standalone Wether it should include XML tag and DTD line.
934
+     * @return string XML as a string, or an empty string if there's no exercise with given ID.
935
+     */
936
+    public static function export_exercise_to_scorm(Exercise $exercise, $standalone = true)
937
+    {
938
+        $ims = new ScormSection($exercise);
939
+        $xml = $ims->export($standalone);
940
+
941
+        return $xml;
942
+    }
943
+
944
+    /**
945
+     * Constructor.
946
+     * @param Exercise $exe The Exercise instance to export
947
+     * @author Amand Tihon <[email protected]>
948
+     */
949
+    public function __construct($exe)
950
+    {
951
+        $this->exercise = $exe;
952
+    }
953
+
954
+    /**
955
+     * Start the XML flow.
956
+     *
957
+     * This opens the <item> block, with correct attributes.
958
+     *
959
+     */
960
+    function start_page()
961
+    {
962 962
         $charset = 'UTF-8';
963
-		$head = '<?xml version="1.0" encoding="'.$charset.'" standalone="no"?><html>';
964
-
965
-		return $head;
966
-	}
967
-
968
-	/**
969
-	 * End the XML flow, closing the </item> tag.
970
-	 *
971
-	 */
972
-	function end_page()
973
-	{
974
-		return '</html>';
975
-	}
976
-
977
-	/**
978
-	 * Start document header
979
-	 */
980
-	function start_header()
981
-	{
982
-		return '<head>';
983
-	}
984
-
985
-	/**
986
-	 * Print CSS inclusion
987
-	 */
988
-	private function css()
989
-	{
990
-		return '';
991
-	}
992
-
993
-	/**
994
-	 * End document header
995
-	 */
963
+        $head = '<?xml version="1.0" encoding="'.$charset.'" standalone="no"?><html>';
964
+
965
+        return $head;
966
+    }
967
+
968
+    /**
969
+     * End the XML flow, closing the </item> tag.
970
+     *
971
+     */
972
+    function end_page()
973
+    {
974
+        return '</html>';
975
+    }
976
+
977
+    /**
978
+     * Start document header
979
+     */
980
+    function start_header()
981
+    {
982
+        return '<head>';
983
+    }
984
+
985
+    /**
986
+     * Print CSS inclusion
987
+     */
988
+    private function css()
989
+    {
990
+        return '';
991
+    }
992
+
993
+    /**
994
+     * End document header
995
+     */
996 996
     private function end_header()
997
-	{
998
-		return '</head>';
999
-	}
1000
-
1001
-	/**
1002
-	 * Start the itemBody
1003
-	 *
1004
-	 */
997
+    {
998
+        return '</head>';
999
+    }
1000
+
1001
+    /**
1002
+     * Start the itemBody
1003
+     *
1004
+     */
1005 1005
     private function start_js()
1006
-	{
1007
-		return '<script>';
1008
-	}
1009
-
1010
-	/**
1011
-	 * Common JS functions
1012
-	 */
1013
-	public function common_js()
1014
-	{
1015
-		$js = file_get_contents('../inc/lib/javascript/hotspot/js/hotspot.js');
1016
-
1017
-		$js .= 'var questions = new Array();' . "\n";
1018
-		$js .= 'var questions_answers = new Array();' . "\n";
1019
-		$js .= 'var questions_answers_correct = new Array();' . "\n";
1020
-		$js .= 'var questions_types = new Array();' . "\n";
1021
-		$js .= "\n" .
1022
-			'/**
1006
+    {
1007
+        return '<script>';
1008
+    }
1009
+
1010
+    /**
1011
+     * Common JS functions
1012
+     */
1013
+    public function common_js()
1014
+    {
1015
+        $js = file_get_contents('../inc/lib/javascript/hotspot/js/hotspot.js');
1016
+
1017
+        $js .= 'var questions = new Array();' . "\n";
1018
+        $js .= 'var questions_answers = new Array();' . "\n";
1019
+        $js .= 'var questions_answers_correct = new Array();' . "\n";
1020
+        $js .= 'var questions_types = new Array();' . "\n";
1021
+        $js .= "\n" .
1022
+            '/**
1023 1023
              * Assigns any event handler to any element
1024 1024
              * @param	object	Element on which the event is added
1025 1025
              * @param	string	Name of event
@@ -1061,76 +1061,76 @@  discard block
 block discarded – undo
1061 1061
             }
1062 1062
             '."\n";
1063 1063
 
1064
-		$js .= '';
1065
-		$js .= 'addEvent(window,\'load\',addListeners,false);'."\n";
1066
-		return $js. "\n";
1067
-	}
1064
+        $js .= '';
1065
+        $js .= 'addEvent(window,\'load\',addListeners,false);'."\n";
1066
+        return $js. "\n";
1067
+    }
1068
+
1069
+    /**
1070
+     * End the itemBody part.
1071
+     *
1072
+     */
1073
+    function end_js()
1074
+    {
1075
+        return '</script>';
1076
+    }
1077
+
1078
+    /**
1079
+     * Start the itemBody
1080
+     *
1081
+     */
1082
+    function start_body()
1083
+    {
1084
+        return '<body>'.
1085
+        '<h1>'.$this->exercise->selectTitle().'</h1><p>'.$this->exercise->selectDescription()."</p>".
1086
+        '<form id="dokeos_scorm_form" method="post" action="">'.
1087
+        '<table width="100%">';
1088
+    }
1089
+
1090
+    /**
1091
+     * End the itemBody part.
1092
+     *
1093
+     */
1094
+    function end_body()
1095
+    {
1096
+        return '</table><br /><input class="btn btn-primary" type="button" id="dokeos_scorm_submit" name="dokeos_scorm_submit" value="OK" /></form></body>';
1097
+    }
1068 1098
 
1069
-	/**
1070
-	 * End the itemBody part.
1071
-	 *
1072
-	 */
1073
-	function end_js()
1099
+    /**
1100
+     * Export the question as a SCORM Item.
1101
+     *
1102
+     * This is a default behaviour, some classes may want to override this.
1103
+     *
1104
+     * @param $standalone: Boolean stating if it should be exported as a stand-alone question
1105
+     * @return string string, the XML flow for an Item.
1106
+     */
1107
+    function export()
1074 1108
     {
1075
-		return '</script>';
1076
-	}
1077
-
1078
-	/**
1079
-	 * Start the itemBody
1080
-	 *
1081
-	 */
1082
-	function start_body()
1083
-	{
1084
-		return '<body>'.
1085
-		'<h1>'.$this->exercise->selectTitle().'</h1><p>'.$this->exercise->selectDescription()."</p>".
1086
-		'<form id="dokeos_scorm_form" method="post" action="">'.
1087
-		'<table width="100%">';
1088
-	}
1089
-
1090
-	/**
1091
-	 * End the itemBody part.
1092
-	 *
1093
-	 */
1094
-	function end_body()
1095
-	{
1096
-		return '</table><br /><input class="btn btn-primary" type="button" id="dokeos_scorm_submit" name="dokeos_scorm_submit" value="OK" /></form></body>';
1097
-	}
1098
-
1099
-	/**
1100
-	 * Export the question as a SCORM Item.
1101
-	 *
1102
-	 * This is a default behaviour, some classes may want to override this.
1103
-	 *
1104
-	 * @param $standalone: Boolean stating if it should be exported as a stand-alone question
1105
-	 * @return string string, the XML flow for an Item.
1106
-	 */
1107
-	function export()
1108
-	{
1109
-		global $charset;
1110
-
1111
-		$head = '';
1112
-		if ($this->standalone) {
1113
-			$head = '<?xml version = "1.0" encoding = "' . $charset . '" standalone = "no"?>' . "\n"
1114
-				. '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n";
1115
-		}
1116
-
1117
-		list($js, $html) = $this->export_questions();
1118
-		$res = $this->start_page()
1119
-			. $this->start_header()
1120
-			. $this->css()
1109
+        global $charset;
1110
+
1111
+        $head = '';
1112
+        if ($this->standalone) {
1113
+            $head = '<?xml version = "1.0" encoding = "' . $charset . '" standalone = "no"?>' . "\n"
1114
+                . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n";
1115
+        }
1116
+
1117
+        list($js, $html) = $this->export_questions();
1118
+        $res = $this->start_page()
1119
+            . $this->start_header()
1120
+            . $this->css()
1121 1121
             . $this->globalAssets()
1122
-			. $this->start_js()
1123
-			. $this->common_js()
1124
-			. $js
1125
-			. $this->end_js()
1126
-			. $this->end_header()
1127
-			. $this->start_body()
1128
-			. $html
1129
-			. $this->end_body()
1130
-			. $this->end_page();
1131
-
1132
-		return $res;
1133
-	}
1122
+            . $this->start_js()
1123
+            . $this->common_js()
1124
+            . $js
1125
+            . $this->end_js()
1126
+            . $this->end_header()
1127
+            . $this->start_body()
1128
+            . $html
1129
+            . $this->end_body()
1130
+            . $this->end_page();
1131
+
1132
+        return $res;
1133
+    }
1134 1134
 
1135 1135
     /**
1136 1136
      * @return string
@@ -1144,21 +1144,21 @@  discard block
 block discarded – undo
1144 1144
         return $assets;
1145 1145
     }
1146 1146
 
1147
-	/**
1148
-	 * Export the questions, as a succession of <items>
1149
-	 * @author Amand Tihon <[email protected]>
1150
-	 */
1151
-	function export_questions()
1152
-	{
1153
-		$js = $html = "";
1154
-		$js_id = 0;
1155
-		foreach ($this->exercise->selectQuestionList() as $q) {
1156
-			list($jstmp, $htmltmp)= ScormQuestion::export_question($q, false, $js_id);
1157
-			$js .= $jstmp."\n";
1158
-			$html .= $htmltmp."\n";
1159
-			++$js_id;
1160
-		}
1161
-
1162
-		return array($js, $html);
1163
-	}
1147
+    /**
1148
+     * Export the questions, as a succession of <items>
1149
+     * @author Amand Tihon <[email protected]>
1150
+     */
1151
+    function export_questions()
1152
+    {
1153
+        $js = $html = "";
1154
+        $js_id = 0;
1155
+        foreach ($this->exercise->selectQuestionList() as $q) {
1156
+            list($jstmp, $htmltmp)= ScormQuestion::export_question($q, false, $js_id);
1157
+            $js .= $jstmp."\n";
1158
+            $html .= $htmltmp."\n";
1159
+            ++$js_id;
1160
+        }
1161
+
1162
+        return array($js, $html);
1163
+    }
1164 1164
 }
Please login to merge, or discard this patch.
main/ticket/tickets.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -289,7 +289,7 @@
 block discarded – undo
289 289
         echo '<div class="actions" >';
290 290
         echo '<a href="' . api_get_path(WEB_CODE_PATH) . 'ticket/new_ticket.php?project_id='.$projectId.'">' .
291 291
                 Display::return_icon('add.png', get_lang('Add'), '', '32') .
292
-             '</a>';
292
+                '</a>';
293 293
         echo '</div>';
294 294
     }
295 295
 }
Please login to merge, or discard this patch.