Passed
Push — 1.10.x ( 51b3f0...0b3bd8 )
by Yannick
116:33 queued 61:35
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.
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.
Indentation   +545 added lines, -545 removed lines patch added patch discarded remove patch
@@ -1,38 +1,38 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * xajaxResponse.inc.php :: xajax XML response class
4
- *
5
- * xajax version 0.2.4
6
- * copyright (c) 2005 by Jared White & J. Max Wilson
7
- * http://www.xajaxproject.org
8
- *
9
- * xajax is an open source PHP class library for easily creating powerful
10
- * PHP-driven, web-based Ajax Applications. Using xajax, you can asynchronously
11
- * call PHP functions and update the content of your your webpage without
12
- * reloading the page.
13
- *
14
- * xajax is released under the terms of the LGPL license
15
- * http://www.gnu.org/copyleft/lesser.html#SEC3
16
- *
17
- * This library is free software; you can redistribute it and/or
18
- * modify it under the terms of the GNU Lesser General Public
19
- * License as published by the Free Software Foundation; either
20
- * version 2.1 of the License, or (at your option) any later version.
21
- *
22
- * This library is distributed in the hope that it will be useful,
23
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25
- * Lesser General Public License for more details.
26
- *
27
- * You should have received a copy of the GNU Lesser General Public
28
- * License along with this library; if not, write to the Free Software
29
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
30
- *
31
- * @package chamilo.include.xajax
32
- * @version $Id: xajaxResponse.inc.php,v 1.1 2006/07/21 15:29:46 elixir_inter Exp $
33
- * @copyright Copyright (c) 2005-2006  by Jared White & J. Max Wilson
34
- * @license http://www.gnu.org/copyleft/lesser.html#SEC3 LGPL License
35
- */
3
+     * xajaxResponse.inc.php :: xajax XML response class
4
+     *
5
+     * xajax version 0.2.4
6
+     * copyright (c) 2005 by Jared White & J. Max Wilson
7
+     * http://www.xajaxproject.org
8
+     *
9
+     * xajax is an open source PHP class library for easily creating powerful
10
+     * PHP-driven, web-based Ajax Applications. Using xajax, you can asynchronously
11
+     * call PHP functions and update the content of your your webpage without
12
+     * reloading the page.
13
+     *
14
+     * xajax is released under the terms of the LGPL license
15
+     * http://www.gnu.org/copyleft/lesser.html#SEC3
16
+     *
17
+     * This library is free software; you can redistribute it and/or
18
+     * modify it under the terms of the GNU Lesser General Public
19
+     * License as published by the Free Software Foundation; either
20
+     * version 2.1 of the License, or (at your option) any later version.
21
+     *
22
+     * This library is distributed in the hope that it will be useful,
23
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25
+     * Lesser General Public License for more details.
26
+     *
27
+     * You should have received a copy of the GNU Lesser General Public
28
+     * License along with this library; if not, write to the Free Software
29
+     * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
30
+     *
31
+     * @package chamilo.include.xajax
32
+     * @version $Id: xajaxResponse.inc.php,v 1.1 2006/07/21 15:29:46 elixir_inter Exp $
33
+     * @copyright Copyright (c) 2005-2006  by Jared White & J. Max Wilson
34
+     * @license http://www.gnu.org/copyleft/lesser.html#SEC3 LGPL License
35
+     */
36 36
 
37 37
 /*
38 38
    ----------------------------------------------------------------------------
@@ -67,521 +67,521 @@  discard block
 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.
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.
Spacing   +692 added lines, -692 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[]', 0);
270 270
                         }
271 271
                     }
@@ -282,19 +282,19 @@  discard block
 block discarded – undo
282 282
 
283 283
                         $this->refs_list[$oItem->ref] = $my_item_id;
284 284
                         if ($this->debug > 2) {
285
-                            error_log('New LP - object with id ' . $my_item_id . ' set in items[]', 0);
285
+                            error_log('New LP - object with id '.$my_item_id.' set in items[]', 0);
286 286
                         }
287 287
                     }
288 288
                     break;
289 289
                 case 1:
290 290
                 default:
291 291
                     if ($this->debug > 2) {
292
-                        error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - calling learnpathItem', 0);
292
+                        error_log('New LP - learnpath::__construct() '.__LINE__.' - calling learnpathItem', 0);
293 293
                     }
294 294
                     $oItem = new learnpathItem($row['id'], $user_id, $course_id, $row);
295 295
 
296 296
                     if ($this->debug > 2) {
297
-                        error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - end calling learnpathItem', 0);
297
+                        error_log('New LP - learnpath::__construct() '.__LINE__.' - end calling learnpathItem', 0);
298 298
                     }
299 299
                     if (is_object($oItem)) {
300 300
                         $my_item_id = $oItem->get_id();
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
                         $this->refs_list[$my_item_id] = $my_item_id;
306 306
                         if ($this->debug > 2) {
307 307
                             error_log(
308
-                                'New LP - learnpath::__construct() ' . __LINE__ .
309
-                                ' - object with id ' . $my_item_id . ' set in items[]',
308
+                                'New LP - learnpath::__construct() '.__LINE__.
309
+                                ' - object with id '.$my_item_id.' set in items[]',
310 310
                                 0);
311 311
                         }
312 312
                     }
@@ -324,13 +324,13 @@  discard block
 block discarded – undo
324 324
                 $this->items[$row['id']]->set_lp_view($this->lp_view_id, $course_id);
325 325
                 if ($this->items[$row['id']]->get_type() == TOOL_HOTPOTATOES) {
326 326
                     $this->items[$row['id']]->current_start_time = 0;
327
-                    $this->items[$row['id']]->current_stop_time	= 0;
327
+                    $this->items[$row['id']]->current_stop_time = 0;
328 328
                 }
329 329
             }
330 330
         }
331 331
 
332 332
         if ($this->debug > 2) {
333
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' ----- end while ----', 0);
333
+            error_log('New LP - learnpath::__construct() '.__LINE__.' ----- end while ----', 0);
334 334
         }
335 335
 
336 336
         if (!empty($lp_item_id_list)) {
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
         // TODO: Define the current item better.
423 423
         $this->first();
424 424
         if ($this->debug > 2) {
425
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - End of learnpath constructor for learnpath ' . $this->get_id(), 0);
425
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - End of learnpath constructor for learnpath '.$this->get_id(), 0);
426 426
         }
427 427
         return true;
428 428
     }
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
     ) {
497 497
         $course_id = $this->course_info['real_id'];
498 498
         if ($this->debug > 0) {
499
-            error_log('New LP - In learnpath::add_item(' . $parent . ',' . $previous . ',' . $type . ',' . $id . ',' . $title . ')', 0);
499
+            error_log('New LP - In learnpath::add_item('.$parent.','.$previous.','.$type.','.$id.','.$title.')', 0);
500 500
         }
501 501
         if (empty($course_id)) {
502 502
             // Sometimes Oogie doesn't catch the course info but sets $this->cc
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
                 FROM $tbl_lp_item
517 517
                 WHERE
518 518
                     c_id = $course_id AND
519
-                    lp_id = " . $this->get_id() . " AND
519
+                    lp_id = ".$this->get_id()." AND
520 520
                     parent_item_id = " . $parent;
521 521
 
522 522
         $res_count = Database::query($sql);
@@ -526,11 +526,11 @@  discard block
 block discarded – undo
526 526
         if ($num > 0) {
527 527
             if ($previous == 0) {
528 528
                 $sql = "SELECT id, next_item_id, display_order
529
-                        FROM " . $tbl_lp_item . "
529
+                        FROM " . $tbl_lp_item."
530 530
                         WHERE
531 531
                             c_id = $course_id AND
532
-                            lp_id = " . $this->get_id() . " AND
533
-                            parent_item_id = " . $parent . " AND
532
+                            lp_id = ".$this->get_id()." AND
533
+                            parent_item_id = " . $parent." AND
534 534
                             previous_item_id = 0 OR
535 535
                             previous_item_id=" . $parent;
536 536
                 $result = Database::query($sql);
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 						FROM $tbl_lp_item
546 546
                         WHERE
547 547
                             c_id = $course_id AND
548
-                            lp_id = " . $this->get_id() . " AND
548
+                            lp_id = ".$this->get_id()." AND
549 549
                             id = " . $previous;
550 550
 
551 551
                 $result = Database::query($sql);
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
         $typeCleaned = Database::escape_string($type);
566 566
         if ($type == 'quiz') {
567 567
             $sql = 'SELECT SUM(ponderation)
568
-                    FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION) . ' as quiz_question
569
-                    INNER JOIN  ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION) . ' as quiz_rel_question
568
+                    FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION).' as quiz_question
569
+                    INNER JOIN  ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION).' as quiz_rel_question
570 570
                     ON
571 571
                         quiz_question.id = quiz_rel_question.question_id AND
572 572
                         quiz_question.c_id = quiz_rel_question.c_id
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
         $new_item_id = Database::insert($tbl_lp_item, $params);
613 613
 
614 614
         if ($this->debug > 2) {
615
-            error_log('New LP - Inserting chapter: ' . $new_item_id, 0);
615
+            error_log('New LP - Inserting chapter: '.$new_item_id, 0);
616 616
         }
617 617
 
618 618
         if ($new_item_id) {
@@ -629,28 +629,28 @@  discard block
 block discarded – undo
629 629
             Database::query($sql);
630 630
 
631 631
             // Update all the items after the new item.
632
-            $sql = "UPDATE " . $tbl_lp_item . "
632
+            $sql = "UPDATE ".$tbl_lp_item."
633 633
                         SET display_order = display_order + 1
634 634
                     WHERE
635 635
                         c_id = $course_id AND
636
-                        lp_id = " . $this->get_id() . " AND
637
-                        id <> " . $new_item_id . " AND
638
-                        parent_item_id = " . $parent . " AND
636
+                        lp_id = ".$this->get_id()." AND
637
+                        id <> " . $new_item_id." AND
638
+                        parent_item_id = " . $parent." AND
639 639
                         display_order > " . $display_order;
640 640
             Database::query($sql);
641 641
 
642 642
             // Update the item that should come after the new item.
643
-            $sql = "UPDATE " . $tbl_lp_item . "
644
-                    SET ref = " . $new_item_id . "
645
-                    WHERE c_id = $course_id AND id = " . $new_item_id;
643
+            $sql = "UPDATE ".$tbl_lp_item."
644
+                    SET ref = " . $new_item_id."
645
+                    WHERE c_id = $course_id AND id = ".$new_item_id;
646 646
             Database::query($sql);
647 647
 
648 648
             // Upload audio.
649 649
             if (!empty($_FILES['mp3']['name'])) {
650 650
                 // Create the audio folder if it does not exist yet.
651
-                $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
652
-                if (!is_dir($filepath . 'audio')) {
653
-                    mkdir($filepath . 'audio', api_get_permissions_for_new_directories());
651
+                $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
652
+                if (!is_dir($filepath.'audio')) {
653
+                    mkdir($filepath.'audio', api_get_permissions_for_new_directories());
654 654
                     $audio_id = add_document(
655 655
                         $_course,
656 656
                         '/audio',
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
                 $file_path = handle_uploaded_document(
688 688
                     $_course,
689 689
                     $_FILES['mp3'],
690
-                    api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document',
690
+                    api_get_path(SYS_COURSE_PATH).$_course['path'].'/document',
691 691
                     '/audio',
692 692
                     api_get_user_id(),
693 693
                     '',
@@ -703,8 +703,8 @@  discard block
 block discarded – undo
703 703
 
704 704
                 // Store the mp3 file in the lp_item table.
705 705
                 $sql = "UPDATE $tbl_lp_item SET
706
-                            audio = '" . Database::escape_string($file) . "'
707
-                        WHERE id = '" . intval($new_item_id) . "'";
706
+                            audio = '".Database::escape_string($file)."'
707
+                        WHERE id = '" . intval($new_item_id)."'";
708 708
                 Database::query($sql);
709 709
             }
710 710
         }
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
         while (Database :: num_rows($res_name)) {
781 781
             // There is already one such name, update the current one a bit.
782 782
             $i++;
783
-            $name = $name . ' - ' . $i;
783
+            $name = $name.' - '.$i;
784 784
             $check_name = "SELECT * FROM $tbl_lp WHERE c_id = $course_id AND name = '$name'";
785 785
             $res_name = Database::query($check_name);
786 786
         }
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
                 // if $item points to an object and there is a parent.
893 893
                 if ($debug) {
894 894
                     error_log(
895
-                        'Autocompleting parent of item ' . $item . ' "'.$currentItem->get_title().'" (item ' . $parent_id . ' "'.$parent->get_title().'") ',
895
+                        'Autocompleting parent of item '.$item.' "'.$currentItem->get_title().'" (item '.$parent_id.' "'.$parent->get_title().'") ',
896 896
                         0
897 897
                     );
898 898
                 }
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
                         if ($childItemId != $item) {
921 921
                             if ($debug) {
922 922
                                 error_log(
923
-                                    'Looking at brother #'.$childItemId . ' "' . $childItem->get_title() . '", status is ' . $childItem->get_status(),
923
+                                    'Looking at brother #'.$childItemId.' "'.$childItem->get_title().'", status is '.$childItem->get_status(),
924 924
                                     0
925 925
                                 );
926 926
                             }
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
                             } else {
941 941
                                 if ($debug > 2) {
942 942
                                     error_log(
943
-                                        '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,
943
+                                        '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,
944 944
                                         0
945 945
                                     );
946 946
                                 }
@@ -1045,15 +1045,15 @@  discard block
 block discarded – undo
1045 1045
         // Delete lp item id.
1046 1046
         foreach ($this->items as $id => $dummy) {
1047 1047
             $sql = "DELETE FROM $lp_item_view
1048
-                    WHERE c_id = $course_id AND lp_item_id = '" . $id . "'";
1048
+                    WHERE c_id = $course_id AND lp_item_id = '".$id."'";
1049 1049
             Database::query($sql);
1050 1050
         }
1051 1051
 
1052 1052
         // Proposed by Christophe (nickname: clefevre)
1053
-        $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
1053
+        $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
1054 1054
         Database::query($sql);
1055 1055
 
1056
-        $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
1056
+        $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
1057 1057
         Database::query($sql);
1058 1058
 
1059 1059
         self::toggle_publish($this->lp_id, 'i');
@@ -1061,32 +1061,32 @@  discard block
 block discarded – undo
1061 1061
         if ($this->type == 2 || $this->type == 3) {
1062 1062
             // This is a scorm learning path, delete the files as well.
1063 1063
             $sql = "SELECT path FROM $lp
1064
-                    WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
1064
+                    WHERE c_id = ".$course_id." AND id = ".$this->lp_id;
1065 1065
             $res = Database::query($sql);
1066 1066
             if (Database :: num_rows($res) > 0) {
1067 1067
                 $row = Database :: fetch_array($res);
1068 1068
                 $path = $row['path'];
1069 1069
                 $sql = "SELECT id FROM $lp
1070
-                        WHERE c_id = ".$course_id." AND path = '$path' AND id != " . $this->lp_id;
1070
+                        WHERE c_id = ".$course_id." AND path = '$path' AND id != ".$this->lp_id;
1071 1071
                 $res = Database::query($sql);
1072 1072
                 if (Database :: num_rows($res) > 0) { // Another learning path uses this directory, so don't delete it.
1073 1073
                     if ($this->debug > 2) {
1074
-                        error_log('New LP - In learnpath::delete(), found other LP using path ' . $path . ', keeping directory', 0);
1074
+                        error_log('New LP - In learnpath::delete(), found other LP using path '.$path.', keeping directory', 0);
1075 1075
                     }
1076 1076
                 } else {
1077 1077
                     // No other LP uses that directory, delete it.
1078
-                    $course_rel_dir = api_get_course_path() . '/scorm/'; // scorm dir web path starting from /courses
1079
-                    $course_scorm_dir = api_get_path(SYS_COURSE_PATH) . $course_rel_dir; // The absolute system path for this course.
1080
-                    if ($delete == 'remove' && is_dir($course_scorm_dir . $path) and !empty ($course_scorm_dir)) {
1078
+                    $course_rel_dir = api_get_course_path().'/scorm/'; // scorm dir web path starting from /courses
1079
+                    $course_scorm_dir = api_get_path(SYS_COURSE_PATH).$course_rel_dir; // The absolute system path for this course.
1080
+                    if ($delete == 'remove' && is_dir($course_scorm_dir.$path) and !empty ($course_scorm_dir)) {
1081 1081
                         if ($this->debug > 2) {
1082
-                            error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: ' . $course_scorm_dir . $path, 0);
1082
+                            error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: '.$course_scorm_dir.$path, 0);
1083 1083
                         }
1084 1084
                         // Proposed by Christophe (clefevre).
1085 1085
                         if (strcmp(substr($path, -2), "/.") == 0) {
1086 1086
                             $path = substr($path, 0, -1); // Remove "." at the end.
1087 1087
                         }
1088 1088
                         //exec('rm -rf ' . $course_scorm_dir . $path); // See Bug #5208, this is not OS-portable way.
1089
-                        rmdirr($course_scorm_dir . $path);
1089
+                        rmdirr($course_scorm_dir.$path);
1090 1090
                     }
1091 1091
                 }
1092 1092
             }
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
                 WHERE c_id = ".$course_id." AND (link LIKE '$link%' AND image='scormbuilder.gif')";
1100 1100
         Database::query($sql);
1101 1101
 
1102
-        $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
1102
+        $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = ".$this->lp_id;
1103 1103
         Database::query($sql);
1104 1104
         // Updates the display order of all lps.
1105 1105
         $this->update_display_order();
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
             api_get_user_id()
1113 1113
         );
1114 1114
 
1115
-        $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4 , $id, api_get_session_id());
1115
+        $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4, $id, api_get_session_id());
1116 1116
         if ($link_info !== false) {
1117 1117
             GradebookUtils::remove_resource_from_course_gradebook($link_info['id']);
1118 1118
         }
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
     {
1133 1133
         $course_id = $this->course_info['real_id'];
1134 1134
         if ($this->debug > 0) {
1135
-            error_log('New LP - In learnpath::delete_children_items(' . $id . ')', 0);
1135
+            error_log('New LP - In learnpath::delete_children_items('.$id.')', 0);
1136 1136
         }
1137 1137
         $num = 0;
1138 1138
         if (empty ($id) || $id != strval(intval($id))) {
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 1143
         $res = Database::query($sql);
1144 1144
         while ($row = Database :: fetch_array($res)) {
1145 1145
             $num += $this->delete_children_items($row['id']);
1146
-            $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = " . $row['id'];
1146
+            $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = ".$row['id'];
1147 1147
             Database::query($sql_del);
1148 1148
             $num++;
1149 1149
         }
@@ -1184,12 +1184,12 @@  discard block
 block discarded – undo
1184 1184
         // Delete children items.
1185 1185
         $num = $this->delete_children_items($id);
1186 1186
         if ($this->debug > 2) {
1187
-            error_log('New LP - learnpath::delete_item() - deleted ' . $num . ' children of element ' . $id, 0);
1187
+            error_log('New LP - learnpath::delete_item() - deleted '.$num.' children of element '.$id, 0);
1188 1188
         }
1189 1189
         // Now delete the item.
1190 1190
         $sql_del = "DELETE FROM $lp_item WHERE c_id = $course_id AND id = $id";
1191 1191
         if ($this->debug > 2) {
1192
-            error_log('New LP - Deleting item: ' . $sql_del, 0);
1192
+            error_log('New LP - Deleting item: '.$sql_del, 0);
1193 1193
         }
1194 1194
         Database::query($sql_del);
1195 1195
         // Now update surrounding items.
@@ -1264,15 +1264,15 @@  discard block
 block discarded – undo
1264 1264
         }
1265 1265
 
1266 1266
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
1267
-        $sql_select = "SELECT * FROM " . $tbl_lp_item . " WHERE c_id = ".$course_id." AND id = " . $id;
1267
+        $sql_select = "SELECT * FROM ".$tbl_lp_item." WHERE c_id = ".$course_id." AND id = ".$id;
1268 1268
         $res_select = Database::query($sql_select);
1269 1269
         $row_select = Database :: fetch_array($res_select);
1270 1270
         $audio_update_sql = '';
1271 1271
         if (is_array($audio) && !empty ($audio['tmp_name']) && $audio['error'] === 0) {
1272 1272
             // Create the audio folder if it does not exist yet.
1273
-            $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
1274
-            if (!is_dir($filepath . 'audio')) {
1275
-                mkdir($filepath . 'audio', api_get_permissions_for_new_directories());
1273
+            $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
1274
+            if (!is_dir($filepath.'audio')) {
1275
+                mkdir($filepath.'audio', api_get_permissions_for_new_directories());
1276 1276
                 $audio_id = add_document(
1277 1277
                     $_course,
1278 1278
                     '/audio',
@@ -1310,11 +1310,11 @@  discard block
 block discarded – undo
1310 1310
             $pi = pathinfo($audio['name']);
1311 1311
             if ($pi['extension'] == 'mp3') {
1312 1312
                 $c_det = api_get_course_info($this->cc);
1313
-                $bp = api_get_path(SYS_COURSE_PATH) . $c_det['path'] . '/document';
1313
+                $bp = api_get_path(SYS_COURSE_PATH).$c_det['path'].'/document';
1314 1314
                 $path = handle_uploaded_document($c_det, $audio, $bp, '/audio', api_get_user_id(), 0, null, 0, 'rename', false, 0);
1315 1315
                 $path = substr($path, 7);
1316 1316
                 // Update reference in lp_item - audio path is the path from inside de document/audio/ dir.
1317
-                $audio_update_sql = ", audio = '" . Database::escape_string($path) . "' ";
1317
+                $audio_update_sql = ", audio = '".Database::escape_string($path)."' ";
1318 1318
             }
1319 1319
         }
1320 1320
 
@@ -1324,13 +1324,13 @@  discard block
 block discarded – undo
1324 1324
         // TODO: htmlspecialchars to be checked for encoding related problems.
1325 1325
         if ($same_parent && $same_previous) {
1326 1326
             // Only update title and description.
1327
-            $sql = "UPDATE " . $tbl_lp_item . "
1328
-                    SET title = '" . Database::escape_string($title) . "',
1329
-                        prerequisite = '" . $prerequisites . "',
1330
-                        description = '" . Database::escape_string($description) . "'
1331
-                        " . $audio_update_sql . ",
1332
-                        max_time_allowed = '" . Database::escape_string($max_time_allowed) . "'
1333
-                    WHERE c_id = ".$course_id." AND id = " . $id;
1327
+            $sql = "UPDATE ".$tbl_lp_item."
1328
+                    SET title = '" . Database::escape_string($title)."',
1329
+                        prerequisite = '" . $prerequisites."',
1330
+                        description = '" . Database::escape_string($description)."'
1331
+                        " . $audio_update_sql.",
1332
+                        max_time_allowed = '" . Database::escape_string($max_time_allowed)."'
1333
+                    WHERE c_id = ".$course_id." AND id = ".$id;
1334 1334
             Database::query($sql);
1335 1335
         } else {
1336 1336
             $old_parent = $row_select['parent_item_id'];
@@ -1345,27 +1345,27 @@  discard block
 block discarded – undo
1345 1345
 
1346 1346
             if ($old_previous != 0) {
1347 1347
                 // Next
1348
-                $sql = "UPDATE " . $tbl_lp_item . "
1349
-                        SET next_item_id = " . $old_next . "
1350
-                        WHERE c_id = ".$course_id." AND id = " . $old_previous;
1348
+                $sql = "UPDATE ".$tbl_lp_item."
1349
+                        SET next_item_id = " . $old_next."
1350
+                        WHERE c_id = ".$course_id." AND id = ".$old_previous;
1351 1351
                 Database::query($sql);
1352 1352
             }
1353 1353
 
1354 1354
             if ($old_next != 0) {
1355 1355
                 // Previous
1356
-                $sql = "UPDATE " . $tbl_lp_item . "
1357
-                        SET previous_item_id = " . $old_previous . "
1358
-                        WHERE c_id = ".$course_id." AND id = " . $old_next;
1356
+                $sql = "UPDATE ".$tbl_lp_item."
1357
+                        SET previous_item_id = " . $old_previous."
1358
+                        WHERE c_id = ".$course_id." AND id = ".$old_next;
1359 1359
                 Database::query($sql);
1360 1360
             }
1361 1361
 
1362 1362
             // display_order - 1 for every item with a display_order bigger then the display_order of the current item.
1363
-            $sql = "UPDATE " . $tbl_lp_item . "
1363
+            $sql = "UPDATE ".$tbl_lp_item."
1364 1364
                     SET display_order = display_order - 1
1365 1365
                     WHERE
1366 1366
                         c_id = ".$course_id." AND
1367
-                        display_order > " . $old_order . " AND
1368
-                        lp_id = " . $this->lp_id . " AND
1367
+                        display_order > " . $old_order." AND
1368
+                        lp_id = " . $this->lp_id." AND
1369 1369
                         parent_item_id = " . $old_parent;
1370 1370
             Database::query($sql);
1371 1371
             /* END -- virtually remove the current item id */
@@ -1375,11 +1375,11 @@  discard block
 block discarded – undo
1375 1375
             if ($previous == 0) {
1376 1376
                 // Select the data of the item that should come after the current item.
1377 1377
                 $sql = "SELECT id, display_order
1378
-                        FROM " . $tbl_lp_item . "
1378
+                        FROM " . $tbl_lp_item."
1379 1379
                         WHERE
1380 1380
                             c_id = ".$course_id." AND
1381
-                            lp_id = " . $this->lp_id . " AND
1382
-                            parent_item_id = " . $parent . " AND
1381
+                            lp_id = " . $this->lp_id." AND
1382
+                            parent_item_id = " . $parent." AND
1383 1383
                             previous_item_id = " . $previous;
1384 1384
                 $res_select_old = Database::query($sql);
1385 1385
                 $row_select_old = Database::fetch_array($res_select_old);
@@ -1395,8 +1395,8 @@  discard block
 block discarded – undo
1395 1395
             } else {
1396 1396
                 // Select the data of the item that should come before the current item.
1397 1397
                 $sql = "SELECT next_item_id, display_order
1398
-                        FROM " . $tbl_lp_item . "
1399
-                        WHERE c_id = ".$course_id." AND id = " . $previous;
1398
+                        FROM " . $tbl_lp_item."
1399
+                        WHERE c_id = ".$course_id." AND id = ".$previous;
1400 1400
                 $res_select_old = Database::query($sql);
1401 1401
                 $row_select_old = Database :: fetch_array($res_select_old);
1402 1402
                 $new_next = $row_select_old['next_item_id'];
@@ -1405,57 +1405,57 @@  discard block
 block discarded – undo
1405 1405
 
1406 1406
             // TODO: htmlspecialchars to be checked for encoding related problems.
1407 1407
             // Update the current item with the new data.
1408
-            $sql = "UPDATE " . $tbl_lp_item . "
1408
+            $sql = "UPDATE ".$tbl_lp_item."
1409 1409
                     SET
1410
-                        title = '" . Database::escape_string($title) . "',
1411
-                        description = '" . Database::escape_string($description) . "',
1412
-                        parent_item_id = " . $parent . ",
1413
-                        previous_item_id = " . $previous . ",
1414
-                        next_item_id = " . $new_next . ",
1415
-                        display_order = " . $new_order . "
1416
-                        " . $audio_update_sql . "
1417
-                    WHERE c_id = ".$course_id." AND id = " . $id;
1410
+                        title = '" . Database::escape_string($title)."',
1411
+                        description = '" . Database::escape_string($description)."',
1412
+                        parent_item_id = " . $parent.",
1413
+                        previous_item_id = " . $previous.",
1414
+                        next_item_id = " . $new_next.",
1415
+                        display_order = " . $new_order."
1416
+                        " . $audio_update_sql."
1417
+                    WHERE c_id = ".$course_id." AND id = ".$id;
1418 1418
             Database::query($sql);
1419 1419
 
1420 1420
             if ($previous != 0) {
1421 1421
                 // Update the previous item's next_item_id.
1422
-                $sql = "UPDATE " . $tbl_lp_item . "
1423
-                        SET next_item_id = " . $id . "
1424
-                        WHERE c_id = ".$course_id." AND id = " . $previous;
1422
+                $sql = "UPDATE ".$tbl_lp_item."
1423
+                        SET next_item_id = " . $id."
1424
+                        WHERE c_id = ".$course_id." AND id = ".$previous;
1425 1425
                 Database::query($sql);
1426 1426
             }
1427 1427
 
1428 1428
             if ($new_next != 0) {
1429 1429
                 // Update the next item's previous_item_id.
1430
-                $sql = "UPDATE " . $tbl_lp_item . "
1431
-                        SET previous_item_id = " . $id . "
1432
-                        WHERE c_id = ".$course_id." AND id = " . $new_next;
1430
+                $sql = "UPDATE ".$tbl_lp_item."
1431
+                        SET previous_item_id = " . $id."
1432
+                        WHERE c_id = ".$course_id." AND id = ".$new_next;
1433 1433
                 Database::query($sql);
1434 1434
             }
1435 1435
 
1436 1436
             if ($old_prerequisite != $prerequisites) {
1437
-                $sql = "UPDATE " . $tbl_lp_item . "
1438
-                        SET prerequisite = '" . $prerequisites . "'
1439
-                        WHERE c_id = ".$course_id." AND id = " . $id;
1437
+                $sql = "UPDATE ".$tbl_lp_item."
1438
+                        SET prerequisite = '" . $prerequisites."'
1439
+                        WHERE c_id = ".$course_id." AND id = ".$id;
1440 1440
                 Database::query($sql);
1441 1441
             }
1442 1442
 
1443 1443
             if ($old_max_time_allowed != $max_time_allowed) {
1444 1444
                 // update max time allowed
1445
-                $sql = "UPDATE " . $tbl_lp_item . "
1446
-                        SET max_time_allowed = " . $max_time_allowed . "
1447
-                        WHERE c_id = ".$course_id." AND id = " . $id;
1445
+                $sql = "UPDATE ".$tbl_lp_item."
1446
+                        SET max_time_allowed = " . $max_time_allowed."
1447
+                        WHERE c_id = ".$course_id." AND id = ".$id;
1448 1448
                 Database::query($sql);
1449 1449
             }
1450 1450
 
1451 1451
             // Update all the items with the same or a bigger display_order than the current item.
1452
-            $sql = "UPDATE " . $tbl_lp_item . "
1452
+            $sql = "UPDATE ".$tbl_lp_item."
1453 1453
                     SET display_order = display_order + 1
1454 1454
                     WHERE
1455 1455
                        c_id = ".$course_id." AND
1456
-                       lp_id = " . $this->get_id() . " AND
1457
-                       id <> " . $id . " AND
1458
-                       parent_item_id = " . $parent . " AND
1456
+                       lp_id = " . $this->get_id()." AND
1457
+                       id <> " . $id." AND
1458
+                       parent_item_id = " . $parent." AND
1459 1459
                        display_order >= " . $new_order;
1460 1460
 
1461 1461
             Database::query($sql);
@@ -1481,7 +1481,7 @@  discard block
 block discarded – undo
1481 1481
     {
1482 1482
         $course_id = api_get_course_int_id();
1483 1483
         if ($this->debug > 0) {
1484
-            error_log('New LP - In learnpath::edit_item_prereq(' . $id . ',' . $prerequisite_id . ',' . $mastery_score . ',' . $max_score . ')', 0);
1484
+            error_log('New LP - In learnpath::edit_item_prereq('.$id.','.$prerequisite_id.','.$mastery_score.','.$max_score.')', 0);
1485 1485
         }
1486 1486
 
1487 1487
         if (empty($id) || ($id != strval(intval($id))) || empty ($prerequisite_id)) {
@@ -1579,8 +1579,8 @@  discard block
 block discarded – undo
1579 1579
             error_log('New LP - In learnpath::get_brother_chapters()', 0);
1580 1580
         }
1581 1581
 
1582
-        if (empty($id)|| $id != strval(intval($id))) {
1583
-            return array ();
1582
+        if (empty($id) || $id != strval(intval($id))) {
1583
+            return array();
1584 1584
         }
1585 1585
 
1586 1586
         $lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -1598,13 +1598,13 @@  discard block
 block discarded – undo
1598 1598
                             item_type='dokeos_chapter'
1599 1599
                         ORDER BY display_order";
1600 1600
             $res_bros = Database::query($sql_bros);
1601
-            $list = array ();
1601
+            $list = array();
1602 1602
             while ($row_bro = Database :: fetch_array($res_bros)) {
1603 1603
                 $list[] = $row_bro;
1604 1604
             }
1605 1605
             return $list;
1606 1606
         }
1607
-        return array ();
1607
+        return array();
1608 1608
     }
1609 1609
 
1610 1610
     /**
@@ -1617,11 +1617,11 @@  discard block
 block discarded – undo
1617 1617
     {
1618 1618
         $course_id = api_get_course_int_id();
1619 1619
         if ($this->debug > 0) {
1620
-            error_log('New LP - In learnpath::get_brother_items(' . $id . ')', 0);
1620
+            error_log('New LP - In learnpath::get_brother_items('.$id.')', 0);
1621 1621
         }
1622 1622
 
1623 1623
         if (empty ($id) || $id != strval(intval($id))) {
1624
-            return array ();
1624
+            return array();
1625 1625
         }
1626 1626
 
1627 1627
         $lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -1633,13 +1633,13 @@  discard block
 block discarded – undo
1633 1633
             $sql_bros = "SELECT * FROM $lp_item WHERE c_id = ".$course_id." AND parent_item_id = $parent
1634 1634
                          ORDER BY display_order";
1635 1635
             $res_bros = Database::query($sql_bros);
1636
-            $list = array ();
1636
+            $list = array();
1637 1637
             while ($row_bro = Database :: fetch_array($res_bros)) {
1638 1638
                 $list[] = $row_bro;
1639 1639
             }
1640 1640
             return $list;
1641 1641
         }
1642
-        return array ();
1642
+        return array();
1643 1643
     }
1644 1644
 
1645 1645
     /**
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
             $current = $this->current;
1710 1710
         }
1711 1711
         if ($this->debug > 2) {
1712
-            error_log('New LP - In learnpath::get_current_item_id() - Returning ' . $current, 0);
1712
+            error_log('New LP - In learnpath::get_current_item_id() - Returning '.$current, 0);
1713 1713
         }
1714 1714
         return $current;
1715 1715
     }
@@ -1790,7 +1790,7 @@  discard block
 block discarded – undo
1790 1790
         ) {
1791 1791
 
1792 1792
             if ($this->debug > 2) {
1793
-                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);
1793
+                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);
1794 1794
             }
1795 1795
             $index = -1;
1796 1796
             foreach ($this->ordered_items as $myindex => $item_id) {
@@ -1802,7 +1802,7 @@  discard block
 block discarded – undo
1802 1802
             if ($index == -1) {
1803 1803
                 // Index hasn't changed, so item not found - panic (this shouldn't happen).
1804 1804
                 if ($this->debug > 2) {
1805
-                    error_log('New LP - Last item (' . $this->last_item_seen . ') was found in items but not in ordered_items, panic!', 0);
1805
+                    error_log('New LP - Last item ('.$this->last_item_seen.') was found in items but not in ordered_items, panic!', 0);
1806 1806
                 }
1807 1807
                 return false;
1808 1808
             } else {
@@ -1817,7 +1817,7 @@  discard block
 block discarded – undo
1817 1817
             $index = 0;
1818 1818
             // Loop through all ordered items and stop at the first item that is
1819 1819
             // not a directory *and* that has not been completed yet.
1820
-            while ( !empty($this->ordered_items[$index]) AND
1820
+            while (!empty($this->ordered_items[$index]) AND
1821 1821
                 is_a($this->items[$this->ordered_items[$index]], 'learnpathItem') AND
1822 1822
                 (
1823 1823
                     $this->items[$this->ordered_items[$index]]->get_type() == 'dir' OR
@@ -1831,14 +1831,14 @@  discard block
 block discarded – undo
1831 1831
             $this->current  = isset($this->ordered_items[$index]) ? $this->ordered_items[$index] : null;
1832 1832
             $this->index    = $index;
1833 1833
             if ($this->debug > 2) {
1834
-                error_log('$index ' . $index);
1834
+                error_log('$index '.$index);
1835 1835
             }
1836 1836
             if ($this->debug > 2) {
1837
-                error_log('New LP - In learnpath::first() - No last item seen. New last = ' . $this->last . '(' . $this->ordered_items[$index] . ')', 0);
1837
+                error_log('New LP - In learnpath::first() - No last item seen. New last = '.$this->last.'('.$this->ordered_items[$index].')', 0);
1838 1838
             }
1839 1839
         }
1840 1840
         if ($this->debug > 2) {
1841
-            error_log('New LP - In learnpath::first() - First item is ' . $this->get_current_item_id());
1841
+            error_log('New LP - In learnpath::first() - First item is '.$this->get_current_item_id());
1842 1842
         }
1843 1843
     }
1844 1844
 
@@ -1851,7 +1851,7 @@  discard block
 block discarded – undo
1851 1851
     public function get_js_info($item_id = '')
1852 1852
     {
1853 1853
         if ($this->debug > 0) {
1854
-            error_log('New LP - In learnpath::get_js_info(' . $item_id . ')', 0);
1854
+            error_log('New LP - In learnpath::get_js_info('.$item_id.')', 0);
1855 1855
         }
1856 1856
 
1857 1857
         $info = '';
@@ -1861,17 +1861,17 @@  discard block
 block discarded – undo
1861 1861
             //if item is defined, return values from DB
1862 1862
             $oItem = $this->items[$item_id];
1863 1863
             $info .= '<script language="javascript">';
1864
-            $info .= "top.set_score(" . $oItem->get_score() . ");\n";
1865
-            $info .= "top.set_max(" . $oItem->get_max() . ");\n";
1866
-            $info .= "top.set_min(" . $oItem->get_min() . ");\n";
1867
-            $info .= "top.set_lesson_status('" . $oItem->get_status() . "');";
1868
-            $info .= "top.set_session_time('" . $oItem->get_scorm_time('js') . "');";
1869
-            $info .= "top.set_suspend_data('" . $oItem->get_suspend_data() . "');";
1870
-            $info .= "top.set_saved_lesson_status('" . $oItem->get_status() . "');";
1864
+            $info .= "top.set_score(".$oItem->get_score().");\n";
1865
+            $info .= "top.set_max(".$oItem->get_max().");\n";
1866
+            $info .= "top.set_min(".$oItem->get_min().");\n";
1867
+            $info .= "top.set_lesson_status('".$oItem->get_status()."');";
1868
+            $info .= "top.set_session_time('".$oItem->get_scorm_time('js')."');";
1869
+            $info .= "top.set_suspend_data('".$oItem->get_suspend_data()."');";
1870
+            $info .= "top.set_saved_lesson_status('".$oItem->get_status()."');";
1871 1871
             $info .= "top.set_flag_synchronized();";
1872 1872
             $info .= '</script>';
1873 1873
             if ($this->debug > 2) {
1874
-                error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0);
1874
+                error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0);
1875 1875
             }
1876 1876
             return $info;
1877 1877
 
@@ -1879,17 +1879,17 @@  discard block
 block discarded – undo
1879 1879
 
1880 1880
             // If item_id is empty, just update to default SCORM data.
1881 1881
             $info .= '<script language="javascript">';
1882
-            $info .= "top.set_score(" . learnpathItem :: get_score() . ");\n";
1883
-            $info .= "top.set_max(" . learnpathItem :: get_max() . ");\n";
1884
-            $info .= "top.set_min(" . learnpathItem :: get_min() . ");\n";
1885
-            $info .= "top.set_lesson_status('" . learnpathItem :: get_status() . "');";
1886
-            $info .= "top.set_session_time('" . learnpathItem :: getScormTimeFromParameter('js') . "');";
1887
-            $info .= "top.set_suspend_data('" . learnpathItem :: get_suspend_data() . "');";
1888
-            $info .= "top.set_saved_lesson_status('" . learnpathItem :: get_status() . "');";
1882
+            $info .= "top.set_score(".learnpathItem :: get_score().");\n";
1883
+            $info .= "top.set_max(".learnpathItem :: get_max().");\n";
1884
+            $info .= "top.set_min(".learnpathItem :: get_min().");\n";
1885
+            $info .= "top.set_lesson_status('".learnpathItem :: get_status()."');";
1886
+            $info .= "top.set_session_time('".learnpathItem :: getScormTimeFromParameter('js')."');";
1887
+            $info .= "top.set_suspend_data('".learnpathItem :: get_suspend_data()."');";
1888
+            $info .= "top.set_saved_lesson_status('".learnpathItem :: get_status()."');";
1889 1889
             $info .= "top.set_flag_synchronized();";
1890 1890
             $info .= '</script>';
1891 1891
             if ($this->debug > 2) {
1892
-                error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0);
1892
+                error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0);
1893 1893
             }
1894 1894
             return $info;
1895 1895
         }
@@ -1943,12 +1943,12 @@  discard block
 block discarded – undo
1943 1943
      * Gets the navigation bar for the learnpath display screen
1944 1944
      * @return	string	The HTML string to use as a navigation bar
1945 1945
      */
1946
-    public function get_navigation_bar($idBar = null, $display=null) {
1946
+    public function get_navigation_bar($idBar = null, $display = null) {
1947 1947
         if ($this->debug > 0) {
1948 1948
             error_log('New LP - In learnpath::get_navigation_bar()', 0);
1949 1949
         }
1950
-        if(empty($idBar)){
1951
-            $idBar='control-top';
1950
+        if (empty($idBar)) {
1951
+            $idBar = 'control-top';
1952 1952
         }
1953 1953
         /* if(empty($display)){
1954 1954
             $display='display:block';
@@ -1961,16 +1961,16 @@  discard block
 block discarded – undo
1961 1961
             $navbar = '
1962 1962
                   <span id="'.$idBar.'" class="buttons">
1963 1963
                     <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">
1964
-                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span>
1964
+                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span>
1965 1965
                     </a>
1966
-                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous">
1967
-                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span>
1966
+                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous">
1967
+                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span>
1968 1968
                     </a>
1969
-                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next">
1970
-                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span>
1969
+                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next">
1970
+                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span>
1971 1971
                     </a>
1972 1972
                     <a class="icon-toolbar" id="view-embedded" href="lp_controller.php?action=mode&mode=embedded" target="_top" title="embedded mode">
1973
-                        <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen') . '</span>
1973
+                        <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen').'</span>
1974 1974
                     </a> 
1975 1975
                   </span>';
1976 1976
 
@@ -1978,13 +1978,13 @@  discard block
 block discarded – undo
1978 1978
             $navbar = '
1979 1979
                 <span id="'.$idBar.'" class="buttons text-right">
1980 1980
                     <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">
1981
-                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span>
1981
+                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span>
1982 1982
                     </a>
1983
-                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous">
1984
-                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span>
1983
+                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous">
1984
+                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span>
1985 1985
                     </a>
1986
-                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next">
1987
-                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span>
1986
+                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next">
1987
+                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span>
1988 1988
                     </a>
1989 1989
                 </span>';
1990 1990
         }
@@ -2005,11 +2005,11 @@  discard block
 block discarded – undo
2005 2005
         $index = $this->index;
2006 2006
         $index++;
2007 2007
         if ($this->debug > 2) {
2008
-            error_log('New LP - Now looking at ordered_items[' . ($index) . '] - type is ' . $this->items[$this->ordered_items[$index]]->type, 0);
2008
+            error_log('New LP - Now looking at ordered_items['.($index).'] - type is '.$this->items[$this->ordered_items[$index]]->type, 0);
2009 2009
         }
2010 2010
         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) {
2011 2011
             $index++;
2012
-            if ($index == $this->max_ordered_items){
2012
+            if ($index == $this->max_ordered_items) {
2013 2013
                 if ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter') {
2014 2014
                     return $this->index;
2015 2015
                 } else {
@@ -2021,7 +2021,7 @@  discard block
 block discarded – undo
2021 2021
             return $this->index;
2022 2022
         }
2023 2023
         if ($this->debug > 2) {
2024
-            error_log('New LP - index is now ' . $index, 0);
2024
+            error_log('New LP - index is now '.$index, 0);
2025 2025
         }
2026 2026
         return $index;
2027 2027
     }
@@ -2039,7 +2039,7 @@  discard block
 block discarded – undo
2039 2039
         if (!empty ($new_index)) {
2040 2040
             if (isset ($this->ordered_items[$new_index])) {
2041 2041
                 if ($this->debug > 2) {
2042
-                    error_log('New LP - In learnpath::get_next_index() - Returning ' . $this->ordered_items[$new_index], 0);
2042
+                    error_log('New LP - In learnpath::get_next_index() - Returning '.$this->ordered_items[$new_index], 0);
2043 2043
                 }
2044 2044
                 return $this->ordered_items[$new_index];
2045 2045
             }
@@ -2081,7 +2081,7 @@  discard block
 block discarded – undo
2081 2081
         }
2082 2082
 
2083 2083
         // Filename without its extension.
2084
-        $file_base_name = str_replace('.' . $extension, '', $filename);
2084
+        $file_base_name = str_replace('.'.$extension, '', $filename);
2085 2085
 
2086 2086
         $zipFile = new PclZip($file_path);
2087 2087
         // Check the zip content (real size and file extension).
@@ -2105,7 +2105,7 @@  discard block
 block discarded – undo
2105 2105
                     break; // Exit the foreach loop.
2106 2106
                 } elseif (
2107 2107
                     preg_match('/aicc\//i', $thisContent['filename']) ||
2108
-                    in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array( 'crs','au','des','cst'))
2108
+                    in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array('crs', 'au', 'des', 'cst'))
2109 2109
                 ) {
2110 2110
                     $ext = strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION));
2111 2111
                     switch ($ext) {
@@ -2147,7 +2147,7 @@  discard block
 block discarded – undo
2147 2147
             error_log('New LP - In learnpath::get_previous_index()', 0);
2148 2148
         }
2149 2149
         $index = $this->index;
2150
-        if (isset ($this->ordered_items[$index -1])) {
2150
+        if (isset ($this->ordered_items[$index - 1])) {
2151 2151
             $index--;
2152 2152
             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')) {
2153 2153
                 $index--;
@@ -2157,7 +2157,7 @@  discard block
 block discarded – undo
2157 2157
             }
2158 2158
         } else {
2159 2159
             if ($this->debug > 2) {
2160
-                error_log('New LP - get_previous_index() - there was no previous index available, reusing ' . $index, 0);
2160
+                error_log('New LP - get_previous_index() - there was no previous index available, reusing '.$index, 0);
2161 2161
             }
2162 2162
             // There is no previous item.
2163 2163
         }
@@ -2200,8 +2200,8 @@  discard block
 block discarded – undo
2200 2200
     {
2201 2201
         $course_id = api_get_course_int_id();
2202 2202
         $_course = api_get_course_info();
2203
-        $tbl_lp_item 		= Database :: get_course_table(TABLE_LP_ITEM);
2204
-        $tbl_lp_item_view 	= Database :: get_course_table(TABLE_LP_ITEM_VIEW);
2203
+        $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
2204
+        $tbl_lp_item_view = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
2205 2205
 
2206 2206
         // Getting all the information about the item.
2207 2207
         $sql = "SELECT * FROM ".$tbl_lp_item." as lp
@@ -2212,7 +2212,7 @@  discard block
 block discarded – undo
2212 2212
                     lp.c_id = $course_id AND
2213 2213
                     lp_view.c_id = $course_id";
2214 2214
         $result = Database::query($sql);
2215
-        $row 	= Database::fetch_assoc($result);
2215
+        $row = Database::fetch_assoc($result);
2216 2216
         $output = '';
2217 2217
 
2218 2218
         if (!empty ($row['audio'])) {
@@ -2220,8 +2220,8 @@  discard block
 block discarded – undo
2220 2220
             $list = $_SESSION['oLP']->get_toc();
2221 2221
             $type_quiz = false;
2222 2222
 
2223
-            foreach($list as $toc) {
2224
-                if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type']=='quiz') ) {
2223
+            foreach ($list as $toc) {
2224
+                if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type'] == 'quiz')) {
2225 2225
                     $type_quiz = true;
2226 2226
                 }
2227 2227
             }
@@ -2284,7 +2284,7 @@  discard block
 block discarded – undo
2284 2284
         $courseCode = null,
2285 2285
         $sessionId = null
2286 2286
     ) {
2287
-        $lp_id = (int)$lp_id;
2287
+        $lp_id = (int) $lp_id;
2288 2288
         $courseInfo = api_get_course_info($courseCode);
2289 2289
         $sessionId = intval($sessionId);
2290 2290
 
@@ -2450,10 +2450,10 @@  discard block
 block discarded – undo
2450 2450
      */
2451 2451
     public static function get_progress_bar($percentage = -1, $text_add = '')
2452 2452
     {
2453
-        $text = $percentage . $text_add;
2453
+        $text = $percentage.$text_add;
2454 2454
         $output = '<div class="progress">
2455
-                        <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.';">
2456
-                        '. $text .'
2455
+                        <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.';">
2456
+                        '. $text.'
2457 2457
                         </div>
2458 2458
                     </div>';
2459 2459
 
@@ -2489,16 +2489,16 @@  discard block
 block discarded – undo
2489 2489
         }
2490 2490
         $total_items = $this->get_total_items_count_without_chapters();
2491 2491
         if ($this->debug > 2) {
2492
-            error_log('New LP - Total items available in this learnpath: ' . $total_items, 0);
2492
+            error_log('New LP - Total items available in this learnpath: '.$total_items, 0);
2493 2493
         }
2494 2494
         $completeItems = $this->get_complete_items_count();
2495 2495
         if ($this->debug > 2) {
2496
-            error_log('New LP - Items completed so far: ' . $completeItems, 0);
2496
+            error_log('New LP - Items completed so far: '.$completeItems, 0);
2497 2497
         }
2498 2498
         if ($add != 0) {
2499 2499
             $completeItems += $add;
2500 2500
             if ($this->debug > 2) {
2501
-                error_log('New LP - Items completed so far (+modifier): ' . $completeItems, 0);
2501
+                error_log('New LP - Items completed so far (+modifier): '.$completeItems, 0);
2502 2502
             }
2503 2503
         }
2504 2504
         $text = '';
@@ -2516,7 +2516,7 @@  discard block
 block discarded – undo
2516 2516
             $text = '%';
2517 2517
         } elseif ($mode == 'abs') {
2518 2518
             $percentage = $completeItems;
2519
-            $text = '/' . $total_items;
2519
+            $text = '/'.$total_items;
2520 2520
         }
2521 2521
 
2522 2522
         return array(
@@ -2712,7 +2712,7 @@  discard block
 block discarded – undo
2712 2712
                 // and replace them, one by one, by the internal IDs (chamilo db)
2713 2713
                 // TODO: Modify the '*' replacement to replace the multiplier in front of it
2714 2714
                 // by a space as well.
2715
-                $find = array (
2715
+                $find = array(
2716 2716
                     '&',
2717 2717
                     '|',
2718 2718
                     '~',
@@ -2724,7 +2724,7 @@  discard block
 block discarded – undo
2724 2724
                     '(',
2725 2725
                     ')'
2726 2726
                 );
2727
-                $replace = array (
2727
+                $replace = array(
2728 2728
                     ' ',
2729 2729
                     ' ',
2730 2730
                     ' ',
@@ -2741,7 +2741,7 @@  discard block
 block discarded – undo
2741 2741
                 foreach ($ids as $id) {
2742 2742
                     $id = trim($id);
2743 2743
                     if (isset ($this->refs_list[$id])) {
2744
-                        $prereq = preg_replace('/[^a-zA-Z_0-9](' . $id . ')[^a-zA-Z_0-9]/', 'ITEM_' . $this->refs_list[$id], $prereq);
2744
+                        $prereq = preg_replace('/[^a-zA-Z_0-9]('.$id.')[^a-zA-Z_0-9]/', 'ITEM_'.$this->refs_list[$id], $prereq);
2745 2745
                     }
2746 2746
                 }
2747 2747
 
@@ -2849,9 +2849,9 @@  discard block
 block discarded – undo
2849 2849
         if ($this->debug > 0) {
2850 2850
             error_log('New LP - In learnpath::get_items_status_list()', 0);
2851 2851
         }
2852
-        $list = array ();
2852
+        $list = array();
2853 2853
         foreach ($this->ordered_items as $item_id) {
2854
-            $list[] = array (
2854
+            $list[] = array(
2855 2855
                 $item_id => $this->items[$item_id]->get_status()
2856 2856
             );
2857 2857
         }
@@ -2905,7 +2905,7 @@  discard block
 block discarded – undo
2905 2905
         $res = Database::query($sql);
2906 2906
         $num = Database :: num_rows($res);
2907 2907
         if ($num > 0) {
2908
-            $list[] = array (
2908
+            $list[] = array(
2909 2909
                 'order_id' => api_htmlentities(get_lang('Order'), ENT_QUOTES),
2910 2910
                 'id' => api_htmlentities(get_lang('InteractionID'), ENT_QUOTES),
2911 2911
                 'type' => api_htmlentities(get_lang('Type'), ENT_QUOTES),
@@ -2916,7 +2916,7 @@  discard block
 block discarded – undo
2916 2916
                 'latency' => api_htmlentities(get_lang('LatencyTimeSpent'), ENT_QUOTES)
2917 2917
             );
2918 2918
             while ($row = Database :: fetch_array($res)) {
2919
-                $list[] = array (
2919
+                $list[] = array(
2920 2920
                     'order_id' => ($row['order_id'] + 1),
2921 2921
                     'id' => urldecode($row['interaction_id']), //urldecode because they often have %2F or stuff like that
2922 2922
                     'type' => $row['interaction_type'],
@@ -2984,7 +2984,7 @@  discard block
 block discarded – undo
2984 2984
                 'status' => api_htmlentities(get_lang('ObjectiveStatus'), ENT_QUOTES)
2985 2985
             );
2986 2986
             while ($row = Database :: fetch_array($res)) {
2987
-                $list[] = array (
2987
+                $list[] = array(
2988 2988
                     'order_id' => ($row['order_id'] + 1),
2989 2989
                     'objective_id' => urldecode($row['objective_id']), // urldecode() because they often have %2F or stuff like that.
2990 2990
                     'score_raw' => $row['score_raw'],
@@ -3011,10 +3011,10 @@  discard block
 block discarded – undo
3011 3011
         $toc = array();
3012 3012
         foreach ($this->ordered_items as $item_id) {
3013 3013
             if ($this->debug > 2) {
3014
-                error_log('learnpath::get_toc(): getting info for item ' . $item_id, 0);
3014
+                error_log('learnpath::get_toc(): getting info for item '.$item_id, 0);
3015 3015
             }
3016 3016
             // TODO: Change this link generation and use new function instead.
3017
-            $toc[] = array (
3017
+            $toc[] = array(
3018 3018
                 'id'            => $item_id,
3019 3019
                 'title'         => $this->items[$item_id]->get_title(),
3020 3020
                 'status'        => $this->items[$item_id]->get_status(),
@@ -3025,7 +3025,7 @@  discard block
 block discarded – undo
3025 3025
             );
3026 3026
         }
3027 3027
         if ($this->debug > 2) {
3028
-            error_log('New LP - In learnpath::get_toc() - TOC array: ' . print_r($toc, true), 0);
3028
+            error_log('New LP - In learnpath::get_toc() - TOC array: '.print_r($toc, true), 0);
3029 3029
         }
3030 3030
         return $toc;
3031 3031
     }
@@ -3042,10 +3042,10 @@  discard block
 block discarded – undo
3042 3042
         }
3043 3043
         $toc = $varname.' = new Array();';
3044 3044
         foreach ($this->ordered_items as $item_id) {
3045
-            $toc.= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
3045
+            $toc .= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
3046 3046
         }
3047 3047
         if ($this->debug > 2) {
3048
-            error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: ' . print_r($toc, true), 0);
3048
+            error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: '.print_r($toc, true), 0);
3049 3049
         }
3050 3050
         return $toc;
3051 3051
     }
@@ -3069,7 +3069,7 @@  discard block
 block discarded – undo
3069 3069
             }
3070 3070
         }
3071 3071
         if ($this->debug > 2) {
3072
-            error_log('New LP - In learnpath::get_type() - Returning ' . ($res ? $res : 'false'), 0);
3072
+            error_log('New LP - In learnpath::get_type() - Returning '.($res ? $res : 'false'), 0);
3073 3073
         }
3074 3074
         return $res;
3075 3075
     }
@@ -3085,7 +3085,7 @@  discard block
 block discarded – undo
3085 3085
         $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
3086 3086
         $lp_id = intval($lp_id);
3087 3087
         $sql = "SELECT lp_type FROM $tbl_lp
3088
-                WHERE c_id = $course_id AND id = '" . $lp_id . "'";
3088
+                WHERE c_id = $course_id AND id = '".$lp_id."'";
3089 3089
         $res = Database::query($sql);
3090 3090
         if ($res === false) {
3091 3091
             return null;
@@ -3177,7 +3177,7 @@  discard block
 block discarded – undo
3177 3177
 
3178 3178
         foreach ($toc_list as $item) {
3179 3179
             // TODO: Complete this
3180
-            $icon_name = array (
3180
+            $icon_name = array(
3181 3181
                 'not attempted' => '../img/notattempted.gif',
3182 3182
                 'incomplete'    => '../img/incomplete.png',
3183 3183
                 'failed'        => '../img/delete.png',
@@ -3189,7 +3189,7 @@  discard block
 block discarded – undo
3189 3189
 
3190 3190
             // Style Status
3191 3191
 
3192
-            $class_name = array (
3192
+            $class_name = array(
3193 3193
                 'not attempted' => 'scorm_not_attempted',
3194 3194
                 'incomplete'    => 'scorm_not_attempted',
3195 3195
                 'failed'        => 'scorm_failed',
@@ -3209,7 +3209,7 @@  discard block
 block discarded – undo
3209 3209
             $dirTypes = self::getChapterTypes();
3210 3210
 
3211 3211
             if (in_array($item['type'], $dirTypes)) {
3212
-                $scorm_color_background ='scorm_item_section ';
3212
+                $scorm_color_background = 'scorm_item_section ';
3213 3213
                 $style_item = '';
3214 3214
             }
3215 3215
             if ($item['id'] == $this->current) {
@@ -3218,7 +3218,7 @@  discard block
 block discarded – undo
3218 3218
                 $scorm_color_background = 'scorm_item_normal '.$scorm_color_background.' ';
3219 3219
             }
3220 3220
 
3221
-            $html .= '<div id="toc_' . $item['id'] . '" class="' . $scorm_color_background . ' '.$class_name[$item['status']].' ">';
3221
+            $html .= '<div id="toc_'.$item['id'].'" class="'.$scorm_color_background.' '.$class_name[$item['status']].' ">';
3222 3222
 
3223 3223
             // Learning path title
3224 3224
             $title = $item['title'];
@@ -3248,7 +3248,7 @@  discard block
 block discarded – undo
3248 3248
                 $html .= stripslashes($title);
3249 3249
             } else {
3250 3250
                 $this->get_link('http', $item['id'], $toc_list);
3251
-                $html .= '<a class="items-list" href="#" onclick="switch_item(' .$mycurrentitemid . ',' .$item['id'] . ');' .'return false;" >' . stripslashes($title) . '</a>';
3251
+                $html .= '<a class="items-list" href="#" onclick="switch_item('.$mycurrentitemid.','.$item['id'].');'.'return false;" >'.stripslashes($title).'</a>';
3252 3252
             }
3253 3253
             $html .= "</div>";
3254 3254
 
@@ -3282,12 +3282,12 @@  discard block
 block discarded – undo
3282 3282
             if ($this->get_lp_session_id() == api_get_session_id()) {
3283 3283
                 $html .= '<div id="actions_lp" class="actions_lp"><hr>';
3284 3284
                 $html .= '<div class="btn-group">';
3285
-                $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'>" .
3286
-                    Display::returnFontAwesomeIcon('street-view') . get_lang('Overview') . "</a>";
3287
-                $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'>" .
3288
-                    Display::returnFontAwesomeIcon('pencil') . get_lang('Edit') . "</a>";
3289
-                $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">' .
3290
-                    Display::returnFontAwesomeIcon('cog') . get_lang('Settings').'</a>';
3285
+                $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'>".
3286
+                    Display::returnFontAwesomeIcon('street-view').get_lang('Overview')."</a>";
3287
+                $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'>".
3288
+                    Display::returnFontAwesomeIcon('pencil').get_lang('Edit')."</a>";
3289
+                $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">'.
3290
+                    Display::returnFontAwesomeIcon('cog').get_lang('Settings').'</a>';
3291 3291
                 $html .= '</div>';
3292 3292
                 $html .= '</div>';
3293 3293
             }
@@ -3338,11 +3338,11 @@  discard block
 block discarded – undo
3338 3338
         $course_id = $this->get_course_int_id();
3339 3339
 
3340 3340
         if ($this->debug > 0) {
3341
-            error_log('New LP - In learnpath::get_link(' . $type . ',' . $item_id . ')', 0);
3341
+            error_log('New LP - In learnpath::get_link('.$type.','.$item_id.')', 0);
3342 3342
         }
3343 3343
         if (empty($item_id)) {
3344 3344
             if ($this->debug > 2) {
3345
-                error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: ' . $this->get_current_item_id(), 0);
3345
+                error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: '.$this->get_current_item_id(), 0);
3346 3346
             }
3347 3347
             $item_id = $this->get_current_item_id();
3348 3348
         }
@@ -3374,7 +3374,7 @@  discard block
 block discarded – undo
3374 3374
                     ON (li.lp_id = l.id AND l.c_id = $course_id AND li.c_id = $course_id )
3375 3375
         		WHERE li.id = $item_id ";
3376 3376
         if ($this->debug > 2) {
3377
-            error_log('New LP - In learnpath::get_link() - selecting item ' . $sql, 0);
3377
+            error_log('New LP - In learnpath::get_link() - selecting item '.$sql, 0);
3378 3378
         }
3379 3379
         $res = Database::query($sql);
3380 3380
         if (Database :: num_rows($res) > 0) {
@@ -3388,9 +3388,9 @@  discard block
 block discarded – undo
3388 3388
             if (empty($lp_item_params) && strpos($lp_item_path, '?') !== false) {
3389 3389
                 list($lp_item_path, $lp_item_params) = explode('?', $lp_item_path);
3390 3390
             }
3391
-            $sys_course_path = api_get_path(SYS_COURSE_PATH) . api_get_course_path();
3391
+            $sys_course_path = api_get_path(SYS_COURSE_PATH).api_get_course_path();
3392 3392
             if ($type == 'http') {
3393
-                $course_path = api_get_path(WEB_COURSE_PATH) . api_get_course_path(); //web path
3393
+                $course_path = api_get_path(WEB_COURSE_PATH).api_get_course_path(); //web path
3394 3394
             } else {
3395 3395
                 $course_path = $sys_course_path; //system path
3396 3396
             }
@@ -3401,8 +3401,8 @@  discard block
 block discarded – undo
3401 3401
             }
3402 3402
 
3403 3403
             if ($this->debug > 2) {
3404
-                error_log('New LP - In learnpath::get_link() - $lp_type ' . $lp_type, 0);
3405
-                error_log('New LP - In learnpath::get_link() - $lp_item_type ' . $lp_item_type, 0);
3404
+                error_log('New LP - In learnpath::get_link() - $lp_type '.$lp_type, 0);
3405
+                error_log('New LP - In learnpath::get_link() - $lp_item_type '.$lp_item_type, 0);
3406 3406
             }
3407 3407
 
3408 3408
             // Now go through the specific cases to get the end of the path
@@ -3421,7 +3421,7 @@  discard block
 block discarded – undo
3421 3421
                         );
3422 3422
 
3423 3423
                         if ($this->debug > 0) {
3424
-                            error_log('rl_get_resource_link_for_learnpath - file: ' . $file, 0);
3424
+                            error_log('rl_get_resource_link_for_learnpath - file: '.$file, 0);
3425 3425
                         }
3426 3426
 
3427 3427
                         if ($lp_item_type == 'link') {
@@ -3441,7 +3441,7 @@  discard block
 block discarded – undo
3441 3441
                                     $linkProtocol = substr($file, 0, 5);
3442 3442
                                     if ($linkProtocol === 'http:') {
3443 3443
                                         //this is the special intervention case
3444
-                                        $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=nonhttps&source=' .  urlencode($file);
3444
+                                        $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=nonhttps&source='.urlencode($file);
3445 3445
                                     }
3446 3446
                                 }
3447 3447
                             }
@@ -3481,8 +3481,8 @@  discard block
 block discarded – undo
3481 3481
                                 $sql = "SELECT count(*) FROM $lp_item_view_table
3482 3482
                                         WHERE
3483 3483
                                             c_id = $course_id AND
3484
-                                            lp_item_id='" . $lp_item_id . "' AND
3485
-                                            lp_view_id ='" . $lp_view_id . "' AND
3484
+                                            lp_item_id='".$lp_item_id."' AND
3485
+                                            lp_view_id ='" . $lp_view_id."' AND
3486 3486
                                             status='completed'";
3487 3487
                                 $result = Database::query($sql);
3488 3488
                                 $row_count = Database :: fetch_row($result);
@@ -3491,7 +3491,7 @@  discard block
 block discarded – undo
3491 3491
                                 if ($prevent_reinit === 1 && $count_item_view > 0) {
3492 3492
                                     $not_multiple_attempt = 1;
3493 3493
                                 }
3494
-                                $file .= '&not_multiple_attempt=' . $not_multiple_attempt;
3494
+                                $file .= '&not_multiple_attempt='.$not_multiple_attempt;
3495 3495
                             }
3496 3496
 
3497 3497
                             $tmp_array = explode('/', $file);
@@ -3504,7 +3504,7 @@  discard block
 block discarded – undo
3504 3504
                     break;
3505 3505
                 case 2 :
3506 3506
                     if ($this->debug > 2) {
3507
-                        error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0);
3507
+                        error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0);
3508 3508
                     }
3509 3509
 
3510 3510
                     if ($lp_item_type != 'dir') {
@@ -3518,19 +3518,19 @@  discard block
 block discarded – undo
3518 3518
                         //if ($this->prerequisites_match($item_id)) {
3519 3519
                         if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) {
3520 3520
                             if ($this->debug > 2) {
3521
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0);
3521
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0);
3522 3522
                             }
3523 3523
                             // Distant url, return as is.
3524 3524
                             $file = $lp_item_path;
3525 3525
                         } else {
3526 3526
                             if ($this->debug > 2) {
3527
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0);
3527
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0);
3528 3528
                             }
3529 3529
                             // Prevent getting untranslatable urls.
3530 3530
                             $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path);
3531 3531
                             $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path);
3532 3532
                             // Prepare the path.
3533
-                            $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path;
3533
+                            $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path;
3534 3534
                             // TODO: Fix this for urls with protocol header.
3535 3535
                             $file = str_replace('//', '/', $file);
3536 3536
                             $file = str_replace(':/', '://', $file);
@@ -3538,11 +3538,11 @@  discard block
 block discarded – undo
3538 3538
                                 $lp_path = substr($lp_path, 0, -1);
3539 3539
                             }
3540 3540
 
3541
-                            if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $lp_item_path))) {
3541
+                            if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$lp_item_path))) {
3542 3542
                                 // if file not found.
3543 3543
                                 $decoded = html_entity_decode($lp_item_path);
3544 3544
                                 list ($decoded) = explode('?', $decoded);
3545
-                                if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $decoded))) {
3545
+                                if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$decoded))) {
3546 3546
                                     require_once 'resourcelinker.inc.php';
3547 3547
                                     $file = rl_get_resource_link_for_learnpath(
3548 3548
                                         $course_id,
@@ -3562,14 +3562,14 @@  discard block
 block discarded – undo
3562 3562
                                         }
3563 3563
                                     }
3564 3564
                                 } else {
3565
-                                    $file = $course_path . '/scorm/' . $lp_path . '/' . $decoded;
3565
+                                    $file = $course_path.'/scorm/'.$lp_path.'/'.$decoded;
3566 3566
                                 }
3567 3567
                             }
3568 3568
                         }
3569 3569
 
3570 3570
                         // We want to use parameters if they were defined in the imsmanifest
3571 3571
                         if (strpos($file, 'blank.php') === false) {
3572
-                            $file .= (strstr($file, '?') === false ? '?' : '') . $lp_item_params;
3572
+                            $file .= (strstr($file, '?') === false ? '?' : '').$lp_item_params;
3573 3573
                         }
3574 3574
                     } else {
3575 3575
                         $file = 'lp_content.php?type=dir';
@@ -3577,12 +3577,12 @@  discard block
 block discarded – undo
3577 3577
                     break;
3578 3578
                 case 3 :
3579 3579
                     if ($this->debug > 2) {
3580
-                        error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0);
3580
+                        error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0);
3581 3581
                     }
3582 3582
                     // Formatting AICC HACP append URL.
3583
-                    $aicc_append = '?aicc_sid=' . urlencode(session_id()) . '&aicc_url=' . urlencode(api_get_path(WEB_CODE_PATH) . 'newscorm/aicc_hacp.php') . '&';
3583
+                    $aicc_append = '?aicc_sid='.urlencode(session_id()).'&aicc_url='.urlencode(api_get_path(WEB_CODE_PATH).'newscorm/aicc_hacp.php').'&';
3584 3584
                     if (!empty($lp_item_params)) {
3585
-                        $aicc_append .= $lp_item_params . '&';
3585
+                        $aicc_append .= $lp_item_params.'&';
3586 3586
                     }
3587 3587
                     if ($lp_item_type != 'dir') {
3588 3588
                         // Quite complex here:
@@ -3594,7 +3594,7 @@  discard block
 block discarded – undo
3594 3594
 
3595 3595
                         if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) {
3596 3596
                             if ($this->debug > 2) {
3597
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0);
3597
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0);
3598 3598
                             }
3599 3599
                             // Distant url, return as is.
3600 3600
                             $file = $lp_item_path;
@@ -3607,19 +3607,19 @@  discard block
 block discarded – undo
3607 3607
                             if (stripos($file, '<servername>') !== false) {
3608 3608
                                 //$file = str_replace('<servername>',$course_path.'/scorm/'.$lp_path.'/',$lp_item_path);
3609 3609
                                 $web_course_path = str_replace('https://', '', str_replace('http://', '', $course_path));
3610
-                                $file = str_replace('<servername>', $web_course_path . '/scorm/' . $lp_path, $lp_item_path);
3610
+                                $file = str_replace('<servername>', $web_course_path.'/scorm/'.$lp_path, $lp_item_path);
3611 3611
                             }
3612 3612
                             //
3613 3613
                             $file .= $aicc_append;
3614 3614
                         } else {
3615 3615
                             if ($this->debug > 2) {
3616
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0);
3616
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0);
3617 3617
                             }
3618 3618
                             // Prevent getting untranslatable urls.
3619 3619
                             $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path);
3620 3620
                             $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path);
3621 3621
                             // Prepare the path - lp_path might be unusable because it includes the "aicc" subdir name.
3622
-                            $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path;
3622
+                            $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path;
3623 3623
                             // TODO: Fix this for urls with protocol header.
3624 3624
                             $file = str_replace('//', '/', $file);
3625 3625
                             $file = str_replace(':/', '://', $file);
@@ -3638,7 +3638,7 @@  discard block
 block discarded – undo
3638 3638
             $file = !empty($file) ? str_replace('&amp;', '&', $file) : '';
3639 3639
         }
3640 3640
         if ($this->debug > 2) {
3641
-            error_log('New LP - In learnpath::get_link() - returning "' . $file . '" from get_link', 0);
3641
+            error_log('New LP - In learnpath::get_link() - returning "'.$file.'" from get_link', 0);
3642 3642
         }
3643 3643
         return $file;
3644 3644
     }
@@ -3656,7 +3656,7 @@  discard block
 block discarded – undo
3656 3656
         $search = '';
3657 3657
         // Use $attempt_num to enable multi-views management (disabled so far).
3658 3658
         if ($attempt_num != 0 AND intval(strval($attempt_num)) == $attempt_num) {
3659
-            $search = 'AND view_count = ' . $attempt_num;
3659
+            $search = 'AND view_count = '.$attempt_num;
3660 3660
         }
3661 3661
         // When missing $attempt_num, search for a unique lp_view record for this lp and user.
3662 3662
         $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW);
@@ -3666,9 +3666,9 @@  discard block
 block discarded – undo
3666 3666
 
3667 3667
         $sql = "SELECT id, view_count FROM $lp_view_table
3668 3668
         		WHERE
3669
-        		    c_id = " . $course_id . " AND
3670
-        		    lp_id = " . $this->get_id() . " AND
3671
-        		    user_id = " . $this->get_user_id() . " AND
3669
+        		    c_id = ".$course_id." AND
3670
+        		    lp_id = " . $this->get_id()." AND
3671
+        		    user_id = " . $this->get_user_id()." AND
3672 3672
         		    session_id = $sessionId
3673 3673
         		    $search
3674 3674
                 ORDER BY view_count DESC";
@@ -3679,7 +3679,7 @@  discard block
 block discarded – undo
3679 3679
         } else if (!api_is_invitee()) {
3680 3680
             // There is no database record, create one.
3681 3681
             $sql = "INSERT INTO $lp_view_table (c_id, lp_id,user_id, view_count, session_id) VALUES
3682
-            		($course_id, " . $this->get_id() . "," . $this->get_user_id() . ", 1, $sessionId)";
3682
+            		($course_id, ".$this->get_id().",".$this->get_user_id().", 1, $sessionId)";
3683 3683
             Database::query($sql);
3684 3684
             $id = Database :: insert_id();
3685 3685
             $this->lp_view_id = $id;
@@ -3779,15 +3779,15 @@  discard block
 block discarded – undo
3779 3779
     {
3780 3780
         $course_id = api_get_course_int_id();
3781 3781
         if ($this->debug > 0) {
3782
-            error_log('New LP - In learnpath::move_item(' . $id . ',' . $direction . ')', 0);
3782
+            error_log('New LP - In learnpath::move_item('.$id.','.$direction.')', 0);
3783 3783
         }
3784 3784
         if (empty($id) || empty($direction)) {
3785 3785
             return false;
3786 3786
         }
3787 3787
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
3788 3788
         $sql_sel = "SELECT *
3789
-                    FROM " . $tbl_lp_item . "
3790
-                    WHERE c_id = ".$course_id." AND id = " . $id;
3789
+                    FROM " . $tbl_lp_item."
3790
+                    WHERE c_id = ".$course_id." AND id = ".$id;
3791 3791
         $res_sel = Database::query($sql_sel);
3792 3792
         // Check if elem exists.
3793 3793
         if (Database :: num_rows($res_sel) < 1) {
@@ -3812,7 +3812,7 @@  discard block
 block discarded – undo
3812 3812
                                  WHERE c_id = ".$course_id." AND id = $previous";
3813 3813
 
3814 3814
                     if ($this->debug > 2) {
3815
-                        error_log('Selecting previous: ' . $sql_sel2, 0);
3815
+                        error_log('Selecting previous: '.$sql_sel2, 0);
3816 3816
                     }
3817 3817
                     $res_sel2 = Database::query($sql_sel2);
3818 3818
                     if (Database :: num_rows($res_sel2) < 1) {
@@ -3865,7 +3865,7 @@  discard block
 block discarded – undo
3865 3865
                         }
3866 3866
                         Database::query($sql_upd2);
3867 3867
                     }
3868
-                    $display = $display -1;
3868
+                    $display = $display - 1;
3869 3869
                 }
3870 3870
                 break;
3871 3871
             case 'down':
@@ -3876,7 +3876,7 @@  discard block
 block discarded – undo
3876 3876
                 } else {
3877 3877
                     $sql_sel2 = "SELECT * FROM $tbl_lp_item WHERE c_id = ".$course_id." AND id = $next";
3878 3878
                     if ($this->debug > 2) {
3879
-                        error_log('Selecting next: ' . $sql_sel2, 0);
3879
+                        error_log('Selecting next: '.$sql_sel2, 0);
3880 3880
                     }
3881 3881
                     $res_sel2 = Database::query($sql_sel2);
3882 3882
                     if (Database :: num_rows($res_sel2) < 1) {
@@ -3914,7 +3914,7 @@  discard block
 block discarded – undo
3914 3914
                                      WHERE c_id = ".$course_id." AND id = $next_next";
3915 3915
                         Database::query($sql_upd2);
3916 3916
                     }
3917
-                    $display = $display +1;
3917
+                    $display = $display + 1;
3918 3918
                 }
3919 3919
                 break;
3920 3920
             default :
@@ -3937,8 +3937,8 @@  discard block
 block discarded – undo
3937 3937
         $res = Database::query($sql);
3938 3938
         if ($res === false)
3939 3939
             return false;
3940
-        $lps = array ();
3941
-        $lp_order = array ();
3940
+        $lps = array();
3941
+        $lp_order = array();
3942 3942
         $num = Database :: num_rows($res);
3943 3943
         // First check the order is correct, globally (might be wrong because
3944 3944
         // of versions < 1.8.4)
@@ -3948,7 +3948,7 @@  discard block
 block discarded – undo
3948 3948
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
3949 3949
                     $need_fix = true;
3950 3950
                     $sql_u = "UPDATE $lp_table SET display_order = $i
3951
-                              WHERE c_id = ".$course_id." AND id = " . $row['id'];
3951
+                              WHERE c_id = ".$course_id." AND id = ".$row['id'];
3952 3952
                     Database::query($sql_u);
3953 3953
                 }
3954 3954
                 $row['display_order'] = $i;
@@ -3961,10 +3961,10 @@  discard block
 block discarded – undo
3961 3961
             $order = $lps[$lp_id]['display_order'];
3962 3962
             if ($order > 1) { // If it's the first element, no need to move up.
3963 3963
                 $sql_u1 = "UPDATE $lp_table SET display_order = $order
3964
-                           WHERE c_id = ".$course_id." AND id = " . $lp_order[$order - 1];
3964
+                           WHERE c_id = ".$course_id." AND id = ".$lp_order[$order - 1];
3965 3965
                 Database::query($sql_u1);
3966
-                $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order - 1) . "
3967
-                           WHERE c_id = ".$course_id." AND id = " . $lp_id;
3966
+                $sql_u2 = "UPDATE $lp_table SET display_order = ".($order - 1)."
3967
+                           WHERE c_id = ".$course_id." AND id = ".$lp_id;
3968 3968
                 Database::query($sql_u2);
3969 3969
             }
3970 3970
         }
@@ -3985,8 +3985,8 @@  discard block
 block discarded – undo
3985 3985
         if ($res === false) {
3986 3986
             return false;
3987 3987
         }
3988
-        $lps = array ();
3989
-        $lp_order = array ();
3988
+        $lps = array();
3989
+        $lp_order = array();
3990 3990
         $num = Database :: num_rows($res);
3991 3991
         $max = 0;
3992 3992
         // First check the order is correct, globally (might be wrong because
@@ -3998,7 +3998,7 @@  discard block
 block discarded – undo
3998 3998
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
3999 3999
                     $need_fix = true;
4000 4000
                     $sql_u = "UPDATE $lp_table SET display_order = $i
4001
-                              WHERE c_id = ".$course_id." AND id = " . $row['id'];
4001
+                              WHERE c_id = ".$course_id." AND id = ".$row['id'];
4002 4002
                     Database::query($sql_u);
4003 4003
                 }
4004 4004
                 $row['display_order'] = $i;
@@ -4011,10 +4011,10 @@  discard block
 block discarded – undo
4011 4011
             $order = $lps[$lp_id]['display_order'];
4012 4012
             if ($order < $max) { // If it's the first element, no need to move up.
4013 4013
                 $sql_u1 = "UPDATE $lp_table SET display_order = $order
4014
-                           WHERE c_id = ".$course_id." AND id = " . $lp_order[$order + 1];
4014
+                           WHERE c_id = ".$course_id." AND id = ".$lp_order[$order + 1];
4015 4015
                 Database::query($sql_u1);
4016
-                $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order + 1) . "
4017
-                           WHERE c_id = ".$course_id." AND id = " . $lp_id;
4016
+                $sql_u2 = "UPDATE $lp_table SET display_order = ".($order + 1)."
4017
+                           WHERE c_id = ".$course_id." AND id = ".$lp_id;
4018 4018
                 Database::query($sql_u2);
4019 4019
             }
4020 4020
         }
@@ -4034,15 +4034,15 @@  discard block
 block discarded – undo
4034 4034
         $this->autocomplete_parents($this->last);
4035 4035
         $new_index = $this->get_next_index();
4036 4036
         if ($this->debug > 2) {
4037
-            error_log('New LP - New index: ' . $new_index, 0);
4037
+            error_log('New LP - New index: '.$new_index, 0);
4038 4038
         }
4039 4039
         $this->index = $new_index;
4040 4040
         if ($this->debug > 2) {
4041
-            error_log('New LP - Now having orderedlist[' . $new_index . '] = ' . $this->ordered_items[$new_index], 0);
4041
+            error_log('New LP - Now having orderedlist['.$new_index.'] = '.$this->ordered_items[$new_index], 0);
4042 4042
         }
4043 4043
         $this->current = $this->ordered_items[$new_index];
4044 4044
         if ($this->debug > 2) {
4045
-            error_log('New LP - new item id is ' . $this->current . '-' . $this->get_current_item_id(), 0);
4045
+            error_log('New LP - new item id is '.$this->current.'-'.$this->get_current_item_id(), 0);
4046 4046
         }
4047 4047
     }
4048 4048
 
@@ -4106,7 +4106,7 @@  discard block
 block discarded – undo
4106 4106
             // Clean spaces.
4107 4107
             $prereq_string = str_replace(' ', '', $prereq_string);
4108 4108
             if ($debug > 0) {
4109
-                error_log('Found prereq_string: ' . $prereq_string, 0);
4109
+                error_log('Found prereq_string: '.$prereq_string, 0);
4110 4110
             }
4111 4111
             // Now send to the parse_prereq() function that will check this component's prerequisites.
4112 4112
             $result = $currentItem->parse_prereq(
@@ -4122,12 +4122,12 @@  discard block
 block discarded – undo
4122 4122
         } else {
4123 4123
             $result = true;
4124 4124
             if ($debug > 1) {
4125
-                error_log('$this->items[' . $itemId . '] was not an object', 0);
4125
+                error_log('$this->items['.$itemId.'] was not an object', 0);
4126 4126
             }
4127 4127
         }
4128 4128
 
4129 4129
         if ($debug > 1) {
4130
-            error_log('End of prerequisites_match(). Error message is now ' . $this->error, 0);
4130
+            error_log('End of prerequisites_match(). Error message is now '.$this->error, 0);
4131 4131
         }
4132 4132
         return $result;
4133 4133
     }
@@ -4193,12 +4193,12 @@  discard block
 block discarded – undo
4193 4193
             $row = Database :: fetch_array($result);
4194 4194
             $name = domesticate($row['name']);
4195 4195
             if ($set_visibility == 'i') {
4196
-                $s = $name . " " . get_lang('LearnpathNotPublished');
4196
+                $s = $name." ".get_lang('LearnpathNotPublished');
4197 4197
                 $dialogBox = $s;
4198 4198
                 $v = 0;
4199 4199
             }
4200 4200
             if ($set_visibility == 'v') {
4201
-                $s = $name . " " . get_lang('LearnpathPublished');
4201
+                $s = $name." ".get_lang('LearnpathPublished');
4202 4202
                 $dialogBox = $s;
4203 4203
                 $v = 1;
4204 4204
             }
@@ -4281,9 +4281,9 @@  discard block
 block discarded – undo
4281 4281
         $course_id = api_get_course_int_id();
4282 4282
         $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW);
4283 4283
         $sql = "INSERT INTO $lp_view_table (c_id, lp_id, user_id, view_count, session_id)
4284
-                VALUES ($course_id, " . $this->lp_id . "," . $this->get_user_id() . "," . ($this->attempt + 1) . ", $session_id)";
4284
+                VALUES ($course_id, ".$this->lp_id.",".$this->get_user_id().",".($this->attempt + 1).", $session_id)";
4285 4285
         if ($this->debug > 2) {
4286
-            error_log('New LP - Inserting new lp_view for restart: ' . $sql, 0);
4286
+            error_log('New LP - Inserting new lp_view for restart: '.$sql, 0);
4287 4287
         }
4288 4288
         $res = Database::query($sql);
4289 4289
         $view_id = Database::insert_id();
@@ -4321,10 +4321,10 @@  discard block
 block discarded – undo
4321 4321
         // TODO: Do a better check on the index pointing to the right item (it is supposed to be working
4322 4322
         // on $ordered_items[] but not sure it's always safe to use with $items[]).
4323 4323
         if ($this->debug > 2) {
4324
-            error_log('New LP - save_current() saving item ' . $this->current, 0);
4324
+            error_log('New LP - save_current() saving item '.$this->current, 0);
4325 4325
         }
4326 4326
         if ($this->debug > 2) {
4327
-            error_log('' . print_r($this->items, true), 0);
4327
+            error_log(''.print_r($this->items, true), 0);
4328 4328
         }
4329 4329
         if (isset($this->items[$this->current]) &&
4330 4330
             is_object($this->items[$this->current])
@@ -4348,7 +4348,7 @@  discard block
 block discarded – undo
4348 4348
     {
4349 4349
         $debug = $this->debug;
4350 4350
         if ($debug) {
4351
-            error_log('In learnpath::save_item(' . $item_id . ',' . intval($from_outside). ')', 0);
4351
+            error_log('In learnpath::save_item('.$item_id.','.intval($from_outside).')', 0);
4352 4352
         }
4353 4353
         // TODO: Do a better check on the index pointing to the right item (it is supposed to be working
4354 4354
         // on $ordered_items[] but not sure it's always safe to use with $items[]).
@@ -4371,7 +4371,7 @@  discard block
 block discarded – undo
4371 4371
 
4372 4372
             if ($debug) {
4373 4373
                 error_log('update_queue before:');
4374
-                error_log(print_r($this->update_queue,1));
4374
+                error_log(print_r($this->update_queue, 1));
4375 4375
             }
4376 4376
             $this->autocomplete_parents($item_id);
4377 4377
 
@@ -4379,9 +4379,9 @@  discard block
 block discarded – undo
4379 4379
             $this->update_queue[$item_id] = $status;
4380 4380
 
4381 4381
             if ($debug) {
4382
-                error_log('get_status(): ' . $status);
4382
+                error_log('get_status(): '.$status);
4383 4383
                 error_log('update_queue after:');
4384
-                error_log(print_r($this->update_queue,1));
4384
+                error_log(print_r($this->update_queue, 1));
4385 4385
             }
4386 4386
             return $res;
4387 4387
         }
@@ -4402,17 +4402,17 @@  discard block
 block discarded – undo
4402 4402
 
4403 4403
         if (isset($this->current) && !api_is_invitee()) {
4404 4404
             if ($this->debug > 2) {
4405
-                error_log('New LP - Saving current item (' . $this->current . ') for later review', 0);
4405
+                error_log('New LP - Saving current item ('.$this->current.') for later review', 0);
4406 4406
             }
4407 4407
             $sql = "UPDATE $table SET
4408
-                        last_item = " . intval($this->get_current_item_id()). "
4408
+                        last_item = ".intval($this->get_current_item_id())."
4409 4409
                     WHERE
4410 4410
                         c_id = $course_id AND
4411
-                        lp_id = " . $this->get_id() . " AND
4411
+                        lp_id = ".$this->get_id()." AND
4412 4412
                         user_id = " . $this->get_user_id()." ".$session_condition;
4413 4413
 
4414 4414
             if ($this->debug > 2) {
4415
-                error_log('New LP - Saving last item seen : ' . $sql, 0);
4415
+                error_log('New LP - Saving last item seen : '.$sql, 0);
4416 4416
             }
4417 4417
             Database::query($sql);
4418 4418
         }
@@ -4426,7 +4426,7 @@  discard block
 block discarded – undo
4426 4426
                             progress = $progress
4427 4427
                         WHERE
4428 4428
                             c_id = ".$course_id." AND
4429
-                            lp_id = " . $this->get_id() . " AND
4429
+                            lp_id = " . $this->get_id()." AND
4430 4430
                             user_id = " . $this->get_user_id()." ".$session_condition;
4431 4431
                 // Ignore errors as some tables might not have the progress field just yet.
4432 4432
                 Database::query($sql);
@@ -4442,7 +4442,7 @@  discard block
 block discarded – undo
4442 4442
     public function set_current_item($item_id = null)
4443 4443
     {
4444 4444
         if ($this->debug > 0) {
4445
-            error_log('New LP - In learnpath::set_current_item(' . $item_id . ')', 0);
4445
+            error_log('New LP - In learnpath::set_current_item('.$item_id.')', 0);
4446 4446
         }
4447 4447
         if (empty ($item_id)) {
4448 4448
             if ($this->debug > 2) {
@@ -4451,7 +4451,7 @@  discard block
 block discarded – undo
4451 4451
             // Do nothing.
4452 4452
         } else {
4453 4453
             if ($this->debug > 2) {
4454
-                error_log('New LP - New current item given is ' . $item_id . '...', 0);
4454
+                error_log('New LP - New current item given is '.$item_id.'...', 0);
4455 4455
             }
4456 4456
             if (is_numeric($item_id)) {
4457 4457
                 $item_id = intval($item_id);
@@ -4466,10 +4466,10 @@  discard block
 block discarded – undo
4466 4466
                     }
4467 4467
                 }
4468 4468
                 if ($this->debug > 2) {
4469
-                    error_log('New LP - set_current_item(' . $item_id . ') done. Index is now : ' . $this->index, 0);
4469
+                    error_log('New LP - set_current_item('.$item_id.') done. Index is now : '.$this->index, 0);
4470 4470
                 }
4471 4471
             } else {
4472
-                error_log('New LP - set_current_item(' . $item_id . ') failed. Not a numeric value: ', 0);
4472
+                error_log('New LP - set_current_item('.$item_id.') failed. Not a numeric value: ', 0);
4473 4473
             }
4474 4474
         }
4475 4475
     }
@@ -4494,7 +4494,7 @@  discard block
 block discarded – undo
4494 4494
             $lp = $this->get_id();
4495 4495
             if ($lp != 0) {
4496 4496
                 $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
4497
-                $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' WHERE c_id = ".$course_id." AND id = " . $lp;
4497
+                $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' WHERE c_id = ".$course_id." AND id = ".$lp;
4498 4498
                 $res = Database::query($sql);
4499 4499
                 return $res;
4500 4500
             }
@@ -4518,7 +4518,7 @@  discard block
 block discarded – undo
4518 4518
 
4519 4519
         if ($lp != 0) {
4520 4520
             $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
4521
-            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = " . $lp;
4521
+            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = ".$lp;
4522 4522
             $res = Database::query($sql);
4523 4523
             return $res;
4524 4524
         } else {
@@ -4543,10 +4543,10 @@  discard block
 block discarded – undo
4543 4543
         $course_id = api_get_course_int_id();
4544 4544
         $lp_id = $this->get_id();
4545 4545
         $sql = "UPDATE $lp_table SET
4546
-                content_maker = '" . Database::escape_string($this->maker) . "'
4546
+                content_maker = '".Database::escape_string($this->maker)."'
4547 4547
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4548 4548
         if ($this->debug > 2) {
4549
-            error_log('New LP - lp updated with new content_maker : ' . $this->maker, 0);
4549
+            error_log('New LP - lp updated with new content_maker : '.$this->maker, 0);
4550 4550
         }
4551 4551
         Database::query($sql);
4552 4552
         return true;
@@ -4570,10 +4570,10 @@  discard block
 block discarded – undo
4570 4570
         $lp_id = $this->get_id();
4571 4571
         $course_id = $this->course_info['real_id'];
4572 4572
         $sql = "UPDATE $lp_table SET
4573
-                name = '" . Database::escape_string($this->name). "'
4573
+                name = '".Database::escape_string($this->name)."'
4574 4574
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4575 4575
         if ($this->debug > 2) {
4576
-            error_log('New LP - lp updated with new name : ' . $this->name, 0);
4576
+            error_log('New LP - lp updated with new name : '.$this->name, 0);
4577 4577
         }
4578 4578
         $result = Database::query($sql);
4579 4579
         // If the lp is visible on the homepage, change his name there.
@@ -4581,7 +4581,7 @@  discard block
 block discarded – undo
4581 4581
             $session_id = api_get_session_id();
4582 4582
             $session_condition = api_get_session_condition($session_id);
4583 4583
             $tbl_tool = Database :: get_course_table(TABLE_TOOL_LIST);
4584
-            $link = 'newscorm/lp_controller.php?action=view&lp_id=' . $lp_id.'&id_session='.$session_id;
4584
+            $link = 'newscorm/lp_controller.php?action=view&lp_id='.$lp_id.'&id_session='.$session_id;
4585 4585
             $sql = "UPDATE $tbl_tool SET name = '$this->name'
4586 4586
             	    WHERE
4587 4587
             	        c_id = $course_id AND
@@ -4659,10 +4659,10 @@  discard block
 block discarded – undo
4659 4659
 
4660 4660
                 // Save it to search engine.
4661 4661
                 foreach ($missing_terms as $term) {
4662
-                    $doc->add_term($prefix . $term, 1);
4662
+                    $doc->add_term($prefix.$term, 1);
4663 4663
                 }
4664 4664
                 foreach ($deprecated_terms as $term) {
4665
-                    $doc->remove_term($prefix . $term);
4665
+                    $doc->remove_term($prefix.$term);
4666 4666
                 }
4667 4667
                 $di->getDb()->replace_document((int) $se_ref['search_did'], $doc);
4668 4668
                 $di->getDb()->flush();
@@ -4687,10 +4687,10 @@  discard block
 block discarded – undo
4687 4687
         $this->theme = $name;
4688 4688
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4689 4689
         $lp_id = $this->get_id();
4690
-        $sql = "UPDATE $lp_table SET theme = '" . Database::escape_string($this->theme). "'
4690
+        $sql = "UPDATE $lp_table SET theme = '".Database::escape_string($this->theme)."'
4691 4691
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4692 4692
         if ($this->debug > 2) {
4693
-            error_log('New LP - lp updated with new theme : ' . $this->theme, 0);
4693
+            error_log('New LP - lp updated with new theme : '.$this->theme, 0);
4694 4694
         }
4695 4695
         Database::query($sql);
4696 4696
 
@@ -4713,10 +4713,10 @@  discard block
 block discarded – undo
4713 4713
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4714 4714
         $lp_id = $this->get_id();
4715 4715
         $sql = "UPDATE $lp_table SET
4716
-                preview_image = '" . Database::escape_string($this->preview_image). "'
4716
+                preview_image = '".Database::escape_string($this->preview_image)."'
4717 4717
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4718 4718
         if ($this->debug > 2) {
4719
-            error_log('New LP - lp updated with new preview image : ' . $this->preview_image, 0);
4719
+            error_log('New LP - lp updated with new preview image : '.$this->preview_image, 0);
4720 4720
         }
4721 4721
         Database::query($sql);
4722 4722
         return true;
@@ -4736,10 +4736,10 @@  discard block
 block discarded – undo
4736 4736
         $this->author = $name;
4737 4737
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4738 4738
         $lp_id = $this->get_id();
4739
-        $sql = "UPDATE $lp_table SET author = '" . Database::escape_string($name). "'
4739
+        $sql = "UPDATE $lp_table SET author = '".Database::escape_string($name)."'
4740 4740
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4741 4741
         if ($this->debug > 2) {
4742
-            error_log('New LP - lp updated with new preview author : ' . $this->author, 0);
4742
+            error_log('New LP - lp updated with new preview author : '.$this->author, 0);
4743 4743
         }
4744 4744
         Database::query($sql);
4745 4745
 
@@ -4757,15 +4757,15 @@  discard block
 block discarded – undo
4757 4757
         if ($this->debug > 0) {
4758 4758
             error_log('New LP - In learnpath::set_hide_toc_frame()', 0);
4759 4759
         }
4760
-        if (intval($hide) == $hide){
4760
+        if (intval($hide) == $hide) {
4761 4761
             $this->hide_toc_frame = $hide;
4762 4762
             $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4763 4763
             $lp_id = $this->get_id();
4764 4764
             $sql = "UPDATE $lp_table SET
4765
-                    hide_toc_frame = '" . $this->hide_toc_frame . "'
4765
+                    hide_toc_frame = '".$this->hide_toc_frame."'
4766 4766
                     WHERE c_id = ".$course_id." AND id = '$lp_id'";
4767 4767
             if ($this->debug > 2) {
4768
-                error_log('New LP - lp updated with new preview hide_toc_frame : ' . $this->author, 0);
4768
+                error_log('New LP - lp updated with new preview hide_toc_frame : '.$this->author, 0);
4769 4769
             }
4770 4770
             Database::query($sql);
4771 4771
 
@@ -4792,7 +4792,7 @@  discard block
 block discarded – undo
4792 4792
         $sql = "UPDATE $lp_table SET prerequisite = '".$this->prerequisite."'
4793 4793
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4794 4794
         if ($this->debug > 2) {
4795
-            error_log('New LP - lp updated with new preview requisite : ' . $this->requisite, 0);
4795
+            error_log('New LP - lp updated with new preview requisite : '.$this->requisite, 0);
4796 4796
         }
4797 4797
         Database::query($sql);
4798 4798
         return true;
@@ -4816,10 +4816,10 @@  discard block
 block discarded – undo
4816 4816
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4817 4817
         $lp_id = $this->get_id();
4818 4818
         $sql = "UPDATE $lp_table SET
4819
-                    content_local = '" . Database::escape_string($name) . "'
4819
+                    content_local = '".Database::escape_string($name)."'
4820 4820
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4821 4821
         if ($this->debug > 2) {
4822
-            error_log('New LP - lp updated with new proximity : ' . $this->proximity, 0);
4822
+            error_log('New LP - lp updated with new proximity : '.$this->proximity, 0);
4823 4823
         }
4824 4824
         Database::query($sql);
4825 4825
         return true;
@@ -4853,11 +4853,11 @@  discard block
 block discarded – undo
4853 4853
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4854 4854
         $lp_id = $this->get_id();
4855 4855
         $sql = "UPDATE $lp_table SET
4856
-                    use_max_score = '" . $this->use_max_score . "'
4856
+                    use_max_score = '".$this->use_max_score."'
4857 4857
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4858 4858
 
4859 4859
         if ($this->debug > 2) {
4860
-            error_log('New LP - lp updated with new use_max_score : ' . $this->use_max_score, 0);
4860
+            error_log('New LP - lp updated with new use_max_score : '.$this->use_max_score, 0);
4861 4861
         }
4862 4862
         Database::query($sql);
4863 4863
 
@@ -4884,10 +4884,10 @@  discard block
 block discarded – undo
4884 4884
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4885 4885
         $lp_id = $this->get_id();
4886 4886
         $sql = "UPDATE $lp_table SET
4887
-                expired_on = '" . Database::escape_string($this->expired_on) . "'
4887
+                expired_on = '".Database::escape_string($this->expired_on)."'
4888 4888
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4889 4889
         if ($this->debug > 2) {
4890
-            error_log('New LP - lp updated with new expired_on : ' . $this->expired_on, 0);
4890
+            error_log('New LP - lp updated with new expired_on : '.$this->expired_on, 0);
4891 4891
         }
4892 4892
         Database::query($sql);
4893 4893
 
@@ -4913,10 +4913,10 @@  discard block
 block discarded – undo
4913 4913
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4914 4914
         $lp_id = $this->get_id();
4915 4915
         $sql = "UPDATE $lp_table SET
4916
-                publicated_on = '" . Database::escape_string($this->publicated_on) . "'
4916
+                publicated_on = '".Database::escape_string($this->publicated_on)."'
4917 4917
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4918 4918
         if ($this->debug > 2) {
4919
-            error_log('New LP - lp updated with new publicated_on : ' . $this->publicated_on, 0);
4919
+            error_log('New LP - lp updated with new publicated_on : '.$this->publicated_on, 0);
4920 4920
         }
4921 4921
         Database::query($sql);
4922 4922
 
@@ -4936,10 +4936,10 @@  discard block
 block discarded – undo
4936 4936
         $this->modified_on = api_get_utc_datetime();
4937 4937
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4938 4938
         $lp_id = $this->get_id();
4939
-        $sql = "UPDATE $lp_table SET modified_on = '" . $this->modified_on . "'
4939
+        $sql = "UPDATE $lp_table SET modified_on = '".$this->modified_on."'
4940 4940
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4941 4941
         if ($this->debug > 2) {
4942
-            error_log('New LP - lp updated with new expired_on : ' . $this->modified_on, 0);
4942
+            error_log('New LP - lp updated with new expired_on : '.$this->modified_on, 0);
4943 4943
         }
4944 4944
         Database::query($sql);
4945 4945
         return true;
@@ -5010,13 +5010,13 @@  discard block
 block discarded – undo
5010 5010
 
5011 5011
         if ($this->last != 0 && $this->last != $this->current && is_object($this->items[$this->last])) {
5012 5012
             if ($this->debug > 2) {
5013
-                error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' is object', 0);
5013
+                error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' is object', 0);
5014 5014
             }
5015 5015
             switch ($this->get_type()) {
5016 5016
                 case '3' :
5017 5017
                     if ($this->items[$this->last]->get_type() != 'au') {
5018 5018
                         if ($this->debug > 2) {
5019
-                            error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 3 is <> au', 0);
5019
+                            error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 3 is <> au', 0);
5020 5020
                         }
5021 5021
                         $this->items[$this->last]->close();
5022 5022
                         //$this->autocomplete_parents($this->last);
@@ -5029,7 +5029,7 @@  discard block
 block discarded – undo
5029 5029
                 case '2' :
5030 5030
                     if ($this->items[$this->last]->get_type() != 'sco') {
5031 5031
                         if ($this->debug > 2) {
5032
-                            error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 2 is <> sco', 0);
5032
+                            error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 2 is <> sco', 0);
5033 5033
                         }
5034 5034
                         $this->items[$this->last]->close();
5035 5035
                         //$this->autocomplete_parents($this->last);
@@ -5043,7 +5043,7 @@  discard block
 block discarded – undo
5043 5043
                 case '1' :
5044 5044
                 default :
5045 5045
                     if ($this->debug > 2) {
5046
-                        error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 1 is asset', 0);
5046
+                        error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 1 is asset', 0);
5047 5047
                     }
5048 5048
                     $this->items[$this->last]->close();
5049 5049
                     break;
@@ -5069,7 +5069,7 @@  discard block
 block discarded – undo
5069 5069
         }
5070 5070
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5071 5071
         $sql = "SELECT * FROM $lp_table
5072
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5072
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5073 5073
         $res = Database::query($sql);
5074 5074
         if (Database :: num_rows($res) > 0) {
5075 5075
             $row = Database :: fetch_array($res);
@@ -5090,14 +5090,14 @@  discard block
 block discarded – undo
5090 5090
                     break;
5091 5091
             }
5092 5092
             $sql = "UPDATE $lp_table SET default_view_mod = '$view_mode'
5093
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5093
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5094 5094
             Database::query($sql);
5095 5095
             $this->mode = $view_mode;
5096 5096
 
5097 5097
             return $view_mode;
5098 5098
         } else {
5099 5099
             if ($this->debug > 2) {
5100
-                error_log('New LP - Problem in update_default_view() - could not find LP ' . $this->get_id() . ' in DB', 0);
5100
+                error_log('New LP - Problem in update_default_view() - could not find LP '.$this->get_id().' in DB', 0);
5101 5101
             }
5102 5102
         }
5103 5103
         return -1;
@@ -5115,7 +5115,7 @@  discard block
 block discarded – undo
5115 5115
         }
5116 5116
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5117 5117
         $sql = "SELECT * FROM $lp_table
5118
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5118
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5119 5119
         $res = Database::query($sql);
5120 5120
         if (Database :: num_rows($res) > 0) {
5121 5121
             $row = Database :: fetch_array($res);
@@ -5128,14 +5128,14 @@  discard block
 block discarded – undo
5128 5128
                 $force_return = true;
5129 5129
             }
5130 5130
             $sql = "UPDATE $lp_table SET force_commit = $force
5131
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5131
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5132 5132
             Database::query($sql);
5133 5133
             $this->force_commit = $force_return;
5134 5134
 
5135 5135
             return $force_return;
5136 5136
         } else {
5137 5137
             if ($this->debug > 2) {
5138
-                error_log('New LP - Problem in update_default_scorm_commit() - could not find LP ' . $this->get_id() . ' in DB', 0);
5138
+                error_log('New LP - Problem in update_default_scorm_commit() - could not find LP '.$this->get_id().' in DB', 0);
5139 5139
             }
5140 5140
         }
5141 5141
         return -1;
@@ -5164,7 +5164,7 @@  discard block
 block discarded – undo
5164 5164
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
5165 5165
                     $need_fix = true;
5166 5166
                     $sql = "UPDATE $lp_table SET display_order = $i
5167
-                            WHERE c_id = ".$course_id." AND id = " . $row['id'];
5167
+                            WHERE c_id = ".$course_id." AND id = ".$row['id'];
5168 5168
                     Database::query($sql);
5169 5169
                 }
5170 5170
                 $i++;
@@ -5185,7 +5185,7 @@  discard block
 block discarded – undo
5185 5185
         }
5186 5186
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5187 5187
         $sql = "SELECT * FROM $lp_table
5188
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5188
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5189 5189
         $res = Database::query($sql);
5190 5190
         if (Database :: num_rows($res) > 0) {
5191 5191
             $row = Database :: fetch_array($res);
@@ -5196,13 +5196,13 @@  discard block
 block discarded – undo
5196 5196
                 $force = 1;
5197 5197
             }
5198 5198
             $sql = "UPDATE $lp_table SET prevent_reinit = $force
5199
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5199
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5200 5200
             Database::query($sql);
5201 5201
             $this->prevent_reinit = $force;
5202 5202
             return $force;
5203 5203
         } else {
5204 5204
             if ($this->debug > 2) {
5205
-                error_log('New LP - Problem in update_reinit() - could not find LP ' . $this->get_id() . ' in DB', 0);
5205
+                error_log('New LP - Problem in update_reinit() - could not find LP '.$this->get_id().' in DB', 0);
5206 5206
             }
5207 5207
         }
5208 5208
         return -1;
@@ -5218,11 +5218,11 @@  discard block
 block discarded – undo
5218 5218
     {
5219 5219
         //Set default value for seriousgame_mode
5220 5220
         if (!isset($this->seriousgame_mode)) {
5221
-            $this->seriousgame_mode=0;
5221
+            $this->seriousgame_mode = 0;
5222 5222
         }
5223 5223
         // Set default value for prevent_reinit
5224 5224
         if (!isset($this->prevent_reinit)) {
5225
-            $this->prevent_reinit =1;
5225
+            $this->prevent_reinit = 1;
5226 5226
         }
5227 5227
         if ($this->seriousgame_mode == 1 && $this->prevent_reinit == 1) {
5228 5228
             return 'seriousgame';
@@ -5270,7 +5270,7 @@  discard block
 block discarded – undo
5270 5270
         $sql = "UPDATE $lp_table SET
5271 5271
                 prevent_reinit = $prevent_reinit ,
5272 5272
                 seriousgame_mode = $sg_mode
5273
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5273
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5274 5274
         $res = Database::query($sql);
5275 5275
         if ($res) {
5276 5276
             return true;
@@ -5322,7 +5322,7 @@  discard block
 block discarded – undo
5322 5322
             error_log('New LP - In learnpath::set_seriousgame_mode()', 0);
5323 5323
         }
5324 5324
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5325
-        $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5325
+        $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5326 5326
         $res = Database::query($sql);
5327 5327
         if (Database :: num_rows($res) > 0) {
5328 5328
             $row = Database :: fetch_array($res);
@@ -5333,13 +5333,13 @@  discard block
 block discarded – undo
5333 5333
                 $force = 1;
5334 5334
             }
5335 5335
             $sql = "UPDATE $lp_table SET seriousgame_mode = $force
5336
-			        WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5336
+			        WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5337 5337
             Database::query($sql);
5338 5338
             $this->seriousgame_mode = $force;
5339 5339
             return $force;
5340 5340
         } else {
5341 5341
             if ($this->debug > 2) {
5342
-                error_log('New LP - Problem in set_seriousgame_mode() - could not find LP ' . $this->get_id() . ' in DB', 0);
5342
+                error_log('New LP - Problem in set_seriousgame_mode() - could not find LP '.$this->get_id().' in DB', 0);
5343 5343
             }
5344 5344
         }
5345 5345
         return -1;
@@ -5357,7 +5357,7 @@  discard block
 block discarded – undo
5357 5357
         }
5358 5358
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5359 5359
         $sql = "SELECT * FROM $lp_table
5360
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5360
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5361 5361
         $res = Database::query($sql);
5362 5362
         if (Database :: num_rows($res) > 0) {
5363 5363
             $row = Database :: fetch_array($res);
@@ -5368,13 +5368,13 @@  discard block
 block discarded – undo
5368 5368
                 $force = 1;
5369 5369
             }
5370 5370
             $sql = "UPDATE $lp_table SET debug = $force
5371
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5371
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5372 5372
             $res = Database::query($sql);
5373 5373
             $this->scorm_debug = $force;
5374 5374
             return $force;
5375 5375
         } else {
5376 5376
             if ($this->debug > 2) {
5377
-                error_log('New LP - Problem in update_scorm_debug() - could not find LP ' . $this->get_id() . ' in DB', 0);
5377
+                error_log('New LP - Problem in update_scorm_debug() - could not find LP '.$this->get_id().' in DB', 0);
5378 5378
             }
5379 5379
         }
5380 5380
         return -1;
@@ -5403,7 +5403,7 @@  discard block
 block discarded – undo
5403 5403
      * @param int $depth
5404 5404
      * @param array $tmp
5405 5405
      */
5406
-    public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array ())
5406
+    public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array())
5407 5407
     {
5408 5408
         if ($this->debug > 1) {
5409 5409
             error_log('New LP - In learnpath::create_tree_array())', 0);
@@ -5489,7 +5489,7 @@  discard block
 block discarded – undo
5489 5489
 
5490 5490
         // we need to start a form when we want to update all the mp3 files
5491 5491
         if ($update_audio == 'true') {
5492
-            $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">';
5492
+            $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">';
5493 5493
         }
5494 5494
         $return .= '<div id="message"></div>';
5495 5495
         if (count($this->items) == 0) {
@@ -5497,14 +5497,14 @@  discard block
 block discarded – undo
5497 5497
         } else {
5498 5498
             $return_audio = '<table class="data_table">';
5499 5499
             $return_audio .= '<tr>';
5500
-            $return_audio .= '<th width="40%">' . get_lang('Title') . '</th>';
5501
-            $return_audio .= '<th>' . get_lang('Audio') . '</th>';
5500
+            $return_audio .= '<th width="40%">'.get_lang('Title').'</th>';
5501
+            $return_audio .= '<th>'.get_lang('Audio').'</th>';
5502 5502
             $return_audio .= '</tr>';
5503 5503
 
5504 5504
             if ($update_audio != 'true') {
5505 5505
                 $return .= '<div class="col-md-12">';
5506 5506
                 $return .= self::return_new_tree($update_audio);
5507
-                $return .='</div>';
5507
+                $return .= '</div>';
5508 5508
                 $return .= Display::div(Display::url(get_lang('Save'), '#', array('id'=>'listSubmit', 'class'=>'btn btn-primary')), array('style'=>'float:left; margin-top:15px;width:100%'));
5509 5509
             } else {
5510 5510
                 $return_audio .= self::return_new_tree($update_audio);
@@ -5514,7 +5514,7 @@  discard block
 block discarded – undo
5514 5514
             // We need to close the form when we are updating the mp3 files.
5515 5515
             if ($update_audio == 'true') {
5516 5516
                 $return .= '<div class="footer-audio">';
5517
-                $return .= Display::button('save_audio','<em class="fa fa-file-audio-o"></em> '. get_lang('SaveAudioAndOrganization'),array('class'=>'btn btn-primary','type'=>'submit'));
5517
+                $return .= Display::button('save_audio', '<em class="fa fa-file-audio-o"></em> '.get_lang('SaveAudioAndOrganization'), array('class'=>'btn btn-primary', 'type'=>'submit'));
5518 5518
                 $return .= '</div>';
5519 5519
                 //$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?
5520 5520
             }
@@ -5535,7 +5535,7 @@  discard block
 block discarded – undo
5535 5535
     public function return_new_tree($update_audio = 'false', $drop_element_here = false)
5536 5536
     {
5537 5537
         $return = '';
5538
-        $is_allowed_to_edit = api_is_allowed_to_edit(null,true);
5538
+        $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
5539 5539
 
5540 5540
         $course_id = api_get_course_int_id();
5541 5541
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -5583,7 +5583,7 @@  discard block
 block discarded – undo
5583 5583
 
5584 5584
             //Link for the documents
5585 5585
             if ($arrLP[$i]['item_type'] == 'document') {
5586
-                $url = api_get_self() . '?'.api_get_cidreq().'&action=view_item&mode=preview_document&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id;
5586
+                $url = api_get_self().'?'.api_get_cidreq().'&action=view_item&mode=preview_document&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
5587 5587
                 $title_cut = Display::url(
5588 5588
                     $title_cut,
5589 5589
                     $url,
@@ -5599,23 +5599,23 @@  discard block
 block discarded – undo
5599 5599
             } else {
5600 5600
                 $oddClass = 'row_even';
5601 5601
             }
5602
-            $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'] .'" class="' . $oddClass . '">';
5602
+            $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'].'" class="'.$oddClass.'">';
5603 5603
 
5604 5604
             $icon_name = str_replace(' ', '', $arrLP[$i]['item_type']);
5605 5605
 
5606 5606
             $icon = '';
5607
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
5608
-                $icon = '<img src="../img/lp_' . $icon_name . '.png" />';
5607
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
5608
+                $icon = '<img src="../img/lp_'.$icon_name.'.png" />';
5609 5609
             } else {
5610
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
5611
-                    $icon = '<img src="../img/lp_' . $icon_name . '.gif"  />';
5610
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
5611
+                    $icon = '<img src="../img/lp_'.$icon_name.'.gif"  />';
5612 5612
                 } else {
5613 5613
                     $icon = '<img src="../img/folder_document.gif" />';
5614 5614
                 }
5615 5615
             }
5616 5616
 
5617 5617
             // The audio column.
5618
-            $return_audio  .= '<td align="left" style="padding-left:10px;">';
5618
+            $return_audio .= '<td align="left" style="padding-left:10px;">';
5619 5619
 
5620 5620
             $audio = '';
5621 5621
 
@@ -5635,10 +5635,10 @@  discard block
 block discarded – undo
5635 5635
             } else {
5636 5636
                 $types = self::getChapterTypes();
5637 5637
                 if (!in_array($arrLP[$i]['item_type'], $types)) {
5638
-                    $audio .= '<input type="file" name="mp3file' . $arrLP[$i]['id'] . '" id="mp3file" />';
5638
+                    $audio .= '<input type="file" name="mp3file'.$arrLP[$i]['id'].'" id="mp3file" />';
5639 5639
                     if (!empty ($arrLP[$i]['audio'])) {
5640 5640
                         $audio .= '<br />'.Security::remove_XSS($arrLP[$i]['audio']).'<br />
5641
-                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'] . '" id="checkbox' . $arrLP[$i]['id'] . '" />' . get_lang('RemoveAudio');
5641
+                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'].'" id="checkbox'.$arrLP[$i]['id'].'" />'.get_lang('RemoveAudio');
5642 5642
                     }
5643 5643
                 }
5644 5644
             }
@@ -5662,7 +5662,7 @@  discard block
 block discarded – undo
5662 5662
                 // No edit for this item types
5663 5663
                 if (!in_array($arrLP[$i]['item_type'], array('sco', 'asset'))) {
5664 5664
                     if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module'))) {
5665
-                        $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">';
5665
+                        $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">';
5666 5666
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5667 5667
                         $edit_icon .= '</a>';
5668 5668
 
@@ -5675,7 +5675,7 @@  discard block
 block discarded – undo
5675 5675
                                 $this->lp_session_id
5676 5676
                             )
5677 5677
                             ) {
5678
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5678
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5679 5679
                                     'action' => 'dissociate_forum',
5680 5680
                                     'id' => $arrLP[$i]['id'],
5681 5681
                                     'lp_id' => $this->lp_id
@@ -5686,7 +5686,7 @@  discard block
 block discarded – undo
5686 5686
                                     ['class' => 'btn btn-default lp-btn-dissociate-forum']
5687 5687
                                 );
5688 5688
                             } else {
5689
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5689
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5690 5690
                                     'action' => 'create_forum',
5691 5691
                                     'id' => $arrLP[$i]['id'],
5692 5692
                                     'lp_id' => $this->lp_id
@@ -5699,17 +5699,17 @@  discard block
 block discarded – undo
5699 5699
                             }
5700 5700
                         }
5701 5701
                     } else {
5702
-                        $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">';
5702
+                        $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">';
5703 5703
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5704 5704
                         $edit_icon .= '</a>';
5705 5705
                     }
5706 5706
                 }
5707 5707
 
5708
-                $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">';
5708
+                $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">';
5709 5709
                 $delete_icon .= Display::return_icon('delete.png', get_lang('LearnpathDeleteModule'), array(), ICON_SIZE_TINY);
5710 5710
                 $delete_icon .= '</a>';
5711 5711
 
5712
-                $url = api_get_self() . '?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'] .'&lp_id='.$this->lp_id;
5712
+                $url = api_get_self().'?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
5713 5713
 
5714 5714
                 if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module', 'dir'))) {
5715 5715
                     $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']);
@@ -5718,8 +5718,8 @@  discard block
 block discarded – undo
5718 5718
                 }
5719 5719
             }
5720 5720
             if ($update_audio != 'true') {
5721
-                $row = $move_icon . ' ' . $icon .
5722
-                    Display::span($title_cut) .
5721
+                $row = $move_icon.' '.$icon.
5722
+                    Display::span($title_cut).
5723 5723
                     Display::tag(
5724 5724
                         'div',
5725 5725
                         "<div class=\"btn-group btn-group-xs\">$audio $edit_icon $forumIcon $prerequisities_icon $move_item_icon $audio_icon $delete_icon</div>",
@@ -5740,8 +5740,8 @@  discard block
 block discarded – undo
5740 5740
                 $parent_arrays = array();
5741 5741
                 if ($arrLP[$i]['depth'] > 1) {
5742 5742
                     //Getting list of parents
5743
-                    for($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5744
-                        foreach($arrLP as $item) {
5743
+                    for ($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5744
+                        foreach ($arrLP as $item) {
5745 5745
                             if ($item['id'] == $parent_id) {
5746 5746
                                 if ($item['parent_item_id'] == 0) {
5747 5747
                                     $parent_id = $item['id'];
@@ -5763,8 +5763,8 @@  discard block
 block discarded – undo
5763 5763
                     $parent_arrays = array_reverse($parent_arrays);
5764 5764
                     $val = '$elements';
5765 5765
                     $x = 0;
5766
-                    foreach($parent_arrays as $item) {
5767
-                        if ($x != count($parent_arrays) -1) {
5766
+                    foreach ($parent_arrays as $item) {
5767
+                        if ($x != count($parent_arrays) - 1) {
5768 5768
                             $val .= '["'.$item.'"]["children"]';
5769 5769
                         } else {
5770 5770
                             $val .= '["'.$item.'"]["children"]';
@@ -5827,7 +5827,7 @@  discard block
 block discarded – undo
5827 5827
                 if (isset($_REQUEST['id']) && $key == $_REQUEST['id']) {
5828 5828
                     $active = 'active';
5829 5829
                 }
5830
-                $return  .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5830
+                $return .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5831 5831
             } else {
5832 5832
                 //sections
5833 5833
                 if (isset($item['children'])) {
@@ -5850,17 +5850,17 @@  discard block
 block discarded – undo
5850 5850
     {
5851 5851
         $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
5852 5852
         $return = '<div class="actions">';
5853
-        $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> ';
5854
-        $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>';
5855
-        $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>';
5853
+        $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> ';
5854
+        $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>';
5855
+        $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>';
5856 5856
         $buttons = array(
5857 5857
             array(
5858 5858
                 'title' => get_lang('SetPrerequisiteForEachItem'),
5859
-                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id=' . $_SESSION['oLP']->lp_id,
5859
+                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id='.$_SESSION['oLP']->lp_id,
5860 5860
             ),
5861 5861
             array(
5862 5862
                 'title' => get_lang('ClearAllPrerequisites'),
5863
-                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id=' . $_SESSION['oLP']->lp_id,
5863
+                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id='.$_SESSION['oLP']->lp_id,
5864 5864
             ),
5865 5865
         );
5866 5866
         $return .= Display::group_button(get_lang('PrerequisitesOptions'), $buttons);
@@ -5881,7 +5881,7 @@  discard block
 block discarded – undo
5881 5881
     {
5882 5882
         // Creating learning_path folder
5883 5883
         $dir = '/learning_path';
5884
-        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'] . '/document';
5884
+        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
5885 5885
         $folder = false;
5886 5886
         if (!is_dir($filepath.'/'.$dir)) {
5887 5887
             $folderData = create_unexisting_directory(
@@ -5922,9 +5922,9 @@  discard block
 block discarded – undo
5922 5922
         // Creating LP folder
5923 5923
         if ($folder) {
5924 5924
             //Limits title size
5925
-            $title = api_substr(api_replace_dangerous_char($lp_name), 0 , 80);
5925
+            $title = api_substr(api_replace_dangerous_char($lp_name), 0, 80);
5926 5926
             $dir   = $dir.$title;
5927
-            $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document';
5927
+            $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
5928 5928
             if (!is_dir($filepath.'/'.$dir)) {
5929 5929
                 $folderData = create_unexisting_directory(
5930 5930
                     $course,
@@ -5944,7 +5944,7 @@  discard block
 block discarded – undo
5944 5944
             }
5945 5945
             $dir = $dir.'/';
5946 5946
             if ($folder) {
5947
-                $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document'.$dir;
5947
+                $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'.$dir;
5948 5948
             }
5949 5949
         }
5950 5950
         $array = array(
@@ -5983,12 +5983,12 @@  discard block
 block discarded – undo
5983 5983
             $dir = substr($dir, 1);
5984 5984
         }
5985 5985
         if (!empty($dir[0]) && $dir[0] != '/') {
5986
-            $dir = '/' . $dir;
5986
+            $dir = '/'.$dir;
5987 5987
         }
5988 5988
         if (isset($dir[strlen($dir) - 1]) && $dir[strlen($dir) - 1] != '/') {
5989 5989
             $dir .= '/';
5990 5990
         }
5991
-        $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document' . $dir;
5991
+        $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$dir;
5992 5992
 
5993 5993
         if (empty($_POST['dir']) && empty($_GET['dir'])) {
5994 5994
             //Generates folder
@@ -5998,7 +5998,7 @@  discard block
 block discarded – undo
5998 5998
         }
5999 5999
 
6000 6000
         if (!is_dir($filepath)) {
6001
-            $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document/';
6001
+            $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document/';
6002 6002
             $dir = '/';
6003 6003
         }
6004 6004
 
@@ -6021,10 +6021,10 @@  discard block
 block discarded – undo
6021 6021
         $tmp_filename = $filename;
6022 6022
 
6023 6023
         $i = 0;
6024
-        while (file_exists($filepath . $tmp_filename . '.'.$extension))
6025
-            $tmp_filename = $filename . '_' . ++ $i;
6024
+        while (file_exists($filepath.$tmp_filename.'.'.$extension))
6025
+            $tmp_filename = $filename.'_'.++ $i;
6026 6026
 
6027
-        $filename = $tmp_filename . '.'.$extension;
6027
+        $filename = $tmp_filename.'.'.$extension;
6028 6028
         if ($extension == 'html') {
6029 6029
             $content = stripslashes($content);
6030 6030
             $content = str_replace(
@@ -6059,12 +6059,12 @@  discard block
 block discarded – undo
6059 6059
             );
6060 6060
         }
6061 6061
 
6062
-        if (!file_exists($filepath . $filename)) {
6063
-            if ($fp = @ fopen($filepath . $filename, 'w')) {
6062
+        if (!file_exists($filepath.$filename)) {
6063
+            if ($fp = @ fopen($filepath.$filename, 'w')) {
6064 6064
                 fputs($fp, $content);
6065 6065
                 fclose($fp);
6066 6066
 
6067
-                $file_size = filesize($filepath . $filename);
6067
+                $file_size = filesize($filepath.$filename);
6068 6068
                 $save_file_path = $dir.$filename;
6069 6069
 
6070 6070
                 $document_id = add_document(
@@ -6096,12 +6096,12 @@  discard block
 block discarded – undo
6096 6096
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6097 6097
                         $ct = '';
6098 6098
                         if ($new_comment)
6099
-                            $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6099
+                            $ct .= ", comment='".Database::escape_string($new_comment)."'";
6100 6100
                         if ($new_title)
6101
-                            $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6101
+                            $ct .= ", title='".Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6102 6102
 
6103
-                        $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)."
6104
-                               WHERE c_id = ".$course_id." AND id = " . $document_id;
6103
+                        $sql = "UPDATE ".$tbl_doc." SET ".substr($ct, 1)."
6104
+                               WHERE c_id = ".$course_id." AND id = ".$document_id;
6105 6105
                         Database::query($sql);
6106 6106
                     }
6107 6107
                 }
@@ -6129,42 +6129,42 @@  discard block
 block discarded – undo
6129 6129
             $dir = substr($dir, 1);
6130 6130
 
6131 6131
         if ($dir[0] != '/')
6132
-            $dir = '/' . $dir;
6132
+            $dir = '/'.$dir;
6133 6133
 
6134 6134
         if ($dir[strlen($dir) - 1] != '/')
6135 6135
             $dir .= '/';
6136 6136
 
6137
-        $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir;
6137
+        $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
6138 6138
 
6139 6139
         if (!is_dir($filepath)) {
6140
-            $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
6140
+            $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
6141 6141
             $dir = '/';
6142 6142
         }
6143 6143
 
6144 6144
         $table_doc = Database :: get_course_table(TABLE_DOCUMENT);
6145 6145
         if (isset($_POST['path']) && !empty($_POST['path'])) {
6146 6146
             $document_id = intval($_POST['path']);
6147
-            $sql = "SELECT path FROM " . $table_doc . "
6148
-                    WHERE c_id = $course_id AND id = " . $document_id;
6147
+            $sql = "SELECT path FROM ".$table_doc."
6148
+                    WHERE c_id = $course_id AND id = ".$document_id;
6149 6149
             $res = Database::query($sql);
6150 6150
             $row = Database :: fetch_array($res);
6151 6151
             $content = stripslashes($_POST['content_lp']);
6152
-            $file = $filepath . $row['path'];
6152
+            $file = $filepath.$row['path'];
6153 6153
 
6154 6154
             if ($fp = @ fopen($file, 'w')) {
6155
-                $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'] . '/courses/', $content);
6155
+                $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].'/courses/', $content);
6156 6156
 
6157 6157
                 // Change the path of mp3 to absolute.
6158 6158
                 // The first regexp deals with :// urls.
6159
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/', $content);
6159
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/', $content);
6160 6160
                 // The second regexp deals with audio/ urls.
6161
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/$2/', $content);
6161
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/$2/', $content);
6162 6162
                 fputs($fp, $content);
6163 6163
                 fclose($fp);
6164 6164
 
6165
-                $sql = "UPDATE " . $table_doc ." SET
6165
+                $sql = "UPDATE ".$table_doc." SET
6166 6166
                             title='".Database::escape_string($_POST['title'])."'
6167
-                        WHERE c_id = ".$course_id." AND id = " . $document_id;
6167
+                        WHERE c_id = ".$course_id." AND id = ".$document_id;
6168 6168
                 Database::query($sql);
6169 6169
             }
6170 6170
         }
@@ -6182,10 +6182,10 @@  discard block
 block discarded – undo
6182 6182
         $return = '';
6183 6183
         if (is_numeric($item_id)) {
6184 6184
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6185
-            $sql = "SELECT lp.* FROM " . $tbl_lp_item . " as lp
6186
-                    WHERE c_id = ".$course_id." AND lp.id = " . intval($item_id);
6185
+            $sql = "SELECT lp.* FROM ".$tbl_lp_item." as lp
6186
+                    WHERE c_id = ".$course_id." AND lp.id = ".intval($item_id);
6187 6187
             $result = Database::query($sql);
6188
-            while ($row = Database :: fetch_array($result,'ASSOC')) {
6188
+            while ($row = Database :: fetch_array($result, 'ASSOC')) {
6189 6189
                 $_SESSION['parent_item_id'] = ($row['item_type'] == 'dokeos_chapter' || $row['item_type'] == 'dokeos_module' || $row['item_type'] == 'dir') ? $item_id : 0;
6190 6190
 
6191 6191
                 // Prevents wrong parent selection for document, see Bug#1251.
@@ -6212,8 +6212,8 @@  discard block
 block discarded – undo
6212 6212
                         break;
6213 6213
                     case TOOL_DOCUMENT:
6214 6214
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6215
-                        $sql_doc = "SELECT path FROM " . $tbl_doc . "
6216
-                                    WHERE c_id = ".$course_id." AND id = " . intval($row['path']);
6215
+                        $sql_doc = "SELECT path FROM ".$tbl_doc."
6216
+                                    WHERE c_id = ".$course_id." AND id = ".intval($row['path']);
6217 6217
                         $result = Database::query($sql_doc);
6218 6218
                         $path_file = Database::result($result, 0, 0);
6219 6219
                         $path_parts = pathinfo($path_file);
@@ -6252,7 +6252,7 @@  discard block
 block discarded – undo
6252 6252
         if (is_numeric($item_id)) {
6253 6253
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6254 6254
             $sql = "SELECT * FROM $tbl_lp_item
6255
-                    WHERE c_id = ".$course_id." AND id = " . intval($item_id);
6255
+                    WHERE c_id = ".$course_id." AND id = ".intval($item_id);
6256 6256
             $res = Database::query($sql);
6257 6257
             $row = Database::fetch_array($res);
6258 6258
 
@@ -6263,21 +6263,21 @@  discard block
 block discarded – undo
6263 6263
                 case 'sco' :
6264 6264
                     if (isset ($_GET['view']) && $_GET['view'] == 'build') {
6265 6265
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6266
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', 'edit', $item_id, $row);
6266
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter').' :', 'edit', $item_id, $row);
6267 6267
                     } else {
6268
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', $row);
6268
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter').' :', $row);
6269 6269
                     }
6270 6270
                     break;
6271 6271
                 case TOOL_DOCUMENT :
6272 6272
                     $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6273 6273
                     $sql = "SELECT lp.*, doc.path as dir
6274
-                            FROM " . $tbl_lp_item . " as lp
6275
-                            LEFT JOIN " . $tbl_doc . " as doc
6274
+                            FROM " . $tbl_lp_item." as lp
6275
+                            LEFT JOIN " . $tbl_doc." as doc
6276 6276
                             ON doc.id = lp.path
6277 6277
                             WHERE
6278 6278
                                 lp.c_id = $course_id AND
6279 6279
                                 doc.c_id = $course_id AND
6280
-                                lp.id = " . intval($item_id);
6280
+                                lp.id = ".intval($item_id);
6281 6281
                     $res_step = Database::query($sql);
6282 6282
                     $row_step = Database :: fetch_array($res_step);
6283 6283
                     $return .= $this->display_manipulate($item_id, $row['item_type']);
@@ -6287,8 +6287,8 @@  discard block
 block discarded – undo
6287 6287
                     $link_id = (string) $row['path'];
6288 6288
                     if (ctype_digit($link_id)) {
6289 6289
                         $tbl_link = Database :: get_course_table(TABLE_LINK);
6290
-                        $sql_select = 'SELECT url FROM ' . $tbl_link . '
6291
-                                       WHERE c_id = '.$course_id.' AND id = ' . intval($link_id);
6290
+                        $sql_select = 'SELECT url FROM '.$tbl_link.'
6291
+                                       WHERE c_id = '.$course_id.' AND id = '.intval($link_id);
6292 6292
                         $res_link = Database::query($sql_select);
6293 6293
                         $row_link = Database :: fetch_array($res_link);
6294 6294
                         if (is_array($row_link)) {
@@ -6301,9 +6301,9 @@  discard block
 block discarded – undo
6301 6301
                 case 'dokeos_module' :
6302 6302
                     if (isset ($_GET['view']) && $_GET['view'] == 'build') {
6303 6303
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6304
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule') . ' :', 'edit', $item_id, $row);
6304
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule').' :', 'edit', $item_id, $row);
6305 6305
                     } else {
6306
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule') . ' :', $row);
6306
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule').' :', $row);
6307 6307
                     }
6308 6308
                     break;
6309 6309
                 case TOOL_QUIZ :
@@ -6358,7 +6358,7 @@  discard block
 block discarded – undo
6358 6358
 
6359 6359
         $headers = array(
6360 6360
             Display::return_icon('folder_document.png', get_lang('Documents'), array(), ICON_SIZE_BIG),
6361
-            Display::return_icon('quiz.png',  get_lang('Quiz'), array(), ICON_SIZE_BIG),
6361
+            Display::return_icon('quiz.png', get_lang('Quiz'), array(), ICON_SIZE_BIG),
6362 6362
             Display::return_icon('links.png', get_lang('Links'), array(), ICON_SIZE_BIG),
6363 6363
             Display::return_icon('works.png', get_lang('Works'), array(), ICON_SIZE_BIG),
6364 6364
             Display::return_icon('forum.png', get_lang('Forums'), array(), ICON_SIZE_BIG),
@@ -6398,16 +6398,16 @@  discard block
 block discarded – undo
6398 6398
         $course_id = api_get_course_int_id();
6399 6399
         $return = '';
6400 6400
         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6401
-        $sql_doc = "SELECT * FROM " . $tbl_doc . "
6402
-                    WHERE c_id = ".$course_id." AND id = " . $id;
6401
+        $sql_doc = "SELECT * FROM ".$tbl_doc."
6402
+                    WHERE c_id = ".$course_id." AND id = ".$id;
6403 6403
         $res_doc = Database::query($sql_doc);
6404 6404
         $row_doc = Database :: fetch_array($res_doc);
6405 6405
 
6406 6406
         // TODO: Add a path filter.
6407 6407
         if ($iframe) {
6408
-            $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>';
6408
+            $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>';
6409 6409
         } else {
6410
-            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $row_doc['path']);
6410
+            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$row_doc['path']);
6411 6411
         }
6412 6412
 
6413 6413
         return $return;
@@ -6431,8 +6431,8 @@  discard block
 block discarded – undo
6431 6431
             $item_description = $extra_info['description'];
6432 6432
         } elseif (is_numeric($extra_info)) {
6433 6433
             $sql = "SELECT title, description
6434
-                    FROM " . $tbl_quiz . "
6435
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
6434
+                    FROM " . $tbl_quiz."
6435
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
6436 6436
 
6437 6437
             $result = Database::query($sql);
6438 6438
             $row = Database::fetch_array($result);
@@ -6442,8 +6442,8 @@  discard block
 block discarded – undo
6442 6442
             $item_title = '';
6443 6443
             $item_description = '';
6444 6444
         }
6445
-        $item_title			= Security::remove_XSS($item_title);
6446
-        $item_description 	= Security::remove_XSS($item_description);
6445
+        $item_title = Security::remove_XSS($item_title);
6446
+        $item_description = Security::remove_XSS($item_description);
6447 6447
 
6448 6448
         $legend = '<legend>';
6449 6449
         if ($id != 0 && is_array($extra_info))
@@ -6451,13 +6451,13 @@  discard block
 block discarded – undo
6451 6451
         else
6452 6452
             $parent = 0;
6453 6453
 
6454
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6455
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6454
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6455
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6456 6456
 
6457 6457
         $result = Database::query($sql);
6458
-        $arrLP = array ();
6458
+        $arrLP = array();
6459 6459
         while ($row = Database :: fetch_array($result)) {
6460
-            $arrLP[] = array (
6460
+            $arrLP[] = array(
6461 6461
                 'id' => $row['id'],
6462 6462
                 'item_type' => $row['item_type'],
6463 6463
                 'title' => $row['title'],
@@ -6480,15 +6480,15 @@  discard block
 block discarded – undo
6480 6480
         unset ($this->arrMenu);
6481 6481
 
6482 6482
         if ($action == 'add') {
6483
-            $legend .= get_lang('CreateTheExercise') . '&nbsp;:';
6483
+            $legend .= get_lang('CreateTheExercise').'&nbsp;:';
6484 6484
         } elseif ($action == 'move') {
6485
-            $legend .= get_lang('MoveTheCurrentExercise') . '&nbsp;:';
6485
+            $legend .= get_lang('MoveTheCurrentExercise').'&nbsp;:';
6486 6486
         } else {
6487
-            $legend .= get_lang('EditCurrentExecice') . '&nbsp;:';
6487
+            $legend .= get_lang('EditCurrentExecice').'&nbsp;:';
6488 6488
         }
6489 6489
 
6490 6490
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6491
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6491
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6492 6492
         }
6493 6493
 
6494 6494
         $legend .= '</legend>';
@@ -6501,34 +6501,34 @@  discard block
 block discarded – undo
6501 6501
 
6502 6502
         if ($action != 'move') {
6503 6503
             $return .= '<tr>';
6504
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
6505
-            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="' . $item_title . '" /></td>';
6504
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
6505
+            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="'.$item_title.'" /></td>';
6506 6506
             $return .= '</tr>';
6507 6507
         }
6508 6508
 
6509 6509
         $return .= '<tr>';
6510 6510
 
6511
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
6511
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
6512 6512
         $return .= '<td class="input">';
6513 6513
 
6514 6514
         // Select for Parent item, root or chapter
6515 6515
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
6516 6516
 
6517
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6517
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6518 6518
 
6519
-        $arrHide = array (
6519
+        $arrHide = array(
6520 6520
             $id
6521 6521
         );
6522 6522
         for ($i = 0; $i < count($arrLP); $i++) {
6523 6523
             if ($action != 'add') {
6524 6524
                 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)) {
6525
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6525
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6526 6526
                 } else {
6527 6527
                     $arrHide[] = $arrLP[$i]['id'];
6528 6528
                 }
6529 6529
             } else {
6530 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>';
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>';
6532 6532
             }
6533 6533
         }
6534 6534
         if (is_array($arrLP)) {
@@ -6540,11 +6540,11 @@  discard block
 block discarded – undo
6540 6540
         $return .= '</tr>';
6541 6541
         $return .= '<tr>';
6542 6542
 
6543
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
6543
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
6544 6544
         $return .= '<td class="input">';
6545 6545
 
6546 6546
         $return .= '<select class="learnpath_item_form" style="width:100%;" id="previous" name="previous" size="1">';
6547
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6547
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6548 6548
         for ($i = 0; $i < count($arrLP); $i++) {
6549 6549
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6550 6550
                 if (is_array($extra_info)) {
@@ -6556,7 +6556,7 @@  discard block
 block discarded – undo
6556 6556
                 } else {
6557 6557
                     $selected = '';
6558 6558
                 }
6559
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6559
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6560 6560
             }
6561 6561
         }
6562 6562
         $return .= '</select>';
@@ -6573,7 +6573,7 @@  discard block
 block discarded – undo
6573 6573
                     }
6574 6574
                 }
6575 6575
             }
6576
-            $arrHide = array ();
6576
+            $arrHide = array();
6577 6577
             for ($i = 0; $i < count($arrLP); $i++) {
6578 6578
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6579 6579
                     if (is_array($extra_info)) {
@@ -6619,27 +6619,27 @@  discard block
 block discarded – undo
6619 6619
 
6620 6620
         $return .= '<tr>';
6621 6621
         if ($action == 'add') {
6622
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('AddExercise') . '</button></td>';
6622
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('AddExercise').'</button></td>';
6623 6623
         } else {
6624
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('EditCurrentExecice') . '</button></td>';
6624
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('EditCurrentExecice').'</button></td>';
6625 6625
         }
6626 6626
 
6627 6627
         $return .= '</tr>';
6628 6628
         $return .= '</table>';
6629 6629
 
6630 6630
         if ($action == 'move') {
6631
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6632
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6631
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6632
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6633 6633
         }
6634 6634
 
6635 6635
         if (is_numeric($extra_info)) {
6636
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6636
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6637 6637
         } elseif (is_array($extra_info)) {
6638
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6638
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6639 6639
         }
6640 6640
 
6641
-        $return .= '<input name="type" type="hidden" value="' . TOOL_QUIZ . '" />';
6642
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6641
+        $return .= '<input name="type" type="hidden" value="'.TOOL_QUIZ.'" />';
6642
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6643 6643
 
6644 6644
         $return .= '</form>';
6645 6645
         $return .= '</div>';
@@ -6666,11 +6666,11 @@  discard block
 block discarded – undo
6666 6666
         } elseif (is_numeric($extra_info)) {
6667 6667
             $TBL_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT);
6668 6668
 
6669
-            $sql = "SELECT * FROM " . $TBL_DOCUMENT . "
6669
+            $sql = "SELECT * FROM ".$TBL_DOCUMENT."
6670 6670
                     WHERE
6671 6671
                         c_id = ".$course_id." AND
6672
-                        path LIKE '" . $uploadPath . "/%/%htm%' AND
6673
-                        id = " . (int) $extra_info . "
6672
+                        path LIKE '" . $uploadPath."/%/%htm%' AND
6673
+                        id = " . (int) $extra_info."
6674 6674
                     ORDER BY id ASC";
6675 6675
 
6676 6676
             $res_hot = Database::query($sql);
@@ -6694,11 +6694,11 @@  discard block
 block discarded – undo
6694 6694
         }
6695 6695
 
6696 6696
         $sql = "SELECT * FROM $tbl_lp_item
6697
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6697
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6698 6698
         $result = Database::query($sql);
6699
-        $arrLP = array ();
6699
+        $arrLP = array();
6700 6700
         while ($row = Database :: fetch_array($result)) {
6701
-            $arrLP[] = array (
6701
+            $arrLP[] = array(
6702 6702
                 'id' => $row['id'],
6703 6703
                 'item_type' => $row['item_type'],
6704 6704
                 'title' => $row['title'],
@@ -6723,7 +6723,7 @@  discard block
 block discarded – undo
6723 6723
         else
6724 6724
             $legend .= get_lang('EditCurrentExecice');
6725 6725
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6726
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6726
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6727 6727
         }
6728 6728
         $legend .= '</legend>';
6729 6729
 
@@ -6731,11 +6731,11 @@  discard block
 block discarded – undo
6731 6731
         $return .= $legend;
6732 6732
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
6733 6733
         $return .= '<tr>';
6734
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . ' :</label></td>';
6734
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').' :</label></td>';
6735 6735
         $return .= '<td class="input">';
6736 6736
         $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
6737
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6738
-        $arrHide = array (
6737
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6738
+        $arrHide = array(
6739 6739
             $id
6740 6740
         );
6741 6741
 
@@ -6743,13 +6743,13 @@  discard block
 block discarded – undo
6743 6743
             for ($i = 0; $i < count($arrLP); $i++) {
6744 6744
                 if ($action != 'add') {
6745 6745
                     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)) {
6746
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6746
+                        $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6747 6747
                     } else {
6748 6748
                         $arrHide[] = $arrLP[$i]['id'];
6749 6749
                     }
6750 6750
                 } else {
6751 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>';
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>';
6753 6753
                 }
6754 6754
             }
6755 6755
 
@@ -6760,10 +6760,10 @@  discard block
 block discarded – undo
6760 6760
         $return .= '</td>';
6761 6761
         $return .= '</tr>';
6762 6762
         $return .= '<tr>';
6763
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . ' :</label></td>';
6763
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').' :</label></td>';
6764 6764
         $return .= '<td class="input">';
6765 6765
         $return .= '<select id="previous" name="previous" size="1">';
6766
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6766
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6767 6767
 
6768 6768
         for ($i = 0; $i < count($arrLP); $i++) {
6769 6769
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
@@ -6773,7 +6773,7 @@  discard block
 block discarded – undo
6773 6773
                 else
6774 6774
                     $selected = '';
6775 6775
 
6776
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6776
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6777 6777
             }
6778 6778
         }
6779 6779
 
@@ -6783,8 +6783,8 @@  discard block
 block discarded – undo
6783 6783
 
6784 6784
         if ($action != 'move') {
6785 6785
             $return .= '<tr>';
6786
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . ' :</label></td>';
6787
-            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>';
6786
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').' :</label></td>';
6787
+            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>';
6788 6788
             $return .= '</tr>';
6789 6789
             $id_prerequisite = 0;
6790 6790
             if (is_array($arrLP) && count($arrLP) > 0) {
@@ -6795,7 +6795,7 @@  discard block
 block discarded – undo
6795 6795
                     }
6796 6796
                 }
6797 6797
 
6798
-                $arrHide = array ();
6798
+                $arrHide = array();
6799 6799
                 for ($i = 0; $i < count($arrLP); $i++) {
6800 6800
                     if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6801 6801
                         if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -6809,22 +6809,22 @@  discard block
 block discarded – undo
6809 6809
         }
6810 6810
 
6811 6811
         $return .= '<tr>';
6812
-        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">' . get_lang('SaveHotpotatoes') . '</button></td>';
6812
+        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">'.get_lang('SaveHotpotatoes').'</button></td>';
6813 6813
         $return .= '</tr>';
6814 6814
         $return .= '</table>';
6815 6815
 
6816 6816
         if ($action == 'move') {
6817
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6818
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6817
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6818
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6819 6819
         }
6820 6820
 
6821 6821
         if (is_numeric($extra_info)) {
6822
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6822
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6823 6823
         } elseif (is_array($extra_info)) {
6824
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6824
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6825 6825
         }
6826
-        $return .= '<input name="type" type="hidden" value="' . TOOL_HOTPOTATOES . '" />';
6827
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6826
+        $return .= '<input name="type" type="hidden" value="'.TOOL_HOTPOTATOES.'" />';
6827
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6828 6828
         $return .= '</form>';
6829 6829
 
6830 6830
         return $return;
@@ -6847,8 +6847,8 @@  discard block
 block discarded – undo
6847 6847
             $item_title = stripslashes($extra_info['title']);
6848 6848
         } elseif (is_numeric($extra_info)) {
6849 6849
             $sql = "SELECT forum_title as title, forum_comment as comment
6850
-                    FROM " . $tbl_forum . "
6851
-                    WHERE c_id = ".$course_id." AND forum_id = " . $extra_info;
6850
+                    FROM " . $tbl_forum."
6851
+                    WHERE c_id = ".$course_id." AND forum_id = ".$extra_info;
6852 6852
 
6853 6853
             $result = Database::query($sql);
6854 6854
             $row = Database :: fetch_array($result);
@@ -6868,7 +6868,7 @@  discard block
 block discarded – undo
6868 6868
             $parent = 0;
6869 6869
         }
6870 6870
 
6871
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6871
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6872 6872
                 WHERE
6873 6873
                     c_id = ".$course_id." AND
6874 6874
                     lp_id = " . $this->lp_id;
@@ -6876,7 +6876,7 @@  discard block
 block discarded – undo
6876 6876
         $arrLP = array();
6877 6877
 
6878 6878
         while ($row = Database :: fetch_array($result)) {
6879
-            $arrLP[] = array (
6879
+            $arrLP[] = array(
6880 6880
                 'id' => $row['id'],
6881 6881
                 'item_type' => $row['item_type'],
6882 6882
                 'title' => $row['title'],
@@ -6898,10 +6898,10 @@  discard block
 block discarded – undo
6898 6898
         unset($this->arrMenu);
6899 6899
 
6900 6900
         if ($action == 'add')
6901
-            $legend .= get_lang('CreateTheForum') . '&nbsp;:';
6902
-        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum') . '&nbsp;:';
6901
+            $legend .= get_lang('CreateTheForum').'&nbsp;:';
6902
+        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum').'&nbsp;:';
6903 6903
         else
6904
-            $legend .= get_lang('EditCurrentForum') . '&nbsp;:';
6904
+            $legend .= get_lang('EditCurrentForum').'&nbsp;:';
6905 6905
 
6906 6906
         $legend .= '</legend>';
6907 6907
         $return = '<div class="sectioncomment">';
@@ -6911,16 +6911,16 @@  discard block
 block discarded – undo
6911 6911
 
6912 6912
         if ($action != 'move') {
6913 6913
             $return .= '<tr>';
6914
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
6915
-            $return .= '<td class="input"><input id="idTitle" size="44" name="title" type="text" value="' . $item_title . '" class="learnpath_item_form" /></td>';
6914
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
6915
+            $return .= '<td class="input"><input id="idTitle" size="44" name="title" type="text" value="'.$item_title.'" class="learnpath_item_form" /></td>';
6916 6916
             $return .= '</tr>';
6917 6917
         }
6918 6918
 
6919 6919
         $return .= '<tr>';
6920
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
6920
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
6921 6921
         $return .= '<td class="input">';
6922 6922
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" class="learnpath_item_form" size="1">';
6923
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6923
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6924 6924
         $arrHide = array(
6925 6925
             $id
6926 6926
         );
@@ -6929,13 +6929,13 @@  discard block
 block discarded – undo
6929 6929
         for ($i = 0; $i < count($arrLP); $i++) {
6930 6930
             if ($action != 'add') {
6931 6931
                 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)) {
6932
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6932
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6933 6933
                 } else {
6934 6934
                     $arrHide[] = $arrLP[$i]['id'];
6935 6935
                 }
6936 6936
             } else {
6937 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>';
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>';
6939 6939
             }
6940 6940
         }
6941 6941
         if (is_array($arrLP)) {
@@ -6946,10 +6946,10 @@  discard block
 block discarded – undo
6946 6946
         $return .= '</td>';
6947 6947
         $return .= '</tr>';
6948 6948
         $return .= '<tr>';
6949
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
6949
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
6950 6950
         $return .= '<td class="input">';
6951 6951
         $return .= '<select id="previous" name="previous" style="width:100%;" size="1" class="learnpath_item_form">';
6952
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6952
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6953 6953
 
6954 6954
         for ($i = 0; $i < count($arrLP); $i++) {
6955 6955
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
@@ -6959,8 +6959,8 @@  discard block
 block discarded – undo
6959 6959
                 else
6960 6960
                     $selected = '';
6961 6961
 
6962
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' .
6963
-                    get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6962
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.
6963
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6964 6964
             }
6965 6965
         }
6966 6966
 
@@ -6994,25 +6994,25 @@  discard block
 block discarded – undo
6994 6994
         $return .= '<tr>';
6995 6995
 
6996 6996
         if ($action == 'add') {
6997
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> ' . get_lang('AddForumToCourse') . ' </button></td>';
6997
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> '.get_lang('AddForumToCourse').' </button></td>';
6998 6998
         } else {
6999
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> ' . get_lang('EditCurrentForum') . ' </button></td>';
6999
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> '.get_lang('EditCurrentForum').' </button></td>';
7000 7000
         }
7001 7001
         $return .= '</tr>';
7002 7002
         $return .= '</table>';
7003 7003
 
7004 7004
         if ($action == 'move') {
7005
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7006
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7005
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7006
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7007 7007
         }
7008 7008
 
7009 7009
         if (is_numeric($extra_info)) {
7010
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7010
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7011 7011
         } elseif (is_array($extra_info)) {
7012
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7012
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7013 7013
         }
7014
-        $return .= '<input name="type" type="hidden" value="' . TOOL_FORUM . '" />';
7015
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7014
+        $return .= '<input name="type" type="hidden" value="'.TOOL_FORUM.'" />';
7015
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7016 7016
         $return .= '</form>';
7017 7017
         $return .= '</div>';
7018 7018
 
@@ -7039,7 +7039,7 @@  discard block
 block discarded – undo
7039 7039
             $item_title = stripslashes($extra_info['title']);
7040 7040
         } elseif (is_numeric($extra_info)) {
7041 7041
             $sql = "SELECT thread_title as title FROM $tbl_forum
7042
-                    WHERE c_id = $course_id AND thread_id = " . $extra_info;
7042
+                    WHERE c_id = $course_id AND thread_id = ".$extra_info;
7043 7043
 
7044 7044
             $result = Database::query($sql);
7045 7045
             $row = Database :: fetch_array($result);
@@ -7059,15 +7059,15 @@  discard block
 block discarded – undo
7059 7059
             $parent = 0;
7060 7060
         }
7061 7061
 
7062
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7063
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7062
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7063
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7064 7064
 
7065 7065
         $result = Database::query($sql);
7066 7066
 
7067
-        $arrLP = array ();
7067
+        $arrLP = array();
7068 7068
 
7069 7069
         while ($row = Database :: fetch_array($result)) {
7070
-            $arrLP[] = array (
7070
+            $arrLP[] = array(
7071 7071
                 'id' => $row['id'],
7072 7072
                 'item_type' => $row['item_type'],
7073 7073
                 'title' => $row['title'],
@@ -7090,31 +7090,31 @@  discard block
 block discarded – undo
7090 7090
 
7091 7091
         $return .= '<form method="POST">';
7092 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>';
7093
+            $return .= '<legend>'.get_lang('CreateTheForum').'</legend>';
7094
+        elseif ($action == 'move') $return .= '<p class="lp_title">'.get_lang('MoveTheCurrentForum').'&nbsp;:</p>';
7095 7095
         else
7096
-            $return .= '<legend>' . get_lang('EditCurrentForum') . '</legend>';
7096
+            $return .= '<legend>'.get_lang('EditCurrentForum').'</legend>';
7097 7097
 
7098 7098
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
7099 7099
         $return .= '<tr>';
7100
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
7100
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
7101 7101
         $return .= '<td class="input">';
7102 7102
         $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
7103
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
7104
-        $arrHide = array (
7103
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
7104
+        $arrHide = array(
7105 7105
             $id
7106 7106
         );
7107 7107
 
7108 7108
         for ($i = 0; $i < count($arrLP); $i++) {
7109 7109
             if ($action != 'add') {
7110 7110
                 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)) {
7111
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7111
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7112 7112
                 } else {
7113 7113
                     $arrHide[] = $arrLP[$i]['id'];
7114 7114
                 }
7115 7115
             } else {
7116 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>';
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>';
7118 7118
             }
7119 7119
         }
7120 7120
 
@@ -7126,10 +7126,10 @@  discard block
 block discarded – undo
7126 7126
         $return .= '</td>';
7127 7127
         $return .= '</tr>';
7128 7128
         $return .= '<tr>';
7129
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
7129
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
7130 7130
         $return .= '<td class="input">';
7131 7131
         $return .= '<select id="previous" name="previous" size="1">';
7132
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7132
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
7133 7133
         for ($i = 0; $i < count($arrLP); $i++) {
7134 7134
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7135 7135
                 if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -7138,7 +7138,7 @@  discard block
 block discarded – undo
7138 7138
                 else
7139 7139
                     $selected = '';
7140 7140
 
7141
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7141
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
7142 7142
             }
7143 7143
         }
7144 7144
         $return .= '</select>';
@@ -7146,8 +7146,8 @@  discard block
 block discarded – undo
7146 7146
         $return .= '</tr>';
7147 7147
         if ($action != 'move') {
7148 7148
             $return .= '<tr>';
7149
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
7150
-            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>';
7149
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
7150
+            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>';
7151 7151
             $return .= '</tr>';
7152 7152
             $return .= '<tr>';
7153 7153
             $return .= '</tr>';
@@ -7174,17 +7174,17 @@  discard block
 block discarded – undo
7174 7174
             }
7175 7175
 
7176 7176
             $return .= '<tr>';
7177
-            $return .= '<td class="label"><label for="idPrerequisites">' . get_lang('LearnpathPrerequisites') . '</label></td>';
7178
-            $return .= '<td class="input"><select name="prerequisites" id="prerequisites"><option value="0">' . get_lang('NoPrerequisites') . '</option>';
7177
+            $return .= '<td class="label"><label for="idPrerequisites">'.get_lang('LearnpathPrerequisites').'</label></td>';
7178
+            $return .= '<td class="input"><select name="prerequisites" id="prerequisites"><option value="0">'.get_lang('NoPrerequisites').'</option>';
7179 7179
 
7180 7180
             foreach ($arrHide as $key => $value) {
7181 7181
                 if ($key == $s_selected_position && $action == 'add') {
7182
-                    $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7182
+                    $return .= '<option value="'.$key.'" selected="selected">'.$value['value'].'</option>';
7183 7183
                 }
7184 7184
                 elseif ($key == $id_prerequisite && $action == 'edit') {
7185
-                    $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7185
+                    $return .= '<option value="'.$key.'" selected="selected">'.$value['value'].'</option>';
7186 7186
                 } else {
7187
-                    $return .= '<option value="' . $key . '">' . $value['value'] . '</option>';
7187
+                    $return .= '<option value="'.$key.'">'.$value['value'].'</option>';
7188 7188
                 }
7189 7189
             }
7190 7190
             $return .= "</select></td>";
@@ -7198,19 +7198,19 @@  discard block
 block discarded – undo
7198 7198
         $return .= '</table>';
7199 7199
 
7200 7200
         if ($action == 'move') {
7201
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7202
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7201
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7202
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7203 7203
         }
7204 7204
 
7205 7205
         if (is_numeric($extra_info)) {
7206
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7206
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7207 7207
         }
7208 7208
         elseif (is_array($extra_info)) {
7209
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7209
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7210 7210
         }
7211 7211
 
7212
-        $return .= '<input name="type" type="hidden" value="' . TOOL_THREAD . '" />';
7213
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7212
+        $return .= '<input name="type" type="hidden" value="'.TOOL_THREAD.'" />';
7213
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7214 7214
         $return .= '</form>';
7215 7215
         $return .= '</div>';
7216 7216
 
@@ -7236,10 +7236,10 @@  discard block
 block discarded – undo
7236 7236
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
7237 7237
 
7238 7238
         if ($id != 0 && is_array($extra_info)) {
7239
-            $item_title 		= $extra_info['title'];
7240
-            $item_description 	= $extra_info['description'];
7241
-            $item_path = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7242
-            $item_path_fck = '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7239
+            $item_title = $extra_info['title'];
7240
+            $item_description = $extra_info['description'];
7241
+            $item_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7242
+            $item_path_fck = '/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7243 7243
         } else {
7244 7244
             $item_title = '';
7245 7245
             $item_description = '';
@@ -7253,17 +7253,17 @@  discard block
 block discarded – undo
7253 7253
         }
7254 7254
 
7255 7255
         $id  = intval($id);
7256
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7256
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7257 7257
                 WHERE
7258 7258
                     c_id = ".$course_id." AND
7259
-                    lp_id = " . $this->lp_id . " AND
7259
+                    lp_id = " . $this->lp_id." AND
7260 7260
                     id != $id";
7261 7261
 
7262 7262
         if ($item_type == 'module')
7263 7263
             $sql .= " AND parent_item_id = 0";
7264 7264
 
7265 7265
         $result = Database::query($sql);
7266
-        $arrLP = array ();
7266
+        $arrLP = array();
7267 7267
 
7268 7268
         while ($row = Database :: fetch_array($result)) {
7269 7269
             $arrLP[] = array(
@@ -7291,9 +7291,9 @@  discard block
 block discarded – undo
7291 7291
 
7292 7292
         $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
7293 7293
 
7294
-        $url = api_get_self() . '?' .api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7294
+        $url = api_get_self().'?'.api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7295 7295
 
7296
-        $form = new FormValidator('form', 'POST',  $url);
7296
+        $form = new FormValidator('form', 'POST', $url);
7297 7297
 
7298 7298
         $defaults['title'] = api_html_entity_decode($item_title, ENT_QUOTES, $charset);
7299 7299
         $defaults['description'] = $item_description;
@@ -7337,7 +7337,7 @@  discard block
 block discarded – undo
7337 7337
             $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', array('id' => 'idParent', 'onchange' => "javascript: load_cbo(this.value);"));
7338 7338
 
7339 7339
             foreach ($arrHide as $key => $value) {
7340
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7340
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7341 7341
             }
7342 7342
             if (!empty($s_selected_parent)) {
7343 7343
                 $parent_select->setSelected($s_selected_parent);
@@ -7359,16 +7359,16 @@  discard block
 block discarded – undo
7359 7359
                     $s_selected_position = $arrLP[$i]['id'];
7360 7360
                 }
7361 7361
 
7362
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7362
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7363 7363
             }
7364 7364
         }
7365 7365
 
7366 7366
         $position = $form->addElement('select', 'previous', get_lang('Position'), '', array('id' => 'previous'));
7367 7367
         $padding = isset($value['padding']) ? $value['padding'] : 0;
7368
-        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:' . $padding . 'px;"');
7368
+        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:'.$padding.'px;"');
7369 7369
 
7370 7370
         foreach ($arrHide as $key => $value) {
7371
-            $position->addOption($value['value'] . '"', $key, 'style="padding-left:' . $padding . 'px;"');
7371
+            $position->addOption($value['value'].'"', $key, 'style="padding-left:'.$padding.'px;"');
7372 7372
         }
7373 7373
 
7374 7374
         if (!empty ($s_selected_position)) {
@@ -7397,23 +7397,23 @@  discard block
 block discarded – undo
7397 7397
         //assets can't be modified
7398 7398
 
7399 7399
         //$item_type == 'asset' ||
7400
-        if (( $item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7400
+        if (($item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7401 7401
 
7402 7402
             if ($item_type == 'sco') {
7403
-                $form->addElement('html', '<script type="text/javascript">alert("' . get_lang('WarningWhenEditingScorm') . '")</script>');
7403
+                $form->addElement('html', '<script type="text/javascript">alert("'.get_lang('WarningWhenEditingScorm').'")</script>');
7404 7404
             }
7405 7405
             $renderer = $form->defaultRenderer();
7406 7406
             $renderer->setElementTemplate('<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{label}<br />{element}', 'content_lp');
7407 7407
 
7408 7408
             $relative_prefix = '';
7409 7409
 
7410
-            $editor_config = array( 'ToolbarSet' 			=> 'LearningPathDocuments',
7410
+            $editor_config = array('ToolbarSet' 			=> 'LearningPathDocuments',
7411 7411
                 'Width' 				=> '100%',
7412 7412
                 'Height' 				=> '500',
7413 7413
                 'FullPage' 				=> true,
7414 7414
                 'CreateDocumentDir' 	=> $relative_prefix,
7415
-                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/scorm/',
7416
-                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().$item_path_fck
7415
+                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/scorm/',
7416
+                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().$item_path_fck
7417 7417
             );
7418 7418
 
7419 7419
             $form->addElement('html_editor', 'content_lp', '', null, $editor_config);
@@ -7422,7 +7422,7 @@  discard block
 block discarded – undo
7422 7422
             $defaults['content_lp'] = file_get_contents($content_path);
7423 7423
         }
7424 7424
 
7425
-        $form->addElement('hidden', 'type', 'dokeos_' . $item_type);
7425
+        $form->addElement('hidden', 'type', 'dokeos_'.$item_type);
7426 7426
         $form->addElement('hidden', 'post_time', time());
7427 7427
         $form->setDefaults($defaults);
7428 7428
         return $form->return_form();
@@ -7460,8 +7460,8 @@  discard block
 block discarded – undo
7460 7460
         // We don't display the document form if it's not an editable document (html or txt file).
7461 7461
         if ($action == "add") {
7462 7462
             if (is_numeric($extra_info)) {
7463
-                $sql_doc = "SELECT path FROM " . $tbl_doc . "
7464
-                            WHERE c_id = ".$course_id." AND id = " . intval($extra_info);
7463
+                $sql_doc = "SELECT path FROM ".$tbl_doc."
7464
+                            WHERE c_id = ".$course_id." AND id = ".intval($extra_info);
7465 7465
                 $result = Database::query($sql_doc);
7466 7466
                 $path_file = Database :: result($result, 0, 0);
7467 7467
                 $path_parts = pathinfo($path_file);
@@ -7479,13 +7479,13 @@  discard block
 block discarded – undo
7479 7479
                 $item_title = stripslashes($path_parts['filename']);
7480 7480
             }
7481 7481
         } elseif (is_numeric($extra_info)) {
7482
-            $sql_doc = "SELECT path, title FROM " . $tbl_doc . "
7482
+            $sql_doc = "SELECT path, title FROM ".$tbl_doc."
7483 7483
                         WHERE
7484 7484
                             c_id = ".$course_id." AND
7485 7485
                             id = " . intval($extra_info);
7486 7486
 
7487 7487
             $result = Database::query($sql_doc);
7488
-            $row 	= Database::fetch_array($result);
7488
+            $row = Database::fetch_array($result);
7489 7489
             $item_title = $row['title'];
7490 7490
             $item_title = str_replace('_', ' ', $item_title);
7491 7491
             if (empty ($item_title)) {
@@ -7504,11 +7504,11 @@  discard block
 block discarded – undo
7504 7504
             $parent = 0;
7505 7505
         }
7506 7506
 
7507
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7508
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7507
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7508
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7509 7509
 
7510 7510
         $result = Database::query($sql);
7511
-        $arrLP = array ();
7511
+        $arrLP = array();
7512 7512
         while ($row = Database :: fetch_array($result)) {
7513 7513
             $arrLP[] = array(
7514 7514
                 'id' => $row['id'],
@@ -7542,9 +7542,9 @@  discard block
 block discarded – undo
7542 7542
         $return .= '</legend>';
7543 7543
 
7544 7544
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
7545
-            $return .= Display :: return_warning_message('<strong>' . get_lang('Warning') . ' !</strong><br />' . get_lang('WarningEditingDocument'), false);
7545
+            $return .= Display :: return_warning_message('<strong>'.get_lang('Warning').' !</strong><br />'.get_lang('WarningEditingDocument'), false);
7546 7546
         }
7547
-        $form = new FormValidator('form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7547
+        $form = new FormValidator('form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7548 7548
         $defaults['title'] = Security :: remove_XSS($item_title);
7549 7549
         if (empty($item_title)) {
7550 7550
             $defaults['title'] = Security::remove_XSS($item_title);
@@ -7580,15 +7580,15 @@  discard block
 block discarded – undo
7580 7580
         }
7581 7581
 
7582 7582
         $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', 'class="form-control" id="idParent" " onchange="javascript: load_cbo(this.value);"');
7583
-        $my_count=0;
7583
+        $my_count = 0;
7584 7584
         foreach ($arrHide as $key => $value) {
7585
-            if ($my_count!=0) {
7585
+            if ($my_count != 0) {
7586 7586
                 // The LP name is also the first section and is not in the same charset like the other sections.
7587 7587
                 $value['value'] = Security :: remove_XSS($value['value']);
7588
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7588
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7589 7589
             } else {
7590 7590
                 $value['value'] = Security :: remove_XSS($value['value']);
7591
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7591
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7592 7592
             }
7593 7593
             $my_count++;
7594 7594
         }
@@ -7596,7 +7596,7 @@  discard block
 block discarded – undo
7596 7596
         if (!empty($id)) {
7597 7597
             $parent_select->setSelected($parent);
7598 7598
         } else {
7599
-            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0 ;
7599
+            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0;
7600 7600
             $parent_select->setSelected($parent_item_id);
7601 7601
         }
7602 7602
 
@@ -7613,7 +7613,7 @@  discard block
 block discarded – undo
7613 7613
                 if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7614 7614
                     $s_selected_position = $arrLP[$i]['id'];
7615 7615
                 elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id'];
7616
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7616
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7617 7617
             }
7618 7618
         }
7619 7619
 
@@ -7621,8 +7621,8 @@  discard block
 block discarded – undo
7621 7621
         $position->addOption(get_lang('FirstPosition'), 0);
7622 7622
 
7623 7623
         foreach ($arrHide as $key => $value) {
7624
-            $padding = isset($value['padding']) ? $value['padding']: 0;
7625
-            $position->addOption($value['value'], $key, 'style="padding-left:' . $padding . 'px;"');
7624
+            $padding = isset($value['padding']) ? $value['padding'] : 0;
7625
+            $position->addOption($value['value'], $key, 'style="padding-left:'.$padding.'px;"');
7626 7626
         }
7627 7627
         $position->setSelected($s_selected_position);
7628 7628
 
@@ -7692,7 +7692,7 @@  discard block
 block discarded – undo
7692 7692
                             $relative_path 	 = array_slice($relative_path, 1, $cnt);
7693 7693
                             $relative_path 	 = implode('/', $relative_path);
7694 7694
                             if (strlen($relative_path) > 0) {
7695
-                                $relative_path = $relative_path . '/';
7695
+                                $relative_path = $relative_path.'/';
7696 7696
                             }
7697 7697
                         } else {
7698 7698
                             $result = $this->generate_lp_folder($_course);
@@ -7706,8 +7706,8 @@  discard block
 block discarded – undo
7706 7706
                             'Height' 				=> '500',
7707 7707
                             'FullPage' 				=> true,
7708 7708
                             'CreateDocumentDir' 	=> $relative_prefix,
7709
-                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/',
7710
-                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/'.$relative_path
7709
+                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
7710
+                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/'.$relative_path
7711 7711
                         );
7712 7712
 
7713 7713
                         if ($_GET['action'] == 'add_item') {
@@ -7774,8 +7774,8 @@  discard block
 block discarded – undo
7774 7774
             $item_url = stripslashes($extra_info['url']);
7775 7775
         } elseif (is_numeric($extra_info)) {
7776 7776
             $extra_info = intval($extra_info);
7777
-            $sql = "SELECT title, description, url FROM " . $tbl_link . "
7778
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
7777
+            $sql = "SELECT title, description, url FROM ".$tbl_link."
7778
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
7779 7779
             $result = Database::query($sql);
7780 7780
             $row = Database :: fetch_array($result);
7781 7781
             $item_title       = $row['title'];
@@ -7795,8 +7795,8 @@  discard block
 block discarded – undo
7795 7795
             $parent = 0;
7796 7796
         }
7797 7797
 
7798
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7799
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7798
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7799
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7800 7800
         $result = Database::query($sql);
7801 7801
         $arrLP = array();
7802 7802
 
@@ -7823,10 +7823,10 @@  discard block
 block discarded – undo
7823 7823
         unset ($this->arrMenu);
7824 7824
 
7825 7825
         if ($action == 'add')
7826
-            $legend .= get_lang('CreateTheLink') . '&nbsp;:';
7827
-        elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink') . '&nbsp;:';
7826
+            $legend .= get_lang('CreateTheLink').'&nbsp;:';
7827
+        elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink').'&nbsp;:';
7828 7828
         else
7829
-            $legend .= get_lang('EditCurrentLink') . '&nbsp;:';
7829
+            $legend .= get_lang('EditCurrentLink').'&nbsp;:';
7830 7830
 
7831 7831
         $legend .= '</legend>';
7832 7832
 
@@ -7837,16 +7837,16 @@  discard block
 block discarded – undo
7837 7837
 
7838 7838
         if ($action != 'move') {
7839 7839
             $return .= '<tr>';
7840
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
7841
-            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="' . $item_title . '" class="learnpath_item_form"/></td>';
7840
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
7841
+            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="'.$item_title.'" class="learnpath_item_form"/></td>';
7842 7842
             $return .= '</tr>';
7843 7843
         }
7844 7844
 
7845 7845
         $return .= '<tr>';
7846
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
7846
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
7847 7847
         $return .= '<td class="input">';
7848 7848
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" class="learnpath_item_form" size="1">';
7849
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
7849
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
7850 7850
         $arrHide = array(
7851 7851
             $id
7852 7852
         );
@@ -7856,13 +7856,13 @@  discard block
 block discarded – undo
7856 7856
         for ($i = 0; $i < count($arrLP); $i++) {
7857 7857
             if ($action != 'add') {
7858 7858
                 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)) {
7859
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7859
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7860 7860
                 } else {
7861 7861
                     $arrHide[] = $arrLP[$i]['id'];
7862 7862
                 }
7863 7863
             } else {
7864 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>';
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>';
7866 7866
             }
7867 7867
         }
7868 7868
 
@@ -7874,11 +7874,11 @@  discard block
 block discarded – undo
7874 7874
         $return .= '</td>';
7875 7875
         $return .= '</tr>';
7876 7876
         $return .= '<tr>';
7877
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
7877
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
7878 7878
         $return .= '<td class="input">';
7879 7879
 
7880 7880
         $return .= '<select id="previous" name="previous" style="width:100%;" size="1" class="learnpath_item_form">';
7881
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7881
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
7882 7882
         for ($i = 0; $i < count($arrLP); $i++) {
7883 7883
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7884 7884
                 if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -7888,7 +7888,7 @@  discard block
 block discarded – undo
7888 7888
                 else
7889 7889
                     $selected = '';
7890 7890
 
7891
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7891
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
7892 7892
             }
7893 7893
         }
7894 7894
         $return .= '</select>';
@@ -7897,8 +7897,8 @@  discard block
 block discarded – undo
7897 7897
 
7898 7898
         if ($action != 'move') {
7899 7899
             $return .= '<tr>';
7900
-            $return .= '<td class="label"><label for="idURL">' . get_lang('Url') . '</label></td>';
7901
-            $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>';
7900
+            $return .= '<td class="label"><label for="idURL">'.get_lang('Url').'</label></td>';
7901
+            $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>';
7902 7902
             $return .= '</tr>';
7903 7903
             $id_prerequisite = 0;
7904 7904
             if (is_array($arrLP)) {
@@ -7925,25 +7925,25 @@  discard block
 block discarded – undo
7925 7925
 
7926 7926
         $return .= '<tr>';
7927 7927
         if ($action == 'add') {
7928
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('AddLinkToCourse') . '</button></td>';
7928
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('AddLinkToCourse').'</button></td>';
7929 7929
         } else {
7930
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('EditCurrentLink') . '</button></td>';
7930
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('EditCurrentLink').'</button></td>';
7931 7931
         }
7932 7932
         $return .= '</tr>';
7933 7933
         $return .= '</table>';
7934 7934
 
7935 7935
         if ($action == 'move') {
7936
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7937
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7936
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7937
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7938 7938
         }
7939 7939
 
7940 7940
         if (is_numeric($extra_info)) {
7941
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7941
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7942 7942
         } elseif (is_array($extra_info)) {
7943
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7943
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7944 7944
         }
7945
-        $return .= '<input name="type" type="hidden" value="' . TOOL_LINK . '" />';
7946
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7945
+        $return .= '<input name="type" type="hidden" value="'.TOOL_LINK.'" />';
7946
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7947 7947
         $return .= '</form>';
7948 7948
         $return .= '</div>';
7949 7949
 
@@ -7969,8 +7969,8 @@  discard block
 block discarded – undo
7969 7969
         } elseif (is_numeric($extra_info)) {
7970 7970
             $extra_info = intval($extra_info);
7971 7971
             $sql = "SELECT title, description
7972
-                    FROM " . $tbl_publication . "
7973
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
7972
+                    FROM " . $tbl_publication."
7973
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
7974 7974
 
7975 7975
             $result = Database::query($sql);
7976 7976
             $row = Database :: fetch_array($result);
@@ -7986,13 +7986,13 @@  discard block
 block discarded – undo
7986 7986
             $parent = 0;
7987 7987
         }
7988 7988
 
7989
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7990
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7989
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7990
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7991 7991
 
7992 7992
         $result = Database::query($sql);
7993 7993
         $arrLP = array();
7994 7994
         while ($row = Database :: fetch_array($result)) {
7995
-            $arrLP[] = array (
7995
+            $arrLP[] = array(
7996 7996
                 'id' => $row['id'],
7997 7997
                 'item_type' => $row['item_type'],
7998 7998
                 'title' => $row['title'],
@@ -8038,7 +8038,7 @@  discard block
 block discarded – undo
8038 8038
             ]
8039 8039
         );
8040 8040
 
8041
-        $arrHide = array (
8041
+        $arrHide = array(
8042 8042
             $id
8043 8043
         );
8044 8044
 
@@ -8056,7 +8056,7 @@  discard block
 block discarded – undo
8056 8056
                     $parentSelect->addOption(
8057 8057
                         $arrLP[$i]['title'],
8058 8058
                         $arrLP[$i]['id'],
8059
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8059
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8060 8060
                     );
8061 8061
 
8062 8062
                     if ($parent == $arrLP[$i]['id']) {
@@ -8073,7 +8073,7 @@  discard block
 block discarded – undo
8073 8073
                     $parentSelect->addOption(
8074 8074
                         $arrLP[$i]['title'],
8075 8075
                         $arrLP[$i]['id'],
8076
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8076
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8077 8077
                     );
8078 8078
 
8079 8079
                     if ($parent == $arrLP[$i]['id']) {
@@ -8097,7 +8097,7 @@  discard block
 block discarded – undo
8097 8097
         for ($i = 0; $i < count($arrLP); $i++) {
8098 8098
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
8099 8099
                 $previousSelect->addOption(
8100
-                    get_lang('After') . ' "' . $arrLP[$i]['title'] . '"',
8100
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"',
8101 8101
                     $arrLP[$i]['id']
8102 8102
                 );
8103 8103
 
@@ -8119,7 +8119,7 @@  discard block
 block discarded – undo
8119 8119
                     }
8120 8120
                 }
8121 8121
             }
8122
-            $arrHide = array ();
8122
+            $arrHide = array();
8123 8123
             for ($i = 0; $i < count($arrLP); $i++) {
8124 8124
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
8125 8125
                     if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -8211,8 +8211,8 @@  discard block
 block discarded – undo
8211 8211
 
8212 8212
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8213 8213
         $item_id = intval($item_id);
8214
-        $sql = "SELECT * FROM " . $tbl_lp_item . " as lp
8215
-                WHERE lp.c_id = ".$course_id." AND lp.id = " . $item_id;
8214
+        $sql = "SELECT * FROM ".$tbl_lp_item." as lp
8215
+                WHERE lp.c_id = ".$course_id." AND lp.id = ".$item_id;
8216 8216
         $result = Database::query($sql);
8217 8217
         $row = Database::fetch_assoc($result);
8218 8218
 
@@ -8226,16 +8226,16 @@  discard block
 block discarded – undo
8226 8226
             $audio_player .= '<script>
8227 8227
                                 var s1 = new SWFObject("../inc/lib/mediaplayer/player.swf","ply","250","20","9","#FFFFFF");
8228 8228
                                 s1.addParam("allowscriptaccess","always");
8229
-                                s1.addParam("flashvars","file=../../courses/' . $_course['path'] . '/document/audio/' . $row['audio'] . '&autostart=true");
8229
+                                s1.addParam("flashvars","file=../../courses/' . $_course['path'].'/document/audio/'.$row['audio'].'&autostart=true");
8230 8230
                                 s1.write("container");
8231 8231
                             </script>';
8232 8232
         }
8233 8233
 
8234
-        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id .'&lp_id='.$this->lp_id;
8234
+        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id.'&lp_id='.$this->lp_id;
8235 8235
 
8236 8236
         $return .= Display::url(
8237 8237
             Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL),
8238
-            $url.'&action=edit_item&path_item=' . $row['path']
8238
+            $url.'&action=edit_item&path_item='.$row['path']
8239 8239
         );
8240 8240
 
8241 8241
         $return .= Display::url(
@@ -8255,12 +8255,12 @@  discard block
 block discarded – undo
8255 8255
             $url.'&action=delete_item'
8256 8256
         );
8257 8257
 
8258
-        if ($item_type == TOOL_HOTPOTATOES ) {
8258
+        if ($item_type == TOOL_HOTPOTATOES) {
8259 8259
             $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code);
8260 8260
             $return .= get_lang('File').': '.$document_data['absolute_path_from_document'];
8261 8261
         }
8262 8262
 
8263
-        if ($item_type == TOOL_DOCUMENT ) {
8263
+        if ($item_type == TOOL_DOCUMENT) {
8264 8264
             $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code);
8265 8265
             $return .= get_lang('File').': '.$document_data['absolute_path_from_document'];
8266 8266
         }
@@ -8281,13 +8281,13 @@  discard block
 block discarded – undo
8281 8281
     public function get_js_dropdown_array()
8282 8282
     {
8283 8283
         $course_id = api_get_course_int_id();
8284
-        $return = 'var child_name = new Array();' . "\n";
8285
-        $return .= 'var child_value = new Array();' . "\n\n";
8286
-        $return .= 'child_name[0] = new Array();' . "\n";
8287
-        $return .= 'child_value[0] = new Array();' . "\n\n";
8284
+        $return = 'var child_name = new Array();'."\n";
8285
+        $return .= 'var child_value = new Array();'."\n\n";
8286
+        $return .= 'child_name[0] = new Array();'."\n";
8287
+        $return .= 'child_value[0] = new Array();'."\n\n";
8288 8288
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8289
-        $sql_zero = "SELECT * FROM " . $tbl_lp_item . "
8290
-                    WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id . " AND parent_item_id = 0
8289
+        $sql_zero = "SELECT * FROM ".$tbl_lp_item."
8290
+                    WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id." AND parent_item_id = 0
8291 8291
                     ORDER BY display_order ASC";
8292 8292
         $res_zero = Database::query($sql_zero);
8293 8293
         $i = 0;
@@ -8297,28 +8297,28 @@  discard block
 block discarded – undo
8297 8297
                 $row_zero['title'] = Exercise::get_formated_title_variable($row_zero['title']);
8298 8298
             }
8299 8299
             $js_var = json_encode(get_lang('After').' '.$row_zero['title']);
8300
-            $return .= 'child_name[0][' . $i . '] = '.$js_var.' ;' . "\n";
8301
-            $return .= 'child_value[0][' . $i++ . '] = "' . $row_zero['id'] . '";' . "\n";
8300
+            $return .= 'child_name[0]['.$i.'] = '.$js_var.' ;'."\n";
8301
+            $return .= 'child_value[0]['.$i++.'] = "'.$row_zero['id'].'";'."\n";
8302 8302
         }
8303 8303
         $return .= "\n";
8304
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
8305
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
8304
+        $sql = "SELECT * FROM ".$tbl_lp_item."
8305
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
8306 8306
         $res = Database::query($sql);
8307 8307
         while ($row = Database :: fetch_array($res)) {
8308
-            $sql_parent = "SELECT * FROM " . $tbl_lp_item . "
8308
+            $sql_parent = "SELECT * FROM ".$tbl_lp_item."
8309 8309
                            WHERE
8310 8310
                                 c_id = ".$course_id." AND
8311
-                                parent_item_id = " . $row['id'] . "
8311
+                                parent_item_id = " . $row['id']."
8312 8312
                            ORDER BY display_order ASC";
8313 8313
             $res_parent = Database::query($sql_parent);
8314 8314
             $i = 0;
8315
-            $return .= 'child_name[' . $row['id'] . '] = new Array();' . "\n";
8316
-            $return .= 'child_value[' . $row['id'] . '] = new Array();' . "\n\n";
8315
+            $return .= 'child_name['.$row['id'].'] = new Array();'."\n";
8316
+            $return .= 'child_value['.$row['id'].'] = new Array();'."\n\n";
8317 8317
 
8318 8318
             while ($row_parent = Database :: fetch_array($res_parent)) {
8319 8319
                 $js_var = json_encode(get_lang('After').' '.$row_parent['title']);
8320
-                $return .= 'child_name[' . $row['id'] . '][' . $i . '] =   '.$js_var.' ;' . "\n";
8321
-                $return .= 'child_value[' . $row['id'] . '][' . $i++ . '] = "' . $row_parent['id'] . '";' . "\n";
8320
+                $return .= 'child_name['.$row['id'].']['.$i.'] =   '.$js_var.' ;'."\n";
8321
+                $return .= 'child_value['.$row['id'].']['.$i++.'] = "'.$row_parent['id'].'";'."\n";
8322 8322
             }
8323 8323
             $return .= "\n";
8324 8324
         }
@@ -8339,8 +8339,8 @@  discard block
 block discarded – undo
8339 8339
         if (is_numeric($item_id)) {
8340 8340
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8341 8341
 
8342
-            $sql = "SELECT * FROM " . $tbl_lp_item . "
8343
-                    WHERE c_id = ".$course_id." AND id = " . $item_id;
8342
+            $sql = "SELECT * FROM ".$tbl_lp_item."
8343
+                    WHERE c_id = ".$course_id." AND id = ".$item_id;
8344 8344
 
8345 8345
             $res = Database::query($sql);
8346 8346
             $row = Database :: fetch_array($res);
@@ -8399,7 +8399,7 @@  discard block
 block discarded – undo
8399 8399
      */
8400 8400
     public function display_item_small_form($item_type, $title = '', $data = array())
8401 8401
     {
8402
-        $url = api_get_self() . '?' .api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8402
+        $url = api_get_self().'?'.api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8403 8403
         $form = new FormValidator('small_form', 'post', $url);
8404 8404
         $form->addElement('header', $title);
8405 8405
         $form->addElement('text', 'title', get_lang('Title'));
@@ -8425,7 +8425,7 @@  discard block
 block discarded – undo
8425 8425
         $item_id = intval($item_id);
8426 8426
         /* Current prerequisite */
8427 8427
         $sql = "SELECT * FROM $tbl_lp_item
8428
-                WHERE c_id = $course_id AND id = " . $item_id;
8428
+                WHERE c_id = $course_id AND id = ".$item_id;
8429 8429
         $result = Database::query($sql);
8430 8430
         $row    = Database::fetch_array($result);
8431 8431
         $prerequisiteId = $row['prerequisite'];
@@ -8435,20 +8435,20 @@  discard block
 block discarded – undo
8435 8435
         $return .= '<form method="POST">';
8436 8436
         $return .= '<table class="data_table">';
8437 8437
         $return .= '<tr>';
8438
-        $return .= '<th height="24">' . get_lang('LearnpathPrerequisites') . '</th>';
8439
-        $return .= '<th width="70" >' . get_lang('Minimum') . '</th>';
8440
-        $return .= '<th width="70">' . get_lang('Maximum') . '</th>';
8438
+        $return .= '<th height="24">'.get_lang('LearnpathPrerequisites').'</th>';
8439
+        $return .= '<th width="70" >'.get_lang('Minimum').'</th>';
8440
+        $return .= '<th width="70">'.get_lang('Maximum').'</th>';
8441 8441
         $return .= '</tr>';
8442 8442
 
8443 8443
         // Adding the none option to the prerequisites see http://www.chamilo.org/es/node/146
8444 8444
         $return .= '<tr >';
8445 8445
         $return .= '<td colspan="3" class="radio">';
8446 8446
         $return .= '<input checked="checked" id="idNone" name="prerequisites"  style="margin-left:0px; margin-right:10px;" type="radio" />';
8447
-        $return .= '<label for="idNone">' . get_lang('None') . '</label>';
8447
+        $return .= '<label for="idNone">'.get_lang('None').'</label>';
8448 8448
         $return .= '</tr>';
8449 8449
 
8450 8450
         $sql = "SELECT * FROM $tbl_lp_item
8451
-                WHERE c_id = $course_id AND lp_id = " . $this->lp_id;
8451
+                WHERE c_id = $course_id AND lp_id = ".$this->lp_id;
8452 8452
         $result = Database::query($sql);
8453 8453
         $arrLP = array();
8454 8454
 
@@ -8491,24 +8491,24 @@  discard block
 block discarded – undo
8491 8491
             }
8492 8492
 
8493 8493
             $selectedMaxScoreValue = isset($selectedMaxScore[$item['id']]) ? $selectedMaxScore[$item['id']] : $item['max_score'];
8494
-            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']]: 0;
8494
+            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']] : 0;
8495 8495
 
8496 8496
             $return .= '<tr>';
8497
-            $return .= '<td class="radio"' . (($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '') . '>';
8498
-            $return .= '<label for="id' . $item['id'] . '">';
8499
-            $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'] . '" />';
8497
+            $return .= '<td class="radio"'.(($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '').'>';
8498
+            $return .= '<label for="id'.$item['id'].'">';
8499
+            $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'].'" />';
8500 8500
             $icon_name = str_replace(' ', '', $item['item_type']);
8501 8501
 
8502
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
8503
-                $return .= '<img alt="" src="../img/lp_' . $icon_name . '.png" style="margin-right:5px;" title="" />';
8502
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
8503
+                $return .= '<img alt="" src="../img/lp_'.$icon_name.'.png" style="margin-right:5px;" title="" />';
8504 8504
             } else {
8505
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
8506
-                    $return .= '<img alt="" src="../img/lp_' . $icon_name . '.gif" style="margin-right:5px;" title="" />';
8505
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
8506
+                    $return .= '<img alt="" src="../img/lp_'.$icon_name.'.gif" style="margin-right:5px;" title="" />';
8507 8507
                 } else {
8508
-                    $return .= Display::return_icon('folder_document.gif','',array('style'=>'margin-right:5px;'));
8508
+                    $return .= Display::return_icon('folder_document.gif', '', array('style'=>'margin-right:5px;'));
8509 8509
                 }
8510 8510
             }
8511
-            $return .=  $item['title'] . '</label>';
8511
+            $return .= $item['title'].'</label>';
8512 8512
             $return .= '</td>';
8513 8513
 
8514 8514
             if ($item['item_type'] == TOOL_QUIZ) {
@@ -8522,19 +8522,19 @@  discard block
 block discarded – undo
8522 8522
                 $item['max_score'] = $tmp_obj_lp_item->max_score;
8523 8523
 
8524 8524
                 $return .= '<td class="exercise">';
8525
-                $return .= '<input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue. '" />';
8525
+                $return .= '<input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" />';
8526 8526
                 $return .= '</td>';
8527 8527
                 $return .= '<td class="exercise">';
8528
-                $return .= '<input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMaxScoreValue . '" />';
8528
+                $return .= '<input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMaxScoreValue.'" />';
8529 8529
                 $return .= '</td>';
8530 8530
             }
8531 8531
 
8532 8532
             if ($item['item_type'] == TOOL_HOTPOTATOES) {
8533 8533
                 $return .= '<td class="exercise">';
8534
-                $return .= '<center><input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue . '" /></center>';
8534
+                $return .= '<center><input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" /></center>';
8535 8535
                 $return .= '</td>';
8536 8536
                 $return .= '<td class="exercise"">';
8537
-                $return .= '<center><input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue . '" /></center>';
8537
+                $return .= '<center><input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue.'" /></center>';
8538 8538
                 $return .= '</td>';
8539 8539
             }
8540 8540
             $return .= '</tr>';
@@ -8543,7 +8543,7 @@  discard block
 block discarded – undo
8543 8543
         $return .= '</tr>';
8544 8544
         $return .= '</table>';
8545 8545
         $return .= '<div style="padding-top:3px;">';
8546
-        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">' . get_lang('ModifyPrerequisites') . '</button>';
8546
+        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">'.get_lang('ModifyPrerequisites').'</button>';
8547 8547
         $return .= '</form>';
8548 8548
 
8549 8549
         return $return;
@@ -8579,7 +8579,7 @@  discard block
 block discarded – undo
8579 8579
                 if ($row['id'] == $lp_id) {
8580 8580
                     continue;
8581 8581
                 }
8582
-                $return .= '<option value="'.$row['id'].'" '.(($row['id']==$prerequisiteId)?' selected ' : '').'>'.$row['name'].'</option>';
8582
+                $return .= '<option value="'.$row['id'].'" '.(($row['id'] == $prerequisiteId) ? ' selected ' : '').'>'.$row['name'].'</option>';
8583 8583
             }
8584 8584
         }
8585 8585
         $return .= '</select>';
@@ -8632,8 +8632,8 @@  discard block
 block discarded – undo
8632 8632
                      WHERE c_id = $course_id AND active<>'-1' $condition_session
8633 8633
                      ORDER BY title ASC";
8634 8634
 
8635
-        $sql_hot  = "SELECT * FROM $tbl_doc
8636
-                     WHERE c_id = $course_id AND path LIKE '" . $uploadPath . "/%/%htm%'  $condition_session
8635
+        $sql_hot = "SELECT * FROM $tbl_doc
8636
+                     WHERE c_id = $course_id AND path LIKE '".$uploadPath."/%/%htm%'  $condition_session
8637 8637
                      ORDER BY id ASC";
8638 8638
 
8639 8639
         $res_quiz = Database::query($sql_quiz);
@@ -8643,8 +8643,8 @@  discard block
 block discarded – undo
8643 8643
 
8644 8644
         $return .= '<li class="lp_resource_element">';
8645 8645
         $return .= '<img alt="" src="../img/new_test_small.gif" style="margin-right:5px;" title="" />';
8646
-        $return .= '<a href="' . api_get_path(REL_CODE_PATH) . 'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id=' . $this->lp_id . '">' .
8647
-            get_lang('NewExercise') . '</a>';
8646
+        $return .= '<a href="'.api_get_path(REL_CODE_PATH).'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id='.$this->lp_id.'">'.
8647
+            get_lang('NewExercise').'</a>';
8648 8648
         $return .= '</li>';
8649 8649
 
8650 8650
         // Display hotpotatoes
@@ -8656,8 +8656,8 @@  discard block
 block discarded – undo
8656 8656
             $return .= '</a> ';
8657 8657
 
8658 8658
             $return .= '<img src="../img/hotpotatoes_s.png" style="margin-right:5px;" title="" width="16px" />';
8659
-            $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq().'&action=add_item&type=' . TOOL_HOTPOTATOES . '&file=' . $row_hot['id'] . '&lp_id=' . $this->lp_id . '">'.
8660
-                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])) . '</a>';
8659
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_HOTPOTATOES.'&file='.$row_hot['id'].'&lp_id='.$this->lp_id.'">'.
8660
+                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])).'</a>';
8661 8661
             $return .= '</li>';
8662 8662
         }
8663 8663
 
@@ -8667,7 +8667,7 @@  discard block
 block discarded – undo
8667 8667
             $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8668 8668
             $return .= '</a> ';
8669 8669
             $return .= '<img alt="" src="../img/quizz_small.gif" style="margin-right:5px;" title="" />';
8670
-            $return .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&action=add_item&type=' . TOOL_QUIZ . '&file=' . $row_quiz['id'] . '&lp_id=' . $this->lp_id . '">' .
8670
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_QUIZ.'&file='.$row_quiz['id'].'&lp_id='.$this->lp_id.'">'.
8671 8671
                 Security :: remove_XSS(cut($row_quiz['title'], 80)).
8672 8672
                 '</a>';
8673 8673
             $return .= '</li>';
@@ -8721,10 +8721,10 @@  discard block
 block discarded – undo
8721 8721
             function toggle_tool(tool, id){
8722 8722
                 if(document.getElementById(tool+"_"+id+"_content").style.display == "none"){
8723 8723
                     document.getElementById(tool+"_"+id+"_content").style.display = "block";
8724
-                    document.getElementById(tool+"_"+id+"_opener").src = "' . api_get_path(WEB_IMG_PATH) . 'remove.gif";
8724
+                    document.getElementById(tool+"_"+id+"_opener").src = "' . api_get_path(WEB_IMG_PATH).'remove.gif";
8725 8725
                 } else {
8726 8726
                     document.getElementById(tool+"_"+id+"_content").style.display = "none";
8727
-                    document.getElementById(tool+"_"+id+"_opener").src = "' . api_get_path(WEB_IMG_PATH) . 'add.gif";
8727
+                    document.getElementById(tool+"_"+id+"_opener").src = "' . api_get_path(WEB_IMG_PATH).'add.gif";
8728 8728
                 }
8729 8729
             }
8730 8730
         </script>
@@ -8737,7 +8737,7 @@  discard block
 block discarded – undo
8737 8737
         foreach ($categorizedLinks as $categoryId => $links) {
8738 8738
             $linkNodes = null;
8739 8739
             foreach ($links as $key => $title) {
8740
-                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2)  {
8740
+                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2) {
8741 8741
                     $linkNodes .=
8742 8742
                         '<li class="lp_resource_element" data_id="'.$key.
8743 8743
                         '" data_type="'.TOOL_LINK.'" title="'.$title.'" >
@@ -8777,7 +8777,7 @@  discard block
 block discarded – undo
8777 8777
         $return = '<div class="lp_resource" >';
8778 8778
         $return .= '<div class="lp_resource_element">';
8779 8779
         $return .= '<img align="left" alt="" src="../img/works_small.gif" style="margin-right:5px;" title="" />';
8780
-        $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=add_item&type=' . TOOL_STUDENTPUBLICATION . '&lp_id=' . $this->lp_id . '">' . get_lang('AddAssignmentPage') . '</a>';
8780
+        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_STUDENTPUBLICATION.'&lp_id='.$this->lp_id.'">'.get_lang('AddAssignmentPage').'</a>';
8781 8781
         $return .= '</div>';
8782 8782
         $return .= '</div>';
8783 8783
         return $return;
@@ -8799,17 +8799,17 @@  discard block
 block discarded – undo
8799 8799
         //First add link
8800 8800
         $return .= '<li class="lp_resource_element">';
8801 8801
         $return .= '<img alt="" src="../img/forum_new_small.gif" style="margin-right:5px;" title="" />';
8802
-        $return .= '<a href="' . api_get_path(REL_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>';
8802
+        $return .= '<a href="'.api_get_path(REL_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>';
8803 8803
         $return .= '</li>';
8804 8804
 
8805 8805
         $return .= '<script>
8806 8806
                     function toggle_forum(forum_id){
8807 8807
                         if(document.getElementById("forum_"+forum_id+"_content").style.display == "none"){
8808 8808
                             document.getElementById("forum_"+forum_id+"_content").style.display = "block";
8809
-                            document.getElementById("forum_"+forum_id+"_opener").src = "' . api_get_path(WEB_IMG_PATH) . 'remove.gif";
8809
+                            document.getElementById("forum_"+forum_id+"_opener").src = "' . api_get_path(WEB_IMG_PATH).'remove.gif";
8810 8810
                         } else {
8811 8811
                             document.getElementById("forum_"+forum_id+"_content").style.display = "none";
8812
-                            document.getElementById("forum_"+forum_id+"_opener").src = "' . api_get_path(WEB_IMG_PATH) . 'add.gif";
8812
+                            document.getElementById("forum_"+forum_id+"_opener").src = "' . api_get_path(WEB_IMG_PATH).'add.gif";
8813 8813
                         }
8814 8814
                     }
8815 8815
                 </script>';
@@ -8821,15 +8821,15 @@  discard block
 block discarded – undo
8821 8821
                 $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8822 8822
                 $return .= ' </a>';
8823 8823
                 $return .= '<img alt="" src="../img/lp_forum.gif" style="margin-right:5px;" title="" />';
8824
-                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum(' . $forum['forum_id'] . ')" style="vertical-align:middle">
8825
-                                <img src="' . api_get_path(WEB_IMG_PATH) . 'add.gif" id="forum_' . $forum['forum_id'] . '_opener" align="absbottom" />
8824
+                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum('.$forum['forum_id'].')" style="vertical-align:middle">
8825
+                                <img src="' . api_get_path(WEB_IMG_PATH).'add.gif" id="forum_'.$forum['forum_id'].'_opener" align="absbottom" />
8826 8826
                             </a>
8827
-                            <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">' .
8828
-                    Security :: remove_XSS($forum['forum_title']) . '</a>';
8827
+                            <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">'.
8828
+                    Security :: remove_XSS($forum['forum_title']).'</a>';
8829 8829
 
8830 8830
                 $return .= '</li>';
8831 8831
 
8832
-                $return .= '<div style="display:none" id="forum_' . $forum['forum_id'] . '_content">';
8832
+                $return .= '<div style="display:none" id="forum_'.$forum['forum_id'].'_content">';
8833 8833
                 $a_threads = get_threads($forum['forum_id']);
8834 8834
                 if (is_array($a_threads)) {
8835 8835
                     foreach ($a_threads as $thread) {
@@ -8838,8 +8838,8 @@  discard block
 block discarded – undo
8838 8838
                         $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8839 8839
                         $return .= ' </a>';
8840 8840
                         $return .= Display::return_icon('forumthread.png', get_lang('Thread'), array(), ICON_SIZE_TINY);
8841
-                        $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 . '">' .
8842
-                            Security :: remove_XSS($thread['thread_title']) . '</a>';
8841
+                        $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.'">'.
8842
+                            Security :: remove_XSS($thread['thread_title']).'</a>';
8843 8843
                         $return .= '</li>';
8844 8844
                     }
8845 8845
                 }
@@ -8910,7 +8910,7 @@  discard block
 block discarded – undo
8910 8910
         if (is_dir($current_course_path.'/scorm/'.$this->path) && is_file($current_course_path.'/scorm/'.$this->path.'/imsmanifest.xml')) {
8911 8911
             // Remove the possible . at the end of the path.
8912 8912
             $dest_path_to_lp = substr($this->path, -1) == '.' ? substr($this->path, 0, -1) : $this->path;
8913
-            $dest_path_to_scorm_folder = str_replace('//','/',$temp_zip_dir.'/scorm/'.$dest_path_to_lp);
8913
+            $dest_path_to_scorm_folder = str_replace('//', '/', $temp_zip_dir.'/scorm/'.$dest_path_to_lp);
8914 8914
             mkdir($dest_path_to_scorm_folder, api_get_permissions_for_new_directories(), true);
8915 8915
             $zip_files_dist = copyr($current_course_path.'/scorm/'.$this->path, $dest_path_to_scorm_folder, array('imsmanifest'), $zip_files);
8916 8916
         }
@@ -8978,7 +8978,7 @@  discard block
 block discarded – undo
8978 8978
                 if ($item->type == 'sco') {
8979 8979
                     $inc_docs = $item->get_resources_from_source(
8980 8980
                         null,
8981
-                        api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/' . 'scorm/' . $this->path . '/' . $item->get_path()
8981
+                        api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.'scorm/'.$this->path.'/'.$item->get_path()
8982 8982
                     );
8983 8983
                 } else {
8984 8984
                     $inc_docs = $item->get_resources_from_source();
@@ -9194,7 +9194,7 @@  discard block
 block discarded – undo
9194 9194
                                         $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9195 9195
                                         $zip_files[] = $my_sub_dir.'/'.$file_path;
9196 9196
                                         $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9197
-                                        $my_dep_file->setAttribute('href','document/'.$file_path);
9197
+                                        $my_dep_file->setAttribute('href', 'document/'.$file_path);
9198 9198
                                         $my_dep->setAttribute('xml:base', '');
9199 9199
                                     }
9200 9200
                                 }
@@ -9325,7 +9325,7 @@  discard block
 block discarded – undo
9325 9325
                         //$my_item->appendChild($my_max_score);
9326 9326
                         // Give a child element <adlcp:prerequisites> to the <item> element.
9327 9327
                         $my_prereqs = $xmldoc->createElement('adlcp:prerequisites', $item->get_prereq_string());
9328
-                        $my_prereqs->setAttribute('type','aicc_script');
9328
+                        $my_prereqs->setAttribute('type', 'aicc_script');
9329 9329
                         $my_item->appendChild($my_prereqs);
9330 9330
                         // Give a child element <adlcp:masteryscore> to the <item> element.
9331 9331
                         $my_masteryscore = $xmldoc->createElement('adlcp:masteryscore', $item->get_mastery_score());
@@ -9378,7 +9378,7 @@  discard block
 block discarded – undo
9378 9378
                         $my_resource->appendChild($my_file);
9379 9379
 
9380 9380
                         // Get included docs.
9381
-                        $inc_docs = $item->get_resources_from_source(null,$tmp_file_path);
9381
+                        $inc_docs = $item->get_resources_from_source(null, $tmp_file_path);
9382 9382
                         // Dependency to other files - not yet supported.
9383 9383
                         $i = 1;
9384 9384
                         foreach ($inc_docs as $doc_info) {
@@ -9439,7 +9439,7 @@  discard block
 block discarded – undo
9439 9439
                                         $my_dep_file->setAttribute('href', $file_path);
9440 9440
                                         $my_dep->setAttribute('xml:base', '');
9441 9441
 
9442
-                                        if (strstr($file_path,$main_path) !== false) {
9442
+                                        if (strstr($file_path, $main_path) !== false) {
9443 9443
                                             // The calculated real path is really inside the chamilo root path.
9444 9444
                                             // Reduce file path to what's under the DocumentRoot.
9445 9445
                                             $file_path = substr($file_path, strlen($root_path));
@@ -9457,7 +9457,7 @@  discard block
 block discarded – undo
9457 9457
                                             $file_path = $_SERVER['DOCUMENT_ROOT'].$doc_info[0];
9458 9458
                                             $file_path = str_replace('//', '/', $file_path);
9459 9459
                                             if (file_exists($file_path)) {
9460
-                                                $file_path = substr($file_path,strlen($current_dir)); // We get the relative path.
9460
+                                                $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9461 9461
                                                 $zip_files[] = $my_sub_dir.'/'.$file_path;
9462 9462
                                                 $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9463 9463
                                                 $my_dep_file->setAttribute('href', 'document/'.$file_path);
@@ -9686,7 +9686,7 @@  discard block
 block discarded – undo
9686 9686
             if (strpos($extra_file, '.') === 0)
9687 9687
                 continue;
9688 9688
             else {
9689
-                $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file;
9689
+                $dest_file = $archive_path.$temp_dir_short.'/'.$extra_file;
9690 9690
                 $this->create_path($dest_file);
9691 9691
                 copy($main_code_path.$extra_file, $dest_file);
9692 9692
             }
@@ -9739,7 +9739,7 @@  discard block
 block discarded – undo
9739 9739
                             }
9740 9740
                             $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$file_data['path'];
9741 9741
                             if (file_exists($file_path)) {
9742
-                                $files_to_export[] = array('title'=>$item->get_title(),'path'=>$file_path);
9742
+                                $files_to_export[] = array('title'=>$item->get_title(), 'path'=>$file_path);
9743 9743
                             }
9744 9744
                             break;
9745 9745
                         case 'asset': //commes from a scorm package generated by chamilo
@@ -9779,12 +9779,12 @@  discard block
 block discarded – undo
9779 9779
 
9780 9780
         foreach ($path_bits as $bit) {
9781 9781
             if (!empty ($bit)) {
9782
-                $new_path = $path_built . $bit;
9782
+                $new_path = $path_built.$bit;
9783 9783
                 if (is_dir($new_path)) {
9784
-                    $path_built = $new_path . '/';
9784
+                    $path_built = $new_path.'/';
9785 9785
                 } else {
9786 9786
                     mkdir($new_path, api_get_permissions_for_new_directories());
9787
-                    $path_built = $new_path . '/';
9787
+                    $path_built = $new_path.'/';
9788 9788
                 }
9789 9789
             }
9790 9790
         }
@@ -9828,9 +9828,9 @@  discard block
 block discarded – undo
9828 9828
 
9829 9829
         if ($upload_ok) {
9830 9830
             if ($has_attachment) {
9831
-                $courseDir = api_get_course_path() . '/upload/learning_path/images';
9831
+                $courseDir = api_get_course_path().'/upload/learning_path/images';
9832 9832
                 $sys_course_path = api_get_path(SYS_COURSE_PATH);
9833
-                $updir = $sys_course_path . $courseDir;
9833
+                $updir = $sys_course_path.$courseDir;
9834 9834
                 // Try to add an extension to the file if it hasn't one.
9835 9835
                 $new_file_name = add_ext_on_mime(stripslashes($image_array['name']), $image_array['type']);
9836 9836
 
@@ -9885,7 +9885,7 @@  discard block
 block discarded – undo
9885 9885
             //Setting my lp_id to autolaunch = 1
9886 9886
             $attributes['autolaunch'] = 1;
9887 9887
             $where = array('id = ? AND session_id = ? AND c_id = ?'=> array($lp_id, api_get_session_id(), $course_id));
9888
-            Database::update($lp_table, $attributes, $where );
9888
+            Database::update($lp_table, $attributes, $where);
9889 9889
         }
9890 9890
     }
9891 9891
 
@@ -9904,13 +9904,13 @@  discard block
 block discarded – undo
9904 9904
 
9905 9905
         // Get the max order of the items
9906 9906
         $sql_max_order = "SELECT max(display_order) AS display_order FROM $table_lp_item
9907
-    	                  WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "'";
9907
+    	                  WHERE c_id = $course_id AND lp_id = '".$this->lp_id."'";
9908 9908
         $rs_max_order = Database::query($sql_max_order);
9909 9909
         $row_max_order = Database::fetch_object($rs_max_order);
9910 9910
         $max_order = $row_max_order->display_order;
9911 9911
         // Get the previous item ID
9912 9912
         $sql = "SELECT id as previous FROM $table_lp_item
9913
-                WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "' AND display_order = '".$max_order."' ";
9913
+                WHERE c_id = $course_id AND lp_id = '".$this->lp_id."' AND display_order = '".$max_order."' ";
9914 9914
         $rs_max = Database::query($sql);
9915 9915
         $row_max = Database::fetch_object($rs_max);
9916 9916
 
@@ -9966,9 +9966,9 @@  discard block
 block discarded – undo
9966 9966
         $documents_total_space = DocumentManager::documents_total_space();
9967 9967
         $course_max_space = DocumentManager::get_course_quota();
9968 9968
         $total_size = filesize($s) + $documents_total_space;
9969
-        if (filesize($s)>$post_max || filesize($s)>$upl_max  || $total_size>$course_max_space ){
9969
+        if (filesize($s) > $post_max || filesize($s) > $upl_max || $total_size > $course_max_space) {
9970 9970
             return true;
9971
-        } else{
9971
+        } else {
9972 9972
             return false;
9973 9973
         }
9974 9974
     }
@@ -10308,7 +10308,7 @@  discard block
 block discarded – undo
10308 10308
         if ($this->debug > 0) {
10309 10309
             error_log('New LP - In learnpath::set_subscribe_users()', 0);
10310 10310
         }
10311
-        $this->subscribeUsers = intval($value);;
10311
+        $this->subscribeUsers = intval($value); ;
10312 10312
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
10313 10313
         $lp_id = $this->get_id();
10314 10314
         $sql = "UPDATE $lp_table SET subscribe_users = ".$this->subscribeUsers."
@@ -10654,7 +10654,7 @@  discard block
 block discarded – undo
10654 10654
      */
10655 10655
     public function createForum($forumCategoryId)
10656 10656
     {
10657
-        require_once api_get_path(SYS_CODE_PATH) . '/forum/forumfunction.inc.php';
10657
+        require_once api_get_path(SYS_CODE_PATH).'/forum/forumfunction.inc.php';
10658 10658
 
10659 10659
         $forumId = store_forum(
10660 10660
             [
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.
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.