Passed
Push — 1.10.x ( 2674ce...55c17b )
by Angel Fernando Quiroz
365:02 queued 317:33
created
main/inc/lib/xajax/xajaxResponse.inc.php 4 patches
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -97,6 +97,7 @@  discard block
 block discarded – undo
97 97
 	 * @param string  contains the character encoding string to use
98 98
 	 * @param boolean lets you set if you want special characters in the output
99 99
 	 *                converted to HTML entities
100
+	 * @param string $sEncoding
100 101
 	 *
101 102
 	 */
102 103
 	function xajaxResponse($sEncoding=XAJAX_DEFAULT_CHAR_ENCODING, $bOutputEntities=false)
@@ -223,6 +224,8 @@  discard block
 block discarded – undo
223 224
 	 * @param string contains the id of an HTML element
224 225
 	 * @param string the part of the element you wish to clear ("innerHTML",
225 226
 	 *               "value", etc.)
227
+	 * @param string $sTarget
228
+	 * @param string $sAttribute
226 229
 	 */
227 230
 	function addClear($sTarget,$sAttribute)
228 231
 	{
@@ -279,6 +282,7 @@  discard block
 block discarded – undo
279 282
 	 * <i>Usage:</i> <kbd>$objResponse->addScript("var x = prompt('get some text');");</kbd>
280 283
 	 *
281 284
 	 * @param string contains Javascript code to be executed
285
+	 * @param string $sJS
282 286
 	 */
283 287
 	function addScript($sJS)
284 288
 	{
@@ -290,8 +294,6 @@  discard block
 block discarded – undo
290 294
 	 *
291 295
 	 * <i>Usage:</i> <kbd>$objResponse->addScriptCall("myJSFunction", "arg 1", "arg 2", 12345);</kbd>
292 296
 	 *
293
-	 * @param string $sFunc the name of a Javascript function
294
-	 * @param mixed $args,... optional arguments to pass to the Javascript function
295 297
 	 */
296 298
 	function addScriptCall() {
297 299
 		$arguments = func_get_args();
Please login to merge, or discard this patch.
Indentation   +512 added lines, -512 removed lines patch added patch discarded remove patch
@@ -67,521 +67,521 @@
 block discarded – undo
67 67
  */
68 68
 class xajaxResponse
69 69
 {
70
-	/**#@+
70
+    /**#@+
71 71
 	 * @access protected
72 72
 	 */
73
-	/**
74
-	 * @var string internal XML storage
75
-	 */
76
-	var $xml;
77
-	/**
78
-	 * @var string the encoding type to use
79
-	 */
80
-	var $sEncoding;
81
-	/**
82
-	 * @var boolean if special characters in the XML should be converted to
83
-	 *              entities
84
-	 */
85
-	var $bOutputEntities;
86
-
87
-	/**#@-*/
88
-
89
-	/**
90
-	 * The constructor's main job is to set the character encoding for the
91
-	 * response.
92
-	 *
93
-	 * <i>Note:</i> to change the character encoding for all of the
94
-	 * responses, set the XAJAX_DEFAULT_ENCODING constant before you
95
-	 * instantiate xajax.
96
-	 *
97
-	 * @param string  contains the character encoding string to use
98
-	 * @param boolean lets you set if you want special characters in the output
99
-	 *                converted to HTML entities
100
-	 *
101
-	 */
102
-	function xajaxResponse($sEncoding=XAJAX_DEFAULT_CHAR_ENCODING, $bOutputEntities=false)
103
-	{
104
-		$this->setCharEncoding($sEncoding);
105
-		$this->bOutputEntities = $bOutputEntities;
106
-	}
107
-
108
-	/**
109
-	 * Sets the character encoding for the response based on $sEncoding, which
110
-	 * is a string containing the character encoding to use. You don't need to
111
-	 * use this method normally, since the character encoding for the response
112
-	 * gets set automatically based on the XAJAX_DEFAULT_CHAR_ENCODING
113
-	 * constant.
114
-	 *
115
-	 * @param string
116
-	 */
117
-	function setCharEncoding($sEncoding)
118
-	{
119
-		$this->sEncoding = $sEncoding;
120
-	}
121
-
122
-	/**
123
-	 * Tells the response object to convert special characters to HTML entities
124
-	 * automatically (only works if the mb_string extension is available).
125
-	 */
126
-	function outputEntitiesOn()
127
-	{
128
-		$this->bOutputEntities = true;
129
-	}
130
-
131
-	/**
132
-	 * Tells the response object to output special characters intact. (default
133
-	 * behavior)
134
-	 */
135
-	function outputEntitiesOff()
136
-	{
137
-		$this->bOutputEntities = false;
138
-	}
139
-
140
-	/**
141
-	 * Adds a confirm commands command message to the XML response.
142
-	 *
143
-	 * <i>Usage:</i> <kbd>$objResponse->addConfirmCommands(1, "Do you want to preview the new data?");</kbd>
144
-	 *
145
-	 * @param integer the number of commands to skip if the user presses
146
-	 *                Cancel in the browsers's confirm dialog
147
-	 * @param string  the message to show in the browser's confirm dialog
148
-	 */
149
-	function addConfirmCommands($iCmdNumber, $sMessage)
150
-	{
151
-		$this->xml .= $this->_cmdXML(array("n"=>"cc","t"=>$iCmdNumber),$sMessage);
152
-	}
153
-
154
-	/**
155
-	 * Adds an assign command message to the XML response.
156
-	 *
157
-	 * <i>Usage:</i> <kbd>$objResponse->addAssign("contentDiv", "innerHTML", "Some Text");</kbd>
158
-	 *
159
-	 * @param string contains the id of an HTML element
160
-	 * @param string the part of the element you wish to modify ("innerHTML",
161
-	 *               "value", etc.)
162
-	 * @param string the data you want to set the attribute to
163
-	 */
164
-	function addAssign($sTarget,$sAttribute,$sData)
165
-	{
166
-		$this->xml .= $this->_cmdXML(array("n"=>"as","t"=>$sTarget,"p"=>$sAttribute),$sData);
167
-	}
168
-
169
-	/**
170
-	 * Adds an append command message to the XML response.
171
-	 *
172
-	 * <i>Usage:</i> <kbd>$objResponse->addAppend("contentDiv", "innerHTML", "Some New Text");</kbd>
173
-	 *
174
-	 * @param string contains the id of an HTML element
175
-	 * @param string the part of the element you wish to modify ("innerHTML",
176
-	 *               "value", etc.)
177
-	 * @param string the data you want to append to the end of the attribute
178
-	 */
179
-	function addAppend($sTarget,$sAttribute,$sData)
180
-	{
181
-		$this->xml .= $this->_cmdXML(array("n"=>"ap","t"=>$sTarget,"p"=>$sAttribute),$sData);
182
-	}
183
-
184
-	/**
185
-	 * Adds an prepend command message to the XML response.
186
-	 *
187
-	 * <i>Usage:</i> <kbd>$objResponse->addPrepend("contentDiv", "innerHTML", "Some Starting Text");</kbd>
188
-	 *
189
-	 * @param string contains the id of an HTML element
190
-	 * @param string the part of the element you wish to modify ("innerHTML",
191
-	 *               "value", etc.)
192
-	 * @param string the data you want to prepend to the beginning of the
193
-	 *               attribute
194
-	 */
195
-	function addPrepend($sTarget,$sAttribute,$sData)
196
-	{
197
-		$this->xml .= $this->_cmdXML(array("n"=>"pp","t"=>$sTarget,"p"=>$sAttribute),$sData);
198
-	}
199
-
200
-	/**
201
-	 * Adds a replace command message to the XML response.
202
-	 *
203
-	 * <i>Usage:</i> <kbd>$objResponse->addReplace("contentDiv", "innerHTML", "text", "<b>text</b>");</kbd>
204
-	 *
205
-	 * @param string contains the id of an HTML element
206
-	 * @param string the part of the element you wish to modify ("innerHTML",
207
-	 *               "value", etc.)
208
-	 * @param string the string to search for
209
-	 * @param string the string to replace the search string when found in the
210
-	 *               attribute
211
-	 */
212
-	function addReplace($sTarget,$sAttribute,$sSearch,$sData)
213
-	{
214
-		$sDta = "<s><![CDATA[$sSearch]]></s><r><![CDATA[$sData]]></r>";
215
-		$this->xml .= $this->_cmdXML(array("n"=>"rp","t"=>$sTarget,"p"=>$sAttribute),$sDta);
216
-	}
217
-
218
-	/**
219
-	 * Adds a clear command message to the XML response.
220
-	 *
221
-	 * <i>Usage:</i> <kbd>$objResponse->addClear("contentDiv", "innerHTML");</kbd>
222
-	 *
223
-	 * @param string contains the id of an HTML element
224
-	 * @param string the part of the element you wish to clear ("innerHTML",
225
-	 *               "value", etc.)
226
-	 */
227
-	function addClear($sTarget,$sAttribute)
228
-	{
229
-		$this->addAssign($sTarget,$sAttribute,'');
230
-	}
231
-
232
-	/**
233
-	 * Adds an alert command message to the XML response.
234
-	 *
235
-	 * <i>Usage:</i> <kbd>$objResponse->addAlert("This is important information");</kbd>
236
-	 *
237
-	 * @param string the text to be displayed in the Javascript alert box
238
-	 */
239
-	function addAlert($sMsg)
240
-	{
241
-		$this->xml .= $this->_cmdXML(array("n"=>"al"),$sMsg);
242
-	}
243
-
244
-	/**
245
-	 * Uses the addScript() method to add a Javascript redirect to another URL.
246
-	 *
247
-	 * <i>Usage:</i> <kbd>$objResponse->addRedirect("http://www.xajaxproject.org");</kbd>
248
-	 *
249
-	 * @param string the URL to redirect the client browser to
250
-	 */
251
-	function addRedirect($sURL)
252
-	{
253
-		//we need to parse the query part so that the values are rawurlencode()'ed
254
-		//can't just use parse_url() cos we could be dealing with a relative URL which
255
-		//  parse_url() can't deal with.
256
-		$queryStart = strpos($sURL, '?', strrpos($sURL, '/'));
257
-		if ($queryStart !== FALSE)
258
-		{
259
-			$queryStart++;
260
-			$queryEnd = strpos($sURL, '#', $queryStart);
261
-			if ($queryEnd === FALSE)
262
-				$queryEnd = strlen($sURL);
263
-			$queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart);
73
+    /**
74
+     * @var string internal XML storage
75
+     */
76
+    var $xml;
77
+    /**
78
+     * @var string the encoding type to use
79
+     */
80
+    var $sEncoding;
81
+    /**
82
+     * @var boolean if special characters in the XML should be converted to
83
+     *              entities
84
+     */
85
+    var $bOutputEntities;
86
+
87
+    /**#@-*/
88
+
89
+    /**
90
+     * The constructor's main job is to set the character encoding for the
91
+     * response.
92
+     *
93
+     * <i>Note:</i> to change the character encoding for all of the
94
+     * responses, set the XAJAX_DEFAULT_ENCODING constant before you
95
+     * instantiate xajax.
96
+     *
97
+     * @param string  contains the character encoding string to use
98
+     * @param boolean lets you set if you want special characters in the output
99
+     *                converted to HTML entities
100
+     *
101
+     */
102
+    function xajaxResponse($sEncoding=XAJAX_DEFAULT_CHAR_ENCODING, $bOutputEntities=false)
103
+    {
104
+        $this->setCharEncoding($sEncoding);
105
+        $this->bOutputEntities = $bOutputEntities;
106
+    }
107
+
108
+    /**
109
+     * Sets the character encoding for the response based on $sEncoding, which
110
+     * is a string containing the character encoding to use. You don't need to
111
+     * use this method normally, since the character encoding for the response
112
+     * gets set automatically based on the XAJAX_DEFAULT_CHAR_ENCODING
113
+     * constant.
114
+     *
115
+     * @param string
116
+     */
117
+    function setCharEncoding($sEncoding)
118
+    {
119
+        $this->sEncoding = $sEncoding;
120
+    }
121
+
122
+    /**
123
+     * Tells the response object to convert special characters to HTML entities
124
+     * automatically (only works if the mb_string extension is available).
125
+     */
126
+    function outputEntitiesOn()
127
+    {
128
+        $this->bOutputEntities = true;
129
+    }
130
+
131
+    /**
132
+     * Tells the response object to output special characters intact. (default
133
+     * behavior)
134
+     */
135
+    function outputEntitiesOff()
136
+    {
137
+        $this->bOutputEntities = false;
138
+    }
139
+
140
+    /**
141
+     * Adds a confirm commands command message to the XML response.
142
+     *
143
+     * <i>Usage:</i> <kbd>$objResponse->addConfirmCommands(1, "Do you want to preview the new data?");</kbd>
144
+     *
145
+     * @param integer the number of commands to skip if the user presses
146
+     *                Cancel in the browsers's confirm dialog
147
+     * @param string  the message to show in the browser's confirm dialog
148
+     */
149
+    function addConfirmCommands($iCmdNumber, $sMessage)
150
+    {
151
+        $this->xml .= $this->_cmdXML(array("n"=>"cc","t"=>$iCmdNumber),$sMessage);
152
+    }
153
+
154
+    /**
155
+     * Adds an assign command message to the XML response.
156
+     *
157
+     * <i>Usage:</i> <kbd>$objResponse->addAssign("contentDiv", "innerHTML", "Some Text");</kbd>
158
+     *
159
+     * @param string contains the id of an HTML element
160
+     * @param string the part of the element you wish to modify ("innerHTML",
161
+     *               "value", etc.)
162
+     * @param string the data you want to set the attribute to
163
+     */
164
+    function addAssign($sTarget,$sAttribute,$sData)
165
+    {
166
+        $this->xml .= $this->_cmdXML(array("n"=>"as","t"=>$sTarget,"p"=>$sAttribute),$sData);
167
+    }
168
+
169
+    /**
170
+     * Adds an append command message to the XML response.
171
+     *
172
+     * <i>Usage:</i> <kbd>$objResponse->addAppend("contentDiv", "innerHTML", "Some New Text");</kbd>
173
+     *
174
+     * @param string contains the id of an HTML element
175
+     * @param string the part of the element you wish to modify ("innerHTML",
176
+     *               "value", etc.)
177
+     * @param string the data you want to append to the end of the attribute
178
+     */
179
+    function addAppend($sTarget,$sAttribute,$sData)
180
+    {
181
+        $this->xml .= $this->_cmdXML(array("n"=>"ap","t"=>$sTarget,"p"=>$sAttribute),$sData);
182
+    }
183
+
184
+    /**
185
+     * Adds an prepend command message to the XML response.
186
+     *
187
+     * <i>Usage:</i> <kbd>$objResponse->addPrepend("contentDiv", "innerHTML", "Some Starting Text");</kbd>
188
+     *
189
+     * @param string contains the id of an HTML element
190
+     * @param string the part of the element you wish to modify ("innerHTML",
191
+     *               "value", etc.)
192
+     * @param string the data you want to prepend to the beginning of the
193
+     *               attribute
194
+     */
195
+    function addPrepend($sTarget,$sAttribute,$sData)
196
+    {
197
+        $this->xml .= $this->_cmdXML(array("n"=>"pp","t"=>$sTarget,"p"=>$sAttribute),$sData);
198
+    }
199
+
200
+    /**
201
+     * Adds a replace command message to the XML response.
202
+     *
203
+     * <i>Usage:</i> <kbd>$objResponse->addReplace("contentDiv", "innerHTML", "text", "<b>text</b>");</kbd>
204
+     *
205
+     * @param string contains the id of an HTML element
206
+     * @param string the part of the element you wish to modify ("innerHTML",
207
+     *               "value", etc.)
208
+     * @param string the string to search for
209
+     * @param string the string to replace the search string when found in the
210
+     *               attribute
211
+     */
212
+    function addReplace($sTarget,$sAttribute,$sSearch,$sData)
213
+    {
214
+        $sDta = "<s><![CDATA[$sSearch]]></s><r><![CDATA[$sData]]></r>";
215
+        $this->xml .= $this->_cmdXML(array("n"=>"rp","t"=>$sTarget,"p"=>$sAttribute),$sDta);
216
+    }
217
+
218
+    /**
219
+     * Adds a clear command message to the XML response.
220
+     *
221
+     * <i>Usage:</i> <kbd>$objResponse->addClear("contentDiv", "innerHTML");</kbd>
222
+     *
223
+     * @param string contains the id of an HTML element
224
+     * @param string the part of the element you wish to clear ("innerHTML",
225
+     *               "value", etc.)
226
+     */
227
+    function addClear($sTarget,$sAttribute)
228
+    {
229
+        $this->addAssign($sTarget,$sAttribute,'');
230
+    }
231
+
232
+    /**
233
+     * Adds an alert command message to the XML response.
234
+     *
235
+     * <i>Usage:</i> <kbd>$objResponse->addAlert("This is important information");</kbd>
236
+     *
237
+     * @param string the text to be displayed in the Javascript alert box
238
+     */
239
+    function addAlert($sMsg)
240
+    {
241
+        $this->xml .= $this->_cmdXML(array("n"=>"al"),$sMsg);
242
+    }
243
+
244
+    /**
245
+     * Uses the addScript() method to add a Javascript redirect to another URL.
246
+     *
247
+     * <i>Usage:</i> <kbd>$objResponse->addRedirect("http://www.xajaxproject.org");</kbd>
248
+     *
249
+     * @param string the URL to redirect the client browser to
250
+     */
251
+    function addRedirect($sURL)
252
+    {
253
+        //we need to parse the query part so that the values are rawurlencode()'ed
254
+        //can't just use parse_url() cos we could be dealing with a relative URL which
255
+        //  parse_url() can't deal with.
256
+        $queryStart = strpos($sURL, '?', strrpos($sURL, '/'));
257
+        if ($queryStart !== FALSE)
258
+        {
259
+            $queryStart++;
260
+            $queryEnd = strpos($sURL, '#', $queryStart);
261
+            if ($queryEnd === FALSE)
262
+                $queryEnd = strlen($sURL);
263
+            $queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart);
264 264
             $queryParts = array();
265
-			parse_str($queryPart, $queryParts);
266
-			$newQueryPart = "";
267
-			foreach($queryParts as $key => $value)
268
-			{
269
-				$newQueryPart .= rawurlencode($key).'='.rawurlencode($value).ini_get('arg_separator.output');
270
-			}
271
-			$sURL = str_replace($queryPart, $newQueryPart, $sURL);
272
-		}
273
-		$this->addScript('window.location = "'.$sURL.'";');
274
-	}
275
-
276
-	/**
277
-	 * Adds a Javascript command message to the XML response.
278
-	 *
279
-	 * <i>Usage:</i> <kbd>$objResponse->addScript("var x = prompt('get some text');");</kbd>
280
-	 *
281
-	 * @param string contains Javascript code to be executed
282
-	 */
283
-	function addScript($sJS)
284
-	{
285
-		$this->xml .= $this->_cmdXML(array("n"=>"js"),$sJS);
286
-	}
287
-
288
-	/**
289
-	 * Adds a Javascript function call command message to the XML response.
290
-	 *
291
-	 * <i>Usage:</i> <kbd>$objResponse->addScriptCall("myJSFunction", "arg 1", "arg 2", 12345);</kbd>
292
-	 *
293
-	 * @param string $sFunc the name of a Javascript function
294
-	 * @param mixed $args,... optional arguments to pass to the Javascript function
295
-	 */
296
-	function addScriptCall() {
297
-		$arguments = func_get_args();
298
-		$sFunc = array_shift($arguments);
299
-		$sData = $this->_buildObjXml($arguments);
300
-		$this->xml .= $this->_cmdXML(array("n"=>"jc","t"=>$sFunc),$sData);
301
-	}
302
-
303
-	/**
304
-	 * Adds a remove element command message to the XML response.
305
-	 *
306
-	 * <i>Usage:</i> <kbd>$objResponse->addRemove("Div2");</kbd>
307
-	 *
308
-	 * @param string contains the id of an HTML element to be removed
309
-	 */
310
-	function addRemove($sTarget)
311
-	{
312
-		$this->xml .= $this->_cmdXML(array("n"=>"rm","t"=>$sTarget),'');
313
-	}
314
-
315
-	/**
316
-	 * Adds a create element command message to the XML response.
317
-	 *
318
-	 * <i>Usage:</i> <kbd>$objResponse->addCreate("parentDiv", "h3", "myid");</kbd>
319
-	 *
320
-	 * @param string contains the id of an HTML element to to which the new
321
-	 *               element will be appended.
322
-	 * @param string the tag to be added
323
-	 * @param string the id to be assigned to the new element
324
-	 * @param string deprecated, use the addCreateInput() method instead
325
-	 */
326
-	function addCreate($sParent, $sTag, $sId, $sType="")
327
-	{
328
-		if ($sType)
329
-		{
330
-			trigger_error("The \$sType parameter of addCreate has been deprecated.  Use the addCreateInput() method instead.", E_USER_WARNING);
331
-			return;
332
-		}
333
-		$this->xml .= $this->_cmdXML(array("n"=>"ce","t"=>$sParent,"p"=>$sId),$sTag);
334
-	}
335
-
336
-	/**
337
-	 * Adds a insert element command message to the XML response.
338
-	 *
339
-	 * <i>Usage:</i> <kbd>$objResponse->addInsert("childDiv", "h3", "myid");</kbd>
340
-	 *
341
-	 * @param string contains the id of the child before which the new element
342
-	 *               will be inserted
343
-	 * @param string the tag to be added
344
-	 * @param string the id to be assigned to the new element
345
-	 */
346
-	function addInsert($sBefore, $sTag, $sId)
347
-	{
348
-		$this->xml .= $this->_cmdXML(array("n"=>"ie","t"=>$sBefore,"p"=>$sId),$sTag);
349
-	}
350
-
351
-	/**
352
-	 * Adds a insert element command message to the XML response.
353
-	 *
354
-	 * <i>Usage:</i> <kbd>$objResponse->addInsertAfter("childDiv", "h3", "myid");</kbd>
355
-	 *
356
-	 * @param string contains the id of the child after which the new element
357
-	 *               will be inserted
358
-	 * @param string the tag to be added
359
-	 * @param string the id to be assigned to the new element
360
-	 */
361
-	function addInsertAfter($sAfter, $sTag, $sId)
362
-	{
363
-		$this->xml .= $this->_cmdXML(array("n"=>"ia","t"=>$sAfter,"p"=>$sId),$sTag);
364
-	}
365
-
366
-	/**
367
-	 * Adds a create input command message to the XML response.
368
-	 *
369
-	 * <i>Usage:</i> <kbd>$objResponse->addCreateInput("form1", "text", "username", "input1");</kbd>
370
-	 *
371
-	 * @param string contains the id of an HTML element to which the new input
372
-	 *               will be appended
373
-	 * @param string the type of input to be created (text, radio, checkbox,
374
-	 *               etc.)
375
-	 * @param string the name to be assigned to the new input and the variable
376
-	 *               name when it is submitted
377
-	 * @param string the id to be assigned to the new input
378
-	 */
379
-	function addCreateInput($sParent, $sType, $sName, $sId)
380
-	{
381
-		$this->xml .= $this->_cmdXML(array("n"=>"ci","t"=>$sParent,"p"=>$sId,"c"=>$sType),$sName);
382
-	}
383
-
384
-	/**
385
-	 * Adds an insert input command message to the XML response.
386
-	 *
387
-	 * <i>Usage:</i> <kbd>$objResponse->addInsertInput("input5", "text", "username", "input1");</kbd>
388
-	 *
389
-	 * @param string contains the id of the child before which the new element
390
-	 *               will be inserted
391
-	 * @param string the type of input to be created (text, radio, checkbox,
392
-	 *               etc.)
393
-	 * @param string the name to be assigned to the new input and the variable
394
-	 *               name when it is submitted
395
-	 * @param string the id to be assigned to the new input
396
-	 */
397
-	function addInsertInput($sBefore, $sType, $sName, $sId)
398
-	{
399
-		$this->xml .= $this->_cmdXML(array("n"=>"ii","t"=>$sBefore,"p"=>$sId,"c"=>$sType),$sName);
400
-	}
401
-
402
-	/**
403
-	 * Adds an insert input command message to the XML response.
404
-	 *
405
-	 * <i>Usage:</i> <kbd>$objResponse->addInsertInputAfter("input7", "text", "email", "input2");</kbd>
406
-	 *
407
-	 * @param string contains the id of the child after which the new element
408
-	 *               will be inserted
409
-	 * @param string the type of input to be created (text, radio, checkbox,
410
-	 *               etc.)
411
-	 * @param string the name to be assigned to the new input and the variable
412
-	 *               name when it is submitted
413
-	 * @param string the id to be assigned to the new input
414
-	 */
415
-	function addInsertInputAfter($sAfter, $sType, $sName, $sId)
416
-	{
417
-		$this->xml .= $this->_cmdXML(array("n"=>"iia","t"=>$sAfter,"p"=>$sId,"c"=>$sType),$sName);
418
-	}
419
-
420
-	/**
421
-	 * Adds an event command message to the XML response.
422
-	 *
423
-	 * <i>Usage:</i> <kbd>$objResponse->addEvent("contentDiv", "onclick", "alert(\'Hello World\');");</kbd>
424
-	 *
425
-	 * @param string contains the id of an HTML element
426
-	 * @param string the event you wish to set ("onclick", "onmouseover", etc.)
427
-	 * @param string the Javascript string you want the event to invoke
428
-	 */
429
-	function addEvent($sTarget,$sEvent,$sScript)
430
-	{
431
-		$this->xml .= $this->_cmdXML(array("n"=>"ev","t"=>$sTarget,"p"=>$sEvent),$sScript);
432
-	}
433
-
434
-	/**
435
-	 * Adds a handler command message to the XML response.
436
-	 *
437
-	 * <i>Usage:</i> <kbd>$objResponse->addHandler("contentDiv", "onclick", "content_click");</kbd>
438
-	 *
439
-	 * @param string contains the id of an HTML element
440
-	 * @param string the event you wish to set ("onclick", "onmouseover", etc.)
441
-	 * @param string the name of a Javascript function that will handle the
442
-	 *               event. Multiple handlers can be added for the same event
443
-	 */
444
-	function addHandler($sTarget,$sEvent,$sHandler)
445
-	{
446
-		$this->xml .= $this->_cmdXML(array("n"=>"ah","t"=>$sTarget,"p"=>$sEvent),$sHandler);
447
-	}
448
-
449
-	/**
450
-	 * Adds a remove handler command message to the XML response.
451
-	 *
452
-	 * <i>Usage:</i> <kbd>$objResponse->addRemoveHandler("contentDiv", "onclick", "content_click");</kbd>
453
-	 *
454
-	 * @param string contains the id of an HTML element
455
-	 * @param string the event you wish to remove ("onclick", "onmouseover",
456
-	 *               etc.)
457
-	 * @param string the name of a Javascript handler function that you want to
458
-	 *               remove
459
-	 */
460
-	function addRemoveHandler($sTarget,$sEvent,$sHandler)
461
-	{
462
-		$this->xml .= $this->_cmdXML(array("n"=>"rh","t"=>$sTarget,"p"=>$sEvent),$sHandler);
463
-	}
464
-
465
-	/**
466
-	 * Adds an include script command message to the XML response.
467
-	 *
468
-	 * <i>Usage:</i> <kbd>$objResponse->addIncludeScript("functions.js");</kbd>
469
-	 *
470
-	 * @param string URL of the Javascript file to include
471
-	 */
472
-	function addIncludeScript($sFileName)
473
-	{
474
-		$this->xml .= $this->_cmdXML(array("n"=>"in"),$sFileName);
475
-	}
476
-
477
-	/**
478
-	 * Returns the XML to be returned from your function to the xajax processor
479
-	 * on your page. Since xajax 0.2, you can also return an xajaxResponse
480
-	 * object from your function directly, and xajax will automatically request
481
-	 * the XML using this method call.
482
-	 *
483
-	 * <i>Usage:</i> <kbd>return $objResponse->getXML();</kbd>
484
-	 *
485
-	 * @return string response XML data
486
-	 */
487
-	function getXML()
488
-	{
489
-		$sXML = "<?xml version=\"1.0\"";
490
-		if ($this->sEncoding && strlen(trim($this->sEncoding)) > 0)
491
-			$sXML .= " encoding=\"".$this->sEncoding."\"";
492
-		$sXML .= " ?"."><xjx>" . $this->xml . "</xjx>";
493
-
494
-		return $sXML;
495
-	}
496
-
497
-	/**
498
-	 * Adds the commands of the provided response XML output to this response
499
-	 * object
500
-	 *
501
-	 * <i>Usage:</i>
502
-	 * <code>$r1 = $objResponse1->getXML();
503
-	 * $objResponse2->loadXML($r1);
504
-	 * return $objResponse2->getXML();</code>
505
-	 *
506
-	 * @param string the response XML (returned from a getXML() method) to add
507
-	 *               to the end of this response object
508
-	 */
509
-	function loadXML($mXML)
510
-	{
511
-		if (is_a($mXML, "xajaxResponse")) {
512
-			$mXML = $mXML->getXML();
513
-		}
514
-		$sNewXML = "";
515
-		$iStartPos = strpos($mXML, "<xjx>") + 5;
516
-		$sNewXML = substr($mXML, $iStartPos);
517
-		$iEndPos = strpos($sNewXML, "</xjx>");
518
-		$sNewXML = substr($sNewXML, 0, $iEndPos);
519
-		$this->xml .= $sNewXML;
520
-	}
521
-
522
-	/**
523
-	 * Generates XML from command data
524
-	 *
525
-	 * @access private
526
-	 * @param array associative array of attributes
527
-	 * @param string data
528
-	 * @return string XML command
529
-	 */
530
-	function _cmdXML($aAttributes, $sData)
531
-	{
532
-		if ($this->bOutputEntities) {
533
-			// An adaptation for the Dokeos LMS, 22-AUG-2009.
534
-			if (function_exists('api_convert_encoding')) {
535
-				$sData = call_user_func_array('api_convert_encoding', array(&$sData, 'HTML-ENTITIES', $this->sEncoding));
536
-			}
537
-			//if (function_exists('mb_convert_encoding')) {
538
-			elseif (function_exists('mb_convert_encoding')) {
539
-			//
540
-				$sData = call_user_func_array('mb_convert_encoding', array(&$sData, 'HTML-ENTITIES', $this->sEncoding));
541
-			}
542
-			else {
543
-				trigger_error("The xajax XML response output could not be converted to HTML entities because the mb_convert_encoding function is not available", E_USER_NOTICE);
544
-			}
545
-		}
546
-		$xml = "<cmd";
547
-		foreach($aAttributes as $sAttribute => $sValue)
548
-			$xml .= " $sAttribute=\"$sValue\"";
549
-		if ($sData !== null && !stristr($sData,'<![CDATA['))
550
-			$xml .= "><![CDATA[$sData]]></cmd>";
551
-		else if ($sData !== null)
552
-			$xml .= ">$sData</cmd>";
553
-		else
554
-			$xml .= "></cmd>";
555
-
556
-		return $xml;
557
-	}
558
-
559
-	/**
560
-	 * Recursively serializes a data structure in XML so it can be sent to
561
-	 * the client. It could be thought of as the opposite of
562
-	 * {@link xajax::_parseObjXml()}.
563
-	 *
564
-	 * @access private
565
-	 * @param mixed data structure to serialize to XML
566
-	 * @return string serialized XML
567
-	 */
568
-	function _buildObjXml($var) {
569
-		if (gettype($var) == "object") $var = get_object_vars($var);
570
-		if (!is_array($var)) {
571
-			return "<![CDATA[$var]]>";
572
-		}
573
-		else {
574
-			$data = "<xjxobj>";
575
-			foreach ($var as $key => $value) {
576
-				$data .= "<e>";
577
-				$data .= "<k>" . htmlspecialchars($key) . "</k>";
578
-				$data .= "<v>" . $this->_buildObjXml($value) . "</v>";
579
-				$data .= "</e>";
580
-			}
581
-			$data .= "</xjxobj>";
582
-			return $data;
583
-		}
584
-	}
265
+            parse_str($queryPart, $queryParts);
266
+            $newQueryPart = "";
267
+            foreach($queryParts as $key => $value)
268
+            {
269
+                $newQueryPart .= rawurlencode($key).'='.rawurlencode($value).ini_get('arg_separator.output');
270
+            }
271
+            $sURL = str_replace($queryPart, $newQueryPart, $sURL);
272
+        }
273
+        $this->addScript('window.location = "'.$sURL.'";');
274
+    }
275
+
276
+    /**
277
+     * Adds a Javascript command message to the XML response.
278
+     *
279
+     * <i>Usage:</i> <kbd>$objResponse->addScript("var x = prompt('get some text');");</kbd>
280
+     *
281
+     * @param string contains Javascript code to be executed
282
+     */
283
+    function addScript($sJS)
284
+    {
285
+        $this->xml .= $this->_cmdXML(array("n"=>"js"),$sJS);
286
+    }
287
+
288
+    /**
289
+     * Adds a Javascript function call command message to the XML response.
290
+     *
291
+     * <i>Usage:</i> <kbd>$objResponse->addScriptCall("myJSFunction", "arg 1", "arg 2", 12345);</kbd>
292
+     *
293
+     * @param string $sFunc the name of a Javascript function
294
+     * @param mixed $args,... optional arguments to pass to the Javascript function
295
+     */
296
+    function addScriptCall() {
297
+        $arguments = func_get_args();
298
+        $sFunc = array_shift($arguments);
299
+        $sData = $this->_buildObjXml($arguments);
300
+        $this->xml .= $this->_cmdXML(array("n"=>"jc","t"=>$sFunc),$sData);
301
+    }
302
+
303
+    /**
304
+     * Adds a remove element command message to the XML response.
305
+     *
306
+     * <i>Usage:</i> <kbd>$objResponse->addRemove("Div2");</kbd>
307
+     *
308
+     * @param string contains the id of an HTML element to be removed
309
+     */
310
+    function addRemove($sTarget)
311
+    {
312
+        $this->xml .= $this->_cmdXML(array("n"=>"rm","t"=>$sTarget),'');
313
+    }
314
+
315
+    /**
316
+     * Adds a create element command message to the XML response.
317
+     *
318
+     * <i>Usage:</i> <kbd>$objResponse->addCreate("parentDiv", "h3", "myid");</kbd>
319
+     *
320
+     * @param string contains the id of an HTML element to to which the new
321
+     *               element will be appended.
322
+     * @param string the tag to be added
323
+     * @param string the id to be assigned to the new element
324
+     * @param string deprecated, use the addCreateInput() method instead
325
+     */
326
+    function addCreate($sParent, $sTag, $sId, $sType="")
327
+    {
328
+        if ($sType)
329
+        {
330
+            trigger_error("The \$sType parameter of addCreate has been deprecated.  Use the addCreateInput() method instead.", E_USER_WARNING);
331
+            return;
332
+        }
333
+        $this->xml .= $this->_cmdXML(array("n"=>"ce","t"=>$sParent,"p"=>$sId),$sTag);
334
+    }
335
+
336
+    /**
337
+     * Adds a insert element command message to the XML response.
338
+     *
339
+     * <i>Usage:</i> <kbd>$objResponse->addInsert("childDiv", "h3", "myid");</kbd>
340
+     *
341
+     * @param string contains the id of the child before which the new element
342
+     *               will be inserted
343
+     * @param string the tag to be added
344
+     * @param string the id to be assigned to the new element
345
+     */
346
+    function addInsert($sBefore, $sTag, $sId)
347
+    {
348
+        $this->xml .= $this->_cmdXML(array("n"=>"ie","t"=>$sBefore,"p"=>$sId),$sTag);
349
+    }
350
+
351
+    /**
352
+     * Adds a insert element command message to the XML response.
353
+     *
354
+     * <i>Usage:</i> <kbd>$objResponse->addInsertAfter("childDiv", "h3", "myid");</kbd>
355
+     *
356
+     * @param string contains the id of the child after which the new element
357
+     *               will be inserted
358
+     * @param string the tag to be added
359
+     * @param string the id to be assigned to the new element
360
+     */
361
+    function addInsertAfter($sAfter, $sTag, $sId)
362
+    {
363
+        $this->xml .= $this->_cmdXML(array("n"=>"ia","t"=>$sAfter,"p"=>$sId),$sTag);
364
+    }
365
+
366
+    /**
367
+     * Adds a create input command message to the XML response.
368
+     *
369
+     * <i>Usage:</i> <kbd>$objResponse->addCreateInput("form1", "text", "username", "input1");</kbd>
370
+     *
371
+     * @param string contains the id of an HTML element to which the new input
372
+     *               will be appended
373
+     * @param string the type of input to be created (text, radio, checkbox,
374
+     *               etc.)
375
+     * @param string the name to be assigned to the new input and the variable
376
+     *               name when it is submitted
377
+     * @param string the id to be assigned to the new input
378
+     */
379
+    function addCreateInput($sParent, $sType, $sName, $sId)
380
+    {
381
+        $this->xml .= $this->_cmdXML(array("n"=>"ci","t"=>$sParent,"p"=>$sId,"c"=>$sType),$sName);
382
+    }
383
+
384
+    /**
385
+     * Adds an insert input command message to the XML response.
386
+     *
387
+     * <i>Usage:</i> <kbd>$objResponse->addInsertInput("input5", "text", "username", "input1");</kbd>
388
+     *
389
+     * @param string contains the id of the child before which the new element
390
+     *               will be inserted
391
+     * @param string the type of input to be created (text, radio, checkbox,
392
+     *               etc.)
393
+     * @param string the name to be assigned to the new input and the variable
394
+     *               name when it is submitted
395
+     * @param string the id to be assigned to the new input
396
+     */
397
+    function addInsertInput($sBefore, $sType, $sName, $sId)
398
+    {
399
+        $this->xml .= $this->_cmdXML(array("n"=>"ii","t"=>$sBefore,"p"=>$sId,"c"=>$sType),$sName);
400
+    }
401
+
402
+    /**
403
+     * Adds an insert input command message to the XML response.
404
+     *
405
+     * <i>Usage:</i> <kbd>$objResponse->addInsertInputAfter("input7", "text", "email", "input2");</kbd>
406
+     *
407
+     * @param string contains the id of the child after which the new element
408
+     *               will be inserted
409
+     * @param string the type of input to be created (text, radio, checkbox,
410
+     *               etc.)
411
+     * @param string the name to be assigned to the new input and the variable
412
+     *               name when it is submitted
413
+     * @param string the id to be assigned to the new input
414
+     */
415
+    function addInsertInputAfter($sAfter, $sType, $sName, $sId)
416
+    {
417
+        $this->xml .= $this->_cmdXML(array("n"=>"iia","t"=>$sAfter,"p"=>$sId,"c"=>$sType),$sName);
418
+    }
419
+
420
+    /**
421
+     * Adds an event command message to the XML response.
422
+     *
423
+     * <i>Usage:</i> <kbd>$objResponse->addEvent("contentDiv", "onclick", "alert(\'Hello World\');");</kbd>
424
+     *
425
+     * @param string contains the id of an HTML element
426
+     * @param string the event you wish to set ("onclick", "onmouseover", etc.)
427
+     * @param string the Javascript string you want the event to invoke
428
+     */
429
+    function addEvent($sTarget,$sEvent,$sScript)
430
+    {
431
+        $this->xml .= $this->_cmdXML(array("n"=>"ev","t"=>$sTarget,"p"=>$sEvent),$sScript);
432
+    }
433
+
434
+    /**
435
+     * Adds a handler command message to the XML response.
436
+     *
437
+     * <i>Usage:</i> <kbd>$objResponse->addHandler("contentDiv", "onclick", "content_click");</kbd>
438
+     *
439
+     * @param string contains the id of an HTML element
440
+     * @param string the event you wish to set ("onclick", "onmouseover", etc.)
441
+     * @param string the name of a Javascript function that will handle the
442
+     *               event. Multiple handlers can be added for the same event
443
+     */
444
+    function addHandler($sTarget,$sEvent,$sHandler)
445
+    {
446
+        $this->xml .= $this->_cmdXML(array("n"=>"ah","t"=>$sTarget,"p"=>$sEvent),$sHandler);
447
+    }
448
+
449
+    /**
450
+     * Adds a remove handler command message to the XML response.
451
+     *
452
+     * <i>Usage:</i> <kbd>$objResponse->addRemoveHandler("contentDiv", "onclick", "content_click");</kbd>
453
+     *
454
+     * @param string contains the id of an HTML element
455
+     * @param string the event you wish to remove ("onclick", "onmouseover",
456
+     *               etc.)
457
+     * @param string the name of a Javascript handler function that you want to
458
+     *               remove
459
+     */
460
+    function addRemoveHandler($sTarget,$sEvent,$sHandler)
461
+    {
462
+        $this->xml .= $this->_cmdXML(array("n"=>"rh","t"=>$sTarget,"p"=>$sEvent),$sHandler);
463
+    }
464
+
465
+    /**
466
+     * Adds an include script command message to the XML response.
467
+     *
468
+     * <i>Usage:</i> <kbd>$objResponse->addIncludeScript("functions.js");</kbd>
469
+     *
470
+     * @param string URL of the Javascript file to include
471
+     */
472
+    function addIncludeScript($sFileName)
473
+    {
474
+        $this->xml .= $this->_cmdXML(array("n"=>"in"),$sFileName);
475
+    }
476
+
477
+    /**
478
+     * Returns the XML to be returned from your function to the xajax processor
479
+     * on your page. Since xajax 0.2, you can also return an xajaxResponse
480
+     * object from your function directly, and xajax will automatically request
481
+     * the XML using this method call.
482
+     *
483
+     * <i>Usage:</i> <kbd>return $objResponse->getXML();</kbd>
484
+     *
485
+     * @return string response XML data
486
+     */
487
+    function getXML()
488
+    {
489
+        $sXML = "<?xml version=\"1.0\"";
490
+        if ($this->sEncoding && strlen(trim($this->sEncoding)) > 0)
491
+            $sXML .= " encoding=\"".$this->sEncoding."\"";
492
+        $sXML .= " ?"."><xjx>" . $this->xml . "</xjx>";
493
+
494
+        return $sXML;
495
+    }
496
+
497
+    /**
498
+     * Adds the commands of the provided response XML output to this response
499
+     * object
500
+     *
501
+     * <i>Usage:</i>
502
+     * <code>$r1 = $objResponse1->getXML();
503
+     * $objResponse2->loadXML($r1);
504
+     * return $objResponse2->getXML();</code>
505
+     *
506
+     * @param string the response XML (returned from a getXML() method) to add
507
+     *               to the end of this response object
508
+     */
509
+    function loadXML($mXML)
510
+    {
511
+        if (is_a($mXML, "xajaxResponse")) {
512
+            $mXML = $mXML->getXML();
513
+        }
514
+        $sNewXML = "";
515
+        $iStartPos = strpos($mXML, "<xjx>") + 5;
516
+        $sNewXML = substr($mXML, $iStartPos);
517
+        $iEndPos = strpos($sNewXML, "</xjx>");
518
+        $sNewXML = substr($sNewXML, 0, $iEndPos);
519
+        $this->xml .= $sNewXML;
520
+    }
521
+
522
+    /**
523
+     * Generates XML from command data
524
+     *
525
+     * @access private
526
+     * @param array associative array of attributes
527
+     * @param string data
528
+     * @return string XML command
529
+     */
530
+    function _cmdXML($aAttributes, $sData)
531
+    {
532
+        if ($this->bOutputEntities) {
533
+            // An adaptation for the Dokeos LMS, 22-AUG-2009.
534
+            if (function_exists('api_convert_encoding')) {
535
+                $sData = call_user_func_array('api_convert_encoding', array(&$sData, 'HTML-ENTITIES', $this->sEncoding));
536
+            }
537
+            //if (function_exists('mb_convert_encoding')) {
538
+            elseif (function_exists('mb_convert_encoding')) {
539
+            //
540
+                $sData = call_user_func_array('mb_convert_encoding', array(&$sData, 'HTML-ENTITIES', $this->sEncoding));
541
+            }
542
+            else {
543
+                trigger_error("The xajax XML response output could not be converted to HTML entities because the mb_convert_encoding function is not available", E_USER_NOTICE);
544
+            }
545
+        }
546
+        $xml = "<cmd";
547
+        foreach($aAttributes as $sAttribute => $sValue)
548
+            $xml .= " $sAttribute=\"$sValue\"";
549
+        if ($sData !== null && !stristr($sData,'<![CDATA['))
550
+            $xml .= "><![CDATA[$sData]]></cmd>";
551
+        else if ($sData !== null)
552
+            $xml .= ">$sData</cmd>";
553
+        else
554
+            $xml .= "></cmd>";
555
+
556
+        return $xml;
557
+    }
558
+
559
+    /**
560
+     * Recursively serializes a data structure in XML so it can be sent to
561
+     * the client. It could be thought of as the opposite of
562
+     * {@link xajax::_parseObjXml()}.
563
+     *
564
+     * @access private
565
+     * @param mixed data structure to serialize to XML
566
+     * @return string serialized XML
567
+     */
568
+    function _buildObjXml($var) {
569
+        if (gettype($var) == "object") $var = get_object_vars($var);
570
+        if (!is_array($var)) {
571
+            return "<![CDATA[$var]]>";
572
+        }
573
+        else {
574
+            $data = "<xjxobj>";
575
+            foreach ($var as $key => $value) {
576
+                $data .= "<e>";
577
+                $data .= "<k>" . htmlspecialchars($key) . "</k>";
578
+                $data .= "<v>" . $this->_buildObjXml($value) . "</v>";
579
+                $data .= "</e>";
580
+            }
581
+            $data .= "</xjxobj>";
582
+            return $data;
583
+        }
584
+    }
585 585
 
586 586
 }// end class xajaxResponse
587 587
 ?>
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 *                converted to HTML entities
100 100
 	 *
101 101
 	 */
102
-	function xajaxResponse($sEncoding=XAJAX_DEFAULT_CHAR_ENCODING, $bOutputEntities=false)
102
+	function xajaxResponse($sEncoding = XAJAX_DEFAULT_CHAR_ENCODING, $bOutputEntities = false)
103 103
 	{
104 104
 		$this->setCharEncoding($sEncoding);
105 105
 		$this->bOutputEntities = $bOutputEntities;
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	function addConfirmCommands($iCmdNumber, $sMessage)
150 150
 	{
151
-		$this->xml .= $this->_cmdXML(array("n"=>"cc","t"=>$iCmdNumber),$sMessage);
151
+		$this->xml .= $this->_cmdXML(array("n"=>"cc", "t"=>$iCmdNumber), $sMessage);
152 152
 	}
153 153
 
154 154
 	/**
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
 	 *               "value", etc.)
162 162
 	 * @param string the data you want to set the attribute to
163 163
 	 */
164
-	function addAssign($sTarget,$sAttribute,$sData)
164
+	function addAssign($sTarget, $sAttribute, $sData)
165 165
 	{
166
-		$this->xml .= $this->_cmdXML(array("n"=>"as","t"=>$sTarget,"p"=>$sAttribute),$sData);
166
+		$this->xml .= $this->_cmdXML(array("n"=>"as", "t"=>$sTarget, "p"=>$sAttribute), $sData);
167 167
 	}
168 168
 
169 169
 	/**
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
 	 *               "value", etc.)
177 177
 	 * @param string the data you want to append to the end of the attribute
178 178
 	 */
179
-	function addAppend($sTarget,$sAttribute,$sData)
179
+	function addAppend($sTarget, $sAttribute, $sData)
180 180
 	{
181
-		$this->xml .= $this->_cmdXML(array("n"=>"ap","t"=>$sTarget,"p"=>$sAttribute),$sData);
181
+		$this->xml .= $this->_cmdXML(array("n"=>"ap", "t"=>$sTarget, "p"=>$sAttribute), $sData);
182 182
 	}
183 183
 
184 184
 	/**
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
 	 * @param string the data you want to prepend to the beginning of the
193 193
 	 *               attribute
194 194
 	 */
195
-	function addPrepend($sTarget,$sAttribute,$sData)
195
+	function addPrepend($sTarget, $sAttribute, $sData)
196 196
 	{
197
-		$this->xml .= $this->_cmdXML(array("n"=>"pp","t"=>$sTarget,"p"=>$sAttribute),$sData);
197
+		$this->xml .= $this->_cmdXML(array("n"=>"pp", "t"=>$sTarget, "p"=>$sAttribute), $sData);
198 198
 	}
199 199
 
200 200
 	/**
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
 	 * @param string the string to replace the search string when found in the
210 210
 	 *               attribute
211 211
 	 */
212
-	function addReplace($sTarget,$sAttribute,$sSearch,$sData)
212
+	function addReplace($sTarget, $sAttribute, $sSearch, $sData)
213 213
 	{
214 214
 		$sDta = "<s><![CDATA[$sSearch]]></s><r><![CDATA[$sData]]></r>";
215
-		$this->xml .= $this->_cmdXML(array("n"=>"rp","t"=>$sTarget,"p"=>$sAttribute),$sDta);
215
+		$this->xml .= $this->_cmdXML(array("n"=>"rp", "t"=>$sTarget, "p"=>$sAttribute), $sDta);
216 216
 	}
217 217
 
218 218
 	/**
@@ -224,9 +224,9 @@  discard block
 block discarded – undo
224 224
 	 * @param string the part of the element you wish to clear ("innerHTML",
225 225
 	 *               "value", etc.)
226 226
 	 */
227
-	function addClear($sTarget,$sAttribute)
227
+	function addClear($sTarget, $sAttribute)
228 228
 	{
229
-		$this->addAssign($sTarget,$sAttribute,'');
229
+		$this->addAssign($sTarget, $sAttribute, '');
230 230
 	}
231 231
 
232 232
 	/**
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	function addAlert($sMsg)
240 240
 	{
241
-		$this->xml .= $this->_cmdXML(array("n"=>"al"),$sMsg);
241
+		$this->xml .= $this->_cmdXML(array("n"=>"al"), $sMsg);
242 242
 	}
243 243
 
244 244
 	/**
@@ -260,11 +260,11 @@  discard block
 block discarded – undo
260 260
 			$queryEnd = strpos($sURL, '#', $queryStart);
261 261
 			if ($queryEnd === FALSE)
262 262
 				$queryEnd = strlen($sURL);
263
-			$queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart);
263
+			$queryPart = substr($sURL, $queryStart, $queryEnd - $queryStart);
264 264
             $queryParts = array();
265 265
 			parse_str($queryPart, $queryParts);
266 266
 			$newQueryPart = "";
267
-			foreach($queryParts as $key => $value)
267
+			foreach ($queryParts as $key => $value)
268 268
 			{
269 269
 				$newQueryPart .= rawurlencode($key).'='.rawurlencode($value).ini_get('arg_separator.output');
270 270
 			}
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 */
283 283
 	function addScript($sJS)
284 284
 	{
285
-		$this->xml .= $this->_cmdXML(array("n"=>"js"),$sJS);
285
+		$this->xml .= $this->_cmdXML(array("n"=>"js"), $sJS);
286 286
 	}
287 287
 
288 288
 	/**
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 		$arguments = func_get_args();
298 298
 		$sFunc = array_shift($arguments);
299 299
 		$sData = $this->_buildObjXml($arguments);
300
-		$this->xml .= $this->_cmdXML(array("n"=>"jc","t"=>$sFunc),$sData);
300
+		$this->xml .= $this->_cmdXML(array("n"=>"jc", "t"=>$sFunc), $sData);
301 301
 	}
302 302
 
303 303
 	/**
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 */
310 310
 	function addRemove($sTarget)
311 311
 	{
312
-		$this->xml .= $this->_cmdXML(array("n"=>"rm","t"=>$sTarget),'');
312
+		$this->xml .= $this->_cmdXML(array("n"=>"rm", "t"=>$sTarget), '');
313 313
 	}
314 314
 
315 315
 	/**
@@ -323,14 +323,14 @@  discard block
 block discarded – undo
323 323
 	 * @param string the id to be assigned to the new element
324 324
 	 * @param string deprecated, use the addCreateInput() method instead
325 325
 	 */
326
-	function addCreate($sParent, $sTag, $sId, $sType="")
326
+	function addCreate($sParent, $sTag, $sId, $sType = "")
327 327
 	{
328 328
 		if ($sType)
329 329
 		{
330 330
 			trigger_error("The \$sType parameter of addCreate has been deprecated.  Use the addCreateInput() method instead.", E_USER_WARNING);
331 331
 			return;
332 332
 		}
333
-		$this->xml .= $this->_cmdXML(array("n"=>"ce","t"=>$sParent,"p"=>$sId),$sTag);
333
+		$this->xml .= $this->_cmdXML(array("n"=>"ce", "t"=>$sParent, "p"=>$sId), $sTag);
334 334
 	}
335 335
 
336 336
 	/**
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 	 */
346 346
 	function addInsert($sBefore, $sTag, $sId)
347 347
 	{
348
-		$this->xml .= $this->_cmdXML(array("n"=>"ie","t"=>$sBefore,"p"=>$sId),$sTag);
348
+		$this->xml .= $this->_cmdXML(array("n"=>"ie", "t"=>$sBefore, "p"=>$sId), $sTag);
349 349
 	}
350 350
 
351 351
 	/**
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 	 */
361 361
 	function addInsertAfter($sAfter, $sTag, $sId)
362 362
 	{
363
-		$this->xml .= $this->_cmdXML(array("n"=>"ia","t"=>$sAfter,"p"=>$sId),$sTag);
363
+		$this->xml .= $this->_cmdXML(array("n"=>"ia", "t"=>$sAfter, "p"=>$sId), $sTag);
364 364
 	}
365 365
 
366 366
 	/**
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 	 */
379 379
 	function addCreateInput($sParent, $sType, $sName, $sId)
380 380
 	{
381
-		$this->xml .= $this->_cmdXML(array("n"=>"ci","t"=>$sParent,"p"=>$sId,"c"=>$sType),$sName);
381
+		$this->xml .= $this->_cmdXML(array("n"=>"ci", "t"=>$sParent, "p"=>$sId, "c"=>$sType), $sName);
382 382
 	}
383 383
 
384 384
 	/**
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 	 */
397 397
 	function addInsertInput($sBefore, $sType, $sName, $sId)
398 398
 	{
399
-		$this->xml .= $this->_cmdXML(array("n"=>"ii","t"=>$sBefore,"p"=>$sId,"c"=>$sType),$sName);
399
+		$this->xml .= $this->_cmdXML(array("n"=>"ii", "t"=>$sBefore, "p"=>$sId, "c"=>$sType), $sName);
400 400
 	}
401 401
 
402 402
 	/**
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 	 */
415 415
 	function addInsertInputAfter($sAfter, $sType, $sName, $sId)
416 416
 	{
417
-		$this->xml .= $this->_cmdXML(array("n"=>"iia","t"=>$sAfter,"p"=>$sId,"c"=>$sType),$sName);
417
+		$this->xml .= $this->_cmdXML(array("n"=>"iia", "t"=>$sAfter, "p"=>$sId, "c"=>$sType), $sName);
418 418
 	}
419 419
 
420 420
 	/**
@@ -426,9 +426,9 @@  discard block
 block discarded – undo
426 426
 	 * @param string the event you wish to set ("onclick", "onmouseover", etc.)
427 427
 	 * @param string the Javascript string you want the event to invoke
428 428
 	 */
429
-	function addEvent($sTarget,$sEvent,$sScript)
429
+	function addEvent($sTarget, $sEvent, $sScript)
430 430
 	{
431
-		$this->xml .= $this->_cmdXML(array("n"=>"ev","t"=>$sTarget,"p"=>$sEvent),$sScript);
431
+		$this->xml .= $this->_cmdXML(array("n"=>"ev", "t"=>$sTarget, "p"=>$sEvent), $sScript);
432 432
 	}
433 433
 
434 434
 	/**
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
 	 * @param string the name of a Javascript function that will handle the
442 442
 	 *               event. Multiple handlers can be added for the same event
443 443
 	 */
444
-	function addHandler($sTarget,$sEvent,$sHandler)
444
+	function addHandler($sTarget, $sEvent, $sHandler)
445 445
 	{
446
-		$this->xml .= $this->_cmdXML(array("n"=>"ah","t"=>$sTarget,"p"=>$sEvent),$sHandler);
446
+		$this->xml .= $this->_cmdXML(array("n"=>"ah", "t"=>$sTarget, "p"=>$sEvent), $sHandler);
447 447
 	}
448 448
 
449 449
 	/**
@@ -457,9 +457,9 @@  discard block
 block discarded – undo
457 457
 	 * @param string the name of a Javascript handler function that you want to
458 458
 	 *               remove
459 459
 	 */
460
-	function addRemoveHandler($sTarget,$sEvent,$sHandler)
460
+	function addRemoveHandler($sTarget, $sEvent, $sHandler)
461 461
 	{
462
-		$this->xml .= $this->_cmdXML(array("n"=>"rh","t"=>$sTarget,"p"=>$sEvent),$sHandler);
462
+		$this->xml .= $this->_cmdXML(array("n"=>"rh", "t"=>$sTarget, "p"=>$sEvent), $sHandler);
463 463
 	}
464 464
 
465 465
 	/**
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 	 */
472 472
 	function addIncludeScript($sFileName)
473 473
 	{
474
-		$this->xml .= $this->_cmdXML(array("n"=>"in"),$sFileName);
474
+		$this->xml .= $this->_cmdXML(array("n"=>"in"), $sFileName);
475 475
 	}
476 476
 
477 477
 	/**
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 		$sXML = "<?xml version=\"1.0\"";
490 490
 		if ($this->sEncoding && strlen(trim($this->sEncoding)) > 0)
491 491
 			$sXML .= " encoding=\"".$this->sEncoding."\"";
492
-		$sXML .= " ?"."><xjx>" . $this->xml . "</xjx>";
492
+		$sXML .= " ?"."><xjx>".$this->xml."</xjx>";
493 493
 
494 494
 		return $sXML;
495 495
 	}
@@ -544,9 +544,9 @@  discard block
 block discarded – undo
544 544
 			}
545 545
 		}
546 546
 		$xml = "<cmd";
547
-		foreach($aAttributes as $sAttribute => $sValue)
547
+		foreach ($aAttributes as $sAttribute => $sValue)
548 548
 			$xml .= " $sAttribute=\"$sValue\"";
549
-		if ($sData !== null && !stristr($sData,'<![CDATA['))
549
+		if ($sData !== null && !stristr($sData, '<![CDATA['))
550 550
 			$xml .= "><![CDATA[$sData]]></cmd>";
551 551
 		else if ($sData !== null)
552 552
 			$xml .= ">$sData</cmd>";
@@ -574,8 +574,8 @@  discard block
 block discarded – undo
574 574
 			$data = "<xjxobj>";
575 575
 			foreach ($var as $key => $value) {
576 576
 				$data .= "<e>";
577
-				$data .= "<k>" . htmlspecialchars($key) . "</k>";
578
-				$data .= "<v>" . $this->_buildObjXml($value) . "</v>";
577
+				$data .= "<k>".htmlspecialchars($key)."</k>";
578
+				$data .= "<v>".$this->_buildObjXml($value)."</v>";
579 579
 				$data .= "</e>";
580 580
 			}
581 581
 			$data .= "</xjxobj>";
Please login to merge, or discard this patch.
Braces   +21 added lines, -17 removed lines patch added patch discarded remove patch
@@ -258,8 +258,9 @@  discard block
 block discarded – undo
258 258
 		{
259 259
 			$queryStart++;
260 260
 			$queryEnd = strpos($sURL, '#', $queryStart);
261
-			if ($queryEnd === FALSE)
262
-				$queryEnd = strlen($sURL);
261
+			if ($queryEnd === FALSE) {
262
+							$queryEnd = strlen($sURL);
263
+			}
263 264
 			$queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart);
264 265
             $queryParts = array();
265 266
 			parse_str($queryPart, $queryParts);
@@ -487,8 +488,9 @@  discard block
 block discarded – undo
487 488
 	function getXML()
488 489
 	{
489 490
 		$sXML = "<?xml version=\"1.0\"";
490
-		if ($this->sEncoding && strlen(trim($this->sEncoding)) > 0)
491
-			$sXML .= " encoding=\"".$this->sEncoding."\"";
491
+		if ($this->sEncoding && strlen(trim($this->sEncoding)) > 0) {
492
+					$sXML .= " encoding=\"".$this->sEncoding."\"";
493
+		}
492 494
 		$sXML .= " ?"."><xjx>" . $this->xml . "</xjx>";
493 495
 
494 496
 		return $sXML;
@@ -538,20 +540,21 @@  discard block
 block discarded – undo
538 540
 			elseif (function_exists('mb_convert_encoding')) {
539 541
 			//
540 542
 				$sData = call_user_func_array('mb_convert_encoding', array(&$sData, 'HTML-ENTITIES', $this->sEncoding));
541
-			}
542
-			else {
543
+			} else {
543 544
 				trigger_error("The xajax XML response output could not be converted to HTML entities because the mb_convert_encoding function is not available", E_USER_NOTICE);
544 545
 			}
545 546
 		}
546 547
 		$xml = "<cmd";
547
-		foreach($aAttributes as $sAttribute => $sValue)
548
-			$xml .= " $sAttribute=\"$sValue\"";
549
-		if ($sData !== null && !stristr($sData,'<![CDATA['))
550
-			$xml .= "><![CDATA[$sData]]></cmd>";
551
-		else if ($sData !== null)
552
-			$xml .= ">$sData</cmd>";
553
-		else
554
-			$xml .= "></cmd>";
548
+		foreach($aAttributes as $sAttribute => $sValue) {
549
+					$xml .= " $sAttribute=\"$sValue\"";
550
+		}
551
+		if ($sData !== null && !stristr($sData,'<![CDATA[')) {
552
+					$xml .= "><![CDATA[$sData]]></cmd>";
553
+		} else if ($sData !== null) {
554
+					$xml .= ">$sData</cmd>";
555
+		} else {
556
+					$xml .= "></cmd>";
557
+		}
555 558
 
556 559
 		return $xml;
557 560
 	}
@@ -566,11 +569,12 @@  discard block
 block discarded – undo
566 569
 	 * @return string serialized XML
567 570
 	 */
568 571
 	function _buildObjXml($var) {
569
-		if (gettype($var) == "object") $var = get_object_vars($var);
572
+		if (gettype($var) == "object") {
573
+		    $var = get_object_vars($var);
574
+		}
570 575
 		if (!is_array($var)) {
571 576
 			return "<![CDATA[$var]]>";
572
-		}
573
-		else {
577
+		} else {
574 578
 			$data = "<xjxobj>";
575 579
 			foreach ($var as $key => $value) {
576 580
 				$data .= "<e>";
Please login to merge, or discard this patch.
main/inc/lib/zombie/zombie_report.class.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -121,6 +121,9 @@
 block discarded – undo
121 121
         return $form->isSubmitted() == false || $form->validate();
122 122
     }
123 123
 
124
+    /**
125
+     * @param string $format
126
+     */
124 127
     function get_ceiling($format = null)
125 128
     {
126 129
         $result = Request::get('ceiling');
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
         }
168 168
 
169 169
         $action = $this->get_action();
170
-        $f = array($this, 'action_' . $action);
170
+        $f = array($this, 'action_'.$action);
171 171
         if (is_callable($f)) {
172 172
             return call_user_func($f, $ids);
173 173
         }
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
             $text = get_lang('No');
293 293
         }
294 294
 
295
-        $result = Display::return_icon($image . '.png', $text);
295
+        $result = Display::return_icon($image.'.png', $text);
296 296
         return $result;
297 297
     }
298 298
 
Please login to merge, or discard this patch.
main/install/install.lib.php 4 patches
Doc Comments   +14 added lines, -5 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
  * This function return the value of a php.ini setting if not "" or if exists,
98 98
  * otherwise return false
99 99
  * @param   string  $phpSetting The name of a PHP setting
100
- * @return  mixed   The value of the setting, or false if not found
100
+ * @return  string|false   The value of the setting, or false if not found
101 101
  */
102 102
 function checkPhpSettingExists($phpSetting)
103 103
 {
@@ -1268,6 +1268,10 @@  discard block
 block discarded – undo
1268 1268
  * @param   string  Extra notice (to show on the right side)
1269 1269
  * @param   boolean Whether to display in update mode
1270 1270
  * @param   string  Additional attribute for the <tr> element
1271
+ * @param string $installType
1272
+ * @param string $parameterName
1273
+ * @param string $formFieldName
1274
+ * @param string $extra_notice
1271 1275
  * @return  void    Direct output
1272 1276
  */
1273 1277
 function displayDatabaseParameter(
@@ -1481,6 +1485,11 @@  discard block
 block discarded – undo
1481 1485
 
1482 1486
     <?php
1483 1487
 }
1488
+/**
1489
+ * @param string $content
1490
+ * @param string $title
1491
+ * @param string $id
1492
+ */
1484 1493
 function panel($content = null, $title = null, $id = null, $style = null) {
1485 1494
     $html = '';
1486 1495
     if (empty($style)) {
@@ -1837,8 +1846,8 @@  discard block
 block discarded – undo
1837 1846
 }
1838 1847
 
1839 1848
 /**
1840
- * @param $current_value
1841
- * @param $wanted_value
1849
+ * @param string $current_value
1850
+ * @param string $wanted_value
1842 1851
  * @return string
1843 1852
  */
1844 1853
 function compare_setting_values($current_value, $wanted_value)
@@ -1855,8 +1864,8 @@  discard block
 block discarded – undo
1855 1864
 }
1856 1865
 
1857 1866
 /**
1858
- * @param $course_dir
1859
- * @param $course_attempt_name
1867
+ * @param string $course_dir
1868
+ * @param string $course_attempt_name
1860 1869
  * @param string $file
1861 1870
  * @return bool
1862 1871
  */
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1498,14 +1498,14 @@  discard block
 block discarded – undo
1498 1498
     return $html;
1499 1499
 }
1500 1500
 /**
1501
- * Displays a parameter in a table row.
1502
- * Used by the display_configuration_settings_form function.
1503
- * @param string $installType
1504
- * @param string $parameterName
1505
- * @param string $formFieldName
1506
- * @param string $parameterValue
1507
- * @param string $displayWhenUpdate
1508
- */
1501
+     * Displays a parameter in a table row.
1502
+     * Used by the display_configuration_settings_form function.
1503
+     * @param string $installType
1504
+     * @param string $parameterName
1505
+     * @param string $formFieldName
1506
+     * @param string $parameterValue
1507
+     * @param string $displayWhenUpdate
1508
+     */
1509 1509
 function display_configuration_parameter(
1510 1510
     $installType,
1511 1511
     $parameterName,
@@ -1682,7 +1682,7 @@  discard block
 block discarded – undo
1682 1682
         $html .= '<label class="checkbox-inline">
1683 1683
                         <input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" '. ($allowSelfReg == 'false' ? '' : 'checked="checked" ') .' /> '. get_lang('No') .'
1684 1684
                     </label>';
1685
-         $html .= '<label class="checkbox-inline">
1685
+            $html .= '<label class="checkbox-inline">
1686 1686
                     <input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" '. ($allowSelfReg == 'approval' ? '' : 'checked="checked" ') .' /> '. get_lang('AfterApproval') .'
1687 1687
                 </label>';
1688 1688
         $html .= '</div>';
@@ -1716,7 +1716,7 @@  discard block
 block discarded – undo
1716 1716
     </div>';
1717 1717
 
1718 1718
     echo panel($html, get_lang('Platform'), 'platform');
1719
- ?>
1719
+    ?>
1720 1720
     <div class='form-group'>
1721 1721
         <div class="col-sm-6">
1722 1722
             <button type="submit" class="btn btn-default pull-right" name="step3" value="&lt; <?php echo get_lang('Previous'); ?>" ><em class="fa fa-backward"> </em> <?php echo get_lang('Previous'); ?></button>
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
     if (!is_array($result)) {
397 397
         $result = array();
398 398
         $exceptions = array('.', '..', 'CVS', '.svn');
399
-        $search       = array('_latin',   '_unicode',   '_corporate',   '_org'  , '_KM',   '_');
399
+        $search       = array('_latin', '_unicode', '_corporate', '_org', '_KM', '_');
400 400
         $replace_with = array(' (Latin)', ' (unicode)', ' (corporate)', ' (org)', ' (KM)', ' ');
401 401
         $dirname = api_get_path(SYS_LANG_PATH);
402 402
         $handle = opendir($dirname);
@@ -430,9 +430,9 @@  discard block
 block discarded – undo
430 430
     if ($handle = opendir($directory)) {
431 431
         while (false !== ($file = readdir($handle))) {
432 432
             if ($file != "." && $file != "..") {
433
-                if (is_dir($directory. "/" . $file)) {
434
-                    $array_items = array_merge($array_items, my_directory_to_array($directory. '/' . $file));
435
-                    $file = $directory . "/" . $file;
433
+                if (is_dir($directory."/".$file)) {
434
+                    $array_items = array_merge($array_items, my_directory_to_array($directory.'/'.$file));
435
+                    $file = $directory."/".$file;
436 436
                     $array_items[] = preg_replace("/\/\//si", '/', $file);
437 437
                 }
438 438
             }
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
     <h2><?php get_lang('WelcomeToTheChamiloInstaller'); ?></h2>
637 637
     <div class="RequirementHeading">
638 638
         <h2><?php echo display_step_sequence(); ?>
639
-            <?php echo get_lang('InstallationLanguage');?>
639
+            <?php echo get_lang('InstallationLanguage'); ?>
640 640
         </h2>
641 641
         <p><?php echo get_lang('PleaseSelectInstallationProcessLanguage'); ?>:</p>
642 642
         <form id="lang_form" method="post" action="<?php echo api_get_self(); ?>">
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
     if (phpversion() < REQUIRED_PHP_VERSION) {
710 710
         echo '<strong><font color="red">'.get_lang('PHPVersionError').'</font></strong>';
711 711
     } else {
712
-        echo '<strong><font color="green">'.get_lang('PHPVersionOK'). ' '.phpversion().'</font></strong>';
712
+        echo '<strong><font color="green">'.get_lang('PHPVersionOK').' '.phpversion().'</font></strong>';
713 713
     }
714 714
     echo '</td>
715 715
             </tr>
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
             if ($file_course_test_was_created == true) {
882 882
                 break;
883 883
             }
884
-            $r = @touch($course_dir.'/test.php',$perm);
884
+            $r = @touch($course_dir.'/test.php', $perm);
885 885
             if ($r === true) {
886 886
                 $fil_perm_verified = $perm;
887 887
                 if (check_course_script_interpretation($course_dir, $course_attempt_name, 'test.php')) {
@@ -1137,7 +1137,7 @@  discard block
 block discarded – undo
1137 1137
 function get_contact_registration_form()
1138 1138
 {
1139 1139
 
1140
-    $html ='
1140
+    $html = '
1141 1141
    <form class="form-horizontal">
1142 1142
     <div class="panel panel-default">
1143 1143
     <div class="panel-body">
@@ -1234,7 +1234,7 @@  discard block
 block discarded – undo
1234 1234
             <div class="col-sm-9">
1235 1235
                 <div class="radio">
1236 1236
                     <label>
1237
-                        <input type="radio" name="financial_decision" id="financial_decision1" value="1" checked /> ' . get_lang('Yes') . '
1237
+                        <input type="radio" name="financial_decision" id="financial_decision1" value="1" checked /> ' . get_lang('Yes').'
1238 1238
                     </label>
1239 1239
                 </div>
1240 1240
                 <div class="radio">
@@ -1293,8 +1293,8 @@  discard block
 block discarded – undo
1293 1293
             echo '<input type="hidden" name="'.$formFieldName.'" id="'.$formFieldName.'" value="'.api_htmlentities($parameterValue).'" />';
1294 1294
             echo api_htmlentities($parameterValue);
1295 1295
         } else {
1296
-            echo '<div class="col-sm-5"><input type="' . $inputType . '" class="form-control" size="' . DATABASE_FORM_FIELD_DISPLAY_LENGTH . '" maxlength="' . $maxLength . '" name="' . $formFieldName . '" id="' . $formFieldName . '" value="' . api_htmlentities($parameterValue) . '" />' . "</div>";
1297
-            echo '<div class="col-sm-3">' . $extra_notice . '</div>';
1296
+            echo '<div class="col-sm-5"><input type="'.$inputType.'" class="form-control" size="'.DATABASE_FORM_FIELD_DISPLAY_LENGTH.'" maxlength="'.$maxLength.'" name="'.$formFieldName.'" id="'.$formFieldName.'" value="'.api_htmlentities($parameterValue).'" />'."</div>";
1297
+            echo '<div class="col-sm-3">'.$extra_notice.'</div>';
1298 1298
         }
1299 1299
 
1300 1300
     }
@@ -1330,12 +1330,12 @@  discard block
 block discarded – undo
1330 1330
         $dbNameForm = $_configuration['main_database'];
1331 1331
         $dbPortForm = isset($_configuration['db_port']) ? $_configuration['db_port'] : '';
1332 1332
 
1333
-        echo '<div class="RequirementHeading"><h2>' . display_step_sequence() .get_lang('DBSetting') . '</h2></div>';
1333
+        echo '<div class="RequirementHeading"><h2>'.display_step_sequence().get_lang('DBSetting').'</h2></div>';
1334 1334
         echo '<div class="RequirementContent">';
1335 1335
         echo get_lang('DBSettingUpgradeIntro');
1336 1336
         echo '</div>';
1337 1337
     } else {
1338
-        echo '<div class="RequirementHeading"><h2>' . display_step_sequence() .get_lang('DBSetting') . '</h2></div>';
1338
+        echo '<div class="RequirementHeading"><h2>'.display_step_sequence().get_lang('DBSetting').'</h2></div>';
1339 1339
         echo '<div class="RequirementContent">';
1340 1340
         echo get_lang('DBSettingIntro');
1341 1341
         echo '</div>';
@@ -1345,12 +1345,12 @@  discard block
 block discarded – undo
1345 1345
         <div class="panel-body">
1346 1346
         <div class="form-group">
1347 1347
             <label class="col-sm-4"><?php echo get_lang('DBHost'); ?> </label>
1348
-            <?php if ($installType == 'update'){ ?>
1348
+            <?php if ($installType == 'update') { ?>
1349 1349
             <div class="col-sm-5">
1350 1350
                 <input type="hidden" name="dbHostForm" value="<?php echo htmlentities($dbHostForm); ?>" /><?php echo $dbHostForm; ?>
1351 1351
             </div>
1352 1352
             <div class="col-sm-3"></div>
1353
-            <?php }else{ ?>
1353
+            <?php } else { ?>
1354 1354
             <div class="col-sm-5">
1355 1355
                 <input type="text" class="form-control" size="25" maxlength="50" name="dbHostForm" value="<?php echo htmlentities($dbHostForm); ?>" />
1356 1356
             </div>
@@ -1359,12 +1359,12 @@  discard block
 block discarded – undo
1359 1359
         </div>
1360 1360
         <div class="form-group">
1361 1361
             <label class="col-sm-4"><?php echo get_lang('DBPort'); ?> </label>
1362
-            <?php if ($installType == 'update'){ ?>
1362
+            <?php if ($installType == 'update') { ?>
1363 1363
             <div class="col-sm-5">
1364 1364
                 <input type="hidden" name="dbPortForm" value="<?php echo htmlentities($dbPortForm); ?>" /><?php echo $dbPortForm; ?>
1365 1365
             </div>
1366 1366
             <div class="col-sm-3"></div>
1367
-            <?php }else{ ?>
1367
+            <?php } else { ?>
1368 1368
             <div class="col-sm-5">
1369 1369
                 <input type="text" class="form-control" size="25" maxlength="50" name="dbPortForm" value="<?php echo htmlentities($dbPortForm); ?>" />
1370 1370
             </div>
@@ -1390,7 +1390,7 @@  discard block
 block discarded – undo
1390 1390
             <?php
1391 1391
             //Database Name fix replace weird chars
1392 1392
             if ($installType != INSTALL_TYPE_UPDATE) {
1393
-                $dbNameForm = str_replace(array('-','*', '$', ' ', '.'), '', $dbNameForm);
1393
+                $dbNameForm = str_replace(array('-', '*', '$', ' ', '.'), '', $dbNameForm);
1394 1394
             }
1395 1395
 
1396 1396
             displayDatabaseParameter(
@@ -1489,7 +1489,7 @@  discard block
 block discarded – undo
1489 1489
     if (!empty($title)) {
1490 1490
         $panelTitle = Display::div($title, array('class' => 'panel-heading'));
1491 1491
         $panelBody = Display::div($content, array('class' => 'panel-body'));
1492
-        $panelParent = Display::div($panelTitle . $panelBody, array('id' => $id, 'class' => 'panel panel-'.$style));
1492
+        $panelParent = Display::div($panelTitle.$panelBody, array('id' => $id, 'class' => 'panel panel-'.$style));
1493 1493
     } else {
1494 1494
         $panelBody = Display::div($html, array('class' => 'panel-body'));
1495 1495
         $panelParent = Display::div($panelBody, array('id' => $id, 'class' => 'panel panel-'.$style));
@@ -1514,9 +1514,9 @@  discard block
 block discarded – undo
1514 1514
     $displayWhenUpdate = 'true'
1515 1515
 ) {
1516 1516
     $html = '<div class="form-group">';
1517
-    $html .= '<label class="col-sm-6 control-label">' . $parameterName . '</label>';
1517
+    $html .= '<label class="col-sm-6 control-label">'.$parameterName.'</label>';
1518 1518
     if ($installType == INSTALL_TYPE_UPDATE && $displayWhenUpdate) {
1519
-        $html .= '<input type="hidden" name="' . $formFieldName . '" value="'. api_htmlentities($parameterValue, ENT_QUOTES). '" />' . $parameterValue;
1519
+        $html .= '<input type="hidden" name="'.$formFieldName.'" value="'.api_htmlentities($parameterValue, ENT_QUOTES).'" />'.$parameterValue;
1520 1520
     } else {
1521 1521
         $html .= '<div class="col-sm-6"><input class="form-control" type="text" size="'.FORM_FIELD_DISPLAY_LENGTH.'" maxlength="'.MAX_FORM_FIELD_LENGTH.'" name="'.$formFieldName.'" value="'.api_htmlentities($parameterValue, ENT_QUOTES).'" />'."</div>";
1522 1522
     }
@@ -1563,7 +1563,7 @@  discard block
 block discarded – undo
1563 1563
         $languageForm = $_SESSION['install_language'];
1564 1564
     }
1565 1565
     echo '<div class="RequirementHeading">';
1566
-    echo "<h2>" . display_step_sequence() . get_lang("CfgSetting") . "</h2>";
1566
+    echo "<h2>".display_step_sequence().get_lang("CfgSetting")."</h2>";
1567 1567
     echo '</div>';
1568 1568
 
1569 1569
     echo '<p>'.get_lang('ConfigSettingsInfo').' <strong>app/config/configuration.php</strong></p>';
@@ -1581,14 +1581,14 @@  discard block
 block discarded – undo
1581 1581
 
1582 1582
     // Parameters 3 and 4: administrator's names
1583 1583
 
1584
-    $html .=  display_configuration_parameter($installType, get_lang('AdminFirstName'), 'adminFirstName', $adminFirstName);
1585
-    $html .=  display_configuration_parameter($installType, get_lang('AdminLastName'), 'adminLastName', $adminLastName);
1584
+    $html .= display_configuration_parameter($installType, get_lang('AdminFirstName'), 'adminFirstName', $adminFirstName);
1585
+    $html .= display_configuration_parameter($installType, get_lang('AdminLastName'), 'adminLastName', $adminLastName);
1586 1586
 
1587 1587
     //Parameter 3: administrator's email
1588
-    $html .=  display_configuration_parameter($installType, get_lang('AdminEmail'), 'emailForm', $emailForm);
1588
+    $html .= display_configuration_parameter($installType, get_lang('AdminEmail'), 'emailForm', $emailForm);
1589 1589
 
1590 1590
     //Parameter 6: administrator's telephone
1591
-    $html .=  display_configuration_parameter($installType, get_lang('AdminPhone'), 'adminPhoneForm', $adminPhoneForm);
1591
+    $html .= display_configuration_parameter($installType, get_lang('AdminPhone'), 'adminPhoneForm', $adminPhoneForm);
1592 1592
 
1593 1593
 
1594 1594
     echo panel($html, get_lang('Administrator'), 'administrator');
@@ -1607,12 +1607,12 @@  discard block
 block discarded – undo
1607 1607
         $html .= display_language_selection_box('languageForm', $languageForm);
1608 1608
         $html .= '</div>';
1609 1609
     }
1610
-    $html.= "</div>";
1610
+    $html .= "</div>";
1611 1611
 
1612 1612
 
1613 1613
     //Second parameter: Chamilo URL
1614 1614
     $html .= '<div class="form-group">';
1615
-    $html .= '<label class="col-sm-6 control-label">'.get_lang('ChamiloURL') .get_lang('ThisFieldIsRequired').'</label>';
1615
+    $html .= '<label class="col-sm-6 control-label">'.get_lang('ChamiloURL').get_lang('ThisFieldIsRequired').'</label>';
1616 1616
 
1617 1617
 
1618 1618
 
@@ -1636,34 +1636,34 @@  discard block
 block discarded – undo
1636 1636
 
1637 1637
 
1638 1638
     $html .= '<div class="form-group">
1639
-            <label class="col-sm-6 control-label">' . get_lang("EncryptMethodUserPass") . '</label>
1639
+            <label class="col-sm-6 control-label">' . get_lang("EncryptMethodUserPass").'</label>
1640 1640
         <div class="col-sm-6">';
1641 1641
     if ($installType == 'update') {
1642
-        $html .= '<input type="hidden" name="encryptPassForm" value="'. $encryptPassForm .'" />'. $encryptPassForm;
1642
+        $html .= '<input type="hidden" name="encryptPassForm" value="'.$encryptPassForm.'" />'.$encryptPassForm;
1643 1643
     } else {
1644 1644
 
1645 1645
         $html .= '<div class="checkbox">
1646 1646
                     <label>
1647
-                        <input  type="radio" name="encryptPassForm" value="bcrypt" id="encryptPass1" '. ($encryptPassForm == 'bcrypt' ? 'checked="checked" ':'') .'/> bcrypt
1647
+                        <input  type="radio" name="encryptPassForm" value="bcrypt" id="encryptPass1" '. ($encryptPassForm == 'bcrypt' ? 'checked="checked" ' : '').'/> bcrypt
1648 1648
                     </label>';
1649 1649
 
1650 1650
         $html .= '<label>
1651
-                        <input  type="radio" name="encryptPassForm" value="sha1" id="encryptPass1" '. ($encryptPassForm == 'sha1' ? 'checked="checked" ':'') .'/> sha1
1651
+                        <input  type="radio" name="encryptPassForm" value="sha1" id="encryptPass1" '. ($encryptPassForm == 'sha1' ? 'checked="checked" ' : '').'/> sha1
1652 1652
                     </label>';
1653 1653
 
1654 1654
         $html .= '<label>
1655
-                        <input type="radio" name="encryptPassForm" value="md5" id="encryptPass0" '. ($encryptPassForm == 'md5' ? 'checked="checked" ':'') .'/> md5
1655
+                        <input type="radio" name="encryptPassForm" value="md5" id="encryptPass0" '. ($encryptPassForm == 'md5' ? 'checked="checked" ' : '').'/> md5
1656 1656
                     </label>';
1657 1657
 
1658 1658
         $html .= '<label>
1659
-                        <input type="radio" name="encryptPassForm" value="none" id="encryptPass2" '. ($encryptPassForm == 'none' ? 'checked="checked" ':'') .'/>'. get_lang('None').'
1659
+                        <input type="radio" name="encryptPassForm" value="none" id="encryptPass2" '. ($encryptPassForm == 'none' ? 'checked="checked" ' : '').'/>'.get_lang('None').'
1660 1660
                     </label>';
1661 1661
         $html .= '</div>';
1662 1662
     }
1663 1663
     $html .= '</div></div>';
1664 1664
 
1665 1665
     $html .= '<div class="form-group">
1666
-            <label class="col-sm-6 control-label">' . get_lang('AllowSelfReg') . '</label>
1666
+            <label class="col-sm-6 control-label">' . get_lang('AllowSelfReg').'</label>
1667 1667
             <div class="col-sm-6">';
1668 1668
     if ($installType == 'update') {
1669 1669
         if ($allowSelfReg == 'true') {
@@ -1673,17 +1673,17 @@  discard block
 block discarded – undo
1673 1673
         } else {
1674 1674
             $label = get_lang('AfterApproval');
1675 1675
         }
1676
-        $html .= '<input type="hidden" name="allowSelfReg" value="'. $allowSelfReg .'" />'. $label;
1676
+        $html .= '<input type="hidden" name="allowSelfReg" value="'.$allowSelfReg.'" />'.$label;
1677 1677
     } else {
1678 1678
         $html .= '<div class="control-group">';
1679 1679
         $html .= '<label class="checkbox-inline">
1680
-                        <input type="radio" name="allowSelfReg" value="1" id="allowSelfReg1" '. ($allowSelfReg == 'true' ? 'checked="checked" ' : '') . ' /> '. get_lang('Yes') .'
1680
+                        <input type="radio" name="allowSelfReg" value="1" id="allowSelfReg1" '. ($allowSelfReg == 'true' ? 'checked="checked" ' : '').' /> '.get_lang('Yes').'
1681 1681
                     </label>';
1682 1682
         $html .= '<label class="checkbox-inline">
1683
-                        <input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" '. ($allowSelfReg == 'false' ? '' : 'checked="checked" ') .' /> '. get_lang('No') .'
1683
+                        <input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" '. ($allowSelfReg == 'false' ? '' : 'checked="checked" ').' /> '.get_lang('No').'
1684 1684
                     </label>';
1685 1685
          $html .= '<label class="checkbox-inline">
1686
-                    <input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" '. ($allowSelfReg == 'approval' ? '' : 'checked="checked" ') .' /> '. get_lang('AfterApproval') .'
1686
+                    <input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" '. ($allowSelfReg == 'approval' ? '' : 'checked="checked" ').' /> '.get_lang('AfterApproval').'
1687 1687
                 </label>';
1688 1688
         $html .= '</div>';
1689 1689
     }
@@ -1691,7 +1691,7 @@  discard block
 block discarded – undo
1691 1691
     $html .= '</div>';
1692 1692
 
1693 1693
     $html .= '<div class="form-group">';
1694
-    $html .= '<label class="col-sm-6 control-label">'. get_lang('AllowSelfRegProf') .'</label>
1694
+    $html .= '<label class="col-sm-6 control-label">'.get_lang('AllowSelfRegProf').'</label>
1695 1695
         <div class="col-sm-6">';
1696 1696
     if ($installType == 'update') {
1697 1697
         if ($allowSelfRegProf == 'true') {
@@ -1699,16 +1699,16 @@  discard block
 block discarded – undo
1699 1699
         } else {
1700 1700
             $label = get_lang('No');
1701 1701
         }
1702
-        $html .= '<input type="hidden" name="allowSelfRegProf" value="'. $allowSelfRegProf.'" />'. $label;
1702
+        $html .= '<input type="hidden" name="allowSelfRegProf" value="'.$allowSelfRegProf.'" />'.$label;
1703 1703
     } else {
1704 1704
         $html .= '<div class="control-group">
1705 1705
                 <label class="checkbox-inline">
1706
-                    <input type="radio" name="allowSelfRegProf" value="1" id="allowSelfRegProf1" '. ($allowSelfRegProf ? 'checked="checked" ' : '') .'/>
1707
-                ' . get_lang('Yes') .'
1706
+                    <input type="radio" name="allowSelfRegProf" value="1" id="allowSelfRegProf1" '. ($allowSelfRegProf ? 'checked="checked" ' : '').'/>
1707
+                ' . get_lang('Yes').'
1708 1708
                 </label>';
1709 1709
         $html .= '<label class="checkbox-inline">
1710
-                    <input type="radio" name="allowSelfRegProf" value="0" id="allowSelfRegProf0" '. ($allowSelfRegProf ? '' : 'checked="checked" ') .' />
1711
-                   '. get_lang('No') .'
1710
+                    <input type="radio" name="allowSelfRegProf" value="0" id="allowSelfRegProf0" '. ($allowSelfRegProf ? '' : 'checked="checked" ').' />
1711
+                   '. get_lang('No').'
1712 1712
                 </label>';
1713 1713
         $html .= '</div>';
1714 1714
     }
@@ -1773,7 +1773,7 @@  discard block
 block discarded – undo
1773 1773
         "Macedonia", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Mauritania", "Mauritius", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Morocco", "Mozambique", "Myanmar",
1774 1774
         "Namibia", "Nauru", "Nepa", "Netherlands", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Norway",
1775 1775
         "Oman",
1776
-        "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland","Portugal",
1776
+        "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland", "Portugal",
1777 1777
         "Qatar",
1778 1778
         "Romania", "Russia", "Rwanda",
1779 1779
         "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia and Montenegro", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "Spain", "Sri Lanka", "Sudan", "Suriname", "Swaziland", "Sweden", "Switzerland", "Syria",
@@ -1820,11 +1820,11 @@  discard block
 block discarded – undo
1820 1820
     $permissions_for_new_directories = isset($_SESSION['permissions_for_new_directories']) ? $_SESSION['permissions_for_new_directories'] : 0770;
1821 1821
     $permissions_for_new_files = isset($_SESSION['permissions_for_new_files']) ? $_SESSION['permissions_for_new_files'] : 0660;
1822 1822
     // use decoct() to store as string
1823
-    $sql = "UPDATE $table SET selected_value = '0" . decoct($permissions_for_new_directories) . "'
1823
+    $sql = "UPDATE $table SET selected_value = '0".decoct($permissions_for_new_directories)."'
1824 1824
               WHERE variable  = 'permissions_for_new_directories'";
1825 1825
     Database::query($sql);
1826 1826
 
1827
-    $sql = "UPDATE $table SET selected_value = '0" . decoct($permissions_for_new_files) . "' WHERE variable  = 'permissions_for_new_files'";
1827
+    $sql = "UPDATE $table SET selected_value = '0".decoct($permissions_for_new_files)."' WHERE variable  = 'permissions_for_new_files'";
1828 1828
     Database::query($sql);
1829 1829
 
1830 1830
     if (isset($_SESSION['permissions_for_new_directories'])) {
@@ -1844,8 +1844,8 @@  discard block
 block discarded – undo
1844 1844
 function compare_setting_values($current_value, $wanted_value)
1845 1845
 {
1846 1846
     $current_value_string = $current_value;
1847
-    $current_value = (float)$current_value;
1848
-    $wanted_value = (float)$wanted_value;
1847
+    $current_value = (float) $current_value;
1848
+    $wanted_value = (float) $wanted_value;
1849 1849
 
1850 1850
     if ($current_value >= $wanted_value) {
1851 1851
         return Display::label($current_value_string, 'success');
@@ -1896,7 +1896,7 @@  discard block
 block discarded – undo
1896 1896
 
1897 1897
                     fwrite($fp, $out);
1898 1898
                     while (!feof($fp)) {
1899
-                        $result = str_replace("\r\n", '',fgets($fp, 128));
1899
+                        $result = str_replace("\r\n", '', fgets($fp, 128));
1900 1900
                         if (!empty($result) && $result == '123') {
1901 1901
                             $output = true;
1902 1902
                         }
@@ -1919,7 +1919,7 @@  discard block
 block discarded – undo
1919 1919
                     curl_setopt($ch, CURLOPT_URL, $url);
1920 1920
                     //curl_setopt($ch, CURLOPT_TIMEOUT, 30);
1921 1921
                     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
1922
-                    $result = curl_exec ($ch);
1922
+                    $result = curl_exec($ch);
1923 1923
                     if (!empty($result) && $result == '123') {
1924 1924
                         $output = true;
1925 1925
                     }
@@ -2679,12 +2679,12 @@  discard block
 block discarded – undo
2679 2679
         $adminPhoneForm,
2680 2680
         '', //$picture_uri = '',
2681 2681
         PLATFORM_AUTH_SOURCE,
2682
-        '',//$expirationDate,
2682
+        '', //$expirationDate,
2683 2683
         1,
2684 2684
         0,
2685 2685
         null,
2686 2686
         '',
2687
-        false,  //$send_mail = false,
2687
+        false, //$send_mail = false,
2688 2688
         true //$isAdmin = false
2689 2689
     );
2690 2690
 
@@ -2706,7 +2706,7 @@  discard block
 block discarded – undo
2706 2706
         0,
2707 2707
         null,
2708 2708
         '',
2709
-        false,  //$send_mail = false,
2709
+        false, //$send_mail = false,
2710 2710
         false //$isAdmin = false
2711 2711
     );
2712 2712
 
@@ -2772,7 +2772,7 @@  discard block
 block discarded – undo
2772 2772
                 SET selected_value = '".$param->selected_value."'
2773 2773
                 WHERE variable = '".$param->variable."'";
2774 2774
         if (!empty($param->subkey)) {
2775
-            $sql .= " AND subkey='" . $param->subkey . "'";
2775
+            $sql .= " AND subkey='".$param->subkey."'";
2776 2776
         }
2777 2777
         Database::query($sql);
2778 2778
     }
Please login to merge, or discard this patch.
Braces   +15 added lines, -8 removed lines patch added patch discarded remove patch
@@ -973,8 +973,7 @@  discard block
 block discarded – undo
973 973
                 <?php echo get_lang('Error'); ?>!<br />
974 974
                 Chamilo <?php echo implode('|', $update_from_version_8).' '.get_lang('HasNotBeenFoundInThatDir'); ?>.
975 975
             </div>
976
-        <?php }
977
-        else {
976
+        <?php } else {
978 977
             echo '<br />';
979 978
         }
980 979
         ?>
@@ -1060,14 +1059,19 @@  discard block
 block discarded – undo
1060 1059
         <button type="submit" name="step1" class="btn btn-default" onclick="javascript: window.location='index.php'; return false;" value="<?php echo get_lang('Previous'); ?>" >
1061 1060
             <em class="fa fa-backward"> </em> <?php echo get_lang('Previous'); ?>
1062 1061
         </button>
1063
-        <button type="submit" name="step2_install" class="btn btn-success" value="<?php echo get_lang("NewInstallation"); ?>" <?php if ($error) echo 'disabled="disabled"'; ?> >
1062
+        <button type="submit" name="step2_install" class="btn btn-success" value="<?php echo get_lang("NewInstallation"); ?>" <?php if ($error) {
1063
+    echo 'disabled="disabled"';
1064
+}
1065
+?> >
1064 1066
             <em class="fa fa-forward"> </em> <?php echo get_lang('NewInstallation'); ?>
1065 1067
         </button>
1066 1068
         <input type="hidden" name="is_executable" id="is_executable" value="-" />
1067 1069
         <?php
1068 1070
         // Real code
1069 1071
         echo '<button type="submit" class="btn btn-default" name="step2_update_8" value="Upgrade from Chamilo 1.9.x"';
1070
-        if ($error) echo ' disabled="disabled"';
1072
+        if ($error) {
1073
+            echo ' disabled="disabled"';
1074
+        }
1071 1075
         echo ' ><em class="fa fa-forward"> </em> '.get_lang('UpgradeFromLMS19x').'</button>';
1072 1076
 
1073 1077
         echo '</p>';
@@ -1350,7 +1354,7 @@  discard block
 block discarded – undo
1350 1354
                 <input type="hidden" name="dbHostForm" value="<?php echo htmlentities($dbHostForm); ?>" /><?php echo $dbHostForm; ?>
1351 1355
             </div>
1352 1356
             <div class="col-sm-3"></div>
1353
-            <?php }else{ ?>
1357
+            <?php } else{ ?>
1354 1358
             <div class="col-sm-5">
1355 1359
                 <input type="text" class="form-control" size="25" maxlength="50" name="dbHostForm" value="<?php echo htmlentities($dbHostForm); ?>" />
1356 1360
             </div>
@@ -1364,7 +1368,7 @@  discard block
 block discarded – undo
1364 1368
                 <input type="hidden" name="dbPortForm" value="<?php echo htmlentities($dbPortForm); ?>" /><?php echo $dbPortForm; ?>
1365 1369
             </div>
1366 1370
             <div class="col-sm-3"></div>
1367
-            <?php }else{ ?>
1371
+            <?php } else{ ?>
1368 1372
             <div class="col-sm-5">
1369 1373
                 <input type="text" class="form-control" size="25" maxlength="50" name="dbPortForm" value="<?php echo htmlentities($dbPortForm); ?>" />
1370 1374
             </div>
@@ -1449,12 +1453,15 @@  discard block
 block discarded – undo
1449 1453
 
1450 1454
             </div>
1451 1455
 
1452
-        <?php else: ?>
1456
+        <?php else {
1457
+    : ?>
1453 1458
 
1454 1459
             <?php echo $database_exists_text ?>
1455 1460
             <div id="db_status" style="float:left;" class="alert alert-danger">
1456 1461
                 <div style="float:left;">
1457
-                    <?php echo get_lang('FailedConectionDatabase'); ?></strong>
1462
+                    <?php echo get_lang('FailedConectionDatabase');
1463
+}
1464
+?></strong>
1458 1465
                 </div>
1459 1466
             </div>
1460 1467
 
Please login to merge, or discard this patch.
main/newscorm/aicc.class.php 4 patches
Doc Comments   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     /**
217 217
      * Import the aicc object (as a result from the parse_config_files function) into the database structure
218 218
      * @param	string	$course_code
219
-     * @return	bool	Returns -1 on error
219
+     * @return	false|null	Returns -1 on error
220 220
      */
221 221
     public function import_aicc($course_code)
222 222
     {
@@ -780,7 +780,8 @@  discard block
 block discarded – undo
780 780
      * Static function to parse AICC ini files.
781 781
      * Based on work by sinedeo at gmail dot com published on php.net (parse_ini_file()).
782 782
      * @param	string	File path
783
-     * @return	array	Structured array
783
+     * @param string $f
784
+     * @return	string	Structured array
784 785
      */
785 786
     function parse_ini_file_quotes_safe($f) {
786 787
         $null = '';
@@ -831,7 +832,7 @@  discard block
 block discarded – undo
831 832
      * Based on work by sinedeo at gmail dot com published on php.net (parse_ini_file()).
832 833
      * @param		string	INI File string
833 834
      * @param		array	List of names of sections that should be considered as containing only hard string data (no variables), provided in lower case
834
-     * @return	array	Structured array
835
+     * @return	string	Structured array
835 836
      */
836 837
     function parse_ini_string_quotes_safe($s, $pure_strings = array()) {
837 838
         $null = '';
@@ -894,6 +895,7 @@  discard block
 block discarded – undo
894 895
      * @param	string	CSV delimiter
895 896
      * @param	string	CSV enclosure
896 897
      * @param	boolean	Might one field name happen more than once on the same line? (then split by comma in the values)
898
+     * @param string $f
897 899
      * @return array	Simple structured array
898 900
      */
899 901
     function parse_csv_file($f, $delim = ',', $enclosure = '"', $multiples = false) {
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -320,12 +320,12 @@  discard block
 block discarded – undo
320 320
         }
321 321
     }
322 322
 
323
-     /**
324
-     * Intermediate to import_package only to allow import from local zip files
325
-     * @param	string	Path to the zip file, from the dokeos sys root
326
-     * @param	string	Current path (optional)
327
-     * @return string	Absolute path to the AICC description files or empty string on error
328
-     */
323
+        /**
324
+         * Intermediate to import_package only to allow import from local zip files
325
+         * @param	string	Path to the zip file, from the dokeos sys root
326
+         * @param	string	Current path (optional)
327
+         * @return string	Absolute path to the AICC description files or empty string on error
328
+         */
329 329
     function import_local_package($file_path, $current_dir = '')
330 330
     {
331 331
         // TODO: Prepare info as given by the $_FILES[''] vector.
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
         $current_dir = api_replace_dangerous_char(trim($current_dir)); // Current dir we are in, inside scorm/
356 356
         if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Current_dir = '.$current_dir, 0); }
357 357
 
358
-         //$uploaded_filename = $_FILES['userFile']['name'];
358
+            //$uploaded_filename = $_FILES['userFile']['name'];
359 359
         // Get the name of the zip file without the extension.
360 360
         if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Received zip file name: '.$zip_file_path, 0); }
361 361
         $file_info = pathinfo($zip_file_name);
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 class aicc extends learnpath
13 13
 {
14 14
     public $config = array();
15
-    public $config_basename = '';	// The configuration files might be multiple and might have
15
+    public $config_basename = ''; // The configuration files might be multiple and might have
16 16
                                     // funny names. We need to keep the name of that file while we
17 17
                                     // install the content.
18 18
     public $config_files = array();
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
     public $cstlist = array();
33 33
     public $orelist = array();
34 34
 
35
-    public $subdir = '';	// Path between the scorm/ directory and the config files e.g. maritime_nav/maritime_nav. This is the path that will be used in the lp_path when importing a package.
36
-    public $zipname = '';	// Keeps the zipfile safe for the object's life so that we can use it if there is no title available.
37
-    public $lastzipnameindex = 0;	// Keeps an index of the number of uses of the zipname so far.
35
+    public $subdir = ''; // Path between the scorm/ directory and the config files e.g. maritime_nav/maritime_nav. This is the path that will be used in the lp_path when importing a package.
36
+    public $zipname = ''; // Keeps the zipfile safe for the object's life so that we can use it if there is no title available.
37
+    public $lastzipnameindex = 0; // Keeps an index of the number of uses of the zipname so far.
38 38
     public $config_encoding = 'ISO-8859-1';
39 39
     public $debug = 0;
40 40
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             //echo '<pre>des:'.print_r($des_params, true).'</pre>';
133 133
             if ($this->debug > 1) { error_log('New LP - In aicc::parse_config_files() - '.$des_file.' has been parsed', 0); }
134 134
             // Distribute des params into the aicc object.
135
-            foreach ($des_params as $des){
135
+            foreach ($des_params as $des) {
136 136
                 // One AU in AICC is equivalent to one SCO in SCORM (scormItem class).
137 137
                 $oDes = new aiccResource('config', $des);
138 138
                 $this->deslist[$oDes->identifier] = $oDes;
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
 
243 243
         $this->config_encoding = "ISO-8859-1"; // TODO: We may apply detection for this value, see the function api_detect_encoding().
244 244
 
245
-        $sql = "INSERT INTO $new_lp (c_id, lp_type, name, ref, description, path, force_commit, default_view_mod, default_encoding, js_lib, content_maker,display_order)" .
246
-                "VALUES " .
247
-                "($course_id, 3, '".$this->course_title."', '".$this->course_id."','".$this->course_description."'," .
248
-                "'".$this->subdir."', 0, 'embedded', '".$this->config_encoding."'," .
245
+        $sql = "INSERT INTO $new_lp (c_id, lp_type, name, ref, description, path, force_commit, default_view_mod, default_encoding, js_lib, content_maker,display_order)".
246
+                "VALUES ".
247
+                "($course_id, 3, '".$this->course_title."', '".$this->course_id."','".$this->course_description."',".
248
+                "'".$this->subdir."', 0, 'embedded', '".$this->config_encoding."',".
249 249
                 "'aicc_api.php','".$this->course_creator."',$dsp)";
250
-        if ($this->debug > 2) { error_log('New LP - In import_aicc(), inserting path: '. $sql, 0); }
250
+        if ($this->debug > 2) { error_log('New LP - In import_aicc(), inserting path: '.$sql, 0); }
251 251
         Database::query($sql);
252 252
         $lp_id = Database::insert_id();
253 253
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 
277 277
         $previous = 0;
278 278
         foreach ($this->aulist as $identifier => $dummy) {
279
-            $oAu =& $this->aulist[$identifier];
279
+            $oAu = & $this->aulist[$identifier];
280 280
             //echo "Item ".$oAu->identifier;
281 281
             $field_add = '';
282 282
             $value_add = '';
@@ -294,12 +294,12 @@  discard block
 block discarded – undo
294 294
             $parent = 0; // TODO: Deal with the parent.
295 295
             $previous = 0;
296 296
             $prereq = $oAu->prereq_string;
297
-            $sql_item = "INSERT INTO $new_lp_item (c_id, lp_id,item_type,ref,title, path,min_score,max_score, $field_add parent_item_id,previous_item_id,next_item_id, prerequisite,display_order,parameters) " .
298
-                    "VALUES " .
299
-                    "($course_id, $lp_id, 'au','".$oAu->identifier."','".$title."'," .
300
-                    "'$path',0,100, $value_add" .
301
-                    "$parent, $previous, 0, " .
302
-                    "'$prereq', 0,'".(!empty($oAu->parameters)?Database::escape_string($oAu->parameters):'')."'" .
297
+            $sql_item = "INSERT INTO $new_lp_item (c_id, lp_id,item_type,ref,title, path,min_score,max_score, $field_add parent_item_id,previous_item_id,next_item_id, prerequisite,display_order,parameters) ".
298
+                    "VALUES ".
299
+                    "($course_id, $lp_id, 'au','".$oAu->identifier."','".$title."',".
300
+                    "'$path',0,100, $value_add".
301
+                    "$parent, $previous, 0, ".
302
+                    "'$prereq', 0,'".(!empty($oAu->parameters) ? Database::escape_string($oAu->parameters) : '')."'".
303 303
                     ")";
304 304
             Database::query($sql_item);
305 305
             if ($this->debug > 1) { error_log('New LP - In aicc::import_aicc() - inserting item : '.$sql_item.' : ', 0); }
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
         $zip_file_name = $zip_file_info['name'];
351 351
 
352 352
         if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Zip file path = '.$zip_file_path.', zip file name = '.$zip_file_name, 0); }
353
-        $course_rel_dir  = api_get_course_path().'/scorm'; // Scorm dir web path starting from /courses
353
+        $course_rel_dir = api_get_course_path().'/scorm'; // Scorm dir web path starting from /courses
354 354
         $course_sys_dir = api_get_path(SYS_COURSE_PATH).$course_rel_dir; // The absolute system path of this course.
355 355
         $current_dir = api_replace_dangerous_char(trim($current_dir)); // Current dir we are in, inside scorm/
356 356
         if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Current_dir = '.$current_dir, 0); }
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
         if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Base file name is : '.$file_base_name, 0); }
368 368
         $new_dir = api_replace_dangerous_char(trim($file_base_name));
369 369
         $this->subdir = $new_dir;
370
-        if($this->debug > 0) { error_log('New LP - aicc::import_package() - Subdir is first set to : '.$this->subdir, 0); }
370
+        if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Subdir is first set to : '.$this->subdir, 0); }
371 371
 
372 372
         /*
373 373
         if (check_name_exist($course_sys_dir.$current_dir.'/'.$new_dir)) {
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
                         $subdir_isset = true;
414 414
                     } else {
415 415
                         if (!$subdir_isset) {
416
-                            if (preg_match('?^.*/aicc$?i',dirname($thisContent['filename']))) {
416
+                            if (preg_match('?^.*/aicc$?i', dirname($thisContent['filename']))) {
417 417
                                 //echo "Cutting subdir<br/>";
418 418
                                 $this->subdir .= '/'.substr(dirname($thisContent['filename']), 0, -5);
419 419
                             } else {
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
                         // TODO: RENAMING FILES CAN BE VERY DANGEROUS AICC-WISE, avoid that as much as possible!
517 517
                         //$safe_file = api_replace_dangerous_char($file, 'strict');
518 518
                         $find_str = array('\\', '.php', '.phtml');
519
-                        $repl_str = array('/',  '.txt', '.txt');
519
+                        $repl_str = array('/', '.txt', '.txt');
520 520
                         $safe_file = str_replace($find_str, $repl_str, $file);
521 521
 
522 522
                         if ($safe_file != $file) {
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
         if ($this->debug > 0) { error_log('In aicc::get_res_path('.$id.') method', 0); }
718 718
         $path = '';
719 719
         if (isset($this->resources[$id])) {
720
-            $oRes =& $this->resources[$id];
720
+            $oRes = & $this->resources[$id];
721 721
             $path = @$oRes->get_path();
722 722
         }
723 723
         return $path;
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
         if ($this->debug > 0) { error_log('In aicc::get_res_type('.$id.') method', 0); }
734 734
         $type = '';
735 735
         if (isset($this->resources[$id])) {
736
-            $oRes =& $this->resources[$id];
736
+            $oRes = & $this->resources[$id];
737 737
             $temptype = $oRes->get_scorm_type();
738 738
             if (!empty($temptype)) {
739 739
                 $type = $temptype;
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
      * Gets the default organisation's title
747 747
      * @return	string	The organization's title
748 748
      */
749
-    function get_title(){
749
+    function get_title() {
750 750
         if ($this->debug > 0) { error_log('In aicc::get_title() method', 0); }
751 751
         $title = '';
752 752
         if (isset($this->config['organizations']['default'])) {
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
             $chr = $data{$i};
908 908
             switch ($chr) {
909 909
                 case $enclosure:
910
-                    if ($enclosed && $data{$i+1} == $enclosure) {
910
+                    if ($enclosed && $data{$i + 1} == $enclosure) {
911 911
                         $fldval .= $chr;
912 912
                         ++$i; // Skip the next character.
913 913
                     } else
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
                         $fldval .= $chr;
922 922
                     break;
923 923
                 case "\r":
924
-                    if (!$enclosed&&$data{$i+1} == "\n")
924
+                    if (!$enclosed && $data{$i + 1} == "\n")
925 925
                         continue;
926 926
                 case "\n":
927 927
                     if (!$enclosed) {
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
                         $fldval .= $chr;
933 933
                     break;
934 934
                 case "\\r":
935
-                    if (!$enclosed&&$data{$i+1} == "\\n")
935
+                    if (!$enclosed && $data{$i + 1} == "\\n")
936 936
                         continue;
937 937
                 case "\\n":
938 938
                     if (!$enclosed) {
Please login to merge, or discard this patch.
Braces   +24 added lines, -15 removed lines patch added patch discarded remove patch
@@ -459,11 +459,12 @@  discard block
 block discarded – undo
459 459
             }
460 460
         }
461 461
 
462
-        if ($package_type == '' || !$mandatory)
463
-        // && defined('CHECK_FOR_AICC') && CHECK_FOR_AICC)
462
+        if ($package_type == '' || !$mandatory) {
463
+                // && defined('CHECK_FOR_AICC') && CHECK_FOR_AICC)
464 464
         {
465 465
             return api_failure::set_failure('not_aicc_content');
466 466
         }
467
+        }
467 468
 
468 469
         if (!enough_size($realFileSize, $course_sys_dir, $maxFilledSpace)) {
469 470
             return api_failure::set_failure('not_enough_space');
@@ -511,7 +512,9 @@  discard block
 block discarded – undo
511 512
                     if ($file != '.' && $file != '..') {
512 513
                         $filetype = 'file';
513 514
 
514
-                        if (is_dir($course_sys_dir.$new_dir.$file)) $filetype = 'folder';
515
+                        if (is_dir($course_sys_dir.$new_dir.$file)) {
516
+                            $filetype = 'folder';
517
+                        }
515 518
 
516 519
                         // TODO: RENAMING FILES CAN BE VERY DANGEROUS AICC-WISE, avoid that as much as possible!
517 520
                         //$safe_file = api_replace_dangerous_char($file, 'strict');
@@ -910,37 +913,43 @@  discard block
 block discarded – undo
910 913
                     if ($enclosed && $data{$i+1} == $enclosure) {
911 914
                         $fldval .= $chr;
912 915
                         ++$i; // Skip the next character.
913
-                    } else
914
-                        $enclosed = !$enclosed;
916
+                    } else {
917
+                                            $enclosed = !$enclosed;
918
+                    }
915 919
                     break;
916 920
                 case $delim:
917 921
                     if (!$enclosed) {
918 922
                         $ret_array[$linecount][$fldcount++] = $fldval;
919 923
                         $fldval = '';
920
-                    } else
921
-                        $fldval .= $chr;
924
+                    } else {
925
+                                            $fldval .= $chr;
926
+                    }
922 927
                     break;
923 928
                 case "\r":
924
-                    if (!$enclosed&&$data{$i+1} == "\n")
925
-                        continue;
929
+                    if (!$enclosed&&$data{$i+1} == "\n") {
930
+                                            continue;
931
+                    }
926 932
                 case "\n":
927 933
                     if (!$enclosed) {
928 934
                         $ret_array[$linecount++][$fldcount] = $fldval;
929 935
                         $fldcount = 0;
930 936
                         $fldval = '';
931
-                    } else
932
-                        $fldval .= $chr;
937
+                    } else {
938
+                                            $fldval .= $chr;
939
+                    }
933 940
                     break;
934 941
                 case "\\r":
935
-                    if (!$enclosed&&$data{$i+1} == "\\n")
936
-                        continue;
942
+                    if (!$enclosed&&$data{$i+1} == "\\n") {
943
+                                            continue;
944
+                    }
937 945
                 case "\\n":
938 946
                     if (!$enclosed) {
939 947
                         $ret_array[$linecount++][$fldcount] = $fldval;
940 948
                         $fldcount = 0;
941 949
                         $fldval = '';
942
-                    } else
943
-                        $fldval .= $chr;
950
+                    } else {
951
+                                            $fldval .= $chr;
952
+                    }
944 953
                     break;
945 954
                 default:
946 955
                     $fldval .= $chr;
Please login to merge, or discard this patch.
main/newscorm/learnpath.class.php 3 patches
Doc Comments   +29 added lines, -24 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      * @param	string	$course Course code
85 85
      * @param	integer	$lp_id
86 86
      * @param	integer	$user_id
87
-     * @return mixed True on success, false on error
87
+     * @return boolean True on success, false on error
88 88
      */
89 89
     public function __construct($course, $lp_id, $user_id)
90 90
     {
@@ -482,7 +482,8 @@  discard block
 block discarded – undo
482 482
      * @param string $description
483 483
      * @param int $prerequisites
484 484
      * @param int $max_time_allowed
485
-     * @return int
485
+     * @param string $id
486
+     * @return false|string
486 487
      */
487 488
     public function add_item(
488 489
         $parent,
@@ -1021,7 +1022,7 @@  discard block
 block discarded – undo
1021 1022
      * @param	array $courseInfo
1022 1023
      * @param	integer	Learnpath ID
1023 1024
      * @param	string	Whether to delete data or keep it (default: 'keep', others: 'remove')
1024
-     * @return	boolean	True on success, false on failure (might change that to return number of elements deleted)
1025
+     * @return	false|null	True on success, false on failure (might change that to return number of elements deleted)
1025 1026
      */
1026 1027
     public function delete($courseInfo = null, $id = null, $delete = 'keep')
1027 1028
     {
@@ -1155,7 +1156,7 @@  discard block
 block discarded – undo
1155 1156
      * @param	integer	$id Elem ID (0 if first)
1156 1157
      * @param	integer	$remove Whether to remove the resource/data from the
1157 1158
      * system or leave it (default: 'keep', others 'remove')
1158
-     * @return	integer	Number of elements moved
1159
+     * @return	false|null	Number of elements moved
1159 1160
      * @todo implement resource removal
1160 1161
      */
1161 1162
     public function delete_item($id, $remove = 'keep')
@@ -1237,7 +1238,7 @@  discard block
 block discarded – undo
1237 1238
      * @param   array   $audio The array resulting of the $_FILES[mp3] element
1238 1239
      * @param   int     $max_time_allowed
1239 1240
      * @param   string  $url
1240
-     * @return  boolean True on success, false on error
1241
+     * @return  false|null True on success, false on error
1241 1242
      */
1242 1243
     public function edit_item(
1243 1244
         $id,
@@ -1760,7 +1761,7 @@  discard block
 block discarded – undo
1760 1761
 
1761 1762
     /**
1762 1763
      * Gets the first element URL.
1763
-     * @return	string	URL to load into the viewer
1764
+     * @return	false|null	URL to load into the viewer
1764 1765
      */
1765 1766
     public function first()
1766 1767
     {
@@ -2276,6 +2277,7 @@  discard block
 block discarded – undo
2276 2277
      * @param int $student_id
2277 2278
      * @param string Course code (optional)
2278 2279
      * @param int $sessionId
2280
+     * @param string $courseCode
2279 2281
      * @return	bool
2280 2282
      */
2281 2283
     public static function is_lp_visible_for_student(
@@ -2575,7 +2577,7 @@  discard block
 block discarded – undo
2575 2577
 
2576 2578
     /**
2577 2579
      * Gets the learnpath session id
2578
-     * @return	string	Learnpath theme
2580
+     * @return	integer	Learnpath theme
2579 2581
      */
2580 2582
     public function get_lp_session_id()
2581 2583
     {
@@ -2608,7 +2610,7 @@  discard block
 block discarded – undo
2608 2610
     /**
2609 2611
      * @param string $size
2610 2612
      * @param string $path_type
2611
-     * @return bool|string
2613
+     * @return string|false
2612 2614
      */
2613 2615
     public function get_preview_image_path($size = null, $path_type = 'web')
2614 2616
     {
@@ -2754,6 +2756,8 @@  discard block
 block discarded – undo
2754 2756
      * Returns the XML DOM document's node
2755 2757
      * @param	resource	Reference to a list of objects to search for the given ITEM_*
2756 2758
      * @param	string		The identifier to look for
2759
+     * @param DOMNodeList $children
2760
+     * @param string $id
2757 2761
      * @return	mixed		The reference to the element found with that identifier. False if not found
2758 2762
      */
2759 2763
     public function get_scorm_xml_node(& $children, $id)
@@ -3001,7 +3005,7 @@  discard block
 block discarded – undo
3001 3005
     /**
3002 3006
      * Generate and return the table of contents for this learnpath. The (flat) table returned can be
3003 3007
      * used by get_html_toc() to be ready to display
3004
-     * @return	array	TOC as a table with 4 elements per row: title, link, status and level
3008
+     * @return	boolean	TOC as a table with 4 elements per row: title, link, status and level
3005 3009
      */
3006 3010
     public function get_toc()
3007 3011
     {
@@ -3137,7 +3141,7 @@  discard block
 block discarded – undo
3137 3141
     }
3138 3142
 
3139 3143
     /**
3140
-     * @return array
3144
+     * @return string[]
3141 3145
      */
3142 3146
     public static function getChapterTypes()
3143 3147
     {
@@ -4050,7 +4054,7 @@  discard block
 block discarded – undo
4050 4054
      * Open a resource = initialise all local variables relative to this resource. Depending on the child
4051 4055
      * class, this might be redefined to allow several behaviours depending on the document type.
4052 4056
      * @param integer Resource ID
4053
-     * @return boolean True on success, false otherwise
4057
+     * @return boolean|null True on success, false otherwise
4054 4058
      */
4055 4059
     public function open($id)
4056 4060
     {
@@ -4179,7 +4183,7 @@  discard block
 block discarded – undo
4179 4183
      * Can be used as abstract
4180 4184
      * @param	integer	$lp_id Learnpath id
4181 4185
      * @param	string	$set_visibility New visibility (v/i - visible/invisible)
4182
-     * @return bool
4186
+     * @return false|null
4183 4187
      */
4184 4188
     public static function toggle_publish($lp_id, $set_visibility = 'v')
4185 4189
     {
@@ -4264,7 +4268,7 @@  discard block
 block discarded – undo
4264 4268
      * Make sure the results are saved with anoter method. This method should probably be
4265 4269
      * redefined in children classes.
4266 4270
      * To use a similar method  statically, use the create_new_attempt() method
4267
-     * @return string URL to load in the viewer
4271
+     * @return boolean URL to load in the viewer
4268 4272
      */
4269 4273
     public function restart()
4270 4274
     {
@@ -4342,6 +4346,7 @@  discard block
 block discarded – undo
4342 4346
      * Saves the given item
4343 4347
      * @param	integer	$item_id. Optional (will take from $_REQUEST if null)
4344 4348
      * @param	boolean	$from_outside Save from url params (true) or from current attributes (false). Optional. Defaults to true
4349
+     * @param integer $item_id
4345 4350
      * @return	boolean
4346 4351
      */
4347 4352
     public function save_item($item_id = null, $from_outside = true)
@@ -4839,7 +4844,7 @@  discard block
 block discarded – undo
4839 4844
 
4840 4845
     /**
4841 4846
      * Sets use_max_score
4842
-     * @param   string  $use_max_score Optional string giving the new location of this learnpath
4847
+     * @param   integer  $use_max_score Optional string giving the new location of this learnpath
4843 4848
      * @return  boolean True on success / False on error
4844 4849
      */
4845 4850
     public function set_use_max_score($use_max_score = 1)
@@ -5240,6 +5245,7 @@  discard block
 block discarded – undo
5240 5245
      * Register the attempt mode into db thanks to flags prevent_reinit and seriousgame_mode flags
5241 5246
      *
5242 5247
      * @param string 'seriousgame', 'single' or 'multiple'
5248
+     * @param string $mode
5243 5249
      * @return boolean
5244 5250
      * @author ndiechburg <[email protected]>
5245 5251
      **/
@@ -5282,7 +5288,7 @@  discard block
 block discarded – undo
5282 5288
     /**
5283 5289
      * Switch between multiple attempt, single attempt or serious_game mode (only for scorm)
5284 5290
      *
5285
-     * @return boolean
5291
+     * @return boolean|null
5286 5292
      * @author ndiechburg <[email protected]>
5287 5293
      **/
5288 5294
     public function switch_attempt_mode()
@@ -5473,7 +5479,6 @@  discard block
 block discarded – undo
5473 5479
     /**
5474 5480
      * Function that creates a html list of learning path items so that we can add audio files to them
5475 5481
      * @author Kevin Van Den Haute
5476
-     * @param int $lp_id
5477 5482
      * @return string
5478 5483
      */
5479 5484
     public function overview()
@@ -5844,7 +5849,7 @@  discard block
 block discarded – undo
5844 5849
     /**
5845 5850
      * This function builds the action menu
5846 5851
      * @param bool $returnContent
5847
-     * @return void
5852
+     * @return string|null
5848 5853
      */
5849 5854
     public function build_action_menu($returnContent = false)
5850 5855
     {
@@ -6335,7 +6340,7 @@  discard block
 block discarded – undo
6335 6340
     /**
6336 6341
      * Function that displays a list with al the resources that
6337 6342
      * could be added to the learning path
6338
-     * @return string
6343
+     * @return boolean
6339 6344
      */
6340 6345
     public function display_resources()
6341 6346
     {
@@ -8770,7 +8775,7 @@  discard block
 block discarded – undo
8770 8775
 
8771 8776
     /**
8772 8777
      * Creates a list with all the student publications in it
8773
-     * @return unknown
8778
+     * @return string
8774 8779
      */
8775 8780
     public function get_student_publications()
8776 8781
     {
@@ -9715,7 +9720,7 @@  discard block
 block discarded – undo
9715 9720
 
9716 9721
     /**
9717 9722
      * @param int $lp_id
9718
-     * @return bool
9723
+     * @return false|null
9719 9724
      */
9720 9725
     public function scorm_export_to_pdf($lp_id)
9721 9726
     {
@@ -10232,6 +10237,7 @@  discard block
 block discarded – undo
10232 10237
     }
10233 10238
 
10234 10239
     /**
10240
+     * @param string $courseCode
10235 10241
      * @return \learnpath
10236 10242
      */
10237 10243
     public static function getLpFromSession($courseCode, $lp_id, $user_id)
@@ -10251,7 +10257,7 @@  discard block
 block discarded – undo
10251 10257
 
10252 10258
     /**
10253 10259
      * @param int $itemId
10254
-     * @return learnpathItem|false
10260
+     * @return string
10255 10261
      */
10256 10262
     public function getItem($itemId)
10257 10263
     {
@@ -10301,7 +10307,6 @@  discard block
 block discarded – undo
10301 10307
     /**
10302 10308
      * Set whether this is a learning path with the possibility to subscribe
10303 10309
      * users or not
10304
-     * @param int $subscribeUsers (0 = false, 1 = true)
10305 10310
      */
10306 10311
     public function setSubscribeUsers($value)
10307 10312
     {
@@ -10426,7 +10431,7 @@  discard block
 block discarded – undo
10426 10431
 
10427 10432
     /**
10428 10433
      * Get the item of exercise type (evaluation type)
10429
-     * @return array The final evaluation. Otherwise return false
10434
+     * @return integer The final evaluation. Otherwise return false
10430 10435
      */
10431 10436
     public function getFinalEvaluationItem()
10432 10437
     {
@@ -10650,7 +10655,7 @@  discard block
 block discarded – undo
10650 10655
     /**
10651 10656
      * Create a forum for this learning path
10652 10657
      * @param type $forumCategoryId
10653
-     * @return int The forum ID if was created. Otherwise return false
10658
+     * @return false|string The forum ID if was created. Otherwise return false
10654 10659
      */
10655 10660
     public function createForum($forumCategoryId)
10656 10661
     {
Please login to merge, or discard this patch.
Braces   +167 added lines, -117 removed lines patch added patch discarded remove patch
@@ -3935,8 +3935,9 @@  discard block
 block discarded – undo
3935 3935
                 WHERE c_id = ".$course_id."
3936 3936
                 ORDER BY display_order";
3937 3937
         $res = Database::query($sql);
3938
-        if ($res === false)
3939
-            return false;
3938
+        if ($res === false) {
3939
+                    return false;
3940
+        }
3940 3941
         $lps = array ();
3941 3942
         $lp_order = array ();
3942 3943
         $num = Database :: num_rows($res);
@@ -4536,8 +4537,9 @@  discard block
 block discarded – undo
4536 4537
         if ($this->debug > 0) {
4537 4538
             error_log('New LP - In learnpath::set_maker()', 0);
4538 4539
         }
4539
-        if (empty ($name))
4540
-            return false;
4540
+        if (empty ($name)) {
4541
+                    return false;
4542
+        }
4541 4543
         $this->maker = $name;
4542 4544
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4543 4545
         $course_id = api_get_course_int_id();
@@ -4602,8 +4604,9 @@  discard block
 block discarded – undo
4602 4604
     public function set_terms_by_prefix($terms_string, $prefix)
4603 4605
     {
4604 4606
         $course_id = api_get_course_int_id();
4605
-        if (api_get_setting('search_enabled') !== 'true')
4606
-            return false;
4607
+        if (api_get_setting('search_enabled') !== 'true') {
4608
+                    return false;
4609
+        }
4607 4610
 
4608 4611
         if (!extension_loaded('xapian')) {
4609 4612
             return false;
@@ -4616,8 +4619,9 @@  discard block
 block discarded – undo
4616 4619
         $stored_terms = $this->get_common_index_terms_by_prefix($prefix);
4617 4620
 
4618 4621
         // Don't do anything if no change, verify only at DB, not the search engine.
4619
-        if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0))
4620
-            return false;
4622
+        if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) {
4623
+                    return false;
4624
+        }
4621 4625
 
4622 4626
         require_once 'xapian.php'; // TODO: Try catch every xapian use or make wrappers on API.
4623 4627
         require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
@@ -4809,8 +4813,9 @@  discard block
 block discarded – undo
4809 4813
         if ($this->debug > 0) {
4810 4814
             error_log('New LP - In learnpath::set_proximity()', 0);
4811 4815
         }
4812
-        if (empty ($name))
4813
-            return false;
4816
+        if (empty ($name)) {
4817
+                    return false;
4818
+        }
4814 4819
 
4815 4820
         $this->proximity = $name;
4816 4821
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
@@ -5152,8 +5157,9 @@  discard block
 block discarded – undo
5152 5157
 
5153 5158
         $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." ORDER BY display_order";
5154 5159
         $res = Database::query($sql);
5155
-        if ($res === false)
5156
-            return false;
5160
+        if ($res === false) {
5161
+                    return false;
5162
+        }
5157 5163
 
5158 5164
         $num = Database :: num_rows($res);
5159 5165
         // First check the order is correct, globally (might be wrong because
@@ -5464,8 +5470,9 @@  discard block
 block discarded – undo
5464 5470
             $position[$key] = $row['display_order'];
5465 5471
         }
5466 5472
 
5467
-        if (count($array) > 0)
5468
-            array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array);
5473
+        if (count($array) > 0) {
5474
+                    array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array);
5475
+        }
5469 5476
 
5470 5477
         return $array;
5471 5478
     }
@@ -6021,8 +6028,9 @@  discard block
 block discarded – undo
6021 6028
         $tmp_filename = $filename;
6022 6029
 
6023 6030
         $i = 0;
6024
-        while (file_exists($filepath . $tmp_filename . '.'.$extension))
6025
-            $tmp_filename = $filename . '_' . ++ $i;
6031
+        while (file_exists($filepath . $tmp_filename . '.'.$extension)) {
6032
+                    $tmp_filename = $filename . '_' . ++ $i;
6033
+        }
6026 6034
 
6027 6035
         $filename = $tmp_filename . '.'.$extension;
6028 6036
         if ($extension == 'html') {
@@ -6095,10 +6103,12 @@  discard block
 block discarded – undo
6095 6103
                     if ($new_comment || $new_title) {
6096 6104
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6097 6105
                         $ct = '';
6098
-                        if ($new_comment)
6099
-                            $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6100
-                        if ($new_title)
6101
-                            $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6106
+                        if ($new_comment) {
6107
+                                                    $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6108
+                        }
6109
+                        if ($new_title) {
6110
+                                                    $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6111
+                        }
6102 6112
 
6103 6113
                         $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)."
6104 6114
                                WHERE c_id = ".$course_id." AND id = " . $document_id;
@@ -6122,17 +6132,21 @@  discard block
 block discarded – undo
6122 6132
         // Please, do not modify this dirname formatting.
6123 6133
         $dir = isset($_GET['dir']) ? $_GET['dir'] : $_POST['dir'];
6124 6134
 
6125
-        if (strstr($dir, '..'))
6126
-            $dir = '/';
6135
+        if (strstr($dir, '..')) {
6136
+                    $dir = '/';
6137
+        }
6127 6138
 
6128
-        if ($dir[0] == '.')
6129
-            $dir = substr($dir, 1);
6139
+        if ($dir[0] == '.') {
6140
+                    $dir = substr($dir, 1);
6141
+        }
6130 6142
 
6131
-        if ($dir[0] != '/')
6132
-            $dir = '/' . $dir;
6143
+        if ($dir[0] != '/') {
6144
+                    $dir = '/' . $dir;
6145
+        }
6133 6146
 
6134
-        if ($dir[strlen($dir) - 1] != '/')
6135
-            $dir .= '/';
6147
+        if ($dir[strlen($dir) - 1] != '/') {
6148
+                    $dir .= '/';
6149
+        }
6136 6150
 
6137 6151
         $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir;
6138 6152
 
@@ -6198,8 +6212,9 @@  discard block
 block discarded – undo
6198 6212
                 }
6199 6213
                 $return .= '<div style="padding:10px;">';
6200 6214
 
6201
-                if ($msg != '')
6202
-                    $return .= $msg;
6215
+                if ($msg != '') {
6216
+                                    $return .= $msg;
6217
+                }
6203 6218
 
6204 6219
                 $return .= '<h3>'.$row['title'].'</h3>';
6205 6220
                 switch ($row['item_type']) {
@@ -6446,10 +6461,11 @@  discard block
 block discarded – undo
6446 6461
         $item_description 	= Security::remove_XSS($item_description);
6447 6462
 
6448 6463
         $legend = '<legend>';
6449
-        if ($id != 0 && is_array($extra_info))
6450
-            $parent = $extra_info['parent_item_id'];
6451
-        else
6452
-            $parent = 0;
6464
+        if ($id != 0 && is_array($extra_info)) {
6465
+                    $parent = $extra_info['parent_item_id'];
6466
+        } else {
6467
+                    $parent = 0;
6468
+        }
6453 6469
 
6454 6470
         $sql = "SELECT * FROM " . $tbl_lp_item . "
6455 6471
                 WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
@@ -6527,8 +6543,9 @@  discard block
 block discarded – undo
6527 6543
                     $arrHide[] = $arrLP[$i]['id'];
6528 6544
                 }
6529 6545
             } else {
6530
-                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6531
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6546
+                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') {
6547
+                                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6548
+                }
6532 6549
             }
6533 6550
         }
6534 6551
         if (is_array($arrLP)) {
@@ -6717,11 +6734,13 @@  discard block
 block discarded – undo
6717 6734
         }
6718 6735
 
6719 6736
         $legend = '<legend>';
6720
-        if ($action == 'add')
6721
-            $legend .= get_lang('CreateTheExercise');
6722
-        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentExercise');
6723
-        else
6724
-            $legend .= get_lang('EditCurrentExecice');
6737
+        if ($action == 'add') {
6738
+                    $legend .= get_lang('CreateTheExercise');
6739
+        } elseif ($action == 'move') {
6740
+            $legend .= get_lang('MoveTheCurrentExercise');
6741
+        } else {
6742
+                    $legend .= get_lang('EditCurrentExecice');
6743
+        }
6725 6744
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6726 6745
             $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6727 6746
         }
@@ -6748,8 +6767,9 @@  discard block
 block discarded – undo
6748 6767
                         $arrHide[] = $arrLP[$i]['id'];
6749 6768
                     }
6750 6769
                 } else {
6751
-                    if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6752
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6770
+                    if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') {
6771
+                                            $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6772
+                    }
6753 6773
                 }
6754 6774
             }
6755 6775
 
@@ -6767,11 +6787,13 @@  discard block
 block discarded – undo
6767 6787
 
6768 6788
         for ($i = 0; $i < count($arrLP); $i++) {
6769 6789
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6770
-                if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
6790
+                if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
6791
+                                    $selected = 'selected="selected" ';
6792
+                } elseif ($action == 'add') {
6771 6793
                     $selected = 'selected="selected" ';
6772
-                elseif ($action == 'add') $selected = 'selected="selected" ';
6773
-                else
6774
-                    $selected = '';
6794
+                } else {
6795
+                                    $selected = '';
6796
+                }
6775 6797
 
6776 6798
                 $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6777 6799
             }
@@ -6798,9 +6820,11 @@  discard block
 block discarded – undo
6798 6820
                 $arrHide = array ();
6799 6821
                 for ($i = 0; $i < count($arrLP); $i++) {
6800 6822
                     if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6801
-                        if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
6802
-                            $s_selected_position = $arrLP[$i]['id'];
6803
-                        elseif ($action == 'add') $s_selected_position = 0;
6823
+                        if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
6824
+                                                    $s_selected_position = $arrLP[$i]['id'];
6825
+                        } elseif ($action == 'add') {
6826
+                            $s_selected_position = 0;
6827
+                        }
6804 6828
                         $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
6805 6829
 
6806 6830
                     }
@@ -6897,11 +6921,13 @@  discard block
 block discarded – undo
6897 6921
         $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
6898 6922
         unset($this->arrMenu);
6899 6923
 
6900
-        if ($action == 'add')
6901
-            $legend .= get_lang('CreateTheForum') . '&nbsp;:';
6902
-        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum') . '&nbsp;:';
6903
-        else
6904
-            $legend .= get_lang('EditCurrentForum') . '&nbsp;:';
6924
+        if ($action == 'add') {
6925
+                    $legend .= get_lang('CreateTheForum') . '&nbsp;:';
6926
+        } elseif ($action == 'move') {
6927
+            $legend .= get_lang('MoveTheCurrentForum') . '&nbsp;:';
6928
+        } else {
6929
+                    $legend .= get_lang('EditCurrentForum') . '&nbsp;:';
6930
+        }
6905 6931
 
6906 6932
         $legend .= '</legend>';
6907 6933
         $return = '<div class="sectioncomment">';
@@ -6934,8 +6960,9 @@  discard block
 block discarded – undo
6934 6960
                     $arrHide[] = $arrLP[$i]['id'];
6935 6961
                 }
6936 6962
             } else {
6937
-                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6938
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6963
+                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') {
6964
+                                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6965
+                }
6939 6966
             }
6940 6967
         }
6941 6968
         if (is_array($arrLP)) {
@@ -6953,11 +6980,13 @@  discard block
 block discarded – undo
6953 6980
 
6954 6981
         for ($i = 0; $i < count($arrLP); $i++) {
6955 6982
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6956
-                if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
6983
+                if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
6984
+                                    $selected = 'selected="selected" ';
6985
+                } elseif ($action == 'add') {
6957 6986
                     $selected = 'selected="selected" ';
6958
-                elseif ($action == 'add') $selected = 'selected="selected" ';
6959
-                else
6960
-                    $selected = '';
6987
+                } else {
6988
+                                    $selected = '';
6989
+                }
6961 6990
 
6962 6991
                 $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' .
6963 6992
                     get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
@@ -6983,9 +7012,11 @@  discard block
 block discarded – undo
6983 7012
             $arrHide = array();
6984 7013
             for ($i = 0; $i < count($arrLP); $i++) {
6985 7014
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6986
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
6987
-                        $s_selected_position = $arrLP[$i]['id'];
6988
-                    elseif ($action == 'add') $s_selected_position = 0;
7015
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7016
+                                            $s_selected_position = $arrLP[$i]['id'];
7017
+                    } elseif ($action == 'add') {
7018
+                        $s_selected_position = 0;
7019
+                    }
6989 7020
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
6990 7021
                 }
6991 7022
             }
@@ -7089,11 +7120,13 @@  discard block
 block discarded – undo
7089 7120
         unset ($this->arrMenu);
7090 7121
 
7091 7122
         $return .= '<form method="POST">';
7092
-        if ($action == 'add')
7093
-            $return .= '<legend>' . get_lang('CreateTheForum') . '</legend>';
7094
-        elseif ($action == 'move') $return .= '<p class="lp_title">' . get_lang('MoveTheCurrentForum') . '&nbsp;:</p>';
7095
-        else
7096
-            $return .= '<legend>' . get_lang('EditCurrentForum') . '</legend>';
7123
+        if ($action == 'add') {
7124
+                    $return .= '<legend>' . get_lang('CreateTheForum') . '</legend>';
7125
+        } elseif ($action == 'move') {
7126
+            $return .= '<p class="lp_title">' . get_lang('MoveTheCurrentForum') . '&nbsp;:</p>';
7127
+        } else {
7128
+                    $return .= '<legend>' . get_lang('EditCurrentForum') . '</legend>';
7129
+        }
7097 7130
 
7098 7131
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
7099 7132
         $return .= '<tr>';
@@ -7113,8 +7146,9 @@  discard block
 block discarded – undo
7113 7146
                     $arrHide[] = $arrLP[$i]['id'];
7114 7147
                 }
7115 7148
             } else {
7116
-                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
7117
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7149
+                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') {
7150
+                                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7151
+                }
7118 7152
             }
7119 7153
         }
7120 7154
 
@@ -7132,11 +7166,13 @@  discard block
 block discarded – undo
7132 7166
         $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7133 7167
         for ($i = 0; $i < count($arrLP); $i++) {
7134 7168
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7135
-                if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7169
+                if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7170
+                                    $selected = 'selected="selected" ';
7171
+                } elseif ($action == 'add') {
7136 7172
                     $selected = 'selected="selected" ';
7137
-                elseif ($action == 'add') $selected = 'selected="selected" ';
7138
-                else
7139
-                    $selected = '';
7173
+                } else {
7174
+                                    $selected = '';
7175
+                }
7140 7176
 
7141 7177
                 $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7142 7178
             }
@@ -7165,9 +7201,11 @@  discard block
 block discarded – undo
7165 7201
             $arrHide = array();
7166 7202
             for ($i = 0; $i < count($arrLP); $i++) {
7167 7203
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
7168
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7169
-                        $s_selected_position = $arrLP[$i]['id'];
7170
-                    elseif ($action == 'add') $s_selected_position = 0;
7204
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7205
+                                            $s_selected_position = $arrLP[$i]['id'];
7206
+                    } elseif ($action == 'add') {
7207
+                        $s_selected_position = 0;
7208
+                    }
7171 7209
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7172 7210
 
7173 7211
                 }
@@ -7180,8 +7218,7 @@  discard block
 block discarded – undo
7180 7218
             foreach ($arrHide as $key => $value) {
7181 7219
                 if ($key == $s_selected_position && $action == 'add') {
7182 7220
                     $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7183
-                }
7184
-                elseif ($key == $id_prerequisite && $action == 'edit') {
7221
+                } elseif ($key == $id_prerequisite && $action == 'edit') {
7185 7222
                     $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7186 7223
                 } else {
7187 7224
                     $return .= '<option value="' . $key . '">' . $value['value'] . '</option>';
@@ -7204,8 +7241,7 @@  discard block
 block discarded – undo
7204 7241
 
7205 7242
         if (is_numeric($extra_info)) {
7206 7243
             $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7207
-        }
7208
-        elseif (is_array($extra_info)) {
7244
+        } elseif (is_array($extra_info)) {
7209 7245
             $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7210 7246
         }
7211 7247
 
@@ -7259,8 +7295,9 @@  discard block
 block discarded – undo
7259 7295
                     lp_id = " . $this->lp_id . " AND
7260 7296
                     id != $id";
7261 7297
 
7262
-        if ($item_type == 'module')
7263
-            $sql .= " AND parent_item_id = 0";
7298
+        if ($item_type == 'module') {
7299
+                    $sql .= " AND parent_item_id = 0";
7300
+        }
7264 7301
 
7265 7302
         $result = Database::query($sql);
7266 7303
         $arrLP = array ();
@@ -7610,9 +7647,11 @@  discard block
 block discarded – undo
7610 7647
         //POSITION
7611 7648
         for ($i = 0; $i < count($arrLP); $i++) {
7612 7649
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7613
-                if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7650
+                if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7651
+                                    $s_selected_position = $arrLP[$i]['id'];
7652
+                } elseif ($action == 'add') {
7614 7653
                     $s_selected_position = $arrLP[$i]['id'];
7615
-                elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id'];
7654
+                }
7616 7655
                 $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7617 7656
             }
7618 7657
         }
@@ -7645,9 +7684,11 @@  discard block
 block discarded – undo
7645 7684
 
7646 7685
             for ($i = 0; $i < count($arrLP); $i++) {
7647 7686
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
7648
-                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7687
+                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7688
+                                            $s_selected_position = $arrLP[$i]['id'];
7689
+                    } elseif ($action == 'add') {
7649 7690
                         $s_selected_position = $arrLP[$i]['id'];
7650
-                    elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id'];
7691
+                    }
7651 7692
 
7652 7693
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7653 7694
 
@@ -7658,17 +7699,18 @@  discard block
 block discarded – undo
7658 7699
                 $item_type = isset($extra_info['item_type']) ? $extra_info['item_type'] : null;
7659 7700
                 $edit = isset($_GET['edit']) ? $_GET['edit'] : null;
7660 7701
                 if (($extra_info == 'new' || $item_type == TOOL_DOCUMENT || $edit == 'true')) {
7661
-                    if (isset ($_POST['content']))
7662
-                        $content = stripslashes($_POST['content']);
7663
-                    elseif (is_array($extra_info)) {
7702
+                    if (isset ($_POST['content'])) {
7703
+                                            $content = stripslashes($_POST['content']);
7704
+                    } elseif (is_array($extra_info)) {
7664 7705
                         //If it's an html document or a text file
7665 7706
                         if (!$no_display_edit_textarea) {
7666 7707
                             $content = $this->display_document($extra_info['path'], false, false);
7667 7708
                         }
7668
-                    } elseif (is_numeric($extra_info))
7669
-                        $content = $this->display_document($extra_info, false, false);
7670
-                    else
7671
-                        $content = '';
7709
+                    } elseif (is_numeric($extra_info)) {
7710
+                                            $content = $this->display_document($extra_info, false, false);
7711
+                    } else {
7712
+                                            $content = '';
7713
+                    }
7672 7714
 
7673 7715
                     if (!$no_display_edit_textarea) {
7674 7716
                         // We need to calculate here some specific settings for the online editor.
@@ -7822,11 +7864,13 @@  discard block
 block discarded – undo
7822 7864
         $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
7823 7865
         unset ($this->arrMenu);
7824 7866
 
7825
-        if ($action == 'add')
7826
-            $legend .= get_lang('CreateTheLink') . '&nbsp;:';
7827
-        elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink') . '&nbsp;:';
7828
-        else
7829
-            $legend .= get_lang('EditCurrentLink') . '&nbsp;:';
7867
+        if ($action == 'add') {
7868
+                    $legend .= get_lang('CreateTheLink') . '&nbsp;:';
7869
+        } elseif ($action == 'move') {
7870
+            $legend .= get_lang('MoveCurrentLink') . '&nbsp;:';
7871
+        } else {
7872
+                    $legend .= get_lang('EditCurrentLink') . '&nbsp;:';
7873
+        }
7830 7874
 
7831 7875
         $legend .= '</legend>';
7832 7876
 
@@ -7861,8 +7905,9 @@  discard block
 block discarded – undo
7861 7905
                     $arrHide[] = $arrLP[$i]['id'];
7862 7906
                 }
7863 7907
             } else {
7864
-                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
7865
-                    $return .= '<option ' . (($parent_item_id == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7908
+                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') {
7909
+                                    $return .= '<option ' . (($parent_item_id == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7910
+                }
7866 7911
             }
7867 7912
         }
7868 7913
 
@@ -7881,12 +7926,13 @@  discard block
 block discarded – undo
7881 7926
         $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7882 7927
         for ($i = 0; $i < count($arrLP); $i++) {
7883 7928
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7884
-                if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7885
-                    $selected = 'selected="selected" ';
7886
-                elseif ($action == 'add')
7887
-                    $selected = 'selected="selected" ';
7888
-                else
7889
-                    $selected = '';
7929
+                if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7930
+                                    $selected = 'selected="selected" ';
7931
+                } elseif ($action == 'add') {
7932
+                                    $selected = 'selected="selected" ';
7933
+                } else {
7934
+                                    $selected = '';
7935
+                }
7890 7936
 
7891 7937
                 $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7892 7938
             }
@@ -7913,9 +7959,11 @@  discard block
 block discarded – undo
7913 7959
             $arrHide = array();
7914 7960
             for ($i = 0; $i < count($arrLP); $i++) {
7915 7961
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
7916
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7917
-                        $s_selected_position = $arrLP[$i]['id'];
7918
-                    elseif ($action == 'add') $s_selected_position = 0;
7962
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7963
+                                            $s_selected_position = $arrLP[$i]['id'];
7964
+                    } elseif ($action == 'add') {
7965
+                        $s_selected_position = 0;
7966
+                    }
7919 7967
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7920 7968
 
7921 7969
                 }
@@ -8122,9 +8170,11 @@  discard block
 block discarded – undo
8122 8170
             $arrHide = array ();
8123 8171
             for ($i = 0; $i < count($arrLP); $i++) {
8124 8172
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
8125
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
8126
-                        $s_selected_position = $arrLP[$i]['id'];
8127
-                    elseif ($action == 'add') $s_selected_position = 0;
8173
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
8174
+                                            $s_selected_position = $arrLP[$i]['id'];
8175
+                    } elseif ($action == 'add') {
8176
+                        $s_selected_position = 0;
8177
+                    }
8128 8178
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
8129 8179
 
8130 8180
                 }
@@ -9683,9 +9733,9 @@  discard block
 block discarded – undo
9683 9733
         $main_code_path = api_get_path(SYS_CODE_PATH).'newscorm/packaging/';
9684 9734
         $extra_files = scandir($main_code_path);
9685 9735
         foreach ($extra_files as $extra_file) {
9686
-            if (strpos($extra_file, '.') === 0)
9687
-                continue;
9688
-            else {
9736
+            if (strpos($extra_file, '.') === 0) {
9737
+                            continue;
9738
+            } else {
9689 9739
                 $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file;
9690 9740
                 $this->create_path($dest_file);
9691 9741
                 copy($main_code_path.$extra_file, $dest_file);
Please login to merge, or discard this patch.
Spacing   +683 added lines, -683 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     // Percentage progress as saved in the db.
54 54
     public $progress_db = '0';
55 55
     public $proximity; // Wether the content is distant or local or unknown.
56
-    public $refs_list = array (); //list of items by ref => db_id. Used only for prerequisites match.
56
+    public $refs_list = array(); //list of items by ref => db_id. Used only for prerequisites match.
57 57
     // !!!This array (refs_list) is built differently depending on the nature of the LP.
58 58
     // If SCORM, uses ref, if Chamilo, uses id to keep a unique value.
59 59
     public $type; //type of learnpath. Could be 'dokeos', 'scorm', 'scorm2004', 'aicc', ...
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
                 }
155 155
 
156 156
                 if ($row['expired_on'] != '0000-00-00 00:00:00') {
157
-                    $this->expired_on  = $row['expired_on'];
157
+                    $this->expired_on = $row['expired_on'];
158 158
                 }
159 159
                 if ($this->type == 2) {
160 160
                     if ($row['force_commit'] == 1) {
@@ -198,12 +198,12 @@  discard block
 block discarded – undo
198 198
                 ORDER BY view_count DESC";
199 199
         $res = Database::query($sql);
200 200
         if ($this->debug > 2) {
201
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - querying lp_view: ' . $sql, 0);
201
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - querying lp_view: '.$sql, 0);
202 202
         }
203 203
 
204 204
         if (Database :: num_rows($res) > 0) {
205 205
             if ($this->debug > 2) {
206
-                error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - Found previous view', 0);
206
+                error_log('New LP - learnpath::__construct() '.__LINE__.' - Found previous view', 0);
207 207
             }
208 208
             $row = Database :: fetch_array($res);
209 209
             $this->attempt = $row['view_count'];
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
             $this->lp_view_session_id = $row['session_id'];
214 214
         } else if (!api_is_invitee()) {
215 215
             if ($this->debug > 2) {
216
-                error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - NOT Found previous view', 0);
216
+                error_log('New LP - learnpath::__construct() '.__LINE__.' - NOT Found previous view', 0);
217 217
             }
218 218
             $this->attempt = 1;
219 219
             $params = [
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
             $this->lp_view_id = Database::insert_id();
229 229
 
230 230
             if ($this->debug > 2) {
231
-                error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - inserting new lp_view: ' . $sql, 0);
231
+                error_log('New LP - learnpath::__construct() '.__LINE__.' - inserting new lp_view: '.$sql, 0);
232 232
             }
233 233
 
234 234
             $sql = "UPDATE $lp_table SET id = iid WHERE iid = ".$this->lp_view_id;
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
         $res = Database::query($sql);
245 245
 
246 246
         if ($this->debug > 2) {
247
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - query lp items: ' . $sql, 0);
247
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - query lp items: '.$sql, 0);
248 248
             error_log('-- Start while--', 0);
249 249
         }
250 250
 
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
                         $this->refs_list[$oItem->ref] = $my_item_id;
265 265
                         if ($this->debug > 2) {
266 266
                             error_log(
267
-                                'New LP - learnpath::__construct() - ' .
268
-                                'aicc object with id ' . $my_item_id .
267
+                                'New LP - learnpath::__construct() - '.
268
+                                'aicc object with id '.$my_item_id.
269 269
                                 ' set in items[]',
270 270
                                 0
271 271
                             );
@@ -284,19 +284,19 @@  discard block
 block discarded – undo
284 284
 
285 285
                         $this->refs_list[$oItem->ref] = $my_item_id;
286 286
                         if ($this->debug > 2) {
287
-                            error_log('New LP - object with id ' . $my_item_id . ' set in items[]', 0);
287
+                            error_log('New LP - object with id '.$my_item_id.' set in items[]', 0);
288 288
                         }
289 289
                     }
290 290
                     break;
291 291
                 case 1:
292 292
                 default:
293 293
                     if ($this->debug > 2) {
294
-                        error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - calling learnpathItem', 0);
294
+                        error_log('New LP - learnpath::__construct() '.__LINE__.' - calling learnpathItem', 0);
295 295
                     }
296 296
                     $oItem = new learnpathItem($row['id'], $user_id, $course_id, $row);
297 297
 
298 298
                     if ($this->debug > 2) {
299
-                        error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - end calling learnpathItem', 0);
299
+                        error_log('New LP - learnpath::__construct() '.__LINE__.' - end calling learnpathItem', 0);
300 300
                     }
301 301
                     if (is_object($oItem)) {
302 302
                         $my_item_id = $oItem->get_id();
@@ -307,8 +307,8 @@  discard block
 block discarded – undo
307 307
                         $this->refs_list[$my_item_id] = $my_item_id;
308 308
                         if ($this->debug > 2) {
309 309
                             error_log(
310
-                                'New LP - learnpath::__construct() ' . __LINE__ .
311
-                                ' - object with id ' . $my_item_id . ' set in items[]',
310
+                                'New LP - learnpath::__construct() '.__LINE__.
311
+                                ' - object with id '.$my_item_id.' set in items[]',
312 312
                                 0);
313 313
                         }
314 314
                     }
@@ -326,13 +326,13 @@  discard block
 block discarded – undo
326 326
                 $this->items[$row['id']]->set_lp_view($this->lp_view_id, $course_id);
327 327
                 if ($this->items[$row['id']]->get_type() == TOOL_HOTPOTATOES) {
328 328
                     $this->items[$row['id']]->current_start_time = 0;
329
-                    $this->items[$row['id']]->current_stop_time	= 0;
329
+                    $this->items[$row['id']]->current_stop_time = 0;
330 330
                 }
331 331
             }
332 332
         }
333 333
 
334 334
         if ($this->debug > 2) {
335
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' ----- end while ----', 0);
335
+            error_log('New LP - learnpath::__construct() '.__LINE__.' ----- end while ----', 0);
336 336
         }
337 337
 
338 338
         if (!empty($lp_item_id_list)) {
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
         // TODO: Define the current item better.
425 425
         $this->first();
426 426
         if ($this->debug > 2) {
427
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - End of learnpath constructor for learnpath ' . $this->get_id(), 0);
427
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - End of learnpath constructor for learnpath '.$this->get_id(), 0);
428 428
         }
429 429
         return true;
430 430
     }
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
     ) {
499 499
         $course_id = $this->course_info['real_id'];
500 500
         if ($this->debug > 0) {
501
-            error_log('New LP - In learnpath::add_item(' . $parent . ',' . $previous . ',' . $type . ',' . $id . ',' . $title . ')', 0);
501
+            error_log('New LP - In learnpath::add_item('.$parent.','.$previous.','.$type.','.$id.','.$title.')', 0);
502 502
         }
503 503
         if (empty($course_id)) {
504 504
             // Sometimes Oogie doesn't catch the course info but sets $this->cc
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
                 FROM $tbl_lp_item
519 519
                 WHERE
520 520
                     c_id = $course_id AND
521
-                    lp_id = " . $this->get_id() . " AND
521
+                    lp_id = ".$this->get_id()." AND
522 522
                     parent_item_id = " . $parent;
523 523
 
524 524
         $res_count = Database::query($sql);
@@ -528,11 +528,11 @@  discard block
 block discarded – undo
528 528
         if ($num > 0) {
529 529
             if ($previous == 0) {
530 530
                 $sql = "SELECT id, next_item_id, display_order
531
-                        FROM " . $tbl_lp_item . "
531
+                        FROM " . $tbl_lp_item."
532 532
                         WHERE
533 533
                             c_id = $course_id AND
534
-                            lp_id = " . $this->get_id() . " AND
535
-                            parent_item_id = " . $parent . " AND
534
+                            lp_id = ".$this->get_id()." AND
535
+                            parent_item_id = " . $parent." AND
536 536
                             previous_item_id = 0 OR
537 537
                             previous_item_id=" . $parent;
538 538
                 $result = Database::query($sql);
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 						FROM $tbl_lp_item
548 548
                         WHERE
549 549
                             c_id = $course_id AND
550
-                            lp_id = " . $this->get_id() . " AND
550
+                            lp_id = ".$this->get_id()." AND
551 551
                             id = " . $previous;
552 552
 
553 553
                 $result = Database::query($sql);
@@ -567,8 +567,8 @@  discard block
 block discarded – undo
567 567
         $typeCleaned = Database::escape_string($type);
568 568
         if ($type == 'quiz') {
569 569
             $sql = 'SELECT SUM(ponderation)
570
-                    FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION) . ' as quiz_question
571
-                    INNER JOIN  ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION) . ' as quiz_rel_question
570
+                    FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION).' as quiz_question
571
+                    INNER JOIN  ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION).' as quiz_rel_question
572 572
                     ON
573 573
                         quiz_question.id = quiz_rel_question.question_id AND
574 574
                         quiz_question.c_id = quiz_rel_question.c_id
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
         $new_item_id = Database::insert($tbl_lp_item, $params);
615 615
 
616 616
         if ($this->debug > 2) {
617
-            error_log('New LP - Inserting chapter: ' . $new_item_id, 0);
617
+            error_log('New LP - Inserting chapter: '.$new_item_id, 0);
618 618
         }
619 619
 
620 620
         if ($new_item_id) {
@@ -631,28 +631,28 @@  discard block
 block discarded – undo
631 631
             Database::query($sql);
632 632
 
633 633
             // Update all the items after the new item.
634
-            $sql = "UPDATE " . $tbl_lp_item . "
634
+            $sql = "UPDATE ".$tbl_lp_item."
635 635
                         SET display_order = display_order + 1
636 636
                     WHERE
637 637
                         c_id = $course_id AND
638
-                        lp_id = " . $this->get_id() . " AND
639
-                        id <> " . $new_item_id . " AND
640
-                        parent_item_id = " . $parent . " AND
638
+                        lp_id = ".$this->get_id()." AND
639
+                        id <> " . $new_item_id." AND
640
+                        parent_item_id = " . $parent." AND
641 641
                         display_order > " . $display_order;
642 642
             Database::query($sql);
643 643
 
644 644
             // Update the item that should come after the new item.
645
-            $sql = "UPDATE " . $tbl_lp_item . "
646
-                    SET ref = " . $new_item_id . "
647
-                    WHERE c_id = $course_id AND id = " . $new_item_id;
645
+            $sql = "UPDATE ".$tbl_lp_item."
646
+                    SET ref = " . $new_item_id."
647
+                    WHERE c_id = $course_id AND id = ".$new_item_id;
648 648
             Database::query($sql);
649 649
 
650 650
             // Upload audio.
651 651
             if (!empty($_FILES['mp3']['name'])) {
652 652
                 // Create the audio folder if it does not exist yet.
653
-                $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
654
-                if (!is_dir($filepath . 'audio')) {
655
-                    mkdir($filepath . 'audio', api_get_permissions_for_new_directories());
653
+                $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
654
+                if (!is_dir($filepath.'audio')) {
655
+                    mkdir($filepath.'audio', api_get_permissions_for_new_directories());
656 656
                     $audio_id = add_document(
657 657
                         $_course,
658 658
                         '/audio',
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
                 $file_path = handle_uploaded_document(
690 690
                     $_course,
691 691
                     $_FILES['mp3'],
692
-                    api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document',
692
+                    api_get_path(SYS_COURSE_PATH).$_course['path'].'/document',
693 693
                     '/audio',
694 694
                     api_get_user_id(),
695 695
                     '',
@@ -705,8 +705,8 @@  discard block
 block discarded – undo
705 705
 
706 706
                 // Store the mp3 file in the lp_item table.
707 707
                 $sql = "UPDATE $tbl_lp_item SET
708
-                            audio = '" . Database::escape_string($file) . "'
709
-                        WHERE id = '" . intval($new_item_id) . "'";
708
+                            audio = '".Database::escape_string($file)."'
709
+                        WHERE id = '" . intval($new_item_id)."'";
710 710
                 Database::query($sql);
711 711
             }
712 712
         }
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
         while (Database :: num_rows($res_name)) {
783 783
             // There is already one such name, update the current one a bit.
784 784
             $i++;
785
-            $name = $name . ' - ' . $i;
785
+            $name = $name.' - '.$i;
786 786
             $check_name = "SELECT * FROM $tbl_lp WHERE c_id = $course_id AND name = '$name'";
787 787
             $res_name = Database::query($check_name);
788 788
         }
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
                 // if $item points to an object and there is a parent.
895 895
                 if ($debug) {
896 896
                     error_log(
897
-                        'Autocompleting parent of item ' . $item . ' "'.$currentItem->get_title().'" (item ' . $parent_id . ' "'.$parent->get_title().'") ',
897
+                        'Autocompleting parent of item '.$item.' "'.$currentItem->get_title().'" (item '.$parent_id.' "'.$parent->get_title().'") ',
898 898
                         0
899 899
                     );
900 900
                 }
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
                         if ($childItemId != $item) {
923 923
                             if ($debug) {
924 924
                                 error_log(
925
-                                    'Looking at brother #'.$childItemId . ' "' . $childItem->get_title() . '", status is ' . $childItem->get_status(),
925
+                                    'Looking at brother #'.$childItemId.' "'.$childItem->get_title().'", status is '.$childItem->get_status(),
926 926
                                     0
927 927
                                 );
928 928
                             }
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
                             } else {
943 943
                                 if ($debug > 2) {
944 944
                                     error_log(
945
-                                        'Found one incomplete child of parent #' . $parent_id . ': child #'.$childItemId . ' "' . $childItem->get_title() . '", is ' . $childItem->get_status().' db_item_view_id:#'.$childItem->db_item_view_id,
945
+                                        'Found one incomplete child of parent #'.$parent_id.': child #'.$childItemId.' "'.$childItem->get_title().'", is '.$childItem->get_status().' db_item_view_id:#'.$childItem->db_item_view_id,
946 946
                                         0
947 947
                                     );
948 948
                                 }
@@ -1047,15 +1047,15 @@  discard block
 block discarded – undo
1047 1047
         // Delete lp item id.
1048 1048
         foreach ($this->items as $id => $dummy) {
1049 1049
             $sql = "DELETE FROM $lp_item_view
1050
-                    WHERE c_id = $course_id AND lp_item_id = '" . $id . "'";
1050
+                    WHERE c_id = $course_id AND lp_item_id = '".$id."'";
1051 1051
             Database::query($sql);
1052 1052
         }
1053 1053
 
1054 1054
         // Proposed by Christophe (nickname: clefevre)
1055
-        $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
1055
+        $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
1056 1056
         Database::query($sql);
1057 1057
 
1058
-        $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
1058
+        $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
1059 1059
         Database::query($sql);
1060 1060
 
1061 1061
         self::toggle_publish($this->lp_id, 'i');
@@ -1063,32 +1063,32 @@  discard block
 block discarded – undo
1063 1063
         if ($this->type == 2 || $this->type == 3) {
1064 1064
             // This is a scorm learning path, delete the files as well.
1065 1065
             $sql = "SELECT path FROM $lp
1066
-                    WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
1066
+                    WHERE c_id = ".$course_id." AND id = ".$this->lp_id;
1067 1067
             $res = Database::query($sql);
1068 1068
             if (Database :: num_rows($res) > 0) {
1069 1069
                 $row = Database :: fetch_array($res);
1070 1070
                 $path = $row['path'];
1071 1071
                 $sql = "SELECT id FROM $lp
1072
-                        WHERE c_id = ".$course_id." AND path = '$path' AND id != " . $this->lp_id;
1072
+                        WHERE c_id = ".$course_id." AND path = '$path' AND id != ".$this->lp_id;
1073 1073
                 $res = Database::query($sql);
1074 1074
                 if (Database :: num_rows($res) > 0) { // Another learning path uses this directory, so don't delete it.
1075 1075
                     if ($this->debug > 2) {
1076
-                        error_log('New LP - In learnpath::delete(), found other LP using path ' . $path . ', keeping directory', 0);
1076
+                        error_log('New LP - In learnpath::delete(), found other LP using path '.$path.', keeping directory', 0);
1077 1077
                     }
1078 1078
                 } else {
1079 1079
                     // No other LP uses that directory, delete it.
1080
-                    $course_rel_dir = api_get_course_path() . '/scorm/'; // scorm dir web path starting from /courses
1081
-                    $course_scorm_dir = api_get_path(SYS_COURSE_PATH) . $course_rel_dir; // The absolute system path for this course.
1082
-                    if ($delete == 'remove' && is_dir($course_scorm_dir . $path) and !empty ($course_scorm_dir)) {
1080
+                    $course_rel_dir = api_get_course_path().'/scorm/'; // scorm dir web path starting from /courses
1081
+                    $course_scorm_dir = api_get_path(SYS_COURSE_PATH).$course_rel_dir; // The absolute system path for this course.
1082
+                    if ($delete == 'remove' && is_dir($course_scorm_dir.$path) and !empty ($course_scorm_dir)) {
1083 1083
                         if ($this->debug > 2) {
1084
-                            error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: ' . $course_scorm_dir . $path, 0);
1084
+                            error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: '.$course_scorm_dir.$path, 0);
1085 1085
                         }
1086 1086
                         // Proposed by Christophe (clefevre).
1087 1087
                         if (strcmp(substr($path, -2), "/.") == 0) {
1088 1088
                             $path = substr($path, 0, -1); // Remove "." at the end.
1089 1089
                         }
1090 1090
                         //exec('rm -rf ' . $course_scorm_dir . $path); // See Bug #5208, this is not OS-portable way.
1091
-                        rmdirr($course_scorm_dir . $path);
1091
+                        rmdirr($course_scorm_dir.$path);
1092 1092
                     }
1093 1093
                 }
1094 1094
             }
@@ -1101,7 +1101,7 @@  discard block
 block discarded – undo
1101 1101
                 WHERE c_id = ".$course_id." AND (link LIKE '$link%' AND image='scormbuilder.gif')";
1102 1102
         Database::query($sql);
1103 1103
 
1104
-        $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
1104
+        $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = ".$this->lp_id;
1105 1105
         Database::query($sql);
1106 1106
         // Updates the display order of all lps.
1107 1107
         $this->update_display_order();
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
             api_get_user_id()
1115 1115
         );
1116 1116
 
1117
-        $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4 , $id, api_get_session_id());
1117
+        $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4, $id, api_get_session_id());
1118 1118
         if ($link_info !== false) {
1119 1119
             GradebookUtils::remove_resource_from_course_gradebook($link_info['id']);
1120 1120
         }
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
     {
1135 1135
         $course_id = $this->course_info['real_id'];
1136 1136
         if ($this->debug > 0) {
1137
-            error_log('New LP - In learnpath::delete_children_items(' . $id . ')', 0);
1137
+            error_log('New LP - In learnpath::delete_children_items('.$id.')', 0);
1138 1138
         }
1139 1139
         $num = 0;
1140 1140
         if (empty ($id) || $id != strval(intval($id))) {
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
         $res = Database::query($sql);
1146 1146
         while ($row = Database :: fetch_array($res)) {
1147 1147
             $num += $this->delete_children_items($row['id']);
1148
-            $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = " . $row['id'];
1148
+            $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = ".$row['id'];
1149 1149
             Database::query($sql_del);
1150 1150
             $num++;
1151 1151
         }
@@ -1186,12 +1186,12 @@  discard block
 block discarded – undo
1186 1186
         // Delete children items.
1187 1187
         $num = $this->delete_children_items($id);
1188 1188
         if ($this->debug > 2) {
1189
-            error_log('New LP - learnpath::delete_item() - deleted ' . $num . ' children of element ' . $id, 0);
1189
+            error_log('New LP - learnpath::delete_item() - deleted '.$num.' children of element '.$id, 0);
1190 1190
         }
1191 1191
         // Now delete the item.
1192 1192
         $sql_del = "DELETE FROM $lp_item WHERE c_id = $course_id AND id = $id";
1193 1193
         if ($this->debug > 2) {
1194
-            error_log('New LP - Deleting item: ' . $sql_del, 0);
1194
+            error_log('New LP - Deleting item: '.$sql_del, 0);
1195 1195
         }
1196 1196
         Database::query($sql_del);
1197 1197
         // Now update surrounding items.
@@ -1266,15 +1266,15 @@  discard block
 block discarded – undo
1266 1266
         }
1267 1267
 
1268 1268
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
1269
-        $sql_select = "SELECT * FROM " . $tbl_lp_item . " WHERE c_id = ".$course_id." AND id = " . $id;
1269
+        $sql_select = "SELECT * FROM ".$tbl_lp_item." WHERE c_id = ".$course_id." AND id = ".$id;
1270 1270
         $res_select = Database::query($sql_select);
1271 1271
         $row_select = Database :: fetch_array($res_select);
1272 1272
         $audio_update_sql = '';
1273 1273
         if (is_array($audio) && !empty ($audio['tmp_name']) && $audio['error'] === 0) {
1274 1274
             // Create the audio folder if it does not exist yet.
1275
-            $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
1276
-            if (!is_dir($filepath . 'audio')) {
1277
-                mkdir($filepath . 'audio', api_get_permissions_for_new_directories());
1275
+            $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
1276
+            if (!is_dir($filepath.'audio')) {
1277
+                mkdir($filepath.'audio', api_get_permissions_for_new_directories());
1278 1278
                 $audio_id = add_document(
1279 1279
                     $_course,
1280 1280
                     '/audio',
@@ -1312,11 +1312,11 @@  discard block
 block discarded – undo
1312 1312
             $pi = pathinfo($audio['name']);
1313 1313
             if ($pi['extension'] == 'mp3') {
1314 1314
                 $c_det = api_get_course_info($this->cc);
1315
-                $bp = api_get_path(SYS_COURSE_PATH) . $c_det['path'] . '/document';
1315
+                $bp = api_get_path(SYS_COURSE_PATH).$c_det['path'].'/document';
1316 1316
                 $path = handle_uploaded_document($c_det, $audio, $bp, '/audio', api_get_user_id(), 0, null, 0, 'rename', false, 0);
1317 1317
                 $path = substr($path, 7);
1318 1318
                 // Update reference in lp_item - audio path is the path from inside de document/audio/ dir.
1319
-                $audio_update_sql = ", audio = '" . Database::escape_string($path) . "' ";
1319
+                $audio_update_sql = ", audio = '".Database::escape_string($path)."' ";
1320 1320
             }
1321 1321
         }
1322 1322
 
@@ -1326,13 +1326,13 @@  discard block
 block discarded – undo
1326 1326
         // TODO: htmlspecialchars to be checked for encoding related problems.
1327 1327
         if ($same_parent && $same_previous) {
1328 1328
             // Only update title and description.
1329
-            $sql = "UPDATE " . $tbl_lp_item . "
1330
-                    SET title = '" . Database::escape_string($title) . "',
1331
-                        prerequisite = '" . $prerequisites . "',
1332
-                        description = '" . Database::escape_string($description) . "'
1333
-                        " . $audio_update_sql . ",
1334
-                        max_time_allowed = '" . Database::escape_string($max_time_allowed) . "'
1335
-                    WHERE c_id = ".$course_id." AND id = " . $id;
1329
+            $sql = "UPDATE ".$tbl_lp_item."
1330
+                    SET title = '" . Database::escape_string($title)."',
1331
+                        prerequisite = '" . $prerequisites."',
1332
+                        description = '" . Database::escape_string($description)."'
1333
+                        " . $audio_update_sql.",
1334
+                        max_time_allowed = '" . Database::escape_string($max_time_allowed)."'
1335
+                    WHERE c_id = ".$course_id." AND id = ".$id;
1336 1336
             Database::query($sql);
1337 1337
         } else {
1338 1338
             $old_parent = $row_select['parent_item_id'];
@@ -1347,27 +1347,27 @@  discard block
 block discarded – undo
1347 1347
 
1348 1348
             if ($old_previous != 0) {
1349 1349
                 // Next
1350
-                $sql = "UPDATE " . $tbl_lp_item . "
1351
-                        SET next_item_id = " . $old_next . "
1352
-                        WHERE c_id = ".$course_id." AND id = " . $old_previous;
1350
+                $sql = "UPDATE ".$tbl_lp_item."
1351
+                        SET next_item_id = " . $old_next."
1352
+                        WHERE c_id = ".$course_id." AND id = ".$old_previous;
1353 1353
                 Database::query($sql);
1354 1354
             }
1355 1355
 
1356 1356
             if ($old_next != 0) {
1357 1357
                 // Previous
1358
-                $sql = "UPDATE " . $tbl_lp_item . "
1359
-                        SET previous_item_id = " . $old_previous . "
1360
-                        WHERE c_id = ".$course_id." AND id = " . $old_next;
1358
+                $sql = "UPDATE ".$tbl_lp_item."
1359
+                        SET previous_item_id = " . $old_previous."
1360
+                        WHERE c_id = ".$course_id." AND id = ".$old_next;
1361 1361
                 Database::query($sql);
1362 1362
             }
1363 1363
 
1364 1364
             // display_order - 1 for every item with a display_order bigger then the display_order of the current item.
1365
-            $sql = "UPDATE " . $tbl_lp_item . "
1365
+            $sql = "UPDATE ".$tbl_lp_item."
1366 1366
                     SET display_order = display_order - 1
1367 1367
                     WHERE
1368 1368
                         c_id = ".$course_id." AND
1369
-                        display_order > " . $old_order . " AND
1370
-                        lp_id = " . $this->lp_id . " AND
1369
+                        display_order > " . $old_order." AND
1370
+                        lp_id = " . $this->lp_id." AND
1371 1371
                         parent_item_id = " . $old_parent;
1372 1372
             Database::query($sql);
1373 1373
             /* END -- virtually remove the current item id */
@@ -1377,11 +1377,11 @@  discard block
 block discarded – undo
1377 1377
             if ($previous == 0) {
1378 1378
                 // Select the data of the item that should come after the current item.
1379 1379
                 $sql = "SELECT id, display_order
1380
-                        FROM " . $tbl_lp_item . "
1380
+                        FROM " . $tbl_lp_item."
1381 1381
                         WHERE
1382 1382
                             c_id = ".$course_id." AND
1383
-                            lp_id = " . $this->lp_id . " AND
1384
-                            parent_item_id = " . $parent . " AND
1383
+                            lp_id = " . $this->lp_id." AND
1384
+                            parent_item_id = " . $parent." AND
1385 1385
                             previous_item_id = " . $previous;
1386 1386
                 $res_select_old = Database::query($sql);
1387 1387
                 $row_select_old = Database::fetch_array($res_select_old);
@@ -1397,8 +1397,8 @@  discard block
 block discarded – undo
1397 1397
             } else {
1398 1398
                 // Select the data of the item that should come before the current item.
1399 1399
                 $sql = "SELECT next_item_id, display_order
1400
-                        FROM " . $tbl_lp_item . "
1401
-                        WHERE c_id = ".$course_id." AND id = " . $previous;
1400
+                        FROM " . $tbl_lp_item."
1401
+                        WHERE c_id = ".$course_id." AND id = ".$previous;
1402 1402
                 $res_select_old = Database::query($sql);
1403 1403
                 $row_select_old = Database :: fetch_array($res_select_old);
1404 1404
                 $new_next = $row_select_old['next_item_id'];
@@ -1407,57 +1407,57 @@  discard block
 block discarded – undo
1407 1407
 
1408 1408
             // TODO: htmlspecialchars to be checked for encoding related problems.
1409 1409
             // Update the current item with the new data.
1410
-            $sql = "UPDATE " . $tbl_lp_item . "
1410
+            $sql = "UPDATE ".$tbl_lp_item."
1411 1411
                     SET
1412
-                        title = '" . Database::escape_string($title) . "',
1413
-                        description = '" . Database::escape_string($description) . "',
1414
-                        parent_item_id = " . $parent . ",
1415
-                        previous_item_id = " . $previous . ",
1416
-                        next_item_id = " . $new_next . ",
1417
-                        display_order = " . $new_order . "
1418
-                        " . $audio_update_sql . "
1419
-                    WHERE c_id = ".$course_id." AND id = " . $id;
1412
+                        title = '" . Database::escape_string($title)."',
1413
+                        description = '" . Database::escape_string($description)."',
1414
+                        parent_item_id = " . $parent.",
1415
+                        previous_item_id = " . $previous.",
1416
+                        next_item_id = " . $new_next.",
1417
+                        display_order = " . $new_order."
1418
+                        " . $audio_update_sql."
1419
+                    WHERE c_id = ".$course_id." AND id = ".$id;
1420 1420
             Database::query($sql);
1421 1421
 
1422 1422
             if ($previous != 0) {
1423 1423
                 // Update the previous item's next_item_id.
1424
-                $sql = "UPDATE " . $tbl_lp_item . "
1425
-                        SET next_item_id = " . $id . "
1426
-                        WHERE c_id = ".$course_id." AND id = " . $previous;
1424
+                $sql = "UPDATE ".$tbl_lp_item."
1425
+                        SET next_item_id = " . $id."
1426
+                        WHERE c_id = ".$course_id." AND id = ".$previous;
1427 1427
                 Database::query($sql);
1428 1428
             }
1429 1429
 
1430 1430
             if ($new_next != 0) {
1431 1431
                 // Update the next item's previous_item_id.
1432
-                $sql = "UPDATE " . $tbl_lp_item . "
1433
-                        SET previous_item_id = " . $id . "
1434
-                        WHERE c_id = ".$course_id." AND id = " . $new_next;
1432
+                $sql = "UPDATE ".$tbl_lp_item."
1433
+                        SET previous_item_id = " . $id."
1434
+                        WHERE c_id = ".$course_id." AND id = ".$new_next;
1435 1435
                 Database::query($sql);
1436 1436
             }
1437 1437
 
1438 1438
             if ($old_prerequisite != $prerequisites) {
1439
-                $sql = "UPDATE " . $tbl_lp_item . "
1440
-                        SET prerequisite = '" . $prerequisites . "'
1441
-                        WHERE c_id = ".$course_id." AND id = " . $id;
1439
+                $sql = "UPDATE ".$tbl_lp_item."
1440
+                        SET prerequisite = '" . $prerequisites."'
1441
+                        WHERE c_id = ".$course_id." AND id = ".$id;
1442 1442
                 Database::query($sql);
1443 1443
             }
1444 1444
 
1445 1445
             if ($old_max_time_allowed != $max_time_allowed) {
1446 1446
                 // update max time allowed
1447
-                $sql = "UPDATE " . $tbl_lp_item . "
1448
-                        SET max_time_allowed = " . $max_time_allowed . "
1449
-                        WHERE c_id = ".$course_id." AND id = " . $id;
1447
+                $sql = "UPDATE ".$tbl_lp_item."
1448
+                        SET max_time_allowed = " . $max_time_allowed."
1449
+                        WHERE c_id = ".$course_id." AND id = ".$id;
1450 1450
                 Database::query($sql);
1451 1451
             }
1452 1452
 
1453 1453
             // Update all the items with the same or a bigger display_order than the current item.
1454
-            $sql = "UPDATE " . $tbl_lp_item . "
1454
+            $sql = "UPDATE ".$tbl_lp_item."
1455 1455
                     SET display_order = display_order + 1
1456 1456
                     WHERE
1457 1457
                        c_id = ".$course_id." AND
1458
-                       lp_id = " . $this->get_id() . " AND
1459
-                       id <> " . $id . " AND
1460
-                       parent_item_id = " . $parent . " AND
1458
+                       lp_id = " . $this->get_id()." AND
1459
+                       id <> " . $id." AND
1460
+                       parent_item_id = " . $parent." AND
1461 1461
                        display_order >= " . $new_order;
1462 1462
 
1463 1463
             Database::query($sql);
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
     {
1484 1484
         $course_id = api_get_course_int_id();
1485 1485
         if ($this->debug > 0) {
1486
-            error_log('New LP - In learnpath::edit_item_prereq(' . $id . ',' . $prerequisite_id . ',' . $mastery_score . ',' . $max_score . ')', 0);
1486
+            error_log('New LP - In learnpath::edit_item_prereq('.$id.','.$prerequisite_id.','.$mastery_score.','.$max_score.')', 0);
1487 1487
         }
1488 1488
 
1489 1489
         if (empty($id) || ($id != strval(intval($id))) || empty ($prerequisite_id)) {
@@ -1581,8 +1581,8 @@  discard block
 block discarded – undo
1581 1581
             error_log('New LP - In learnpath::get_brother_chapters()', 0);
1582 1582
         }
1583 1583
 
1584
-        if (empty($id)|| $id != strval(intval($id))) {
1585
-            return array ();
1584
+        if (empty($id) || $id != strval(intval($id))) {
1585
+            return array();
1586 1586
         }
1587 1587
 
1588 1588
         $lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -1600,13 +1600,13 @@  discard block
 block discarded – undo
1600 1600
                             item_type='dokeos_chapter'
1601 1601
                         ORDER BY display_order";
1602 1602
             $res_bros = Database::query($sql_bros);
1603
-            $list = array ();
1603
+            $list = array();
1604 1604
             while ($row_bro = Database :: fetch_array($res_bros)) {
1605 1605
                 $list[] = $row_bro;
1606 1606
             }
1607 1607
             return $list;
1608 1608
         }
1609
-        return array ();
1609
+        return array();
1610 1610
     }
1611 1611
 
1612 1612
     /**
@@ -1619,11 +1619,11 @@  discard block
 block discarded – undo
1619 1619
     {
1620 1620
         $course_id = api_get_course_int_id();
1621 1621
         if ($this->debug > 0) {
1622
-            error_log('New LP - In learnpath::get_brother_items(' . $id . ')', 0);
1622
+            error_log('New LP - In learnpath::get_brother_items('.$id.')', 0);
1623 1623
         }
1624 1624
 
1625 1625
         if (empty ($id) || $id != strval(intval($id))) {
1626
-            return array ();
1626
+            return array();
1627 1627
         }
1628 1628
 
1629 1629
         $lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -1635,13 +1635,13 @@  discard block
 block discarded – undo
1635 1635
             $sql_bros = "SELECT * FROM $lp_item WHERE c_id = ".$course_id." AND parent_item_id = $parent
1636 1636
                          ORDER BY display_order";
1637 1637
             $res_bros = Database::query($sql_bros);
1638
-            $list = array ();
1638
+            $list = array();
1639 1639
             while ($row_bro = Database :: fetch_array($res_bros)) {
1640 1640
                 $list[] = $row_bro;
1641 1641
             }
1642 1642
             return $list;
1643 1643
         }
1644
-        return array ();
1644
+        return array();
1645 1645
     }
1646 1646
 
1647 1647
     /**
@@ -1711,7 +1711,7 @@  discard block
 block discarded – undo
1711 1711
             $current = $this->current;
1712 1712
         }
1713 1713
         if ($this->debug > 2) {
1714
-            error_log('New LP - In learnpath::get_current_item_id() - Returning ' . $current, 0);
1714
+            error_log('New LP - In learnpath::get_current_item_id() - Returning '.$current, 0);
1715 1715
         }
1716 1716
         return $current;
1717 1717
     }
@@ -1792,7 +1792,7 @@  discard block
 block discarded – undo
1792 1792
         ) {
1793 1793
 
1794 1794
             if ($this->debug > 2) {
1795
-                error_log('New LP - In learnpath::first() - Last item seen is ' . $this->last_item_seen.' of type '.$this->items[$this->last_item_seen]->get_type(), 0);
1795
+                error_log('New LP - In learnpath::first() - Last item seen is '.$this->last_item_seen.' of type '.$this->items[$this->last_item_seen]->get_type(), 0);
1796 1796
             }
1797 1797
             $index = -1;
1798 1798
             foreach ($this->ordered_items as $myindex => $item_id) {
@@ -1804,7 +1804,7 @@  discard block
 block discarded – undo
1804 1804
             if ($index == -1) {
1805 1805
                 // Index hasn't changed, so item not found - panic (this shouldn't happen).
1806 1806
                 if ($this->debug > 2) {
1807
-                    error_log('New LP - Last item (' . $this->last_item_seen . ') was found in items but not in ordered_items, panic!', 0);
1807
+                    error_log('New LP - Last item ('.$this->last_item_seen.') was found in items but not in ordered_items, panic!', 0);
1808 1808
                 }
1809 1809
                 return false;
1810 1810
             } else {
@@ -1819,7 +1819,7 @@  discard block
 block discarded – undo
1819 1819
             $index = 0;
1820 1820
             // Loop through all ordered items and stop at the first item that is
1821 1821
             // not a directory *and* that has not been completed yet.
1822
-            while ( !empty($this->ordered_items[$index]) AND
1822
+            while (!empty($this->ordered_items[$index]) AND
1823 1823
                 is_a($this->items[$this->ordered_items[$index]], 'learnpathItem') AND
1824 1824
                 (
1825 1825
                     $this->items[$this->ordered_items[$index]]->get_type() == 'dir' OR
@@ -1833,14 +1833,14 @@  discard block
 block discarded – undo
1833 1833
             $this->current  = isset($this->ordered_items[$index]) ? $this->ordered_items[$index] : null;
1834 1834
             $this->index    = $index;
1835 1835
             if ($this->debug > 2) {
1836
-                error_log('$index ' . $index);
1836
+                error_log('$index '.$index);
1837 1837
             }
1838 1838
             if ($this->debug > 2) {
1839
-                error_log('New LP - In learnpath::first() - No last item seen. New last = ' . $this->last . '(' . $this->ordered_items[$index] . ')', 0);
1839
+                error_log('New LP - In learnpath::first() - No last item seen. New last = '.$this->last.'('.$this->ordered_items[$index].')', 0);
1840 1840
             }
1841 1841
         }
1842 1842
         if ($this->debug > 2) {
1843
-            error_log('New LP - In learnpath::first() - First item is ' . $this->get_current_item_id());
1843
+            error_log('New LP - In learnpath::first() - First item is '.$this->get_current_item_id());
1844 1844
         }
1845 1845
     }
1846 1846
 
@@ -1853,7 +1853,7 @@  discard block
 block discarded – undo
1853 1853
     public function get_js_info($item_id = '')
1854 1854
     {
1855 1855
         if ($this->debug > 0) {
1856
-            error_log('New LP - In learnpath::get_js_info(' . $item_id . ')', 0);
1856
+            error_log('New LP - In learnpath::get_js_info('.$item_id.')', 0);
1857 1857
         }
1858 1858
 
1859 1859
         $info = '';
@@ -1863,17 +1863,17 @@  discard block
 block discarded – undo
1863 1863
             //if item is defined, return values from DB
1864 1864
             $oItem = $this->items[$item_id];
1865 1865
             $info .= '<script language="javascript">';
1866
-            $info .= "top.set_score(" . $oItem->get_score() . ");\n";
1867
-            $info .= "top.set_max(" . $oItem->get_max() . ");\n";
1868
-            $info .= "top.set_min(" . $oItem->get_min() . ");\n";
1869
-            $info .= "top.set_lesson_status('" . $oItem->get_status() . "');";
1870
-            $info .= "top.set_session_time('" . $oItem->get_scorm_time('js') . "');";
1871
-            $info .= "top.set_suspend_data('" . $oItem->get_suspend_data() . "');";
1872
-            $info .= "top.set_saved_lesson_status('" . $oItem->get_status() . "');";
1866
+            $info .= "top.set_score(".$oItem->get_score().");\n";
1867
+            $info .= "top.set_max(".$oItem->get_max().");\n";
1868
+            $info .= "top.set_min(".$oItem->get_min().");\n";
1869
+            $info .= "top.set_lesson_status('".$oItem->get_status()."');";
1870
+            $info .= "top.set_session_time('".$oItem->get_scorm_time('js')."');";
1871
+            $info .= "top.set_suspend_data('".$oItem->get_suspend_data()."');";
1872
+            $info .= "top.set_saved_lesson_status('".$oItem->get_status()."');";
1873 1873
             $info .= "top.set_flag_synchronized();";
1874 1874
             $info .= '</script>';
1875 1875
             if ($this->debug > 2) {
1876
-                error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0);
1876
+                error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0);
1877 1877
             }
1878 1878
             return $info;
1879 1879
 
@@ -1881,17 +1881,17 @@  discard block
 block discarded – undo
1881 1881
 
1882 1882
             // If item_id is empty, just update to default SCORM data.
1883 1883
             $info .= '<script language="javascript">';
1884
-            $info .= "top.set_score(" . learnpathItem :: get_score() . ");\n";
1885
-            $info .= "top.set_max(" . learnpathItem :: get_max() . ");\n";
1886
-            $info .= "top.set_min(" . learnpathItem :: get_min() . ");\n";
1887
-            $info .= "top.set_lesson_status('" . learnpathItem :: get_status() . "');";
1888
-            $info .= "top.set_session_time('" . learnpathItem :: getScormTimeFromParameter('js') . "');";
1889
-            $info .= "top.set_suspend_data('" . learnpathItem :: get_suspend_data() . "');";
1890
-            $info .= "top.set_saved_lesson_status('" . learnpathItem :: get_status() . "');";
1884
+            $info .= "top.set_score(".learnpathItem :: get_score().");\n";
1885
+            $info .= "top.set_max(".learnpathItem :: get_max().");\n";
1886
+            $info .= "top.set_min(".learnpathItem :: get_min().");\n";
1887
+            $info .= "top.set_lesson_status('".learnpathItem :: get_status()."');";
1888
+            $info .= "top.set_session_time('".learnpathItem :: getScormTimeFromParameter('js')."');";
1889
+            $info .= "top.set_suspend_data('".learnpathItem :: get_suspend_data()."');";
1890
+            $info .= "top.set_saved_lesson_status('".learnpathItem :: get_status()."');";
1891 1891
             $info .= "top.set_flag_synchronized();";
1892 1892
             $info .= '</script>';
1893 1893
             if ($this->debug > 2) {
1894
-                error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0);
1894
+                error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0);
1895 1895
             }
1896 1896
             return $info;
1897 1897
         }
@@ -1945,12 +1945,12 @@  discard block
 block discarded – undo
1945 1945
      * Gets the navigation bar for the learnpath display screen
1946 1946
      * @return	string	The HTML string to use as a navigation bar
1947 1947
      */
1948
-    public function get_navigation_bar($idBar = null, $display=null) {
1948
+    public function get_navigation_bar($idBar = null, $display = null) {
1949 1949
         if ($this->debug > 0) {
1950 1950
             error_log('New LP - In learnpath::get_navigation_bar()', 0);
1951 1951
         }
1952
-        if(empty($idBar)){
1953
-            $idBar='control-top';
1952
+        if (empty($idBar)) {
1953
+            $idBar = 'control-top';
1954 1954
         }
1955 1955
         /* if(empty($display)){
1956 1956
             $display='display:block';
@@ -1963,16 +1963,16 @@  discard block
 block discarded – undo
1963 1963
             $navbar = '
1964 1964
                   <span id="'.$idBar.'" class="buttons">
1965 1965
                     <a class="icon-toolbar" href="lp_controller.php?action=stats&'.api_get_cidreq(true).'&lp_id='.$lp_id.'" onclick="window.parent.API.save_asset();return true;" target="content_name" title="stats" id="stats_link">
1966
-                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span>
1966
+                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span>
1967 1967
                     </a>
1968
-                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous">
1969
-                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span>
1968
+                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous">
1969
+                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span>
1970 1970
                     </a>
1971
-                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next">
1972
-                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span>
1971
+                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next">
1972
+                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span>
1973 1973
                     </a>
1974 1974
                     <a class="icon-toolbar" id="view-embedded" href="lp_controller.php?action=mode&mode=embedded" target="_top" title="embedded mode">
1975
-                        <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen') . '</span>
1975
+                        <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen').'</span>
1976 1976
                     </a>
1977 1977
                   </span>';
1978 1978
 
@@ -1980,13 +1980,13 @@  discard block
 block discarded – undo
1980 1980
             $navbar = '
1981 1981
                 <span id="'.$idBar.'" class="buttons text-right">
1982 1982
                     <a class="icon-toolbar" href="lp_controller.php?action=stats&'.api_get_cidreq(true).'&lp_id='.$lp_id.'" onclick="window.parent.API.save_asset();return true;" target="content_name" title="stats" id="stats_link">
1983
-                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span>
1983
+                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span>
1984 1984
                     </a>
1985
-                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous">
1986
-                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span>
1985
+                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous">
1986
+                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span>
1987 1987
                     </a>
1988
-                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next">
1989
-                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span>
1988
+                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next">
1989
+                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span>
1990 1990
                     </a>
1991 1991
                 </span>';
1992 1992
         }
@@ -2007,11 +2007,11 @@  discard block
 block discarded – undo
2007 2007
         $index = $this->index;
2008 2008
         $index++;
2009 2009
         if ($this->debug > 2) {
2010
-            error_log('New LP - Now looking at ordered_items[' . ($index) . '] - type is ' . $this->items[$this->ordered_items[$index]]->type, 0);
2010
+            error_log('New LP - Now looking at ordered_items['.($index).'] - type is '.$this->items[$this->ordered_items[$index]]->type, 0);
2011 2011
         }
2012 2012
         while (!empty ($this->ordered_items[$index]) AND ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter') AND $index < $this->max_ordered_items) {
2013 2013
             $index++;
2014
-            if ($index == $this->max_ordered_items){
2014
+            if ($index == $this->max_ordered_items) {
2015 2015
                 if ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter') {
2016 2016
                     return $this->index;
2017 2017
                 } else {
@@ -2023,7 +2023,7 @@  discard block
 block discarded – undo
2023 2023
             return $this->index;
2024 2024
         }
2025 2025
         if ($this->debug > 2) {
2026
-            error_log('New LP - index is now ' . $index, 0);
2026
+            error_log('New LP - index is now '.$index, 0);
2027 2027
         }
2028 2028
         return $index;
2029 2029
     }
@@ -2041,7 +2041,7 @@  discard block
 block discarded – undo
2041 2041
         if (!empty ($new_index)) {
2042 2042
             if (isset ($this->ordered_items[$new_index])) {
2043 2043
                 if ($this->debug > 2) {
2044
-                    error_log('New LP - In learnpath::get_next_index() - Returning ' . $this->ordered_items[$new_index], 0);
2044
+                    error_log('New LP - In learnpath::get_next_index() - Returning '.$this->ordered_items[$new_index], 0);
2045 2045
                 }
2046 2046
                 return $this->ordered_items[$new_index];
2047 2047
             }
@@ -2083,7 +2083,7 @@  discard block
 block discarded – undo
2083 2083
         }
2084 2084
 
2085 2085
         // Filename without its extension.
2086
-        $file_base_name = str_replace('.' . $extension, '', $filename);
2086
+        $file_base_name = str_replace('.'.$extension, '', $filename);
2087 2087
 
2088 2088
         $zipFile = new PclZip($file_path);
2089 2089
         // Check the zip content (real size and file extension).
@@ -2107,7 +2107,7 @@  discard block
 block discarded – undo
2107 2107
                     break; // Exit the foreach loop.
2108 2108
                 } elseif (
2109 2109
                     preg_match('/aicc\//i', $thisContent['filename']) ||
2110
-                    in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array( 'crs','au','des','cst'))
2110
+                    in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array('crs', 'au', 'des', 'cst'))
2111 2111
                 ) {
2112 2112
                     $ext = strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION));
2113 2113
                     switch ($ext) {
@@ -2149,7 +2149,7 @@  discard block
 block discarded – undo
2149 2149
             error_log('New LP - In learnpath::get_previous_index()', 0);
2150 2150
         }
2151 2151
         $index = $this->index;
2152
-        if (isset ($this->ordered_items[$index -1])) {
2152
+        if (isset ($this->ordered_items[$index - 1])) {
2153 2153
             $index--;
2154 2154
             while (isset($this->ordered_items[$index]) && ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter')) {
2155 2155
                 $index--;
@@ -2159,7 +2159,7 @@  discard block
 block discarded – undo
2159 2159
             }
2160 2160
         } else {
2161 2161
             if ($this->debug > 2) {
2162
-                error_log('New LP - get_previous_index() - there was no previous index available, reusing ' . $index, 0);
2162
+                error_log('New LP - get_previous_index() - there was no previous index available, reusing '.$index, 0);
2163 2163
             }
2164 2164
             // There is no previous item.
2165 2165
         }
@@ -2202,8 +2202,8 @@  discard block
 block discarded – undo
2202 2202
     {
2203 2203
         $course_id = api_get_course_int_id();
2204 2204
         $_course = api_get_course_info();
2205
-        $tbl_lp_item 		= Database :: get_course_table(TABLE_LP_ITEM);
2206
-        $tbl_lp_item_view 	= Database :: get_course_table(TABLE_LP_ITEM_VIEW);
2205
+        $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
2206
+        $tbl_lp_item_view = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
2207 2207
 
2208 2208
         // Getting all the information about the item.
2209 2209
         $sql = "SELECT * FROM ".$tbl_lp_item." as lp
@@ -2214,7 +2214,7 @@  discard block
 block discarded – undo
2214 2214
                     lp.c_id = $course_id AND
2215 2215
                     lp_view.c_id = $course_id";
2216 2216
         $result = Database::query($sql);
2217
-        $row 	= Database::fetch_assoc($result);
2217
+        $row = Database::fetch_assoc($result);
2218 2218
         $output = '';
2219 2219
 
2220 2220
         if (!empty ($row['audio'])) {
@@ -2222,8 +2222,8 @@  discard block
 block discarded – undo
2222 2222
             $list = $_SESSION['oLP']->get_toc();
2223 2223
             $type_quiz = false;
2224 2224
 
2225
-            foreach($list as $toc) {
2226
-                if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type']=='quiz') ) {
2225
+            foreach ($list as $toc) {
2226
+                if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type'] == 'quiz')) {
2227 2227
                     $type_quiz = true;
2228 2228
                 }
2229 2229
             }
@@ -2286,7 +2286,7 @@  discard block
 block discarded – undo
2286 2286
         $courseCode = null,
2287 2287
         $sessionId = null
2288 2288
     ) {
2289
-        $lp_id = (int)$lp_id;
2289
+        $lp_id = (int) $lp_id;
2290 2290
         $courseInfo = api_get_course_info($courseCode);
2291 2291
         $sessionId = intval($sessionId);
2292 2292
 
@@ -2452,10 +2452,10 @@  discard block
 block discarded – undo
2452 2452
      */
2453 2453
     public static function get_progress_bar($percentage = -1, $text_add = '')
2454 2454
     {
2455
-        $text = $percentage . $text_add;
2455
+        $text = $percentage.$text_add;
2456 2456
         $output = '<div class="progress">
2457
-                        <div id="progress_bar_value" class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="' .$percentage. '" aria-valuemin="0" aria-valuemax="100" style="width: '.$text.';">
2458
-                        '. $text .'
2457
+                        <div id="progress_bar_value" class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="' .$percentage.'" aria-valuemin="0" aria-valuemax="100" style="width: '.$text.';">
2458
+                        '. $text.'
2459 2459
                         </div>
2460 2460
                     </div>';
2461 2461
 
@@ -2491,16 +2491,16 @@  discard block
 block discarded – undo
2491 2491
         }
2492 2492
         $total_items = $this->get_total_items_count_without_chapters();
2493 2493
         if ($this->debug > 2) {
2494
-            error_log('New LP - Total items available in this learnpath: ' . $total_items, 0);
2494
+            error_log('New LP - Total items available in this learnpath: '.$total_items, 0);
2495 2495
         }
2496 2496
         $completeItems = $this->get_complete_items_count();
2497 2497
         if ($this->debug > 2) {
2498
-            error_log('New LP - Items completed so far: ' . $completeItems, 0);
2498
+            error_log('New LP - Items completed so far: '.$completeItems, 0);
2499 2499
         }
2500 2500
         if ($add != 0) {
2501 2501
             $completeItems += $add;
2502 2502
             if ($this->debug > 2) {
2503
-                error_log('New LP - Items completed so far (+modifier): ' . $completeItems, 0);
2503
+                error_log('New LP - Items completed so far (+modifier): '.$completeItems, 0);
2504 2504
             }
2505 2505
         }
2506 2506
         $text = '';
@@ -2518,7 +2518,7 @@  discard block
 block discarded – undo
2518 2518
             $text = '%';
2519 2519
         } elseif ($mode == 'abs') {
2520 2520
             $percentage = $completeItems;
2521
-            $text = '/' . $total_items;
2521
+            $text = '/'.$total_items;
2522 2522
         }
2523 2523
 
2524 2524
         return array(
@@ -2714,7 +2714,7 @@  discard block
 block discarded – undo
2714 2714
                 // and replace them, one by one, by the internal IDs (chamilo db)
2715 2715
                 // TODO: Modify the '*' replacement to replace the multiplier in front of it
2716 2716
                 // by a space as well.
2717
-                $find = array (
2717
+                $find = array(
2718 2718
                     '&',
2719 2719
                     '|',
2720 2720
                     '~',
@@ -2726,7 +2726,7 @@  discard block
 block discarded – undo
2726 2726
                     '(',
2727 2727
                     ')'
2728 2728
                 );
2729
-                $replace = array (
2729
+                $replace = array(
2730 2730
                     ' ',
2731 2731
                     ' ',
2732 2732
                     ' ',
@@ -2743,7 +2743,7 @@  discard block
 block discarded – undo
2743 2743
                 foreach ($ids as $id) {
2744 2744
                     $id = trim($id);
2745 2745
                     if (isset ($this->refs_list[$id])) {
2746
-                        $prereq = preg_replace('/[^a-zA-Z_0-9](' . $id . ')[^a-zA-Z_0-9]/', 'ITEM_' . $this->refs_list[$id], $prereq);
2746
+                        $prereq = preg_replace('/[^a-zA-Z_0-9]('.$id.')[^a-zA-Z_0-9]/', 'ITEM_'.$this->refs_list[$id], $prereq);
2747 2747
                     }
2748 2748
                 }
2749 2749
 
@@ -2851,9 +2851,9 @@  discard block
 block discarded – undo
2851 2851
         if ($this->debug > 0) {
2852 2852
             error_log('New LP - In learnpath::get_items_status_list()', 0);
2853 2853
         }
2854
-        $list = array ();
2854
+        $list = array();
2855 2855
         foreach ($this->ordered_items as $item_id) {
2856
-            $list[] = array (
2856
+            $list[] = array(
2857 2857
                 $item_id => $this->items[$item_id]->get_status()
2858 2858
             );
2859 2859
         }
@@ -2907,7 +2907,7 @@  discard block
 block discarded – undo
2907 2907
         $res = Database::query($sql);
2908 2908
         $num = Database :: num_rows($res);
2909 2909
         if ($num > 0) {
2910
-            $list[] = array (
2910
+            $list[] = array(
2911 2911
                 'order_id' => api_htmlentities(get_lang('Order'), ENT_QUOTES),
2912 2912
                 'id' => api_htmlentities(get_lang('InteractionID'), ENT_QUOTES),
2913 2913
                 'type' => api_htmlentities(get_lang('Type'), ENT_QUOTES),
@@ -2918,7 +2918,7 @@  discard block
 block discarded – undo
2918 2918
                 'latency' => api_htmlentities(get_lang('LatencyTimeSpent'), ENT_QUOTES)
2919 2919
             );
2920 2920
             while ($row = Database :: fetch_array($res)) {
2921
-                $list[] = array (
2921
+                $list[] = array(
2922 2922
                     'order_id' => ($row['order_id'] + 1),
2923 2923
                     'id' => urldecode($row['interaction_id']), //urldecode because they often have %2F or stuff like that
2924 2924
                     'type' => $row['interaction_type'],
@@ -2986,7 +2986,7 @@  discard block
 block discarded – undo
2986 2986
                 'status' => api_htmlentities(get_lang('ObjectiveStatus'), ENT_QUOTES)
2987 2987
             );
2988 2988
             while ($row = Database :: fetch_array($res)) {
2989
-                $list[] = array (
2989
+                $list[] = array(
2990 2990
                     'order_id' => ($row['order_id'] + 1),
2991 2991
                     'objective_id' => urldecode($row['objective_id']), // urldecode() because they often have %2F or stuff like that.
2992 2992
                     'score_raw' => $row['score_raw'],
@@ -3013,10 +3013,10 @@  discard block
 block discarded – undo
3013 3013
         $toc = array();
3014 3014
         foreach ($this->ordered_items as $item_id) {
3015 3015
             if ($this->debug > 2) {
3016
-                error_log('learnpath::get_toc(): getting info for item ' . $item_id, 0);
3016
+                error_log('learnpath::get_toc(): getting info for item '.$item_id, 0);
3017 3017
             }
3018 3018
             // TODO: Change this link generation and use new function instead.
3019
-            $toc[] = array (
3019
+            $toc[] = array(
3020 3020
                 'id'            => $item_id,
3021 3021
                 'title'         => $this->items[$item_id]->get_title(),
3022 3022
                 'status'        => $this->items[$item_id]->get_status(),
@@ -3027,7 +3027,7 @@  discard block
 block discarded – undo
3027 3027
             );
3028 3028
         }
3029 3029
         if ($this->debug > 2) {
3030
-            error_log('New LP - In learnpath::get_toc() - TOC array: ' . print_r($toc, true), 0);
3030
+            error_log('New LP - In learnpath::get_toc() - TOC array: '.print_r($toc, true), 0);
3031 3031
         }
3032 3032
         return $toc;
3033 3033
     }
@@ -3044,10 +3044,10 @@  discard block
 block discarded – undo
3044 3044
         }
3045 3045
         $toc = $varname.' = new Array();';
3046 3046
         foreach ($this->ordered_items as $item_id) {
3047
-            $toc.= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
3047
+            $toc .= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
3048 3048
         }
3049 3049
         if ($this->debug > 2) {
3050
-            error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: ' . print_r($toc, true), 0);
3050
+            error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: '.print_r($toc, true), 0);
3051 3051
         }
3052 3052
         return $toc;
3053 3053
     }
@@ -3071,7 +3071,7 @@  discard block
 block discarded – undo
3071 3071
             }
3072 3072
         }
3073 3073
         if ($this->debug > 2) {
3074
-            error_log('New LP - In learnpath::get_type() - Returning ' . ($res ? $res : 'false'), 0);
3074
+            error_log('New LP - In learnpath::get_type() - Returning '.($res ? $res : 'false'), 0);
3075 3075
         }
3076 3076
         return $res;
3077 3077
     }
@@ -3087,7 +3087,7 @@  discard block
 block discarded – undo
3087 3087
         $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
3088 3088
         $lp_id = intval($lp_id);
3089 3089
         $sql = "SELECT lp_type FROM $tbl_lp
3090
-                WHERE c_id = $course_id AND id = '" . $lp_id . "'";
3090
+                WHERE c_id = $course_id AND id = '".$lp_id."'";
3091 3091
         $res = Database::query($sql);
3092 3092
         if ($res === false) {
3093 3093
             return null;
@@ -3200,7 +3200,7 @@  discard block
 block discarded – undo
3200 3200
             $dirTypes = self::getChapterTypes();
3201 3201
 
3202 3202
             if (in_array($item['type'], $dirTypes)) {
3203
-                $scorm_color_background ='scorm_item_section ';
3203
+                $scorm_color_background = 'scorm_item_section ';
3204 3204
                 $style_item = '';
3205 3205
             }
3206 3206
             if ($item['id'] == $this->current) {
@@ -3209,7 +3209,7 @@  discard block
 block discarded – undo
3209 3209
                 $scorm_color_background = 'scorm_item_normal '.$scorm_color_background.' ';
3210 3210
             }
3211 3211
 
3212
-            $html .= '<div id="toc_' . $item['id'] . '" class="' . $scorm_color_background . ' '.$class_name[$item['status']].' ">';
3212
+            $html .= '<div id="toc_'.$item['id'].'" class="'.$scorm_color_background.' '.$class_name[$item['status']].' ">';
3213 3213
 
3214 3214
             // Learning path title
3215 3215
             $title = $item['title'];
@@ -3239,7 +3239,7 @@  discard block
 block discarded – undo
3239 3239
                 $html .= stripslashes($title);
3240 3240
             } else {
3241 3241
                 $this->get_link('http', $item['id'], $toc_list);
3242
-                $html .= '<a class="items-list" href="#" onclick="switch_item(' .$mycurrentitemid . ',' .$item['id'] . ');' .'return false;" >' . stripslashes($title) . '</a>';
3242
+                $html .= '<a class="items-list" href="#" onclick="switch_item('.$mycurrentitemid.','.$item['id'].');'.'return false;" >'.stripslashes($title).'</a>';
3243 3243
             }
3244 3244
             $html .= "</div>";
3245 3245
 
@@ -3273,12 +3273,12 @@  discard block
 block discarded – undo
3273 3273
             if ($this->get_lp_session_id() == api_get_session_id()) {
3274 3274
                 $html .= '<div id="actions_lp" class="actions_lp"><hr>';
3275 3275
                 $html .= '<div class="btn-group">';
3276
-                $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?" . api_get_cidreq()."&gradebook=$gradebook&action=build&lp_id=" . $this->lp_id . "&isStudentView=false' target='_parent'>" .
3277
-                    Display::returnFontAwesomeIcon('street-view') . get_lang('Overview') . "</a>";
3278
-                $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?" . api_get_cidreq()."&action=add_item&type=step&lp_id=" . $this->lp_id . "&isStudentView=false' target='_parent'>" .
3279
-                    Display::returnFontAwesomeIcon('pencil') . get_lang('Edit') . "</a>";
3280
-                $html .= '<a class="btn btn-sm btn-default" href="lp_controller.php?'.api_get_cidreq()."&gradebook=$gradebook&action=edit&lp_id=" . $this->lp_id.'&isStudentView=false">' .
3281
-                    Display::returnFontAwesomeIcon('cog') . get_lang('Settings').'</a>';
3276
+                $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?".api_get_cidreq()."&gradebook=$gradebook&action=build&lp_id=".$this->lp_id."&isStudentView=false' target='_parent'>".
3277
+                    Display::returnFontAwesomeIcon('street-view').get_lang('Overview')."</a>";
3278
+                $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?".api_get_cidreq()."&action=add_item&type=step&lp_id=".$this->lp_id."&isStudentView=false' target='_parent'>".
3279
+                    Display::returnFontAwesomeIcon('pencil').get_lang('Edit')."</a>";
3280
+                $html .= '<a class="btn btn-sm btn-default" href="lp_controller.php?'.api_get_cidreq()."&gradebook=$gradebook&action=edit&lp_id=".$this->lp_id.'&isStudentView=false">'.
3281
+                    Display::returnFontAwesomeIcon('cog').get_lang('Settings').'</a>';
3282 3282
                 $html .= '</div>';
3283 3283
                 $html .= '</div>';
3284 3284
             }
@@ -3329,11 +3329,11 @@  discard block
 block discarded – undo
3329 3329
         $course_id = $this->get_course_int_id();
3330 3330
 
3331 3331
         if ($this->debug > 0) {
3332
-            error_log('New LP - In learnpath::get_link(' . $type . ',' . $item_id . ')', 0);
3332
+            error_log('New LP - In learnpath::get_link('.$type.','.$item_id.')', 0);
3333 3333
         }
3334 3334
         if (empty($item_id)) {
3335 3335
             if ($this->debug > 2) {
3336
-                error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: ' . $this->get_current_item_id(), 0);
3336
+                error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: '.$this->get_current_item_id(), 0);
3337 3337
             }
3338 3338
             $item_id = $this->get_current_item_id();
3339 3339
         }
@@ -3365,7 +3365,7 @@  discard block
 block discarded – undo
3365 3365
                     ON (li.lp_id = l.id AND l.c_id = $course_id AND li.c_id = $course_id )
3366 3366
         		WHERE li.id = $item_id ";
3367 3367
         if ($this->debug > 2) {
3368
-            error_log('New LP - In learnpath::get_link() - selecting item ' . $sql, 0);
3368
+            error_log('New LP - In learnpath::get_link() - selecting item '.$sql, 0);
3369 3369
         }
3370 3370
         $res = Database::query($sql);
3371 3371
         if (Database :: num_rows($res) > 0) {
@@ -3379,9 +3379,9 @@  discard block
 block discarded – undo
3379 3379
             if (empty($lp_item_params) && strpos($lp_item_path, '?') !== false) {
3380 3380
                 list($lp_item_path, $lp_item_params) = explode('?', $lp_item_path);
3381 3381
             }
3382
-            $sys_course_path = api_get_path(SYS_COURSE_PATH) . api_get_course_path();
3382
+            $sys_course_path = api_get_path(SYS_COURSE_PATH).api_get_course_path();
3383 3383
             if ($type == 'http') {
3384
-                $course_path = api_get_path(WEB_COURSE_PATH) . api_get_course_path(); //web path
3384
+                $course_path = api_get_path(WEB_COURSE_PATH).api_get_course_path(); //web path
3385 3385
             } else {
3386 3386
                 $course_path = $sys_course_path; //system path
3387 3387
             }
@@ -3392,8 +3392,8 @@  discard block
 block discarded – undo
3392 3392
             }
3393 3393
 
3394 3394
             if ($this->debug > 2) {
3395
-                error_log('New LP - In learnpath::get_link() - $lp_type ' . $lp_type, 0);
3396
-                error_log('New LP - In learnpath::get_link() - $lp_item_type ' . $lp_item_type, 0);
3395
+                error_log('New LP - In learnpath::get_link() - $lp_type '.$lp_type, 0);
3396
+                error_log('New LP - In learnpath::get_link() - $lp_item_type '.$lp_item_type, 0);
3397 3397
             }
3398 3398
 
3399 3399
             // Now go through the specific cases to get the end of the path
@@ -3412,7 +3412,7 @@  discard block
 block discarded – undo
3412 3412
                         );
3413 3413
 
3414 3414
                         if ($this->debug > 0) {
3415
-                            error_log('rl_get_resource_link_for_learnpath - file: ' . $file, 0);
3415
+                            error_log('rl_get_resource_link_for_learnpath - file: '.$file, 0);
3416 3416
                         }
3417 3417
 
3418 3418
                         if ($lp_item_type == 'link') {
@@ -3432,7 +3432,7 @@  discard block
 block discarded – undo
3432 3432
                                     $linkProtocol = substr($file, 0, 5);
3433 3433
                                     if ($linkProtocol === 'http:') {
3434 3434
                                         //this is the special intervention case
3435
-                                        $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=nonhttps&source=' .  urlencode($file);
3435
+                                        $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=nonhttps&source='.urlencode($file);
3436 3436
                                     }
3437 3437
                                 }
3438 3438
                             }
@@ -3472,8 +3472,8 @@  discard block
 block discarded – undo
3472 3472
                                 $sql = "SELECT count(*) FROM $lp_item_view_table
3473 3473
                                         WHERE
3474 3474
                                             c_id = $course_id AND
3475
-                                            lp_item_id='" . $lp_item_id . "' AND
3476
-                                            lp_view_id ='" . $lp_view_id . "' AND
3475
+                                            lp_item_id='".$lp_item_id."' AND
3476
+                                            lp_view_id ='" . $lp_view_id."' AND
3477 3477
                                             status='completed'";
3478 3478
                                 $result = Database::query($sql);
3479 3479
                                 $row_count = Database :: fetch_row($result);
@@ -3482,7 +3482,7 @@  discard block
 block discarded – undo
3482 3482
                                 if ($prevent_reinit === 1 && $count_item_view > 0) {
3483 3483
                                     $not_multiple_attempt = 1;
3484 3484
                                 }
3485
-                                $file .= '&not_multiple_attempt=' . $not_multiple_attempt;
3485
+                                $file .= '&not_multiple_attempt='.$not_multiple_attempt;
3486 3486
                             }
3487 3487
 
3488 3488
                             $tmp_array = explode('/', $file);
@@ -3495,7 +3495,7 @@  discard block
 block discarded – undo
3495 3495
                     break;
3496 3496
                 case 2 :
3497 3497
                     if ($this->debug > 2) {
3498
-                        error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0);
3498
+                        error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0);
3499 3499
                     }
3500 3500
 
3501 3501
                     if ($lp_item_type != 'dir') {
@@ -3509,19 +3509,19 @@  discard block
 block discarded – undo
3509 3509
                         //if ($this->prerequisites_match($item_id)) {
3510 3510
                         if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) {
3511 3511
                             if ($this->debug > 2) {
3512
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0);
3512
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0);
3513 3513
                             }
3514 3514
                             // Distant url, return as is.
3515 3515
                             $file = $lp_item_path;
3516 3516
                         } else {
3517 3517
                             if ($this->debug > 2) {
3518
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0);
3518
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0);
3519 3519
                             }
3520 3520
                             // Prevent getting untranslatable urls.
3521 3521
                             $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path);
3522 3522
                             $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path);
3523 3523
                             // Prepare the path.
3524
-                            $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path;
3524
+                            $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path;
3525 3525
                             // TODO: Fix this for urls with protocol header.
3526 3526
                             $file = str_replace('//', '/', $file);
3527 3527
                             $file = str_replace(':/', '://', $file);
@@ -3529,11 +3529,11 @@  discard block
 block discarded – undo
3529 3529
                                 $lp_path = substr($lp_path, 0, -1);
3530 3530
                             }
3531 3531
 
3532
-                            if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $lp_item_path))) {
3532
+                            if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$lp_item_path))) {
3533 3533
                                 // if file not found.
3534 3534
                                 $decoded = html_entity_decode($lp_item_path);
3535 3535
                                 list ($decoded) = explode('?', $decoded);
3536
-                                if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $decoded))) {
3536
+                                if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$decoded))) {
3537 3537
                                     require_once 'resourcelinker.inc.php';
3538 3538
                                     $file = rl_get_resource_link_for_learnpath(
3539 3539
                                         $course_id,
@@ -3553,14 +3553,14 @@  discard block
 block discarded – undo
3553 3553
                                         }
3554 3554
                                     }
3555 3555
                                 } else {
3556
-                                    $file = $course_path . '/scorm/' . $lp_path . '/' . $decoded;
3556
+                                    $file = $course_path.'/scorm/'.$lp_path.'/'.$decoded;
3557 3557
                                 }
3558 3558
                             }
3559 3559
                         }
3560 3560
 
3561 3561
                         // We want to use parameters if they were defined in the imsmanifest
3562 3562
                         if (strpos($file, 'blank.php') === false) {
3563
-                            $file .= (strstr($file, '?') === false ? '?' : '') . $lp_item_params;
3563
+                            $file .= (strstr($file, '?') === false ? '?' : '').$lp_item_params;
3564 3564
                         }
3565 3565
                     } else {
3566 3566
                         $file = 'lp_content.php?type=dir';
@@ -3568,12 +3568,12 @@  discard block
 block discarded – undo
3568 3568
                     break;
3569 3569
                 case 3 :
3570 3570
                     if ($this->debug > 2) {
3571
-                        error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0);
3571
+                        error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0);
3572 3572
                     }
3573 3573
                     // Formatting AICC HACP append URL.
3574
-                    $aicc_append = '?aicc_sid=' . urlencode(session_id()) . '&aicc_url=' . urlencode(api_get_path(WEB_CODE_PATH) . 'newscorm/aicc_hacp.php') . '&';
3574
+                    $aicc_append = '?aicc_sid='.urlencode(session_id()).'&aicc_url='.urlencode(api_get_path(WEB_CODE_PATH).'newscorm/aicc_hacp.php').'&';
3575 3575
                     if (!empty($lp_item_params)) {
3576
-                        $aicc_append .= $lp_item_params . '&';
3576
+                        $aicc_append .= $lp_item_params.'&';
3577 3577
                     }
3578 3578
                     if ($lp_item_type != 'dir') {
3579 3579
                         // Quite complex here:
@@ -3585,7 +3585,7 @@  discard block
 block discarded – undo
3585 3585
 
3586 3586
                         if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) {
3587 3587
                             if ($this->debug > 2) {
3588
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0);
3588
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0);
3589 3589
                             }
3590 3590
                             // Distant url, return as is.
3591 3591
                             $file = $lp_item_path;
@@ -3598,19 +3598,19 @@  discard block
 block discarded – undo
3598 3598
                             if (stripos($file, '<servername>') !== false) {
3599 3599
                                 //$file = str_replace('<servername>',$course_path.'/scorm/'.$lp_path.'/',$lp_item_path);
3600 3600
                                 $web_course_path = str_replace('https://', '', str_replace('http://', '', $course_path));
3601
-                                $file = str_replace('<servername>', $web_course_path . '/scorm/' . $lp_path, $lp_item_path);
3601
+                                $file = str_replace('<servername>', $web_course_path.'/scorm/'.$lp_path, $lp_item_path);
3602 3602
                             }
3603 3603
                             //
3604 3604
                             $file .= $aicc_append;
3605 3605
                         } else {
3606 3606
                             if ($this->debug > 2) {
3607
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0);
3607
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0);
3608 3608
                             }
3609 3609
                             // Prevent getting untranslatable urls.
3610 3610
                             $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path);
3611 3611
                             $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path);
3612 3612
                             // Prepare the path - lp_path might be unusable because it includes the "aicc" subdir name.
3613
-                            $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path;
3613
+                            $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path;
3614 3614
                             // TODO: Fix this for urls with protocol header.
3615 3615
                             $file = str_replace('//', '/', $file);
3616 3616
                             $file = str_replace(':/', '://', $file);
@@ -3629,7 +3629,7 @@  discard block
 block discarded – undo
3629 3629
             $file = !empty($file) ? str_replace('&amp;', '&', $file) : '';
3630 3630
         }
3631 3631
         if ($this->debug > 2) {
3632
-            error_log('New LP - In learnpath::get_link() - returning "' . $file . '" from get_link', 0);
3632
+            error_log('New LP - In learnpath::get_link() - returning "'.$file.'" from get_link', 0);
3633 3633
         }
3634 3634
         return $file;
3635 3635
     }
@@ -3647,7 +3647,7 @@  discard block
 block discarded – undo
3647 3647
         $search = '';
3648 3648
         // Use $attempt_num to enable multi-views management (disabled so far).
3649 3649
         if ($attempt_num != 0 AND intval(strval($attempt_num)) == $attempt_num) {
3650
-            $search = 'AND view_count = ' . $attempt_num;
3650
+            $search = 'AND view_count = '.$attempt_num;
3651 3651
         }
3652 3652
         // When missing $attempt_num, search for a unique lp_view record for this lp and user.
3653 3653
         $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW);
@@ -3657,9 +3657,9 @@  discard block
 block discarded – undo
3657 3657
 
3658 3658
         $sql = "SELECT id, view_count FROM $lp_view_table
3659 3659
         		WHERE
3660
-        		    c_id = " . $course_id . " AND
3661
-        		    lp_id = " . $this->get_id() . " AND
3662
-        		    user_id = " . $this->get_user_id() . " AND
3660
+        		    c_id = ".$course_id." AND
3661
+        		    lp_id = " . $this->get_id()." AND
3662
+        		    user_id = " . $this->get_user_id()." AND
3663 3663
         		    session_id = $sessionId
3664 3664
         		    $search
3665 3665
                 ORDER BY view_count DESC";
@@ -3670,7 +3670,7 @@  discard block
 block discarded – undo
3670 3670
         } else if (!api_is_invitee()) {
3671 3671
             // There is no database record, create one.
3672 3672
             $sql = "INSERT INTO $lp_view_table (c_id, lp_id,user_id, view_count, session_id) VALUES
3673
-            		($course_id, " . $this->get_id() . "," . $this->get_user_id() . ", 1, $sessionId)";
3673
+            		($course_id, ".$this->get_id().",".$this->get_user_id().", 1, $sessionId)";
3674 3674
             Database::query($sql);
3675 3675
             $id = Database :: insert_id();
3676 3676
             $this->lp_view_id = $id;
@@ -3770,15 +3770,15 @@  discard block
 block discarded – undo
3770 3770
     {
3771 3771
         $course_id = api_get_course_int_id();
3772 3772
         if ($this->debug > 0) {
3773
-            error_log('New LP - In learnpath::move_item(' . $id . ',' . $direction . ')', 0);
3773
+            error_log('New LP - In learnpath::move_item('.$id.','.$direction.')', 0);
3774 3774
         }
3775 3775
         if (empty($id) || empty($direction)) {
3776 3776
             return false;
3777 3777
         }
3778 3778
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
3779 3779
         $sql_sel = "SELECT *
3780
-                    FROM " . $tbl_lp_item . "
3781
-                    WHERE c_id = ".$course_id." AND id = " . $id;
3780
+                    FROM " . $tbl_lp_item."
3781
+                    WHERE c_id = ".$course_id." AND id = ".$id;
3782 3782
         $res_sel = Database::query($sql_sel);
3783 3783
         // Check if elem exists.
3784 3784
         if (Database :: num_rows($res_sel) < 1) {
@@ -3803,7 +3803,7 @@  discard block
 block discarded – undo
3803 3803
                                  WHERE c_id = ".$course_id." AND id = $previous";
3804 3804
 
3805 3805
                     if ($this->debug > 2) {
3806
-                        error_log('Selecting previous: ' . $sql_sel2, 0);
3806
+                        error_log('Selecting previous: '.$sql_sel2, 0);
3807 3807
                     }
3808 3808
                     $res_sel2 = Database::query($sql_sel2);
3809 3809
                     if (Database :: num_rows($res_sel2) < 1) {
@@ -3856,7 +3856,7 @@  discard block
 block discarded – undo
3856 3856
                         }
3857 3857
                         Database::query($sql_upd2);
3858 3858
                     }
3859
-                    $display = $display -1;
3859
+                    $display = $display - 1;
3860 3860
                 }
3861 3861
                 break;
3862 3862
             case 'down':
@@ -3867,7 +3867,7 @@  discard block
 block discarded – undo
3867 3867
                 } else {
3868 3868
                     $sql_sel2 = "SELECT * FROM $tbl_lp_item WHERE c_id = ".$course_id." AND id = $next";
3869 3869
                     if ($this->debug > 2) {
3870
-                        error_log('Selecting next: ' . $sql_sel2, 0);
3870
+                        error_log('Selecting next: '.$sql_sel2, 0);
3871 3871
                     }
3872 3872
                     $res_sel2 = Database::query($sql_sel2);
3873 3873
                     if (Database :: num_rows($res_sel2) < 1) {
@@ -3905,7 +3905,7 @@  discard block
 block discarded – undo
3905 3905
                                      WHERE c_id = ".$course_id." AND id = $next_next";
3906 3906
                         Database::query($sql_upd2);
3907 3907
                     }
3908
-                    $display = $display +1;
3908
+                    $display = $display + 1;
3909 3909
                 }
3910 3910
                 break;
3911 3911
             default :
@@ -3928,8 +3928,8 @@  discard block
 block discarded – undo
3928 3928
         $res = Database::query($sql);
3929 3929
         if ($res === false)
3930 3930
             return false;
3931
-        $lps = array ();
3932
-        $lp_order = array ();
3931
+        $lps = array();
3932
+        $lp_order = array();
3933 3933
         $num = Database :: num_rows($res);
3934 3934
         // First check the order is correct, globally (might be wrong because
3935 3935
         // of versions < 1.8.4)
@@ -3939,7 +3939,7 @@  discard block
 block discarded – undo
3939 3939
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
3940 3940
                     $need_fix = true;
3941 3941
                     $sql_u = "UPDATE $lp_table SET display_order = $i
3942
-                              WHERE c_id = ".$course_id." AND id = " . $row['id'];
3942
+                              WHERE c_id = ".$course_id." AND id = ".$row['id'];
3943 3943
                     Database::query($sql_u);
3944 3944
                 }
3945 3945
                 $row['display_order'] = $i;
@@ -3952,10 +3952,10 @@  discard block
 block discarded – undo
3952 3952
             $order = $lps[$lp_id]['display_order'];
3953 3953
             if ($order > 1) { // If it's the first element, no need to move up.
3954 3954
                 $sql_u1 = "UPDATE $lp_table SET display_order = $order
3955
-                           WHERE c_id = ".$course_id." AND id = " . $lp_order[$order - 1];
3955
+                           WHERE c_id = ".$course_id." AND id = ".$lp_order[$order - 1];
3956 3956
                 Database::query($sql_u1);
3957
-                $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order - 1) . "
3958
-                           WHERE c_id = ".$course_id." AND id = " . $lp_id;
3957
+                $sql_u2 = "UPDATE $lp_table SET display_order = ".($order - 1)."
3958
+                           WHERE c_id = ".$course_id." AND id = ".$lp_id;
3959 3959
                 Database::query($sql_u2);
3960 3960
             }
3961 3961
         }
@@ -3976,8 +3976,8 @@  discard block
 block discarded – undo
3976 3976
         if ($res === false) {
3977 3977
             return false;
3978 3978
         }
3979
-        $lps = array ();
3980
-        $lp_order = array ();
3979
+        $lps = array();
3980
+        $lp_order = array();
3981 3981
         $num = Database :: num_rows($res);
3982 3982
         $max = 0;
3983 3983
         // First check the order is correct, globally (might be wrong because
@@ -3989,7 +3989,7 @@  discard block
 block discarded – undo
3989 3989
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
3990 3990
                     $need_fix = true;
3991 3991
                     $sql_u = "UPDATE $lp_table SET display_order = $i
3992
-                              WHERE c_id = ".$course_id." AND id = " . $row['id'];
3992
+                              WHERE c_id = ".$course_id." AND id = ".$row['id'];
3993 3993
                     Database::query($sql_u);
3994 3994
                 }
3995 3995
                 $row['display_order'] = $i;
@@ -4002,10 +4002,10 @@  discard block
 block discarded – undo
4002 4002
             $order = $lps[$lp_id]['display_order'];
4003 4003
             if ($order < $max) { // If it's the first element, no need to move up.
4004 4004
                 $sql_u1 = "UPDATE $lp_table SET display_order = $order
4005
-                           WHERE c_id = ".$course_id." AND id = " . $lp_order[$order + 1];
4005
+                           WHERE c_id = ".$course_id." AND id = ".$lp_order[$order + 1];
4006 4006
                 Database::query($sql_u1);
4007
-                $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order + 1) . "
4008
-                           WHERE c_id = ".$course_id." AND id = " . $lp_id;
4007
+                $sql_u2 = "UPDATE $lp_table SET display_order = ".($order + 1)."
4008
+                           WHERE c_id = ".$course_id." AND id = ".$lp_id;
4009 4009
                 Database::query($sql_u2);
4010 4010
             }
4011 4011
         }
@@ -4025,15 +4025,15 @@  discard block
 block discarded – undo
4025 4025
         $this->autocomplete_parents($this->last);
4026 4026
         $new_index = $this->get_next_index();
4027 4027
         if ($this->debug > 2) {
4028
-            error_log('New LP - New index: ' . $new_index, 0);
4028
+            error_log('New LP - New index: '.$new_index, 0);
4029 4029
         }
4030 4030
         $this->index = $new_index;
4031 4031
         if ($this->debug > 2) {
4032
-            error_log('New LP - Now having orderedlist[' . $new_index . '] = ' . $this->ordered_items[$new_index], 0);
4032
+            error_log('New LP - Now having orderedlist['.$new_index.'] = '.$this->ordered_items[$new_index], 0);
4033 4033
         }
4034 4034
         $this->current = $this->ordered_items[$new_index];
4035 4035
         if ($this->debug > 2) {
4036
-            error_log('New LP - new item id is ' . $this->current . '-' . $this->get_current_item_id(), 0);
4036
+            error_log('New LP - new item id is '.$this->current.'-'.$this->get_current_item_id(), 0);
4037 4037
         }
4038 4038
     }
4039 4039
 
@@ -4097,7 +4097,7 @@  discard block
 block discarded – undo
4097 4097
             // Clean spaces.
4098 4098
             $prereq_string = str_replace(' ', '', $prereq_string);
4099 4099
             if ($debug > 0) {
4100
-                error_log('Found prereq_string: ' . $prereq_string, 0);
4100
+                error_log('Found prereq_string: '.$prereq_string, 0);
4101 4101
             }
4102 4102
             // Now send to the parse_prereq() function that will check this component's prerequisites.
4103 4103
             $result = $currentItem->parse_prereq(
@@ -4113,12 +4113,12 @@  discard block
 block discarded – undo
4113 4113
         } else {
4114 4114
             $result = true;
4115 4115
             if ($debug > 1) {
4116
-                error_log('$this->items[' . $itemId . '] was not an object', 0);
4116
+                error_log('$this->items['.$itemId.'] was not an object', 0);
4117 4117
             }
4118 4118
         }
4119 4119
 
4120 4120
         if ($debug > 1) {
4121
-            error_log('End of prerequisites_match(). Error message is now ' . $this->error, 0);
4121
+            error_log('End of prerequisites_match(). Error message is now '.$this->error, 0);
4122 4122
         }
4123 4123
         return $result;
4124 4124
     }
@@ -4184,12 +4184,12 @@  discard block
 block discarded – undo
4184 4184
             $row = Database :: fetch_array($result);
4185 4185
             $name = domesticate($row['name']);
4186 4186
             if ($set_visibility == 'i') {
4187
-                $s = $name . " " . get_lang('LearnpathNotPublished');
4187
+                $s = $name." ".get_lang('LearnpathNotPublished');
4188 4188
                 $dialogBox = $s;
4189 4189
                 $v = 0;
4190 4190
             }
4191 4191
             if ($set_visibility == 'v') {
4192
-                $s = $name . " " . get_lang('LearnpathPublished');
4192
+                $s = $name." ".get_lang('LearnpathPublished');
4193 4193
                 $dialogBox = $s;
4194 4194
                 $v = 1;
4195 4195
             }
@@ -4272,9 +4272,9 @@  discard block
 block discarded – undo
4272 4272
         $course_id = api_get_course_int_id();
4273 4273
         $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW);
4274 4274
         $sql = "INSERT INTO $lp_view_table (c_id, lp_id, user_id, view_count, session_id)
4275
-                VALUES ($course_id, " . $this->lp_id . "," . $this->get_user_id() . "," . ($this->attempt + 1) . ", $session_id)";
4275
+                VALUES ($course_id, ".$this->lp_id.",".$this->get_user_id().",".($this->attempt + 1).", $session_id)";
4276 4276
         if ($this->debug > 2) {
4277
-            error_log('New LP - Inserting new lp_view for restart: ' . $sql, 0);
4277
+            error_log('New LP - Inserting new lp_view for restart: '.$sql, 0);
4278 4278
         }
4279 4279
         $res = Database::query($sql);
4280 4280
         $view_id = Database::insert_id();
@@ -4312,10 +4312,10 @@  discard block
 block discarded – undo
4312 4312
         // TODO: Do a better check on the index pointing to the right item (it is supposed to be working
4313 4313
         // on $ordered_items[] but not sure it's always safe to use with $items[]).
4314 4314
         if ($this->debug > 2) {
4315
-            error_log('New LP - save_current() saving item ' . $this->current, 0);
4315
+            error_log('New LP - save_current() saving item '.$this->current, 0);
4316 4316
         }
4317 4317
         if ($this->debug > 2) {
4318
-            error_log('' . print_r($this->items, true), 0);
4318
+            error_log(''.print_r($this->items, true), 0);
4319 4319
         }
4320 4320
         if (isset($this->items[$this->current]) &&
4321 4321
             is_object($this->items[$this->current])
@@ -4339,7 +4339,7 @@  discard block
 block discarded – undo
4339 4339
     {
4340 4340
         $debug = $this->debug;
4341 4341
         if ($debug) {
4342
-            error_log('In learnpath::save_item(' . $item_id . ',' . intval($from_outside). ')', 0);
4342
+            error_log('In learnpath::save_item('.$item_id.','.intval($from_outside).')', 0);
4343 4343
         }
4344 4344
         // TODO: Do a better check on the index pointing to the right item (it is supposed to be working
4345 4345
         // on $ordered_items[] but not sure it's always safe to use with $items[]).
@@ -4362,7 +4362,7 @@  discard block
 block discarded – undo
4362 4362
 
4363 4363
             if ($debug) {
4364 4364
                 error_log('update_queue before:');
4365
-                error_log(print_r($this->update_queue,1));
4365
+                error_log(print_r($this->update_queue, 1));
4366 4366
             }
4367 4367
             $this->autocomplete_parents($item_id);
4368 4368
 
@@ -4370,9 +4370,9 @@  discard block
 block discarded – undo
4370 4370
             $this->update_queue[$item_id] = $status;
4371 4371
 
4372 4372
             if ($debug) {
4373
-                error_log('get_status(): ' . $status);
4373
+                error_log('get_status(): '.$status);
4374 4374
                 error_log('update_queue after:');
4375
-                error_log(print_r($this->update_queue,1));
4375
+                error_log(print_r($this->update_queue, 1));
4376 4376
             }
4377 4377
             return $res;
4378 4378
         }
@@ -4393,17 +4393,17 @@  discard block
 block discarded – undo
4393 4393
 
4394 4394
         if (isset($this->current) && !api_is_invitee()) {
4395 4395
             if ($this->debug > 2) {
4396
-                error_log('New LP - Saving current item (' . $this->current . ') for later review', 0);
4396
+                error_log('New LP - Saving current item ('.$this->current.') for later review', 0);
4397 4397
             }
4398 4398
             $sql = "UPDATE $table SET
4399
-                        last_item = " . intval($this->get_current_item_id()). "
4399
+                        last_item = ".intval($this->get_current_item_id())."
4400 4400
                     WHERE
4401 4401
                         c_id = $course_id AND
4402
-                        lp_id = " . $this->get_id() . " AND
4402
+                        lp_id = ".$this->get_id()." AND
4403 4403
                         user_id = " . $this->get_user_id()." ".$session_condition;
4404 4404
 
4405 4405
             if ($this->debug > 2) {
4406
-                error_log('New LP - Saving last item seen : ' . $sql, 0);
4406
+                error_log('New LP - Saving last item seen : '.$sql, 0);
4407 4407
             }
4408 4408
             Database::query($sql);
4409 4409
         }
@@ -4417,7 +4417,7 @@  discard block
 block discarded – undo
4417 4417
                             progress = $progress
4418 4418
                         WHERE
4419 4419
                             c_id = ".$course_id." AND
4420
-                            lp_id = " . $this->get_id() . " AND
4420
+                            lp_id = " . $this->get_id()." AND
4421 4421
                             user_id = " . $this->get_user_id()." ".$session_condition;
4422 4422
                 // Ignore errors as some tables might not have the progress field just yet.
4423 4423
                 Database::query($sql);
@@ -4433,7 +4433,7 @@  discard block
 block discarded – undo
4433 4433
     public function set_current_item($item_id = null)
4434 4434
     {
4435 4435
         if ($this->debug > 0) {
4436
-            error_log('New LP - In learnpath::set_current_item(' . $item_id . ')', 0);
4436
+            error_log('New LP - In learnpath::set_current_item('.$item_id.')', 0);
4437 4437
         }
4438 4438
         if (empty ($item_id)) {
4439 4439
             if ($this->debug > 2) {
@@ -4442,7 +4442,7 @@  discard block
 block discarded – undo
4442 4442
             // Do nothing.
4443 4443
         } else {
4444 4444
             if ($this->debug > 2) {
4445
-                error_log('New LP - New current item given is ' . $item_id . '...', 0);
4445
+                error_log('New LP - New current item given is '.$item_id.'...', 0);
4446 4446
             }
4447 4447
             if (is_numeric($item_id)) {
4448 4448
                 $item_id = intval($item_id);
@@ -4457,10 +4457,10 @@  discard block
 block discarded – undo
4457 4457
                     }
4458 4458
                 }
4459 4459
                 if ($this->debug > 2) {
4460
-                    error_log('New LP - set_current_item(' . $item_id . ') done. Index is now : ' . $this->index, 0);
4460
+                    error_log('New LP - set_current_item('.$item_id.') done. Index is now : '.$this->index, 0);
4461 4461
                 }
4462 4462
             } else {
4463
-                error_log('New LP - set_current_item(' . $item_id . ') failed. Not a numeric value: ', 0);
4463
+                error_log('New LP - set_current_item('.$item_id.') failed. Not a numeric value: ', 0);
4464 4464
             }
4465 4465
         }
4466 4466
     }
@@ -4485,7 +4485,7 @@  discard block
 block discarded – undo
4485 4485
             $lp = $this->get_id();
4486 4486
             if ($lp != 0) {
4487 4487
                 $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
4488
-                $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' WHERE c_id = ".$course_id." AND id = " . $lp;
4488
+                $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' WHERE c_id = ".$course_id." AND id = ".$lp;
4489 4489
                 $res = Database::query($sql);
4490 4490
                 return $res;
4491 4491
             }
@@ -4509,7 +4509,7 @@  discard block
 block discarded – undo
4509 4509
 
4510 4510
         if ($lp != 0) {
4511 4511
             $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
4512
-            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = " . $lp;
4512
+            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = ".$lp;
4513 4513
             $res = Database::query($sql);
4514 4514
             return $res;
4515 4515
         } else {
@@ -4534,10 +4534,10 @@  discard block
 block discarded – undo
4534 4534
         $course_id = api_get_course_int_id();
4535 4535
         $lp_id = $this->get_id();
4536 4536
         $sql = "UPDATE $lp_table SET
4537
-                content_maker = '" . Database::escape_string($this->maker) . "'
4537
+                content_maker = '".Database::escape_string($this->maker)."'
4538 4538
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4539 4539
         if ($this->debug > 2) {
4540
-            error_log('New LP - lp updated with new content_maker : ' . $this->maker, 0);
4540
+            error_log('New LP - lp updated with new content_maker : '.$this->maker, 0);
4541 4541
         }
4542 4542
         Database::query($sql);
4543 4543
         return true;
@@ -4561,10 +4561,10 @@  discard block
 block discarded – undo
4561 4561
         $lp_id = $this->get_id();
4562 4562
         $course_id = $this->course_info['real_id'];
4563 4563
         $sql = "UPDATE $lp_table SET
4564
-                name = '" . Database::escape_string($this->name). "'
4564
+                name = '".Database::escape_string($this->name)."'
4565 4565
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4566 4566
         if ($this->debug > 2) {
4567
-            error_log('New LP - lp updated with new name : ' . $this->name, 0);
4567
+            error_log('New LP - lp updated with new name : '.$this->name, 0);
4568 4568
         }
4569 4569
         $result = Database::query($sql);
4570 4570
         // If the lp is visible on the homepage, change his name there.
@@ -4572,7 +4572,7 @@  discard block
 block discarded – undo
4572 4572
             $session_id = api_get_session_id();
4573 4573
             $session_condition = api_get_session_condition($session_id);
4574 4574
             $tbl_tool = Database :: get_course_table(TABLE_TOOL_LIST);
4575
-            $link = 'newscorm/lp_controller.php?action=view&lp_id=' . $lp_id.'&id_session='.$session_id;
4575
+            $link = 'newscorm/lp_controller.php?action=view&lp_id='.$lp_id.'&id_session='.$session_id;
4576 4576
             $sql = "UPDATE $tbl_tool SET name = '$this->name'
4577 4577
             	    WHERE
4578 4578
             	        c_id = $course_id AND
@@ -4650,10 +4650,10 @@  discard block
 block discarded – undo
4650 4650
 
4651 4651
                 // Save it to search engine.
4652 4652
                 foreach ($missing_terms as $term) {
4653
-                    $doc->add_term($prefix . $term, 1);
4653
+                    $doc->add_term($prefix.$term, 1);
4654 4654
                 }
4655 4655
                 foreach ($deprecated_terms as $term) {
4656
-                    $doc->remove_term($prefix . $term);
4656
+                    $doc->remove_term($prefix.$term);
4657 4657
                 }
4658 4658
                 $di->getDb()->replace_document((int) $se_ref['search_did'], $doc);
4659 4659
                 $di->getDb()->flush();
@@ -4678,10 +4678,10 @@  discard block
 block discarded – undo
4678 4678
         $this->theme = $name;
4679 4679
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4680 4680
         $lp_id = $this->get_id();
4681
-        $sql = "UPDATE $lp_table SET theme = '" . Database::escape_string($this->theme). "'
4681
+        $sql = "UPDATE $lp_table SET theme = '".Database::escape_string($this->theme)."'
4682 4682
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4683 4683
         if ($this->debug > 2) {
4684
-            error_log('New LP - lp updated with new theme : ' . $this->theme, 0);
4684
+            error_log('New LP - lp updated with new theme : '.$this->theme, 0);
4685 4685
         }
4686 4686
         Database::query($sql);
4687 4687
 
@@ -4704,10 +4704,10 @@  discard block
 block discarded – undo
4704 4704
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4705 4705
         $lp_id = $this->get_id();
4706 4706
         $sql = "UPDATE $lp_table SET
4707
-                preview_image = '" . Database::escape_string($this->preview_image). "'
4707
+                preview_image = '".Database::escape_string($this->preview_image)."'
4708 4708
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4709 4709
         if ($this->debug > 2) {
4710
-            error_log('New LP - lp updated with new preview image : ' . $this->preview_image, 0);
4710
+            error_log('New LP - lp updated with new preview image : '.$this->preview_image, 0);
4711 4711
         }
4712 4712
         Database::query($sql);
4713 4713
         return true;
@@ -4727,10 +4727,10 @@  discard block
 block discarded – undo
4727 4727
         $this->author = $name;
4728 4728
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4729 4729
         $lp_id = $this->get_id();
4730
-        $sql = "UPDATE $lp_table SET author = '" . Database::escape_string($name). "'
4730
+        $sql = "UPDATE $lp_table SET author = '".Database::escape_string($name)."'
4731 4731
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4732 4732
         if ($this->debug > 2) {
4733
-            error_log('New LP - lp updated with new preview author : ' . $this->author, 0);
4733
+            error_log('New LP - lp updated with new preview author : '.$this->author, 0);
4734 4734
         }
4735 4735
         Database::query($sql);
4736 4736
 
@@ -4748,15 +4748,15 @@  discard block
 block discarded – undo
4748 4748
         if ($this->debug > 0) {
4749 4749
             error_log('New LP - In learnpath::set_hide_toc_frame()', 0);
4750 4750
         }
4751
-        if (intval($hide) == $hide){
4751
+        if (intval($hide) == $hide) {
4752 4752
             $this->hide_toc_frame = $hide;
4753 4753
             $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4754 4754
             $lp_id = $this->get_id();
4755 4755
             $sql = "UPDATE $lp_table SET
4756
-                    hide_toc_frame = '" . $this->hide_toc_frame . "'
4756
+                    hide_toc_frame = '".$this->hide_toc_frame."'
4757 4757
                     WHERE c_id = ".$course_id." AND id = '$lp_id'";
4758 4758
             if ($this->debug > 2) {
4759
-                error_log('New LP - lp updated with new preview hide_toc_frame : ' . $this->author, 0);
4759
+                error_log('New LP - lp updated with new preview hide_toc_frame : '.$this->author, 0);
4760 4760
             }
4761 4761
             Database::query($sql);
4762 4762
 
@@ -4783,7 +4783,7 @@  discard block
 block discarded – undo
4783 4783
         $sql = "UPDATE $lp_table SET prerequisite = '".$this->prerequisite."'
4784 4784
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4785 4785
         if ($this->debug > 2) {
4786
-            error_log('New LP - lp updated with new preview requisite : ' . $this->requisite, 0);
4786
+            error_log('New LP - lp updated with new preview requisite : '.$this->requisite, 0);
4787 4787
         }
4788 4788
         Database::query($sql);
4789 4789
         return true;
@@ -4807,10 +4807,10 @@  discard block
 block discarded – undo
4807 4807
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4808 4808
         $lp_id = $this->get_id();
4809 4809
         $sql = "UPDATE $lp_table SET
4810
-                    content_local = '" . Database::escape_string($name) . "'
4810
+                    content_local = '".Database::escape_string($name)."'
4811 4811
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4812 4812
         if ($this->debug > 2) {
4813
-            error_log('New LP - lp updated with new proximity : ' . $this->proximity, 0);
4813
+            error_log('New LP - lp updated with new proximity : '.$this->proximity, 0);
4814 4814
         }
4815 4815
         Database::query($sql);
4816 4816
         return true;
@@ -4844,11 +4844,11 @@  discard block
 block discarded – undo
4844 4844
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4845 4845
         $lp_id = $this->get_id();
4846 4846
         $sql = "UPDATE $lp_table SET
4847
-                    use_max_score = '" . $this->use_max_score . "'
4847
+                    use_max_score = '".$this->use_max_score."'
4848 4848
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4849 4849
 
4850 4850
         if ($this->debug > 2) {
4851
-            error_log('New LP - lp updated with new use_max_score : ' . $this->use_max_score, 0);
4851
+            error_log('New LP - lp updated with new use_max_score : '.$this->use_max_score, 0);
4852 4852
         }
4853 4853
         Database::query($sql);
4854 4854
 
@@ -4875,10 +4875,10 @@  discard block
 block discarded – undo
4875 4875
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4876 4876
         $lp_id = $this->get_id();
4877 4877
         $sql = "UPDATE $lp_table SET
4878
-                expired_on = '" . Database::escape_string($this->expired_on) . "'
4878
+                expired_on = '".Database::escape_string($this->expired_on)."'
4879 4879
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4880 4880
         if ($this->debug > 2) {
4881
-            error_log('New LP - lp updated with new expired_on : ' . $this->expired_on, 0);
4881
+            error_log('New LP - lp updated with new expired_on : '.$this->expired_on, 0);
4882 4882
         }
4883 4883
         Database::query($sql);
4884 4884
 
@@ -4904,10 +4904,10 @@  discard block
 block discarded – undo
4904 4904
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4905 4905
         $lp_id = $this->get_id();
4906 4906
         $sql = "UPDATE $lp_table SET
4907
-                publicated_on = '" . Database::escape_string($this->publicated_on) . "'
4907
+                publicated_on = '".Database::escape_string($this->publicated_on)."'
4908 4908
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4909 4909
         if ($this->debug > 2) {
4910
-            error_log('New LP - lp updated with new publicated_on : ' . $this->publicated_on, 0);
4910
+            error_log('New LP - lp updated with new publicated_on : '.$this->publicated_on, 0);
4911 4911
         }
4912 4912
         Database::query($sql);
4913 4913
 
@@ -4927,10 +4927,10 @@  discard block
 block discarded – undo
4927 4927
         $this->modified_on = api_get_utc_datetime();
4928 4928
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4929 4929
         $lp_id = $this->get_id();
4930
-        $sql = "UPDATE $lp_table SET modified_on = '" . $this->modified_on . "'
4930
+        $sql = "UPDATE $lp_table SET modified_on = '".$this->modified_on."'
4931 4931
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4932 4932
         if ($this->debug > 2) {
4933
-            error_log('New LP - lp updated with new expired_on : ' . $this->modified_on, 0);
4933
+            error_log('New LP - lp updated with new expired_on : '.$this->modified_on, 0);
4934 4934
         }
4935 4935
         Database::query($sql);
4936 4936
         return true;
@@ -5001,13 +5001,13 @@  discard block
 block discarded – undo
5001 5001
 
5002 5002
         if ($this->last != 0 && $this->last != $this->current && is_object($this->items[$this->last])) {
5003 5003
             if ($this->debug > 2) {
5004
-                error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' is object', 0);
5004
+                error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' is object', 0);
5005 5005
             }
5006 5006
             switch ($this->get_type()) {
5007 5007
                 case '3' :
5008 5008
                     if ($this->items[$this->last]->get_type() != 'au') {
5009 5009
                         if ($this->debug > 2) {
5010
-                            error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 3 is <> au', 0);
5010
+                            error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 3 is <> au', 0);
5011 5011
                         }
5012 5012
                         $this->items[$this->last]->close();
5013 5013
                         //$this->autocomplete_parents($this->last);
@@ -5020,7 +5020,7 @@  discard block
 block discarded – undo
5020 5020
                 case '2' :
5021 5021
                     if ($this->items[$this->last]->get_type() != 'sco') {
5022 5022
                         if ($this->debug > 2) {
5023
-                            error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 2 is <> sco', 0);
5023
+                            error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 2 is <> sco', 0);
5024 5024
                         }
5025 5025
                         $this->items[$this->last]->close();
5026 5026
                         //$this->autocomplete_parents($this->last);
@@ -5034,7 +5034,7 @@  discard block
 block discarded – undo
5034 5034
                 case '1' :
5035 5035
                 default :
5036 5036
                     if ($this->debug > 2) {
5037
-                        error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 1 is asset', 0);
5037
+                        error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 1 is asset', 0);
5038 5038
                     }
5039 5039
                     $this->items[$this->last]->close();
5040 5040
                     break;
@@ -5060,7 +5060,7 @@  discard block
 block discarded – undo
5060 5060
         }
5061 5061
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5062 5062
         $sql = "SELECT * FROM $lp_table
5063
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5063
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5064 5064
         $res = Database::query($sql);
5065 5065
         if (Database :: num_rows($res) > 0) {
5066 5066
             $row = Database :: fetch_array($res);
@@ -5081,14 +5081,14 @@  discard block
 block discarded – undo
5081 5081
                     break;
5082 5082
             }
5083 5083
             $sql = "UPDATE $lp_table SET default_view_mod = '$view_mode'
5084
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5084
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5085 5085
             Database::query($sql);
5086 5086
             $this->mode = $view_mode;
5087 5087
 
5088 5088
             return $view_mode;
5089 5089
         } else {
5090 5090
             if ($this->debug > 2) {
5091
-                error_log('New LP - Problem in update_default_view() - could not find LP ' . $this->get_id() . ' in DB', 0);
5091
+                error_log('New LP - Problem in update_default_view() - could not find LP '.$this->get_id().' in DB', 0);
5092 5092
             }
5093 5093
         }
5094 5094
         return -1;
@@ -5106,7 +5106,7 @@  discard block
 block discarded – undo
5106 5106
         }
5107 5107
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5108 5108
         $sql = "SELECT * FROM $lp_table
5109
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5109
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5110 5110
         $res = Database::query($sql);
5111 5111
         if (Database :: num_rows($res) > 0) {
5112 5112
             $row = Database :: fetch_array($res);
@@ -5119,14 +5119,14 @@  discard block
 block discarded – undo
5119 5119
                 $force_return = true;
5120 5120
             }
5121 5121
             $sql = "UPDATE $lp_table SET force_commit = $force
5122
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5122
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5123 5123
             Database::query($sql);
5124 5124
             $this->force_commit = $force_return;
5125 5125
 
5126 5126
             return $force_return;
5127 5127
         } else {
5128 5128
             if ($this->debug > 2) {
5129
-                error_log('New LP - Problem in update_default_scorm_commit() - could not find LP ' . $this->get_id() . ' in DB', 0);
5129
+                error_log('New LP - Problem in update_default_scorm_commit() - could not find LP '.$this->get_id().' in DB', 0);
5130 5130
             }
5131 5131
         }
5132 5132
         return -1;
@@ -5155,7 +5155,7 @@  discard block
 block discarded – undo
5155 5155
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
5156 5156
                     $need_fix = true;
5157 5157
                     $sql = "UPDATE $lp_table SET display_order = $i
5158
-                            WHERE c_id = ".$course_id." AND id = " . $row['id'];
5158
+                            WHERE c_id = ".$course_id." AND id = ".$row['id'];
5159 5159
                     Database::query($sql);
5160 5160
                 }
5161 5161
                 $i++;
@@ -5176,7 +5176,7 @@  discard block
 block discarded – undo
5176 5176
         }
5177 5177
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5178 5178
         $sql = "SELECT * FROM $lp_table
5179
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5179
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5180 5180
         $res = Database::query($sql);
5181 5181
         if (Database :: num_rows($res) > 0) {
5182 5182
             $row = Database :: fetch_array($res);
@@ -5187,13 +5187,13 @@  discard block
 block discarded – undo
5187 5187
                 $force = 1;
5188 5188
             }
5189 5189
             $sql = "UPDATE $lp_table SET prevent_reinit = $force
5190
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5190
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5191 5191
             Database::query($sql);
5192 5192
             $this->prevent_reinit = $force;
5193 5193
             return $force;
5194 5194
         } else {
5195 5195
             if ($this->debug > 2) {
5196
-                error_log('New LP - Problem in update_reinit() - could not find LP ' . $this->get_id() . ' in DB', 0);
5196
+                error_log('New LP - Problem in update_reinit() - could not find LP '.$this->get_id().' in DB', 0);
5197 5197
             }
5198 5198
         }
5199 5199
         return -1;
@@ -5209,11 +5209,11 @@  discard block
 block discarded – undo
5209 5209
     {
5210 5210
         //Set default value for seriousgame_mode
5211 5211
         if (!isset($this->seriousgame_mode)) {
5212
-            $this->seriousgame_mode=0;
5212
+            $this->seriousgame_mode = 0;
5213 5213
         }
5214 5214
         // Set default value for prevent_reinit
5215 5215
         if (!isset($this->prevent_reinit)) {
5216
-            $this->prevent_reinit =1;
5216
+            $this->prevent_reinit = 1;
5217 5217
         }
5218 5218
         if ($this->seriousgame_mode == 1 && $this->prevent_reinit == 1) {
5219 5219
             return 'seriousgame';
@@ -5261,7 +5261,7 @@  discard block
 block discarded – undo
5261 5261
         $sql = "UPDATE $lp_table SET
5262 5262
                 prevent_reinit = $prevent_reinit ,
5263 5263
                 seriousgame_mode = $sg_mode
5264
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5264
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5265 5265
         $res = Database::query($sql);
5266 5266
         if ($res) {
5267 5267
             return true;
@@ -5313,7 +5313,7 @@  discard block
 block discarded – undo
5313 5313
             error_log('New LP - In learnpath::set_seriousgame_mode()', 0);
5314 5314
         }
5315 5315
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5316
-        $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5316
+        $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5317 5317
         $res = Database::query($sql);
5318 5318
         if (Database :: num_rows($res) > 0) {
5319 5319
             $row = Database :: fetch_array($res);
@@ -5324,13 +5324,13 @@  discard block
 block discarded – undo
5324 5324
                 $force = 1;
5325 5325
             }
5326 5326
             $sql = "UPDATE $lp_table SET seriousgame_mode = $force
5327
-			        WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5327
+			        WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5328 5328
             Database::query($sql);
5329 5329
             $this->seriousgame_mode = $force;
5330 5330
             return $force;
5331 5331
         } else {
5332 5332
             if ($this->debug > 2) {
5333
-                error_log('New LP - Problem in set_seriousgame_mode() - could not find LP ' . $this->get_id() . ' in DB', 0);
5333
+                error_log('New LP - Problem in set_seriousgame_mode() - could not find LP '.$this->get_id().' in DB', 0);
5334 5334
             }
5335 5335
         }
5336 5336
         return -1;
@@ -5348,7 +5348,7 @@  discard block
 block discarded – undo
5348 5348
         }
5349 5349
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5350 5350
         $sql = "SELECT * FROM $lp_table
5351
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5351
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5352 5352
         $res = Database::query($sql);
5353 5353
         if (Database :: num_rows($res) > 0) {
5354 5354
             $row = Database :: fetch_array($res);
@@ -5359,13 +5359,13 @@  discard block
 block discarded – undo
5359 5359
                 $force = 1;
5360 5360
             }
5361 5361
             $sql = "UPDATE $lp_table SET debug = $force
5362
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5362
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5363 5363
             $res = Database::query($sql);
5364 5364
             $this->scorm_debug = $force;
5365 5365
             return $force;
5366 5366
         } else {
5367 5367
             if ($this->debug > 2) {
5368
-                error_log('New LP - Problem in update_scorm_debug() - could not find LP ' . $this->get_id() . ' in DB', 0);
5368
+                error_log('New LP - Problem in update_scorm_debug() - could not find LP '.$this->get_id().' in DB', 0);
5369 5369
             }
5370 5370
         }
5371 5371
         return -1;
@@ -5394,7 +5394,7 @@  discard block
 block discarded – undo
5394 5394
      * @param int $depth
5395 5395
      * @param array $tmp
5396 5396
      */
5397
-    public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array ())
5397
+    public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array())
5398 5398
     {
5399 5399
         if ($this->debug > 1) {
5400 5400
             error_log('New LP - In learnpath::create_tree_array())', 0);
@@ -5480,7 +5480,7 @@  discard block
 block discarded – undo
5480 5480
 
5481 5481
         // we need to start a form when we want to update all the mp3 files
5482 5482
         if ($update_audio == 'true') {
5483
-            $return .= '<form action="' . api_get_self() . '?cidReq=' . Security :: remove_XSS($_GET['cidReq']) . '&updateaudio=' . Security :: remove_XSS($_GET['updateaudio']) .'&action=' . Security :: remove_XSS($_GET['action']) . '&lp_id=' . $_SESSION['oLP']->lp_id . '" method="post" enctype="multipart/form-data" name="updatemp3" id="updatemp3">';
5483
+            $return .= '<form action="'.api_get_self().'?cidReq='.Security :: remove_XSS($_GET['cidReq']).'&updateaudio='.Security :: remove_XSS($_GET['updateaudio']).'&action='.Security :: remove_XSS($_GET['action']).'&lp_id='.$_SESSION['oLP']->lp_id.'" method="post" enctype="multipart/form-data" name="updatemp3" id="updatemp3">';
5484 5484
         }
5485 5485
         $return .= '<div id="message"></div>';
5486 5486
         if (count($this->items) == 0) {
@@ -5488,14 +5488,14 @@  discard block
 block discarded – undo
5488 5488
         } else {
5489 5489
             $return_audio = '<table class="data_table">';
5490 5490
             $return_audio .= '<tr>';
5491
-            $return_audio .= '<th width="40%">' . get_lang('Title') . '</th>';
5492
-            $return_audio .= '<th>' . get_lang('Audio') . '</th>';
5491
+            $return_audio .= '<th width="40%">'.get_lang('Title').'</th>';
5492
+            $return_audio .= '<th>'.get_lang('Audio').'</th>';
5493 5493
             $return_audio .= '</tr>';
5494 5494
 
5495 5495
             if ($update_audio != 'true') {
5496 5496
                 $return .= '<div class="col-md-12">';
5497 5497
                 $return .= self::return_new_tree($update_audio);
5498
-                $return .='</div>';
5498
+                $return .= '</div>';
5499 5499
                 $return .= Display::div(Display::url(get_lang('Save'), '#', array('id'=>'listSubmit', 'class'=>'btn btn-primary')), array('style'=>'float:left; margin-top:15px;width:100%'));
5500 5500
             } else {
5501 5501
                 $return_audio .= self::return_new_tree($update_audio);
@@ -5505,7 +5505,7 @@  discard block
 block discarded – undo
5505 5505
             // We need to close the form when we are updating the mp3 files.
5506 5506
             if ($update_audio == 'true') {
5507 5507
                 $return .= '<div class="footer-audio">';
5508
-                $return .= Display::button('save_audio','<em class="fa fa-file-audio-o"></em> '. get_lang('SaveAudioAndOrganization'),array('class'=>'btn btn-primary','type'=>'submit'));
5508
+                $return .= Display::button('save_audio', '<em class="fa fa-file-audio-o"></em> '.get_lang('SaveAudioAndOrganization'), array('class'=>'btn btn-primary', 'type'=>'submit'));
5509 5509
                 $return .= '</div>';
5510 5510
                 //$return .= '<div><button class="btn btn-primary" type="submit" name="save_audio" id="save_audio">' . get_lang('SaveAudioAndOrganization') . '</button></div>'; // TODO: What kind of language variable is this?
5511 5511
             }
@@ -5526,7 +5526,7 @@  discard block
 block discarded – undo
5526 5526
     public function return_new_tree($update_audio = 'false', $drop_element_here = false)
5527 5527
     {
5528 5528
         $return = '';
5529
-        $is_allowed_to_edit = api_is_allowed_to_edit(null,true);
5529
+        $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
5530 5530
 
5531 5531
         $course_id = api_get_course_int_id();
5532 5532
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -5574,7 +5574,7 @@  discard block
 block discarded – undo
5574 5574
 
5575 5575
             // Link for the documents
5576 5576
             if ($arrLP[$i]['item_type'] == 'document') {
5577
-                $url = api_get_self() . '?'.api_get_cidreq().'&action=view_item&mode=preview_document&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id;
5577
+                $url = api_get_self().'?'.api_get_cidreq().'&action=view_item&mode=preview_document&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
5578 5578
                 $title_cut = Display::url(
5579 5579
                     $title_cut,
5580 5580
                     $url,
@@ -5590,14 +5590,14 @@  discard block
 block discarded – undo
5590 5590
             } else {
5591 5591
                 $oddClass = 'row_even';
5592 5592
             }
5593
-            $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'] .'" class="' . $oddClass . '">';
5593
+            $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'].'" class="'.$oddClass.'">';
5594 5594
 
5595 5595
             $icon_name = str_replace(' ', '', $arrLP[$i]['item_type']);
5596 5596
 
5597
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
5597
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
5598 5598
                 $icon = Display::return_icon('lp_'.$icon_name.'.png');
5599 5599
             } else {
5600
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
5600
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
5601 5601
                     $icon = Display::return_icon('lp_'.$icon_name.'.gif');
5602 5602
                 } else {
5603 5603
                     $icon = Display::return_icon('folder_document.gif');
@@ -5605,7 +5605,7 @@  discard block
 block discarded – undo
5605 5605
             }
5606 5606
 
5607 5607
             // The audio column.
5608
-            $return_audio  .= '<td align="left" style="padding-left:10px;">';
5608
+            $return_audio .= '<td align="left" style="padding-left:10px;">';
5609 5609
             $audio = '';
5610 5610
 
5611 5611
             if (!$update_audio || $update_audio <> 'true') {
@@ -5616,10 +5616,10 @@  discard block
 block discarded – undo
5616 5616
             } else {
5617 5617
                 $types = self::getChapterTypes();
5618 5618
                 if (!in_array($arrLP[$i]['item_type'], $types)) {
5619
-                    $audio .= '<input type="file" name="mp3file' . $arrLP[$i]['id'] . '" id="mp3file" />';
5619
+                    $audio .= '<input type="file" name="mp3file'.$arrLP[$i]['id'].'" id="mp3file" />';
5620 5620
                     if (!empty ($arrLP[$i]['audio'])) {
5621 5621
                         $audio .= '<br />'.Security::remove_XSS($arrLP[$i]['audio']).'<br />
5622
-                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'] . '" id="checkbox' . $arrLP[$i]['id'] . '" />' . get_lang('RemoveAudio');
5622
+                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'].'" id="checkbox'.$arrLP[$i]['id'].'" />'.get_lang('RemoveAudio');
5623 5623
                     }
5624 5624
                 }
5625 5625
             }
@@ -5643,7 +5643,7 @@  discard block
 block discarded – undo
5643 5643
                 // No edit for this item types
5644 5644
                 if (!in_array($arrLP[$i]['item_type'], array('sco', 'asset'))) {
5645 5645
                     if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module'))) {
5646
-                        $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit_item&view=build&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id . '&path_item=' . $arrLP[$i]['path'] . '" class="btn btn-default">';
5646
+                        $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit_item&view=build&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id.'&path_item='.$arrLP[$i]['path'].'" class="btn btn-default">';
5647 5647
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5648 5648
                         $edit_icon .= '</a>';
5649 5649
 
@@ -5656,7 +5656,7 @@  discard block
 block discarded – undo
5656 5656
                                 $this->lp_session_id
5657 5657
                             )
5658 5658
                             ) {
5659
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5659
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5660 5660
                                     'action' => 'dissociate_forum',
5661 5661
                                     'id' => $arrLP[$i]['id'],
5662 5662
                                     'lp_id' => $this->lp_id
@@ -5667,7 +5667,7 @@  discard block
 block discarded – undo
5667 5667
                                     ['class' => 'btn btn-default lp-btn-dissociate-forum']
5668 5668
                                 );
5669 5669
                             } else {
5670
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5670
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5671 5671
                                     'action' => 'create_forum',
5672 5672
                                     'id' => $arrLP[$i]['id'],
5673 5673
                                     'lp_id' => $this->lp_id
@@ -5680,17 +5680,17 @@  discard block
 block discarded – undo
5680 5680
                             }
5681 5681
                         }
5682 5682
                     } else {
5683
-                        $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit_item&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id . '&path_item=' . $arrLP[$i]['path'] . '" class="btn btn-default">';
5683
+                        $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit_item&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id.'&path_item='.$arrLP[$i]['path'].'" class="btn btn-default">';
5684 5684
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5685 5685
                         $edit_icon .= '</a>';
5686 5686
                     }
5687 5687
                 }
5688 5688
 
5689
-                $delete_icon .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete_item&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id . '" onclick="return confirmation(\'' . addslashes($title) . '\');" class="btn btn-default">';
5689
+                $delete_icon .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete_item&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id.'" onclick="return confirmation(\''.addslashes($title).'\');" class="btn btn-default">';
5690 5690
                 $delete_icon .= Display::return_icon('delete.png', get_lang('LearnpathDeleteModule'), array(), ICON_SIZE_TINY);
5691 5691
                 $delete_icon .= '</a>';
5692 5692
 
5693
-                $url = api_get_self() . '?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'] .'&lp_id='.$this->lp_id;
5693
+                $url = api_get_self().'?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
5694 5694
 
5695 5695
                 if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module', 'dir'))) {
5696 5696
                     $prerequisities_icon = Display::url(Display::return_icon('accept.png', get_lang('LearnpathPrerequisites'), array(), ICON_SIZE_TINY), $url.'&action=edit_item_prereq', ['class' => 'btn btn-default']);
@@ -5699,8 +5699,8 @@  discard block
 block discarded – undo
5699 5699
                 }
5700 5700
             }
5701 5701
             if ($update_audio != 'true') {
5702
-                $row = $move_icon . ' ' . $icon .
5703
-                    Display::span($title_cut) .
5702
+                $row = $move_icon.' '.$icon.
5703
+                    Display::span($title_cut).
5704 5704
                     Display::tag(
5705 5705
                         'div',
5706 5706
                         "<div class=\"btn-group btn-group-xs\">$audio $edit_icon $forumIcon $prerequisities_icon $move_item_icon $audio_icon $delete_icon</div>",
@@ -5721,8 +5721,8 @@  discard block
 block discarded – undo
5721 5721
                 $parent_arrays = array();
5722 5722
                 if ($arrLP[$i]['depth'] > 1) {
5723 5723
                     //Getting list of parents
5724
-                    for($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5725
-                        foreach($arrLP as $item) {
5724
+                    for ($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5725
+                        foreach ($arrLP as $item) {
5726 5726
                             if ($item['id'] == $parent_id) {
5727 5727
                                 if ($item['parent_item_id'] == 0) {
5728 5728
                                     $parent_id = $item['id'];
@@ -5744,8 +5744,8 @@  discard block
 block discarded – undo
5744 5744
                     $parent_arrays = array_reverse($parent_arrays);
5745 5745
                     $val = '$elements';
5746 5746
                     $x = 0;
5747
-                    foreach($parent_arrays as $item) {
5748
-                        if ($x != count($parent_arrays) -1) {
5747
+                    foreach ($parent_arrays as $item) {
5748
+                        if ($x != count($parent_arrays) - 1) {
5749 5749
                             $val .= '["'.$item.'"]["children"]';
5750 5750
                         } else {
5751 5751
                             $val .= '["'.$item.'"]["children"]';
@@ -5808,7 +5808,7 @@  discard block
 block discarded – undo
5808 5808
                 if (isset($_REQUEST['id']) && $key == $_REQUEST['id']) {
5809 5809
                     $active = 'active';
5810 5810
                 }
5811
-                $return  .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5811
+                $return .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5812 5812
             } else {
5813 5813
                 //sections
5814 5814
                 if (isset($item['children'])) {
@@ -5831,17 +5831,17 @@  discard block
 block discarded – undo
5831 5831
     {
5832 5832
         $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
5833 5833
         $return = '<div class="actions">';
5834
-        $return .=  '<a href="lp_controller.php?'.api_get_cidreq().'&gradebook=' . $gradebook . '&action=view&lp_id=' . $_SESSION['oLP']->lp_id . '&isStudentView=true">' . Display :: return_icon('preview_view.png', get_lang('Display'),'',ICON_SIZE_MEDIUM).'</a> ';
5835
-        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=admin_view&lp_id=' . $_SESSION['oLP']->lp_id . '&updateaudio=true">' . Display :: return_icon('upload_audio.png', get_lang('UpdateAllAudioFragments'),'',ICON_SIZE_MEDIUM).'</a>';
5836
-        $return .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=edit&lp_id=' . $_SESSION['oLP']->lp_id . '">' . Display :: return_icon('settings.png', get_lang('CourseSettings'),'',ICON_SIZE_MEDIUM).'</a>';
5834
+        $return .= '<a href="lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=view&lp_id='.$_SESSION['oLP']->lp_id.'&isStudentView=true">'.Display :: return_icon('preview_view.png', get_lang('Display'), '', ICON_SIZE_MEDIUM).'</a> ';
5835
+        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=admin_view&lp_id='.$_SESSION['oLP']->lp_id.'&updateaudio=true">'.Display :: return_icon('upload_audio.png', get_lang('UpdateAllAudioFragments'), '', ICON_SIZE_MEDIUM).'</a>';
5836
+        $return .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=edit&lp_id='.$_SESSION['oLP']->lp_id.'">'.Display :: return_icon('settings.png', get_lang('CourseSettings'), '', ICON_SIZE_MEDIUM).'</a>';
5837 5837
         $buttons = array(
5838 5838
             array(
5839 5839
                 'title' => get_lang('SetPrerequisiteForEachItem'),
5840
-                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id=' . $_SESSION['oLP']->lp_id,
5840
+                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id='.$_SESSION['oLP']->lp_id,
5841 5841
             ),
5842 5842
             array(
5843 5843
                 'title' => get_lang('ClearAllPrerequisites'),
5844
-                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id=' . $_SESSION['oLP']->lp_id,
5844
+                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id='.$_SESSION['oLP']->lp_id,
5845 5845
             ),
5846 5846
         );
5847 5847
         $return .= Display::group_button(get_lang('PrerequisitesOptions'), $buttons);
@@ -5862,7 +5862,7 @@  discard block
 block discarded – undo
5862 5862
     {
5863 5863
         // Creating learning_path folder
5864 5864
         $dir = '/learning_path';
5865
-        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'] . '/document';
5865
+        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
5866 5866
         $folder = false;
5867 5867
         if (!is_dir($filepath.'/'.$dir)) {
5868 5868
             $folderData = create_unexisting_directory(
@@ -5903,9 +5903,9 @@  discard block
 block discarded – undo
5903 5903
         // Creating LP folder
5904 5904
         if ($folder) {
5905 5905
             //Limits title size
5906
-            $title = api_substr(api_replace_dangerous_char($lp_name), 0 , 80);
5906
+            $title = api_substr(api_replace_dangerous_char($lp_name), 0, 80);
5907 5907
             $dir   = $dir.$title;
5908
-            $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document';
5908
+            $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
5909 5909
             if (!is_dir($filepath.'/'.$dir)) {
5910 5910
                 $folderData = create_unexisting_directory(
5911 5911
                     $course,
@@ -5925,7 +5925,7 @@  discard block
 block discarded – undo
5925 5925
             }
5926 5926
             $dir = $dir.'/';
5927 5927
             if ($folder) {
5928
-                $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document'.$dir;
5928
+                $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'.$dir;
5929 5929
             }
5930 5930
         }
5931 5931
         $array = array(
@@ -5964,12 +5964,12 @@  discard block
 block discarded – undo
5964 5964
             $dir = substr($dir, 1);
5965 5965
         }
5966 5966
         if (!empty($dir[0]) && $dir[0] != '/') {
5967
-            $dir = '/' . $dir;
5967
+            $dir = '/'.$dir;
5968 5968
         }
5969 5969
         if (isset($dir[strlen($dir) - 1]) && $dir[strlen($dir) - 1] != '/') {
5970 5970
             $dir .= '/';
5971 5971
         }
5972
-        $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document' . $dir;
5972
+        $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$dir;
5973 5973
 
5974 5974
         if (empty($_POST['dir']) && empty($_GET['dir'])) {
5975 5975
             //Generates folder
@@ -5979,7 +5979,7 @@  discard block
 block discarded – undo
5979 5979
         }
5980 5980
 
5981 5981
         if (!is_dir($filepath)) {
5982
-            $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document/';
5982
+            $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document/';
5983 5983
             $dir = '/';
5984 5984
         }
5985 5985
 
@@ -6002,10 +6002,10 @@  discard block
 block discarded – undo
6002 6002
         $tmp_filename = $filename;
6003 6003
 
6004 6004
         $i = 0;
6005
-        while (file_exists($filepath . $tmp_filename . '.'.$extension))
6006
-            $tmp_filename = $filename . '_' . ++ $i;
6005
+        while (file_exists($filepath.$tmp_filename.'.'.$extension))
6006
+            $tmp_filename = $filename.'_'.++ $i;
6007 6007
 
6008
-        $filename = $tmp_filename . '.'.$extension;
6008
+        $filename = $tmp_filename.'.'.$extension;
6009 6009
         if ($extension == 'html') {
6010 6010
             $content = stripslashes($content);
6011 6011
             $content = str_replace(
@@ -6040,12 +6040,12 @@  discard block
 block discarded – undo
6040 6040
             );
6041 6041
         }
6042 6042
 
6043
-        if (!file_exists($filepath . $filename)) {
6044
-            if ($fp = @ fopen($filepath . $filename, 'w')) {
6043
+        if (!file_exists($filepath.$filename)) {
6044
+            if ($fp = @ fopen($filepath.$filename, 'w')) {
6045 6045
                 fputs($fp, $content);
6046 6046
                 fclose($fp);
6047 6047
 
6048
-                $file_size = filesize($filepath . $filename);
6048
+                $file_size = filesize($filepath.$filename);
6049 6049
                 $save_file_path = $dir.$filename;
6050 6050
 
6051 6051
                 $document_id = add_document(
@@ -6077,12 +6077,12 @@  discard block
 block discarded – undo
6077 6077
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6078 6078
                         $ct = '';
6079 6079
                         if ($new_comment)
6080
-                            $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6080
+                            $ct .= ", comment='".Database::escape_string($new_comment)."'";
6081 6081
                         if ($new_title)
6082
-                            $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6082
+                            $ct .= ", title='".Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6083 6083
 
6084
-                        $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)."
6085
-                               WHERE c_id = ".$course_id." AND id = " . $document_id;
6084
+                        $sql = "UPDATE ".$tbl_doc." SET ".substr($ct, 1)."
6085
+                               WHERE c_id = ".$course_id." AND id = ".$document_id;
6086 6086
                         Database::query($sql);
6087 6087
                     }
6088 6088
                 }
@@ -6110,42 +6110,42 @@  discard block
 block discarded – undo
6110 6110
             $dir = substr($dir, 1);
6111 6111
 
6112 6112
         if ($dir[0] != '/')
6113
-            $dir = '/' . $dir;
6113
+            $dir = '/'.$dir;
6114 6114
 
6115 6115
         if ($dir[strlen($dir) - 1] != '/')
6116 6116
             $dir .= '/';
6117 6117
 
6118
-        $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir;
6118
+        $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
6119 6119
 
6120 6120
         if (!is_dir($filepath)) {
6121
-            $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
6121
+            $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
6122 6122
             $dir = '/';
6123 6123
         }
6124 6124
 
6125 6125
         $table_doc = Database :: get_course_table(TABLE_DOCUMENT);
6126 6126
         if (isset($_POST['path']) && !empty($_POST['path'])) {
6127 6127
             $document_id = intval($_POST['path']);
6128
-            $sql = "SELECT path FROM " . $table_doc . "
6129
-                    WHERE c_id = $course_id AND id = " . $document_id;
6128
+            $sql = "SELECT path FROM ".$table_doc."
6129
+                    WHERE c_id = $course_id AND id = ".$document_id;
6130 6130
             $res = Database::query($sql);
6131 6131
             $row = Database :: fetch_array($res);
6132 6132
             $content = stripslashes($_POST['content_lp']);
6133
-            $file = $filepath . $row['path'];
6133
+            $file = $filepath.$row['path'];
6134 6134
 
6135 6135
             if ($fp = @ fopen($file, 'w')) {
6136
-                $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'] . '/courses/', $content);
6136
+                $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].'/courses/', $content);
6137 6137
 
6138 6138
                 // Change the path of mp3 to absolute.
6139 6139
                 // The first regexp deals with :// urls.
6140
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/', $content);
6140
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/', $content);
6141 6141
                 // The second regexp deals with audio/ urls.
6142
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/$2/', $content);
6142
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/$2/', $content);
6143 6143
                 fputs($fp, $content);
6144 6144
                 fclose($fp);
6145 6145
 
6146
-                $sql = "UPDATE " . $table_doc ." SET
6146
+                $sql = "UPDATE ".$table_doc." SET
6147 6147
                             title='".Database::escape_string($_POST['title'])."'
6148
-                        WHERE c_id = ".$course_id." AND id = " . $document_id;
6148
+                        WHERE c_id = ".$course_id." AND id = ".$document_id;
6149 6149
                 Database::query($sql);
6150 6150
             }
6151 6151
         }
@@ -6163,10 +6163,10 @@  discard block
 block discarded – undo
6163 6163
         $return = '';
6164 6164
         if (is_numeric($item_id)) {
6165 6165
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6166
-            $sql = "SELECT lp.* FROM " . $tbl_lp_item . " as lp
6167
-                    WHERE c_id = ".$course_id." AND lp.id = " . intval($item_id);
6166
+            $sql = "SELECT lp.* FROM ".$tbl_lp_item." as lp
6167
+                    WHERE c_id = ".$course_id." AND lp.id = ".intval($item_id);
6168 6168
             $result = Database::query($sql);
6169
-            while ($row = Database :: fetch_array($result,'ASSOC')) {
6169
+            while ($row = Database :: fetch_array($result, 'ASSOC')) {
6170 6170
                 $_SESSION['parent_item_id'] = ($row['item_type'] == 'dokeos_chapter' || $row['item_type'] == 'dokeos_module' || $row['item_type'] == 'dir') ? $item_id : 0;
6171 6171
 
6172 6172
                 // Prevents wrong parent selection for document, see Bug#1251.
@@ -6193,8 +6193,8 @@  discard block
 block discarded – undo
6193 6193
                         break;
6194 6194
                     case TOOL_DOCUMENT:
6195 6195
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6196
-                        $sql_doc = "SELECT path FROM " . $tbl_doc . "
6197
-                                    WHERE c_id = ".$course_id." AND id = " . intval($row['path']);
6196
+                        $sql_doc = "SELECT path FROM ".$tbl_doc."
6197
+                                    WHERE c_id = ".$course_id." AND id = ".intval($row['path']);
6198 6198
                         $result = Database::query($sql_doc);
6199 6199
                         $path_file = Database::result($result, 0, 0);
6200 6200
                         $path_parts = pathinfo($path_file);
@@ -6233,7 +6233,7 @@  discard block
 block discarded – undo
6233 6233
         if (is_numeric($item_id)) {
6234 6234
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6235 6235
             $sql = "SELECT * FROM $tbl_lp_item
6236
-                    WHERE c_id = ".$course_id." AND id = " . intval($item_id);
6236
+                    WHERE c_id = ".$course_id." AND id = ".intval($item_id);
6237 6237
             $res = Database::query($sql);
6238 6238
             $row = Database::fetch_array($res);
6239 6239
 
@@ -6244,21 +6244,21 @@  discard block
 block discarded – undo
6244 6244
                 case 'sco' :
6245 6245
                     if (isset ($_GET['view']) && $_GET['view'] == 'build') {
6246 6246
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6247
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', 'edit', $item_id, $row);
6247
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter').' :', 'edit', $item_id, $row);
6248 6248
                     } else {
6249
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', $row);
6249
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter').' :', $row);
6250 6250
                     }
6251 6251
                     break;
6252 6252
                 case TOOL_DOCUMENT :
6253 6253
                     $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6254 6254
                     $sql = "SELECT lp.*, doc.path as dir
6255
-                            FROM " . $tbl_lp_item . " as lp
6256
-                            LEFT JOIN " . $tbl_doc . " as doc
6255
+                            FROM " . $tbl_lp_item." as lp
6256
+                            LEFT JOIN " . $tbl_doc." as doc
6257 6257
                             ON doc.id = lp.path
6258 6258
                             WHERE
6259 6259
                                 lp.c_id = $course_id AND
6260 6260
                                 doc.c_id = $course_id AND
6261
-                                lp.id = " . intval($item_id);
6261
+                                lp.id = ".intval($item_id);
6262 6262
                     $res_step = Database::query($sql);
6263 6263
                     $row_step = Database :: fetch_array($res_step);
6264 6264
                     $return .= $this->display_manipulate($item_id, $row['item_type']);
@@ -6268,8 +6268,8 @@  discard block
 block discarded – undo
6268 6268
                     $link_id = (string) $row['path'];
6269 6269
                     if (ctype_digit($link_id)) {
6270 6270
                         $tbl_link = Database :: get_course_table(TABLE_LINK);
6271
-                        $sql_select = 'SELECT url FROM ' . $tbl_link . '
6272
-                                       WHERE c_id = '.$course_id.' AND id = ' . intval($link_id);
6271
+                        $sql_select = 'SELECT url FROM '.$tbl_link.'
6272
+                                       WHERE c_id = '.$course_id.' AND id = '.intval($link_id);
6273 6273
                         $res_link = Database::query($sql_select);
6274 6274
                         $row_link = Database :: fetch_array($res_link);
6275 6275
                         if (is_array($row_link)) {
@@ -6282,9 +6282,9 @@  discard block
 block discarded – undo
6282 6282
                 case 'dokeos_module' :
6283 6283
                     if (isset ($_GET['view']) && $_GET['view'] == 'build') {
6284 6284
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6285
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule') . ' :', 'edit', $item_id, $row);
6285
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule').' :', 'edit', $item_id, $row);
6286 6286
                     } else {
6287
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule') . ' :', $row);
6287
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule').' :', $row);
6288 6288
                     }
6289 6289
                     break;
6290 6290
                 case TOOL_QUIZ :
@@ -6339,7 +6339,7 @@  discard block
 block discarded – undo
6339 6339
 
6340 6340
         $headers = array(
6341 6341
             Display::return_icon('folder_document.png', get_lang('Documents'), array(), ICON_SIZE_BIG),
6342
-            Display::return_icon('quiz.png',  get_lang('Quiz'), array(), ICON_SIZE_BIG),
6342
+            Display::return_icon('quiz.png', get_lang('Quiz'), array(), ICON_SIZE_BIG),
6343 6343
             Display::return_icon('links.png', get_lang('Links'), array(), ICON_SIZE_BIG),
6344 6344
             Display::return_icon('works.png', get_lang('Works'), array(), ICON_SIZE_BIG),
6345 6345
             Display::return_icon('forum.png', get_lang('Forums'), array(), ICON_SIZE_BIG),
@@ -6379,16 +6379,16 @@  discard block
 block discarded – undo
6379 6379
         $course_id = api_get_course_int_id();
6380 6380
         $return = '';
6381 6381
         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6382
-        $sql_doc = "SELECT * FROM " . $tbl_doc . "
6383
-                    WHERE c_id = ".$course_id." AND id = " . $id;
6382
+        $sql_doc = "SELECT * FROM ".$tbl_doc."
6383
+                    WHERE c_id = ".$course_id." AND id = ".$id;
6384 6384
         $res_doc = Database::query($sql_doc);
6385 6385
         $row_doc = Database :: fetch_array($res_doc);
6386 6386
 
6387 6387
         // TODO: Add a path filter.
6388 6388
         if ($iframe) {
6389
-            $return .= '<iframe id="learnpath_preview_frame" frameborder="0" height="400" width="100%" scrolling="auto" src="' . api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document' . str_replace('%2F', '/', urlencode($row_doc['path'])) . '?' . api_get_cidreq() . '"></iframe>';
6389
+            $return .= '<iframe id="learnpath_preview_frame" frameborder="0" height="400" width="100%" scrolling="auto" src="'.api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.str_replace('%2F', '/', urlencode($row_doc['path'])).'?'.api_get_cidreq().'"></iframe>';
6390 6390
         } else {
6391
-            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $row_doc['path']);
6391
+            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$row_doc['path']);
6392 6392
         }
6393 6393
 
6394 6394
         return $return;
@@ -6412,8 +6412,8 @@  discard block
 block discarded – undo
6412 6412
             $item_description = $extra_info['description'];
6413 6413
         } elseif (is_numeric($extra_info)) {
6414 6414
             $sql = "SELECT title, description
6415
-                    FROM " . $tbl_quiz . "
6416
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
6415
+                    FROM " . $tbl_quiz."
6416
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
6417 6417
 
6418 6418
             $result = Database::query($sql);
6419 6419
             $row = Database::fetch_array($result);
@@ -6423,8 +6423,8 @@  discard block
 block discarded – undo
6423 6423
             $item_title = '';
6424 6424
             $item_description = '';
6425 6425
         }
6426
-        $item_title			= Security::remove_XSS($item_title);
6427
-        $item_description 	= Security::remove_XSS($item_description);
6426
+        $item_title = Security::remove_XSS($item_title);
6427
+        $item_description = Security::remove_XSS($item_description);
6428 6428
 
6429 6429
         $legend = '<legend>';
6430 6430
         if ($id != 0 && is_array($extra_info))
@@ -6432,13 +6432,13 @@  discard block
 block discarded – undo
6432 6432
         else
6433 6433
             $parent = 0;
6434 6434
 
6435
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6436
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6435
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6436
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6437 6437
 
6438 6438
         $result = Database::query($sql);
6439
-        $arrLP = array ();
6439
+        $arrLP = array();
6440 6440
         while ($row = Database :: fetch_array($result)) {
6441
-            $arrLP[] = array (
6441
+            $arrLP[] = array(
6442 6442
                 'id' => $row['id'],
6443 6443
                 'item_type' => $row['item_type'],
6444 6444
                 'title' => $row['title'],
@@ -6461,15 +6461,15 @@  discard block
 block discarded – undo
6461 6461
         unset ($this->arrMenu);
6462 6462
 
6463 6463
         if ($action == 'add') {
6464
-            $legend .= get_lang('CreateTheExercise') . '&nbsp;:';
6464
+            $legend .= get_lang('CreateTheExercise').'&nbsp;:';
6465 6465
         } elseif ($action == 'move') {
6466
-            $legend .= get_lang('MoveTheCurrentExercise') . '&nbsp;:';
6466
+            $legend .= get_lang('MoveTheCurrentExercise').'&nbsp;:';
6467 6467
         } else {
6468
-            $legend .= get_lang('EditCurrentExecice') . '&nbsp;:';
6468
+            $legend .= get_lang('EditCurrentExecice').'&nbsp;:';
6469 6469
         }
6470 6470
 
6471 6471
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6472
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6472
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6473 6473
         }
6474 6474
 
6475 6475
         $legend .= '</legend>';
@@ -6482,34 +6482,34 @@  discard block
 block discarded – undo
6482 6482
 
6483 6483
         if ($action != 'move') {
6484 6484
             $return .= '<tr>';
6485
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
6486
-            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="' . $item_title . '" /></td>';
6485
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
6486
+            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="'.$item_title.'" /></td>';
6487 6487
             $return .= '</tr>';
6488 6488
         }
6489 6489
 
6490 6490
         $return .= '<tr>';
6491 6491
 
6492
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
6492
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
6493 6493
         $return .= '<td class="input">';
6494 6494
 
6495 6495
         // Select for Parent item, root or chapter
6496 6496
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
6497 6497
 
6498
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6498
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6499 6499
 
6500
-        $arrHide = array (
6500
+        $arrHide = array(
6501 6501
             $id
6502 6502
         );
6503 6503
         for ($i = 0; $i < count($arrLP); $i++) {
6504 6504
             if ($action != 'add') {
6505 6505
                 if (($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') && !in_array($arrLP[$i]['id'], $arrHide) && !in_array($arrLP[$i]['parent_item_id'], $arrHide)) {
6506
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6506
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6507 6507
                 } else {
6508 6508
                     $arrHide[] = $arrLP[$i]['id'];
6509 6509
                 }
6510 6510
             } else {
6511 6511
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6512
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6512
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6513 6513
             }
6514 6514
         }
6515 6515
         if (is_array($arrLP)) {
@@ -6521,11 +6521,11 @@  discard block
 block discarded – undo
6521 6521
         $return .= '</tr>';
6522 6522
         $return .= '<tr>';
6523 6523
 
6524
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
6524
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
6525 6525
         $return .= '<td class="input">';
6526 6526
 
6527 6527
         $return .= '<select class="learnpath_item_form" style="width:100%;" id="previous" name="previous" size="1">';
6528
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6528
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6529 6529
         for ($i = 0; $i < count($arrLP); $i++) {
6530 6530
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6531 6531
                 if (is_array($extra_info)) {
@@ -6537,7 +6537,7 @@  discard block
 block discarded – undo
6537 6537
                 } else {
6538 6538
                     $selected = '';
6539 6539
                 }
6540
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6540
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6541 6541
             }
6542 6542
         }
6543 6543
         $return .= '</select>';
@@ -6554,7 +6554,7 @@  discard block
 block discarded – undo
6554 6554
                     }
6555 6555
                 }
6556 6556
             }
6557
-            $arrHide = array ();
6557
+            $arrHide = array();
6558 6558
             for ($i = 0; $i < count($arrLP); $i++) {
6559 6559
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6560 6560
                     if (is_array($extra_info)) {
@@ -6600,27 +6600,27 @@  discard block
 block discarded – undo
6600 6600
 
6601 6601
         $return .= '<tr>';
6602 6602
         if ($action == 'add') {
6603
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('AddExercise') . '</button></td>';
6603
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('AddExercise').'</button></td>';
6604 6604
         } else {
6605
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('EditCurrentExecice') . '</button></td>';
6605
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('EditCurrentExecice').'</button></td>';
6606 6606
         }
6607 6607
 
6608 6608
         $return .= '</tr>';
6609 6609
         $return .= '</table>';
6610 6610
 
6611 6611
         if ($action == 'move') {
6612
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6613
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6612
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6613
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6614 6614
         }
6615 6615
 
6616 6616
         if (is_numeric($extra_info)) {
6617
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6617
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6618 6618
         } elseif (is_array($extra_info)) {
6619
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6619
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6620 6620
         }
6621 6621
 
6622
-        $return .= '<input name="type" type="hidden" value="' . TOOL_QUIZ . '" />';
6623
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6622
+        $return .= '<input name="type" type="hidden" value="'.TOOL_QUIZ.'" />';
6623
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6624 6624
 
6625 6625
         $return .= '</form>';
6626 6626
         $return .= '</div>';
@@ -6647,11 +6647,11 @@  discard block
 block discarded – undo
6647 6647
         } elseif (is_numeric($extra_info)) {
6648 6648
             $TBL_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT);
6649 6649
 
6650
-            $sql = "SELECT * FROM " . $TBL_DOCUMENT . "
6650
+            $sql = "SELECT * FROM ".$TBL_DOCUMENT."
6651 6651
                     WHERE
6652 6652
                         c_id = ".$course_id." AND
6653
-                        path LIKE '" . $uploadPath . "/%/%htm%' AND
6654
-                        id = " . (int) $extra_info . "
6653
+                        path LIKE '" . $uploadPath."/%/%htm%' AND
6654
+                        id = " . (int) $extra_info."
6655 6655
                     ORDER BY id ASC";
6656 6656
 
6657 6657
             $res_hot = Database::query($sql);
@@ -6675,11 +6675,11 @@  discard block
 block discarded – undo
6675 6675
         }
6676 6676
 
6677 6677
         $sql = "SELECT * FROM $tbl_lp_item
6678
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6678
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6679 6679
         $result = Database::query($sql);
6680
-        $arrLP = array ();
6680
+        $arrLP = array();
6681 6681
         while ($row = Database :: fetch_array($result)) {
6682
-            $arrLP[] = array (
6682
+            $arrLP[] = array(
6683 6683
                 'id' => $row['id'],
6684 6684
                 'item_type' => $row['item_type'],
6685 6685
                 'title' => $row['title'],
@@ -6704,7 +6704,7 @@  discard block
 block discarded – undo
6704 6704
         else
6705 6705
             $legend .= get_lang('EditCurrentExecice');
6706 6706
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6707
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6707
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6708 6708
         }
6709 6709
         $legend .= '</legend>';
6710 6710
 
@@ -6712,11 +6712,11 @@  discard block
 block discarded – undo
6712 6712
         $return .= $legend;
6713 6713
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
6714 6714
         $return .= '<tr>';
6715
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . ' :</label></td>';
6715
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').' :</label></td>';
6716 6716
         $return .= '<td class="input">';
6717 6717
         $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
6718
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6719
-        $arrHide = array (
6718
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6719
+        $arrHide = array(
6720 6720
             $id
6721 6721
         );
6722 6722
 
@@ -6724,13 +6724,13 @@  discard block
 block discarded – undo
6724 6724
             for ($i = 0; $i < count($arrLP); $i++) {
6725 6725
                 if ($action != 'add') {
6726 6726
                     if (($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') && !in_array($arrLP[$i]['id'], $arrHide) && !in_array($arrLP[$i]['parent_item_id'], $arrHide)) {
6727
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6727
+                        $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6728 6728
                     } else {
6729 6729
                         $arrHide[] = $arrLP[$i]['id'];
6730 6730
                     }
6731 6731
                 } else {
6732 6732
                     if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6733
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6733
+                        $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6734 6734
                 }
6735 6735
             }
6736 6736
 
@@ -6741,10 +6741,10 @@  discard block
 block discarded – undo
6741 6741
         $return .= '</td>';
6742 6742
         $return .= '</tr>';
6743 6743
         $return .= '<tr>';
6744
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . ' :</label></td>';
6744
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').' :</label></td>';
6745 6745
         $return .= '<td class="input">';
6746 6746
         $return .= '<select id="previous" name="previous" size="1">';
6747
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6747
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6748 6748
 
6749 6749
         for ($i = 0; $i < count($arrLP); $i++) {
6750 6750
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
@@ -6754,7 +6754,7 @@  discard block
 block discarded – undo
6754 6754
                 else
6755 6755
                     $selected = '';
6756 6756
 
6757
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6757
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6758 6758
             }
6759 6759
         }
6760 6760
 
@@ -6764,8 +6764,8 @@  discard block
 block discarded – undo
6764 6764
 
6765 6765
         if ($action != 'move') {
6766 6766
             $return .= '<tr>';
6767
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . ' :</label></td>';
6768
-            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>';
6767
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').' :</label></td>';
6768
+            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>';
6769 6769
             $return .= '</tr>';
6770 6770
             $id_prerequisite = 0;
6771 6771
             if (is_array($arrLP) && count($arrLP) > 0) {
@@ -6776,7 +6776,7 @@  discard block
 block discarded – undo
6776 6776
                     }
6777 6777
                 }
6778 6778
 
6779
-                $arrHide = array ();
6779
+                $arrHide = array();
6780 6780
                 for ($i = 0; $i < count($arrLP); $i++) {
6781 6781
                     if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6782 6782
                         if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -6790,22 +6790,22 @@  discard block
 block discarded – undo
6790 6790
         }
6791 6791
 
6792 6792
         $return .= '<tr>';
6793
-        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">' . get_lang('SaveHotpotatoes') . '</button></td>';
6793
+        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">'.get_lang('SaveHotpotatoes').'</button></td>';
6794 6794
         $return .= '</tr>';
6795 6795
         $return .= '</table>';
6796 6796
 
6797 6797
         if ($action == 'move') {
6798
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6799
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6798
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6799
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6800 6800
         }
6801 6801
 
6802 6802
         if (is_numeric($extra_info)) {
6803
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6803
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6804 6804
         } elseif (is_array($extra_info)) {
6805
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6805
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6806 6806
         }
6807
-        $return .= '<input name="type" type="hidden" value="' . TOOL_HOTPOTATOES . '" />';
6808
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6807
+        $return .= '<input name="type" type="hidden" value="'.TOOL_HOTPOTATOES.'" />';
6808
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6809 6809
         $return .= '</form>';
6810 6810
 
6811 6811
         return $return;
@@ -6828,8 +6828,8 @@  discard block
 block discarded – undo
6828 6828
             $item_title = stripslashes($extra_info['title']);
6829 6829
         } elseif (is_numeric($extra_info)) {
6830 6830
             $sql = "SELECT forum_title as title, forum_comment as comment
6831
-                    FROM " . $tbl_forum . "
6832
-                    WHERE c_id = ".$course_id." AND forum_id = " . $extra_info;
6831
+                    FROM " . $tbl_forum."
6832
+                    WHERE c_id = ".$course_id." AND forum_id = ".$extra_info;
6833 6833
 
6834 6834
             $result = Database::query($sql);
6835 6835
             $row = Database :: fetch_array($result);
@@ -6849,7 +6849,7 @@  discard block
 block discarded – undo
6849 6849
             $parent = 0;
6850 6850
         }
6851 6851
 
6852
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6852
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6853 6853
                 WHERE
6854 6854
                     c_id = ".$course_id." AND
6855 6855
                     lp_id = " . $this->lp_id;
@@ -6857,7 +6857,7 @@  discard block
 block discarded – undo
6857 6857
         $arrLP = array();
6858 6858
 
6859 6859
         while ($row = Database :: fetch_array($result)) {
6860
-            $arrLP[] = array (
6860
+            $arrLP[] = array(
6861 6861
                 'id' => $row['id'],
6862 6862
                 'item_type' => $row['item_type'],
6863 6863
                 'title' => $row['title'],
@@ -6879,10 +6879,10 @@  discard block
 block discarded – undo
6879 6879
         unset($this->arrMenu);
6880 6880
 
6881 6881
         if ($action == 'add')
6882
-            $legend .= get_lang('CreateTheForum') . '&nbsp;:';
6883
-        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum') . '&nbsp;:';
6882
+            $legend .= get_lang('CreateTheForum').'&nbsp;:';
6883
+        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum').'&nbsp;:';
6884 6884
         else
6885
-            $legend .= get_lang('EditCurrentForum') . '&nbsp;:';
6885
+            $legend .= get_lang('EditCurrentForum').'&nbsp;:';
6886 6886
 
6887 6887
         $legend .= '</legend>';
6888 6888
         $return = '<div class="sectioncomment">';
@@ -6892,16 +6892,16 @@  discard block
 block discarded – undo
6892 6892
 
6893 6893
         if ($action != 'move') {
6894 6894
             $return .= '<tr>';
6895
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
6896
-            $return .= '<td class="input"><input id="idTitle" size="44" name="title" type="text" value="' . $item_title . '" class="learnpath_item_form" /></td>';
6895
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
6896
+            $return .= '<td class="input"><input id="idTitle" size="44" name="title" type="text" value="'.$item_title.'" class="learnpath_item_form" /></td>';
6897 6897
             $return .= '</tr>';
6898 6898
         }
6899 6899
 
6900 6900
         $return .= '<tr>';
6901
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
6901
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
6902 6902
         $return .= '<td class="input">';
6903 6903
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" class="learnpath_item_form" size="1">';
6904
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6904
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6905 6905
         $arrHide = array(
6906 6906
             $id
6907 6907
         );
@@ -6910,13 +6910,13 @@  discard block
 block discarded – undo
6910 6910
         for ($i = 0; $i < count($arrLP); $i++) {
6911 6911
             if ($action != 'add') {
6912 6912
                 if (($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') && !in_array($arrLP[$i]['id'], $arrHide) && !in_array($arrLP[$i]['parent_item_id'], $arrHide)) {
6913
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6913
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6914 6914
                 } else {
6915 6915
                     $arrHide[] = $arrLP[$i]['id'];
6916 6916
                 }
6917 6917
             } else {
6918 6918
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6919
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6919
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6920 6920
             }
6921 6921
         }
6922 6922
         if (is_array($arrLP)) {
@@ -6927,10 +6927,10 @@  discard block
 block discarded – undo
6927 6927
         $return .= '</td>';
6928 6928
         $return .= '</tr>';
6929 6929
         $return .= '<tr>';
6930
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
6930
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
6931 6931
         $return .= '<td class="input">';
6932 6932
         $return .= '<select id="previous" name="previous" style="width:100%;" size="1" class="learnpath_item_form">';
6933
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6933
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6934 6934
 
6935 6935
         for ($i = 0; $i < count($arrLP); $i++) {
6936 6936
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
@@ -6940,8 +6940,8 @@  discard block
 block discarded – undo
6940 6940
                 else
6941 6941
                     $selected = '';
6942 6942
 
6943
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' .
6944
-                    get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6943
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.
6944
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6945 6945
             }
6946 6946
         }
6947 6947
 
@@ -6975,25 +6975,25 @@  discard block
 block discarded – undo
6975 6975
         $return .= '<tr>';
6976 6976
 
6977 6977
         if ($action == 'add') {
6978
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> ' . get_lang('AddForumToCourse') . ' </button></td>';
6978
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> '.get_lang('AddForumToCourse').' </button></td>';
6979 6979
         } else {
6980
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> ' . get_lang('EditCurrentForum') . ' </button></td>';
6980
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> '.get_lang('EditCurrentForum').' </button></td>';
6981 6981
         }
6982 6982
         $return .= '</tr>';
6983 6983
         $return .= '</table>';
6984 6984
 
6985 6985
         if ($action == 'move') {
6986
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6987
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6986
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6987
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6988 6988
         }
6989 6989
 
6990 6990
         if (is_numeric($extra_info)) {
6991
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6991
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6992 6992
         } elseif (is_array($extra_info)) {
6993
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6993
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6994 6994
         }
6995
-        $return .= '<input name="type" type="hidden" value="' . TOOL_FORUM . '" />';
6996
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6995
+        $return .= '<input name="type" type="hidden" value="'.TOOL_FORUM.'" />';
6996
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6997 6997
         $return .= '</form>';
6998 6998
         $return .= '</div>';
6999 6999
 
@@ -7020,7 +7020,7 @@  discard block
 block discarded – undo
7020 7020
             $item_title = stripslashes($extra_info['title']);
7021 7021
         } elseif (is_numeric($extra_info)) {
7022 7022
             $sql = "SELECT thread_title as title FROM $tbl_forum
7023
-                    WHERE c_id = $course_id AND thread_id = " . $extra_info;
7023
+                    WHERE c_id = $course_id AND thread_id = ".$extra_info;
7024 7024
 
7025 7025
             $result = Database::query($sql);
7026 7026
             $row = Database :: fetch_array($result);
@@ -7040,15 +7040,15 @@  discard block
 block discarded – undo
7040 7040
             $parent = 0;
7041 7041
         }
7042 7042
 
7043
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7044
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7043
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7044
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7045 7045
 
7046 7046
         $result = Database::query($sql);
7047 7047
 
7048
-        $arrLP = array ();
7048
+        $arrLP = array();
7049 7049
 
7050 7050
         while ($row = Database :: fetch_array($result)) {
7051
-            $arrLP[] = array (
7051
+            $arrLP[] = array(
7052 7052
                 'id' => $row['id'],
7053 7053
                 'item_type' => $row['item_type'],
7054 7054
                 'title' => $row['title'],
@@ -7071,31 +7071,31 @@  discard block
 block discarded – undo
7071 7071
 
7072 7072
         $return .= '<form method="POST">';
7073 7073
         if ($action == 'add')
7074
-            $return .= '<legend>' . get_lang('CreateTheForum') . '</legend>';
7075
-        elseif ($action == 'move') $return .= '<p class="lp_title">' . get_lang('MoveTheCurrentForum') . '&nbsp;:</p>';
7074
+            $return .= '<legend>'.get_lang('CreateTheForum').'</legend>';
7075
+        elseif ($action == 'move') $return .= '<p class="lp_title">'.get_lang('MoveTheCurrentForum').'&nbsp;:</p>';
7076 7076
         else
7077
-            $return .= '<legend>' . get_lang('EditCurrentForum') . '</legend>';
7077
+            $return .= '<legend>'.get_lang('EditCurrentForum').'</legend>';
7078 7078
 
7079 7079
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
7080 7080
         $return .= '<tr>';
7081
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
7081
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
7082 7082
         $return .= '<td class="input">';
7083 7083
         $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
7084
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
7085
-        $arrHide = array (
7084
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
7085
+        $arrHide = array(
7086 7086
             $id
7087 7087
         );
7088 7088
 
7089 7089
         for ($i = 0; $i < count($arrLP); $i++) {
7090 7090
             if ($action != 'add') {
7091 7091
                 if (($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') && !in_array($arrLP[$i]['id'], $arrHide) && !in_array($arrLP[$i]['parent_item_id'], $arrHide)) {
7092
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7092
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7093 7093
                 } else {
7094 7094
                     $arrHide[] = $arrLP[$i]['id'];
7095 7095
                 }
7096 7096
             } else {
7097 7097
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
7098
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7098
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7099 7099
             }
7100 7100
         }
7101 7101
 
@@ -7107,10 +7107,10 @@  discard block
 block discarded – undo
7107 7107
         $return .= '</td>';
7108 7108
         $return .= '</tr>';
7109 7109
         $return .= '<tr>';
7110
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
7110
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
7111 7111
         $return .= '<td class="input">';
7112 7112
         $return .= '<select id="previous" name="previous" size="1">';
7113
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7113
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
7114 7114
         for ($i = 0; $i < count($arrLP); $i++) {
7115 7115
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7116 7116
                 if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -7119,7 +7119,7 @@  discard block
 block discarded – undo
7119 7119
                 else
7120 7120
                     $selected = '';
7121 7121
 
7122
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7122
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
7123 7123
             }
7124 7124
         }
7125 7125
         $return .= '</select>';
@@ -7127,8 +7127,8 @@  discard block
 block discarded – undo
7127 7127
         $return .= '</tr>';
7128 7128
         if ($action != 'move') {
7129 7129
             $return .= '<tr>';
7130
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
7131
-            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>';
7130
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
7131
+            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>';
7132 7132
             $return .= '</tr>';
7133 7133
             $return .= '<tr>';
7134 7134
             $return .= '</tr>';
@@ -7155,17 +7155,17 @@  discard block
 block discarded – undo
7155 7155
             }
7156 7156
 
7157 7157
             $return .= '<tr>';
7158
-            $return .= '<td class="label"><label for="idPrerequisites">' . get_lang('LearnpathPrerequisites') . '</label></td>';
7159
-            $return .= '<td class="input"><select name="prerequisites" id="prerequisites"><option value="0">' . get_lang('NoPrerequisites') . '</option>';
7158
+            $return .= '<td class="label"><label for="idPrerequisites">'.get_lang('LearnpathPrerequisites').'</label></td>';
7159
+            $return .= '<td class="input"><select name="prerequisites" id="prerequisites"><option value="0">'.get_lang('NoPrerequisites').'</option>';
7160 7160
 
7161 7161
             foreach ($arrHide as $key => $value) {
7162 7162
                 if ($key == $s_selected_position && $action == 'add') {
7163
-                    $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7163
+                    $return .= '<option value="'.$key.'" selected="selected">'.$value['value'].'</option>';
7164 7164
                 }
7165 7165
                 elseif ($key == $id_prerequisite && $action == 'edit') {
7166
-                    $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7166
+                    $return .= '<option value="'.$key.'" selected="selected">'.$value['value'].'</option>';
7167 7167
                 } else {
7168
-                    $return .= '<option value="' . $key . '">' . $value['value'] . '</option>';
7168
+                    $return .= '<option value="'.$key.'">'.$value['value'].'</option>';
7169 7169
                 }
7170 7170
             }
7171 7171
             $return .= "</select></td>";
@@ -7179,19 +7179,19 @@  discard block
 block discarded – undo
7179 7179
         $return .= '</table>';
7180 7180
 
7181 7181
         if ($action == 'move') {
7182
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7183
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7182
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7183
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7184 7184
         }
7185 7185
 
7186 7186
         if (is_numeric($extra_info)) {
7187
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7187
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7188 7188
         }
7189 7189
         elseif (is_array($extra_info)) {
7190
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7190
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7191 7191
         }
7192 7192
 
7193
-        $return .= '<input name="type" type="hidden" value="' . TOOL_THREAD . '" />';
7194
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7193
+        $return .= '<input name="type" type="hidden" value="'.TOOL_THREAD.'" />';
7194
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7195 7195
         $return .= '</form>';
7196 7196
         $return .= '</div>';
7197 7197
 
@@ -7217,10 +7217,10 @@  discard block
 block discarded – undo
7217 7217
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
7218 7218
 
7219 7219
         if ($id != 0 && is_array($extra_info)) {
7220
-            $item_title 		= $extra_info['title'];
7221
-            $item_description 	= $extra_info['description'];
7222
-            $item_path = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7223
-            $item_path_fck = '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7220
+            $item_title = $extra_info['title'];
7221
+            $item_description = $extra_info['description'];
7222
+            $item_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7223
+            $item_path_fck = '/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7224 7224
         } else {
7225 7225
             $item_title = '';
7226 7226
             $item_description = '';
@@ -7234,17 +7234,17 @@  discard block
 block discarded – undo
7234 7234
         }
7235 7235
 
7236 7236
         $id  = intval($id);
7237
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7237
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7238 7238
                 WHERE
7239 7239
                     c_id = ".$course_id." AND
7240
-                    lp_id = " . $this->lp_id . " AND
7240
+                    lp_id = " . $this->lp_id." AND
7241 7241
                     id != $id";
7242 7242
 
7243 7243
         if ($item_type == 'module')
7244 7244
             $sql .= " AND parent_item_id = 0";
7245 7245
 
7246 7246
         $result = Database::query($sql);
7247
-        $arrLP = array ();
7247
+        $arrLP = array();
7248 7248
 
7249 7249
         while ($row = Database :: fetch_array($result)) {
7250 7250
             $arrLP[] = array(
@@ -7272,9 +7272,9 @@  discard block
 block discarded – undo
7272 7272
 
7273 7273
         $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
7274 7274
 
7275
-        $url = api_get_self() . '?' .api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7275
+        $url = api_get_self().'?'.api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7276 7276
 
7277
-        $form = new FormValidator('form', 'POST',  $url);
7277
+        $form = new FormValidator('form', 'POST', $url);
7278 7278
 
7279 7279
         $defaults['title'] = api_html_entity_decode($item_title, ENT_QUOTES, $charset);
7280 7280
         $defaults['description'] = $item_description;
@@ -7318,7 +7318,7 @@  discard block
 block discarded – undo
7318 7318
             $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', array('id' => 'idParent', 'onchange' => "javascript: load_cbo(this.value);"));
7319 7319
 
7320 7320
             foreach ($arrHide as $key => $value) {
7321
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7321
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7322 7322
             }
7323 7323
             if (!empty($s_selected_parent)) {
7324 7324
                 $parent_select->setSelected($s_selected_parent);
@@ -7340,16 +7340,16 @@  discard block
 block discarded – undo
7340 7340
                     $s_selected_position = $arrLP[$i]['id'];
7341 7341
                 }
7342 7342
 
7343
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7343
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7344 7344
             }
7345 7345
         }
7346 7346
 
7347 7347
         $position = $form->addElement('select', 'previous', get_lang('Position'), '', array('id' => 'previous'));
7348 7348
         $padding = isset($value['padding']) ? $value['padding'] : 0;
7349
-        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:' . $padding . 'px;"');
7349
+        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:'.$padding.'px;"');
7350 7350
 
7351 7351
         foreach ($arrHide as $key => $value) {
7352
-            $position->addOption($value['value'] . '"', $key, 'style="padding-left:' . $padding . 'px;"');
7352
+            $position->addOption($value['value'].'"', $key, 'style="padding-left:'.$padding.'px;"');
7353 7353
         }
7354 7354
 
7355 7355
         if (!empty ($s_selected_position)) {
@@ -7378,23 +7378,23 @@  discard block
 block discarded – undo
7378 7378
         //assets can't be modified
7379 7379
 
7380 7380
         //$item_type == 'asset' ||
7381
-        if (( $item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7381
+        if (($item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7382 7382
 
7383 7383
             if ($item_type == 'sco') {
7384
-                $form->addElement('html', '<script type="text/javascript">alert("' . get_lang('WarningWhenEditingScorm') . '")</script>');
7384
+                $form->addElement('html', '<script type="text/javascript">alert("'.get_lang('WarningWhenEditingScorm').'")</script>');
7385 7385
             }
7386 7386
             $renderer = $form->defaultRenderer();
7387 7387
             $renderer->setElementTemplate('<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{label}<br />{element}', 'content_lp');
7388 7388
 
7389 7389
             $relative_prefix = '';
7390 7390
 
7391
-            $editor_config = array( 'ToolbarSet' 			=> 'LearningPathDocuments',
7391
+            $editor_config = array('ToolbarSet' 			=> 'LearningPathDocuments',
7392 7392
                 'Width' 				=> '100%',
7393 7393
                 'Height' 				=> '500',
7394 7394
                 'FullPage' 				=> true,
7395 7395
                 'CreateDocumentDir' 	=> $relative_prefix,
7396
-                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/scorm/',
7397
-                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().$item_path_fck
7396
+                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/scorm/',
7397
+                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().$item_path_fck
7398 7398
             );
7399 7399
 
7400 7400
             $form->addElement('html_editor', 'content_lp', '', null, $editor_config);
@@ -7403,7 +7403,7 @@  discard block
 block discarded – undo
7403 7403
             $defaults['content_lp'] = file_get_contents($content_path);
7404 7404
         }
7405 7405
 
7406
-        $form->addElement('hidden', 'type', 'dokeos_' . $item_type);
7406
+        $form->addElement('hidden', 'type', 'dokeos_'.$item_type);
7407 7407
         $form->addElement('hidden', 'post_time', time());
7408 7408
         $form->setDefaults($defaults);
7409 7409
         return $form->return_form();
@@ -7441,8 +7441,8 @@  discard block
 block discarded – undo
7441 7441
         // We don't display the document form if it's not an editable document (html or txt file).
7442 7442
         if ($action == "add") {
7443 7443
             if (is_numeric($extra_info)) {
7444
-                $sql_doc = "SELECT path FROM " . $tbl_doc . "
7445
-                            WHERE c_id = ".$course_id." AND id = " . intval($extra_info);
7444
+                $sql_doc = "SELECT path FROM ".$tbl_doc."
7445
+                            WHERE c_id = ".$course_id." AND id = ".intval($extra_info);
7446 7446
                 $result = Database::query($sql_doc);
7447 7447
                 $path_file = Database :: result($result, 0, 0);
7448 7448
                 $path_parts = pathinfo($path_file);
@@ -7460,13 +7460,13 @@  discard block
 block discarded – undo
7460 7460
                 $item_title = stripslashes($path_parts['filename']);
7461 7461
             }
7462 7462
         } elseif (is_numeric($extra_info)) {
7463
-            $sql_doc = "SELECT path, title FROM " . $tbl_doc . "
7463
+            $sql_doc = "SELECT path, title FROM ".$tbl_doc."
7464 7464
                         WHERE
7465 7465
                             c_id = ".$course_id." AND
7466 7466
                             id = " . intval($extra_info);
7467 7467
 
7468 7468
             $result = Database::query($sql_doc);
7469
-            $row 	= Database::fetch_array($result);
7469
+            $row = Database::fetch_array($result);
7470 7470
             $item_title = $row['title'];
7471 7471
             $item_title = str_replace('_', ' ', $item_title);
7472 7472
             if (empty ($item_title)) {
@@ -7485,11 +7485,11 @@  discard block
 block discarded – undo
7485 7485
             $parent = 0;
7486 7486
         }
7487 7487
 
7488
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7489
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7488
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7489
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7490 7490
 
7491 7491
         $result = Database::query($sql);
7492
-        $arrLP = array ();
7492
+        $arrLP = array();
7493 7493
         while ($row = Database :: fetch_array($result)) {
7494 7494
             $arrLP[] = array(
7495 7495
                 'id' => $row['id'],
@@ -7523,9 +7523,9 @@  discard block
 block discarded – undo
7523 7523
         $return .= '</legend>';
7524 7524
 
7525 7525
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
7526
-            $return .= Display :: return_warning_message('<strong>' . get_lang('Warning') . ' !</strong><br />' . get_lang('WarningEditingDocument'), false);
7526
+            $return .= Display :: return_warning_message('<strong>'.get_lang('Warning').' !</strong><br />'.get_lang('WarningEditingDocument'), false);
7527 7527
         }
7528
-        $form = new FormValidator('form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7528
+        $form = new FormValidator('form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7529 7529
         $defaults['title'] = Security :: remove_XSS($item_title);
7530 7530
         if (empty($item_title)) {
7531 7531
             $defaults['title'] = Security::remove_XSS($item_title);
@@ -7561,15 +7561,15 @@  discard block
 block discarded – undo
7561 7561
         }
7562 7562
 
7563 7563
         $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', 'class="form-control" id="idParent" " onchange="javascript: load_cbo(this.value);"');
7564
-        $my_count=0;
7564
+        $my_count = 0;
7565 7565
         foreach ($arrHide as $key => $value) {
7566
-            if ($my_count!=0) {
7566
+            if ($my_count != 0) {
7567 7567
                 // The LP name is also the first section and is not in the same charset like the other sections.
7568 7568
                 $value['value'] = Security :: remove_XSS($value['value']);
7569
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7569
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7570 7570
             } else {
7571 7571
                 $value['value'] = Security :: remove_XSS($value['value']);
7572
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7572
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7573 7573
             }
7574 7574
             $my_count++;
7575 7575
         }
@@ -7577,7 +7577,7 @@  discard block
 block discarded – undo
7577 7577
         if (!empty($id)) {
7578 7578
             $parent_select->setSelected($parent);
7579 7579
         } else {
7580
-            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0 ;
7580
+            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0;
7581 7581
             $parent_select->setSelected($parent_item_id);
7582 7582
         }
7583 7583
 
@@ -7594,7 +7594,7 @@  discard block
 block discarded – undo
7594 7594
                 if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7595 7595
                     $s_selected_position = $arrLP[$i]['id'];
7596 7596
                 elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id'];
7597
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7597
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7598 7598
             }
7599 7599
         }
7600 7600
 
@@ -7602,8 +7602,8 @@  discard block
 block discarded – undo
7602 7602
         $position->addOption(get_lang('FirstPosition'), 0);
7603 7603
 
7604 7604
         foreach ($arrHide as $key => $value) {
7605
-            $padding = isset($value['padding']) ? $value['padding']: 0;
7606
-            $position->addOption($value['value'], $key, 'style="padding-left:' . $padding . 'px;"');
7605
+            $padding = isset($value['padding']) ? $value['padding'] : 0;
7606
+            $position->addOption($value['value'], $key, 'style="padding-left:'.$padding.'px;"');
7607 7607
         }
7608 7608
         $position->setSelected($s_selected_position);
7609 7609
 
@@ -7673,7 +7673,7 @@  discard block
 block discarded – undo
7673 7673
                             $relative_path 	 = array_slice($relative_path, 1, $cnt);
7674 7674
                             $relative_path 	 = implode('/', $relative_path);
7675 7675
                             if (strlen($relative_path) > 0) {
7676
-                                $relative_path = $relative_path . '/';
7676
+                                $relative_path = $relative_path.'/';
7677 7677
                             }
7678 7678
                         } else {
7679 7679
                             $result = $this->generate_lp_folder($_course);
@@ -7687,8 +7687,8 @@  discard block
 block discarded – undo
7687 7687
                             'Height' 				=> '500',
7688 7688
                             'FullPage' 				=> true,
7689 7689
                             'CreateDocumentDir' 	=> $relative_prefix,
7690
-                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/',
7691
-                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/'.$relative_path
7690
+                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
7691
+                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/'.$relative_path
7692 7692
                         );
7693 7693
 
7694 7694
                         if ($_GET['action'] == 'add_item') {
@@ -7755,8 +7755,8 @@  discard block
 block discarded – undo
7755 7755
             $item_url = stripslashes($extra_info['url']);
7756 7756
         } elseif (is_numeric($extra_info)) {
7757 7757
             $extra_info = intval($extra_info);
7758
-            $sql = "SELECT title, description, url FROM " . $tbl_link . "
7759
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
7758
+            $sql = "SELECT title, description, url FROM ".$tbl_link."
7759
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
7760 7760
             $result = Database::query($sql);
7761 7761
             $row = Database :: fetch_array($result);
7762 7762
             $item_title       = $row['title'];
@@ -7776,8 +7776,8 @@  discard block
 block discarded – undo
7776 7776
             $parent = 0;
7777 7777
         }
7778 7778
 
7779
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7780
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7779
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7780
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7781 7781
         $result = Database::query($sql);
7782 7782
         $arrLP = array();
7783 7783
 
@@ -7804,10 +7804,10 @@  discard block
 block discarded – undo
7804 7804
         unset ($this->arrMenu);
7805 7805
 
7806 7806
         if ($action == 'add')
7807
-            $legend .= get_lang('CreateTheLink') . '&nbsp;:';
7808
-        elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink') . '&nbsp;:';
7807
+            $legend .= get_lang('CreateTheLink').'&nbsp;:';
7808
+        elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink').'&nbsp;:';
7809 7809
         else
7810
-            $legend .= get_lang('EditCurrentLink') . '&nbsp;:';
7810
+            $legend .= get_lang('EditCurrentLink').'&nbsp;:';
7811 7811
 
7812 7812
         $legend .= '</legend>';
7813 7813
 
@@ -7818,16 +7818,16 @@  discard block
 block discarded – undo
7818 7818
 
7819 7819
         if ($action != 'move') {
7820 7820
             $return .= '<tr>';
7821
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
7822
-            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="' . $item_title . '" class="learnpath_item_form"/></td>';
7821
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
7822
+            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="'.$item_title.'" class="learnpath_item_form"/></td>';
7823 7823
             $return .= '</tr>';
7824 7824
         }
7825 7825
 
7826 7826
         $return .= '<tr>';
7827
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
7827
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
7828 7828
         $return .= '<td class="input">';
7829 7829
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" class="learnpath_item_form" size="1">';
7830
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
7830
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
7831 7831
         $arrHide = array(
7832 7832
             $id
7833 7833
         );
@@ -7837,13 +7837,13 @@  discard block
 block discarded – undo
7837 7837
         for ($i = 0; $i < count($arrLP); $i++) {
7838 7838
             if ($action != 'add') {
7839 7839
                 if (($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') && !in_array($arrLP[$i]['id'], $arrHide) && !in_array($arrLP[$i]['parent_item_id'], $arrHide)) {
7840
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7840
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7841 7841
                 } else {
7842 7842
                     $arrHide[] = $arrLP[$i]['id'];
7843 7843
                 }
7844 7844
             } else {
7845 7845
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
7846
-                    $return .= '<option ' . (($parent_item_id == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7846
+                    $return .= '<option '.(($parent_item_id == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7847 7847
             }
7848 7848
         }
7849 7849
 
@@ -7855,11 +7855,11 @@  discard block
 block discarded – undo
7855 7855
         $return .= '</td>';
7856 7856
         $return .= '</tr>';
7857 7857
         $return .= '<tr>';
7858
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
7858
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
7859 7859
         $return .= '<td class="input">';
7860 7860
 
7861 7861
         $return .= '<select id="previous" name="previous" style="width:100%;" size="1" class="learnpath_item_form">';
7862
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7862
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
7863 7863
         for ($i = 0; $i < count($arrLP); $i++) {
7864 7864
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7865 7865
                 if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -7869,7 +7869,7 @@  discard block
 block discarded – undo
7869 7869
                 else
7870 7870
                     $selected = '';
7871 7871
 
7872
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7872
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
7873 7873
             }
7874 7874
         }
7875 7875
         $return .= '</select>';
@@ -7878,8 +7878,8 @@  discard block
 block discarded – undo
7878 7878
 
7879 7879
         if ($action != 'move') {
7880 7880
             $return .= '<tr>';
7881
-            $return .= '<td class="label"><label for="idURL">' . get_lang('Url') . '</label></td>';
7882
-            $return .= '<td class="input"><input' . (is_numeric($extra_info) ? ' disabled="disabled"' : '') . ' id="idURL" name="url" style="width:99%;" type="text" value="' . $item_url . '" class="learnpath_item_form" /></td>';
7881
+            $return .= '<td class="label"><label for="idURL">'.get_lang('Url').'</label></td>';
7882
+            $return .= '<td class="input"><input'.(is_numeric($extra_info) ? ' disabled="disabled"' : '').' id="idURL" name="url" style="width:99%;" type="text" value="'.$item_url.'" class="learnpath_item_form" /></td>';
7883 7883
             $return .= '</tr>';
7884 7884
             $id_prerequisite = 0;
7885 7885
             if (is_array($arrLP)) {
@@ -7906,25 +7906,25 @@  discard block
 block discarded – undo
7906 7906
 
7907 7907
         $return .= '<tr>';
7908 7908
         if ($action == 'add') {
7909
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('AddLinkToCourse') . '</button></td>';
7909
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('AddLinkToCourse').'</button></td>';
7910 7910
         } else {
7911
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('EditCurrentLink') . '</button></td>';
7911
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('EditCurrentLink').'</button></td>';
7912 7912
         }
7913 7913
         $return .= '</tr>';
7914 7914
         $return .= '</table>';
7915 7915
 
7916 7916
         if ($action == 'move') {
7917
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7918
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7917
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7918
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7919 7919
         }
7920 7920
 
7921 7921
         if (is_numeric($extra_info)) {
7922
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7922
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7923 7923
         } elseif (is_array($extra_info)) {
7924
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7924
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7925 7925
         }
7926
-        $return .= '<input name="type" type="hidden" value="' . TOOL_LINK . '" />';
7927
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7926
+        $return .= '<input name="type" type="hidden" value="'.TOOL_LINK.'" />';
7927
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7928 7928
         $return .= '</form>';
7929 7929
         $return .= '</div>';
7930 7930
 
@@ -7950,8 +7950,8 @@  discard block
 block discarded – undo
7950 7950
         } elseif (is_numeric($extra_info)) {
7951 7951
             $extra_info = intval($extra_info);
7952 7952
             $sql = "SELECT title, description
7953
-                    FROM " . $tbl_publication . "
7954
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
7953
+                    FROM " . $tbl_publication."
7954
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
7955 7955
 
7956 7956
             $result = Database::query($sql);
7957 7957
             $row = Database :: fetch_array($result);
@@ -7967,13 +7967,13 @@  discard block
 block discarded – undo
7967 7967
             $parent = 0;
7968 7968
         }
7969 7969
 
7970
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7971
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7970
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7971
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7972 7972
 
7973 7973
         $result = Database::query($sql);
7974 7974
         $arrLP = array();
7975 7975
         while ($row = Database :: fetch_array($result)) {
7976
-            $arrLP[] = array (
7976
+            $arrLP[] = array(
7977 7977
                 'id' => $row['id'],
7978 7978
                 'item_type' => $row['item_type'],
7979 7979
                 'title' => $row['title'],
@@ -8019,7 +8019,7 @@  discard block
 block discarded – undo
8019 8019
             ]
8020 8020
         );
8021 8021
 
8022
-        $arrHide = array (
8022
+        $arrHide = array(
8023 8023
             $id
8024 8024
         );
8025 8025
 
@@ -8037,7 +8037,7 @@  discard block
 block discarded – undo
8037 8037
                     $parentSelect->addOption(
8038 8038
                         $arrLP[$i]['title'],
8039 8039
                         $arrLP[$i]['id'],
8040
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8040
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8041 8041
                     );
8042 8042
 
8043 8043
                     if ($parent == $arrLP[$i]['id']) {
@@ -8054,7 +8054,7 @@  discard block
 block discarded – undo
8054 8054
                     $parentSelect->addOption(
8055 8055
                         $arrLP[$i]['title'],
8056 8056
                         $arrLP[$i]['id'],
8057
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8057
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8058 8058
                     );
8059 8059
 
8060 8060
                     if ($parent == $arrLP[$i]['id']) {
@@ -8078,7 +8078,7 @@  discard block
 block discarded – undo
8078 8078
         for ($i = 0; $i < count($arrLP); $i++) {
8079 8079
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
8080 8080
                 $previousSelect->addOption(
8081
-                    get_lang('After') . ' "' . $arrLP[$i]['title'] . '"',
8081
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"',
8082 8082
                     $arrLP[$i]['id']
8083 8083
                 );
8084 8084
 
@@ -8100,7 +8100,7 @@  discard block
 block discarded – undo
8100 8100
                     }
8101 8101
                 }
8102 8102
             }
8103
-            $arrHide = array ();
8103
+            $arrHide = array();
8104 8104
             for ($i = 0; $i < count($arrLP); $i++) {
8105 8105
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
8106 8106
                     if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -8192,8 +8192,8 @@  discard block
 block discarded – undo
8192 8192
 
8193 8193
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8194 8194
         $item_id = intval($item_id);
8195
-        $sql = "SELECT * FROM " . $tbl_lp_item . " as lp
8196
-                WHERE lp.c_id = ".$course_id." AND lp.id = " . $item_id;
8195
+        $sql = "SELECT * FROM ".$tbl_lp_item." as lp
8196
+                WHERE lp.c_id = ".$course_id." AND lp.id = ".$item_id;
8197 8197
         $result = Database::query($sql);
8198 8198
         $row = Database::fetch_assoc($result);
8199 8199
 
@@ -8207,16 +8207,16 @@  discard block
 block discarded – undo
8207 8207
             $audio_player .= '<script>
8208 8208
                                 var s1 = new SWFObject("../inc/lib/mediaplayer/player.swf","ply","250","20","9","#FFFFFF");
8209 8209
                                 s1.addParam("allowscriptaccess","always");
8210
-                                s1.addParam("flashvars","file=../../courses/' . $_course['path'] . '/document/audio/' . $row['audio'] . '&autostart=true");
8210
+                                s1.addParam("flashvars","file=../../courses/' . $_course['path'].'/document/audio/'.$row['audio'].'&autostart=true");
8211 8211
                                 s1.write("container");
8212 8212
                             </script>';
8213 8213
         }
8214 8214
 
8215
-        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id .'&lp_id='.$this->lp_id;
8215
+        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id.'&lp_id='.$this->lp_id;
8216 8216
 
8217 8217
         $return .= Display::url(
8218 8218
             Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL),
8219
-            $url.'&action=edit_item&path_item=' . $row['path']
8219
+            $url.'&action=edit_item&path_item='.$row['path']
8220 8220
         );
8221 8221
 
8222 8222
         $return .= Display::url(
@@ -8236,12 +8236,12 @@  discard block
 block discarded – undo
8236 8236
             $url.'&action=delete_item'
8237 8237
         );
8238 8238
 
8239
-        if ($item_type == TOOL_HOTPOTATOES ) {
8239
+        if ($item_type == TOOL_HOTPOTATOES) {
8240 8240
             $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code);
8241 8241
             $return .= get_lang('File').': '.$document_data['absolute_path_from_document'];
8242 8242
         }
8243 8243
 
8244
-        if ($item_type == TOOL_DOCUMENT ) {
8244
+        if ($item_type == TOOL_DOCUMENT) {
8245 8245
             $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code);
8246 8246
             $return .= get_lang('File').': '.$document_data['absolute_path_from_document'];
8247 8247
         }
@@ -8262,13 +8262,13 @@  discard block
 block discarded – undo
8262 8262
     public function get_js_dropdown_array()
8263 8263
     {
8264 8264
         $course_id = api_get_course_int_id();
8265
-        $return = 'var child_name = new Array();' . "\n";
8266
-        $return .= 'var child_value = new Array();' . "\n\n";
8267
-        $return .= 'child_name[0] = new Array();' . "\n";
8268
-        $return .= 'child_value[0] = new Array();' . "\n\n";
8265
+        $return = 'var child_name = new Array();'."\n";
8266
+        $return .= 'var child_value = new Array();'."\n\n";
8267
+        $return .= 'child_name[0] = new Array();'."\n";
8268
+        $return .= 'child_value[0] = new Array();'."\n\n";
8269 8269
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8270
-        $sql_zero = "SELECT * FROM " . $tbl_lp_item . "
8271
-                    WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id . " AND parent_item_id = 0
8270
+        $sql_zero = "SELECT * FROM ".$tbl_lp_item."
8271
+                    WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id." AND parent_item_id = 0
8272 8272
                     ORDER BY display_order ASC";
8273 8273
         $res_zero = Database::query($sql_zero);
8274 8274
         $i = 0;
@@ -8278,28 +8278,28 @@  discard block
 block discarded – undo
8278 8278
                 $row_zero['title'] = Exercise::get_formated_title_variable($row_zero['title']);
8279 8279
             }
8280 8280
             $js_var = json_encode(get_lang('After').' '.$row_zero['title']);
8281
-            $return .= 'child_name[0][' . $i . '] = '.$js_var.' ;' . "\n";
8282
-            $return .= 'child_value[0][' . $i++ . '] = "' . $row_zero['id'] . '";' . "\n";
8281
+            $return .= 'child_name[0]['.$i.'] = '.$js_var.' ;'."\n";
8282
+            $return .= 'child_value[0]['.$i++.'] = "'.$row_zero['id'].'";'."\n";
8283 8283
         }
8284 8284
         $return .= "\n";
8285
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
8286
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
8285
+        $sql = "SELECT * FROM ".$tbl_lp_item."
8286
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
8287 8287
         $res = Database::query($sql);
8288 8288
         while ($row = Database :: fetch_array($res)) {
8289
-            $sql_parent = "SELECT * FROM " . $tbl_lp_item . "
8289
+            $sql_parent = "SELECT * FROM ".$tbl_lp_item."
8290 8290
                            WHERE
8291 8291
                                 c_id = ".$course_id." AND
8292
-                                parent_item_id = " . $row['id'] . "
8292
+                                parent_item_id = " . $row['id']."
8293 8293
                            ORDER BY display_order ASC";
8294 8294
             $res_parent = Database::query($sql_parent);
8295 8295
             $i = 0;
8296
-            $return .= 'child_name[' . $row['id'] . '] = new Array();' . "\n";
8297
-            $return .= 'child_value[' . $row['id'] . '] = new Array();' . "\n\n";
8296
+            $return .= 'child_name['.$row['id'].'] = new Array();'."\n";
8297
+            $return .= 'child_value['.$row['id'].'] = new Array();'."\n\n";
8298 8298
 
8299 8299
             while ($row_parent = Database :: fetch_array($res_parent)) {
8300 8300
                 $js_var = json_encode(get_lang('After').' '.$row_parent['title']);
8301
-                $return .= 'child_name[' . $row['id'] . '][' . $i . '] =   '.$js_var.' ;' . "\n";
8302
-                $return .= 'child_value[' . $row['id'] . '][' . $i++ . '] = "' . $row_parent['id'] . '";' . "\n";
8301
+                $return .= 'child_name['.$row['id'].']['.$i.'] =   '.$js_var.' ;'."\n";
8302
+                $return .= 'child_value['.$row['id'].']['.$i++.'] = "'.$row_parent['id'].'";'."\n";
8303 8303
             }
8304 8304
             $return .= "\n";
8305 8305
         }
@@ -8320,8 +8320,8 @@  discard block
 block discarded – undo
8320 8320
         if (is_numeric($item_id)) {
8321 8321
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8322 8322
 
8323
-            $sql = "SELECT * FROM " . $tbl_lp_item . "
8324
-                    WHERE c_id = ".$course_id." AND id = " . $item_id;
8323
+            $sql = "SELECT * FROM ".$tbl_lp_item."
8324
+                    WHERE c_id = ".$course_id." AND id = ".$item_id;
8325 8325
 
8326 8326
             $res = Database::query($sql);
8327 8327
             $row = Database :: fetch_array($res);
@@ -8380,7 +8380,7 @@  discard block
 block discarded – undo
8380 8380
      */
8381 8381
     public function display_item_small_form($item_type, $title = '', $data = array())
8382 8382
     {
8383
-        $url = api_get_self() . '?' .api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8383
+        $url = api_get_self().'?'.api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8384 8384
         $form = new FormValidator('small_form', 'post', $url);
8385 8385
         $form->addElement('header', $title);
8386 8386
         $form->addElement('text', 'title', get_lang('Title'));
@@ -8406,7 +8406,7 @@  discard block
 block discarded – undo
8406 8406
         $item_id = intval($item_id);
8407 8407
         /* Current prerequisite */
8408 8408
         $sql = "SELECT * FROM $tbl_lp_item
8409
-                WHERE c_id = $course_id AND id = " . $item_id;
8409
+                WHERE c_id = $course_id AND id = ".$item_id;
8410 8410
         $result = Database::query($sql);
8411 8411
         $row    = Database::fetch_array($result);
8412 8412
         $prerequisiteId = $row['prerequisite'];
@@ -8416,20 +8416,20 @@  discard block
 block discarded – undo
8416 8416
         $return .= '<form method="POST">';
8417 8417
         $return .= '<table class="data_table">';
8418 8418
         $return .= '<tr>';
8419
-        $return .= '<th height="24">' . get_lang('LearnpathPrerequisites') . '</th>';
8420
-        $return .= '<th width="70" >' . get_lang('Minimum') . '</th>';
8421
-        $return .= '<th width="70">' . get_lang('Maximum') . '</th>';
8419
+        $return .= '<th height="24">'.get_lang('LearnpathPrerequisites').'</th>';
8420
+        $return .= '<th width="70" >'.get_lang('Minimum').'</th>';
8421
+        $return .= '<th width="70">'.get_lang('Maximum').'</th>';
8422 8422
         $return .= '</tr>';
8423 8423
 
8424 8424
         // Adding the none option to the prerequisites see http://www.chamilo.org/es/node/146
8425 8425
         $return .= '<tr >';
8426 8426
         $return .= '<td colspan="3" class="radio">';
8427 8427
         $return .= '<input checked="checked" id="idNone" name="prerequisites"  style="margin-left:0px; margin-right:10px;" type="radio" />';
8428
-        $return .= '<label for="idNone">' . get_lang('None') . '</label>';
8428
+        $return .= '<label for="idNone">'.get_lang('None').'</label>';
8429 8429
         $return .= '</tr>';
8430 8430
 
8431 8431
         $sql = "SELECT * FROM $tbl_lp_item
8432
-                WHERE c_id = $course_id AND lp_id = " . $this->lp_id;
8432
+                WHERE c_id = $course_id AND lp_id = ".$this->lp_id;
8433 8433
         $result = Database::query($sql);
8434 8434
         $arrLP = array();
8435 8435
 
@@ -8472,25 +8472,25 @@  discard block
 block discarded – undo
8472 8472
             }
8473 8473
 
8474 8474
             $selectedMaxScoreValue = isset($selectedMaxScore[$item['id']]) ? $selectedMaxScore[$item['id']] : $item['max_score'];
8475
-            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']]: 0;
8475
+            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']] : 0;
8476 8476
 
8477 8477
             $return .= '<tr>';
8478
-            $return .= '<td class="radio"' . (($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '') . '>';
8479
-            $return .= '<label for="id' . $item['id'] . '">';
8480
-            $return .= '<input' . (in_array($prerequisiteId, array($item['id'], $item['ref'])) ? ' checked="checked" ' : '') . (($item['item_type'] == 'dokeos_module' || $item['item_type'] == 'dokeos_chapter') ? ' disabled="disabled" ' : ' ') . 'id="id' . $item['id'] . '" name="prerequisites" style="margin-left:' . $item['depth'] * 10 . 'px; margin-right:10px;" type="radio" value="' . $item['id'] . '" />';
8478
+            $return .= '<td class="radio"'.(($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '').'>';
8479
+            $return .= '<label for="id'.$item['id'].'">';
8480
+            $return .= '<input'.(in_array($prerequisiteId, array($item['id'], $item['ref'])) ? ' checked="checked" ' : '').(($item['item_type'] == 'dokeos_module' || $item['item_type'] == 'dokeos_chapter') ? ' disabled="disabled" ' : ' ').'id="id'.$item['id'].'" name="prerequisites" style="margin-left:'.$item['depth'] * 10.'px; margin-right:10px;" type="radio" value="'.$item['id'].'" />';
8481 8481
             $icon_name = str_replace(' ', '', $item['item_type']);
8482 8482
 
8483
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
8484
-                $return .= Display::return_icon('lp_' . $icon_name . '.png');
8483
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
8484
+                $return .= Display::return_icon('lp_'.$icon_name.'.png');
8485 8485
             } else {
8486
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
8487
-                    $return .= Display::return_icon('lp_' . $icon_name . '.gif');
8486
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
8487
+                    $return .= Display::return_icon('lp_'.$icon_name.'.gif');
8488 8488
                 } else {
8489 8489
                     $return .= Display::return_icon('folder_document.gif', '', array('style'=>'margin-right:5px;'));
8490 8490
                 }
8491 8491
             }
8492 8492
 
8493
-            $return .=  $item['title'] . '</label>';
8493
+            $return .= $item['title'].'</label>';
8494 8494
             $return .= '</td>';
8495 8495
 
8496 8496
             if ($item['item_type'] == TOOL_QUIZ) {
@@ -8504,19 +8504,19 @@  discard block
 block discarded – undo
8504 8504
                 $item['max_score'] = $tmp_obj_lp_item->max_score;
8505 8505
 
8506 8506
                 $return .= '<td class="exercise">';
8507
-                $return .= '<input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue. '" />';
8507
+                $return .= '<input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" />';
8508 8508
                 $return .= '</td>';
8509 8509
                 $return .= '<td class="exercise">';
8510
-                $return .= '<input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMaxScoreValue . '" />';
8510
+                $return .= '<input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMaxScoreValue.'" />';
8511 8511
                 $return .= '</td>';
8512 8512
             }
8513 8513
 
8514 8514
             if ($item['item_type'] == TOOL_HOTPOTATOES) {
8515 8515
                 $return .= '<td class="exercise">';
8516
-                $return .= '<center><input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue . '" /></center>';
8516
+                $return .= '<center><input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" /></center>';
8517 8517
                 $return .= '</td>';
8518 8518
                 $return .= '<td class="exercise"">';
8519
-                $return .= '<center><input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue . '" /></center>';
8519
+                $return .= '<center><input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue.'" /></center>';
8520 8520
                 $return .= '</td>';
8521 8521
             }
8522 8522
             $return .= '</tr>';
@@ -8525,7 +8525,7 @@  discard block
 block discarded – undo
8525 8525
         $return .= '</tr>';
8526 8526
         $return .= '</table>';
8527 8527
         $return .= '<div style="padding-top:3px;">';
8528
-        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">' . get_lang('ModifyPrerequisites') . '</button>';
8528
+        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">'.get_lang('ModifyPrerequisites').'</button>';
8529 8529
         $return .= '</form>';
8530 8530
 
8531 8531
         return $return;
@@ -8561,7 +8561,7 @@  discard block
 block discarded – undo
8561 8561
                 if ($row['id'] == $lp_id) {
8562 8562
                     continue;
8563 8563
                 }
8564
-                $return .= '<option value="'.$row['id'].'" '.(($row['id']==$prerequisiteId)?' selected ' : '').'>'.$row['name'].'</option>';
8564
+                $return .= '<option value="'.$row['id'].'" '.(($row['id'] == $prerequisiteId) ? ' selected ' : '').'>'.$row['name'].'</option>';
8565 8565
             }
8566 8566
         }
8567 8567
         $return .= '</select>';
@@ -8621,8 +8621,8 @@  discard block
 block discarded – undo
8621 8621
                      WHERE c_id = $course_id AND $activeCondition $condition_session
8622 8622
                      ORDER BY title ASC";
8623 8623
 
8624
-        $sql_hot  = "SELECT * FROM $tbl_doc
8625
-                     WHERE c_id = $course_id AND path LIKE '" . $uploadPath . "/%/%htm%'  $condition_session
8624
+        $sql_hot = "SELECT * FROM $tbl_doc
8625
+                     WHERE c_id = $course_id AND path LIKE '".$uploadPath."/%/%htm%'  $condition_session
8626 8626
                      ORDER BY id ASC";
8627 8627
 
8628 8628
         $res_quiz = Database::query($sql_quiz);
@@ -8631,8 +8631,8 @@  discard block
 block discarded – undo
8631 8631
         $return = '<ul class="lp_resource">';
8632 8632
         $return .= '<li class="lp_resource_element">';
8633 8633
         $return .= Display::return_icon('new_test_small.gif');
8634
-        $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id=' . $this->lp_id . '">' .
8635
-            get_lang('NewExercise') . '</a>';
8634
+        $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id='.$this->lp_id.'">'.
8635
+            get_lang('NewExercise').'</a>';
8636 8636
         $return .= '</li>';
8637 8637
 
8638 8638
         // Display hotpotatoes
@@ -8644,8 +8644,8 @@  discard block
 block discarded – undo
8644 8644
             $return .= '</a> ';
8645 8645
 
8646 8646
             $return .= Display::return_icon('hotpotatoes_s.png');
8647
-            $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq().'&action=add_item&type=' . TOOL_HOTPOTATOES . '&file=' . $row_hot['id'] . '&lp_id=' . $this->lp_id . '">'.
8648
-                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])) . '</a>';
8647
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_HOTPOTATOES.'&file='.$row_hot['id'].'&lp_id='.$this->lp_id.'">'.
8648
+                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])).'</a>';
8649 8649
             $return .= '</li>';
8650 8650
         }
8651 8651
 
@@ -8655,7 +8655,7 @@  discard block
 block discarded – undo
8655 8655
             $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8656 8656
             $return .= '</a> ';
8657 8657
             $return .= Display::return_icon('quizz_small.gif', '', array(), ICON_SIZE_TINY);
8658
-            $return .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&action=add_item&type=' . TOOL_QUIZ . '&file=' . $row_quiz['id'] . '&lp_id=' . $this->lp_id . '">' .
8658
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_QUIZ.'&file='.$row_quiz['id'].'&lp_id='.$this->lp_id.'">'.
8659 8659
                 Security :: remove_XSS(cut($row_quiz['title'], 80)).
8660 8660
                 '</a>';
8661 8661
             $return .= '</li>';
@@ -8729,7 +8729,7 @@  discard block
 block discarded – undo
8729 8729
         foreach ($categorizedLinks as $categoryId => $links) {
8730 8730
             $linkNodes = null;
8731 8731
             foreach ($links as $key => $title) {
8732
-                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2)  {
8732
+                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2) {
8733 8733
                     $linkNodes .=
8734 8734
                         '<li class="lp_resource_element" data_id="'.$key.'" data_type="'.TOOL_LINK.'" title="'.$title.'" >
8735 8735
                         <a class="moved" href="#">'.
@@ -8767,7 +8767,7 @@  discard block
 block discarded – undo
8767 8767
         $return = '<div class="lp_resource" >';
8768 8768
         $return .= '<div class="lp_resource_element">';
8769 8769
         $return .= Display::return_icon('works_small.gif', '', array(), ICON_SIZE_TINY);
8770
-        $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=add_item&type=' . TOOL_STUDENTPUBLICATION . '&lp_id=' . $this->lp_id . '">' . get_lang('AddAssignmentPage') . '</a>';
8770
+        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_STUDENTPUBLICATION.'&lp_id='.$this->lp_id.'">'.get_lang('AddAssignmentPage').'</a>';
8771 8771
         $return .= '</div>';
8772 8772
         $return .= '</div>';
8773 8773
         return $return;
@@ -8788,7 +8788,7 @@  discard block
 block discarded – undo
8788 8788
         //First add link
8789 8789
         $return .= '<li class="lp_resource_element">';
8790 8790
         $return .= Display::return_icon('forum_new_small.gif');
8791
-        $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'forum/index.php?' . api_get_cidreq() . '&action=add&content=forum&origin=learnpath&lp_id=' . $this->lp_id . '" title="' . get_lang('CreateANewForum') . '">' . get_lang('CreateANewForum') . '</a>';
8791
+        $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq().'&action=add&content=forum&origin=learnpath&lp_id='.$this->lp_id.'" title="'.get_lang('CreateANewForum').'">'.get_lang('CreateANewForum').'</a>';
8792 8792
         $return .= '</li>';
8793 8793
 
8794 8794
         $return .= '<script>
@@ -8810,15 +8810,15 @@  discard block
 block discarded – undo
8810 8810
                 $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8811 8811
                 $return .= ' </a>';
8812 8812
                 $return .= Display::return_icon('lp_forum.png', '', array(), ICON_SIZE_TINY);
8813
-                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum(' . $forum['forum_id'] . ')" style="vertical-align:middle">
8814
-                                <img src="' . Display::returnIconPath('add.gif').'" id="forum_' . $forum['forum_id'] . '_opener" align="absbottom" />
8813
+                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum('.$forum['forum_id'].')" style="vertical-align:middle">
8814
+                                <img src="' . Display::returnIconPath('add.gif').'" id="forum_'.$forum['forum_id'].'_opener" align="absbottom" />
8815 8815
                             </a>
8816
-                            <a href="' . api_get_self() . '?'.api_get_cidreq().'&action=add_item&type=' . TOOL_FORUM . '&forum_id=' . $forum['forum_id'] . '&lp_id=' . $this->lp_id . '" style="vertical-align:middle">' .
8817
-                    Security :: remove_XSS($forum['forum_title']) . '</a>';
8816
+                            <a href="' . api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_FORUM.'&forum_id='.$forum['forum_id'].'&lp_id='.$this->lp_id.'" style="vertical-align:middle">'.
8817
+                    Security :: remove_XSS($forum['forum_title']).'</a>';
8818 8818
 
8819 8819
                 $return .= '</li>';
8820 8820
 
8821
-                $return .= '<div style="display:none" id="forum_' . $forum['forum_id'] . '_content">';
8821
+                $return .= '<div style="display:none" id="forum_'.$forum['forum_id'].'_content">';
8822 8822
                 $a_threads = get_threads($forum['forum_id']);
8823 8823
                 if (is_array($a_threads)) {
8824 8824
                     foreach ($a_threads as $thread) {
@@ -8827,8 +8827,8 @@  discard block
 block discarded – undo
8827 8827
                         $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8828 8828
                         $return .= ' </a>';
8829 8829
                         $return .= Display::return_icon('forumthread.png', get_lang('Thread'), array(), ICON_SIZE_TINY);
8830
-                        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type=' . TOOL_THREAD . '&thread_id=' . $thread['thread_id'] . '&lp_id=' . $this->lp_id . '">' .
8831
-                            Security :: remove_XSS($thread['thread_title']) . '</a>';
8830
+                        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_THREAD.'&thread_id='.$thread['thread_id'].'&lp_id='.$this->lp_id.'">'.
8831
+                            Security :: remove_XSS($thread['thread_title']).'</a>';
8832 8832
                         $return .= '</li>';
8833 8833
                     }
8834 8834
                 }
@@ -8899,7 +8899,7 @@  discard block
 block discarded – undo
8899 8899
         if (is_dir($current_course_path.'/scorm/'.$this->path) && is_file($current_course_path.'/scorm/'.$this->path.'/imsmanifest.xml')) {
8900 8900
             // Remove the possible . at the end of the path.
8901 8901
             $dest_path_to_lp = substr($this->path, -1) == '.' ? substr($this->path, 0, -1) : $this->path;
8902
-            $dest_path_to_scorm_folder = str_replace('//','/',$temp_zip_dir.'/scorm/'.$dest_path_to_lp);
8902
+            $dest_path_to_scorm_folder = str_replace('//', '/', $temp_zip_dir.'/scorm/'.$dest_path_to_lp);
8903 8903
             mkdir($dest_path_to_scorm_folder, api_get_permissions_for_new_directories(), true);
8904 8904
             $zip_files_dist = copyr($current_course_path.'/scorm/'.$this->path, $dest_path_to_scorm_folder, array('imsmanifest'), $zip_files);
8905 8905
         }
@@ -8967,7 +8967,7 @@  discard block
 block discarded – undo
8967 8967
                 if ($item->type == 'sco') {
8968 8968
                     $inc_docs = $item->get_resources_from_source(
8969 8969
                         null,
8970
-                        api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/' . 'scorm/' . $this->path . '/' . $item->get_path()
8970
+                        api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.'scorm/'.$this->path.'/'.$item->get_path()
8971 8971
                     );
8972 8972
                 } else {
8973 8973
                     $inc_docs = $item->get_resources_from_source();
@@ -9183,7 +9183,7 @@  discard block
 block discarded – undo
9183 9183
                                         $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9184 9184
                                         $zip_files[] = $my_sub_dir.'/'.$file_path;
9185 9185
                                         $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9186
-                                        $my_dep_file->setAttribute('href','document/'.$file_path);
9186
+                                        $my_dep_file->setAttribute('href', 'document/'.$file_path);
9187 9187
                                         $my_dep->setAttribute('xml:base', '');
9188 9188
                                     }
9189 9189
                                 }
@@ -9314,7 +9314,7 @@  discard block
 block discarded – undo
9314 9314
                         //$my_item->appendChild($my_max_score);
9315 9315
                         // Give a child element <adlcp:prerequisites> to the <item> element.
9316 9316
                         $my_prereqs = $xmldoc->createElement('adlcp:prerequisites', $item->get_prereq_string());
9317
-                        $my_prereqs->setAttribute('type','aicc_script');
9317
+                        $my_prereqs->setAttribute('type', 'aicc_script');
9318 9318
                         $my_item->appendChild($my_prereqs);
9319 9319
                         // Give a child element <adlcp:masteryscore> to the <item> element.
9320 9320
                         $my_masteryscore = $xmldoc->createElement('adlcp:masteryscore', $item->get_mastery_score());
@@ -9367,7 +9367,7 @@  discard block
 block discarded – undo
9367 9367
                         $my_resource->appendChild($my_file);
9368 9368
 
9369 9369
                         // Get included docs.
9370
-                        $inc_docs = $item->get_resources_from_source(null,$tmp_file_path);
9370
+                        $inc_docs = $item->get_resources_from_source(null, $tmp_file_path);
9371 9371
                         // Dependency to other files - not yet supported.
9372 9372
                         $i = 1;
9373 9373
                         foreach ($inc_docs as $doc_info) {
@@ -9428,7 +9428,7 @@  discard block
 block discarded – undo
9428 9428
                                         $my_dep_file->setAttribute('href', $file_path);
9429 9429
                                         $my_dep->setAttribute('xml:base', '');
9430 9430
 
9431
-                                        if (strstr($file_path,$main_path) !== false) {
9431
+                                        if (strstr($file_path, $main_path) !== false) {
9432 9432
                                             // The calculated real path is really inside the chamilo root path.
9433 9433
                                             // Reduce file path to what's under the DocumentRoot.
9434 9434
                                             $file_path = substr($file_path, strlen($root_path));
@@ -9446,7 +9446,7 @@  discard block
 block discarded – undo
9446 9446
                                             $file_path = $_SERVER['DOCUMENT_ROOT'].$doc_info[0];
9447 9447
                                             $file_path = str_replace('//', '/', $file_path);
9448 9448
                                             if (file_exists($file_path)) {
9449
-                                                $file_path = substr($file_path,strlen($current_dir)); // We get the relative path.
9449
+                                                $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9450 9450
                                                 $zip_files[] = $my_sub_dir.'/'.$file_path;
9451 9451
                                                 $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9452 9452
                                                 $my_dep_file->setAttribute('href', 'document/'.$file_path);
@@ -9675,7 +9675,7 @@  discard block
 block discarded – undo
9675 9675
             if (strpos($extra_file, '.') === 0)
9676 9676
                 continue;
9677 9677
             else {
9678
-                $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file;
9678
+                $dest_file = $archive_path.$temp_dir_short.'/'.$extra_file;
9679 9679
                 $this->create_path($dest_file);
9680 9680
                 copy($main_code_path.$extra_file, $dest_file);
9681 9681
             }
@@ -9728,7 +9728,7 @@  discard block
 block discarded – undo
9728 9728
                             }
9729 9729
                             $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$file_data['path'];
9730 9730
                             if (file_exists($file_path)) {
9731
-                                $files_to_export[] = array('title'=>$item->get_title(),'path'=>$file_path);
9731
+                                $files_to_export[] = array('title'=>$item->get_title(), 'path'=>$file_path);
9732 9732
                             }
9733 9733
                             break;
9734 9734
                         case 'asset': //commes from a scorm package generated by chamilo
@@ -9768,12 +9768,12 @@  discard block
 block discarded – undo
9768 9768
 
9769 9769
         foreach ($path_bits as $bit) {
9770 9770
             if (!empty ($bit)) {
9771
-                $new_path = $path_built . $bit;
9771
+                $new_path = $path_built.$bit;
9772 9772
                 if (is_dir($new_path)) {
9773
-                    $path_built = $new_path . '/';
9773
+                    $path_built = $new_path.'/';
9774 9774
                 } else {
9775 9775
                     mkdir($new_path, api_get_permissions_for_new_directories());
9776
-                    $path_built = $new_path . '/';
9776
+                    $path_built = $new_path.'/';
9777 9777
                 }
9778 9778
             }
9779 9779
         }
@@ -9817,9 +9817,9 @@  discard block
 block discarded – undo
9817 9817
 
9818 9818
         if ($upload_ok) {
9819 9819
             if ($has_attachment) {
9820
-                $courseDir = api_get_course_path() . '/upload/learning_path/images';
9820
+                $courseDir = api_get_course_path().'/upload/learning_path/images';
9821 9821
                 $sys_course_path = api_get_path(SYS_COURSE_PATH);
9822
-                $updir = $sys_course_path . $courseDir;
9822
+                $updir = $sys_course_path.$courseDir;
9823 9823
                 // Try to add an extension to the file if it hasn't one.
9824 9824
                 $new_file_name = add_ext_on_mime(stripslashes($image_array['name']), $image_array['type']);
9825 9825
 
@@ -9874,7 +9874,7 @@  discard block
 block discarded – undo
9874 9874
             //Setting my lp_id to autolaunch = 1
9875 9875
             $attributes['autolaunch'] = 1;
9876 9876
             $where = array('id = ? AND session_id = ? AND c_id = ?'=> array($lp_id, api_get_session_id(), $course_id));
9877
-            Database::update($lp_table, $attributes, $where );
9877
+            Database::update($lp_table, $attributes, $where);
9878 9878
         }
9879 9879
     }
9880 9880
 
@@ -9893,13 +9893,13 @@  discard block
 block discarded – undo
9893 9893
 
9894 9894
         // Get the max order of the items
9895 9895
         $sql_max_order = "SELECT max(display_order) AS display_order FROM $table_lp_item
9896
-    	                  WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "'";
9896
+    	                  WHERE c_id = $course_id AND lp_id = '".$this->lp_id."'";
9897 9897
         $rs_max_order = Database::query($sql_max_order);
9898 9898
         $row_max_order = Database::fetch_object($rs_max_order);
9899 9899
         $max_order = $row_max_order->display_order;
9900 9900
         // Get the previous item ID
9901 9901
         $sql = "SELECT id as previous FROM $table_lp_item
9902
-                WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "' AND display_order = '".$max_order."' ";
9902
+                WHERE c_id = $course_id AND lp_id = '".$this->lp_id."' AND display_order = '".$max_order."' ";
9903 9903
         $rs_max = Database::query($sql);
9904 9904
         $row_max = Database::fetch_object($rs_max);
9905 9905
 
@@ -9955,9 +9955,9 @@  discard block
 block discarded – undo
9955 9955
         $documents_total_space = DocumentManager::documents_total_space();
9956 9956
         $course_max_space = DocumentManager::get_course_quota();
9957 9957
         $total_size = filesize($s) + $documents_total_space;
9958
-        if (filesize($s)>$post_max || filesize($s)>$upl_max  || $total_size>$course_max_space ){
9958
+        if (filesize($s) > $post_max || filesize($s) > $upl_max || $total_size > $course_max_space) {
9959 9959
             return true;
9960
-        } else{
9960
+        } else {
9961 9961
             return false;
9962 9962
         }
9963 9963
     }
@@ -10297,7 +10297,7 @@  discard block
 block discarded – undo
10297 10297
         if ($this->debug > 0) {
10298 10298
             error_log('New LP - In learnpath::set_subscribe_users()', 0);
10299 10299
         }
10300
-        $this->subscribeUsers = intval($value);;
10300
+        $this->subscribeUsers = intval($value); ;
10301 10301
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
10302 10302
         $lp_id = $this->get_id();
10303 10303
         $sql = "UPDATE $lp_table SET subscribe_users = ".$this->subscribeUsers."
@@ -10643,7 +10643,7 @@  discard block
 block discarded – undo
10643 10643
      */
10644 10644
     public function createForum($forumCategoryId)
10645 10645
     {
10646
-        require_once api_get_path(SYS_CODE_PATH) . '/forum/forumfunction.inc.php';
10646
+        require_once api_get_path(SYS_CODE_PATH).'/forum/forumfunction.inc.php';
10647 10647
 
10648 10648
         $forumId = store_forum(
10649 10649
             [
Please login to merge, or discard this patch.
main/newscorm/learnpath_functions.inc.php 1 patch
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -60,6 +60,7 @@
 block discarded – undo
60 60
 /**
61 61
  * This function deletes an entire directory
62 62
  * @param	string	The directory path
63
+ * @param string $dir
63 64
  * @return boolean	True on success, false on failure
64 65
  */
65 66
 function deldir($dir) {
Please login to merge, or discard this patch.
main/newscorm/learnpathItem.class.php 2 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1869,7 +1869,7 @@  discard block
 block discarded – undo
1869 1869
 
1870 1870
     /**
1871 1871
      * Get the extra terms (tags) that identify this item
1872
-     * @return mixed
1872
+     * @return string
1873 1873
      */
1874 1874
     public function get_terms()
1875 1875
     {
@@ -2069,7 +2069,7 @@  discard block
 block discarded – undo
2069 2069
 
2070 2070
     /**
2071 2071
      * Opens/launches the item. Initialises runtime values.
2072
-     * @return    boolean    True on success, false on failure.
2072
+     * @return    boolean|null    True on success, false on failure.
2073 2073
      */
2074 2074
     public function open($allow_new_attempt = false)
2075 2075
     {
@@ -3494,7 +3494,7 @@  discard block
 block discarded – undo
3494 3494
 
3495 3495
     /**
3496 3496
      * Checks if the current status is part of the list of status given
3497
-     * @param  array  $list  An array of status to check for.
3497
+     * @param  string[]  $list  An array of status to check for.
3498 3498
      * If the current status is one of the strings, return true
3499 3499
      *
3500 3500
      * @return boolean True if the status was one of the given strings,
@@ -3671,7 +3671,7 @@  discard block
 block discarded – undo
3671 3671
     /**
3672 3672
      * Write objectives to DB. This method is separate from write_to_db() because otherwise
3673 3673
      * objectives are lost as a side effect to AJAX and session concurrent access
3674
-     * @return    boolean        True or false on error
3674
+     * @return    boolean|null        True or false on error
3675 3675
      */
3676 3676
     public function write_objectives_to_db()
3677 3677
     {
@@ -4312,7 +4312,7 @@  discard block
 block discarded – undo
4312 4312
      * Removes the relation between the current item and an audio file. The file
4313 4313
      * is only removed from the lp_item table, but remains in the document table
4314 4314
      * and directory
4315
-     * @return bool
4315
+     * @return false|null
4316 4316
      */
4317 4317
     public function remove_audio()
4318 4318
     {
@@ -4333,7 +4333,7 @@  discard block
 block discarded – undo
4333 4333
      * @param $status
4334 4334
      * @param bool $decorate
4335 4335
      * @param string $type classic|simple
4336
-     * @return array|string
4336
+     * @return string
4337 4337
      */
4338 4338
     static function humanize_status($status, $decorate = true, $type = 'classic')
4339 4339
     {
Please login to merge, or discard this patch.
Spacing   +247 added lines, -247 removed lines patch added patch discarded remove patch
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
             $res = Database::query($sql);
200 200
             if (Database::num_rows($res) > 0) {
201 201
                 $se_ref = Database::fetch_array($res);
202
-                $this->search_did = (int)$se_ref['search_did'];
202
+                $this->search_did = (int) $se_ref['search_did'];
203 203
             }
204 204
         }
205 205
         $this->audio = $row['audio'];
206 206
         if (self::debug > 0) {
207 207
             error_log(
208
-                'New LP - End of learnpathItem constructor for item ' . $id,
208
+                'New LP - End of learnpathItem constructor for item '.$id,
209 209
                 0
210 210
             );
211 211
         }
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
     public function delete()
315 315
     {
316 316
         if (self::debug > 0) {
317
-            error_log('learnpath_item::delete() for item ' . $this->db_id, 0);
317
+            error_log('learnpath_item::delete() for item '.$this->db_id, 0);
318 318
         }
319 319
         $lp_item_view = Database::get_course_table(TABLE_LP_ITEM_VIEW);
320 320
         $lp_item = Database::get_course_table(TABLE_LP_ITEM);
@@ -322,29 +322,29 @@  discard block
 block discarded – undo
322 322
         $course_id = api_get_course_int_id();
323 323
 
324 324
         $sql = "DELETE FROM $lp_item_view
325
-                WHERE c_id = $course_id AND lp_item_id = " . $this->db_id;
325
+                WHERE c_id = $course_id AND lp_item_id = ".$this->db_id;
326 326
         if (self::debug > 0) {
327
-            error_log('Deleting from lp_item_view: ' . $sql, 0);
327
+            error_log('Deleting from lp_item_view: '.$sql, 0);
328 328
         }
329 329
         Database::query($sql);
330 330
 
331 331
         $sql = "SELECT * FROM $lp_item
332
-                WHERE c_id = $course_id AND id = " . $this->db_id;
332
+                WHERE c_id = $course_id AND id = ".$this->db_id;
333 333
         $res_sel = Database::query($sql);
334 334
         if (Database::num_rows($res_sel) < 1) {
335 335
             return false;
336 336
         }
337 337
 
338 338
         $sql = "DELETE FROM $lp_item
339
-                WHERE c_id = $course_id AND id = " . $this->db_id;
339
+                WHERE c_id = $course_id AND id = ".$this->db_id;
340 340
         Database::query($sql);
341 341
         if (self::debug > 0) {
342
-            error_log('Deleting from lp_item: ' . $sql);
342
+            error_log('Deleting from lp_item: '.$sql);
343 343
         }
344 344
 
345 345
         if (api_get_setting('search_enabled') == 'true') {
346 346
             if (!is_null($this->search_did)) {
347
-                require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php';
347
+                require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
348 348
                 $di = new ChamiloIndexer();
349 349
                 $di->remove_document($this->search_did);
350 350
             }
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
     {
381 381
         if (self::debug > 0) {
382 382
             error_log(
383
-                'learnpathItem::get_attempt_id() on item ' . $this->db_id,
383
+                'learnpathItem::get_attempt_id() on item '.$this->db_id,
384 384
                 0
385 385
             );
386 386
         }
@@ -390,8 +390,8 @@  discard block
 block discarded – undo
390 390
         }
391 391
         if (self::debug > 0) {
392 392
             error_log(
393
-                'New LP - End of learnpathItem::get_attempt_id() on item ' .
394
-                $this->db_id . ' - Returning ' . $res,
393
+                'New LP - End of learnpathItem::get_attempt_id() on item '.
394
+                $this->db_id.' - Returning '.$res,
395 395
                 0
396 396
             );
397 397
         }
@@ -453,12 +453,12 @@  discard block
 block discarded – undo
453 453
             if (self::debug > 2) {
454 454
                 error_log(
455 455
                     'learnpathItem::get_credit() - get_prevent_reinit!=0 and '.
456
-                    'status is ' . $status,
456
+                    'status is '.$status,
457 457
                     0
458 458
                 );
459 459
             }
460 460
             //0=not attempted - 1 = incomplete
461
-            if ($status != $this->possible_status[0]&&
461
+            if ($status != $this->possible_status[0] &&
462 462
                 $status != $this->possible_status[1]
463 463
             ) {
464 464
                 $credit = 'no-credit';
@@ -532,13 +532,13 @@  discard block
 block discarded – undo
532 532
                 case TOOL_DOCUMENT:
533 533
                     $table_doc = Database::get_course_table(TABLE_DOCUMENT);
534 534
                     $sql = 'SELECT path
535
-                            FROM ' . $table_doc . '
535
+                            FROM ' . $table_doc.'
536 536
                             WHERE
537
-                                c_id = ' . $course_id . ' AND
537
+                                c_id = ' . $course_id.' AND
538 538
                                 id = ' . $path;
539 539
                     $res = Database::query($sql);
540 540
                     $row = Database::fetch_array($res);
541
-                    $real_path = 'document' . $row['path'];
541
+                    $real_path = 'document'.$row['path'];
542 542
                     return $real_path;
543 543
                 case TOOL_STUDENTPUBLICATION:
544 544
                 case TOOL_QUIZ:
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
             }
551 551
         } else {
552 552
             if (!empty($path_to_scorm_dir)) {
553
-                $path = $path_to_scorm_dir . $path;
553
+                $path = $path_to_scorm_dir.$path;
554 554
             }
555 555
             return $path;
556 556
         }
@@ -586,8 +586,8 @@  discard block
 block discarded – undo
586 586
         $sql = "SELECT id FROM $tbl
587 587
                 WHERE
588 588
                     c_id = $course_id AND
589
-                    lp_item_id = " . $this->db_id . " AND
590
-                    lp_view_id = " . $this->view_id . " AND
589
+                    lp_item_id = ".$this->db_id." AND
590
+                    lp_view_id = " . $this->view_id." AND
591 591
                     view_count = " . $this->attempt_id;
592 592
         $res = Database::query($sql);
593 593
         if (Database::num_rows($res) > 0) {
@@ -630,8 +630,8 @@  discard block
 block discarded – undo
630 630
             $sql = "SELECT id FROM $tbl
631 631
                     WHERE
632 632
                         c_id = $course_id AND
633
-                        lp_item_id = " . $this->db_id . " AND
634
-                        lp_view_id = " . $this->view_id ." AND
633
+                        lp_item_id = ".$this->db_id." AND
634
+                        lp_view_id = " . $this->view_id." AND
635 635
                         view_count = " . $this->get_attempt_id();
636 636
             $res = Database::query($sql);
637 637
             if (Database::num_rows($res) > 0) {
@@ -671,13 +671,13 @@  discard block
 block discarded – undo
671 671
         foreach ($this->interactions as $id => $in) {
672 672
             $return .= "[
673 673
                 '$id',
674
-                '" . $in[1] . "',
675
-                '" . $in[2] . "',
676
-                '" . $in[3] . "',
677
-                '" . $in[4] . "',
678
-                '" . $in[5] . "',
679
-                '" . $in[6] . "',
680
-                '" . $in[7] . "'],";
674
+                '".$in[1]."',
675
+                '" . $in[2]."',
676
+                '" . $in[3]."',
677
+                '" . $in[4]."',
678
+                '" . $in[5]."',
679
+                '" . $in[6]."',
680
+                '" . $in[7]."'],";
681 681
         }
682 682
         if (!empty($return)) {
683 683
             $return = substr($return, 0, -1);
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
                 $table = Database::get_course_table(TABLE_LP_MAIN);
920 920
                 $sql = "SELECT prevent_reinit
921 921
                     FROM $table
922
-                    WHERE c_id = $course_id AND id = " . $this->lp_id;
922
+                    WHERE c_id = $course_id AND id = ".$this->lp_id;
923 923
                 $res = Database::query($sql);
924 924
                 if (Database::num_rows($res) < 1) {
925 925
                     $this->error = "Could not find parent learnpath in lp table";
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
         }
942 942
         if (self::debug > 2) {
943 943
             error_log(
944
-                'New LP - End of learnpathItem::get_prevent_reinit() - Returned ' . $this->prevent_reinit,
944
+                'New LP - End of learnpathItem::get_prevent_reinit() - Returned '.$this->prevent_reinit,
945 945
                 0
946 946
             );
947 947
         }
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
                 $table = Database::get_course_table(TABLE_LP_MAIN);
967 967
                 $sql = "SELECT seriousgame_mode
968 968
                         FROM $table
969
-                        WHERE c_id = $course_id AND id = " . $this->lp_id;
969
+                        WHERE c_id = $course_id AND id = ".$this->lp_id;
970 970
                 $res = Database::query($sql);
971 971
                 if (Database::num_rows($res) < 1) {
972 972
                     $this->error = "Could not find parent learnpath in learnpath table";
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
         }
988 988
         if (self::debug > 2) {
989 989
             error_log(
990
-                'New LP - End of learnpathItem::get_seriousgame_mode() - Returned ' . $this->seriousgame_mode,
990
+                'New LP - End of learnpathItem::get_seriousgame_mode() - Returned '.$this->seriousgame_mode,
991 991
                 0
992 992
             );
993 993
         }
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
         }
1033 1033
         if (!isset($abs_path)) {
1034 1034
             $path = $this->get_file_path();
1035
-            $abs_path = api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/' . $path;
1035
+            $abs_path = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.$path;
1036 1036
         }
1037 1037
 
1038 1038
         $files_list = array();
@@ -1307,7 +1307,7 @@  discard block
 block discarded – undo
1307 1307
                                                             $abs_path
1308 1308
                                                         );
1309 1309
                                                         $new_abs_path = realpath(
1310
-                                                            $dir . '/' . $second_part
1310
+                                                            $dir.'/'.$second_part
1311 1311
                                                         );
1312 1312
                                                         $in_files_list[] = learnpathItem::get_resources_from_source(
1313 1313
                                                             TOOL_DOCUMENT,
@@ -1345,7 +1345,7 @@  discard block
 block discarded – undo
1345 1345
                                                             $abs_path
1346 1346
                                                         );
1347 1347
                                                         $new_abs_path = realpath(
1348
-                                                            $dir . '/' . $second_part
1348
+                                                            $dir.'/'.$second_part
1349 1349
                                                         );
1350 1350
                                                         $in_files_list[] = learnpathItem::get_resources_from_source(
1351 1351
                                                             TOOL_DOCUMENT,
@@ -1452,7 +1452,7 @@  discard block
 block discarded – undo
1452 1452
                                                             $abs_path
1453 1453
                                                         );
1454 1454
                                                         $new_abs_path = realpath(
1455
-                                                            $dir . '/' . $source
1455
+                                                            $dir.'/'.$source
1456 1456
                                                         );
1457 1457
                                                         $in_files_list[] = learnpathItem::get_resources_from_source(
1458 1458
                                                             TOOL_DOCUMENT,
@@ -1490,7 +1490,7 @@  discard block
 block discarded – undo
1490 1490
                                                             $abs_path
1491 1491
                                                         );
1492 1492
                                                         $new_abs_path = realpath(
1493
-                                                            $dir . '/' . $source
1493
+                                                            $dir.'/'.$source
1494 1494
                                                         );
1495 1495
                                                         $in_files_list[] = learnpathItem::get_resources_from_source(
1496 1496
                                                             TOOL_DOCUMENT,
@@ -1574,7 +1574,7 @@  discard block
 block discarded – undo
1574 1574
                                                 );
1575 1575
                                                 $dir = dirname($abs_path);
1576 1576
                                                 $new_abs_path = realpath(
1577
-                                                    $dir . '/' . $source
1577
+                                                    $dir.'/'.$source
1578 1578
                                                 );
1579 1579
                                                 $in_files_list[] = learnpathItem::get_resources_from_source(
1580 1580
                                                     TOOL_DOCUMENT,
@@ -1619,7 +1619,7 @@  discard block
 block discarded – undo
1619 1619
                                                 );
1620 1620
                                                 $dir = dirname($abs_path);
1621 1621
                                                 $new_abs_path = realpath(
1622
-                                                    $dir . '/' . $source
1622
+                                                    $dir.'/'.$source
1623 1623
                                                 );
1624 1624
                                                 $in_files_list[] = learnpathItem::get_resources_from_source(
1625 1625
                                                     TOOL_DOCUMENT,
@@ -1679,7 +1679,7 @@  discard block
 block discarded – undo
1679 1679
         }
1680 1680
         if (self::debug > 1) {
1681 1681
             error_log(
1682
-                'New LP - Out of learnpathItem::get_score() - returning ' . $res,
1682
+                'New LP - Out of learnpathItem::get_score() - returning '.$res,
1683 1683
                 0
1684 1684
             );
1685 1685
         }
@@ -1699,7 +1699,7 @@  discard block
 block discarded – undo
1699 1699
         $course_id = api_get_course_int_id();
1700 1700
         $debug = self::debug;
1701 1701
         if ($debug > 0) {
1702
-            error_log('learnpathItem::get_status() on item ' . $this->db_id, 0);
1702
+            error_log('learnpathItem::get_status() on item '.$this->db_id, 0);
1703 1703
         }
1704 1704
         if ($check_db) {
1705 1705
             if ($debug > 2) {
@@ -1710,12 +1710,12 @@  discard block
 block discarded – undo
1710 1710
                 $sql = "SELECT status FROM $table
1711 1711
                         WHERE
1712 1712
                             c_id = $course_id AND
1713
-                            id = '" . $this->db_item_view_id . "' AND
1714
-                            view_count = '" . $this->get_attempt_id() . "'";
1713
+                            id = '".$this->db_item_view_id."' AND
1714
+                            view_count = '" . $this->get_attempt_id()."'";
1715 1715
 
1716 1716
                 if ($debug > 2) {
1717 1717
                     error_log(
1718
-                        'learnpathItem::get_status() - Checking DB: ' . $sql,
1718
+                        'learnpathItem::get_status() - Checking DB: '.$sql,
1719 1719
                         0
1720 1720
                     );
1721 1721
                 }
@@ -1726,7 +1726,7 @@  discard block
 block discarded – undo
1726 1726
                     if ($update_local) {
1727 1727
                         if ($debug > 2) {
1728 1728
                             error_log(
1729
-                                'learnpathItem::set_status() :' . $row['status'],
1729
+                                'learnpathItem::set_status() :'.$row['status'],
1730 1730
                                 0
1731 1731
                             );
1732 1732
                         }
@@ -1734,7 +1734,7 @@  discard block
 block discarded – undo
1734 1734
                     }
1735 1735
                     if ($debug > 2) {
1736 1736
                         error_log(
1737
-                            'learnpathItem::get_status() - Returning db value ' . $row['status'],
1737
+                            'learnpathItem::get_status() - Returning db value '.$row['status'],
1738 1738
                             0
1739 1739
                         );
1740 1740
                     }
@@ -1751,7 +1751,7 @@  discard block
 block discarded – undo
1751 1751
             if (!empty($this->status)) {
1752 1752
                 if ($debug > 2) {
1753 1753
                     error_log(
1754
-                        'learnpathItem::get_status() - Returning attrib: ' . $this->status,
1754
+                        'learnpathItem::get_status() - Returning attrib: '.$this->status,
1755 1755
                         0
1756 1756
                     );
1757 1757
                 }
@@ -1761,7 +1761,7 @@  discard block
 block discarded – undo
1761 1761
 
1762 1762
         if ($debug > 2) {
1763 1763
             error_log(
1764
-                'learnpathItem::get_status() - Returning default ' . $this->possible_status[0],
1764
+                'learnpathItem::get_status() - Returning default '.$this->possible_status[0],
1765 1765
                 0
1766 1766
             );
1767 1767
         }
@@ -1801,7 +1801,7 @@  discard block
 block discarded – undo
1801 1801
             if ($origin == 'js') {
1802 1802
                 return '00 : 00: 00';
1803 1803
             } else {
1804
-                return '00 ' . $h . ' 00 \' 00"';
1804
+                return '00 '.$h.' 00 \' 00"';
1805 1805
             }
1806 1806
         } else {
1807 1807
             return api_format_time($time, $origin);
@@ -1826,7 +1826,7 @@  discard block
 block discarded – undo
1826 1826
         if (!isset($given_time)) {
1827 1827
             if (self::debug > 2) {
1828 1828
                 error_log(
1829
-                    'learnpathItem::get_scorm_time(): given time empty, current_start_time = ' . $this->current_start_time,
1829
+                    'learnpathItem::get_scorm_time(): given time empty, current_start_time = '.$this->current_start_time,
1830 1830
                     0
1831 1831
                 );
1832 1832
             }
@@ -1836,8 +1836,8 @@  discard block
 block discarded – undo
1836 1836
                         FROM $table
1837 1837
                         WHERE
1838 1838
                             c_id = $course_id AND
1839
-                            id = '" . $this->db_item_view_id . "' AND
1840
-                            view_count = '" . $this->get_attempt_id() . "'";
1839
+                            id = '".$this->db_item_view_id."' AND
1840
+                            view_count = '" . $this->get_attempt_id()."'";
1841 1841
                 $res = Database::query($sql);
1842 1842
                 $row = Database::fetch_array($res);
1843 1843
                 $start = $row['start_time'];
@@ -1858,7 +1858,7 @@  discard block
 block discarded – undo
1858 1858
         }
1859 1859
         if (self::debug > 2) {
1860 1860
             error_log(
1861
-                'learnpathItem::get_scorm_time(): intermediate = ' . $time,
1861
+                'learnpathItem::get_scorm_time(): intermediate = '.$time,
1862 1862
                 0
1863 1863
             );
1864 1864
         }
@@ -1878,7 +1878,7 @@  discard block
 block discarded – undo
1878 1878
         $sql = "SELECT * FROM $lp_item
1879 1879
                 WHERE
1880 1880
                     c_id = $course_id AND
1881
-                    id='" . intval($this->db_id) . "'";
1881
+                    id='".intval($this->db_id)."'";
1882 1882
         $res = Database::query($sql);
1883 1883
         $row = Database::fetch_array($res);
1884 1884
         return $row['terms'];
@@ -1907,9 +1907,9 @@  discard block
 block discarded – undo
1907 1907
     {
1908 1908
         if (self::debug > 0) {
1909 1909
             error_log(
1910
-                'learnpathItem::get_total_time() for item ' . $this->db_id .
1911
-                ' - Initially, current_start_time = ' . $this->current_start_time .
1912
-                ' and current_stop_time = ' . $this->current_stop_time,
1910
+                'learnpathItem::get_total_time() for item '.$this->db_id.
1911
+                ' - Initially, current_start_time = '.$this->current_start_time.
1912
+                ' and current_stop_time = '.$this->current_stop_time,
1913 1913
                 0
1914 1914
             );
1915 1915
         }
@@ -1950,9 +1950,9 @@  discard block
 block discarded – undo
1950 1950
         } else {
1951 1951
             if (self::debug > 2) {
1952 1952
                 error_log(
1953
-                    'learnpathItem::get_total_time() - Current start time = ' .
1954
-                    $this->current_start_time . ', current stop time = ' .
1955
-                    $this->current_stop_time . ' Returning ' . $time . "-----------\n",
1953
+                    'learnpathItem::get_total_time() - Current start time = '.
1954
+                    $this->current_start_time.', current stop time = '.
1955
+                    $this->current_stop_time.' Returning '.$time."-----------\n",
1956 1956
                     0
1957 1957
                 );
1958 1958
             }
@@ -1972,7 +1972,7 @@  discard block
 block discarded – undo
1972 1972
         }
1973 1973
         if (self::debug > 2) {
1974 1974
             error_log(
1975
-                'learnpathItem::get_type() - Returning ' . $res . ' for item ' . $this->db_id,
1975
+                'learnpathItem::get_type() - Returning '.$res.' for item '.$this->db_id,
1976 1976
                 0
1977 1977
             );
1978 1978
         }
@@ -2012,8 +2012,8 @@  discard block
 block discarded – undo
2012 2012
         if ($this->status_is($completedStatusList)) {
2013 2013
             if (self::debug > 2) {
2014 2014
                 error_log(
2015
-                    'learnpath::is_done() - Item ' . $this->get_id(
2016
-                    ) . ' is complete',
2015
+                    'learnpath::is_done() - Item '.$this->get_id(
2016
+                    ).' is complete',
2017 2017
                     0
2018 2018
                 );
2019 2019
             }
@@ -2022,8 +2022,8 @@  discard block
 block discarded – undo
2022 2022
         } else {
2023 2023
             if (self::debug > 2) {
2024 2024
                 error_log(
2025
-                    'learnpath::is_done() - Item ' . $this->get_id(
2026
-                    ) . ' is not complete',
2025
+                    'learnpath::is_done() - Item '.$this->get_id(
2026
+                    ).' is not complete',
2027 2027
                     0
2028 2028
                 );
2029 2029
             }
@@ -2060,7 +2060,7 @@  discard block
 block discarded – undo
2060 2060
         }
2061 2061
         if (self::debug > 2) {
2062 2062
             error_log(
2063
-                'New LP - End of learnpathItem::is_restart_allowed() - Returning ' . $restart,
2063
+                'New LP - End of learnpathItem::is_restart_allowed() - Returning '.$restart,
2064 2064
                 0
2065 2065
             );
2066 2066
         }
@@ -2139,7 +2139,7 @@  discard block
 block discarded – undo
2139 2139
     {
2140 2140
         if (self::debug > 0) {
2141 2141
             error_log(
2142
-                'learnpathItem::parse_prereq() for learnpath ' . $this->lp_id . ' with string ' . $prereqs_string,
2142
+                'learnpathItem::parse_prereq() for learnpath '.$this->lp_id.' with string '.$prereqs_string,
2143 2143
                 0
2144 2144
             );
2145 2145
         }
@@ -2332,7 +2332,7 @@  discard block
 block discarded – undo
2332 2332
                                 // Strange...
2333 2333
                                 if (self::debug > 1) {
2334 2334
                                     error_log(
2335
-                                        'New LP - Found ~ but strange string: ' . $prereqs_string,
2335
+                                        'New LP - Found ~ but strange string: '.$prereqs_string,
2336 2336
                                         0
2337 2337
                                     );
2338 2338
                                 }
@@ -2360,7 +2360,7 @@  discard block
 block discarded – undo
2360 2360
                                     //  the big brackets-enclosed condition.
2361 2361
                                     if (self::debug > 1) {
2362 2362
                                         error_log(
2363
-                                            'New LP - Dealing with group ' . $gr,
2363
+                                            'New LP - Dealing with group '.$gr,
2364 2364
                                             0
2365 2365
                                         );
2366 2366
                                     }
@@ -2374,7 +2374,7 @@  discard block
 block discarded – undo
2374 2374
                                     ) {
2375 2375
                                         if (self::debug > 1) {
2376 2376
                                             error_log(
2377
-                                                'New LP - Found multiplier ' . $multi[0],
2377
+                                                'New LP - Found multiplier '.$multi[0],
2378 2378
                                                 0
2379 2379
                                             );
2380 2380
                                         }
@@ -2390,7 +2390,7 @@  discard block
 block discarded – undo
2390 2390
                                                     $mytrue++;
2391 2391
                                                     if (self::debug > 1) {
2392 2392
                                                         error_log(
2393
-                                                            'New LP - Found true item, counting.. (' . ($mytrue) . ')',
2393
+                                                            'New LP - Found true item, counting.. ('.($mytrue).')',
2394 2394
                                                             0
2395 2395
                                                         );
2396 2396
                                                     }
@@ -2398,7 +2398,7 @@  discard block
 block discarded – undo
2398 2398
                                             } else {
2399 2399
                                                 if (self::debug > 1) {
2400 2400
                                                     error_log(
2401
-                                                        'New LP - item ' . $cond . ' does not exist in items list',
2401
+                                                        'New LP - item '.$cond.' does not exist in items list',
2402 2402
                                                         0
2403 2403
                                                     );
2404 2404
                                                 }
@@ -2445,7 +2445,7 @@  discard block
 block discarded – undo
2445 2445
                                                 } else {
2446 2446
                                                     if (self::debug > 1) {
2447 2447
                                                         error_log(
2448
-                                                            'New LP - ' .
2448
+                                                            'New LP - '.
2449 2449
                                                             ' Found false item, the set is not true, return false',
2450 2450
                                                             0
2451 2451
                                                         );
@@ -2456,7 +2456,7 @@  discard block
 block discarded – undo
2456 2456
                                             } else {
2457 2457
                                                 if (self::debug > 1) {
2458 2458
                                                     error_log(
2459
-                                                        'New LP - item ' . $cond . ' does not exist in items list',
2459
+                                                        'New LP - item '.$cond.' does not exist in items list',
2460 2460
                                                         0
2461 2461
                                                     );
2462 2462
                                                 }
@@ -2482,7 +2482,7 @@  discard block
 block discarded – undo
2482 2482
                                 //  value of the corresponding resource completion status.
2483 2483
                                 if (self::debug > 1) {
2484 2484
                                     error_log(
2485
-                                        'New LP - Didnt find any group, returning value for ' . $prereqs_string,
2485
+                                        'New LP - Didnt find any group, returning value for '.$prereqs_string,
2486 2486
                                         0
2487 2487
                                     );
2488 2488
                                 }
@@ -2499,14 +2499,14 @@  discard block
 block discarded – undo
2499 2499
                                         if (!$returnstatus) {
2500 2500
                                             if (self::debug > 1) {
2501 2501
                                                 error_log(
2502
-                                                    'New LP - Prerequisite ' . $prereqs_string . ' not complete',
2502
+                                                    'New LP - Prerequisite '.$prereqs_string.' not complete',
2503 2503
                                                     0
2504 2504
                                                 );
2505 2505
                                             }
2506 2506
                                         } else {
2507 2507
                                             if (self::debug > 1) {
2508 2508
                                                 error_log(
2509
-                                                    'New LP - Prerequisite ' . $prereqs_string . ' complete',
2509
+                                                    'New LP - Prerequisite '.$prereqs_string.' complete',
2510 2510
                                                     0
2511 2511
                                                 );
2512 2512
                                             }
@@ -2518,12 +2518,12 @@  discard block
 block discarded – undo
2518 2518
                                             if ($returnstatus) {
2519 2519
                                                 //AND origin_lp_item_id = '.$user_id.'
2520 2520
                                                 $sql = 'SELECT exe_result, exe_weighting
2521
-                                                        FROM ' . Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES) . '
2521
+                                                        FROM ' . Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES).'
2522 2522
                                                         WHERE
2523
-                                                            exe_exo_id = ' . $items[$refs_list[$prereqs_string]]->path . ' AND
2524
-                                                            exe_user_id = ' . $user_id . ' AND
2525
-                                                            orig_lp_id = ' . $this->lp_id . ' AND
2526
-                                                            orig_lp_item_id = ' . $prereqs_string . ' AND
2523
+                                                            exe_exo_id = ' . $items[$refs_list[$prereqs_string]]->path.' AND
2524
+                                                            exe_user_id = ' . $user_id.' AND
2525
+                                                            orig_lp_id = ' . $this->lp_id.' AND
2526
+                                                            orig_lp_item_id = ' . $prereqs_string.' AND
2527 2527
                                                             status <> "incomplete"
2528 2528
                                                         ORDER BY exe_date DESC
2529 2529
                                                         LIMIT 0, 1';
@@ -2561,12 +2561,12 @@  discard block
 block discarded – undo
2561 2561
 
2562 2562
                                             // Checking in the database.
2563 2563
                                             $sql = 'SELECT exe_result, exe_weighting
2564
-                                                    FROM ' . Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES) . '
2564
+                                                    FROM ' . Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES).'
2565 2565
                                                     WHERE
2566
-                                                        exe_exo_id = ' . $items[$refs_list[$prereqs_string]]->path . ' AND
2567
-                                                        exe_user_id = ' . $user_id . ' AND
2568
-                                                        orig_lp_id = ' . $this->lp_id . ' AND
2569
-                                                        orig_lp_item_id = ' . $prereqs_string . ' ';
2566
+                                                        exe_exo_id = ' . $items[$refs_list[$prereqs_string]]->path.' AND
2567
+                                                        exe_user_id = ' . $user_id.' AND
2568
+                                                        orig_lp_id = ' . $this->lp_id.' AND
2569
+                                                        orig_lp_item_id = ' . $prereqs_string.' ';
2570 2570
 
2571 2571
                                             $rs_quiz = Database::query($sql);
2572 2572
                                             if (Database::num_rows($rs_quiz) > 0) {
@@ -2612,14 +2612,14 @@  discard block
 block discarded – undo
2612 2612
                                         if (!$returnstatus) {
2613 2613
                                             if (self::debug > 1) {
2614 2614
                                                 error_log(
2615
-                                                    'New LP - Prerequisite ' . $prereqs_string . ' not complete',
2615
+                                                    'New LP - Prerequisite '.$prereqs_string.' not complete',
2616 2616
                                                     0
2617 2617
                                                 );
2618 2618
                                             }
2619 2619
                                         } else {
2620 2620
                                             if (self::debug > 1) {
2621 2621
                                                 error_log(
2622
-                                                    'New LP - Prerequisite ' . $prereqs_string . ' complete',
2622
+                                                    'New LP - Prerequisite '.$prereqs_string.' complete',
2623 2623
                                                     0
2624 2624
                                                 );
2625 2625
                                             }
@@ -2634,11 +2634,11 @@  discard block
 block discarded – undo
2634 2634
                                                 TABLE_LP_VIEW
2635 2635
                                             );
2636 2636
 
2637
-                                            $sql = 'SELECT id FROM ' . $lp_view . '
2637
+                                            $sql = 'SELECT id FROM '.$lp_view.'
2638 2638
                                                     WHERE
2639
-                                                        c_id = ' . $course_id . ' AND
2640
-                                                        user_id = ' . $user_id . '  AND
2641
-                                                        lp_id = ' . $this->lp_id . ' AND
2639
+                                                        c_id = ' . $course_id.' AND
2640
+                                                        user_id = ' . $user_id.'  AND
2641
+                                                        lp_id = ' . $this->lp_id.' AND
2642 2642
                                                         session_id = '.$sessionId.'
2643 2643
                                                     LIMIT 0, 1';
2644 2644
                                             $rs_lp = Database::query($sql);
@@ -2647,11 +2647,11 @@  discard block
 block discarded – undo
2647 2647
                                             );
2648 2648
                                             $my_lp_id = $lp_id[0];
2649 2649
 
2650
-                                            $sql = 'SELECT status FROM ' . $lp_item_view . '
2650
+                                            $sql = 'SELECT status FROM '.$lp_item_view.'
2651 2651
                                                    WHERE
2652
-                                                        c_id = ' . $course_id . ' AND
2653
-                                                        lp_view_id = ' . $my_lp_id . ' AND
2654
-                                                        lp_item_id = ' . $refs_list[$prereqs_string] . '
2652
+                                                        c_id = ' . $course_id.' AND
2653
+                                                        lp_view_id = ' . $my_lp_id.' AND
2654
+                                                        lp_item_id = ' . $refs_list[$prereqs_string].'
2655 2655
                                                     LIMIT 0, 1';
2656 2656
                                             $rs_lp = Database::query($sql);
2657 2657
                                             $status_array = Database :: fetch_row(
@@ -2668,14 +2668,14 @@  discard block
 block discarded – undo
2668 2668
                                             if (!$returnstatus) {
2669 2669
                                                 if (self::debug > 1) {
2670 2670
                                                     error_log(
2671
-                                                        'New LP - Prerequisite ' . $prereqs_string . ' not complete',
2671
+                                                        'New LP - Prerequisite '.$prereqs_string.' not complete',
2672 2672
                                                         0
2673 2673
                                                     );
2674 2674
                                                 }
2675 2675
                                             } else {
2676 2676
                                                 if (self::debug > 1) {
2677 2677
                                                     error_log(
2678
-                                                        'New LP - Prerequisite ' . $prereqs_string . ' complete',
2678
+                                                        'New LP - Prerequisite '.$prereqs_string.' complete',
2679 2679
                                                         0
2680 2680
                                                     );
2681 2681
                                                 }
@@ -2686,7 +2686,7 @@  discard block
 block discarded – undo
2686 2686
                                 } else {
2687 2687
                                     if (self::debug > 1) {
2688 2688
                                         error_log(
2689
-                                            'New LP - Could not find ' . $prereqs_string . ' in ' . print_r(
2689
+                                            'New LP - Could not find '.$prereqs_string.' in '.print_r(
2690 2690
                                                 $refs_list,
2691 2691
                                                 true
2692 2692
                                             ),
@@ -2709,7 +2709,7 @@  discard block
 block discarded – undo
2709 2709
                 foreach ($list as $condition) {
2710 2710
                     if (self::debug > 1) {
2711 2711
                         error_log(
2712
-                            'New LP - Found OR, adding it (' . $condition . ')',
2712
+                            'New LP - Found OR, adding it ('.$condition.')',
2713 2713
                             0
2714 2714
                         );
2715 2715
                     }
@@ -2762,7 +2762,7 @@  discard block
 block discarded – undo
2762 2762
 
2763 2763
         if (self::debug > 1) {
2764 2764
             error_log(
2765
-                'New LP - End of parse_prereq. Error code is now ' . $this->prereq_alert,
2765
+                'New LP - End of parse_prereq. Error code is now '.$this->prereq_alert,
2766 2766
                 0
2767 2767
             );
2768 2768
         }
@@ -2880,7 +2880,7 @@  discard block
 block discarded – undo
2880 2880
                                 $this->set_score($value);
2881 2881
                                 if (self::debug > 2) {
2882 2882
                                     error_log(
2883
-                                        'learnpathItem::save() - setting score to ' . $value,
2883
+                                        'learnpathItem::save() - setting score to '.$value,
2884 2884
                                         0
2885 2885
                                     );
2886 2886
                                 }
@@ -2889,7 +2889,7 @@  discard block
 block discarded – undo
2889 2889
                                 $this->set_max_score($value);
2890 2890
                                 if (self::debug > 2) {
2891 2891
                                     error_log(
2892
-                                        'learnpathItem::save() - setting view_max_score to ' . $value,
2892
+                                        'learnpathItem::save() - setting view_max_score to '.$value,
2893 2893
                                         0
2894 2894
                                     );
2895 2895
                                 }
@@ -2898,7 +2898,7 @@  discard block
 block discarded – undo
2898 2898
                                 $this->min_score = $value;
2899 2899
                                 if (self::debug > 2) {
2900 2900
                                     error_log(
2901
-                                        'learnpathItem::save() - setting min_score to ' . $value,
2901
+                                        'learnpathItem::save() - setting min_score to '.$value,
2902 2902
                                         0
2903 2903
                                     );
2904 2904
                                 }
@@ -2908,7 +2908,7 @@  discard block
 block discarded – undo
2908 2908
                                     $this->set_status($value);
2909 2909
                                     if (self::debug > 2) {
2910 2910
                                         error_log(
2911
-                                            'learnpathItem::save() - setting status to ' . $value,
2911
+                                            'learnpathItem::save() - setting status to '.$value,
2912 2912
                                             0
2913 2913
                                         );
2914 2914
                                     }
@@ -2918,7 +2918,7 @@  discard block
 block discarded – undo
2918 2918
                                 $this->set_time($value);
2919 2919
                                 if (self::debug > 2) {
2920 2920
                                     error_log(
2921
-                                        'learnpathItem::save() - setting time to ' . $value,
2921
+                                        'learnpathItem::save() - setting time to '.$value,
2922 2922
                                         0
2923 2923
                                     );
2924 2924
                                 }
@@ -2927,7 +2927,7 @@  discard block
 block discarded – undo
2927 2927
                                 $this->current_data = $value;
2928 2928
                                 if (self::debug > 2) {
2929 2929
                                     error_log(
2930
-                                        'learnpathItem::save() - setting suspend_data to ' . $value,
2930
+                                        'learnpathItem::save() - setting suspend_data to '.$value,
2931 2931
                                         0
2932 2932
                                     );
2933 2933
                                 }
@@ -2936,7 +2936,7 @@  discard block
 block discarded – undo
2936 2936
                                 $this->set_lesson_location($value);
2937 2937
                                 if (self::debug > 2) {
2938 2938
                                     error_log(
2939
-                                        'learnpathItem::save() - setting lesson_location to ' . $value,
2939
+                                        'learnpathItem::save() - setting lesson_location to '.$value,
2940 2940
                                         0
2941 2941
                                     );
2942 2942
                                 }
@@ -2945,7 +2945,7 @@  discard block
 block discarded – undo
2945 2945
                                 $this->set_core_exit($value);
2946 2946
                                 if (self::debug > 2) {
2947 2947
                                     error_log(
2948
-                                        'learnpathItem::save() - setting core_exit to ' . $value,
2948
+                                        'learnpathItem::save() - setting core_exit to '.$value,
2949 2949
                                         0
2950 2950
                                     );
2951 2951
                                 }
@@ -3092,7 +3092,7 @@  discard block
 block discarded – undo
3092 3092
     public function set_level($int = 0)
3093 3093
     {
3094 3094
         if (self::debug > 0) {
3095
-            error_log('learnpathItem::set_level(' . $int . ')', 0);
3095
+            error_log('learnpathItem::set_level('.$int.')', 0);
3096 3096
         }
3097 3097
         if (!empty($int) AND $int == strval(intval($int))) {
3098 3098
             $this->level = $int;
@@ -3121,7 +3121,7 @@  discard block
 block discarded – undo
3121 3121
         if (empty($lpItemId)) {
3122 3122
             if (self::debug > 0) {
3123 3123
                 error_log(
3124
-                    'learnpathItem::set_lp_view(' . $lp_view_id . ') $lpItemId is empty',
3124
+                    'learnpathItem::set_lp_view('.$lp_view_id.') $lpItemId is empty',
3125 3125
                     0
3126 3126
                 );
3127 3127
             }
@@ -3132,7 +3132,7 @@  discard block
 block discarded – undo
3132 3132
         if (empty($lp_view_id)) {
3133 3133
             if (self::debug > 0) {
3134 3134
                 error_log(
3135
-                    'learnpathItem::set_lp_view(' . $lp_view_id . ') $lp_view_id is empty',
3135
+                    'learnpathItem::set_lp_view('.$lp_view_id.') $lp_view_id is empty',
3136 3136
                     0
3137 3137
                 );
3138 3138
             }
@@ -3141,7 +3141,7 @@  discard block
 block discarded – undo
3141 3141
         }
3142 3142
 
3143 3143
         if (self::debug > 0) {
3144
-            error_log('learnpathItem::set_lp_view(' . $lp_view_id . ')', 0);
3144
+            error_log('learnpathItem::set_lp_view('.$lp_view_id.')', 0);
3145 3145
         }
3146 3146
 
3147 3147
         $this->view_id = $lp_view_id;
@@ -3151,13 +3151,13 @@  discard block
 block discarded – undo
3151 3151
         $sql = "SELECT * FROM $item_view_table
3152 3152
                 WHERE
3153 3153
                     c_id = $course_id AND
3154
-                    lp_item_id = " . $lpItemId . " AND
3155
-                    lp_view_id = " . $lp_view_id . "
3154
+                    lp_item_id = ".$lpItemId." AND
3155
+                    lp_view_id = " . $lp_view_id."
3156 3156
                 ORDER BY view_count DESC";
3157 3157
 
3158 3158
         if (self::debug > 2) {
3159 3159
             error_log(
3160
-                'learnpathItem::set_lp_view() - Querying lp_item_view: ' . $sql,
3160
+                'learnpathItem::set_lp_view() - Querying lp_item_view: '.$sql,
3161 3161
                 0
3162 3162
             );
3163 3163
         }
@@ -3189,7 +3189,7 @@  discard block
 block discarded – undo
3189 3189
             $sql = "SELECT * FROM $item_view_interaction_table
3190 3190
                     WHERE
3191 3191
                         c_id = $course_id AND
3192
-                        lp_iv_id = '" . $this->db_item_view_id . "'";
3192
+                        lp_iv_id = '".$this->db_item_view_id."'";
3193 3193
 
3194 3194
             $res = Database::query($sql);
3195 3195
             if ($res !== false) {
@@ -3204,7 +3204,7 @@  discard block
 block discarded – undo
3204 3204
             $sql = "SELECT * FROM $item_view_objective_table
3205 3205
                     WHERE
3206 3206
                         c_id = $course_id AND
3207
-                        lp_iv_id = '" . $this->db_item_view_id . "'";
3207
+                        lp_iv_id = '".$this->db_item_view_id."'";
3208 3208
 
3209 3209
             $res = Database::query($sql);
3210 3210
             if ($res !== false) {
@@ -3265,7 +3265,7 @@  discard block
 block discarded – undo
3265 3265
     {
3266 3266
         $debug = self::debug;
3267 3267
         if ($debug > 0) {
3268
-            error_log('learnpathItem::set_score(' . $score . ')', 0);
3268
+            error_log('learnpathItem::set_score('.$score.')', 0);
3269 3269
         }
3270 3270
         if (($this->max_score <= 0 || $score <= $this->max_score) && ($score >= $this->min_score)) {
3271 3271
             $this->current_score = $score;
@@ -3278,9 +3278,9 @@  discard block
 block discarded – undo
3278 3278
             }
3279 3279
 
3280 3280
             if ($debug > 0) {
3281
-                error_log('get_mastery_score: ' . $masteryScore);
3282
-                error_log('current_status: ' . $current_status);
3283
-                error_log('current score : ' . $this->current_score);
3281
+                error_log('get_mastery_score: '.$masteryScore);
3282
+                error_log('current_status: '.$current_status);
3283
+                error_log('current score : '.$this->current_score);
3284 3284
             }
3285 3285
 
3286 3286
             // If mastery_score is set AND the current score reaches the mastery
@@ -3308,15 +3308,15 @@  discard block
 block discarded – undo
3308 3308
     public function set_max_score($score)
3309 3309
     {
3310 3310
         if (self::debug > 0) {
3311
-            error_log('learnpathItem::set_max_score(' . $score . ')', 0);
3311
+            error_log('learnpathItem::set_max_score('.$score.')', 0);
3312 3312
         }
3313 3313
         if (is_int($score) || $score == '') {
3314 3314
             $this->view_max_score = $score;
3315 3315
             if (self::debug > 1) {
3316 3316
                 error_log(
3317
-                    'learnpathItem::set_max_score() - ' .
3318
-                    'Updated object score of item ' . $this->db_id .
3319
-                    ' to ' . $this->view_max_score,
3317
+                    'learnpathItem::set_max_score() - '.
3318
+                    'Updated object score of item '.$this->db_id.
3319
+                    ' to '.$this->view_max_score,
3320 3320
                     0
3321 3321
                 );
3322 3322
             }
@@ -3334,12 +3334,12 @@  discard block
 block discarded – undo
3334 3334
     public function set_status($status)
3335 3335
     {
3336 3336
         if (self::debug > 0) {
3337
-            error_log('learnpathItem::set_status(' . $status . ')', 0);
3337
+            error_log('learnpathItem::set_status('.$status.')', 0);
3338 3338
         }
3339 3339
 
3340 3340
         $found = false;
3341 3341
         foreach ($this->possible_status as $possible) {
3342
-            if (preg_match('/^' . $possible . '$/i', $status)) {
3342
+            if (preg_match('/^'.$possible.'$/i', $status)) {
3343 3343
                 $found = true;
3344 3344
             }
3345 3345
         }
@@ -3349,8 +3349,8 @@  discard block
 block discarded – undo
3349 3349
             if (self::debug > 1) {
3350 3350
                 error_log(
3351 3351
                     'learnpathItem::set_status() - '.
3352
-                        'Updated object status of item ' . $this->db_id .
3353
-                        ' to ' . $this->status,
3352
+                        'Updated object status of item '.$this->db_id.
3353
+                        ' to '.$this->status,
3354 3354
                     0
3355 3355
                 );
3356 3356
             }
@@ -3374,7 +3374,7 @@  discard block
 block discarded – undo
3374 3374
         $lp_item = Database::get_course_table(TABLE_LP_ITEM);
3375 3375
         require_once api_get_path(
3376 3376
                 LIBRARY_PATH
3377
-            ) . 'search/ChamiloIndexer.class.php';
3377
+            ).'search/ChamiloIndexer.class.php';
3378 3378
         $a_terms = preg_split('/,/', $terms);
3379 3379
         $i_terms = preg_split('/,/', $this->get_terms());
3380 3380
         foreach ($i_terms as $term) {
@@ -3391,7 +3391,7 @@  discard block
 block discarded – undo
3391 3391
                 SET terms = '$terms'
3392 3392
                 WHERE
3393 3393
                     c_id = $course_id AND
3394
-                    id=" . $this->get_id();
3394
+                    id=".$this->get_id();
3395 3395
         Database::query($sql);
3396 3396
         // Save it to search engine.
3397 3397
         if (api_get_setting('search_enabled') == 'true') {
@@ -3419,7 +3419,7 @@  discard block
 block discarded – undo
3419 3419
     public function set_time($scorm_time, $format = 'scorm')
3420 3420
     {
3421 3421
         if (self::debug > 0) {
3422
-            error_log('learnpathItem::set_time(' . $scorm_time . ')', 0);
3422
+            error_log('learnpathItem::set_time('.$scorm_time.')', 0);
3423 3423
         }
3424 3424
         if ($scorm_time == '0'
3425 3425
                 and ($this->type != 'sco')
@@ -3430,8 +3430,8 @@  discard block
 block discarded – undo
3430 3430
                 $this->update_time($my_time);
3431 3431
                 if (self::debug > 0) {
3432 3432
                     error_log(
3433
-                        'learnpathItem::set_time(' . $scorm_time . ') - ' .
3434
-                            'found asset - set time to ' . $my_time,
3433
+                        'learnpathItem::set_time('.$scorm_time.') - '.
3434
+                            'found asset - set time to '.$my_time,
3435 3435
                         0
3436 3436
                     );
3437 3437
                 }
@@ -3504,10 +3504,10 @@  discard block
 block discarded – undo
3504 3504
     {
3505 3505
         if (self::debug > 1) {
3506 3506
             error_log(
3507
-                'learnpathItem::status_is(' . print_r(
3507
+                'learnpathItem::status_is('.print_r(
3508 3508
                     $list,
3509 3509
                     true
3510
-                ) . ') on item ' . $this->db_id,
3510
+                ).') on item '.$this->db_id,
3511 3511
                 0
3512 3512
             );
3513 3513
         }
@@ -3517,11 +3517,11 @@  discard block
 block discarded – undo
3517 3517
         }
3518 3518
         $found = false;
3519 3519
         foreach ($list as $status) {
3520
-            if (preg_match('/^' . $status . '$/i', $currentStatus)) {
3520
+            if (preg_match('/^'.$status.'$/i', $currentStatus)) {
3521 3521
                 if (self::debug > 2) {
3522 3522
                     error_log(
3523
-                        'New LP - learnpathItem::status_is() - Found status ' .
3524
-                            $status . ' corresponding to current status',
3523
+                        'New LP - learnpathItem::status_is() - Found status '.
3524
+                            $status.' corresponding to current status',
3525 3525
                         0
3526 3526
                     );
3527 3527
                 }
@@ -3532,8 +3532,8 @@  discard block
 block discarded – undo
3532 3532
         }
3533 3533
         if (self::debug > 2) {
3534 3534
             error_log(
3535
-                'New LP - learnpathItem::status_is() - Status ' .
3536
-                    $currentStatus . ' did not match request',
3535
+                'New LP - learnpathItem::status_is() - Status '.
3536
+                    $currentStatus.' did not match request',
3537 3537
                 0
3538 3538
             );
3539 3539
         }
@@ -3550,7 +3550,7 @@  discard block
 block discarded – undo
3550 3550
     public function update_time($total_sec = 0)
3551 3551
     {
3552 3552
         if (self::debug > 0) {
3553
-            error_log('learnpathItem::update_time(' . $total_sec . ')', 0);
3553
+            error_log('learnpathItem::update_time('.$total_sec.')', 0);
3554 3554
         }
3555 3555
         if ($total_sec >= 0) {
3556 3556
             // Getting start time from finish time. The only problem in the calculation is it might be
@@ -3602,11 +3602,11 @@  discard block
 block discarded – undo
3602 3602
         $item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW);
3603 3603
         $course_id = api_get_course_int_id();
3604 3604
 
3605
-        $get_view_sql = 'SELECT total_time, status FROM ' . $item_view_table . '
3606
-                         WHERE c_id = ' . $course_id . '
3607
-                            AND lp_item_id="' . $this->db_id . '"
3608
-                            AND lp_view_id="' . $this->view_id . '"
3609
-                            AND view_count="' . $this->attempt_id . '" ;';
3605
+        $get_view_sql = 'SELECT total_time, status FROM '.$item_view_table.'
3606
+                         WHERE c_id = ' . $course_id.'
3607
+                            AND lp_item_id="' . $this->db_id.'"
3608
+                            AND lp_view_id="' . $this->view_id.'"
3609
+                            AND view_count="' . $this->attempt_id.'" ;';
3610 3610
         $result = Database::query($get_view_sql);
3611 3611
         $row = Database::fetch_array($result);
3612 3612
 
@@ -3659,12 +3659,12 @@  discard block
 block discarded – undo
3659 3659
     {
3660 3660
         $item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW);
3661 3661
         $course_id = api_get_course_int_id();
3662
-        $sql = 'UPDATE ' . $item_view_table . '
3663
-                SET total_time = 0, start_time=' . time() . '
3664
-                WHERE c_id = ' . $course_id . '
3665
-                    AND lp_item_id="' . $this->db_id . '"
3666
-                    AND lp_view_id="' . $this->view_id . '"
3667
-                    AND view_count="' . $this->attempt_id . '" ;';
3662
+        $sql = 'UPDATE '.$item_view_table.'
3663
+                SET total_time = 0, start_time=' . time().'
3664
+                WHERE c_id = ' . $course_id.'
3665
+                    AND lp_item_id="' . $this->db_id.'"
3666
+                    AND lp_view_id="' . $this->view_id.'"
3667
+                    AND view_count="' . $this->attempt_id.'" ;';
3668 3668
         Database::query($sql);
3669 3669
     }
3670 3670
 
@@ -3686,8 +3686,8 @@  discard block
 block discarded – undo
3686 3686
                     FROM $tbl
3687 3687
                     WHERE
3688 3688
                         c_id = $course_id AND
3689
-                        lp_item_id = " . $this->db_id . " AND
3690
-                        lp_view_id = " . $this->view_id . " AND
3689
+                        lp_item_id = ".$this->db_id." AND
3690
+                        lp_view_id = " . $this->view_id." AND
3691 3691
                         view_count = " . $this->attempt_id;
3692 3692
             $res = Database::query($sql);
3693 3693
             if (Database::num_rows($res) > 0) {
@@ -3695,8 +3695,8 @@  discard block
 block discarded – undo
3695 3695
                 $lp_iv_id = $row[0];
3696 3696
                 if (self::debug > 2) {
3697 3697
                     error_log(
3698
-                        'learnpathItem::write_to_db() - Got item_view_id ' .
3699
-                            $lp_iv_id . ', now checking objectives ',
3698
+                        'learnpathItem::write_to_db() - Got item_view_id '.
3699
+                            $lp_iv_id.', now checking objectives ',
3700 3700
                         0
3701 3701
                     );
3702 3702
                 }
@@ -3708,7 +3708,7 @@  discard block
 block discarded – undo
3708 3708
                                 WHERE
3709 3709
                                     c_id = $course_id AND
3710 3710
                                     lp_iv_id = $lp_iv_id AND
3711
-                                    objective_id = '" . Database::escape_string($objective[0]) . "'";
3711
+                                    objective_id = '".Database::escape_string($objective[0])."'";
3712 3712
                     $iva_res = Database::query($iva_sql);
3713 3713
                     // id(0), type(1), time(2), weighting(3),
3714 3714
                     // correct_responses(4), student_response(5),
@@ -3717,22 +3717,22 @@  discard block
 block discarded – undo
3717 3717
                         // Update (or don't).
3718 3718
                         $iva_row = Database::fetch_array($iva_res);
3719 3719
                         $iva_id = $iva_row[0];
3720
-                        $ivau_sql = "UPDATE $iva_table " .
3721
-                            "SET objective_id = '" . Database::escape_string(
3720
+                        $ivau_sql = "UPDATE $iva_table ".
3721
+                            "SET objective_id = '".Database::escape_string(
3722 3722
                                 $objective[0]
3723
-                            ) . "'," .
3724
-                            "status = '" . Database::escape_string(
3723
+                            )."',".
3724
+                            "status = '".Database::escape_string(
3725 3725
                                 $objective[1]
3726
-                            ) . "'," .
3727
-                            "score_raw = '" . Database::escape_string(
3726
+                            )."',".
3727
+                            "score_raw = '".Database::escape_string(
3728 3728
                                 $objective[2]
3729
-                            ) . "'," .
3730
-                            "score_min = '" . Database::escape_string(
3729
+                            )."',".
3730
+                            "score_min = '".Database::escape_string(
3731 3731
                                 $objective[4]
3732
-                            ) . "'," .
3733
-                            "score_max = '" . Database::escape_string(
3732
+                            )."',".
3733
+                            "score_max = '".Database::escape_string(
3734 3734
                                 $objective[3]
3735
-                            ) . "' " .
3735
+                            )."' ".
3736 3736
                             "WHERE c_id = $course_id AND id = $iva_id";
3737 3737
                         Database::query($ivau_sql);
3738 3738
                     } else {
@@ -3782,12 +3782,12 @@  discard block
 block discarded – undo
3782 3782
         $credit = $this->get_credit();
3783 3783
 
3784 3784
         $item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW);
3785
-        $sql = 'SELECT status FROM ' . $item_view_table . '
3785
+        $sql = 'SELECT status FROM '.$item_view_table.'
3786 3786
                 WHERE
3787
-                    c_id = ' . $course_id . ' AND
3788
-                    lp_item_id="' . $this->db_id . '" AND
3789
-                    lp_view_id="' . $this->view_id . '" AND
3790
-                    view_count="' . $this->get_attempt_id() . '" ';
3787
+                    c_id = ' . $course_id.' AND
3788
+                    lp_item_id="' . $this->db_id.'" AND
3789
+                    lp_view_id="' . $this->view_id.'" AND
3790
+                    view_count="' . $this->get_attempt_id().'" ';
3791 3791
         $rs_verified = Database::query($sql);
3792 3792
         $row_verified = Database::fetch_array($rs_verified);
3793 3793
 
@@ -3815,8 +3815,8 @@  discard block
 block discarded – undo
3815 3815
                     "This info shouldn't be saved as the credit or lesson mode info prevent it"
3816 3816
                 );
3817 3817
                 error_log(
3818
-                    'learnpathItem::write_to_db() - credit(' . $credit . ') or'.
3819
-                        ' lesson_mode(' . $mode . ') prevent recording!',
3818
+                    'learnpathItem::write_to_db() - credit('.$credit.') or'.
3819
+                        ' lesson_mode('.$mode.') prevent recording!',
3820 3820
                     0
3821 3821
                 );
3822 3822
             }
@@ -3840,14 +3840,14 @@  discard block
 block discarded – undo
3840 3840
                     "max_score" => $this->get_max(),
3841 3841
                     "lp_item_id" => $this->db_id,
3842 3842
                     "lp_view_id" => $this->view_id,
3843
-                    "view_count" => $this->get_attempt_id() ,
3843
+                    "view_count" => $this->get_attempt_id(),
3844 3844
                     "suspend_data" => $this->current_data,
3845 3845
                     //"max_time_allowed" => ,
3846 3846
                     "lesson_location" => $this->lesson_location
3847 3847
                 );
3848 3848
                 if (self::debug > 2) {
3849 3849
                     error_log(
3850
-                        'learnpathItem::write_to_db() - Inserting into item_view forced: ' . print_r($params, 1),
3850
+                        'learnpathItem::write_to_db() - Inserting into item_view forced: '.print_r($params, 1),
3851 3851
                         0
3852 3852
                     );
3853 3853
                 }
@@ -3855,7 +3855,7 @@  discard block
 block discarded – undo
3855 3855
 
3856 3856
                 if ($this->db_item_view_id) {
3857 3857
                     $sql = "UPDATE $item_view_table SET id = iid
3858
-                            WHERE iid = " . $this->db_item_view_id;
3858
+                            WHERE iid = ".$this->db_item_view_id;
3859 3859
                     Database::query($sql);
3860 3860
                     $inserted = true;
3861 3861
                 }
@@ -3865,12 +3865,12 @@  discard block
 block discarded – undo
3865 3865
             $sql = "SELECT * FROM $item_view_table
3866 3866
                     WHERE
3867 3867
                         c_id = $course_id AND
3868
-                        lp_item_id = " . $this->db_id . " AND
3869
-                        lp_view_id = " . $this->view_id . " AND
3868
+                        lp_item_id = ".$this->db_id." AND
3869
+                        lp_view_id = " . $this->view_id." AND
3870 3870
                         view_count = " . intval($this->get_attempt_id());
3871 3871
             if (self::debug > 2) {
3872 3872
                 error_log(
3873
-                    'learnpathItem::write_to_db() - Querying item_view: ' . $sql,
3873
+                    'learnpathItem::write_to_db() - Querying item_view: '.$sql,
3874 3874
                     0
3875 3875
                 );
3876 3876
             }
@@ -3887,7 +3887,7 @@  discard block
 block discarded – undo
3887 3887
                     "max_score" => $this->get_max(),
3888 3888
                     "lp_item_id" => $this->db_id,
3889 3889
                     "lp_view_id" => $this->view_id,
3890
-                    "view_count" => $this->get_attempt_id() ,
3890
+                    "view_count" => $this->get_attempt_id(),
3891 3891
                     "suspend_data" => $this->current_data,
3892 3892
                     //"max_time_allowed" => ,$this->get_max_time_allowed()
3893 3893
                     "lesson_location" => $this->lesson_location
@@ -3895,7 +3895,7 @@  discard block
 block discarded – undo
3895 3895
 
3896 3896
                 if (self::debug > 2) {
3897 3897
                     error_log(
3898
-                        'learnpathItem::write_to_db() - Inserting into item_view forced: ' . print_r($params, 1),
3898
+                        'learnpathItem::write_to_db() - Inserting into item_view forced: '.print_r($params, 1),
3899 3899
                         0
3900 3900
                     );
3901 3901
                 }
@@ -3904,7 +3904,7 @@  discard block
 block discarded – undo
3904 3904
 
3905 3905
                 if ($this->db_item_view_id) {
3906 3906
                     $sql = "UPDATE $item_view_table SET id = iid
3907
-                            WHERE iid = " . $this->db_item_view_id;
3907
+                            WHERE iid = ".$this->db_item_view_id;
3908 3908
                     Database::query($sql);
3909 3909
                 }
3910 3910
             } else {
@@ -3944,8 +3944,8 @@  discard block
 block discarded – undo
3944 3944
                             $time_exe_date = convert_sql_date(
3945 3945
                                 $row_dates['exe_date']
3946 3946
                             );
3947
-                            $mytime = ((int)$time_exe_date - (int)$time_start_date);
3948
-                            $total_time = " total_time = " . $mytime . ", ";
3947
+                            $mytime = ((int) $time_exe_date - (int) $time_start_date);
3948
+                            $total_time = " total_time = ".$mytime.", ";
3949 3949
                         }
3950 3950
                     } else {
3951 3951
                         $my_type_lp = learnpath::get_type_static($this->lp_id);
@@ -3959,16 +3959,16 @@  discard block
 block discarded – undo
3959 3959
 
3960 3960
                         // Is not multiple attempts
3961 3961
                         if ($this->seriousgame_mode == 1 && $this->type == 'sco') {
3962
-                            $total_time = " total_time = total_time +" . $this->get_total_time() . ", ";
3963
-                            $my_status = " status = '" . $this->get_status(false) . "' ,";
3962
+                            $total_time = " total_time = total_time +".$this->get_total_time().", ";
3963
+                            $my_status = " status = '".$this->get_status(false)."' ,";
3964 3964
                         } elseif ($this->get_prevent_reinit() == 1) {
3965 3965
                             // Process of status verified into data base.
3966
-                            $sql = 'SELECT status FROM ' . $item_view_table . '
3966
+                            $sql = 'SELECT status FROM '.$item_view_table.'
3967 3967
                                     WHERE
3968
-                                        c_id = ' . $course_id . ' AND
3969
-                                        lp_item_id="' . $this->db_id . '" AND
3970
-                                        lp_view_id="' . $this->view_id . '" AND
3971
-                                        view_count="' . $this->get_attempt_id() . '"
3968
+                                        c_id = ' . $course_id.' AND
3969
+                                        lp_item_id="' . $this->db_id.'" AND
3970
+                                        lp_view_id="' . $this->view_id.'" AND
3971
+                                        view_count="' . $this->get_attempt_id().'"
3972 3972
                                     ';
3973 3973
                             $rs_verified = Database::query($sql);
3974 3974
                             $row_verified = Database::fetch_array($rs_verified);
@@ -3978,26 +3978,26 @@  discard block
 block discarded – undo
3978 3978
                             if (!in_array($this->get_status(false), $case_completed) &&
3979 3979
                                 $my_type_lp == 2
3980 3980
                             ) {
3981
-                                $total_time = " total_time = total_time +" . $this->get_total_time() . ", ";
3982
-                                $my_status = " status = '" . $this->get_status(false) . "' ,";
3981
+                                $total_time = " total_time = total_time +".$this->get_total_time().", ";
3982
+                                $my_status = " status = '".$this->get_status(false)."' ,";
3983 3983
                             } else {
3984 3984
                                 // Verified into database.
3985 3985
                                 if (!in_array($row_verified['status'], $case_completed) &&
3986 3986
                                     $my_type_lp == 2
3987 3987
                                 ) {
3988
-                                    $total_time = " total_time = total_time +" . $this->get_total_time() . ", ";
3989
-                                    $my_status = " status = '" . $this->get_status(false) . "' ,";
3990
-                                } elseif (in_array($row_verified['status'], $case_completed ) &&
3988
+                                    $total_time = " total_time = total_time +".$this->get_total_time().", ";
3989
+                                    $my_status = " status = '".$this->get_status(false)."' ,";
3990
+                                } elseif (in_array($row_verified['status'], $case_completed) &&
3991 3991
                                     $my_type_lp == 2 && $this->type != 'sco'
3992 3992
                                 ) {
3993
-                                    $total_time = " total_time = total_time +" . $this->get_total_time() . ", ";
3994
-                                    $my_status = " status = '" . $this->get_status(false) . "' ,";
3993
+                                    $total_time = " total_time = total_time +".$this->get_total_time().", ";
3994
+                                    $my_status = " status = '".$this->get_status(false)."' ,";
3995 3995
                                 } else {
3996 3996
                                     if (($my_type_lp == 3 && $this->type == 'au') ||
3997 3997
                                         ($my_type_lp == 1 && $this->type != 'chapter')) {
3998 3998
                                         // Is AICC or Chamilo LP
3999
-                                        $total_time = " total_time = total_time + " . $this->get_total_time() . ", ";
4000
-                                        $my_status = " status = '" . $this->get_status(false) . "' ,";
3999
+                                        $total_time = " total_time = total_time + ".$this->get_total_time().", ";
4000
+                                        $my_status = " status = '".$this->get_status(false)."' ,";
4001 4001
                                     }
4002 4002
                                 }
4003 4003
                             }
@@ -4009,27 +4009,27 @@  discard block
 block discarded – undo
4009 4009
                                 ) && $my_type_lp == 2
4010 4010
                             ) {
4011 4011
                                 // Reset zero new attempt ?
4012
-                                $my_status = " status = '" . $this->get_status(false) . "' ,";
4012
+                                $my_status = " status = '".$this->get_status(false)."' ,";
4013 4013
                             } elseif (!in_array($this->get_status(false), $case_completed) &&
4014 4014
                                 $my_type_lp == 2
4015 4015
                             ) {
4016
-                                $total_time = " total_time = " . $this->get_total_time() . ", ";
4017
-                                $my_status = " status = '" . $this->get_status(false) . "' ,";
4016
+                                $total_time = " total_time = ".$this->get_total_time().", ";
4017
+                                $my_status = " status = '".$this->get_status(false)."' ,";
4018 4018
                             } else {
4019 4019
                                 // It is chamilo LP.
4020
-                                $total_time = " total_time = total_time +" . $this->get_total_time() . ", ";
4021
-                                $my_status = " status = '" . $this->get_status(false) . "' ,";
4020
+                                $total_time = " total_time = total_time +".$this->get_total_time().", ";
4021
+                                $my_status = " status = '".$this->get_status(false)."' ,";
4022 4022
                             }
4023 4023
 
4024 4024
                             // This code line fixes the problem of wrong status.
4025 4025
                             if ($my_type_lp == 2) {
4026 4026
                                 // Verify current status in multiples attempts.
4027
-                                $sql = 'SELECT status FROM ' . $item_view_table . '
4027
+                                $sql = 'SELECT status FROM '.$item_view_table.'
4028 4028
                                         WHERE
4029
-                                            c_id = ' . $course_id . ' AND
4030
-                                            lp_item_id="' . $this->db_id . '" AND
4031
-                                            lp_view_id="' . $this->view_id . '" AND
4032
-                                            view_count="' . $this->get_attempt_id() . '" ';
4029
+                                            c_id = ' . $course_id.' AND
4030
+                                            lp_item_id="' . $this->db_id.'" AND
4031
+                                            lp_view_id="' . $this->view_id.'" AND
4032
+                                            view_count="' . $this->get_attempt_id().'" ';
4033 4033
                                 $rs_status = Database::query($sql);
4034 4034
                                 $current_status = Database::result(
4035 4035
                                     $rs_status,
@@ -4040,7 +4040,7 @@  discard block
 block discarded – undo
4040 4040
                                     $my_status = '';
4041 4041
                                     $total_time = '';
4042 4042
                                 } else {
4043
-                                    $total_time = " total_time = total_time +" . $this->get_total_time() . ", ";
4043
+                                    $total_time = " total_time = total_time +".$this->get_total_time().", ";
4044 4044
                                 }
4045 4045
                             }
4046 4046
                         }
@@ -4051,38 +4051,38 @@  discard block
 block discarded – undo
4051 4051
                         //" . //start_time = ".$this->get_current_start_time().", " . //scorm_init_time does it
4052 4052
                         ////" max_time_allowed = '".$this->get_max_time_allowed()."'," .
4053 4053
                         $sql = "UPDATE $item_view_table SET
4054
-                                    score = " . $this->get_score() . ",
4054
+                                    score = ".$this->get_score().",
4055 4055
                                     $my_status
4056
-                                    max_score = '" . $this->get_max() . "',
4057
-                                    suspend_data = '" . Database::escape_string($this->current_data) . "',
4058
-                                    lesson_location = '" . $this->lesson_location . "'
4056
+                                    max_score = '".$this->get_max()."',
4057
+                                    suspend_data = '" . Database::escape_string($this->current_data)."',
4058
+                                    lesson_location = '" . $this->lesson_location."'
4059 4059
                                 WHERE
4060 4060
                                     c_id = $course_id AND
4061
-                                    lp_item_id = " . $this->db_id . " AND
4062
-                                    lp_view_id = " . $this->view_id . "  AND
4061
+                                    lp_item_id = ".$this->db_id." AND
4062
+                                    lp_view_id = " . $this->view_id."  AND
4063 4063
                                     view_count = " . $this->get_attempt_id();
4064 4064
 
4065 4065
                     } else {
4066 4066
                         //" max_time_allowed = '".$this->get_max_time_allowed()."'," .
4067 4067
                         $sql = "UPDATE $item_view_table SET
4068 4068
                                     $total_time
4069
-                                    start_time = " . $this->get_current_start_time() . ",
4070
-                                    score = " . $this->get_score() . ",
4069
+                                    start_time = ".$this->get_current_start_time().",
4070
+                                    score = " . $this->get_score().",
4071 4071
                                     $my_status
4072
-                                    max_score = '" . $this->get_max() . "',
4073
-                                    suspend_data = '" . Database::escape_string($this->current_data) . "',
4074
-                                    lesson_location = '" . $this->lesson_location . "'
4072
+                                    max_score = '".$this->get_max()."',
4073
+                                    suspend_data = '" . Database::escape_string($this->current_data)."',
4074
+                                    lesson_location = '" . $this->lesson_location."'
4075 4075
                                 WHERE
4076 4076
                                     c_id = $course_id AND
4077
-                                    lp_item_id = " . $this->db_id . " AND
4078
-                                    lp_view_id = " . $this->view_id . " AND
4077
+                                    lp_item_id = ".$this->db_id." AND
4078
+                                    lp_view_id = " . $this->view_id." AND
4079 4079
                                     view_count = " . $this->get_attempt_id();
4080 4080
                     }
4081 4081
                     $this->current_start_time = time();
4082 4082
                 }
4083 4083
                 if (self::debug > 2) {
4084 4084
                     error_log(
4085
-                        'learnpathItem::write_to_db() - Updating item_view: ' . $sql,
4085
+                        'learnpathItem::write_to_db() - Updating item_view: '.$sql,
4086 4086
                         0
4087 4087
                     );
4088 4088
                 }
@@ -4095,8 +4095,8 @@  discard block
 block discarded – undo
4095 4095
                 $sql = "SELECT id FROM $tbl
4096 4096
                         WHERE
4097 4097
                             c_id = $course_id AND
4098
-                            lp_item_id = " . $this->db_id . " AND
4099
-                            lp_view_id = " . $this->view_id . " AND
4098
+                            lp_item_id = ".$this->db_id." AND
4099
+                            lp_view_id = " . $this->view_id." AND
4100 4100
                             view_count = " . $this->get_attempt_id();
4101 4101
                 $res = Database::query($sql);
4102 4102
                 if (Database::num_rows($res) > 0) {
@@ -4104,8 +4104,8 @@  discard block
 block discarded – undo
4104 4104
                     $lp_iv_id = $row[0];
4105 4105
                     if (self::debug > 2) {
4106 4106
                         error_log(
4107
-                            'learnpathItem::write_to_db() - Got item_view_id ' .
4108
-                                $lp_iv_id . ', now checking interactions ',
4107
+                            'learnpathItem::write_to_db() - Got item_view_id '.
4108
+                                $lp_iv_id.', now checking interactions ',
4109 4109
                             0
4110 4110
                         );
4111 4111
                     }
@@ -4116,7 +4116,7 @@  discard block
 block discarded – undo
4116 4116
                             ) && !empty($interaction[4][0])
4117 4117
                         ) {
4118 4118
                             foreach ($interaction[4] as $resp) {
4119
-                                $correct_resp .= $resp . ',';
4119
+                                $correct_resp .= $resp.',';
4120 4120
                             }
4121 4121
                             $correct_resp = substr(
4122 4122
                                 $correct_resp,
@@ -4135,7 +4135,7 @@  discard block
 block discarded – undo
4135 4135
                                         lp_iv_id = $lp_iv_id AND
4136 4136
                                         (
4137 4137
                                             order_id = $index OR
4138
-                                            interaction_id = '" . Database::escape_string($interaction[0]) . "'
4138
+                                            interaction_id = '".Database::escape_string($interaction[0])."'
4139 4139
                                         )
4140 4140
                                     ";
4141 4141
                         $iva_res = Database::query($iva_sql);
@@ -4208,11 +4208,11 @@  discard block
 block discarded – undo
4208 4208
     public function add_audio()
4209 4209
     {
4210 4210
         $course_info = api_get_course_info();
4211
-        $filepath = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document/';
4211
+        $filepath = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document/';
4212 4212
 
4213
-        if (!is_dir($filepath . 'audio')) {
4213
+        if (!is_dir($filepath.'audio')) {
4214 4214
             mkdir(
4215
-                $filepath . 'audio',
4215
+                $filepath.'audio',
4216 4216
                 api_get_permissions_for_new_directories()
4217 4217
             );
4218 4218
             $audio_id = add_document(
@@ -4271,10 +4271,10 @@  discard block
 block discarded – undo
4271 4271
             // Store the mp3 file in the lp_item table.
4272 4272
             $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
4273 4273
             $sql = "UPDATE $tbl_lp_item SET
4274
-                        audio = '" . Database::escape_string($file_path) . "'
4274
+                        audio = '".Database::escape_string($file_path)."'
4275 4275
                     WHERE
4276 4276
                         c_id = {$course_info['real_id']} AND
4277
-                        id = '" . intval($this->db_id) . "'";
4277
+                        id = '".intval($this->db_id)."'";
4278 4278
             Database::query($sql);
4279 4279
         }
4280 4280
 
@@ -4299,10 +4299,10 @@  discard block
 block discarded – undo
4299 4299
             // Store the mp3 file in the lp_item table.
4300 4300
             $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
4301 4301
             $sql = "UPDATE $tbl_lp_item SET
4302
-                        audio = '" . Database::escape_string($file_path) . "'
4302
+                        audio = '".Database::escape_string($file_path)."'
4303 4303
                     WHERE
4304 4304
                         c_id = {$course_info['real_id']} AND
4305
-                        id = " . intval($this->db_id);
4305
+                        id = ".intval($this->db_id);
4306 4306
             Database::query($sql);
4307 4307
         }
4308 4308
         return $file_path;
@@ -4323,7 +4323,7 @@  discard block
 block discarded – undo
4323 4323
         }
4324 4324
         $sql = "UPDATE $tbl_lp_item SET
4325 4325
                 audio = ''
4326
-                WHERE c_id = $course_id AND id IN (" . $this->db_id . ")";
4326
+                WHERE c_id = $course_id AND id IN (".$this->db_id.")";
4327 4327
         Database::query($sql);
4328 4328
     }
4329 4329
 
@@ -4369,7 +4369,7 @@  discard block
 block discarded – undo
4369 4369
 
4370 4370
         if ($type == 'simple') {
4371 4371
             if (in_array($status, array('failed', 'passed', 'browsed'))) {
4372
-                $myLessonStatus = get_lang('ScormIncomplete');;
4372
+                $myLessonStatus = get_lang('ScormIncomplete'); ;
4373 4373
                 $classStatus = 'warning';
4374 4374
             }
4375 4375
         }
@@ -4518,7 +4518,7 @@  discard block
 block discarded – undo
4518 4518
      */
4519 4519
     public function createForumThread($currentForumId)
4520 4520
     {
4521
-        require_once api_get_path(SYS_CODE_PATH) . '/forum/forumfunction.inc.php';
4521
+        require_once api_get_path(SYS_CODE_PATH).'/forum/forumfunction.inc.php';
4522 4522
 
4523 4523
         $em = Database::getManager();
4524 4524
         $threadRepo = $em->getRepository('ChamiloCourseBundle:CForumThread');
Please login to merge, or discard this patch.
main/newscorm/learnpathList.class.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
      * @param   int     $categoryId
35 35
      * @param bool $ignoreCategoryFilter
36 36
      *
37
-     * @return	void
37
+     * @return	false|null
38 38
      */
39 39
     public function __construct(
40 40
         $user_id,
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
                     ";
106 106
         $res = Database::query($sql);
107 107
         $names = array();
108
-        while ($row = Database::fetch_array($res,'ASSOC')) {
108
+        while ($row = Database::fetch_array($res, 'ASSOC')) {
109 109
             // Use domesticate here instead of Database::escape_string because
110 110
             // it prevents ' to be slashed and the input (done by learnpath.class.php::toggle_visibility())
111 111
             // is done using domesticate()
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 
236 236
         $lessons = array();
237 237
         while ($row = Database::fetch_array($result)) {
238
-            if (api_get_item_visibility($course, 'learnpath', $row['id'],  $session_id)) {
238
+            if (api_get_item_visibility($course, 'learnpath', $row['id'], $session_id)) {
239 239
                 $lessons[$row['id']] = $row;
240 240
             }
241 241
         }
Please login to merge, or discard this patch.
main/newscorm/lp_ajax_save_item.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@
 block discarded – undo
20 20
  * @param   int $user_id User ID
21 21
  * @param   int $view_id View ID
22 22
  * @param   int $item_id Item ID
23
- * @param   float  $score Current score
24
- * @param   float  $max Maximum score
25
- * @param   float  $min Minimum score
23
+ * @param   integer  $score Current score
24
+ * @param   integer  $max Maximum score
25
+ * @param   integer  $min Minimum score
26 26
  * @param   string  $status Lesson status
27 27
  * @param   int  $time Session time
28 28
  * @param   string  $suspend Suspend data
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -458,7 +458,7 @@
 block discarded – undo
458 458
     }
459 459
 
460 460
     if ($myLP->get_type() == 2) {
461
-         $return .= "update_stats();";
461
+            $return .= "update_stats();";
462 462
     }
463 463
 
464 464
     // To be sure progress is updated.
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         // Set status to completed for hotpotatoes if score > 80%.
164 164
         if ($my_type == 'hotpotatoes') {
165 165
             if ((empty($status) || $status == 'undefined' || $status == 'not attempted') && $max > 0) {
166
-                if (($score/$max) > 0.8) {
166
+                if (($score / $max) > 0.8) {
167 167
                     $myStatus = 'completed';
168 168
                     if ($debug > 1) {
169 169
                         error_log('Calling set_status('.$myStatus.') for hotpotatoes', 0);
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
                         error_log('Done calling set_status for hotpotatoes - now '.$myLPI->get_status(false), 0);
175 175
                     }
176 176
                 }
177
-            } elseif ($status == 'completed' && $max > 0 && ($score/$max) < 0.8) {
177
+            } elseif ($status == 'completed' && $max > 0 && ($score / $max) < 0.8) {
178 178
                 $myStatus = 'failed';
179 179
                 if ($debug > 1) {
180 180
                     error_log('Calling set_status('.$myStatus.') for hotpotatoes', 0);
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
             $myLPI->current_data = $suspend;
368 368
         }
369 369
 
370
-        if (isset($location) && $location != '' && $location!='undefined') {
370
+        if (isset($location) && $location != '' && $location != 'undefined') {
371 371
             $myLPI->set_lesson_location($location);
372 372
         }
373 373
 
Please login to merge, or discard this patch.