Completed
Push — 1.10.x ( 3658ba...81c9ff )
by
unknown
91:59 queued 46:43
created
main/inc/lib/add_course.lib.inc.php 1 patch
Spacing   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 
42 42
         while (!$keys_are_unique) {
43 43
 
44
-            $keys_course_id = $prefix_for_all . $unique_prefix . $wanted_code . $final_suffix['CourseId'];
44
+            $keys_course_id = $prefix_for_all.$unique_prefix.$wanted_code.$final_suffix['CourseId'];
45 45
             //$keys_course_db_name = $prefix_for_base_name . $unique_prefix . strtoupper($keys_course_id) . $final_suffix['CourseDb'];
46
-            $keys_course_repository = $prefix_for_path . $unique_prefix . $wanted_code . $final_suffix['CourseDir'];
46
+            $keys_course_repository = $prefix_for_path.$unique_prefix.$wanted_code.$final_suffix['CourseDir'];
47 47
             $keys_are_unique = true;
48 48
 
49 49
             // Check whether they are unique.
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
 
53 53
             if (Database::num_rows($result)) {
54 54
                 $keys_are_unique = false;
55
-                $try_new_fsc_id ++;
55
+                $try_new_fsc_id++;
56 56
                 $final_suffix['CourseId'] = substr(md5(uniqid(rand())), 0, 4);
57 57
             }
58 58
             if (file_exists(api_get_path(SYS_COURSE_PATH).$keys_course_repository)) {
59 59
                 $keys_are_unique = false;
60
-                $try_new_fsc_dir ++;
60
+                $try_new_fsc_dir++;
61 61
                 $final_suffix['CourseDir'] = substr(md5(uniqid(rand())), 0, 4);
62 62
             }
63 63
 
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
         $perm = api_get_permissions_for_new_directories();
86 86
         $perm_file = api_get_permissions_for_new_files();
87 87
         $htmlpage = "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\">\n    <title>Not authorized</title>\n  </head>\n  <body>\n  </body>\n</html>";
88
-        $cp = api_get_path(SYS_COURSE_PATH) . $course_repository;
88
+        $cp = api_get_path(SYS_COURSE_PATH).$course_repository;
89 89
 
90 90
         //Creating document folder
91 91
         mkdir($cp, $perm);
92
-        mkdir($cp . '/document', $perm);
93
-        $cpt = $cp . '/document/index.html';
92
+        mkdir($cp.'/document', $perm);
93
+        $cpt = $cp.'/document/index.html';
94 94
         $fd = fopen($cpt, 'w');
95 95
         fwrite($fd, $htmlpage);
96 96
         fclose($fd);
@@ -112,49 +112,49 @@  discard block
 block discarded – undo
112 112
         @copy($cpt, $cp . '/document/video/index.html');    */
113 113
 
114 114
         //Creatind dropbox folder
115
-        mkdir($cp . '/dropbox', $perm);
116
-        $cpt = $cp . '/dropbox/index.html';
115
+        mkdir($cp.'/dropbox', $perm);
116
+        $cpt = $cp.'/dropbox/index.html';
117 117
         $fd = fopen($cpt, 'w');
118 118
         fwrite($fd, $htmlpage);
119 119
         fclose($fd);
120 120
         @chmod($cpt, $perm_file);
121
-        mkdir($cp . '/group', $perm);
122
-        @copy($cpt, $cp . '/group/index.html');
123
-        mkdir($cp . '/page', $perm);
124
-        @copy($cpt, $cp . '/page/index.html');
125
-        mkdir($cp . '/scorm', $perm);
126
-        @copy($cpt, $cp . '/scorm/index.html');
127
-        mkdir($cp . '/upload', $perm);
128
-        @copy($cpt, $cp . '/upload/index.html');
129
-        mkdir($cp . '/upload/forum', $perm);
130
-        @copy($cpt, $cp . '/upload/forum/index.html');
131
-        mkdir($cp . '/upload/forum/images', $perm);
132
-        @copy($cpt, $cp . '/upload/forum/images/index.html');
133
-        mkdir($cp . '/upload/test', $perm);
134
-        @copy($cpt, $cp . '/upload/test/index.html');
135
-        mkdir($cp . '/upload/blog', $perm);
136
-        @copy($cpt, $cp . '/upload/blog/index.html');
137
-        mkdir($cp . '/upload/learning_path', $perm);
138
-        @copy($cpt, $cp . '/upload/learning_path/index.html');
139
-        mkdir($cp . '/upload/learning_path/images', $perm);
140
-        @copy($cpt, $cp . '/upload/learning_path/images/index.html');
141
-        mkdir($cp . '/upload/calendar', $perm);
142
-        @copy($cpt, $cp . '/upload/calendar/index.html');
143
-        mkdir($cp . '/upload/calendar/images', $perm);
144
-        @copy($cpt, $cp . '/upload/calendar/images/index.html');
145
-        mkdir($cp . '/work', $perm);
146
-        @copy($cpt, $cp . '/work/index.html');
147
-        mkdir($cp . '/upload/announcements', $perm);
148
-        @copy($cpt, $cp . '/upload/announcements/index.html');
149
-        mkdir($cp . '/upload/announcements/images', $perm);
150
-        @copy($cpt, $cp . '/upload/announcements/images/index.html');
121
+        mkdir($cp.'/group', $perm);
122
+        @copy($cpt, $cp.'/group/index.html');
123
+        mkdir($cp.'/page', $perm);
124
+        @copy($cpt, $cp.'/page/index.html');
125
+        mkdir($cp.'/scorm', $perm);
126
+        @copy($cpt, $cp.'/scorm/index.html');
127
+        mkdir($cp.'/upload', $perm);
128
+        @copy($cpt, $cp.'/upload/index.html');
129
+        mkdir($cp.'/upload/forum', $perm);
130
+        @copy($cpt, $cp.'/upload/forum/index.html');
131
+        mkdir($cp.'/upload/forum/images', $perm);
132
+        @copy($cpt, $cp.'/upload/forum/images/index.html');
133
+        mkdir($cp.'/upload/test', $perm);
134
+        @copy($cpt, $cp.'/upload/test/index.html');
135
+        mkdir($cp.'/upload/blog', $perm);
136
+        @copy($cpt, $cp.'/upload/blog/index.html');
137
+        mkdir($cp.'/upload/learning_path', $perm);
138
+        @copy($cpt, $cp.'/upload/learning_path/index.html');
139
+        mkdir($cp.'/upload/learning_path/images', $perm);
140
+        @copy($cpt, $cp.'/upload/learning_path/images/index.html');
141
+        mkdir($cp.'/upload/calendar', $perm);
142
+        @copy($cpt, $cp.'/upload/calendar/index.html');
143
+        mkdir($cp.'/upload/calendar/images', $perm);
144
+        @copy($cpt, $cp.'/upload/calendar/images/index.html');
145
+        mkdir($cp.'/work', $perm);
146
+        @copy($cpt, $cp.'/work/index.html');
147
+        mkdir($cp.'/upload/announcements', $perm);
148
+        @copy($cpt, $cp.'/upload/announcements/index.html');
149
+        mkdir($cp.'/upload/announcements/images', $perm);
150
+        @copy($cpt, $cp.'/upload/announcements/images/index.html');
151 151
 
152 152
         //Oral expression question type
153
-        mkdir($cp . '/exercises', $perm);
154
-        @copy($cpt, $cp . '/exercises/index.html');
153
+        mkdir($cp.'/exercises', $perm);
154
+        @copy($cpt, $cp.'/exercises/index.html');
155 155
 
156 156
         // Create .htaccess in the dropbox directory.
157
-        $fp = fopen($cp . '/dropbox/.htaccess', 'w');
157
+        $fp = fopen($cp.'/dropbox/.htaccess', 'w');
158 158
         fwrite(
159 159
             $fp,
160 160
             "AuthName AllowLocalAccess
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
     {
298 298
         $list = self::get_course_tables();
299 299
         foreach ($list as $table) {
300
-            $sql = "DROP TABLE IF EXISTS " . DB_COURSE_PREFIX . $table;
300
+            $sql = "DROP TABLE IF EXISTS ".DB_COURSE_PREFIX.$table;
301 301
             Database::query($sql);
302 302
         }
303 303
     }
@@ -319,47 +319,47 @@  discard block
 block discarded – undo
319 319
         if ($media == 'images') {
320 320
             $code_path = api_get_path(
321 321
                     SYS_CODE_PATH
322
-                ) . 'default_course_document/images/';
322
+                ).'default_course_document/images/';
323 323
         }
324 324
         if ($media == 'audio') {
325 325
             $code_path = api_get_path(
326 326
                     SYS_CODE_PATH
327
-                ) . 'default_course_document/audio/';
327
+                ).'default_course_document/audio/';
328 328
         }
329 329
         if ($media == 'flash') {
330 330
             $code_path = api_get_path(
331 331
                     SYS_CODE_PATH
332
-                ) . 'default_course_document/flash/';
332
+                ).'default_course_document/flash/';
333 333
         }
334 334
         if ($media == 'video') {
335 335
             $code_path = api_get_path(
336 336
                     SYS_CODE_PATH
337
-                ) . 'default_course_document/video/';
337
+                ).'default_course_document/video/';
338 338
         }
339 339
         if ($media == 'certificates') {
340 340
             $code_path = api_get_path(
341 341
                     SYS_CODE_PATH
342
-                ) . 'default_course_document/certificates/';
342
+                ).'default_course_document/certificates/';
343 343
         }
344 344
         if (is_dir($path)) {
345 345
             $handle = opendir($path);
346 346
             while (false !== ($file = readdir($handle))) {
347
-                if (is_dir($path . $file) && strpos($file, '.') !== 0) {
347
+                if (is_dir($path.$file) && strpos($file, '.') !== 0) {
348 348
                     $files[]['dir'] = str_replace(
349 349
                         $code_path,
350 350
                         '',
351
-                        $path . $file . '/'
351
+                        $path.$file.'/'
352 352
                     );
353 353
                     $files = self::browse_folders(
354
-                        $path . $file . '/',
354
+                        $path.$file.'/',
355 355
                         $files,
356 356
                         $media
357 357
                     );
358
-                } elseif (is_file($path . $file) && strpos($file, '.') !== 0) {
358
+                } elseif (is_file($path.$file) && strpos($file, '.') !== 0) {
359 359
                     $files[]['file'] = str_replace(
360 360
                         $code_path,
361 361
                         '',
362
-                        $path . $file
362
+                        $path.$file
363 363
                     );
364 364
                 }
365 365
             }
@@ -471,8 +471,8 @@  discard block
 block discarded – undo
471 471
             TABLE_MAIN_GRADEBOOK_CERTIFICATE
472 472
         );
473 473
 
474
-        include_once api_get_path(SYS_CODE_PATH) . 'lang/english/trad4all.inc.php';
475
-        $file_to_include = api_get_path(SYS_CODE_PATH) . 'lang/' . $language . '/trad4all.inc.php';
474
+        include_once api_get_path(SYS_CODE_PATH).'lang/english/trad4all.inc.php';
475
+        $file_to_include = api_get_path(SYS_CODE_PATH).'lang/'.$language.'/trad4all.inc.php';
476 476
 
477 477
         if (file_exists($file_to_include)) {
478 478
             include_once $file_to_include;
@@ -486,117 +486,117 @@  discard block
 block discarded – undo
486 486
 
487 487
         Database::query(
488 488
             "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
489
-            VALUES ($course_id, 1, '" . TOOL_COURSE_DESCRIPTION . "','course_description/','info.gif','" . self::string2binary(
489
+            VALUES ($course_id, 1, '".TOOL_COURSE_DESCRIPTION."','course_description/','info.gif','".self::string2binary(
490 490
                 api_get_setting(
491 491
                     'course_create_active_tools',
492 492
                     'course_description'
493 493
                 )
494
-            ) . "','0','squaregrey.gif', 0,'_self','authoring','0')"
494
+            )."','0','squaregrey.gif', 0,'_self','authoring','0')"
495 495
         );
496 496
         Database::query(
497 497
             "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
498
-            VALUES ($course_id, 2, '" . TOOL_CALENDAR_EVENT . "','calendar/agenda.php','agenda.gif','" . self::string2binary(
498
+            VALUES ($course_id, 2, '".TOOL_CALENDAR_EVENT."','calendar/agenda.php','agenda.gif','".self::string2binary(
499 499
                 api_get_setting('course_create_active_tools', 'agenda')
500
-            ) . "','0','squaregrey.gif',0,'_self','interaction','0')"
500
+            )."','0','squaregrey.gif',0,'_self','interaction','0')"
501 501
         );
502 502
         Database::query(
503 503
             "INSERT INTO $tbl_course_homepage  (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
504
-            VALUES ($course_id, 3, '" . TOOL_DOCUMENT . "','document/document.php','folder_document.gif','" . self::string2binary(
504
+            VALUES ($course_id, 3, '".TOOL_DOCUMENT."','document/document.php','folder_document.gif','".self::string2binary(
505 505
                 api_get_setting('course_create_active_tools', 'documents')
506
-            ) . "','0','squaregrey.gif',0,'_self','authoring','0')"
506
+            )."','0','squaregrey.gif',0,'_self','authoring','0')"
507 507
         );
508 508
         Database::query(
509 509
             "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
510
-            VALUES ($course_id, 4, '" . TOOL_LEARNPATH . "','newscorm/lp_controller.php','scorms.gif','" . self::string2binary(
510
+            VALUES ($course_id, 4, '".TOOL_LEARNPATH."','newscorm/lp_controller.php','scorms.gif','".self::string2binary(
511 511
                 api_get_setting('course_create_active_tools', 'learning_path')
512
-            ) . "','0','squaregrey.gif',0,'_self','authoring','0')"
512
+            )."','0','squaregrey.gif',0,'_self','authoring','0')"
513 513
         );
514 514
         Database::query(
515 515
             "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
516
-             VALUES ($course_id, 5, '" . TOOL_LINK . "','link/link.php','links.gif','" . self::string2binary(
516
+             VALUES ($course_id, 5, '".TOOL_LINK."','link/link.php','links.gif','".self::string2binary(
517 517
                 api_get_setting('course_create_active_tools', 'links')
518
-            ) . "','0','squaregrey.gif',0,'_self','authoring','0')"
518
+            )."','0','squaregrey.gif',0,'_self','authoring','0')"
519 519
         );
520 520
         Database::query(
521 521
             "INSERT INTO $tbl_course_homepage  (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
522
-            VALUES  ($course_id, 6, '" . TOOL_QUIZ . "','exercice/exercice.php','quiz.gif','" . self::string2binary(
522
+            VALUES  ($course_id, 6, '".TOOL_QUIZ."','exercice/exercice.php','quiz.gif','".self::string2binary(
523 523
                 api_get_setting('course_create_active_tools', 'quiz')
524
-            ) . "','0','squaregrey.gif',0,'_self','authoring','0')"
524
+            )."','0','squaregrey.gif',0,'_self','authoring','0')"
525 525
         );
526 526
         Database::query(
527 527
             "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
528
-            VALUES ($course_id, 7, '" . TOOL_ANNOUNCEMENT . "','announcements/announcements.php','valves.gif','" . self::string2binary(
528
+            VALUES ($course_id, 7, '".TOOL_ANNOUNCEMENT."','announcements/announcements.php','valves.gif','".self::string2binary(
529 529
                 api_get_setting('course_create_active_tools', 'announcements')
530
-            ) . "','0','squaregrey.gif', 0,'_self','authoring','0')"
530
+            )."','0','squaregrey.gif', 0,'_self','authoring','0')"
531 531
         );
532 532
         Database::query(
533 533
             "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
534
-            VALUES ($course_id, 8, '" . TOOL_FORUM . "','forum/index.php','forum.gif','" . self::string2binary(
534
+            VALUES ($course_id, 8, '".TOOL_FORUM."','forum/index.php','forum.gif','".self::string2binary(
535 535
                 api_get_setting('course_create_active_tools', 'forums')
536
-            ) . "','0','squaregrey.gif',0,'_self','interaction','0')"
536
+            )."','0','squaregrey.gif',0,'_self','interaction','0')"
537 537
         );
538 538
         Database::query(
539 539
             "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
540
-            VALUES ($course_id, 9, '" . TOOL_DROPBOX . "','dropbox/index.php','dropbox.gif','" . self::string2binary(
540
+            VALUES ($course_id, 9, '".TOOL_DROPBOX."','dropbox/index.php','dropbox.gif','".self::string2binary(
541 541
                 api_get_setting('course_create_active_tools', 'dropbox')
542
-            ) . "','0','squaregrey.gif',0,'_self','interaction','0')"
542
+            )."','0','squaregrey.gif',0,'_self','interaction','0')"
543 543
         );
544 544
         Database::query(
545 545
             "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
546
-            VALUES ($course_id, 10, '" . TOOL_USER . "','user/user.php','members.gif','" . self::string2binary(
546
+            VALUES ($course_id, 10, '".TOOL_USER."','user/user.php','members.gif','".self::string2binary(
547 547
                 api_get_setting('course_create_active_tools', 'users')
548
-            ) . "','0','squaregrey.gif',0,'_self','interaction','0')"
548
+            )."','0','squaregrey.gif',0,'_self','interaction','0')"
549 549
         );
550 550
         Database::query(
551 551
             "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
552
-            VALUES ($course_id, 11, '" . TOOL_GROUP . "','group/group.php','group.gif','" . self::string2binary(
552
+            VALUES ($course_id, 11, '".TOOL_GROUP."','group/group.php','group.gif','".self::string2binary(
553 553
                 api_get_setting('course_create_active_tools', 'groups')
554
-            ) . "','0','squaregrey.gif',0,'_self','interaction','0')"
554
+            )."','0','squaregrey.gif',0,'_self','interaction','0')"
555 555
         );
556 556
         Database::query(
557 557
             "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
558
-            VALUES ($course_id, 12, '" . TOOL_CHAT . "','chat/chat.php','chat.gif','" . self::string2binary(
558
+            VALUES ($course_id, 12, '".TOOL_CHAT."','chat/chat.php','chat.gif','".self::string2binary(
559 559
                 api_get_setting('course_create_active_tools', 'chat')
560
-            ) . "','0','squaregrey.gif',0,'_self','interaction','0')"
560
+            )."','0','squaregrey.gif',0,'_self','interaction','0')"
561 561
         );
562 562
         Database::query(
563 563
             "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
564
-            VALUES ($course_id, 13, '" . TOOL_STUDENTPUBLICATION . "','work/work.php','works.gif','" . self::string2binary(
564
+            VALUES ($course_id, 13, '".TOOL_STUDENTPUBLICATION."','work/work.php','works.gif','".self::string2binary(
565 565
                 api_get_setting(
566 566
                     'course_create_active_tools',
567 567
                     'student_publications'
568 568
                 )
569
-            ) . "','0','squaregrey.gif',0,'_self','interaction','0')"
569
+            )."','0','squaregrey.gif',0,'_self','interaction','0')"
570 570
         );
571 571
         Database::query(
572 572
             "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
573
-            VALUES ($course_id, 14, '" . TOOL_SURVEY . "','survey/survey_list.php','survey.gif','" . self::string2binary(
573
+            VALUES ($course_id, 14, '".TOOL_SURVEY."','survey/survey_list.php','survey.gif','".self::string2binary(
574 574
                 api_get_setting('course_create_active_tools', 'survey')
575
-            ) . "','0','squaregrey.gif',0,'_self','interaction','0')"
575
+            )."','0','squaregrey.gif',0,'_self','interaction','0')"
576 576
         );
577 577
         Database::query(
578 578
             "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
579
-            VALUES ($course_id, 15, '" . TOOL_WIKI . "','wiki/index.php','wiki.gif','" . self::string2binary(
579
+            VALUES ($course_id, 15, '".TOOL_WIKI."','wiki/index.php','wiki.gif','".self::string2binary(
580 580
                 api_get_setting('course_create_active_tools', 'wiki')
581
-            ) . "','0','squaregrey.gif',0,'_self','interaction','0')"
581
+            )."','0','squaregrey.gif',0,'_self','interaction','0')"
582 582
         );
583 583
         Database::query(
584 584
             "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
585
-            VALUES ($course_id, 16, '" . TOOL_GRADEBOOK . "','gradebook/index.php','gradebook.gif','" . self::string2binary(
585
+            VALUES ($course_id, 16, '".TOOL_GRADEBOOK."','gradebook/index.php','gradebook.gif','".self::string2binary(
586 586
                 api_get_setting('course_create_active_tools', 'gradebook')
587
-            ) . "','0','squaregrey.gif',0,'_self','authoring','0')"
587
+            )."','0','squaregrey.gif',0,'_self','authoring','0')"
588 588
         );
589 589
         Database::query(
590 590
             "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
591
-            VALUES ($course_id, 17, '" . TOOL_GLOSSARY . "','glossary/index.php','glossary.gif','" . self::string2binary(
591
+            VALUES ($course_id, 17, '".TOOL_GLOSSARY."','glossary/index.php','glossary.gif','".self::string2binary(
592 592
                 api_get_setting('course_create_active_tools', 'glossary')
593
-            ) . "','0','squaregrey.gif',0,'_self','authoring','0')"
593
+            )."','0','squaregrey.gif',0,'_self','authoring','0')"
594 594
         );
595 595
         Database::query(
596 596
             "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
597
-            VALUES ($course_id, 18, '" . TOOL_NOTEBOOK . "','notebook/index.php','notebook.gif','" . self::string2binary(
597
+            VALUES ($course_id, 18, '".TOOL_NOTEBOOK."','notebook/index.php','notebook.gif','".self::string2binary(
598 598
                 api_get_setting('course_create_active_tools', 'notebook')
599
-            ) . "','0','squaregrey.gif',0,'_self','interaction','0')"
599
+            )."','0','squaregrey.gif',0,'_self','interaction','0')"
600 600
         );
601 601
 
602 602
         $setting = intval(self::string2binary(
@@ -605,13 +605,13 @@  discard block
 block discarded – undo
605 605
 
606 606
         Database::query(
607 607
             "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
608
-            VALUES ($course_id, 19, '" . TOOL_ATTENDANCE . "','attendance/index.php','attendance.gif','" . $setting. "','0','squaregrey.gif',0,'_self','authoring','0')"
608
+            VALUES ($course_id, 19, '".TOOL_ATTENDANCE."','attendance/index.php','attendance.gif','".$setting."','0','squaregrey.gif',0,'_self','authoring','0')"
609 609
         );
610 610
         Database::query(
611 611
             "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
612
-            VALUES ($course_id, 20, '" . TOOL_COURSE_PROGRESS . "','course_progress/index.php','course_progress.gif','" . self::string2binary(
612
+            VALUES ($course_id, 20, '".TOOL_COURSE_PROGRESS."','course_progress/index.php','course_progress.gif','".self::string2binary(
613 613
                 intval(api_get_setting('course_create_active_tools', 'course_progress'))
614
-            ) . "','0','squaregrey.gif',0,'_self','authoring','0')"
614
+            )."','0','squaregrey.gif',0,'_self','authoring','0')"
615 615
         );
616 616
 
617 617
         if (api_get_setting('service_visio', 'active') == 'true') {
@@ -619,11 +619,11 @@  discard block
 block discarded – undo
619 619
             if (!empty($mycheck)) {
620 620
                 Database::query(
621 621
                     "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
622
-                     VALUES ($course_id, 21, '" . TOOL_VISIO_CONFERENCE . "','conference/index.php?type=conference','visio_meeting.gif','1','0','squaregrey.gif','NO','_self','interaction','0')"
622
+                     VALUES ($course_id, 21, '".TOOL_VISIO_CONFERENCE."','conference/index.php?type=conference','visio_meeting.gif','1','0','squaregrey.gif','NO','_self','interaction','0')"
623 623
                 );
624 624
                 Database::query(
625 625
                     "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
626
-                     VALUES ($course_id, 22, '" . TOOL_VISIO_CLASSROOM . "','conference/index.php?type=classroom','visio.gif','1','0','squaregrey.gif','NO','_self','authoring','0')"
626
+                     VALUES ($course_id, 22, '".TOOL_VISIO_CLASSROOM."','conference/index.php?type=classroom','visio.gif','1','0','squaregrey.gif','NO','_self','authoring','0')"
627 627
                 );
628 628
             }
629 629
         }
@@ -631,33 +631,33 @@  discard block
 block discarded – undo
631 631
         if (api_get_setting('search_enabled') == 'true') {
632 632
             Database::query(
633 633
                 "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
634
-                VALUES ($course_id, 23, '" . TOOL_SEARCH . "','search/','info.gif','" . self::string2binary(
634
+                VALUES ($course_id, 23, '".TOOL_SEARCH."','search/','info.gif','".self::string2binary(
635 635
                     api_get_setting(
636 636
                         'course_create_active_tools',
637 637
                         'enable_search'
638 638
                     )
639
-                ) . "','0','search.gif',0,'_self','authoring','0')"
639
+                )."','0','search.gif',0,'_self','authoring','0')"
640 640
             );
641 641
         }
642 642
 
643 643
         $sql = "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
644
-                VALUES ($course_id, 24,'" . TOOL_BLOGS . "','blog/blog_admin.php','blog_admin.gif','" . intval(self::string2binary(
644
+                VALUES ($course_id, 24,'".TOOL_BLOGS."','blog/blog_admin.php','blog_admin.gif','".intval(self::string2binary(
645 645
                 api_get_setting('course_create_active_tools', 'blogs'))
646
-            ) . "','1','squaregrey.gif',0,'_self','admin','0')";
646
+            )."','1','squaregrey.gif',0,'_self','admin','0')";
647 647
         Database::query($sql);
648 648
 
649 649
         /*  Course homepage tools for course admin only  */
650 650
         Database::query(
651 651
             "INSERT INTO $tbl_course_homepage  (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
652
-            VALUES ($course_id, 25, '" . TOOL_TRACKING . "','tracking/courseLog.php','statistics.gif','$visible_for_course_admin','1','', 0,'_self','admin','0')"
652
+            VALUES ($course_id, 25, '".TOOL_TRACKING."','tracking/courseLog.php','statistics.gif','$visible_for_course_admin','1','', 0,'_self','admin','0')"
653 653
         );
654 654
         Database::query(
655 655
             "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
656
-            VALUES ($course_id, 26, '" . TOOL_COURSE_SETTING . "','course_info/infocours.php','reference.gif','$visible_for_course_admin','1','', 0,'_self','admin','0')"
656
+            VALUES ($course_id, 26, '".TOOL_COURSE_SETTING."','course_info/infocours.php','reference.gif','$visible_for_course_admin','1','', 0,'_self','admin','0')"
657 657
         );
658 658
         Database::query(
659 659
             "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
660
-            VALUES ($course_id, 27, '" . TOOL_COURSE_MAINTENANCE . "','course_info/maintenance.php','backup.gif','$visible_for_course_admin','1','',0,'_self', 'admin','0')"
660
+            VALUES ($course_id, 27, '".TOOL_COURSE_MAINTENANCE."','course_info/maintenance.php','backup.gif','$visible_for_course_admin','1','',0,'_self', 'admin','0')"
661 661
         );
662 662
 
663 663
         $defaultEmailExerciseAlert = 1;
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 
709 709
         Database::query(
710 710
             "INSERT INTO $TABLEGROUPCATEGORIES (c_id, id, title , description, max_student, self_reg_allowed, self_unreg_allowed, groups_per_user, display_order, doc_state,calendar_state, work_state ,announcements_state, forum_state, wiki_state, chat_state)
711
-             VALUES ($course_id, '2', '" . self::lang2db(get_lang('DefaultGroupCategory')) . "', '', '8', '0', '0', '0', '0', 1, 1 ,1 ,1 ,1, 1, 1);"
711
+             VALUES ($course_id, '2', '".self::lang2db(get_lang('DefaultGroupCategory'))."', '', '8', '0', '0', '0', '0', 1, 1 ,1 ,1 ,1, 1, 1);"
712 712
         );
713 713
 
714 714
         /*    Example Material  */
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
         $perm = api_get_permissions_for_new_directories();
739 739
         $perm_file = api_get_permissions_for_new_files();
740 740
 
741
-        $chat_path = $sys_course_path . $course_repository . '/document/chat_files';
741
+        $chat_path = $sys_course_path.$course_repository.'/document/chat_files';
742 742
 
743 743
         if (!is_dir($chat_path)) {
744 744
             @mkdir($chat_path, api_get_permissions_for_new_directories());
@@ -770,11 +770,11 @@  discard block
 block discarded – undo
770 770
                 'certificates',
771 771
             );
772 772
 
773
-            $default_course_path = api_get_path(SYS_CODE_PATH) . 'default_course_document/';
773
+            $default_course_path = api_get_path(SYS_CODE_PATH).'default_course_document/';
774 774
 
775 775
             $default_document_array = array();
776 776
             foreach ($folders_to_copy_from_default_course as $folder) {
777
-                $default_course_folder_path = $default_course_path . $folder . '/';
777
+                $default_course_folder_path = $default_course_path.$folder.'/';
778 778
                 $files = self::browse_folders(
779 779
                     $default_course_folder_path,
780 780
                     array(),
@@ -805,30 +805,30 @@  discard block
 block discarded – undo
805 805
                     //hack until feature #5242 is implemented
806 806
                     if ($media_type == 'images') {
807 807
                         $media_type = 'images/gallery';
808
-                        $images_folder = $sys_course_path . $course_repository . "/document/images/";
808
+                        $images_folder = $sys_course_path.$course_repository."/document/images/";
809 809
 
810 810
                         if (!is_dir($images_folder)) {
811 811
                             //Creating index.html
812 812
                             mkdir($images_folder, $perm);
813
-                            $fd = fopen($images_folder . 'index.html', 'w');
813
+                            $fd = fopen($images_folder.'index.html', 'w');
814 814
                             fwrite($fd, $htmlpage);
815
-                            @chmod($images_folder . 'index.html', $perm_file);
815
+                            @chmod($images_folder.'index.html', $perm_file);
816 816
                         }
817 817
                     }
818 818
 
819
-                    $course_documents_folder = $sys_course_path . $course_repository . "/document/$media_type/";
820
-                    $default_course_path = api_get_path(SYS_CODE_PATH) . 'default_course_document' . $path_documents;
819
+                    $course_documents_folder = $sys_course_path.$course_repository."/document/$media_type/";
820
+                    $default_course_path = api_get_path(SYS_CODE_PATH).'default_course_document'.$path_documents;
821 821
 
822 822
                     if (!is_dir($course_documents_folder)) {
823 823
                         // Creating index.html
824 824
                         mkdir($course_documents_folder, $perm);
825 825
                         $fd = fopen(
826
-                            $course_documents_folder . 'index.html',
826
+                            $course_documents_folder.'index.html',
827 827
                             'w'
828 828
                         );
829 829
                         fwrite($fd, $htmlpage);
830 830
                         @chmod(
831
-                            $course_documents_folder . 'index.html',
831
+                            $course_documents_folder.'index.html',
832 832
                             $perm_file
833 833
                         );
834 834
                     }
@@ -836,15 +836,15 @@  discard block
 block discarded – undo
836 836
                     if (is_array($array_media) && count($array_media) > 0) {
837 837
                         foreach ($array_media as $key => $value) {
838 838
                             if (isset($value['dir']) && !empty($value['dir'])) {
839
-                                if (!is_dir($course_documents_folder . $value['dir'])) {
839
+                                if (!is_dir($course_documents_folder.$value['dir'])) {
840 840
                                     //Creating folder
841 841
                                     mkdir(
842
-                                        $course_documents_folder . $value['dir'],
842
+                                        $course_documents_folder.$value['dir'],
843 843
                                         $perm
844 844
                                     );
845 845
 
846 846
                                     //Creating index.html (for light protection)
847
-                                    $index_html = $course_documents_folder . $value['dir'] . '/index.html';
847
+                                    $index_html = $course_documents_folder.$value['dir'].'/index.html';
848 848
                                     $fd = fopen($index_html, 'w');
849 849
                                     fwrite($fd, $htmlpage);
850 850
                                     @chmod($index_html, $perm_file);
@@ -866,12 +866,12 @@  discard block
 block discarded – undo
866 866
                                     }
867 867
 
868 868
                                     if ($media_type == 'images/gallery') {
869
-                                        $folder_path = 'gallery/' . $folder_path;
869
+                                        $folder_path = 'gallery/'.$folder_path;
870 870
                                     }
871 871
 
872 872
                                     Database::query(
873 873
                                         "INSERT INTO $TABLETOOLDOCUMENT (c_id, path,title,filetype,size)
874
-                                        VALUES ($course_id,'$path_documents" . $folder_path . "','" . $title . "','folder','0')"
874
+                                        VALUES ($course_id,'$path_documents".$folder_path."','".$title."','folder','0')"
875 875
                                     );
876 876
                                     $image_id = Database:: insert_id();
877 877
 
@@ -884,33 +884,33 @@  discard block
 block discarded – undo
884 884
 
885 885
                             if (isset($value['file']) && !empty($value['file'])) {
886 886
                                 if (!file_exists(
887
-                                    $course_documents_folder . $value['file']
887
+                                    $course_documents_folder.$value['file']
888 888
                                 )
889 889
                                 ) {
890 890
                                     //Copying file
891 891
                                     copy(
892
-                                        $default_course_path . $value['file'],
893
-                                        $course_documents_folder . $value['file']
892
+                                        $default_course_path.$value['file'],
893
+                                        $course_documents_folder.$value['file']
894 894
                                     );
895 895
                                     chmod(
896
-                                        $course_documents_folder . $value['file'],
896
+                                        $course_documents_folder.$value['file'],
897 897
                                         $perm_file
898 898
                                     );
899 899
                                     //echo $default_course_path.$value['file']; echo ' - '; echo $course_documents_folder.$value['file']; echo '<br />';
900 900
                                     $temp = explode('/', $value['file']);
901 901
                                     $file_size = filesize(
902
-                                        $course_documents_folder . $value['file']
902
+                                        $course_documents_folder.$value['file']
903 903
                                     );
904 904
 
905 905
                                     //hack until feature #5242 is implemented
906 906
                                     if ($media_type == 'images/gallery') {
907
-                                        $value["file"] = 'gallery/' . $value["file"];
907
+                                        $value["file"] = 'gallery/'.$value["file"];
908 908
                                     }
909 909
 
910 910
                                     //Inserting file in the DB
911 911
                                     Database::query(
912 912
                                         "INSERT INTO $TABLETOOLDOCUMENT (c_id, path,title,filetype,size)
913
-                                        VALUES ($course_id,'$path_documents" . $value["file"] . "','" . $temp[count($temp) - 1] . "','file','$file_size')"
913
+                                        VALUES ($course_id,'$path_documents".$value["file"]."','".$temp[count($temp) - 1]."','file','$file_size')"
914 914
                                     );
915 915
                                     $image_id = Database:: insert_id();
916 916
                                     if ($image_id) {
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
                                         $sql = "UPDATE $TABLETOOLDOCUMENT SET id = iid WHERE iid = $image_id";
919 919
                                         Database::query($sql);
920 920
 
921
-                                        if ($path_documents . $value['file'] == '/certificates/default.html') {
921
+                                        if ($path_documents.$value['file'] == '/certificates/default.html') {
922 922
                                             $example_cert_id = $image_id;
923 923
                                         }
924 924
                                         Database::query(
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
                     'c_id' => $course_id,
959 959
                     'url' => 'http://www.google.com',
960 960
                     'title' => 'Google',
961
-                    'description' => get_lang('Google') ,
961
+                    'description' => get_lang('Google'),
962 962
                     'category_id' => 0,
963 963
                     'on_homepage' => 0,
964 964
                     'target' => '_self',
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
                     'c_id' => $course_id,
969 969
                     'url' => 'http://www.wikipedia.org',
970 970
                     'title' => 'Wikipedia',
971
-                    'description' => get_lang('Wikipedia') ,
971
+                    'description' => get_lang('Wikipedia'),
972 972
                     'category_id' => 0,
973 973
                     'on_homepage' => 0,
974 974
                     'target' => '_self',
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
                 ]
977 977
             ];
978 978
 
979
-            foreach($links as $params) {
979
+            foreach ($links as $params) {
980 980
                 $link->save($params);
981 981
             }
982 982
 
@@ -995,8 +995,8 @@  discard block
 block discarded – undo
995 995
             /* Introduction text */
996 996
 
997 997
             $intro_text = '<p style="text-align: center;">
998
-                            <img src="' . api_get_path(REL_CODE_PATH) . 'img/mascot.png" alt="Mr. Chamilo" title="Mr. Chamilo" />
999
-                            <h2>' . self::lang2db(get_lang('IntroductionText')) . '</h2>
998
+                            <img src="' . api_get_path(REL_CODE_PATH).'img/mascot.png" alt="Mr. Chamilo" title="Mr. Chamilo" />
999
+                            <h2>' . self::lang2db(get_lang('IntroductionText')).'</h2>
1000 1000
                          </p>';
1001 1001
 
1002 1002
             $toolIntro = new Chamilo\CourseBundle\Entity\CToolIntro();
@@ -1032,9 +1032,9 @@  discard block
 block discarded – undo
1032 1032
             $html = '<table width="100%" border="0" cellpadding="0" cellspacing="0">
1033 1033
                         <tr>
1034 1034
                         <td width="220" valign="top" align="left">
1035
-                            <img src="' . api_get_path(WEB_CODE_PATH) . 'default_course_document/images/mr_chamilo/doubts.png">
1035
+                            <img src="' . api_get_path(WEB_CODE_PATH).'default_course_document/images/mr_chamilo/doubts.png">
1036 1036
                         </td>
1037
-                        <td valign="top" align="left">' . get_lang('Antique') . '</td></tr>
1037
+                        <td valign="top" align="left">' . get_lang('Antique').'</td></tr>
1038 1038
                     </table>';
1039 1039
             $exercise->type = 1;
1040 1040
             $exercise->setRandom(0);
@@ -1279,7 +1279,7 @@  discard block
 block discarded – undo
1279 1279
                 'https://'
1280 1280
             ) === false
1281 1281
         ) {
1282
-            $department_url = 'http://' . $department_url;
1282
+            $department_url = 'http://'.$department_url;
1283 1283
         }
1284 1284
         //just in case
1285 1285
         if ($department_url == 'http://') {
@@ -1290,26 +1290,26 @@  discard block
 block discarded – undo
1290 1290
         if ($ok_to_register_course) {
1291 1291
 
1292 1292
             // Here we must add 2 fields.
1293
-            $sql = "INSERT INTO " . $TABLECOURSE . " SET
1293
+            $sql = "INSERT INTO ".$TABLECOURSE." SET
1294 1294
                         code = '".Database:: escape_string($code)."',
1295 1295
                         directory = '".Database:: escape_string($directory)."',
1296 1296
                         course_language = '".Database:: escape_string($course_language)."',
1297 1297
                         title = '".Database:: escape_string($title)."',
1298 1298
                         description = '".self::lang2db(get_lang('CourseDescription'))."',
1299 1299
                         category_code = '".Database:: escape_string($category_code)."',
1300
-                        visibility      = '" . $visibility . "',
1300
+                        visibility      = '" . $visibility."',
1301 1301
                         show_score      = '1',
1302
-                        disk_quota      = '" . intval($disk_quota) . "',
1302
+                        disk_quota      = '" . intval($disk_quota)."',
1303 1303
                         creation_date   = '$time',
1304
-                        expiration_date = '" . $expiration_date . "',
1304
+                        expiration_date = '".$expiration_date."',
1305 1305
                         last_edit       = '$time',
1306 1306
                         last_visit      = NULL,
1307
-                        tutor_name = '" . Database:: escape_string($tutor_name) . "',
1308
-                        department_name = '" . Database:: escape_string($department_name) . "',
1309
-                        department_url = '" . Database:: escape_string($department_url) . "',
1310
-                        subscribe = '" . intval($subscribe) . "',
1311
-                        unsubscribe = '" . intval($unsubscribe) . "',
1312
-                        visual_code = '" . Database:: escape_string($visual_code) . "'";
1307
+                        tutor_name = '".Database:: escape_string($tutor_name)."',
1308
+                        department_name = '" . Database:: escape_string($department_name)."',
1309
+                        department_url = '" . Database:: escape_string($department_url)."',
1310
+                        subscribe = '" . intval($subscribe)."',
1311
+                        unsubscribe = '" . intval($unsubscribe)."',
1312
+                        visual_code = '" . Database:: escape_string($visual_code)."'";
1313 1313
             Database::query($sql);
1314 1314
             $course_id = Database::insert_id();
1315 1315
 
@@ -1324,12 +1324,12 @@  discard block
 block discarded – undo
1324 1324
                         $code
1325 1325
                     );
1326 1326
                     if (!empty($user_id)) {
1327
-                        $sql = "INSERT INTO " . $TABLECOURSUSER . " SET
1328
-                                c_id     = '" . $course_id . "',
1329
-                                user_id         = '" . intval($user_id) . "',
1327
+                        $sql = "INSERT INTO ".$TABLECOURSUSER." SET
1328
+                                c_id     = '" . $course_id."',
1329
+                                user_id         = '" . intval($user_id)."',
1330 1330
                                 status          = '1',
1331 1331
                                 is_tutor        = '0',
1332
-                                sort            = '" . ($i_course_sort) . "',
1332
+                                sort            = '" . ($i_course_sort)."',
1333 1333
                                 relation_type = 0,
1334 1334
                                 user_course_cat = '0'";
1335 1335
                         Database::query($sql);
@@ -1348,12 +1348,12 @@  discard block
 block discarded – undo
1348 1348
                         if (empty($key)) {
1349 1349
                             continue;
1350 1350
                         }
1351
-                        $sql = "INSERT INTO " . $TABLECOURSUSER . " SET
1352
-                            c_id     = '" . Database::escape_string($course_id) . "',
1353
-                            user_id         = '" . Database::escape_string($key) . "',
1351
+                        $sql = "INSERT INTO ".$TABLECOURSUSER." SET
1352
+                            c_id     = '" . Database::escape_string($course_id)."',
1353
+                            user_id         = '" . Database::escape_string($key)."',
1354 1354
                             status          = '1',
1355 1355
                             is_tutor        = '0',
1356
-                            sort            = '" . ($sort + 1) . "',
1356
+                            sort            = '" . ($sort + 1)."',
1357 1357
                             relation_type = 0,
1358 1358
                             user_course_cat = '0'";
1359 1359
                         Database::query($sql);
@@ -1397,18 +1397,18 @@  discard block
 block discarded – undo
1397 1397
                     $iname = api_get_setting('Institution');
1398 1398
                     $subject = get_lang(
1399 1399
                             'NewCourseCreatedIn'
1400
-                        ) . ' ' . $siteName . ' - ' . $iname;
1400
+                        ).' '.$siteName.' - '.$iname;
1401 1401
                     $message = get_lang(
1402 1402
                             'Dear'
1403
-                        ) . ' ' . $recipient_name . ",\n\n" . get_lang(
1403
+                        ).' '.$recipient_name.",\n\n".get_lang(
1404 1404
                             'MessageOfNewCourseToAdmin'
1405
-                        ) . ' ' . $siteName . ' - ' . $iname . "\n";
1406
-                    $message .= get_lang('CourseName') . ' ' . $title . "\n";
1405
+                        ).' '.$siteName.' - '.$iname."\n";
1406
+                    $message .= get_lang('CourseName').' '.$title."\n";
1407 1407
                     $message .= get_lang(
1408 1408
                             'Category'
1409
-                        ) . ' ' . $category_code . "\n";
1410
-                    $message .= get_lang('Tutor') . ' ' . $tutor_name . "\n";
1411
-                    $message .= get_lang('Language') . ' ' . $course_language;
1409
+                        ).' '.$category_code."\n";
1410
+                    $message .= get_lang('Tutor').' '.$tutor_name."\n";
1411
+                    $message .= get_lang('Language').' '.$course_language;
1412 1412
 
1413 1413
                     $userInfo = api_get_user_info($user_id);
1414 1414
 
Please login to merge, or discard this patch.
main/newscorm/lp_view_item.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 if (isset($_GET['lp_item_id'])) {
20 20
 
21 21
     // Get parameter only came from lp_view.php.
22
-    $lp_item_id  = intval($_GET['lp_item_id']);
22
+    $lp_item_id = intval($_GET['lp_item_id']);
23 23
     if (isset($_SESSION['lpobject'])) {
24 24
         $oLP = unserialize($_SESSION['lpobject']);
25 25
     }
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
57 57
 $tbl_lp_view = Database::get_course_table(TABLE_LP_VIEW);
58 58
 
59
-$isStudentView = (empty($_REQUEST['isStudentView']) ? 0 : (int)$_REQUEST['isStudentView']);
60
-$learnpath_id = (int)$_REQUEST['lp_id'];
59
+$isStudentView = (empty($_REQUEST['isStudentView']) ? 0 : (int) $_REQUEST['isStudentView']);
60
+$learnpath_id = (int) $_REQUEST['lp_id'];
61 61
 
62 62
 // Using the resource linker as a tool for adding resources to the learning path.
63 63
 if ($action == 'add' && $type == 'learnpathitem') {
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 /* SHOWING THE ADMIN TOOLS	*/
79 79
 
80 80
 if (api_is_in_gradebook()) {
81
-    $interbreadcrumb[] = array (
81
+    $interbreadcrumb[] = array(
82 82
         'url' => api_get_path(WEB_CODE_PATH).'gradebook/index.php?'.api_get_cidreq(),
83 83
         'name' => get_lang('ToolGradebook')
84 84
     );
Please login to merge, or discard this patch.
main/inc/lib/geometry.lib.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@  discard block
 block discarded – undo
13 13
  * @returns an array such as: for all i in [0..max[x][ : for all j in [0..max[y][ : array[i][j] = FALSE
14 14
  */
15 15
 function poly_init($max) {
16
-    return array_fill(0, $max["x"]-1,
17
-            array_fill(0, $max["y"]-1, FALSE));
16
+    return array_fill(0, $max["x"] - 1,
17
+            array_fill(0, $max["y"] - 1, FALSE));
18 18
 }
19 19
 
20 20
 
@@ -69,18 +69,18 @@  discard block
 block discarded – undo
69 69
     	array_push($bords[$poly[0]['y']], $poly[0]['x']);
70 70
 
71 71
     $i = 1; // we re-use $i and $old_pente bellow the loop
72
-    $old_pente=0;
73
-    for (    ;    // for each points of the polygon but the first
74
-        $i<sizeof($poly) && (!empty($poly[$i]['x']) && !empty($poly[$i]['y'])); $i++) {
72
+    $old_pente = 0;
73
+    for (;    // for each points of the polygon but the first
74
+        $i < sizeof($poly) && (!empty($poly[$i]['x']) && !empty($poly[$i]['y'])); $i++) {
75 75
 
76 76
         /* special cases */
77
-        if ($poly[$i-1]['y'] == $poly[$i]['y']) {
78
-            if ($poly[$i-1]['x'] == $poly[$i]['x'])
77
+        if ($poly[$i - 1]['y'] == $poly[$i]['y']) {
78
+            if ($poly[$i - 1]['x'] == $poly[$i]['x'])
79 79
                 continue; // twice the same point
80 80
             else {    //  infinite elevation of the edge
81 81
             	if (is_array($bords[$poly[$i]['y']]))
82
-                	array_push($bords[$poly[$i]['y']],$poly[$i]['x']);
83
-                $old_pente=0;
82
+                	array_push($bords[$poly[$i]['y']], $poly[$i]['x']);
83
+                $old_pente = 0;
84 84
                 continue;
85 85
             }
86 86
         }
@@ -93,17 +93,17 @@  discard block
 block discarded – undo
93 93
 
94 94
         /* computing the elevation of the edge going */
95 95
         //        from $poly[$i-1] to $poly[$i]
96
-        $pente = ($poly[$i-1]['x']-$poly[$i]['x'])/
97
-                 ($poly[$i-1]['y']-$poly[$i]['y']);
96
+        $pente = ($poly[$i - 1]['x'] - $poly[$i]['x']) /
97
+                 ($poly[$i - 1]['y'] - $poly[$i]['y']);
98 98
 
99 99
         // if the sign of the elevation change from the one of the
100 100
         // previous edge, the point must be added a second time inside
101 101
         // $bords
102
-        if ($i>1)
103
-            if (($old_pente<0 && $pente>0)
104
-                    || ($old_pente>0 && $pente<0)) {
102
+        if ($i > 1)
103
+            if (($old_pente < 0 && $pente > 0)
104
+                    || ($old_pente > 0 && $pente < 0)) {
105 105
 				if (is_array($bords[$poly[$i]['y']])) //avoid warning
106
-                	array_push($bords[$poly[$i]['y']],$poly[$i]['x']);
106
+                	array_push($bords[$poly[$i]['y']], $poly[$i]['x']);
107 107
 
108 108
                 if (DEBUG)
109 109
                     echo '*('.$poly[$i]['x'].
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
         	}
112 112
 
113 113
         /* detect the direction of the elevation in Y */
114
-        $dy_inc = ($poly[$i]['y']-$poly[$i-1]['y']) > 0 ? 1 : -1;
115
-        $x = $poly[$i-1]['x'];
114
+        $dy_inc = ($poly[$i]['y'] - $poly[$i - 1]['y']) > 0 ? 1 : -1;
115
+        $x = $poly[$i - 1]['x'];
116 116
 //        if (DEBUG) echo "init: ".$poly[$i-1]['y']."  dy_inc: ".$dy_inc.
117 117
 //            "   end: ".$poly[$i]['y']."   pente:".$pente;
118 118
 
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
 
122 122
         // we iterate w/ $dy in ]$poly[$i-1]['y'],$poly[$i-1]['y'][
123 123
         //    w/ $dy_inc as increment
124
-        for ($dy = $poly[$i-1]['y']+$dy_inc;
124
+        for ($dy = $poly[$i - 1]['y'] + $dy_inc;
125 125
             $dy != $poly[$i]['y'];
126 126
             $dy += $dy_inc) {
127
-            $x += $pente*$dy_inc;
127
+            $x += $pente * $dy_inc;
128 128
             array_push($bords[$dy], $x);
129 129
 //            if (DEBUG) echo '/('.$x.';'.$dy.')   ';
130 130
         }
@@ -132,47 +132,47 @@  discard block
 block discarded – undo
132 132
     }
133 133
 
134 134
     // closing the polygone (the edge between $poly[$i-1] and $poly[0])
135
-    if ($poly[$i-1]['y']!=$poly[0]['y']) {// droite--> rien à faire
135
+    if ($poly[$i - 1]['y'] != $poly[0]['y']) {// droite--> rien à faire
136 136
 
137 137
         // elevation between $poly[0]['x'] and $poly[1]['x'])
138
-        $rest = $poly[0]['y']-$poly[1]['y'];
139
-        if ($rest!=0)
140
-        	$pente1 = ($poly[0]['x']-$poly[1]['x'])/($rest);
138
+        $rest = $poly[0]['y'] - $poly[1]['y'];
139
+        if ($rest != 0)
140
+        	$pente1 = ($poly[0]['x'] - $poly[1]['x']) / ($rest);
141 141
         else
142 142
 			$pente1 = 0;
143 143
 
144 144
         // elevation between $poly[$i-1]['x'] and $poly[0]['x'])
145
-        $pente = ($poly[$i-1]['x']-$poly[0]['x'])/
146
-            ($poly[$i-1]['y']-$poly[0]['y']);
145
+        $pente = ($poly[$i - 1]['x'] - $poly[0]['x']) /
146
+            ($poly[$i - 1]['y'] - $poly[0]['y']);
147 147
 
148 148
 //        if (DEBUG) echo 'start('.$poly[$i-1]['x'].','.$poly[$i-1]['y'].
149 149
 //                ')-end('.$poly[0]['x'].','.$poly[0]['y'].
150 150
 //                ')-pente'.$pente;
151 151
 
152 152
         // doubling the first point if needed (see above)
153
-        if (($pente1<0 && $pente>0) || ($pente1>0 && $pente<0)) {
153
+        if (($pente1 < 0 && $pente > 0) || ($pente1 > 0 && $pente < 0)) {
154 154
         	if (is_array($bords[$poly[$i - 1]['y']]))
155
-            	array_push($bords[$poly[$i - 1]['y']],  round($poly[$i - 1]['x']));
155
+            	array_push($bords[$poly[$i - 1]['y']], round($poly[$i - 1]['x']));
156 156
             //if (DEBUG) echo '('.$poly[$i-1]['x'].';'.$poly[$i-1]['y'].')   ';
157 157
         }
158 158
         //  doubling the last point if neededd
159
-        if (($old_pente<0 && $pente>0) || ($old_pente>0 && $pente<0)) {
160
-        	if (is_array($bords[$poly[$i-1]['y']])) //avoid warning
161
-            	array_push($bords[$poly[$i-1]['y']], round($poly[$i-1]['x']));
159
+        if (($old_pente < 0 && $pente > 0) || ($old_pente > 0 && $pente < 0)) {
160
+        	if (is_array($bords[$poly[$i - 1]['y']])) //avoid warning
161
+            	array_push($bords[$poly[$i - 1]['y']], round($poly[$i - 1]['x']));
162 162
             //if (DEBUG) echo '*('.$poly[$i-1]['x'].';'.$poly[$i-1]['y'].')   ';
163 163
         }
164 164
 
165 165
 
166
-        $dy_inc = ($poly[0]['y']-$poly[$i-1]['y']) > 0 ? 1 : -1;
167
-        $x = $poly[$i-1]['x'];
166
+        $dy_inc = ($poly[0]['y'] - $poly[$i - 1]['y']) > 0 ? 1 : -1;
167
+        $x = $poly[$i - 1]['x'];
168 168
 //        if (DEBUG) echo "init: ".$poly[$i-1]['y']."  dy_inc: ".$dy_inc.
169 169
 //            "   end: ".$poly[0]['y'];
170 170
 
171
-        for ($dy = $poly[$i-1]['y']+$dy_inc;
171
+        for ($dy = $poly[$i - 1]['y'] + $dy_inc;
172 172
             $dy != $poly[0]['y'];
173 173
             $dy += $dy_inc)
174 174
         {
175
-            $x += $pente*$dy_inc;
175
+            $x += $pente * $dy_inc;
176 176
             array_push($bords[$dy], round($x));
177 177
 //            if (DEBUG) echo '/('.$x.';'.$dy.')   ';
178 178
         }
@@ -182,20 +182,20 @@  discard block
 block discarded – undo
182 182
     /* basic idea: we sort a column of edges.
183 183
         For each pair of point, we color the points in between */
184 184
     $n = count($bords);
185
-    for ($i = 0; $i<$n; $i++) {  // Y
185
+    for ($i = 0; $i < $n; $i++) {  // Y
186 186
         //error_log(__FILE__.' - Border Num '.$i,0);
187 187
         if (is_array($bords[$i])) {
188 188
        		sort($bords[$i]);
189 189
         }
190 190
 
191
-        for ($j = 0; $j<sizeof($bords[$i]);$j+=2) { // bords
191
+        for ($j = 0; $j < sizeof($bords[$i]); $j += 2) { // bords
192 192
             if (!isset($bords[$i][$j + 1])) {
193 193
                 break;
194 194
             }
195 195
 
196
-            for ($k = round($bords[$i][$j]); $k<=$bords[$i][$j+1];$k++) {
196
+            for ($k = round($bords[$i][$j]); $k <= $bords[$i][$j + 1]; $k++) {
197 197
                 $res[$k][$i] = true; //filling the array with trues
198
-                if ($test == 1)  {
198
+                if ($test == 1) {
199 199
                 	/*how to draw the polygon in a human way:
200 200
                 	In ubuntu : sudo apt-get install gnuplot
201 201
                 	Create an empty file with all points with the result of this echos (No commas, no point, no headers)
@@ -222,19 +222,19 @@  discard block
 block discarded – undo
222 222
  *
223 223
  * @return string     html code of the representation of the polygone image
224 224
  */
225
-function poly_dump(&$poly, $max, $format='raw') {
225
+function poly_dump(&$poly, $max, $format = 'raw') {
226 226
     if ($format == 'html') {
227 227
         $s = "<div style='font-size: 8px; line-height:3px'><pre>\n";
228 228
     }
229
-    for ($i=0; $i<$max['y']; $i++) {
230
-        for($j=0; $j<$max['x']; $j++)
231
-            if($poly[$j][$i] == TRUE)
232
-                $s .= ($format=='html'?"<b>1</b>":'1');
229
+    for ($i = 0; $i < $max['y']; $i++) {
230
+        for ($j = 0; $j < $max['x']; $j++)
231
+            if ($poly[$j][$i] == TRUE)
232
+                $s .= ($format == 'html' ? "<b>1</b>" : '1');
233 233
             else
234 234
                 $s .= "0";
235
-        $s .= ($format=='html'?"<br />\n":"\n");
235
+        $s .= ($format == 'html' ? "<br />\n" : "\n");
236 236
     }
237
-    $s .= ($format=='html'?"</pre></div>\n":"\n");
237
+    $s .= ($format == 'html' ? "</pre></div>\n" : "\n");
238 238
     return $s;
239 239
 }
240 240
 
@@ -252,8 +252,8 @@  discard block
 block discarded – undo
252 252
     $surfaceOf1 = 0;
253 253
     $surfaceOf2 = 0;
254 254
 
255
-    for ($i=0; $i<$max['x']; $i++)
256
-        for($j=0; $j<$max['y']; $j++) {
255
+    for ($i = 0; $i < $max['x']; $i++)
256
+        for ($j = 0; $j < $max['y']; $j++) {
257 257
             if (isset($poly1[$i][$j]) && ($poly1[$i][$j] == TRUE)) {
258 258
                 $surfaceOf1++;
259 259
                 if (isset($poly2[$i][$j]) && ($poly2[$i][$j] == FALSE))
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
                 $surfaceOf2++;
264 264
         }
265 265
 
266
-    return array (
266
+    return array(
267 267
         "s1" => $surfaceOf1,
268 268
         "s2" => $surfaceOf2,
269 269
         "both" => $surfaceOf1 - $onlyIn1,
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
  */
283 283
 function poly_touch(&$poly1, &$poly2, $max) {
284 284
 
285
-    for ($i=0; $i<$max['x']; $i++) {
286
-        for($j=0; $j<$max['y']; $j++) {
285
+    for ($i = 0; $i < $max['x']; $i++) {
286
+        for ($j = 0; $j < $max['y']; $j++) {
287 287
             if (isset($poly1[$i][$j]) && ($poly1[$i][$j] == true)
288 288
                 && isset($poly2[$i][$j]) && ($poly2[$i][$j] == true)) {
289 289
                     return true;
@@ -301,12 +301,12 @@  discard block
 block discarded – undo
301 301
  * @return  array   An array of points in the right format to use with the
302 302
  *                  local functions
303 303
  */
304
-function convert_coordinates($coords,$sep='|') {
304
+function convert_coordinates($coords, $sep = '|') {
305 305
     $points = array();
306
-    $pairs = explode($sep,$coords);
306
+    $pairs = explode($sep, $coords);
307 307
     foreach ($pairs as $idx => $pcoord) {
308
-        list($x,$y) = explode(';',$pcoord);
309
-        $points[] = array('x'=>$x,'y'=>$y);
308
+        list($x, $y) = explode(';', $pcoord);
309
+        $points[] = array('x'=>$x, 'y'=>$y);
310 310
     }
311 311
 	return $points;
312 312
 }
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
             $my = $coord['y'];
337 337
         }
338 338
     }
339
-    return array('x'=>$mx,'y'=>$my);
339
+    return array('x'=>$mx, 'y'=>$my);
340 340
 }
341 341
 
342 342
 /**
Please login to merge, or discard this patch.
main/exercice/exercise_submit_modal.php 1 patch
Spacing   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 	$learnpath_item_id = intval($_REQUEST['learnpath_item_id']);
53 53
 }
54 54
 
55
-$_SESSION['hotspot_coord']=array();
56
-$newquestionList= isset($_SESSION['newquestionList']) ? $_SESSION['newquestionList'] : [];
57
-$questionList 	= $_SESSION['questionList'];
55
+$_SESSION['hotspot_coord'] = array();
56
+$newquestionList = isset($_SESSION['newquestionList']) ? $_SESSION['newquestionList'] : [];
57
+$questionList = $_SESSION['questionList'];
58 58
 
59 59
 $exerciseId		= intval($_GET['exerciseId']);
60 60
 $exerciseType	= intval($_GET['exerciseType']);
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 
85 85
 $choice_value = '';
86 86
 
87
-$user_array = substr($user_array,0,-1);
87
+$user_array = substr($user_array, 0, -1);
88 88
 
89
-if (isset($_GET['choice'])){
89
+if (isset($_GET['choice'])) {
90 90
     $choice_value = intval($_GET['choice']);
91 91
 }
92 92
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 }
134 134
 
135 135
 $choice = array();
136
-$questionid= $questionList[$questionNum];
136
+$questionid = $questionList[$questionNum];
137 137
 // $choice_value => value of the user selection
138 138
 $choice[$questionid] = isset($choice_value) ? $choice_value : null;
139 139
 
@@ -150,11 +150,11 @@  discard block
 block discarded – undo
150 150
         $exerciseResult = $choice;
151 151
     } else {
152 152
         // gets the question ID from $choice. It is the key of the array
153
-        list($key)=array_keys($choice);
153
+        list($key) = array_keys($choice);
154 154
         // if the user didn't already answer this question
155
-        if(!isset($exerciseResult[$key])) {
155
+        if (!isset($exerciseResult[$key])) {
156 156
             // stores the user answer into the array
157
-            $exerciseResult[$key]=$choice[$key];
157
+            $exerciseResult[$key] = $choice[$key];
158 158
         }
159 159
     }
160 160
 }
@@ -180,26 +180,26 @@  discard block
 block discarded – undo
180 180
 
181 181
 // creates a temporary Question object
182 182
 if (in_array($questionid, $questionList)) {
183
-	$objQuestionTmp 	= Question :: read($questionid);
184
-	$questionName		=$objQuestionTmp->selectTitle();
185
-	$questionDescription=$objQuestionTmp->selectDescription();
186
-	$questionWeighting	=$objQuestionTmp->selectWeighting();
187
-	$answerType			=$objQuestionTmp->selectType();
188
-	$quesId				=$objQuestionTmp->selectId(); //added by priya saini
183
+	$objQuestionTmp = Question :: read($questionid);
184
+	$questionName = $objQuestionTmp->selectTitle();
185
+	$questionDescription = $objQuestionTmp->selectDescription();
186
+	$questionWeighting = $objQuestionTmp->selectWeighting();
187
+	$answerType = $objQuestionTmp->selectType();
188
+	$quesId = $objQuestionTmp->selectId(); //added by priya saini
189 189
 }
190 190
 
191
-$objAnswerTmp=new Answer($questionid);
192
-$nbrAnswers=$objAnswerTmp->selectNbrAnswers();
191
+$objAnswerTmp = new Answer($questionid);
192
+$nbrAnswers = $objAnswerTmp->selectNbrAnswers();
193 193
 //echo 'answe_type '.$answerType;echo '<br />';
194 194
 
195 195
 $choice = $exerciseResult[$questionid];
196
-$destination=array();
197
-$comment='';
198
-$next=1;
196
+$destination = array();
197
+$comment = '';
198
+$next = 1;
199 199
 $_SESSION['hotspot_coord'] = array();
200 200
 $_SESSION['hotspot_dest'] = array();
201 201
 
202
-$overlap_color = $missing_color = $excess_color=false;
202
+$overlap_color = $missing_color = $excess_color = false;
203 203
 $organs_at_risk_hit = 0;
204 204
 $wrong_results = false;
205 205
 $hot_spot_load = false;
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 $totalScore = 0;
209 209
 
210 210
 if (!empty($choice_value)) {
211
-	for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
211
+	for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
212 212
 		$answer            = $objAnswerTmp->selectAnswer($answerId);
213 213
 		$answerComment     = $objAnswerTmp->selectComment($answerId);
214 214
 		$answerDestination = $objAnswerTmp->selectDestination($answerId);
@@ -219,29 +219,29 @@  discard block
 block discarded – undo
219 219
 
220 220
 		//delineation
221 221
 		$delineation_cord  = $objAnswerTmp->selectHotspotCoordinates(1);
222
-		$answer_delineation_destination=$objAnswerTmp->selectDestination(1);
223
-        if ($dbg_local>0) { error_log(__LINE__.' answerId: '.$answerId.'('.$answerType.') - user delineation_cord: '.$delineation_cord.' - $answer_delineation_destination: '.$answer_delineation_destination,0);}
222
+		$answer_delineation_destination = $objAnswerTmp->selectDestination(1);
223
+        if ($dbg_local > 0) { error_log(__LINE__.' answerId: '.$answerId.'('.$answerType.') - user delineation_cord: '.$delineation_cord.' - $answer_delineation_destination: '.$answer_delineation_destination, 0); }
224 224
 
225
-		switch($answerType) {
225
+		switch ($answerType) {
226 226
 			// for unique answer
227 227
 			case UNIQUE_ANSWER :
228
-				$studentChoice = ($choice_value == $numAnswer)?1:0;
228
+				$studentChoice = ($choice_value == $numAnswer) ? 1 : 0;
229 229
 				if ($studentChoice) {
230
-					$questionScore	+=$answerWeighting;
231
-					$totalScore		+=$answerWeighting;
232
-					$newquestionList[]=$questionid;
230
+					$questionScore += $answerWeighting;
231
+					$totalScore		+= $answerWeighting;
232
+					$newquestionList[] = $questionid;
233 233
 				}
234 234
 				break;
235 235
 			case HOT_SPOT_DELINEATION :
236
-			    $studentChoice=$choice[$answerId];
236
+			    $studentChoice = $choice[$answerId];
237 237
 				if ($studentChoice) {
238
-					$newquestionList[]=$questionid;
238
+					$newquestionList[] = $questionid;
239 239
 				}
240
-				if ($answerId===1) {
241
-					$questionScore	+=$answerWeighting;
242
-					$totalScore		+=$answerWeighting;
243
-					$_SESSION['hotspot_coord'][1]	=$delineation_cord;
244
-					$_SESSION['hotspot_dest'][1]	=$answer_delineation_destination;
240
+				if ($answerId === 1) {
241
+					$questionScore += $answerWeighting;
242
+					$totalScore += $answerWeighting;
243
+					$_SESSION['hotspot_coord'][1] = $delineation_cord;
244
+					$_SESSION['hotspot_dest'][1] = $answer_delineation_destination;
245 245
 				}
246 246
 				break;
247 247
 		}
@@ -253,27 +253,27 @@  discard block
 block discarded – undo
253 253
                 $destination = $answerDestination;
254 254
                 $comment = $answerComment;
255 255
             }
256
-        } elseif($answerType == HOT_SPOT_DELINEATION) {
256
+        } elseif ($answerType == HOT_SPOT_DELINEATION) {
257 257
             if ($next) {
258
-                if ($dbg_local>0) { error_log(__LINE__.' - next',0);}
258
+                if ($dbg_local > 0) { error_log(__LINE__.' - next', 0); }
259 259
                 $hot_spot_load = true; //apparently the script is called twice
260 260
                 $user_answer = $user_array;
261
-                $_SESSION['exerciseResultCoordinates'][$questionid]=$user_answer; //needed for exercise_result.php
261
+                $_SESSION['exerciseResultCoordinates'][$questionid] = $user_answer; //needed for exercise_result.php
262 262
 
263 263
                 // we compare only the delineation not the other points
264
-                $answer_question	= $_SESSION['hotspot_coord'][1];
265
-                $answerDestination	= $_SESSION['hotspot_dest'][1];
264
+                $answer_question = $_SESSION['hotspot_coord'][1];
265
+                $answerDestination = $_SESSION['hotspot_dest'][1];
266 266
 
267
-                $poly_user 				= convert_coordinates($user_answer,'/');
268
-                $poly_answer 			= convert_coordinates($answer_question,'|');
269
-                $max_coord 				= poly_get_max($poly_user,$poly_answer);
267
+                $poly_user 				= convert_coordinates($user_answer, '/');
268
+                $poly_answer = convert_coordinates($answer_question, '|');
269
+                $max_coord 				= poly_get_max($poly_user, $poly_answer);
270 270
 
271 271
                 if (empty($_GET['hotspot'])) { //no user response
272 272
                     $overlap = -2;
273 273
                 } else {
274
-                    $poly_user_compiled 	= poly_compile($poly_user,$max_coord);
275
-                    $poly_answer_compiled 	= poly_compile($poly_answer,$max_coord);
276
-                    $poly_results 			= poly_result($poly_answer_compiled,$poly_user_compiled,$max_coord);
274
+                    $poly_user_compiled = poly_compile($poly_user, $max_coord);
275
+                    $poly_answer_compiled = poly_compile($poly_answer, $max_coord);
276
+                    $poly_results = poly_result($poly_answer_compiled, $poly_user_compiled, $max_coord);
277 277
 
278 278
                     $overlap = $poly_results['both'];
279 279
                     $poly_answer_area = $poly_results['s1'];
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
                 }
284 284
 
285 285
                 //$overlap = round(polygons_overlap($poly_answer,$poly_user)); //this is an area in pixels
286
-                if ($dbg_local>0) { error_log(__LINE__.' - Polygons results are '.print_r($poly_results,1),0);}
286
+                if ($dbg_local > 0) { error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0); }
287 287
                 if ($overlap < 1) {
288 288
                     //shortcut to avoid complicated calculations
289 289
                     $final_overlap = 0;
@@ -291,27 +291,27 @@  discard block
 block discarded – undo
291 291
                     $final_excess  = 100;
292 292
                 } else {
293 293
                     // the final overlap is the percentage of the initial polygon that is overlapped by the user's polygon
294
-                    $final_overlap = round(((float)$overlap / (float)$poly_answer_area)*100);
295
-                    if ($dbg_local>1) { error_log(__LINE__.' - Final overlap is '.$final_overlap,0);}
294
+                    $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100);
295
+                    if ($dbg_local > 1) { error_log(__LINE__.' - Final overlap is '.$final_overlap, 0); }
296 296
                     // the final missing area is the percentage of the initial polygon that is not overlapped by the user's polygon
297 297
                     $final_missing = 100 - $final_overlap;
298
-                    if ($dbg_local>1) { error_log(__LINE__.' - Final missing is '.$final_missing,0);}
298
+                    if ($dbg_local > 1) { error_log(__LINE__.' - Final missing is '.$final_missing, 0); }
299 299
                     // the final excess area is the percentage of the initial polygon's size that is covered by the user's polygon outside of the initial polygon
300
-                    $final_excess = round((((float)$poly_user_area-(float)$overlap)/(float)$poly_answer_area)*100);
301
-                    if ($dbg_local>1) { error_log(__LINE__.' - Final excess is '.$final_excess,0);}
300
+                    $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100);
301
+                    if ($dbg_local > 1) { error_log(__LINE__.' - Final excess is '.$final_excess, 0); }
302 302
                 }
303 303
 
304
-                $destination_items= explode('@@', $answerDestination);
304
+                $destination_items = explode('@@', $answerDestination);
305 305
                 $threadhold_total = $destination_items[0];
306
-                $threadhold_items=explode(';',$threadhold_total);
306
+                $threadhold_items = explode(';', $threadhold_total);
307 307
                 $threadhold1 = $threadhold_items[0]; // overlap
308 308
                 $threadhold2 = $threadhold_items[1]; // excess
309
-                $threadhold3 = $threadhold_items[2];	 //missing
309
+                $threadhold3 = $threadhold_items[2]; //missing
310 310
 
311 311
                 // echo $final_overlap.'  '.$threadhold1 .' - '. $final_missing.' '. $threadhold2 .' - '. $final_excess.'  '. $threadhold3;
312 312
 
313 313
                 // if is delineation
314
-                if ($answerId===1) {
314
+                if ($answerId === 1) {
315 315
                     //setting colors
316 316
                     if ($final_overlap >= $threadhold1) {
317 317
                         $overlap_color = true; //echo 'a';
@@ -327,40 +327,40 @@  discard block
 block discarded – undo
327 327
 
328 328
                     // if pass
329 329
                     //if ($final_overlap>=$threadhold1 && $final_missing<=$threadhold2 && $final_excess<=$threadhold3) {
330
-                    if ($final_overlap>=$threadhold1 && $final_missing<=$threadhold3 && $final_excess<=$threadhold2) {
331
-                        $next=1; //go to the oars
332
-                        $result_comment=get_lang('Acceptable');
330
+                    if ($final_overlap >= $threadhold1 && $final_missing <= $threadhold3 && $final_excess <= $threadhold2) {
331
+                        $next = 1; //go to the oars
332
+                        $result_comment = get_lang('Acceptable');
333 333
                     } else {
334
-                        $next=1; //Go to the oars. If $next =  0 we will show this message: "One (or more) area at risk has been hit" instead of the table resume with the results
334
+                        $next = 1; //Go to the oars. If $next =  0 we will show this message: "One (or more) area at risk has been hit" instead of the table resume with the results
335 335
                         $wrong_results = true;
336
-                        $result_comment=get_lang('Unacceptable');
337
-                        $special_comment = $comment=$answerDestination=$objAnswerTmp->selectComment(1);
338
-                        $answerDestination=$objAnswerTmp->selectDestination(1);
339
-                        $destination_items= explode('@@', $answerDestination);
340
-                        $try_hotspot=$destination_items[1];
341
-                        $lp_hotspot=$destination_items[2];
342
-                        $select_question_hotspot=$destination_items[3];
343
-                        $url_hotspot=$destination_items[4];
336
+                        $result_comment = get_lang('Unacceptable');
337
+                        $special_comment = $comment = $answerDestination = $objAnswerTmp->selectComment(1);
338
+                        $answerDestination = $objAnswerTmp->selectDestination(1);
339
+                        $destination_items = explode('@@', $answerDestination);
340
+                        $try_hotspot = $destination_items[1];
341
+                        $lp_hotspot = $destination_items[2];
342
+                        $select_question_hotspot = $destination_items[3];
343
+                        $url_hotspot = $destination_items[4];
344 344
                          //echo 'show the feedback';
345 345
                     }
346
-                } elseif($answerId>1) {
346
+                } elseif ($answerId > 1) {
347 347
                     if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') {
348
-                        if ($dbg_local>0) { error_log(__LINE__.' - answerId is of type noerror',0);}
348
+                        if ($dbg_local > 0) { error_log(__LINE__.' - answerId is of type noerror', 0); }
349 349
                         //type no error shouldn't be treated
350 350
                         $next = 1;
351 351
                         continue;
352 352
                     }
353
-                    if ($dbg_local>0) { error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR',0);}
353
+                    if ($dbg_local > 0) { error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0); }
354 354
                     //check the intersection between the oar and the user
355 355
                     //echo 'user';	print_r($x_user_list);		print_r($y_user_list);
356 356
                     //echo 'official';print_r($x_list);print_r($y_list);
357 357
                     //$result = get_intersection_data($x_list,$y_list,$x_user_list,$y_user_list);
358 358
 
359 359
                     //$delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId);
360
-                    $delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId); //getting the oars coordinates
360
+                    $delineation_cord = $objAnswerTmp->selectHotspotCoordinates($answerId); //getting the oars coordinates
361 361
 
362
-                    $poly_answer 			= convert_coordinates($delineation_cord,'|');
363
-                    $max_coord 				= poly_get_max($poly_user,$poly_answer); //getting max coordinates
362
+                    $poly_answer = convert_coordinates($delineation_cord, '|');
363
+                    $max_coord = poly_get_max($poly_user, $poly_answer); //getting max coordinates
364 364
                     $test = false;
365 365
                     // if ($answerId == 2 ){$test = true;} for test oars
366 366
 
@@ -368,9 +368,9 @@  discard block
 block discarded – undo
368 368
                         $overlap = false;
369 369
                     } else {
370 370
                         //	poly_compile really works tested with gnuplot
371
-                        $poly_user_compiled	  	= poly_compile($poly_user,$max_coord,$test);//$poly_user is already set when answerid = 1
372
-                        $poly_answer_compiled 	= poly_compile($poly_answer,$max_coord,$test);
373
-                        $overlap 			  	= poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord);
371
+                        $poly_user_compiled	  	= poly_compile($poly_user, $max_coord, $test); //$poly_user is already set when answerid = 1
372
+                        $poly_answer_compiled 	= poly_compile($poly_answer, $max_coord, $test);
373
+                        $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord);
374 374
                     }
375 375
 
376 376
                     if ($overlap == false) {
@@ -378,42 +378,42 @@  discard block
 block discarded – undo
378 378
                         $next = 1;
379 379
                         continue;
380 380
                     } else {
381
-                        if ($dbg_local>0) { error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit',0);}
381
+                        if ($dbg_local > 0) { error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0); }
382 382
 
383 383
                         $organs_at_risk_hit++;
384 384
                         //show the feedback
385
-                        $next=1;
386
-                        $comment=$answerDestination=$objAnswerTmp->selectComment($answerId);
387
-                        $answerDestination=$objAnswerTmp->selectDestination($answerId);
388
-                        $destination_items= explode('@@', $answerDestination);
389
-                        $try_hotspot=$destination_items[1];
390
-                        $lp_hotspot=$destination_items[2];
391
-                        $select_question_hotspot=$destination_items[3];
392
-                        $url_hotspot=$destination_items[4];
385
+                        $next = 1;
386
+                        $comment = $answerDestination = $objAnswerTmp->selectComment($answerId);
387
+                        $answerDestination = $objAnswerTmp->selectDestination($answerId);
388
+                        $destination_items = explode('@@', $answerDestination);
389
+                        $try_hotspot = $destination_items[1];
390
+                        $lp_hotspot = $destination_items[2];
391
+                        $select_question_hotspot = $destination_items[3];
392
+                        $url_hotspot = $destination_items[4];
393 393
                     }
394 394
                 }
395 395
             } else {
396 396
                 // the first delineation feedback
397
-                if ($dbg_local>0) { error_log(__LINE__.' first',0);}
397
+                if ($dbg_local > 0) { error_log(__LINE__.' first', 0); }
398 398
                 //we send the error
399 399
             }
400 400
         }
401 401
 	}
402 402
 
403 403
 	if ($overlap_color) {
404
-		$overlap_color='green';
404
+		$overlap_color = 'green';
405 405
     } else {
406
-		$overlap_color='red';
406
+		$overlap_color = 'red';
407 407
     }
408 408
 	if ($missing_color) {
409
-		$missing_color='green';
409
+		$missing_color = 'green';
410 410
     } else {
411
-		$missing_color='red';
411
+		$missing_color = 'red';
412 412
     }
413 413
 	if ($excess_color) {
414
-		$excess_color='green';
414
+		$excess_color = 'green';
415 415
     } else {
416
-		$excess_color='red';
416
+		$excess_color = 'red';
417 417
     }
418 418
 
419 419
     if (!is_numeric($final_overlap)) {
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
     	$final_excess = 0;
428 428
     }
429 429
 
430
-    if ($final_excess>100) {
430
+    if ($final_excess > 100) {
431 431
     	$final_excess = 100;
432 432
     }
433 433
 
@@ -442,26 +442,26 @@  discard block
 block discarded – undo
442 442
 	<tr class="row_even">
443 443
 		<td><b>'.get_lang('Overlap').'</b></td>
444 444
 		<td>'.get_lang('Min').' '.$threadhold1.'</td>
445
-		<td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0)?0:intval($final_overlap)).'</div></td>
445
+		<td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td>
446 446
 	</tr>
447 447
 
448 448
 	<tr>
449 449
 		<td><b>'.get_lang('Excess').'</b></td>
450 450
 		<td>'.get_lang('Max').' '.$threadhold2.'</td>
451
-		<td><div style="color:'.$excess_color.'">'.(($final_excess < 0)?0:intval($final_excess)).'</div></td>
451
+		<td><div style="color:'.$excess_color.'">'.(($final_excess < 0) ? 0 : intval($final_excess)).'</div></td>
452 452
 	</tr>
453 453
 
454 454
 	<tr class="row_even">
455 455
 		<td><b>'.get_lang('Missing').'</b></td>
456 456
 		<td>'.get_lang('Max').' '.$threadhold3.'</td>
457
-		<td><div style="color:'.$missing_color.'">'.(($final_missing < 0)?0:intval($final_missing)).'</div></td>
457
+		<td><div style="color:'.$missing_color.'">'.(($final_missing < 0) ? 0 : intval($final_missing)).'</div></td>
458 458
 	</tr>
459 459
 	</table>';
460 460
 	//var_dump($final_overlap, $threadhold1 , $final_missing, $threadhold2 , $final_excess, $threadhold3);
461 461
 }
462 462
 $_SESSION['newquestionList'] = $newquestionList;
463 463
 
464
-$links='';
464
+$links = '';
465 465
 
466 466
 if (isset($choice_value) && $choice_value == -1) {
467 467
     if ($answerType != HOT_SPOT_DELINEATION) {
@@ -473,32 +473,32 @@  discard block
 block discarded – undo
473 473
 
474 474
 if ($answerType != HOT_SPOT_DELINEATION) {
475 475
     if (!empty($destination)) {
476
-        $item_list = explode('@@',$destination);
476
+        $item_list = explode('@@', $destination);
477 477
     	//print_R($item_list);
478 478
     	$try = $item_list[0];
479 479
     	$lp = $item_list[1];
480
-    	$destinationid= $item_list[2];
481
-    	$url=$item_list[3];
480
+    	$destinationid = $item_list[2];
481
+    	$url = $item_list[3];
482 482
     }
483
-	$table_resume='';
483
+	$table_resume = '';
484 484
 } else {
485 485
 		$try = $try_hotspot;
486 486
 		$lp = $lp_hotspot;
487
-		$destinationid= $select_question_hotspot;
488
-		$url=$url_hotspot;
489
-	if ($organs_at_risk_hit==0 && $wrong_results==false ) {
487
+		$destinationid = $select_question_hotspot;
488
+		$url = $url_hotspot;
489
+	if ($organs_at_risk_hit == 0 && $wrong_results == false) {
490 490
 		// no error = no oar and no wrong result for delineation
491 491
 		//show if no error
492 492
 		//echo 'no error';
493
-		$comment= $answerComment = $objAnswerTmp->selectComment($nbrAnswers);
494
-		$answerDestination		 = $objAnswerTmp->selectDestination($nbrAnswers);
493
+		$comment = $answerComment = $objAnswerTmp->selectComment($nbrAnswers);
494
+		$answerDestination = $objAnswerTmp->selectDestination($nbrAnswers);
495 495
 
496 496
 		//we send the error
497
-		$destination_items= explode('@@', $answerDestination);
498
-		$try=$destination_items[1];
499
-		$lp=$destination_items[2];
500
-		$destinationid=$destination_items[3];
501
-		$url=$destination_items[4];
497
+		$destination_items = explode('@@', $answerDestination);
498
+		$try = $destination_items[1];
499
+		$lp = $destination_items[2];
500
+		$destinationid = $destination_items[3];
501
+		$url = $destination_items[4];
502 502
 		$exerciseResult[$questionid] = 1;
503 503
 	} else {
504 504
 		$exerciseResult[$questionid] = 0;
@@ -506,35 +506,35 @@  discard block
 block discarded – undo
506 506
 }
507 507
 
508 508
 // the link to retry the question
509
-if (isset($try) && $try==1) {
510
-	$num_value_array= (array_keys($questionList, $questionid));
511
-	$links.= Display :: return_icon('reload.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />';
509
+if (isset($try) && $try == 1) {
510
+	$num_value_array = (array_keys($questionList, $questionid));
511
+	$links .= Display :: return_icon('reload.gif', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />';
512 512
 }
513 513
 
514 514
 // the link to theory (a learning path)
515 515
 if (!empty($lp)) {
516
-	$lp_url= api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp;
516
+	$lp_url = api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp;
517 517
 	$list = new LearnpathList(api_get_user_id());
518 518
 	$flat_list = $list->get_flat_list();
519
-	$links.= Display :: return_icon('theory.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />';
519
+	$links .= Display :: return_icon('theory.gif', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />';
520 520
 }
521
-$links.='<br />';
521
+$links .= '<br />';
522 522
 
523 523
 // the link to an external website or link
524 524
 if (!empty($url)) {
525
-	$links.= Display :: return_icon('link.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />';
525
+	$links .= Display :: return_icon('link.gif', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />';
526 526
 }
527 527
 
528 528
 // the link to finish the test
529
-if ($destinationid==-1) {
530
-	$links.= Display :: return_icon('finish.gif', '', array ('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />';
529
+if ($destinationid == -1) {
530
+	$links .= Display :: return_icon('finish.gif', '', array('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />';
531 531
 } else {
532 532
 	// the link to other question
533
-	if (in_array($destinationid,$questionList)) {
533
+	if (in_array($destinationid, $questionList)) {
534 534
 		$objQuestionTmp = Question :: read($destinationid);
535
-		$questionName=$objQuestionTmp->selectTitle();
536
-		$num_value_array= (array_keys($questionList, $destinationid));
537
-		$links.= Display :: return_icon('quiz.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />';
535
+		$questionName = $objQuestionTmp->selectTitle();
536
+		$num_value_array = (array_keys($questionList, $destinationid));
537
+		$links .= Display :: return_icon('quiz.gif', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />';
538 538
 	}
539 539
 }
540 540
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 }
552 552
 </script>';
553 553
 
554
-if ($links!='') {
554
+if ($links != '') {
555 555
 	/*echo '<div id="ModalContent" style="padding-bottom:30px;padding-top:10px;padding-left:20px;padding-right:20px;">
556 556
     <a onclick="self.parent.tb_remove();" href="#" style="float:right; margin-top:-10px;">'.api_ucfirst(get_lang('Close')).'</a>';*/
557 557
 	echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>';
@@ -560,15 +560,15 @@  discard block
 block discarded – undo
560 560
 		if ($organs_at_risk_hit > 0) {
561 561
 			//$message='<p>'.get_lang('YourDelineation').'</p>';
562 562
 			//$message.=$table_resume;
563
-			$message.='<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />';
563
+			$message .= '<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />';
564 564
 			//if ($wrong_results) { }
565
-			$message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>';
566
-			$message.='<p>'.$comment.'</p>';
565
+			$message .= '<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>';
566
+			$message .= '<p>'.$comment.'</p>';
567 567
 		} else {
568
-			$message='<p>'.get_lang('YourDelineation').'</p>';
569
-			$message.=$table_resume;
570
-			$message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
571
-			$message.='<p>'.$comment.'</p>';
568
+			$message = '<p>'.get_lang('YourDelineation').'</p>';
569
+			$message .= $table_resume;
570
+			$message .= '<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
571
+			$message .= '<p>'.$comment.'</p>';
572 572
 		}
573 573
 		echo $message;
574 574
 	} else {
@@ -577,10 +577,10 @@  discard block
 block discarded – undo
577 577
 	echo '<h3>'.$links.'</h3>';
578 578
 	echo '</div>';
579 579
 
580
-	$_SESSION['hot_spot_result']=$message;
580
+	$_SESSION['hot_spot_result'] = $message;
581 581
 	$_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]);
582 582
 	//reseting the exerciseResult variable
583
-	Session::write('exerciseResult',$exerciseResult);
583
+	Session::write('exerciseResult', $exerciseResult);
584 584
 
585 585
 	//save this variables just in case the exercise loads an LP with other exercise
586 586
 	$_SESSION['objExerciseExtra'.$exerciseId] 	 = $_SESSION['objExercise'];
Please login to merge, or discard this patch.
main/tracking/courseLog.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
                             get_lang('HideColumn'),
113 113
                             array('align' => 'absmiddle', 'hspace' => '3px'),
114 114
                             ICON_SIZE_SMALL
115
-                         ) . "</div>'
115
+                         )."</div>'
116 116
                     );
117 117
                 }
118 118
             );
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 $TABLETRACK_LINKS       = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LINKS);
148 148
 $TABLETRACK_DOWNLOADS   = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
149 149
 $TABLETRACK_ACCESS_2    = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
150
-$TABLETRACK_EXERCISES 	= Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
150
+$TABLETRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
151 151
 $TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
152 152
 $TABLECOURSE = Database::get_main_table(TABLE_MAIN_COURSE);
153 153
 $table_user = Database::get_main_table(TABLE_MAIN_USER);
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 
158 158
 // Breadcrumbs.
159 159
 if (isset($_GET['origin']) && $_GET['origin'] == 'resume_session') {
160
-    $interbreadcrumb[] = array('url' => '../admin/index.php','name' => get_lang('PlatformAdmin'));
161
-    $interbreadcrumb[] = array('url' => '../session/session_list.php','name' => get_lang('SessionList'));
160
+    $interbreadcrumb[] = array('url' => '../admin/index.php', 'name' => get_lang('PlatformAdmin'));
161
+    $interbreadcrumb[] = array('url' => '../session/session_list.php', 'name' => get_lang('SessionList'));
162 162
     $interbreadcrumb[] = array('url' => '../session/resume_session.php?id_session='.$sessionId, 'name' => get_lang('SessionOverview'));
163 163
 }
164 164
 
@@ -229,21 +229,21 @@  discard block
 block discarded – undo
229 229
 if (!empty($sessionId)) {
230 230
     $actionsLeft .= Display::url(
231 231
         Display::return_icon('attendance_list.png', get_lang('Logins'), '', ICON_SIZE_MEDIUM),
232
-        api_get_path(WEB_CODE_PATH) . 'attendance/index.php?' . api_get_cidreq() . '&action=calendar_logins'
232
+        api_get_path(WEB_CODE_PATH).'attendance/index.php?'.api_get_cidreq().'&action=calendar_logins'
233 233
     );
234 234
 }
235 235
 
236 236
 $actionsRight = '<div class="pull-right">';
237 237
 $actionsRight .= '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
238
-    Display::return_icon('printer.png', get_lang('Print'),'',ICON_SIZE_MEDIUM).'</a>';
238
+    Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
239 239
 
240 240
 $addional_param = '';
241 241
 if (isset($_GET['additional_profile_field'])) {
242
-    $addional_param ='additional_profile_field='.intval($_GET['additional_profile_field']);
242
+    $addional_param = 'additional_profile_field='.intval($_GET['additional_profile_field']);
243 243
 }
244 244
 $users_tracking_per_page = '';
245 245
 if (isset($_GET['users_tracking_per_page'])) {
246
-    $users_tracking_per_page= '&users_tracking_per_page='.intval($_GET['users_tracking_per_page']);
246
+    $users_tracking_per_page = '&users_tracking_per_page='.intval($_GET['users_tracking_per_page']);
247 247
 }
248 248
 $actionsRight .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&export=csv&'.$addional_param.$users_tracking_per_page.'">
249 249
      '.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
@@ -264,13 +264,13 @@  discard block
 block discarded – undo
264 264
 $form_search->addButtonSearch(get_lang('SearchUsers'));
265 265
 
266 266
 
267
-echo Display::toolbarAction('toolbar-courselog', array( 0 => $actionsLeft, 1 => $form_search->returnForm(), 2 => $actionsRight ), 3);
267
+echo Display::toolbarAction('toolbar-courselog', array(0 => $actionsLeft, 1 => $form_search->returnForm(), 2 => $actionsRight), 3);
268 268
 
269 269
 $course_name = get_lang('Course').' '.$courseInfo['name'];
270 270
 
271 271
 if ($session_id) {
272 272
     $titleSession = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.api_get_session_name($session_id);
273
-    $titleCourse =  Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$course_name;
273
+    $titleCourse = Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$course_name;
274 274
 
275 275
 } else {
276 276
     $titleSession = Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$courseInfo['name'];
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
     $html .= '<ul class="session-list">';
313 313
     foreach ($sessionList as $session) {
314 314
         $url = api_get_path(WEB_CODE_PATH).'mySpace/course.php?session_id='.$session['id'].'&cidReq='.$courseInfo['code'];
315
-        $html .= Display::tag('li', $iconCourse . ' ' . Display::url($session['name'], $url));
315
+        $html .= Display::tag('li', $iconCourse.' '.Display::url($session['name'], $url));
316 316
     }
317 317
     $html .= '</ul>';
318 318
 }
@@ -327,12 +327,12 @@  discard block
 block discarded – undo
327 327
     $form = new FormValidator(
328 328
         'reminder_form',
329 329
         'get',
330
-        api_get_path(WEB_CODE_PATH).'announcements/announcements.php?' . api_get_cidreq(),
330
+        api_get_path(WEB_CODE_PATH).'announcements/announcements.php?'.api_get_cidreq(),
331 331
         null,
332 332
         ['style' => 'margin-bottom: 10px'],
333 333
         FormValidator::LAYOUT_INLINE
334 334
     );
335
-    $options = array (
335
+    $options = array(
336 336
         2 => sprintf($getLangXDays, 2),
337 337
         3 => sprintf($getLangXDays, 3),
338 338
         4 => sprintf($getLangXDays, 4),
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
     );
346 346
     $el = $form->addSelect(
347 347
         'since',
348
-        Display::returnFontAwesomeIcon('warning') . get_lang('RemindInactivesLearnersSince'),
348
+        Display::returnFontAwesomeIcon('warning').get_lang('RemindInactivesLearnersSince'),
349 349
         $options,
350 350
         ['class' => 'col-sm-3']
351 351
     );
Please login to merge, or discard this patch.
main/admin/careers.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -83,9 +83,9 @@
 block discarded – undo
83 83
 
84 84
 //With this function we can add actions to the jgrid (edit, delete, etc)
85 85
 $action_links = 'function action_formatter(cellvalue, options, rowObject) {
86
-    return \'<a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'.
87
-    '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;"  href="?sec_token='.$token.'&action=copy&id=\'+options.rowId+\'">'.Display::return_icon('copy.png',get_lang('Copy'),'',ICON_SIZE_SMALL).'</a>'.
88
-    '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;"  href="?sec_token='.$token.'&action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'.
86
+    return \'<a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'.
87
+    '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."\'".')) return false;"  href="?sec_token='.$token.'&action=copy&id=\'+options.rowId+\'">'.Display::return_icon('copy.png', get_lang('Copy'), '', ICON_SIZE_SMALL).'</a>'.
88
+    '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."\'".')) return false;"  href="?sec_token='.$token.'&action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'.
89 89
     '\';
90 90
 }';
91 91
 ?>
Please login to merge, or discard this patch.
main/admin/access_urls.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     exit;
20 20
 }
21 21
 
22
-$interbreadcrumb[] = array ("url" => 'index.php', 'name' => get_lang('PlatformAdmin'));
22
+$interbreadcrumb[] = array("url" => 'index.php', 'name' => get_lang('PlatformAdmin'));
23 23
 $tool_name = get_lang('MultipleAccessURLs');
24 24
 Display :: display_header($tool_name);
25 25
 
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
         case 'register':
56 56
             // we are going to register the admin
57 57
             if (api_is_platform_admin()) {
58
-                if ($current_access_url_id!=-1) {
58
+                if ($current_access_url_id != -1) {
59 59
                     $url_str = '';
60 60
                     foreach ($url_list as $my_url) {
61 61
                         if (!in_array($my_url['id'], $my_user_url_list)) {
62 62
                             UrlManager::add_user_to_url(api_get_user_id(), $my_url['id']);
63
-                            $url_str.=$my_url['url'].' <br />';
63
+                            $url_str .= $my_url['url'].' <br />';
64 64
                         }
65 65
                     }
66 66
                     Display:: display_normal_message(
@@ -84,16 +84,16 @@  discard block
 block discarded – undo
84 84
         $url_string .= $my_url['url'].' <br />';
85 85
     }
86 86
 }
87
-if(!empty($url_string)) {
88
-	Display :: display_warning_message(get_lang('AdminShouldBeRegisterInSite').'<br />'.$url_string,false);
87
+if (!empty($url_string)) {
88
+	Display :: display_warning_message(get_lang('AdminShouldBeRegisterInSite').'<br />'.$url_string, false);
89 89
 }
90 90
 
91 91
 // checking the current installation
92
-if ($current_access_url_id==-1) {
92
+if ($current_access_url_id == -1) {
93 93
 	Display::display_warning_message(get_lang('URLNotConfiguredPleaseChangedTo').': '.api_get_path(WEB_PATH));
94
-} elseif(api_is_platform_admin()) {
95
-    $quant= UrlManager::relation_url_user_exist(api_get_user_id(),$current_access_url_id);
96
-    if ($quant==0) {
94
+} elseif (api_is_platform_admin()) {
95
+    $quant = UrlManager::relation_url_user_exist(api_get_user_id(), $current_access_url_id);
96
+    if ($quant == 0) {
97 97
         Display:: display_warning_message(
98 98
             '<a href="'.api_get_self().'?action=register&sec_token='.$parameters['sec_token'].'">'.get_lang('ClickToRegisterAdmin').'</a>',
99 99
             false
@@ -142,16 +142,16 @@  discard block
 block discarded – undo
142 142
 
143 143
     //Status
144 144
     $active = $row['active'];
145
-    if ($active=='1') {
146
-        $action='lock';
147
-        $image='right';
145
+    if ($active == '1') {
146
+        $action = 'lock';
147
+        $image = 'right';
148 148
     }
149
-    if ($active=='0') {
150
-        $action='unlock';
151
-        $image='wrong';
149
+    if ($active == '0') {
150
+        $action = 'unlock';
151
+        $image = 'wrong';
152 152
     }
153 153
     // you cannot lock the default
154
-    if ($row['id']=='1') {
154
+    if ($row['id'] == '1') {
155 155
         $status = Display::return_icon($image.'.gif', get_lang(ucfirst($action)));
156 156
     } else {
157 157
         $status = '<a href="access_urls.php?action='.$action.'&amp;url_id='.$row['id'].'">'.
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
     $url_id = $row['id'];
162 162
     $actions = Display::url(Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), "access_url_edit.php?url_id=$url_id");
163 163
     if ($url_id != '1') {
164
-        $actions .= '<a href="access_urls.php?action=delete_url&amp;url_id='.$url_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.
164
+        $actions .= '<a href="access_urls.php?action=delete_url&amp;url_id='.$url_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset))."'".')) return false;">'.
165 165
             Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
166 166
     }
167 167
     $urls[] = array($url, $description, $status, $actions);
Please login to merge, or discard this patch.
main/admin/user_import.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
             // We are sure that the extra field exists.
216 216
             foreach ($extra_fields as $extras) {
217 217
                 if (isset($user[$extras[1]])) {
218
-                    $key 	= $extras[1];
219
-                    $value 	= $user[$extras[1]];
218
+                    $key = $extras[1];
219
+                    $value = $user[$extras[1]];
220 220
                     UserManager::update_extra_field_value($user_id, $key, $value);
221 221
                 }
222 222
             }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
     global $current_tag;
253 253
     switch ($data) {
254 254
         case 'Contact':
255
-            $user = array ();
255
+            $user = array();
256 256
             break;
257 257
         default:
258 258
             $current_tag = $data;
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
     $allowed_file_mimetype = array('csv', 'xml');
346 346
     $error_kind_file = false;
347 347
 
348
-    $checkUniqueEmail = isset($_POST['check_unique_email']) ? $_POST['check_unique_email'] :null;
348
+    $checkUniqueEmail = isset($_POST['check_unique_email']) ? $_POST['check_unique_email'] : null;
349 349
 
350 350
     $uploadInfo = pathinfo($_FILES['import_file']['name']);
351 351
     $ext_import_file = $uploadInfo['extension'];
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
         if (strcmp($file_type, 'csv') === 0 &&
355 355
             $ext_import_file == $allowed_file_mimetype[0]
356 356
         ) {
357
-            $users	= parse_csv_data($_FILES['import_file']['tmp_name']);
357
+            $users = parse_csv_data($_FILES['import_file']['tmp_name']);
358 358
             $errors = validate_data($users, $checkUniqueEmail);
359 359
             $error_kind_file = false;
360 360
         } elseif (strcmp($file_type, 'xml') === 0 && $ext_import_file == $allowed_file_mimetype[1]) {
Please login to merge, or discard this patch.
main/course_progress/index.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 // current section
18 18
 $this_section = SECTION_COURSES;
19 19
 
20
-$current_course_tool  = TOOL_COURSE_PROGRESS;
20
+$current_course_tool = TOOL_COURSE_PROGRESS;
21 21
 
22 22
 // protect a course script
23 23
 api_protect_course_script(true);
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
     'thematic_advance_delete'
50 50
 );
51 51
 
52
-$action  = 'thematic_details';
53
-if (isset($_GET['action']) && in_array($_GET['action'],$actions)) {
52
+$action = 'thematic_details';
53
+if (isset($_GET['action']) && in_array($_GET['action'], $actions)) {
54 54
     $action = $_GET['action'];
55 55
 }
56 56
 
@@ -187,21 +187,21 @@  discard block
 block discarded – undo
187 187
 $thematicControl = Session::read('thematic_control');
188 188
 
189 189
 if ($action == 'thematic_list') {
190
-    $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl'));
190
+    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('ThematicControl'));
191 191
 }
192 192
 if ($action == 'thematic_add') {
193
-    $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl'));
194
-    $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewThematicSection'));
193
+    $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl'));
194
+    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewThematicSection'));
195 195
 }
196 196
 if ($action == 'thematic_edit') {
197
-    $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl'));
198
-    $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('EditThematicSection'));
197
+    $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl'));
198
+    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('EditThematicSection'));
199 199
 }
200 200
 if ($action == 'thematic_details') {
201
-    $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl'));
201
+    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('ThematicControl'));
202 202
 }
203 203
 if ($action == 'thematic_plan_list' || $action == 'thematic_plan_delete') {
204
-    $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl'));
204
+    $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl'));
205 205
     if (!empty($thematic_data)) {
206 206
         $interbreadcrumb[] = array(
207 207
             'url' => '#',
@@ -210,22 +210,22 @@  discard block
 block discarded – undo
210 210
     }
211 211
 }
212 212
 if ($action == 'thematic_plan_add' || $action == 'thematic_plan_edit') {
213
-    $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl'));
214
-    $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic_id, 'name' => get_lang('ThematicPlan').' ('.$thematic_data['title'].')');
213
+    $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl'));
214
+    $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic_id, 'name' => get_lang('ThematicPlan').' ('.$thematic_data['title'].')');
215 215
     if ($description_type >= ADD_THEMATIC_PLAN) {
216
-        $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewBloc'));
216
+        $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewBloc'));
217 217
     } else {
218
-        $interbreadcrumb[] = array ('url' => '#', 'name' => $default_thematic_plan_title[$description_type]);
218
+        $interbreadcrumb[] = array('url' => '#', 'name' => $default_thematic_plan_title[$description_type]);
219 219
     }
220 220
 }
221 221
 if ($action == 'thematic_advance_list' || $action == 'thematic_advance_delete') {
222
-    $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl'));
223
-    $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicAdvance').' ('.$thematic_data['title'].')');
222
+    $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl'));
223
+    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('ThematicAdvance').' ('.$thematic_data['title'].')');
224 224
 }
225 225
 if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') {
226
-    $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl'));
227
-    $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic_id, 'name' => get_lang('ThematicAdvance').' ('.$thematic_data['title'].')');
228
-    $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewThematicAdvance'));
226
+    $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl'));
227
+    $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic_id, 'name' => get_lang('ThematicAdvance').' ('.$thematic_data['title'].')');
228
+    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewThematicAdvance'));
229 229
 }
230 230
 
231 231
 // Distpacher actions to controller
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
     case 'thematic_import':
240 240
     case 'moveup':
241 241
     case 'movedown':
242
-        if (!api_is_allowed_to_edit(null,true)) {
242
+        if (!api_is_allowed_to_edit(null, true)) {
243 243
             api_not_allowed();
244 244
         }
245 245
     case 'thematic_list':
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
     case 'thematic_plan_add':
252 252
     case 'thematic_plan_edit':
253 253
     case 'thematic_plan_delete':
254
-        if (!api_is_allowed_to_edit(null,true)) {
254
+        if (!api_is_allowed_to_edit(null, true)) {
255 255
             api_not_allowed();
256 256
         }
257 257
     case 'thematic_plan_list':
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
     case 'thematic_advance_add':
261 261
     case 'thematic_advance_edit':
262 262
     case 'thematic_advance_delete':
263
-        if (!api_is_allowed_to_edit(null,true)) {
263
+        if (!api_is_allowed_to_edit(null, true)) {
264 264
             api_not_allowed();
265 265
         }
266 266
     case 'thematic_advance_list':
Please login to merge, or discard this patch.