Completed
Pull Request — 1.11.x (#1637)
by José
56:24 queued 29:02
created
main/exercise/export/aiken/aiken_classes.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,9 @@
 block discarded – undo
7 7
  * @package chamilo.exercise
8 8
  */
9 9
 
10
-if ( count( get_included_files() ) == 1 ) die( '---' );
10
+if ( count( get_included_files() ) == 1 ) {
11
+    die( '---' );
12
+}
11 13
 
12 14
 if (!function_exists('mime_content_type')) {
13 15
 
Please login to merge, or discard this patch.
src/Chamilo/ThemeBundle/EventListener/SidebarSetupMenuDemoListener.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,8 +48,7 @@
 block discarded – undo
48 48
         foreach($items as $item) { /** @var $item MenuItemModel */
49 49
             if($item->hasChildren()) {
50 50
                 $this->activateByRoute($route, $item->getChildren());
51
-            }
52
-            else {
51
+            } else {
53 52
                 if($item->getRoute() == $route) {
54 53
                     $item->setIsActive(true);
55 54
                 }
Please login to merge, or discard this patch.
src/Chamilo/CourseBundle/Component/CourseCopy/CourseSelectForm.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -535,8 +535,8 @@  discard block
 block discarded – undo
535 535
 						// Mark folders to import which are not selected by the user to import,
536 536
 						// but in which a document was selected.
537 537
 						$documents = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null;
538
-						if (!empty($resources) && is_array($resources))
539
-							foreach ($resources as $id => $obj) {
538
+						if (!empty($resources) && is_array($resources)) {
539
+													foreach ($resources as $id => $obj) {
540 540
 								if (isset($obj->file_type) && $obj->file_type == 'folder' &&
541 541
                                     !isset($_POST['resource'][RESOURCE_DOCUMENT][$id]) &&
542 542
                                     is_array($documents)
@@ -544,6 +544,7 @@  discard block
 block discarded – undo
544 544
 									foreach ($documents as $id_to_check => $post_value) {
545 545
 									    if (isset($resources[$id_to_check])) {
546 546
                                             $obj_to_check = $resources[$id_to_check];
547
+						}
547 548
                                             $shared_path_part = substr(
548 549
                                                 $obj_to_check->path,
549 550
                                                 0,
Please login to merge, or discard this patch.
main/exercise/exercise_submit.php 1 patch
Braces   +32 added lines, -12 removed lines patch added patch discarded remove patch
@@ -314,7 +314,9 @@  discard block
 block discarded – undo
314 314
 
315 315
 $clock_expired_time = null;
316 316
 if (empty($exercise_stat_info)) {
317
-    if ($debug) error_log('5  $exercise_stat_info is empty ');
317
+    if ($debug) {
318
+        error_log('5  $exercise_stat_info is empty ');
319
+    }
318 320
     $total_weight = 0;
319 321
     $questionList = $objExercise->get_validated_question_list();
320 322
     foreach ($questionListUncompressed as $question_id) {
@@ -325,11 +327,17 @@  discard block
 block discarded – undo
325 327
 	if ($time_control) {
326 328
 		$expected_time = $current_timestamp + $total_seconds;
327 329
 
328
-		if ($debug)  error_log('5.1. $current_timestamp '.$current_timestamp);
329
-		if ($debug)  error_log('5.2. $expected_time '.$expected_time);
330
+		if ($debug) {
331
+		    error_log('5.1. $current_timestamp '.$current_timestamp);
332
+		}
333
+		if ($debug) {
334
+		    error_log('5.2. $expected_time '.$expected_time);
335
+		}
330 336
 
331 337
 		$clock_expired_time 	= api_get_utc_datetime($expected_time);
332
-		if ($debug) error_log('5.3. $expected_time '.$clock_expired_time);
338
+		if ($debug) {
339
+		    error_log('5.3. $expected_time '.$clock_expired_time);
340
+		}
333 341
 
334 342
 		//Sessions  that contain the expired time
335 343
 		$_SESSION['expired_time'][$current_expired_time_key] 	 = $clock_expired_time;
@@ -349,8 +357,10 @@  discard block
 block discarded – undo
349 357
         $learnpath_item_id,
350 358
         $learnpath_item_view_id
351 359
     );
352
-    if ($debug)  error_log("5.5  exercise_stat_info[] exists getting exe_id $exe_id");
353
-} else {
360
+    if ($debug) {
361
+        error_log("5.5  exercise_stat_info[] exists getting exe_id $exe_id");
362
+    }
363
+    } else {
354 364
 	$exe_id = $exercise_stat_info['exe_id'];
355 365
     // Remember last question id position.
356 366
     $isFirstTime = Session::read('firstTime');
@@ -373,8 +383,10 @@  discard block
 block discarded – undo
373 383
         }
374 384
     }
375 385
 
376
-    if ($debug)  error_log("5  exercise_stat_info[] exists getting exe_id $exe_id ");
377
-}
386
+    if ($debug) {
387
+        error_log("5  exercise_stat_info[] exists getting exe_id $exe_id ");
388
+    }
389
+    }
378 390
 
379 391
 $questionListInSession = Session::read('questionList');
380 392
 
@@ -430,9 +442,15 @@  discard block
 block discarded – undo
430 442
  * If the expired time is major that zero(0) then the expired time is compute on this time.
431 443
  */
432 444
 if ($time_control) {
433
-	if ($debug) error_log('7.1. Time control is enabled');
434
-	if ($debug) error_log('7.2. $current_expired_time_key  '.$current_expired_time_key);
435
-	if ($debug) error_log('7.3. $_SESSION[expired_time][$current_expired_time_key]  '.$_SESSION['expired_time'][$current_expired_time_key]);
445
+	if ($debug) {
446
+	    error_log('7.1. Time control is enabled');
447
+	}
448
+	if ($debug) {
449
+	    error_log('7.2. $current_expired_time_key  '.$current_expired_time_key);
450
+	}
451
+	if ($debug) {
452
+	    error_log('7.3. $_SESSION[expired_time][$current_expired_time_key]  '.$_SESSION['expired_time'][$current_expired_time_key]);
453
+	}
436 454
 
437 455
     if (!isset($_SESSION['expired_time'][$current_expired_time_key])) {
438 456
         //Timer - Get expired_time for a student
@@ -514,7 +532,9 @@  discard block
 block discarded – undo
514 532
 	}
515 533
 }
516 534
 
517
-if ($debug) error_log('8. Question list loaded '.print_r($questionList, 1));
535
+if ($debug) {
536
+    error_log('8. Question list loaded '.print_r($questionList, 1));
537
+}
518 538
 
519 539
 //Real question count
520 540
 $question_count = 0;
Please login to merge, or discard this patch.
main/auth/courses_controller.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -523,7 +523,7 @@
 block discarded – undo
523 523
     ) {
524 524
         if($btnBing){
525 525
             $btnBing = 'btn-lg'; 
526
-        }else{
526
+        } else{
527 527
             $btnBing = 'btn-sm';
528 528
         }
529 529
         if ($checkRequirements) {
Please login to merge, or discard this patch.
main/lp/lp_controller.php 1 patch
Braces   +73 added lines, -29 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@  discard block
 block discarded – undo
14 14
 $use_anonymous = true;
15 15
 
16 16
 $debug = 0;
17
-if ($debug > 0) error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0);
17
+if ($debug > 0) {
18
+    error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0);
19
+}
18 20
 
19 21
 // Language files that needs to be included.
20 22
 if (isset($_GET['action'])) {
@@ -210,10 +212,14 @@  discard block
 block discarded – undo
210 212
     // If refresh is set, we regenerate the oLP object from the database (kind of flush).
211 213
     Session::erase('refresh');
212 214
     $myrefresh = 1;
213
-    if ($debug > 0) error_log('New LP - Refresh asked', 0);
214
-}
215
+    if ($debug > 0) {
216
+        error_log('New LP - Refresh asked', 0);
217
+    }
218
+    }
215 219
 
216
-if ($debug > 0) error_log('New LP - Passed refresh check', 0);
220
+if ($debug > 0) {
221
+    error_log('New LP - Passed refresh check', 0);
222
+}
217 223
 
218 224
 if (!empty($_REQUEST['dialog_box'])) {
219 225
     $dialog_box = stripslashes(urldecode($_REQUEST['dialog_box']));
@@ -223,17 +229,23 @@  discard block
 block discarded – undo
223 229
 $lp_found = false;
224 230
 
225 231
 if (isset($_SESSION['lpobject'])) {
226
-    if ($debug > 0) error_log('New LP - SESSION[lpobject] is defined', 0);
232
+    if ($debug > 0) {
233
+        error_log('New LP - SESSION[lpobject] is defined', 0);
234
+    }
227 235
     $oLP = unserialize($_SESSION['lpobject']);
228 236
     if (isset($oLP) && is_object($oLP)) {
229
-        if ($debug > 0) error_log('New LP - oLP is object', 0);
237
+        if ($debug > 0) {
238
+            error_log('New LP - oLP is object', 0);
239
+        }
230 240
         if ($myrefresh == 1 ||
231 241
             empty($oLP->cc) ||
232 242
             $oLP->cc != api_get_course_id() ||
233 243
             $oLP->lp_view_session_id != $session_id ||
234 244
             $oLP->scorm_debug == '1'
235 245
         ) {
236
-            if ($debug > 0) error_log('New LP - Course has changed, discard lp object', 0);
246
+            if ($debug > 0) {
247
+                error_log('New LP - Course has changed, discard lp object', 0);
248
+            }
237 249
             if ($myrefresh == 1) { $myrefresh_id = $oLP->get_id(); }
238 250
             $oLP = null;
239 251
             Session::erase('oLP');
@@ -247,13 +259,19 @@  discard block
 block discarded – undo
247 259
 
248 260
 $course_id = api_get_course_int_id();
249 261
 
250
-if ($debug>0) error_log('New LP - Passed data remains check', 0);
262
+if ($debug>0) {
263
+    error_log('New LP - Passed data remains check', 0);
264
+}
251 265
 
252 266
 if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $_REQUEST['lp_id'])) {
253
-    if ($debug > 0) error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0);
267
+    if ($debug > 0) {
268
+        error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0);
269
+    }
254 270
     // Regenerate a new lp object? Not always as some pages don't need the object (like upload?)
255 271
     if (!empty($_REQUEST['lp_id']) || !empty($myrefresh_id)) {
256
-        if ($debug > 0) error_log('New LP - lp_id is defined', 0);
272
+        if ($debug > 0) {
273
+            error_log('New LP - lp_id is defined', 0);
274
+        }
257 275
         // Select the lp in the database and check which type it is (scorm/dokeos/aicc) to generate the
258 276
         // right object.
259 277
         if (!empty($_REQUEST['lp_id'])) {
@@ -265,16 +283,22 @@  discard block
 block discarded – undo
265 283
         $lp_table = Database::get_course_table(TABLE_LP_MAIN);
266 284
         if (is_numeric($lp_id)) {
267 285
             $sel = "SELECT lp_type FROM $lp_table WHERE c_id = $course_id AND id = $lp_id";
268
-            if ($debug > 0) error_log('New LP - querying '.$sel, 0);
286
+            if ($debug > 0) {
287
+                error_log('New LP - querying '.$sel, 0);
288
+            }
269 289
             $res = Database::query($sel);
270 290
 
271 291
             if (Database::num_rows($res)) {
272 292
                 $row = Database::fetch_array($res);
273 293
                 $type = $row['lp_type'];
274
-                if ($debug > 0) error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
294
+                if ($debug > 0) {
295
+                    error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
296
+                }
275 297
                 switch ($type) {
276 298
                     case 1:
277
-                        if ($debug > 0) error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
299
+                        if ($debug > 0) {
300
+                            error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
301
+                        }
278 302
 
279 303
                         $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id());
280 304
                         if ($oLP !== false) {
@@ -284,7 +308,9 @@  discard block
 block discarded – undo
284 308
                         }
285 309
                         break;
286 310
                     case 2:
287
-                        if ($debug > 0) error_log('New LP - found row - type scorm - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
311
+                        if ($debug > 0) {
312
+                            error_log('New LP - found row - type scorm - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
313
+                        }
288 314
                         $oLP = new scorm(api_get_course_id(), $lp_id, api_get_user_id());
289 315
                         if ($oLP !== false) {
290 316
                             $lp_found = true;
@@ -293,7 +319,9 @@  discard block
 block discarded – undo
293 319
                         }
294 320
                         break;
295 321
                     case 3:
296
-                        if ($debug > 0) error_log('New LP - found row - type aicc - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
322
+                        if ($debug > 0) {
323
+                            error_log('New LP - found row - type aicc - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
324
+                        }
297 325
                         $oLP = new aicc(api_get_course_id(), $lp_id, api_get_user_id());
298 326
                         if ($oLP !== false) {
299 327
                             $lp_found = true;
@@ -302,7 +330,9 @@  discard block
 block discarded – undo
302 330
                         }
303 331
                         break;
304 332
                     default:
305
-                        if ($debug > 0) error_log('New LP - found row - type other - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
333
+                        if ($debug > 0) {
334
+                            error_log('New LP - found row - type other - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
335
+                        }
306 336
                         $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id());
307 337
                         if ($oLP !== false) {
308 338
                             $lp_found = true;
@@ -313,17 +343,23 @@  discard block
 block discarded – undo
313 343
                 }
314 344
             }
315 345
         } else {
316
-            if ($debug > 0) error_log('New LP - Request[lp_id] is not numeric', 0);
346
+            if ($debug > 0) {
347
+                error_log('New LP - Request[lp_id] is not numeric', 0);
348
+            }
317 349
         }
318 350
     } else {
319
-        if ($debug > 0) error_log('New LP - Request[lp_id] and refresh_id were empty', 0);
351
+        if ($debug > 0) {
352
+            error_log('New LP - Request[lp_id] and refresh_id were empty', 0);
353
+        }
320 354
     }
321 355
     if ($lp_found) {
322 356
         $_SESSION['oLP'] = $oLP;
323 357
     }
324 358
 }
325 359
 
326
-if ($debug > 0) error_log('New LP - Passed oLP creation check', 0);
360
+if ($debug > 0) {
361
+    error_log('New LP - Passed oLP creation check', 0);
362
+}
327 363
 
328 364
 $is_allowed_to_edit = api_is_allowed_to_edit(false, true, false, false);
329 365
 
@@ -614,8 +650,7 @@  discard block
 block discarded – undo
614 650
             if (!$lp_found) {
615 651
                 error_log('New LP - No learnpath given for set_autolaunch', 0);
616 652
                 require 'lp_list.php';
617
-            }
618
-            else {
653
+            } else {
619 654
                 $_SESSION['oLP']->set_autolaunch($_GET['lp_id'], $_GET['status']);
620 655
                 require 'lp_list.php';
621 656
                 exit;
@@ -1127,16 +1162,24 @@  discard block
 block discarded – undo
1127 1162
         }
1128 1163
         break;
1129 1164
     case 'content':
1130
-        if ($debug > 0) error_log('New LP - Item id is '.intval($_GET['item_id']), 0);
1165
+        if ($debug > 0) {
1166
+            error_log('New LP - Item id is '.intval($_GET['item_id']), 0);
1167
+        }
1131 1168
         if (!$lp_found) {
1132 1169
             error_log('New LP - No learnpath given for content', 0);
1133 1170
             require 'lp_list.php';
1134 1171
         } else {
1135
-            if ($debug > 0) error_log('New LP - save_last()', 0);
1172
+            if ($debug > 0) {
1173
+                error_log('New LP - save_last()', 0);
1174
+            }
1136 1175
             $_SESSION['oLP']->save_last();
1137
-            if ($debug > 0) error_log('New LP - set_current_item()', 0);
1176
+            if ($debug > 0) {
1177
+                error_log('New LP - set_current_item()', 0);
1178
+            }
1138 1179
             $_SESSION['oLP']->set_current_item($_GET['item_id']);
1139
-            if ($debug > 0) error_log('New LP - start_current_item()', 0);
1180
+            if ($debug > 0) {
1181
+                error_log('New LP - start_current_item()', 0);
1182
+            }
1140 1183
             $_SESSION['oLP']->start_current_item();
1141 1184
             require 'lp_content.php';
1142 1185
         }
@@ -1252,8 +1295,7 @@  discard block
 block discarded – undo
1252 1295
         require 'lp_message.php';
1253 1296
         break;
1254 1297
     case 'return_to_course_homepage':
1255
-        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; }
1256
-        else {
1298
+        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } else {
1257 1299
             $_SESSION['oLP']->save_current();
1258 1300
             $_SESSION['oLP']->save_last();
1259 1301
             $url = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/index.php?id_session='.api_get_session_id();
@@ -1441,8 +1483,10 @@  discard block
 block discarded – undo
1441 1483
 
1442 1484
 if (!empty($_SESSION['oLP'])) {
1443 1485
     $_SESSION['lpobject'] = serialize($_SESSION['oLP']);
1444
-    if ($debug > 0) error_log('New LP - lpobject is serialized in session', 0);
1445
-}
1486
+    if ($debug > 0) {
1487
+        error_log('New LP - lpobject is serialized in session', 0);
1488
+    }
1489
+    }
1446 1490
 
1447 1491
 if (!empty($redirectTo)) {
1448 1492
     header("Location: $redirectTo");
Please login to merge, or discard this patch.