Passed
Push — 1.10.x ( 5654d2...115d5a )
by Yannick
263:14 queued 212:07
created
main/exercice/export/exercise_import.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php // $Id:  $
2 2
 /* For licensing terms, see /license.txt */
3 3
 /**
4
- * @copyright (c) 2001-2006 Universite catholique de Louvain (UCL)
5
- * @package chamilo.exercise
6
- * @author claro team <[email protected]>
7
- */
4
+     * @copyright (c) 2001-2006 Universite catholique de Louvain (UCL)
5
+     * @package chamilo.exercise
6
+     * @author claro team <[email protected]>
7
+     */
8 8
 /**
9
- * Code
10
- */
9
+     * Code
10
+     */
11 11
 
12 12
 require '../../inc/global.inc.php';
13 13
 
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
 // Tool introduction
94 94
 // TODO: These settings to be checked when it is possible.
95 95
 Display::display_introduction_section(TOOL_QUIZ, array(
96
-		'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
97
-		'CreateDocumentDir' => '../../../courses/'.api_get_course_path().'/document/',
98
-		'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/'
99
-	)
96
+        'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
97
+        'CreateDocumentDir' => '../../../courses/'.api_get_course_path().'/document/',
98
+        'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/'
99
+    )
100 100
 );
101 101
 
102 102
 
Please login to merge, or discard this patch.
main/exercice/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 $question Ims2Question object we want to export.
36 36
      */
37
-     function ImsAssessmentItem($question)
38
-     {
37
+        function ImsAssessmentItem($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 A 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 A 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
 /**
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
     function export_presentation()
194 194
     {
195 195
         $out = "<presentation_material><flow_mat><material>\n"
196
-             . "  <mattext><![CDATA[" . formatExerciseQtiDescription($this->exercise->selectDescription()) . "]]></mattext>\n"
197
-             . "</material></flow_mat></presentation_material>\n";
196
+                . "  <mattext><![CDATA[" . formatExerciseQtiDescription($this->exercise->selectDescription()) . "]]></mattext>\n"
197
+                . "</material></flow_mat></presentation_material>\n";
198 198
         return $out;
199 199
     }
200 200
 
@@ -208,15 +208,15 @@  discard block
 block discarded – undo
208 208
         $out = '';
209 209
         if ($n = $this->exercise->getShuffle()) {
210 210
             $out.= "<selection_ordering>"
211
-                 . "  <selection>\n"
212
-                 . "    <selection_number>" . $n . "</selection_number>\n"
213
-                 . "  </selection>\n"
214
-                 . '  <order order_type="Random" />'
215
-                 . "\n</selection_ordering>\n";
211
+                    . "  <selection>\n"
212
+                    . "    <selection_number>" . $n . "</selection_number>\n"
213
+                    . "  </selection>\n"
214
+                    . '  <order order_type="Random" />'
215
+                    . "\n</selection_ordering>\n";
216 216
         } else {
217 217
             $out.= '<selection_ordering sequence_type="Normal">' . "\n"
218
-                 . "  <selection />\n"
219
-                 . "</selection_ordering>\n";
218
+                    . "  <selection />\n"
219
+                    . "</selection_ordering>\n";
220 220
         }
221 221
 
222 222
         return $out;
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
     {
231 231
         $out = "";
232 232
         foreach ($this->exercise->selectQuestionList() as $q) {
233
-        	$out .= export_question_qti($q, false);
233
+            $out .= export_question_qti($q, false);
234 234
         }
235 235
         return $out;
236 236
     }
@@ -247,18 +247,18 @@  discard block
 block discarded – undo
247 247
         $head = $foot = "";
248 248
         if ($standalone) {
249 249
             $head = '<?xml version = "1.0" encoding = "UTF-8" standalone = "no"?>' . "\n"
250
-                  . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n"
251
-                  . "<questestinterop>\n";
250
+                    . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n"
251
+                    . "<questestinterop>\n";
252 252
             $foot = "</questestinterop>\n";
253 253
         }
254 254
         $out = $head
255
-             . $this->start_section()
256
-             . $this->export_duration()
257
-             . $this->export_presentation()
258
-             . $this->export_ordering()
259
-             . $this->export_questions()
260
-             . $this->end_section()
261
-             . $foot;
255
+                . $this->start_section()
256
+                . $this->export_duration()
257
+                . $this->export_presentation()
258
+                . $this->export_ordering()
259
+                . $this->export_questions()
260
+                . $this->end_section()
261
+                . $foot;
262 262
 
263 263
         return $out;
264 264
     }
@@ -304,97 +304,97 @@  discard block
 block discarded – undo
304 304
      * @param $question The Question object we want to export.
305 305
      * @author Anamd Tihon
306 306
      */
307
-     function ImsItem($question)
308
-     {
307
+        function ImsItem($question)
308
+        {
309 309
         $this->question = $question;
310 310
         $this->answer = $question->answer;
311 311
         $this->questionIdent = "QST_" . $question->selectId() ;
312
-     }
313
-
314
-     /**
315
-      * Start the XML flow.
316
-      *
317
-      * This opens the <item> block, with correct attributes.
318
-      *
319
-      * @author Amand Tihon <[email protected]>
320
-      */
321
-      function start_item()
322
-      {
312
+        }
313
+
314
+        /**
315
+         * Start the XML flow.
316
+         *
317
+         * This opens the <item> block, with correct attributes.
318
+         *
319
+         * @author Amand Tihon <[email protected]>
320
+         */
321
+        function start_item()
322
+        {
323 323
         return '<item title="' . cleanAttribute(formatExerciseQtiDescription($this->question->selectTitle())) . '" ident="' . $this->questionIdent . '">' . "\n";
324
-      }
325
-
326
-      /**
327
-       * End the XML flow, closing the </item> tag.
328
-       *
329
-       * @author Amand Tihon <[email protected]>
330
-       */
331
-      function end_item()
332
-      {
324
+        }
325
+
326
+        /**
327
+         * End the XML flow, closing the </item> tag.
328
+         *
329
+         * @author Amand Tihon <[email protected]>
330
+         */
331
+        function end_item()
332
+        {
333 333
         return "</item>\n";
334
-      }
335
-
336
-     /**
337
-      * Create the opening, with the question itself.
338
-      *
339
-      * This means it opens the <presentation> but doesn't close it, as this is the role of end_presentation().
340
-      * In between, the export_responses from the subclass should have been called.
341
-      *
342
-      * @author Amand Tihon <[email protected]>
343
-      */
344
-     function start_presentation()
345
-     {
334
+        }
335
+
336
+        /**
337
+         * Create the opening, with the question itself.
338
+         *
339
+         * This means it opens the <presentation> but doesn't close it, as this is the role of end_presentation().
340
+         * In between, the export_responses from the subclass should have been called.
341
+         *
342
+         * @author Amand Tihon <[email protected]>
343
+         */
344
+        function start_presentation()
345
+        {
346 346
         return '<presentation label="' . $this->questionIdent . '"><flow>' . "\n"
347
-             . '<material><mattext>' . formatExerciseQtiDescription($this->question->selectDescription()) . "</mattext></material>\n";
348
-     }
349
-
350
-     /**
351
-      * End the </presentation> part, opened by export_header.
352
-      *
353
-      * @author Amand Tihon <[email protected]>
354
-      */
355
-     function end_presentation()
356
-     {
347
+                . '<material><mattext>' . formatExerciseQtiDescription($this->question->selectDescription()) . "</mattext></material>\n";
348
+        }
349
+
350
+        /**
351
+         * End the </presentation> part, opened by export_header.
352
+         *
353
+         * @author Amand Tihon <[email protected]>
354
+         */
355
+        function end_presentation()
356
+        {
357 357
         return "</flow></presentation>\n";
358
-     }
359
-
360
-     /**
361
-      * Start the response processing, and declare the default variable, SCORE, at 0 in the outcomes.
362
-      *
363
-      * @author Amand Tihon <[email protected]>
364
-      */
365
-     function start_processing()
366
-     {
358
+        }
359
+
360
+        /**
361
+         * Start the response processing, and declare the default variable, SCORE, at 0 in the outcomes.
362
+         *
363
+         * @author Amand Tihon <[email protected]>
364
+         */
365
+        function start_processing()
366
+        {
367 367
         return '<resprocessing><outcomes><decvar vartype="Integer" defaultval="0" /></outcomes>' . "\n";
368
-     }
369
-
370
-     /**
371
-      * End the response processing part.
372
-      *
373
-      * @author Amand Tihon <[email protected]>
374
-      */
375
-     function end_processing()
376
-     {
368
+        }
369
+
370
+        /**
371
+         * End the response processing part.
372
+         *
373
+         * @author Amand Tihon <[email protected]>
374
+         */
375
+        function end_processing()
376
+        {
377 377
         return "</resprocessing>\n";
378
-     }
379
-
380
-     /**
381
-      * Export the question as an IMS/QTI Item.
382
-      *
383
-      * This is a default behaviour, some classes may want to override this.
384
-      *
385
-      * @param $standalone: Boolean stating if it should be exported as a stand-alone question
386
-      * @return A string, the XML flow for an Item.
387
-      * @author Amand Tihon <[email protected]>
388
-      */
389
-     function export($standalone = False)
390
-     {
378
+        }
379
+
380
+        /**
381
+         * Export the question as an IMS/QTI Item.
382
+         *
383
+         * This is a default behaviour, some classes may want to override this.
384
+         *
385
+         * @param $standalone: Boolean stating if it should be exported as a stand-alone question
386
+         * @return A string, the XML flow for an Item.
387
+         * @author Amand Tihon <[email protected]>
388
+         */
389
+        function export($standalone = False)
390
+        {
391 391
         global $charset;
392 392
         $head = $foot = "";
393 393
 
394 394
         if ($standalone) {
395 395
             $head = '<?xml version = "1.0" encoding = "'.$charset.'" standalone = "no"?>' . "\n"
396
-                  . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n"
397
-                  . "<questestinterop>\n";
396
+                    . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n"
397
+                    . "<questestinterop>\n";
398 398
             $foot = "</questestinterop>\n";
399 399
         }
400 400
 
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
             . $this->answer->imsExportFeedback($this->questionIdent)
410 410
             . $this->end_item()
411 411
             . $foot;
412
-     }
412
+        }
413 413
 }
414 414
 
415 415
 /**
@@ -447,9 +447,9 @@  discard block
 block discarded – undo
447 447
     $question->type = $qst->type;
448 448
     $question->question = $qst->question;
449 449
     $question->description = $qst->description;
450
-	$question->weighting=$qst->weighting;
451
-	$question->position=$qst->position;
452
-	$question->picture=$qst->picture;
450
+    $question->weighting=$qst->weighting;
451
+    $question->position=$qst->position;
452
+    $question->picture=$qst->picture;
453 453
     $ims = new ImsAssessmentItem($question);
454 454
 
455 455
     return $ims->export($standalone);
Please login to merge, or discard this patch.
main/exercice/export/qti2/qti2_classes.php 1 patch
Indentation   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -55,18 +55,18 @@  discard block
 block discarded – undo
55 55
 
56 56
     function createAnswersForm($form)
57 57
     {
58
-    	return true;
58
+        return true;
59 59
     }
60 60
 
61 61
     function processAnswersCreation($form)
62 62
     {
63
-    	return true;
63
+        return true;
64 64
     }
65 65
 }
66 66
 /**
67
- * Class
68
- * @package chamilo.exercise
69
- */
67
+     * Class
68
+     * @package chamilo.exercise
69
+     */
70 70
 class ImsAnswerMultipleChoice extends Answer
71 71
 {
72 72
     /**
@@ -76,21 +76,21 @@  discard block
 block discarded – undo
76 76
     public function imsExportResponses($questionIdent, $questionStatment)
77 77
     {
78 78
         // @todo getAnswersList() converts the answers using api_html_entity_decode()
79
-		$this->answerList = $this->getAnswersList(true);
79
+        $this->answerList = $this->getAnswersList(true);
80 80
         $out  = '    <choiceInteraction responseIdentifier="' . $questionIdent . '" >' . "\n";
81 81
         $out .= '      <prompt><![CDATA['.formatExerciseQtiTitle($questionStatment) . ']]></prompt>'. "\n";
82
-		if (is_array($this->answerList)) {
83
-	        foreach ($this->answerList as $current_answer) {
84
-	            $out .= '<simpleChoice identifier="answer_' . $current_answer['id'] . '" fixed="false">
82
+        if (is_array($this->answerList)) {
83
+            foreach ($this->answerList as $current_answer) {
84
+                $out .= '<simpleChoice identifier="answer_' . $current_answer['id'] . '" fixed="false">
85 85
                          <![CDATA['.formatExerciseQtiTitle($current_answer['answer']).']]>';
86
-	            if (isset($current_answer['comment']) && $current_answer['comment'] != '') {
87
-	                $out .= '<feedbackInline identifier="answer_' . $current_answer['id'] . '">
86
+                if (isset($current_answer['comment']) && $current_answer['comment'] != '') {
87
+                    $out .= '<feedbackInline identifier="answer_' . $current_answer['id'] . '">
88 88
 	                         <![CDATA['.formatExerciseQtiTitle($current_answer['comment']).']]>
89 89
 	                         </feedbackInline>';
90
-	            }
91
-	            $out .= '</simpleChoice>'. "\n";
92
-	        }
93
-		}
90
+                }
91
+                $out .= '</simpleChoice>'. "\n";
92
+            }
93
+        }
94 94
         $out .= '    </choiceInteraction>'. "\n";
95 95
 
96 96
         return $out;
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
      */
103 103
     public function imsExportResponsesDeclaration($questionIdent)
104 104
     {
105
-		$this->answerList = $this->getAnswersList(true);
106
-		$type = $this->getQuestionType();
105
+        $this->answerList = $this->getAnswersList(true);
106
+        $type = $this->getQuestionType();
107 107
         if ($type == MCMA)  $cardinality = 'multiple'; else $cardinality = 'single';
108 108
 
109 109
         $out = '  <responseDeclaration identifier="' . $questionIdent . '" cardinality="' . $cardinality . '" baseType="identifier">' . "\n";
@@ -111,25 +111,25 @@  discard block
 block discarded – undo
111 111
         // Match the correct answers.
112 112
 
113 113
         $out .= '    <correctResponse>'. "\n";
114
-		if (is_array($this->answerList)) {
115
-	        foreach($this->answerList as $current_answer) {
116
-	            if ($current_answer['correct']) {
117
-	                $out .= '      <value>answer_'. $current_answer['id'] .'</value>'. "\n";
118
-	            }
119
-	        }
120
-		}
114
+        if (is_array($this->answerList)) {
115
+            foreach($this->answerList as $current_answer) {
116
+                if ($current_answer['correct']) {
117
+                    $out .= '      <value>answer_'. $current_answer['id'] .'</value>'. "\n";
118
+                }
119
+            }
120
+        }
121 121
         $out .= '    </correctResponse>'. "\n";
122 122
 
123 123
         //Add the grading
124 124
 
125 125
         $out .= '    <mapping>'. "\n";
126
-		if (is_array($this->answerList)) {
127
-	        foreach($this->answerList as $current_answer) {
128
-	            if (isset($current_answer['grade'])) {
129
-	                $out .= ' <mapEntry mapKey="answer_'. $current_answer['id'] .'" mappedValue="'.$current_answer['grade'].'" />'. "\n";
130
-	            }
131
-	        }
132
-		}
126
+        if (is_array($this->answerList)) {
127
+            foreach($this->answerList as $current_answer) {
128
+                if (isset($current_answer['grade'])) {
129
+                    $out .= ' <mapEntry mapKey="answer_'. $current_answer['id'] .'" mappedValue="'.$current_answer['grade'].'" />'. "\n";
130
+                }
131
+            }
132
+        }
133 133
         $out .= '    </mapping>'. "\n";
134 134
         $out .= '  </responseDeclaration>'. "\n";
135 135
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      */
151 151
     public function imsExportResponses($questionIdent, $questionStatment)
152 152
     {
153
-		$this->answerList = $this->getAnswersList(true);
153
+        $this->answerList = $this->getAnswersList(true);
154 154
         $text = '';
155 155
         $text .= $this->answerText;
156 156
         if (is_array($this->answerList)) {
@@ -171,28 +171,28 @@  discard block
 block discarded – undo
171 171
      */
172 172
     public function imsExportResponsesDeclaration($questionIdent)
173 173
     {
174
-		$this->answerList = $this->getAnswersList(true);
175
-		$this->gradeList = $this->getGradesList();
174
+        $this->answerList = $this->getAnswersList(true);
175
+        $this->gradeList = $this->getGradesList();
176 176
         $out = '';
177
-		if (is_array($this->answerList)) {
178
-	        foreach ($this->answerList as $answer) {
179
-	        	$answerKey = $answer['id'];
180
-	        	$answer = $answer['answer'];
181
-	            $out .= '  <responseDeclaration identifier="fill_' . $answerKey . '" cardinality="single" baseType="identifier">' . "\n";
182
-	            $out .= '    <correctResponse>'. "\n";
177
+        if (is_array($this->answerList)) {
178
+            foreach ($this->answerList as $answer) {
179
+                $answerKey = $answer['id'];
180
+                $answer = $answer['answer'];
181
+                $out .= '  <responseDeclaration identifier="fill_' . $answerKey . '" cardinality="single" baseType="identifier">' . "\n";
182
+                $out .= '    <correctResponse>'. "\n";
183 183
                 $out .= '      <value><![CDATA['.formatExerciseQtiTitle($answer).']]></value>'. "\n";
184
-	            $out .= '    </correctResponse>'. "\n";
185
-	            if (isset($this->gradeList[$answerKey])) {
186
-	                $out .= '    <mapping>'. "\n";
187
-	                $out .= '      <mapEntry mapKey="'.$answer.'" mappedValue="'.$this->gradeList[$answerKey].'"/>'. "\n";
188
-	                $out .= '    </mapping>'. "\n";
189
-	            }
190
-
191
-	            $out .= '  </responseDeclaration>'. "\n";
192
-	        }
193
-		}
194
-
195
-       return $out;
184
+                $out .= '    </correctResponse>'. "\n";
185
+                if (isset($this->gradeList[$answerKey])) {
186
+                    $out .= '    <mapping>'. "\n";
187
+                    $out .= '      <mapEntry mapKey="'.$answer.'" mappedValue="'.$this->gradeList[$answerKey].'"/>'. "\n";
188
+                    $out .= '    </mapping>'. "\n";
189
+                }
190
+
191
+                $out .= '  </responseDeclaration>'. "\n";
192
+            }
193
+        }
194
+
195
+        return $out;
196 196
     }
197 197
 }
198 198
 
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
      */
208 208
     public function imsExportResponses($questionIdent, $questionStatment)
209 209
     {
210
-		$this->answerList = $this->getAnswersList(true);
211
-		$maxAssociation = max(count($this->leftList), count($this->rightList));
210
+        $this->answerList = $this->getAnswersList(true);
211
+        $maxAssociation = max(count($this->leftList), count($this->rightList));
212 212
 
213 213
         $out = "";
214 214
 
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
         //add left column
219 219
 
220 220
         $out .= '  <simpleMatchSet>'. "\n";
221
-		if (is_array($this->leftList)) {
222
-	        foreach ($this->leftList as $leftKey=>$leftElement) {
223
-	            $out .= '
221
+        if (is_array($this->leftList)) {
222
+            foreach ($this->leftList as $leftKey=>$leftElement) {
223
+                $out .= '
224 224
 	            <simpleAssociableChoice identifier="left_'.$leftKey.'" >
225 225
 	                <![CDATA['.formatExerciseQtiTitle($leftElement['answer']).']]>
226 226
 	            </simpleAssociableChoice>'. "\n";
227
-	        }
228
-    	}
227
+            }
228
+        }
229 229
 
230 230
         $out .= '  </simpleMatchSet>'. "\n";
231 231
 
@@ -235,14 +235,14 @@  discard block
 block discarded – undo
235 235
 
236 236
         $i = 0;
237 237
 
238
-		if (is_array($this->rightList)) {
239
-	        foreach($this->rightList as $rightKey=>$rightElement) {
240
-	            $out .= '<simpleAssociableChoice identifier="right_'.$i.'" >
238
+        if (is_array($this->rightList)) {
239
+            foreach($this->rightList as $rightKey=>$rightElement) {
240
+                $out .= '<simpleAssociableChoice identifier="right_'.$i.'" >
241 241
 	                    <![CDATA['.formatExerciseQtiTitle($rightElement['answer']).']]>
242 242
 	                    </simpleAssociableChoice>'. "\n";
243
-	            $i++;
244
-	        }
245
-		}
243
+                $i++;
244
+            }
245
+        }
246 246
         $out .= '  </simpleMatchSet>'. "\n";
247 247
         $out .= '</matchInteraction>'. "\n";
248 248
 
@@ -254,30 +254,30 @@  discard block
 block discarded – undo
254 254
      */
255 255
     public function imsExportResponsesDeclaration($questionIdent)
256 256
     {
257
-		$this->answerList = $this->getAnswersList(true);
257
+        $this->answerList = $this->getAnswersList(true);
258 258
         $out =  '  <responseDeclaration identifier="' . $questionIdent . '" cardinality="single" baseType="identifier">' . "\n";
259 259
         $out .= '    <correctResponse>' . "\n";
260 260
 
261 261
         $gradeArray = array();
262
-		if (is_array($this->leftList)) {
263
-	        foreach ($this->leftList as $leftKey=>$leftElement) {
264
-	            $i=0;
265
-	            foreach ($this->rightList as $rightKey=>$rightElement) {
266
-	                if (($leftElement['match'] == $rightElement['code'])) {
267
-	                    $out .= '      <value>left_' . $leftKey . ' right_'.$i.'</value>'. "\n";
268
-
269
-	                    $gradeArray['left_' . $leftKey . ' right_'.$i] = $leftElement['grade'];
270
-	                }
271
-	                $i++;
272
-	            }
273
-	        }
274
-		}
262
+        if (is_array($this->leftList)) {
263
+            foreach ($this->leftList as $leftKey=>$leftElement) {
264
+                $i=0;
265
+                foreach ($this->rightList as $rightKey=>$rightElement) {
266
+                    if (($leftElement['match'] == $rightElement['code'])) {
267
+                        $out .= '      <value>left_' . $leftKey . ' right_'.$i.'</value>'. "\n";
268
+
269
+                        $gradeArray['left_' . $leftKey . ' right_'.$i] = $leftElement['grade'];
270
+                    }
271
+                    $i++;
272
+                }
273
+            }
274
+        }
275 275
         $out .= '    </correctResponse>'. "\n";
276 276
         $out .= '    <mapping>' . "\n";
277 277
         if (is_array($gradeArray)) {
278
-	        foreach ($gradeArray as $gradeKey=>$grade) {
279
-	            $out .= '          <mapEntry mapKey="'.$gradeKey.'" mappedValue="'.$grade.'"/>' . "\n";
280
-	        }
278
+            foreach ($gradeArray as $gradeKey=>$grade) {
279
+                $out .= '          <mapEntry mapKey="'.$gradeKey.'" mappedValue="'.$grade.'"/>' . "\n";
280
+            }
281 281
         }
282 282
         $out .= '    </mapping>' . "\n";
283 283
         $out .= '  </responseDeclaration>'. "\n";
@@ -298,49 +298,49 @@  discard block
 block discarded – undo
298 298
      */
299 299
     public function imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='')
300 300
     {
301
-		$this->answerList = $this->getAnswersList(true);
302
-		$questionMedia = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/images/'.$questionMedia;
303
-		$mimetype = mime_content_type($questionMedia);
304
-		if(empty($mimetype)){
305
-			$mimetype = 'image/jpeg';
306
-		}
307
-
308
-		$text = '      <p>'.$questionStatment.'</p>'."\n";
309
-		$text .= '      <graphicOrderInteraction responseIdentifier="hotspot_'.$questionIdent.'">'."\n";
310
-		$text .= '        <prompt>'.$questionDesc.'</prompt>'."\n";
311
-		$text .= '        <object type="'.$mimetype.'" width="250" height="230" data="'.$questionMedia.'">-</object>'."\n";
301
+        $this->answerList = $this->getAnswersList(true);
302
+        $questionMedia = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/images/'.$questionMedia;
303
+        $mimetype = mime_content_type($questionMedia);
304
+        if(empty($mimetype)){
305
+            $mimetype = 'image/jpeg';
306
+        }
307
+
308
+        $text = '      <p>'.$questionStatment.'</p>'."\n";
309
+        $text .= '      <graphicOrderInteraction responseIdentifier="hotspot_'.$questionIdent.'">'."\n";
310
+        $text .= '        <prompt>'.$questionDesc.'</prompt>'."\n";
311
+        $text .= '        <object type="'.$mimetype.'" width="250" height="230" data="'.$questionMedia.'">-</object>'."\n";
312 312
         if (is_array($this->answerList)) {
313
-	        foreach ($this->answerList as $key=>$answer) {
314
-	        	$key = $answer['id'];
315
-	        	$answerTxt = $answer['answer'];
316
-	        	$len = api_strlen($answerTxt);
317
-	        	//coords are transformed according to QTIv2 rules here: http://www.imsproject.org/question/qtiv2p1pd/imsqti_infov2p1pd.html#element10663
318
-	        	$coords = '';
319
-	        	$type = 'default';
320
-	        	switch($answer['hotspot_type']){
321
-	        		case 'square':
322
-	        			$type = 'rect';
323
-						$res = array();
324
-						$coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/',$answer['hotspot_coord'],$res);
325
-						$coords = $res[1].','.$res[2].','.((int)$res[1]+(int)$res[3]).",".((int)$res[2]+(int)$res[4]);
326
-	        			break;
327
-	        		case 'circle':
328
-	        			$type = 'circle';
329
-			 			$res = array();
330
-						$coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/',$answer['hotspot_coord'],$res);
331
-						$coords = $res[1].','.$res[2].','.sqrt(pow(($res[1]-$res[3]),2)+pow(($res[2]-$res[4])));
332
-	        			break;
333
-	        		case 'poly':
334
-	        			$type = 'poly';
335
-						$coords = str_replace(array(';','|'),array(',',','),$answer['hotspot_coord']);
336
-	        			break;
337
-	        		 case 'delineation' :
338
-	        			$type = 'delineation';
339
-						$coords = str_replace(array(';','|'),array(',',','),$answer['hotspot_coord']);
340
-	        			break;
341
-	        	}
342
-	            $text .= '        <hotspotChoice shape="'.$type.'" coords="'.$coords.'" identifier="'.$key.'"/>'."\n";
343
-	        }
313
+            foreach ($this->answerList as $key=>$answer) {
314
+                $key = $answer['id'];
315
+                $answerTxt = $answer['answer'];
316
+                $len = api_strlen($answerTxt);
317
+                //coords are transformed according to QTIv2 rules here: http://www.imsproject.org/question/qtiv2p1pd/imsqti_infov2p1pd.html#element10663
318
+                $coords = '';
319
+                $type = 'default';
320
+                switch($answer['hotspot_type']){
321
+                    case 'square':
322
+                        $type = 'rect';
323
+                        $res = array();
324
+                        $coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/',$answer['hotspot_coord'],$res);
325
+                        $coords = $res[1].','.$res[2].','.((int)$res[1]+(int)$res[3]).",".((int)$res[2]+(int)$res[4]);
326
+                        break;
327
+                    case 'circle':
328
+                        $type = 'circle';
329
+                            $res = array();
330
+                        $coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/',$answer['hotspot_coord'],$res);
331
+                        $coords = $res[1].','.$res[2].','.sqrt(pow(($res[1]-$res[3]),2)+pow(($res[2]-$res[4])));
332
+                        break;
333
+                    case 'poly':
334
+                        $type = 'poly';
335
+                        $coords = str_replace(array(';','|'),array(',',','),$answer['hotspot_coord']);
336
+                        break;
337
+                        case 'delineation' :
338
+                        $type = 'delineation';
339
+                        $coords = str_replace(array(';','|'),array(',',','),$answer['hotspot_coord']);
340
+                        break;
341
+                }
342
+                $text .= '        <hotspotChoice shape="'.$type.'" coords="'.$coords.'" identifier="'.$key.'"/>'."\n";
343
+            }
344 344
         }
345 345
         $text .= '      </graphicOrderInteraction>'."\n";
346 346
         $out = $text;
@@ -353,23 +353,23 @@  discard block
 block discarded – undo
353 353
      */
354 354
     public function imsExportResponsesDeclaration($questionIdent)
355 355
     {
356
-		$this->answerList = $this->getAnswersList(true);
357
-		$this->gradeList = $this->getGradesList();
356
+        $this->answerList = $this->getAnswersList(true);
357
+        $this->gradeList = $this->getGradesList();
358 358
         $out = '';
359 359
         $out .= '  <responseDeclaration identifier="hotspot_'.$questionIdent.'" cardinality="ordered" baseType="identifier">' . "\n";
360 360
         $out .= '    <correctResponse>'. "\n";
361 361
 
362
-		if (is_array($this->answerList)) {
363
-	        foreach ($this->answerList as $answerKey=>$answer)  {
364
-	        	$answerKey = $answer['id'];
365
-	        	$answer = $answer['answer'];
366
-	            $out .= '<value><![CDATA['.formatExerciseQtiTitle($answerKey).']]></value>';
367
-	        }
368
-		}
362
+        if (is_array($this->answerList)) {
363
+            foreach ($this->answerList as $answerKey=>$answer)  {
364
+                $answerKey = $answer['id'];
365
+                $answer = $answer['answer'];
366
+                $out .= '<value><![CDATA['.formatExerciseQtiTitle($answerKey).']]></value>';
367
+            }
368
+        }
369 369
         $out .= '    </correctResponse>'. "\n";
370 370
         $out .= '  </responseDeclaration>'. "\n";
371 371
 
372
-       return $out;
372
+        return $out;
373 373
     }
374 374
 }
375 375
 
@@ -384,14 +384,14 @@  discard block
 block discarded – undo
384 384
      * Export the question part as a matrix-choice, with only one possible answer per line.
385 385
      */
386 386
     public function imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='')
387
-	{
388
-		return '';
389
-	}
387
+    {
388
+        return '';
389
+    }
390 390
     /**
391 391
      *
392 392
      */
393 393
     public function imsExportResponsesDeclaration($questionIdent)
394 394
     {
395
-    	return '';
395
+        return '';
396 396
     }
397 397
 }
Please login to merge, or discard this patch.
main/exercice/export/aiken/aiken_classes.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* For licensing terms, see /license.txt */
3 3
 /**
4
- * @author Claro Team <[email protected]>
5
- * @author Yannick Warnier <[email protected]> - updated ImsAnswerHotspot to match QTI norms
6
- * @author César Perales <[email protected]> Updated function names and import files for Aiken format support
7
- * @package chamilo.exercise
8
- */
4
+     * @author Claro Team <[email protected]>
5
+     * @author Yannick Warnier <[email protected]> - updated ImsAnswerHotspot to match QTI norms
6
+     * @author César Perales <[email protected]> Updated function names and import files for Aiken format support
7
+     * @package chamilo.exercise
8
+     */
9 9
 
10 10
 if ( count( get_included_files() ) == 1 ) die( '---' );
11 11
 
12 12
 if (!function_exists('mime_content_type')) {
13
-	function mime_content_type($filename) {
14
-		return DocumentManager::file_get_mime_type((string)$filename);
15
-	}
13
+    function mime_content_type($filename) {
14
+        return DocumentManager::file_get_mime_type((string)$filename);
15
+    }
16 16
 }
17 17
 
18 18
 /**
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         {
30 30
             case MCUA :
31 31
                 $answer = new AikenAnswerMultipleChoice($this->id);
32
-            	return $answer;
32
+                return $answer;
33 33
             default :
34 34
                 $answer = null;
35 35
                 break;
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
38 38
     }
39 39
     function createAnswersForm($form)
40 40
     {
41
-    	return true;
41
+        return true;
42 42
     }
43 43
     function processAnswersCreation($form)
44 44
     {
45
-    	return true;
45
+        return true;
46 46
     }
47 47
 }
48 48
 
Please login to merge, or discard this patch.
main/exercice/unique_answer.class.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -447,7 +447,7 @@
 block discarded – undo
447 447
         $position = $row_max->max_position + 1;
448 448
 
449 449
         // Insert a new answer
450
-       $params = [
450
+        $params = [
451 451
             'c_id' => $course_id,
452 452
             'id' => $id,
453 453
             'question_id' => $question_id,
Please login to merge, or discard this patch.
main/exercice/hotspot_actionscript.as.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
 
31 31
 // Query db for answers
32 32
 if ($answer_type==HOT_SPOT_DELINEATION) {
33
-	$sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS
33
+    $sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS
34 34
 	        WHERE c_id = $course_id AND question_id = ".intval($questionId)." AND hotspot_type = 'delineation' ORDER BY id";
35 35
 } else {
36
-	$sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS
36
+    $sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS
37 37
 	        WHERE c_id = $course_id AND question_id = ".intval($questionId)." ORDER BY id";
38 38
 }
39 39
 $result = Database::query($sql);
@@ -74,37 +74,37 @@  discard block
 block discarded – undo
74 74
     $hotSpot['id'] = $hotspot['id'];
75 75
     $hotSpot['answer'] = $hotspot['answer'];
76 76
 
77
-	// Square or rectancle
78
-	if ($hotspot['hotspot_type'] == 'square' )
79
-	{
77
+    // Square or rectancle
78
+    if ($hotspot['hotspot_type'] == 'square' )
79
+    {
80 80
         $hotSpot['type'] = 'square';
81
-	}
82
-	// Circle or ovale
83
-	if ($hotspot['hotspot_type'] == 'circle')
84
-	{
81
+    }
82
+    // Circle or ovale
83
+    if ($hotspot['hotspot_type'] == 'circle')
84
+    {
85 85
         $hotSpot['type'] = 'circle';
86
-	}
87
-	// Polygon
88
-	if ($hotspot['hotspot_type'] == 'poly')
89
-	{
86
+    }
87
+    // Polygon
88
+    if ($hotspot['hotspot_type'] == 'poly')
89
+    {
90 90
         $hotSpot['type'] = 'poly';
91
-	}
92
-	// Delineation
93
-	if ($hotspot['hotspot_type'] == 'delineation')
94
-	{
91
+    }
92
+    // Delineation
93
+    if ($hotspot['hotspot_type'] == 'delineation')
94
+    {
95 95
         $hotSpot['type'] = 'delineation';
96
-	}
97
-	// No error
98
-	if ($hotspot['hotspot_type'] == 'noerror')
99
-	{
96
+    }
97
+    // No error
98
+    if ($hotspot['hotspot_type'] == 'noerror')
99
+    {
100 100
         $hotSpot['type'] = 'noerror';
101
-	}
101
+    }
102 102
 
103
-	// This is a good answer, count + 1 for nmbr of clicks
104
-	if ($hotspot['hotspot_type'] > 0)
105
-	{
106
-		$nmbrTries++;
107
-	}
103
+    // This is a good answer, count + 1 for nmbr of clicks
104
+    if ($hotspot['hotspot_type'] > 0)
105
+    {
106
+        $nmbrTries++;
107
+    }
108 108
 
109 109
     $hotSpot['coord'] = $hotspot['hotspot_coordinates'];
110 110
 
Please login to merge, or discard this patch.
main/exercice/Hpdownload.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
 //Event::event_download($doc_url);
24 24
 if (isset($_course['path'])) {
25 25
     $course_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
26
-	$full_file_name = $course_path.Security::remove_XSS($doc_url);
26
+    $full_file_name = $course_path.Security::remove_XSS($doc_url);
27 27
 } else {
28 28
     $course_path = api_get_path(SYS_COURSE_PATH).$cid.'/document';
29
-	$full_file_name = $course_path.Security::remove_XSS($doc_url);
29
+    $full_file_name = $course_path.Security::remove_XSS($doc_url);
30 30
 }
31 31
 
32 32
 if(!is_file($full_file_name)) {
33
-	exit;
33
+    exit;
34 34
 }
35 35
 
36 36
 if (!Security::check_abs_path($full_file_name, $course_path.'/')) {
@@ -41,16 +41,16 @@  discard block
 block discarded – undo
41 41
 $extension=strtolower($extension[sizeof($extension)-1]);
42 42
 
43 43
 switch($extension) {
44
-	case 'gz':		$content_type='application/x-gzip';			break;
45
-	case 'zip':		$content_type='application/zip';			break;
46
-	case 'pdf':		$content_type='application/pdf';			break;
47
-	case 'png':		$content_type='image/png';					break;
48
-	case 'gif':		$content_type='image/gif';					break;
49
-	case 'jpg':		$content_type='image/jpeg';					break;
50
-	case 'txt':		$content_type='text/plain';					break;
51
-	case 'htm':		$content_type='text/html';					break;
52
-	case 'html':	$content_type='text/html';					break;
53
-	default:		$content_type='application/octet-stream';	break;
44
+    case 'gz':		$content_type='application/x-gzip';			break;
45
+    case 'zip':		$content_type='application/zip';			break;
46
+    case 'pdf':		$content_type='application/pdf';			break;
47
+    case 'png':		$content_type='image/png';					break;
48
+    case 'gif':		$content_type='image/gif';					break;
49
+    case 'jpg':		$content_type='image/jpeg';					break;
50
+    case 'txt':		$content_type='text/plain';					break;
51
+    case 'htm':		$content_type='text/html';					break;
52
+    case 'html':	$content_type='text/html';					break;
53
+    default:		$content_type='application/octet-stream';	break;
54 54
 }
55 55
 
56 56
 header('Content-disposition: filename='.$filename);
@@ -68,23 +68,23 @@  discard block
 block discarded – undo
68 68
 */
69 69
 
70 70
 if ($content_type == 'text/html') {
71
-	$directory_name = dirname($full_file_name);
71
+    $directory_name = dirname($full_file_name);
72 72
 
73
-	$dir=str_replace(array('\\',$_configuration['root_sys']."courses/".$_course['path'].'/document'),array('/',''),$directory_name);
73
+    $dir=str_replace(array('\\',$_configuration['root_sys']."courses/".$_course['path'].'/document'),array('/',''),$directory_name);
74 74
 
75
-	if($dir[strlen($dir)-1] != '/') {
76
-		$dir.='/';
77
-	}
75
+    if($dir[strlen($dir)-1] != '/') {
76
+        $dir.='/';
77
+    }
78 78
 
79 79
 
80
-	//Parse whole file at one
81
-	$fp = fopen($full_file_name, "r");
82
-	$file_content = fread ($fp, filesize ($full_file_name));
83
-	fclose($fp);
84
-	//$file_content = api_replace_parameter($dir, $file_content, "src");
85
-	//$file_content = api_replace_parameter($dir, $file_content, "href");
80
+    //Parse whole file at one
81
+    $fp = fopen($full_file_name, "r");
82
+    $file_content = fread ($fp, filesize ($full_file_name));
83
+    fclose($fp);
84
+    //$file_content = api_replace_parameter($dir, $file_content, "src");
85
+    //$file_content = api_replace_parameter($dir, $file_content, "href");
86 86
 
87
-	/*
87
+    /*
88 88
 	//parse line per line
89 89
 	$file_content_array = file($full_file_name);
90 90
 
@@ -98,16 +98,16 @@  discard block
 block discarded – undo
98 98
 
99 99
 
100 100
     $exercisePath = api_get_self();
101
-  	$exfile = explode('/',$exercisePath);
102
-  	$exfile = $exfile[sizeof($exfile)-1];
103
-  	$exercisePath = substr($exercisePath,0,strpos($exercisePath,$exfile));
104
-  	$exercisePath = $exercisePath;
101
+        $exfile = explode('/',$exercisePath);
102
+        $exfile = $exfile[sizeof($exfile)-1];
103
+        $exercisePath = substr($exercisePath,0,strpos($exercisePath,$exfile));
104
+        $exercisePath = $exercisePath;
105 105
 
106
-		$content = $file_content;
107
-		$mit = "function Finish(){";
106
+        $content = $file_content;
107
+        $mit = "function Finish(){";
108 108
 
109
-		$js_content = "var SaveScoreVariable = 0; // This variable included by Dokeos System\n".
110
-		"function mySaveScore() // This function included by Dokeos System\n".
109
+        $js_content = "var SaveScoreVariable = 0; // This variable included by Dokeos System\n".
110
+        "function mySaveScore() // This function included by Dokeos System\n".
111 111
 "{\n".
112 112
 "   if (SaveScoreVariable==0)\n".
113 113
 "		{\n".
@@ -125,23 +125,23 @@  discard block
 block discarded – undo
125 125
 "// Must be included \n".
126 126
 "function Finish(){\n".
127 127
 " mySaveScore();";
128
-		$newcontent = str_replace($mit,$js_content,$content);
128
+        $newcontent = str_replace($mit,$js_content,$content);
129 129
 
130
-		$prehref="javascript:void(0);";
131
-		$posthref=$_configuration['root_web']."main/exercice/Hpdownload.php?doc_url=".$doc_url."&cid=".$cid."&uid=".$uid;
132
-		$newcontent = str_replace($prehref,$posthref,$newcontent);
130
+        $prehref="javascript:void(0);";
131
+        $posthref=$_configuration['root_web']."main/exercice/Hpdownload.php?doc_url=".$doc_url."&cid=".$cid."&uid=".$uid;
132
+        $newcontent = str_replace($prehref,$posthref,$newcontent);
133 133
 
134 134
 
135
-		$prehref="class=\"GridNum\" onclick=";
136
-		$posthref="class=\"GridNum\" onMouseover=";
137
-		$newcontent = str_replace($prehref,$posthref,$newcontent);
135
+        $prehref="class=\"GridNum\" onclick=";
136
+        $posthref="class=\"GridNum\" onMouseover=";
137
+        $newcontent = str_replace($prehref,$posthref,$newcontent);
138 138
 
139 139
 
140
-		header('Content-length: '.strlen($newcontent));
141
-		// Dipsp.
142
-		echo $newcontent;
140
+        header('Content-length: '.strlen($newcontent));
141
+        // Dipsp.
142
+        echo $newcontent;
143 143
 
144
-	exit();
144
+    exit();
145 145
 }
146 146
 
147 147
 //normal case, all non-html files
Please login to merge, or discard this patch.
main/exercice/hotpotatoes_exercise_result.class.php 1 patch
Indentation   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@  discard block
 block discarded – undo
14 14
     //stores the results
15 15
     private $results = array();
16 16
 
17
-	/**
18
-	 * Gets the results of all students (or just one student if access is limited)
19
-	 * @param	string		The document path (for HotPotatoes retrieval)
20
-	 * @param	integer		User ID. Optional. If no user ID is provided, we take all the results. Defauts to null
21
-	 */
22
-	public function getExercisesReporting($document_path, $hotpotato_name)
17
+    /**
18
+     * Gets the results of all students (or just one student if access is limited)
19
+     * @param	string		The document path (for HotPotatoes retrieval)
20
+     * @param	integer		User ID. Optional. If no user ID is provided, we take all the results. Defauts to null
21
+     */
22
+    public function getExercisesReporting($document_path, $hotpotato_name)
23 23
     {
24
-		$return = array();
24
+        $return = array();
25 25
         $TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
26 26
         $TBL_TRACK_HOTPOTATOES	= Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
27 27
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $hotpotato_name  = Database::escape_string($hotpotato_name);
34 34
 
35 35
         if (!empty($exercise_id)) {
36
-          $session_id_and .= " AND exe_exo_id = $exercise_id ";
36
+            $session_id_and .= " AND exe_exo_id = $exercise_id ";
37 37
         }
38 38
 
39 39
         if (empty($user_id)) {
@@ -110,25 +110,25 @@  discard block
 block discarded – undo
110 110
         $this->results = $return;
111 111
 
112 112
         return true;
113
-	}
113
+    }
114 114
 
115 115
 
116
-	/**
117
-	 * Exports the complete report as a CSV file
118
-	 * @param	string		Document path inside the document tool
119
-	 * @param	integer		Optional user ID
120
-	 * @param	boolean		Whether to include user fields or not
121
-	 * @return	boolean		False on error
122
-	 */
123
-	public function exportCompleteReportCSV($document_path='', $hotpotato_name)
116
+    /**
117
+     * Exports the complete report as a CSV file
118
+     * @param	string		Document path inside the document tool
119
+     * @param	integer		Optional user ID
120
+     * @param	boolean		Whether to include user fields or not
121
+     * @return	boolean		False on error
122
+     */
123
+    public function exportCompleteReportCSV($document_path='', $hotpotato_name)
124 124
     {
125
-		global $charset;
126
-		$this->getExercisesReporting($document_path, $hotpotato_name);
127
-		$filename = 'exercise_results_'.date('YmdGis').'.csv';
128
-		if (!empty($user_id)) {
129
-			$filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv';
130
-		}
131
-		$data = '';
125
+        global $charset;
126
+        $this->getExercisesReporting($document_path, $hotpotato_name);
127
+        $filename = 'exercise_results_'.date('YmdGis').'.csv';
128
+        if (!empty($user_id)) {
129
+            $filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv';
130
+        }
131
+        $data = '';
132 132
 
133 133
         if (api_is_western_name_order()) {
134 134
             if(!empty($this->results[0]['first_name'])) {
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         }
148 148
         $data .= get_lang('Email').';';
149 149
 
150
-		/*if ($export_user_fields) {
150
+        /*if ($export_user_fields) {
151 151
 			//show user fields section with a big th colspan that spans over all fields
152 152
 			$extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1);
153 153
 			$num = count($extra_user_fields);
@@ -156,25 +156,25 @@  discard block
 block discarded – undo
156 156
 			}
157 157
 		}*/
158 158
 
159
-		$data .= get_lang('Title').';';
160
-		$data .= get_lang('StartDate').';';
161
-		$data .= get_lang('Score').';';
162
-		$data .= get_lang('Total').';';
163
-		$data .= "\n";
159
+        $data .= get_lang('Title').';';
160
+        $data .= get_lang('StartDate').';';
161
+        $data .= get_lang('Score').';';
162
+        $data .= get_lang('Total').';';
163
+        $data .= "\n";
164 164
 
165
-		//results
166
-		foreach($this->results as $row) {
165
+        //results
166
+        foreach($this->results as $row) {
167 167
             if (api_is_western_name_order()) {
168
-              $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
169
-              $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
168
+                $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
169
+                $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
170 170
             } else {
171
-              $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
172
-              $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
171
+                $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
172
+                $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
173 173
             }
174 174
 
175 175
             $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';';
176 176
 
177
-			/*if ($export_user_fields) {
177
+            /*if ($export_user_fields) {
178 178
 				//show user fields data, if any, for this user
179 179
 				$user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true);
180 180
 				foreach($user_fields_values as $value) {
@@ -182,40 +182,40 @@  discard block
 block discarded – undo
182 182
 				}
183 183
 			}*/
184 184
 
185
-			$data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';';
186
-			$data .= str_replace("\r\n",'  ',$row['exe_date']).';';
187
-			$data .= str_replace("\r\n",'  ',$row['result']).';';
188
-			$data .= str_replace("\r\n",'  ',$row['max']).';';
189
-			$data .= "\n";
190
-		}
191
-
192
-		//output the results
193
-		$len = strlen($data);
194
-		header('Content-type: application/octet-stream');
195
-		header('Content-Type: application/force-download');
196
-		header('Content-length: '.$len);
197
-		if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) {
198
-			header('Content-Disposition: filename= '.$filename);
199
-		} else {
200
-			header('Content-Disposition: attachment; filename= '.$filename);
201
-		}
202
-		if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
203
-			header('Pragma: ');
204
-			header('Cache-Control: ');
205
-			header('Cache-Control: public'); // IE cannot download from sessions without a cache
206
-		}
207
-		header('Content-Description: '.$filename);
208
-		header('Content-transfer-encoding: binary');
209
-		// @todo add this utf-8 header for all csv files
210
-		echo "\xEF\xBB\xBF";  // force utf-8 header of csv file
211
-		echo $data;
212
-		return true;
213
-	}
214
-
215
-	/**
216
-	 * Exports the complete report as an XLS file
217
-	 * @return	boolean		False on error
218
-	 */
185
+            $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';';
186
+            $data .= str_replace("\r\n",'  ',$row['exe_date']).';';
187
+            $data .= str_replace("\r\n",'  ',$row['result']).';';
188
+            $data .= str_replace("\r\n",'  ',$row['max']).';';
189
+            $data .= "\n";
190
+        }
191
+
192
+        //output the results
193
+        $len = strlen($data);
194
+        header('Content-type: application/octet-stream');
195
+        header('Content-Type: application/force-download');
196
+        header('Content-length: '.$len);
197
+        if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) {
198
+            header('Content-Disposition: filename= '.$filename);
199
+        } else {
200
+            header('Content-Disposition: attachment; filename= '.$filename);
201
+        }
202
+        if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
203
+            header('Pragma: ');
204
+            header('Cache-Control: ');
205
+            header('Cache-Control: public'); // IE cannot download from sessions without a cache
206
+        }
207
+        header('Content-Description: '.$filename);
208
+        header('Content-transfer-encoding: binary');
209
+        // @todo add this utf-8 header for all csv files
210
+        echo "\xEF\xBB\xBF";  // force utf-8 header of csv file
211
+        echo $data;
212
+        return true;
213
+    }
214
+
215
+    /**
216
+     * Exports the complete report as an XLS file
217
+     * @return	boolean		False on error
218
+     */
219 219
     public function exportCompleteReportXLS(
220 220
         $document_path = '',
221 221
         $user_id = null,
@@ -224,37 +224,37 @@  discard block
 block discarded – undo
224 224
         $exercise_id = 0,
225 225
         $hotpotato_name = null
226 226
     ) {
227
-		global $charset;
228
-		$this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name);
229
-		$filename = 'exercise_results_'.api_get_local_time().'.xls';
230
-		if (!empty($user_id)) {
231
-			$filename = 'exercise_results_user_'.$user_id.'_'.api_get_local_time().'.xls';
232
-		}
227
+        global $charset;
228
+        $this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name);
229
+        $filename = 'exercise_results_'.api_get_local_time().'.xls';
230
+        if (!empty($user_id)) {
231
+            $filename = 'exercise_results_user_'.$user_id.'_'.api_get_local_time().'.xls';
232
+        }
233 233
 
234 234
         $spreadsheet = new PHPExcel();
235 235
         $spreadsheet->setActiveSheetIndex(0);
236 236
         $worksheet = $spreadsheet->getActiveSheet();
237 237
 
238 238
 
239
-		$line = 0;
240
-		$column = 0; //skip the first column (row titles)
239
+        $line = 0;
240
+        $column = 0; //skip the first column (row titles)
241 241
 
242
-		// check if exists column 'user'
243
-		$with_column_user = false;
244
-		foreach ($this->results as $result) {
245
-			if (!empty($result['last_name']) && !empty($result['first_name'])) {
246
-				$with_column_user = true;
247
-				break;
248
-			}
249
-		}
242
+        // check if exists column 'user'
243
+        $with_column_user = false;
244
+        foreach ($this->results as $result) {
245
+            if (!empty($result['last_name']) && !empty($result['first_name'])) {
246
+                $with_column_user = true;
247
+                break;
248
+            }
249
+        }
250 250
 
251
-		if ($with_column_user) {
252
-		    $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Email'));
253
-		    $column++;
251
+        if ($with_column_user) {
252
+            $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Email'));
253
+            $column++;
254 254
 
255 255
             if (api_is_western_name_order()) {
256
-    			$worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName'));
257
-    			$column++;
256
+                $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName'));
257
+                $column++;
258 258
                 $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('LastName'));
259 259
                 $column++;
260 260
             } else {
@@ -263,36 +263,36 @@  discard block
 block discarded – undo
263 263
                 $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName'));
264 264
                 $column++;
265 265
             }
266
-		}
266
+        }
267 267
 
268
-		if ($export_user_fields) {
269
-			//show user fields section with a big th colspan that spans over all fields
270
-			$extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1);
268
+        if ($export_user_fields) {
269
+            //show user fields section with a big th colspan that spans over all fields
270
+            $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1);
271 271
 
272
-			//show the fields names for user fields
273
-			foreach ($extra_user_fields as $field) {
274
-				$worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset));
275
-				$column++;
276
-			}
277
-		}
272
+            //show the fields names for user fields
273
+            foreach ($extra_user_fields as $field) {
274
+                $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset));
275
+                $column++;
276
+            }
277
+        }
278 278
 
279
-		$worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Title'));
280
-		$column++;
281
-		$worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('StartDate'));
279
+        $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Title'));
280
+        $column++;
281
+        $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('StartDate'));
282 282
         $column++;
283 283
         $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('EndDate'));
284 284
         $column++;
285 285
         $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Duration').' ('.get_lang('MinMinutes').')');
286
-		$column++;
287
-		$worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Score'));
288
-		$column++;
289
-		$worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Total'));
290
-		$column++;
286
+        $column++;
287
+        $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Score'));
288
+        $column++;
289
+        $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Total'));
290
+        $column++;
291 291
         $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Status'));
292
-		$line++;
292
+        $line++;
293 293
 
294
-		foreach ($this->results as $row) {
295
-			$column = 0;
294
+        foreach ($this->results as $row) {
295
+            $column = 0;
296 296
 
297 297
             if ($with_column_user) {
298 298
                 $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset));
@@ -309,38 +309,38 @@  discard block
 block discarded – undo
309 309
                     $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset));
310 310
                     $column++;
311 311
                 }
312
-			}
312
+            }
313 313
 
314
-			if ($export_user_fields) {
315
-				//show user fields data, if any, for this user
316
-				$user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true);
317
-				foreach($user_fields_values as $value) {
318
-					$worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset));
319
-					$column++;
320
-				}
321
-			}
314
+            if ($export_user_fields) {
315
+                //show user fields data, if any, for this user
316
+                $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true);
317
+                foreach($user_fields_values as $value) {
318
+                    $worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset));
319
+                    $column++;
320
+                }
321
+            }
322 322
 
323
-			$worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset));
324
-			$column++;
325
-			$worksheet->SetCellValueByColumnAndRow($line,$column,$row['start_date']);
323
+            $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset));
324
+            $column++;
325
+            $worksheet->SetCellValueByColumnAndRow($line,$column,$row['start_date']);
326 326
             $column++;
327
-			$worksheet->SetCellValueByColumnAndRow($line,$column,$row['end_date']);
327
+            $worksheet->SetCellValueByColumnAndRow($line,$column,$row['end_date']);
328
+            $column++;
329
+            $worksheet->SetCellValueByColumnAndRow($line,$column,$row['duration']);
330
+            $column++;
331
+            $worksheet->SetCellValueByColumnAndRow($line,$column,$row['result']);
332
+            $column++;
333
+            $worksheet->SetCellValueByColumnAndRow($line,$column,$row['max']);
328 334
             $column++;
329
-			$worksheet->SetCellValueByColumnAndRow($line,$column,$row['duration']);
330
-			$column++;
331
-			$worksheet->SetCellValueByColumnAndRow($line,$column,$row['result']);
332
-			$column++;
333
-			$worksheet->SetCellValueByColumnAndRow($line,$column,$row['max']);
334
-			$column++;
335 335
             $worksheet->SetCellValueByColumnAndRow($line,$column,$row['status']);
336
-			$line++;
337
-		}
336
+            $line++;
337
+        }
338 338
 
339 339
         $file = api_get_path(SYS_ARCHIVE_PATH).api_replace_dangerous_char($filename);
340 340
         $writer = new PHPExcel_Writer_Excel2007($spreadsheet);
341 341
         $writer->save($file);
342 342
         DocumentManager::file_send_for_download($file, true, $filename);
343 343
 
344
-		return true;
345
-	}
344
+        return true;
345
+    }
346 346
 }
Please login to merge, or discard this patch.
main/exercice/hotspot_actionscript_admin.as.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -98,10 +98,10 @@
 block discarded – undo
98 98
         }*/
99 99
     }
100 100
 
101
-	// This is a good answer, count + 1 for nmbr of clicks
102
-	if ($answers['weighting'][$i] > 0) {
103
-		$nmbrTries++;
104
-	}
101
+    // This is a good answer, count + 1 for nmbr of clicks
102
+    if ($answers['weighting'][$i] > 0) {
103
+        $nmbrTries++;
104
+    }
105 105
 
106 106
     $hotSpot['coord'] = $answers['hotspot_coordinates'][$i];
107 107
     $data['hotspots'][] = $hotSpot;
Please login to merge, or discard this patch.