Completed
Push — 1.11.x ( 55a6a1...a914dc )
by José
60:32 queued 35:06
created
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.
main/messages/new_message.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -77,20 +77,20 @@  discard block
 block discarded – undo
77 77
 
78 78
 function show_compose_reply_to_message($message_id, $receiver_id)
79 79
 {
80
-	$table_message = Database::get_main_table(TABLE_MESSAGE);
81
-	$query = "SELECT user_sender_id
80
+    $table_message = Database::get_main_table(TABLE_MESSAGE);
81
+    $query = "SELECT user_sender_id
82 82
               FROM $table_message
83 83
 			  WHERE user_receiver_id = ".intval($receiver_id)." AND id='".intval($message_id)."';";
84
-	$result = Database::query($query);
85
-	$row = Database::fetch_array($result,'ASSOC');
86
-	if (!isset($row['user_sender_id'])) {
87
-		$html = get_lang('InvalidMessageId');
84
+    $result = Database::query($query);
85
+    $row = Database::fetch_array($result,'ASSOC');
86
+    if (!isset($row['user_sender_id'])) {
87
+        $html = get_lang('InvalidMessageId');
88 88
 
89
-		return $html;
90
-	}
91
-	$userInfo = api_get_user_info($row['user_sender_id']);
92
-	$default['users'] = array($row['user_sender_id']);
93
-	$html = manage_form($default, null, $userInfo['complete_name']);
89
+        return $html;
90
+    }
91
+    $userInfo = api_get_user_info($row['user_sender_id']);
92
+    $default['users'] = array($row['user_sender_id']);
93
+    $html = manage_form($default, null, $userInfo['complete_name']);
94 94
 
95 95
     return $html;
96 96
 }
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
 function show_compose_to_user ($receiver_id)
99 99
 {
100 100
     $userInfo = api_get_user_info($receiver_id);
101
-	$html = get_lang('To').':&nbsp;<strong>'.$userInfo['complete_name'].'</strong>';
102
-	$default['title'] = api_xml_http_response_encode(get_lang('EnterTitle'));
103
-	$default['users'] = array($receiver_id);
104
-	$html .= manage_form($default);
101
+    $html = get_lang('To').':&nbsp;<strong>'.$userInfo['complete_name'].'</strong>';
102
+    $default['title'] = api_xml_http_response_encode(get_lang('EnterTitle'));
103
+    $default['users'] = array($receiver_id);
104
+    $html .= manage_form($default);
105 105
 
106 106
     return $html;
107 107
 }
@@ -273,13 +273,13 @@  discard block
 block discarded – undo
273 273
 
274 274
 /* MAIN SECTION */
275 275
 if ($socialToolIsActive) {
276
-	$this_section = SECTION_SOCIAL;
276
+    $this_section = SECTION_SOCIAL;
277 277
     $interbreadcrumb[] = array(
278 278
         'url' => api_get_path(WEB_PATH).'main/social/home.php',
279 279
         'name' => get_lang('SocialNetwork')
280 280
     );
281 281
 } else {
282
-	$this_section = SECTION_MYPROFILE;
282
+    $this_section = SECTION_MYPROFILE;
283 283
     $interbreadcrumb[] = array(
284 284
         'url' => api_get_path(WEB_PATH).'main/auth/profile.php',
285 285
         'name' => get_lang('Profile')
@@ -289,30 +289,30 @@  discard block
 block discarded – undo
289 289
 $group_id = isset($_REQUEST['group_id']) ? intval($_REQUEST['group_id']) : null;
290 290
 $social_right_content = null;
291 291
 if ($group_id != 0) {
292
-	$social_right_content .= '<div class=actions>';
293
-	$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/group_view.php?id='.$group_id.'">'.
294
-		Display::return_icon('back.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).'</a>';
295
-	$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php?group_id='.$group_id.'">'.
296
-		Display::return_icon('message_new.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).'</a>';
297
-	$social_right_content .= '</div>';
292
+    $social_right_content .= '<div class=actions>';
293
+    $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/group_view.php?id='.$group_id.'">'.
294
+        Display::return_icon('back.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).'</a>';
295
+    $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php?group_id='.$group_id.'">'.
296
+        Display::return_icon('message_new.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).'</a>';
297
+    $social_right_content .= '</div>';
298 298
 } else {
299
-	if ($socialToolIsActive) {
300
-	} else {
301
-		$social_right_content .= '<div class=actions>';
302
-		if (api_get_setting('allow_social_tool') === 'true' && api_get_setting('allow_message_tool') === 'true') {
303
-			$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.
299
+    if ($socialToolIsActive) {
300
+    } else {
301
+        $social_right_content .= '<div class=actions>';
302
+        if (api_get_setting('allow_social_tool') === 'true' && api_get_setting('allow_message_tool') === 'true') {
303
+            $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.
304 304
                 Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).'</a>';
305
-		}
306
-		if (api_get_setting('allow_message_tool') === 'true') {
307
-			$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
305
+        }
306
+        if (api_get_setting('allow_message_tool') === 'true') {
307
+            $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
308 308
                 Display::return_icon('message_new.png',get_lang('ComposeMessage')).'</a>';
309
-			$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
309
+            $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
310 310
                 Display::return_icon('inbox.png',get_lang('Inbox')).'</a>';
311 311
             $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.
312 312
                 Display::return_icon('outbox.png',get_lang('Outbox')).'</a>';
313
-		}
314
-		$social_right_content .= '</div>';
315
-	}
313
+        }
314
+        $social_right_content .= '</div>';
315
+    }
316 316
 }
317 317
 
318 318
 // LEFT COLUMN
Please login to merge, or discard this patch.
main/mySpace/user_import.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 $interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('MySpace'));
19 19
 $id_session = '';
20 20
 if (isset($_GET['id_session']) && $_GET['id_session'] != '') {
21
- 	$id_session = intval($_GET['id_session']);
22
-	$interbreadcrumb[] = array ('url' => 'session.php', 'name' => get_lang('Sessions'));
23
-	$interbreadcrumb[] = array ('url' => 'course.php?id_session='.$id_session.'', 'name' => get_lang('Course'));
21
+        $id_session = intval($_GET['id_session']);
22
+    $interbreadcrumb[] = array ('url' => 'session.php', 'name' => get_lang('Sessions'));
23
+    $interbreadcrumb[] = array ('url' => 'course.php?id_session='.$id_session.'', 'name' => get_lang('Course'));
24 24
 }
25 25
 
26 26
 // Set this option to true to enforce strict purification for usenames.
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 Display :: display_header($tool_name);
90 90
 
91 91
 if ($_FILES['import_file']['size'] == 0 && $_POST) {
92
-	Display::display_error_message(get_lang('ThisFieldIsRequired'));
92
+    Display::display_error_message(get_lang('ThisFieldIsRequired'));
93 93
 }
94 94
 
95 95
 if (count($errors) != 0) {
Please login to merge, or discard this patch.
main/lp/lp_view_item.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@
 block discarded – undo
97 97
 // Theme calls
98 98
 $show_learn_path = true;
99 99
 if (isset($_SESSION['oLP']) && is_object($_SESSION['oLP'])) {
100
-	$lp_theme_css = $_SESSION['oLP']->get_theme();
100
+    $lp_theme_css = $_SESSION['oLP']->get_theme();
101 101
 }
102 102
 
103 103
 if ($mode == 'fullpage') {
Please login to merge, or discard this patch.
main/admin/dashboard_add_courses_to_user.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -36,20 +36,20 @@  discard block
 block discarded – undo
36 36
 
37 37
 // setting the name of the tool
38 38
 if (UserManager::is_admin($user_id)) {
39
-	$tool_name= get_lang('AssignCoursesToPlatformAdministrator');
39
+    $tool_name= get_lang('AssignCoursesToPlatformAdministrator');
40 40
 } else if ($user_info['status'] == SESSIONADMIN) {
41
-	$tool_name= get_lang('AssignCoursesToSessionsAdministrator');
41
+    $tool_name= get_lang('AssignCoursesToSessionsAdministrator');
42 42
 } else {
43
-	$tool_name= get_lang('AssignCoursesToHumanResourcesManager');
43
+    $tool_name= get_lang('AssignCoursesToHumanResourcesManager');
44 44
 }
45 45
 
46 46
 $add_type = 'multiple';
47 47
 if(isset($_GET['add_type']) && $_GET['add_type']!='') {
48
-	$add_type = Security::remove_XSS($_REQUEST['add_type']);
48
+    $add_type = Security::remove_XSS($_REQUEST['add_type']);
49 49
 }
50 50
 
51 51
 if (!api_is_platform_admin()) {
52
-	api_not_allowed(true);
52
+    api_not_allowed(true);
53 53
 }
54 54
 
55 55
 function search_courses($needle, $type)
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     $return = '';
61 61
     if (!empty($needle) && !empty($type)) {
62 62
         // xajax send utf8 datas... datas in db can be non-utf8 datas
63
-		$needle = Database::escape_string($needle);
63
+        $needle = Database::escape_string($needle);
64 64
 
65 65
         $assigned_courses_to_hrm = CourseManager::get_courses_followed_by_drh($user_id);
66 66
         $assigned_courses_code = array_keys($assigned_courses_to_hrm);
@@ -88,16 +88,16 @@  discard block
 block discarded – undo
88 88
                 		$without_assigned_courses ";
89 89
         }
90 90
 
91
-		$rs	= Database::query($sql);
91
+        $rs	= Database::query($sql);
92 92
 
93
-		$return .= '<select id="origin" name="NoAssignedCoursesList[]" multiple="multiple" size="20" >';
94
-		while ($course = Database :: fetch_array($rs)) {
95
-			$return .= '<option value="'.$course['code'].'" title="'.htmlspecialchars($course['title'],ENT_QUOTES).'">'.$course['title'].' ('.$course['code'].')</option>';
96
-		}
97
-		$return .= '</select>';
98
-		$xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return));
99
-	}
100
-	return $xajax_response;
93
+        $return .= '<select id="origin" name="NoAssignedCoursesList[]" multiple="multiple" size="20" >';
94
+        while ($course = Database :: fetch_array($rs)) {
95
+            $return .= '<option value="'.$course['code'].'" title="'.htmlspecialchars($course['title'],ENT_QUOTES).'">'.$course['title'].' ('.$course['code'].')</option>';
96
+        }
97
+        $return .= '</select>';
98
+        $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return));
99
+    }
100
+    return $xajax_response;
101 101
 }
102 102
 
103 103
 $xajax->processRequests();
@@ -187,23 +187,23 @@  discard block
 block discarded – undo
187 187
 $assigned_courses_to_hrm = CourseManager::get_courses_followed_by_drh($user_id);
188 188
 $assigned_courses_code = array_keys($assigned_courses_to_hrm);
189 189
 foreach ($assigned_courses_code as &$value) {
190
-	$value = "'".$value."'";
190
+    $value = "'".$value."'";
191 191
 }
192 192
 
193 193
 $without_assigned_courses = '';
194 194
 if (count($assigned_courses_code) > 0) {
195
-	$without_assigned_courses = " AND c.code NOT IN(".implode(',', $assigned_courses_code).")";
195
+    $without_assigned_courses = " AND c.code NOT IN(".implode(',', $assigned_courses_code).")";
196 196
 }
197 197
 
198 198
 $needle = '%';
199 199
 $firstLetter = null;
200 200
 if (isset($_POST['firstLetterCourse'])) {
201
-	$firstLetter = $_POST['firstLetterCourse'];
202
-	$needle = Database::escape_string($firstLetter.'%');
201
+    $firstLetter = $_POST['firstLetterCourse'];
202
+    $needle = Database::escape_string($firstLetter.'%');
203 203
 }
204 204
 
205 205
 if (api_is_multiple_url_enabled()) {
206
-	$sql = " SELECT c.code, c.title
206
+    $sql = " SELECT c.code, c.title
207 207
             FROM $tbl_course c
208 208
             LEFT JOIN $tbl_course_rel_access_url a
209 209
             ON (a.c_id = c.id)
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
             ORDER BY c.title";
214 214
 
215 215
 } else {
216
-	$sql= " SELECT c.code, c.title
216
+    $sql= " SELECT c.code, c.title
217 217
 	        FROM $tbl_course c
218 218
             WHERE  c.code LIKE '$needle' $without_assigned_courses
219 219
             ORDER BY c.title";
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 <input type="hidden" name="formSent" value="1" />
228 228
 <?php
229 229
 if(!empty($msg)) {
230
-	Display::display_normal_message($msg); //main API
230
+    Display::display_normal_message($msg); //main API
231 231
 }
232 232
 ?>
233 233
 
@@ -272,13 +272,13 @@  discard block
 block discarded – undo
272 272
     </div>
273 273
     <div class="col-md-4">
274 274
         <h5><?php
275
-	  	if (UserManager::is_admin($user_id)) {
276
-			echo get_lang('AssignedCoursesListToPlatformAdministrator');
277
-		} else if ($user_info['status'] == SESSIONADMIN) {
278
-			echo get_lang('AssignedCoursesListToSessionsAdministrator');
279
-		} else {
280
-			echo get_lang('AssignedCoursesListToHumanResourcesManager');
281
-		}
275
+            if (UserManager::is_admin($user_id)) {
276
+            echo get_lang('AssignedCoursesListToPlatformAdministrator');
277
+        } else if ($user_info['status'] == SESSIONADMIN) {
278
+            echo get_lang('AssignedCoursesListToSessionsAdministrator');
279
+        } else {
280
+            echo get_lang('AssignedCoursesListToHumanResourcesManager');
281
+        }
282 282
             ?>: </h5>
283 283
 
284 284
         <select id='destination' name="CoursesList[]" multiple="multiple" size="20" style="width:320px;">
Please login to merge, or discard this patch.
main/admin/skills_import.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
             $oskill = new Skill();
71 71
             $skill_id = $oskill->add($skill);
72 72
             $parents[$saved_id] = $skill_id;
73
-		}
73
+        }
74 74
     }
75 75
 }
76 76
 
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
  */
82 82
 function parse_csv_data($file)
83 83
 {
84
-	$skills = Import :: csvToArray($file);
85
-	foreach ($skills as $index => $skill) {
86
-		$skills[$index] = $skill;
87
-	}
84
+    $skills = Import :: csvToArray($file);
85
+    foreach ($skills as $index => $skill) {
86
+        $skills[$index] = $skill;
87
+    }
88 88
 
89
-	return $skills;
89
+    return $skills;
90 90
 }
91 91
 
92 92
 /**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
  */
95 95
 function element_start($parser, $data)
96 96
 {
97
-	$data = api_utf8_decode($data);
97
+    $data = api_utf8_decode($data);
98 98
     global $skill;
99 99
     global $current_tag;
100 100
     switch ($data) {
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
  */
112 112
 function element_end($parser, $data)
113 113
 {
114
-	$data = api_utf8_decode($data);
114
+    $data = api_utf8_decode($data);
115 115
     global $skill;
116 116
     global $skills;
117 117
     global $current_value;
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
  */
131 131
 function character_data($parser, $data)
132 132
 {
133
-	$data = trim(api_utf8_decode($data));
134
-	global $current_value;
135
-	$current_value = $data;
133
+    $data = trim(api_utf8_decode($data));
134
+    global $current_value;
135
+    $current_value = $data;
136 136
 }
137 137
 
138 138
 /**
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     xml_parse($parser, api_utf8_encode_xml(file_get_contents($file)));
155 155
     xml_parser_free($parser);
156 156
 
157
-	return $skills;
157
+    return $skills;
158 158
 }
159 159
 
160 160
 $this_section = SECTION_PLATFORM_ADMIN;
Please login to merge, or discard this patch.
main/admin/ldap_form_add_users_group.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -29,35 +29,35 @@
 block discarded – undo
29 29
 echo '<input type="hidden" name="confirmed" value="yes">';
30 30
 echo '<table border="0" cellspacing="0" width="100%">';
31 31
 echo '<tr align="center" id="header3">' .
32
-		'<td width="15%"><input type="button" value="'.get_lang('AllSlashNone').'" onClick="checkAll();"></td>' .
33
-		'<td width="40%"><b>'.get_lang('Email').'</b></td>' .
34
-		($is_western_name_order
35
-			? '<td width="15%"><b>'.get_lang('FirstName').'</b></td>' .
36
-			'<td width="15%"><b>'.get_lang('Name').'</b></td>'
37
-			: '<td width="15%"><b>'.get_lang('Name').'</b></td>' .
38
-			'<td width="15%"><b>'.get_lang('FirstName').'</b></td>') .
39
-		'<td width="15%"><b>'.get_lang('Login').'</b></td>' .
40
-	  '</tr>'."\n";
32
+        '<td width="15%"><input type="button" value="'.get_lang('AllSlashNone').'" onClick="checkAll();"></td>' .
33
+        '<td width="40%"><b>'.get_lang('Email').'</b></td>' .
34
+        ($is_western_name_order
35
+            ? '<td width="15%"><b>'.get_lang('FirstName').'</b></td>' .
36
+            '<td width="15%"><b>'.get_lang('Name').'</b></td>'
37
+            : '<td width="15%"><b>'.get_lang('Name').'</b></td>' .
38
+            '<td width="15%"><b>'.get_lang('FirstName').'</b></td>') .
39
+        '<td width="15%"><b>'.get_lang('Login').'</b></td>' .
40
+        '</tr>'."\n";
41 41
 while (list ($key, $val) = each($nom_form)) {
42
-	$nbre=$nbre+1;
43
-	if($nbre & 1) $ndiv=2; else $ndiv=3;
44
-	echo '<tr align="center" id="header'.$ndiv.'">';
45
-	echo '<td><input type="checkbox" name="checkboxes[]" value="'.$key.'" checked="checked"></td>';
46
-	echo '<td>'.$email_form[$key].'<input type="hidden" name="email_form['.$key.']" size="40" value="'.$email_form[$key].'"></td>';
47
-	if ($is_western_name_order)	{
48
-		echo '<td>'.$prenom_form[$key].'<input type="hidden" name="prenom_form['.$key.']" size="20" value="'.$prenom_form[$key].'"></td>';
49
-		echo '<td>'.$nom_form[$key].'<input type="hidden" name="nom_form['.$key.']" size="20" value="'.$nom_form[$key].'"></td>';
50
-	} else {
51
-		echo '<td>'.$nom_form[$key].'<input type="hidden" name="nom_form['.$key.']" size="20" value="'.$nom_form[$key].'"></td>';
52
-		echo '<td>'.$prenom_form[$key].'<input type="hidden" name="prenom_form['.$key.']" size="20" value="'.$prenom_form[$key].'"></td>';
53
-	}
54
-	echo '<td>'.$username_form[$key].'<input type="hidden" name="username_form['.$key.']" size="10" value="'.$username_form[$key].'">';
55
-	echo '<input type="hidden" name="tutor_form['.$key.']" value="0">';
56
-	echo '<input type="hidden" name="admin_form['.$key.']" value="1">';
57
-	echo '<input type="hidden" name="password_form['.$key.']"  value="'.$password_form[$key].'">';
58
-	echo '<input type="hidden" name="statut['.$key.']"  value="'.$statut.'">';
59
-	echo '</td>';
60
-	echo '</tr>';
42
+    $nbre=$nbre+1;
43
+    if($nbre & 1) $ndiv=2; else $ndiv=3;
44
+    echo '<tr align="center" id="header'.$ndiv.'">';
45
+    echo '<td><input type="checkbox" name="checkboxes[]" value="'.$key.'" checked="checked"></td>';
46
+    echo '<td>'.$email_form[$key].'<input type="hidden" name="email_form['.$key.']" size="40" value="'.$email_form[$key].'"></td>';
47
+    if ($is_western_name_order)	{
48
+        echo '<td>'.$prenom_form[$key].'<input type="hidden" name="prenom_form['.$key.']" size="20" value="'.$prenom_form[$key].'"></td>';
49
+        echo '<td>'.$nom_form[$key].'<input type="hidden" name="nom_form['.$key.']" size="20" value="'.$nom_form[$key].'"></td>';
50
+    } else {
51
+        echo '<td>'.$nom_form[$key].'<input type="hidden" name="nom_form['.$key.']" size="20" value="'.$nom_form[$key].'"></td>';
52
+        echo '<td>'.$prenom_form[$key].'<input type="hidden" name="prenom_form['.$key.']" size="20" value="'.$prenom_form[$key].'"></td>';
53
+    }
54
+    echo '<td>'.$username_form[$key].'<input type="hidden" name="username_form['.$key.']" size="10" value="'.$username_form[$key].'">';
55
+    echo '<input type="hidden" name="tutor_form['.$key.']" value="0">';
56
+    echo '<input type="hidden" name="admin_form['.$key.']" value="1">';
57
+    echo '<input type="hidden" name="password_form['.$key.']"  value="'.$password_form[$key].'">';
58
+    echo '<input type="hidden" name="statut['.$key.']"  value="'.$statut.'">';
59
+    echo '</td>';
60
+    echo '</tr>';
61 61
 }
62 62
 echo '</table>';
63 63
 echo '<br />';
Please login to merge, or discard this patch.