فهرست منبع

Applied fixes from FlintCI

Julio Montoya 7 سال پیش
والد
کامیت
7f6a146fd3
100فایلهای تغییر یافته به همراه2055 افزوده شده و 1884 حذف شده
  1. 0 0
      .php_cs.cache
  2. 4 4
      certificates/index.php
  3. 5 6
      cli-config.php
  4. 2 3
      contrat.php
  5. 10 9
      custompages/first_login-dist.php
  6. 3 2
      custompages/index-logged-dist.php
  7. 16 14
      custompages/index-unlogged-dist.php
  8. 7 5
      custompages/language.inc.php
  9. 9 9
      custompages/language.php
  10. 6 6
      custompages/loggedout-dist.php
  11. 3 3
      custompages/lostpassword-dist.php
  12. 9 9
      custompages/registration-dist.php
  13. 4 3
      custompages/registration-feedback-dist.php
  14. 1 0
      index.php
  15. 63 71
      load_search.php
  16. 25 15
      main/admin/access_url_add_courses_to_url.php
  17. 23 13
      main/admin/access_url_add_usergroup_to_url.php
  18. 20 14
      main/admin/access_url_add_users_to_url.php
  19. 6 6
      main/admin/access_url_check_user_session.php
  20. 6 5
      main/admin/access_url_edit.php
  21. 42 28
      main/admin/access_url_edit_course_category_to_url.php
  22. 18 17
      main/admin/access_url_edit_courses_to_url.php
  23. 42 28
      main/admin/access_url_edit_usergroup_to_url.php
  24. 32 25
      main/admin/access_url_edit_users_to_url.php
  25. 14 13
      main/admin/access_urls.php
  26. 36 31
      main/admin/add_courses_to_usergroup.php
  27. 3 3
      main/admin/add_drh_to_user.php
  28. 30 27
      main/admin/add_sessions_to_promotion.php
  29. 37 32
      main/admin/add_sessions_to_usergroup.php
  30. 63 57
      main/admin/add_users_to_usergroup.php
  31. 2 2
      main/admin/archive_cleanup.php
  32. 25 25
      main/admin/career_dashboard.php
  33. 9 12
      main/admin/career_diagram.php
  34. 19 21
      main/admin/careers.php
  35. 7 6
      main/admin/cli.php
  36. 140 139
      main/admin/configure_extensions.php
  37. 43 45
      main/admin/configure_homepage.php
  38. 28 28
      main/admin/configure_inscription.php
  39. 13 13
      main/admin/configure_plugin.php
  40. 21 22
      main/admin/course_add.php
  41. 5 6
      main/admin/course_category.php
  42. 21 22
      main/admin/course_edit.php
  43. 6 6
      main/admin/course_export.php
  44. 19 12
      main/admin/course_import.php
  45. 19 16
      main/admin/course_information.php
  46. 13 9
      main/admin/course_intro_pdf_import.php
  47. 48 44
      main/admin/course_list.php
  48. 11 11
      main/admin/course_request_accepted.php
  49. 9 8
      main/admin/course_request_edit.php
  50. 15 15
      main/admin/course_request_rejected.php
  51. 16 16
      main/admin/course_request_review.php
  52. 21 18
      main/admin/course_user_import.php
  53. 19 15
      main/admin/course_user_import_by_email.php
  54. 21 16
      main/admin/dashboard_add_courses_to_user.php
  55. 23 14
      main/admin/dashboard_add_sessions_to_user.php
  56. 40 34
      main/admin/dashboard_add_users_to_user.php
  57. 3 2
      main/admin/email_tester.php
  58. 15 13
      main/admin/event_controller.php
  59. 31 28
      main/admin/event_type.php
  60. 2 3
      main/admin/export_certificates.php
  61. 9 13
      main/admin/extra_field_geo.php
  62. 2 2
      main/admin/extra_field_list.php
  63. 32 33
      main/admin/extra_field_options.php
  64. 47 49
      main/admin/extra_field_workflow.php
  65. 16 17
      main/admin/extra_fields.php
  66. 3 3
      main/admin/filler.php
  67. 25 26
      main/admin/grade_models.php
  68. 4 6
      main/admin/gradebook_dependency.php
  69. 8 9
      main/admin/gradebook_list.php
  70. 163 163
      main/admin/index.php
  71. 27 26
      main/admin/languages.php
  72. 36 31
      main/admin/ldap_form_add_users_group.php
  73. 7 6
      main/admin/ldap_import_students.php
  74. 9 10
      main/admin/ldap_import_students_to_session.php
  75. 10 12
      main/admin/ldap_users_list.php
  76. 10 10
      main/admin/ldap_users_synchro.php
  77. 13 15
      main/admin/legal_add.php
  78. 5 5
      main/admin/legal_list.php
  79. 32 33
      main/admin/promotions.php
  80. 2 3
      main/admin/resource_sequence.php
  81. 186 139
      main/admin/settings.lib.php
  82. 42 41
      main/admin/settings.php
  83. 2 3
      main/admin/skill.php
  84. 8 6
      main/admin/skill_badge.php
  85. 13 14
      main/admin/skill_badge_create.php
  86. 12 10
      main/admin/skill_badge_list.php
  87. 7 6
      main/admin/skill_create.php
  88. 7 6
      main/admin/skill_edit.php
  89. 3 4
      main/admin/skill_level.php
  90. 4 4
      main/admin/skill_list.php
  91. 4 5
      main/admin/skill_profile.php
  92. 4 4
      main/admin/skill_translate.php
  93. 20 21
      main/admin/skills_gradebook.php
  94. 30 23
      main/admin/skills_import.php
  95. 12 13
      main/admin/skills_profile.php
  96. 8 6
      main/admin/special_exports.php
  97. 7 6
      main/admin/specific_fields.php
  98. 11 10
      main/admin/specific_fields_add.php
  99. 3 4
      main/admin/statistics.php
  100. 9 8
      main/admin/statistics/index.php

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
.php_cs.cache


+ 4 - 4
certificates/index.php

@@ -1,10 +1,10 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
- * Show specified user certificate
+ * Show specified user certificate.
+ *
  * @package chamilo.certificate
  */
-
 require_once '../main/inc/global.inc.php';
 
 $action = isset($_GET['action']) ? $_GET['action'] : null;
@@ -20,7 +20,7 @@ switch ($action) {
             api_not_allowed(true);
         }
 
-        $certificate->generate(array('hide_print_button' => true));
+        $certificate->generate(['hide_print_button' => true]);
 
         if ($certificate->isHtmlFileGenerated()) {
             $certificatePathList[] = $certificate->html_file;
@@ -29,7 +29,7 @@ switch ($action) {
                 'top' => 0,
                 'right' => 0,
                 'bottom' => 0,
-                'left' => 0
+                'left' => 0,
             ];
 
             $orientation = api_get_configuration_value('certificate_pdf_orientation');

+ 5 - 6
cli-config.php

@@ -3,15 +3,14 @@
 
 /**
  * Script needed to execute bin/doctrine.php in the command line
- * in order to:
+ * in order to:.
  *
  * - Generate migrations
  * - Create schema
  * - Update schema
  * - Validate schema
  * - Etc
- **/
-
+ */
 use Doctrine\ORM\Tools\Console\ConsoleRunner;
 
 require_once __DIR__.'/vendor/autoload.php';
@@ -26,13 +25,13 @@ if (!is_file($configurationFile)) {
 require_once $configurationFile;
 
 $database = new \Database();
-$dbParams = array(
+$dbParams = [
     'driver' => 'pdo_mysql',
     'host' => $_configuration['db_host'],
     'user' => $_configuration['db_user'],
     'password' => $_configuration['db_password'],
-    'dbname' => $_configuration['main_database']
-);
+    'dbname' => $_configuration['main_database'],
+];
 
 $database->connect($dbParams, realpath(__DIR__).'/', realpath(__DIR__).'/');
 $entityManager = $database::getManager();

+ 2 - 3
contrat.php

@@ -1,6 +1,5 @@
 <?php
 require_once __DIR__.'/main/inc/global.inc.php';
 $linkLegal = api_get_path(WEB_PATH)."courses/FORUMDAIDE/index.php";
-header('Location: ' . $linkLegal);
-Exit();
-?>
+header('Location: '.$linkLegal);
+exit();

+ 10 - 9
custompages/first_login-dist.php

@@ -1,18 +1,19 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
- * Quick page to react to first login cases
+ * Quick page to react to first login cases.
+ *
  * @package chamilo.custompages
  */
-
 require_once api_get_path(SYS_PATH).'main/inc/global.inc.php';
 require_once __DIR__.'/language.php';
 
 /**
- * Security checks
+ * Security checks.
  */
-if (!isset($_SESSION['conditional_login']['uid']))
-  die("Not Authorised");
+if (!isset($_SESSION['conditional_login']['uid'])) {
+    die("Not Authorised");
+}
 
 if (isset($_POST['password'])) {
     $u = api_get_user_info($_SESSION['conditional_login']['uid']);
@@ -59,7 +60,7 @@ if ($_GET['invalid'] == 2) {
 }
 $www = api_get_path('WEB_PATH');
 /**
- * HTML output
+ * HTML output.
  */
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -67,7 +68,7 @@ $www = api_get_path('WEB_PATH');
 <head>
     <title>Custompage - login</title>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-    <script type="text/javascript" src="<?php echo $www ?>web/assets/jquery/dist/jquery.min.js"></script>
+    <script type="text/javascript" src="<?php echo $www; ?>web/assets/jquery/dist/jquery.min.js"></script>
     <script type="text/javascript">
         $(document).ready(function() {
             if (top.location != location)
@@ -95,8 +96,8 @@ $www = api_get_path('WEB_PATH');
         <div id="changepassword-form-box" class="form-box">
       <div class="info"> <?php echo custompages_get_lang('FirstLoginChangePassword'); ?> </div>
         <?php if (isset($error_message)) {
-            echo '<div id="changepassword-form-error" class="form-error">'.$error_message.'</div>';
-        }?>
+    echo '<div id="changepassword-form-error" class="form-error">'.$error_message.'</div>';
+}?>
             <form id="changepassword-form" class="form" method="post">
                 <div>
           <label for="password">*<?php echo custompages_get_lang('Password'); ?></label>

+ 3 - 2
custompages/index-logged-dist.php

@@ -1,14 +1,15 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
- * Redirect to normal Chamilo
+ * Redirect to normal Chamilo.
+ *
  * @package chamilo.custompages
  */
 require_once api_get_path(SYS_PATH).'main/inc/global.inc.php';
 
 $www = api_get_path('WEB_PATH');
 /**
- * Redirect
+ * Redirect.
  */
 header("Location: $www/user_portal.php");
 exit;

+ 16 - 14
custompages/index-unlogged-dist.php

@@ -1,15 +1,15 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
- * Redirect script
+ * Redirect script.
+ *
  * @package chamilo.custompages
  */
-
 require_once api_get_path(SYS_PATH).'main/inc/global.inc.php';
 require_once __DIR__.'/language.php';
 
 /**
- * Homemade micro-controller
+ * Homemade micro-controller.
  */
 if (isset($_GET['loginFailed'])) {
     if (isset($_GET['error'])) {
@@ -37,14 +37,14 @@ if (isset($_GET['loginFailed'])) {
 $rootWeb = api_get_path('WEB_PATH');
 
 /**
- * HTML output
+ * HTML output.
  */
 ?>
 <html>
 <head>
 	<title>Custompage - login</title>
 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-    <script type="text/javascript" src="<?php echo $rootWeb ?>web/assets/jquery/dist/jquery.min.js"></script>
+    <script type="text/javascript" src="<?php echo $rootWeb; ?>web/assets/jquery/dist/jquery.min.js"></script>
 	<script type="text/javascript">
 		$(document).ready(function() {
 			if (top.location != location) {
@@ -62,24 +62,24 @@ $rootWeb = api_get_path('WEB_PATH');
 </head>
 <body>
 	<div id="backgroundimage">
-		<img src="<?php echo api_get_path(WEB_PATH)?>/custompages/images/page-background.png" class="backgroundimage" />
+		<img src="<?php echo api_get_path(WEB_PATH); ?>/custompages/images/page-background.png" class="backgroundimage" />
 	</div>
 	<div id="wrapper">
 		<div id="header">
-			<img src="<?php echo api_get_path(WEB_PATH)?>/custompages/images/header.png" alt="Logo" />
+			<img src="<?php echo api_get_path(WEB_PATH); ?>/custompages/images/header.png" alt="Logo" />
 		</div> <!-- #header -->
 		<div id="login-form-box" class="form-box">
             <div id="login-form-info" class="form-info">
             <?php if (isset($content['info']) && !empty($content['info'])) {
-                echo $content['info'];
-            }
+    echo $content['info'];
+}
             ?>
             </div>
             <?php if (isset($error_message)) {
                 echo '<div id="login-form-info" class="form-error">'.$error_message.'</div>';
             }
             ?>
-            <form id="login-form" class="form" action="<?php echo api_get_path(WEB_PATH)?>index.php" method="post">
+            <form id="login-form" class="form" action="<?php echo api_get_path(WEB_PATH); ?>index.php" method="post">
                 <div>
                     <label for="login">*<?php echo custompages_get_lang('User'); ?></label>
                     <input name="login" type="text" /><br />
@@ -92,14 +92,16 @@ $rootWeb = api_get_path('WEB_PATH');
             </div> <!-- #form-submit -->
 			<div id="links">
 
-                <?php if (api_get_setting('allow_registration') === 'true') { ?>
+                <?php if (api_get_setting('allow_registration') === 'true') {
+                ?>
                 <a href="<?php echo api_get_path(WEB_CODE_PATH); ?>auth/inscription.php?language=<?php echo api_get_interface_language(); ?>">
-                    <?php echo custompages_get_lang('Registration')?>
+                    <?php echo custompages_get_lang('Registration'); ?>
                 </a><br />
-                <?php } ?>
+                <?php
+            } ?>
 
                 <a href="<?php echo api_get_path(WEB_CODE_PATH); ?>auth/lostPassword.php?language=<?php echo api_get_interface_language(); ?>">
-                    <?php echo custompages_get_lang('LostPassword')?>
+                    <?php echo custompages_get_lang('LostPassword'); ?>
                 </a>
 			</div>
 		</div> <!-- #form -->

+ 7 - 5
custompages/language.inc.php

@@ -6,17 +6,19 @@
  * to the best pick according to the visitor's browser's options.
  * 2011, Jean-Karim Bockstael, CBlue <jeankarim@cblue.be>
  * This requires the Chamilo system to be initialized
- * (note that it's easier to do the following include in the parent page)
+ * (note that it's easier to do the following include in the parent page).
+ *
  * @package chamilo.custompages
  */
 /**
- * Returns the best match between available languages and visitor preferences
+ * Returns the best match between available languages and visitor preferences.
+ *
  * @return string the best match as 2-chars code, null when none match
-*/
+ */
 function get_preferred_language($available_langs)
 {
     // Parsing the Accept-languages HTTP header
-    $langs = array();
+    $langs = [];
     foreach (explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $httplang) {
         $rawlang = explode(';q=', $httplang);
         if (strpos($rawlang[0], '-') !== false) {
@@ -43,7 +45,7 @@ function get_preferred_language($available_langs)
 }
 
 /**
- * Get a language variable in a specific language
+ * Get a language variable in a specific language.
  */
 function custompages_get_lang($variable)
 {

+ 9 - 9
custompages/language.php

@@ -2,16 +2,17 @@
 /* For licensing terms, see /license.txt */
 /**
  * Definition of language-related functions for cases where th user isn't
- * logged in yet
+ * logged in yet.
+ *
  * @package chamilo.custompages
  */
 // Get helper functions
 require_once __DIR__.'/language.inc.php';
 
 // Define the languages you want to make available for auto-detection here
-$available_langs = array('en', 'fr', 'es', 'gl', 'eu');
+$available_langs = ['en', 'fr', 'es', 'gl', 'eu'];
 // Define the translation of these language codes to Chamilo languages
-$chamilo_langs = array(
+$chamilo_langs = [
     null => 'english',
     'en' => 'english',
     'fr' => 'french',
@@ -19,21 +20,21 @@ $chamilo_langs = array(
     'de' => 'german',
     'es' => 'spanish',
     'gl' => 'galician',
-    'eu' => 'basque'
-);
+    'eu' => 'basque',
+];
 $lang_match = $chamilo_langs[get_preferred_language($available_langs)];
 // recover previous value ...
 if (isset($_SESSION['user_language_choice'])) {
-	$lang_match = $_SESSION['user_language_choice'];
+    $lang_match = $_SESSION['user_language_choice'];
 }
 
 // Chamilo parameter, on logout
 if (isset($_REQUEST['language']) && !empty($_REQUEST['language']) && in_array($_REQUEST['language'], $chamilo_langs)) {
-	$lang_match = $_REQUEST['language'];
+    $lang_match = $_REQUEST['language'];
 }
 // Incoming link parameter
 if (isset($_REQUEST['lang']) && !empty($_REQUEST['lang']) && in_array($_REQUEST['lang'], $available_langs)) {
-	$lang_match = $chamilo_langs[$_REQUEST['lang']];
+    $lang_match = $chamilo_langs[$_REQUEST['lang']];
 }
 
 $detect = api_get_setting('auto_detect_language_custom_pages');
@@ -47,4 +48,3 @@ if ($detect === 'true') {
     $_user['language'] = $defaultLanguage;
     $_SESSION['user_language_choice'] = $defaultLanguage;
 }
-

+ 6 - 6
custompages/loggedout-dist.php

@@ -2,9 +2,9 @@
 /* For licensing terms, see /license.txt */
 /**
  * Displayed after the user has been logged out.
+ *
  * @package chamilo.custompages
  */
-
 $called_direcly = !function_exists('api_get_path');
 if ($called_direcly) {
     return '';
@@ -15,7 +15,7 @@ require_once __DIR__.'/language.php';
 $www = api_get_path('WEB_PATH');
 
 /**
- * HTML output
+ * HTML output.
  */
 ?>
 <!DOCTYPE html>
@@ -23,7 +23,7 @@ $www = api_get_path('WEB_PATH');
     <head>
         <title>Custompage - logged out</title>
         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-        <script type="text/javascript" src="<?php echo $www ?>web/assets/jquery/dist/jquery.min.js"></script>
+        <script type="text/javascript" src="<?php echo $www; ?>web/assets/jquery/dist/jquery.min.js"></script>
         <script type="text/javascript">
             $(document).ready(function() {
                 if (top.location != location)
@@ -33,11 +33,11 @@ $www = api_get_path('WEB_PATH');
     </head>
     <body>
         <div id="backgroundimage">
-            <img src="<?php echo $www ?>/custompages/images/page-background.png" class="backgroundimage" alt="background"/>
+            <img src="<?php echo $www; ?>/custompages/images/page-background.png" class="backgroundimage" alt="background"/>
         </div>
         <div id="wrapper">
             <div id="header">
-                <img src="<?php echo $www ?>/custompages/images/header.png" alt="Logo" />
+                <img src="<?php echo $www; ?>/custompages/images/header.png" alt="Logo" />
             </div>
 
             <div id="login-form-box" class="form-box">
@@ -47,7 +47,7 @@ $www = api_get_path('WEB_PATH');
             </div>
             <a href="<?php echo $www.'user_portal.php'; ?>">Go to your portal</a>
             <div id="footer">
-                <img src="<?php echo $www ?>/custompages/images/footer.png" alt="footer"/>
+                <img src="<?php echo $www; ?>/custompages/images/footer.png" alt="footer"/>
             </div>
         </div>
     </body>

+ 3 - 3
custompages/lostpassword-dist.php

@@ -2,9 +2,9 @@
 /* For licensing terms, see /license.txt */
 /**
  * Quick form to ask for password reminder.
+ *
  * @package chamilo.custompages
  */
-
 require_once api_get_path(SYS_PATH).'main/inc/global.inc.php';
 require_once __DIR__.'/language.php';
 
@@ -14,7 +14,7 @@ $rootWeb = api_get_path('WEB_PATH');
 <head>
 	<title><?php echo custompages_get_lang('LostPassword'); ?></title>
 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-	<script type="text/javascript" src="<?php echo $rootWeb ?>web/assets/jquery/dist/jquery.min.js"></script>
+	<script type="text/javascript" src="<?php echo $rootWeb; ?>web/assets/jquery/dist/jquery.min.js"></script>
 
 	<script type="text/javascript">
 		$(document).ready(function() {
@@ -41,7 +41,7 @@ $rootWeb = api_get_path('WEB_PATH');
                 echo '<div id="registration-form-error" class="form-error"><ul>'.$content['info'].'</ul></div>';
             }
 
-            echo isset($content['form']) ? $content['form'] : ''
+            echo isset($content['form']) ? $content['form'] : '';
             ?>
 		</div> <!-- #form -->
 		<div id="footer">

+ 9 - 9
custompages/registration-dist.php

@@ -4,14 +4,14 @@
  * This script allows for specific registration rules (see CustomPages feature of Chamilo)
  * Please contact CBlue regarding any licences issues.
  * Author: noel@cblue.be
- * Copyright: CBlue SPRL, 20XX (GNU/GPLv3)
+ * Copyright: CBlue SPRL, 20XX (GNU/GPLv3).
+ *
  * @package chamilo.custompages
- **/
-
+ */
 require_once api_get_path(SYS_PATH).'main/inc/global.inc.php';
 require_once __DIR__.'/language.php';
 /**
- * Removes some unwanted elementend of the form object
+ * Removes some unwanted elementend of the form object.
  */
 $content['form']->removeElement('extra_mail_notify_invitation');
 $content['form']->removeElement('extra_mail_notify_message');
@@ -27,7 +27,7 @@ $rootWeb = api_get_path('WEB_PATH');
 
 // Deprecated since 2015-03-26
 /**
- * Code to change the way QuickForm render html
+ * Code to change the way QuickForm render html.
  */
 /*
 $renderer = & $content['form']->defaultRenderer();
@@ -84,7 +84,7 @@ EOT;
     <title><?php echo custompages_get_lang('Registration'); ?></title>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <script type="text/javascript" src="<?php echo $rootWeb ?>web/assets/jquery/dist/jquery.min.js"></script>
+    <script type="text/javascript" src="<?php echo $rootWeb; ?>web/assets/jquery/dist/jquery.min.js"></script>
 </head>
 <body>
 <img id="backgroundimage" src="/custompages/images/page-background.png"">
@@ -97,8 +97,8 @@ EOT;
                         <img src="/custompages/images/header.png">
                     </div>
                     <?php if (isset($content['error']) && !empty($content['error'])) {
-                        echo '<div id="registration-form-error" class="alert alert-danger">'.$content['error'].'</div>';
-                    }?>
+    echo '<div id="registration-form-error" class="alert alert-danger">'.$content['error'].'</div>';
+}?>
                     <div id="registration-form-box" class="form-box">
                         <div class="block-form-login">
                             <?php
@@ -106,7 +106,7 @@ EOT;
                             ?>
                         </div>
                         <div id="links">
-                            <!--<a href="mailto: support@cblue.be"><?php echo custompages_get_lang('NeedContactAdmin')?></a><br />-->
+                            <!--<a href="mailto: support@cblue.be"><?php echo custompages_get_lang('NeedContactAdmin'); ?></a><br />-->
                         </div>
                     </div>
                     <div id="footer">

+ 4 - 3
custompages/registration-feedback-dist.php

@@ -1,11 +1,12 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
- * Quick display for user registration
+ * Quick display for user registration.
+ *
  * @package chamilo.custompages
  */
 /**
- * HTML output
+ * HTML output.
  */
 require_once api_get_path(SYS_PATH).'main/inc/global.inc.php';
 require_once __DIR__.'/language.php';
@@ -18,7 +19,7 @@ $rootWeb = api_get_path('WEB_PATH');
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <script type="text/javascript" src="<?php echo $rootWeb ?>web/assets/jquery/dist/jquery.min.js"></script>
+    <script type="text/javascript" src="<?php echo $rootWeb; ?>web/assets/jquery/dist/jquery.min.js"></script>
 </head>
 <body>
 <img src="/custompages/images/page-background.png" class="backgroundimage" />

+ 1 - 0
index.php

@@ -41,6 +41,7 @@ if (!empty($_GET['logout'])) {
 /**
  * Registers in the track_e_default table (view in important activities in admin
  * interface) a possible attempted break in, sending auth data through get.
+ *
  * @todo This piece of code should probably move to local.inc.php where the
  * actual login / logout procedure is handled.
  * The real use of this code block should be seriously considered as well.

+ 63 - 71
load_search.php

@@ -10,7 +10,7 @@ require_once 'main/inc/global.inc.php';
 $htmlHeadXtra[] = '<link  href="'.api_get_path(WEB_PATH).'web/assets/cropper/dist/cropper.min.css" rel="stylesheet">';
 $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_PATH).'web/assets/cropper/dist/cropper.min.js"></script>';
 
-$htmlHeadXtra[] ='<script>		
+$htmlHeadXtra[] = '<script>		
 $(document).ready(function() {		
     /*$("#filiere_panel").hide();			
     $("#dispo_panel").hide();    		
@@ -128,9 +128,9 @@ $form = new FormValidator('search', 'post', api_get_self().'?user_id='.$userToLo
 $form->addHeader(get_lang('Diagnosis'));
 $form->addHidden('user_id', $userToLoad);
 
-/** @var ExtraFieldSavedSearch  $saved */
+/** @var ExtraFieldSavedSearch $saved */
 $search = [
-    'user' => $userToLoad
+    'user' => $userToLoad,
 ];
 
 $items = $em->getRepository('ChamiloCoreBundle:ExtraFieldSavedSearch')->findBy($search);
@@ -175,9 +175,9 @@ $userForm = new FormValidator('user_form', 'post', api_get_self());
 
 $userForm->addHtml('<div class="panel-group" id="search_extrafield" role="tablist" aria-multiselectable="true">');
 $userForm->addHtml('<div class="panel panel-default">');
-$userForm->addHtml('<div class="panel-heading"><a role="button" data-toggle="collapse" data-parent="#search_extrafield" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">' . get_lang('Filiere') . '</a></div>');
+$userForm->addHtml('<div class="panel-heading"><a role="button" data-toggle="collapse" data-parent="#search_extrafield" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">'.get_lang('Filiere').'</a></div>');
 $userForm->addHtml('<div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">');
-$userForm->addHtml('<div class="panel-body"><p class="text-info">' . get_lang('FiliereExplanation') .'</p>');
+$userForm->addHtml('<div class="panel-body"><p class="text-info">'.get_lang('FiliereExplanation').'</p>');
 
 $fieldsToShow = [
     'statusocial',
@@ -207,15 +207,15 @@ $extra = $extraFieldUser->addElements(
 $userForm->addHtml('</div></div></div>');
 
 $userForm->addHtml('<div class="panel panel-default">');
-$userForm->addHtml('<div class="panel-heading"><a role="button" data-toggle="collapse" data-parent="#search_extrafield" href="#collapseThree" aria-expanded="true" aria-controls="collapseThree">' . get_lang('DisponibilitePendantMonStage') . '</a></div>');
+$userForm->addHtml('<div class="panel-heading"><a role="button" data-toggle="collapse" data-parent="#search_extrafield" href="#collapseThree" aria-expanded="true" aria-controls="collapseThree">'.get_lang('DisponibilitePendantMonStage').'</a></div>');
 $userForm->addHtml('<div id="collapseThree" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingThree">');
-$userForm->addHtml('<div class="panel-body"><p class="text-info">' . get_lang('DisponibilitePendantMonStageExplanation') . '</p>');
+$userForm->addHtml('<div class="panel-body"><p class="text-info">'.get_lang('DisponibilitePendantMonStageExplanation').'</p>');
 
 $fieldsToShow = [
     'datedebutstage',
     'datefinstage',
     'poursuiteapprentissagestage',
-    'heures_disponibilite_par_semaine_stage'
+    'heures_disponibilite_par_semaine_stage',
 ];
 
 $extra = $extraFieldUser->addElements(
@@ -237,14 +237,13 @@ $extra = $extraFieldUser->addElements(
 
 $userForm->addHtml('</div></div></div>');
 
-
 $userForm->addHtml('<div class="panel panel-default">');
-$userForm->addHtml('<div class="panel-heading"><a role="button" data-toggle="collapse" data-parent="#search_extrafield" href="#collapseSix" aria-expanded="true" aria-controls="collapseSix">' . get_lang('ObjectifsApprentissage') . '</a></div>');
+$userForm->addHtml('<div class="panel-heading"><a role="button" data-toggle="collapse" data-parent="#search_extrafield" href="#collapseSix" aria-expanded="true" aria-controls="collapseSix">'.get_lang('ObjectifsApprentissage').'</a></div>');
 $userForm->addHtml('<div id="collapseSix" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingSix">');
-$userForm->addHtml('<div class="panel-body"><p class="text-info">' . get_lang('ObjectifsApprentissageExplanation') . '</p>');
+$userForm->addHtml('<div class="panel-body"><p class="text-info">'.get_lang('ObjectifsApprentissageExplanation').'</p>');
 
 $fieldsToShow = [
-    'objectif_apprentissage'
+    'objectif_apprentissage',
 ];
 
 $extra = $extraFieldUser->addElements(
@@ -264,17 +263,16 @@ $extra = $extraFieldUser->addElements(
     $fieldsToShow
 );
 
-
 $userForm->addHtml('</div></div></div>');
 
 $userForm->addHtml('<div class="panel panel-default">');
-$userForm->addHtml('<div class="panel-heading"><a role="button" data-toggle="collapse" data-parent="#search_extrafield" href="#collapseSeven" aria-expanded="true" aria-controls="collapseSeven">' . get_lang('MethodeTravail') . '</a></div>');
+$userForm->addHtml('<div class="panel-heading"><a role="button" data-toggle="collapse" data-parent="#search_extrafield" href="#collapseSeven" aria-expanded="true" aria-controls="collapseSeven">'.get_lang('MethodeTravail').'</a></div>');
 $userForm->addHtml('<div id="collapseSeven" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingSeven">');
-$userForm->addHtml('<div class="panel-body"><p class="text-info">' . get_lang('MethodeTravailExplanation') . '</p>');
+$userForm->addHtml('<div class="panel-body"><p class="text-info">'.get_lang('MethodeTravailExplanation').'</p>');
 
 $fieldsToShow = [
     'methode_de_travaille',
-    'accompagnement'
+    'accompagnement',
 ];
 
 $extra = $extraFieldUser->addElements(
@@ -297,15 +295,14 @@ $extra = $extraFieldUser->addElements(
 $userForm->addHtml('</div></div></div>');
 
 $form->addHtml('<div class="panel panel-default">');
-$form->addHtml('<div class="panel-heading"><a role="button" data-toggle="collapse" data-parent="#search_extrafield" href="#collapseTwo" aria-expanded="true" aria-controls="collapseTwo">' . get_lang('DisponibiliteAvant') . '</a></div>');
+$form->addHtml('<div class="panel-heading"><a role="button" data-toggle="collapse" data-parent="#search_extrafield" href="#collapseTwo" aria-expanded="true" aria-controls="collapseTwo">'.get_lang('DisponibiliteAvant').'</a></div>');
 $form->addHtml('<div id="collapseTwo" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingTwo">');
-$form->addHtml('<div class="panel-body"><p class="text-info">' . get_lang('DisponibiliteAvantExplanation') . '</p>');
-
+$form->addHtml('<div class="panel-body"><p class="text-info">'.get_lang('DisponibiliteAvantExplanation').'</p>');
 
 // Session fields
 $showOnlyThisFields = [
     'access_start_date',
-    'access_end_date'
+    'access_end_date',
 ];
 
 $extra = $extraField->addElements(
@@ -342,13 +339,12 @@ $extra = $extraFieldUser->addElements(
     $forceShowFields //$forceShowFields = false
 );
 
-
 $form->addHtml('</div></div></div>');
 
 $form->addHtml('<div class="panel panel-default">');
-$form->addHtml('<div class="panel-heading"><a role="button" data-toggle="collapse" data-parent="#search_extrafield" href="#collapseFour" aria-expanded="true" aria-controls="collapseFour">' . get_lang('ThemesObjectifs') . '</a></div>');
+$form->addHtml('<div class="panel-heading"><a role="button" data-toggle="collapse" data-parent="#search_extrafield" href="#collapseFour" aria-expanded="true" aria-controls="collapseFour">'.get_lang('ThemesObjectifs').'</a></div>');
 $form->addHtml('<div id="collapseFour" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingFour">');
-$form->addHtml('<div class="panel-body"><p class="text-info">' . get_lang('ThemesObjectifsExplanation') . '</p>');
+$form->addHtml('<div class="panel-body"><p class="text-info">'.get_lang('ThemesObjectifsExplanation').'</p>');
 
 $showOnlyThisFields = [
     'domaine',
@@ -368,19 +364,19 @@ $extra = $extraField->addElements(
     [],
     false, //$orderDependingDefaults
     true, // force
-    [ 'domaine' => 3, $theme => 5], // $separateExtraMultipleSelect
+    ['domaine' => 3, $theme => 5], // $separateExtraMultipleSelect
     [
         'domaine' => [
             get_lang('Domaine').' 1',
             get_lang('Domaine').' 2',
-            get_lang('Domaine').' 3'
+            get_lang('Domaine').' 3',
         ],
-        $theme  => [
+        $theme => [
             get_lang('ThemeField').' 1',
             get_lang('ThemeField').' 2',
             get_lang('ThemeField').' 3',
             get_lang('ThemeField').' 4',
-            get_lang('ThemeField').' 5'
+            get_lang('ThemeField').' 5',
         ],
     ],
     [],
@@ -389,20 +385,17 @@ $extra = $extraField->addElements(
 
 $form->addHtml('</div></div></div>');
 
-
-
-
 $form->addHtml('<div class="panel panel-default">');
-$form->addHtml('<div class="panel-heading"><a role="button" data-toggle="collapse" data-parent="#search_extrafield" href="#collapseFive" aria-expanded="true" aria-controls="collapseFive">' . get_lang('NiveauLangue') . '</a></div>');
+$form->addHtml('<div class="panel-heading"><a role="button" data-toggle="collapse" data-parent="#search_extrafield" href="#collapseFive" aria-expanded="true" aria-controls="collapseFive">'.get_lang('NiveauLangue').'</a></div>');
 $form->addHtml('<div id="collapseFive" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingFive">');
-$form->addHtml('<div class="panel-body"><p class="text-info">' . get_lang('NiveauLangueExplanation') . '</p>');
+$form->addHtml('<div class="panel-body"><p class="text-info">'.get_lang('NiveauLangueExplanation').'</p>');
 
 $showOnlyThisFields = [
     'ecouter',
     'lire',
     'participer_a_une_conversation',
     's_exprimer_oralement_en_continu',
-    'ecrire'
+    'ecrire',
 ];
 
 $extra = $extraField->addElements(
@@ -417,19 +410,19 @@ $extra = $extraField->addElements(
     [],
     false, //$orderDependingDefaults
     true, // force
-    [ 'domaine' => 3, $theme => 5], // $separateExtraMultipleSelect
+    ['domaine' => 3, $theme => 5], // $separateExtraMultipleSelect
     [
         'domaine' => [
             get_lang('Domaine').' 1',
             get_lang('Domaine').' 2',
-            get_lang('Domaine').' 3'
+            get_lang('Domaine').' 3',
         ],
-        $theme  => [
+        $theme => [
             get_lang('Theme').' 1',
             get_lang('Theme').' 2',
             get_lang('Theme').' 3',
             get_lang('Theme').' 4',
-            get_lang('Theme').' 5'
+            get_lang('Theme').' 5',
         ],
     ]
 );
@@ -439,8 +432,8 @@ $form->addHtml('</div></div></div>');
 $form->addButtonSave(get_lang('SaveDiagnosticChanges'), 'save');
 $form->addButtonSearch(get_lang('SearchSessions'), 'search');
 
-$extraFieldsToFilter = $extraField->get_all(array('variable = ?' => 'temps_de_travail'));
-$extraFieldToSearch = array();
+$extraFieldsToFilter = $extraField->get_all(['variable = ?' => 'temps_de_travail']);
+$extraFieldToSearch = [];
 if (!empty($extraFieldsToFilter)) {
     foreach ($extraFieldsToFilter as $filter) {
         $extraFieldToSearch[] = $filter['id'];
@@ -563,7 +556,7 @@ if ($form->validate()) {
                             $filterToSend['rules'][] = [
                                 'field' => $column['name'],
                                 'op' => 'cn',
-                                'data' => $filters[$column['name']]
+                                'data' => $filters[$column['name']],
                             ];
                         }
                         $countExtraField++;
@@ -581,7 +574,7 @@ if ($form->validate()) {
         $extraFieldValue = new ExtraFieldValue('user');
         $userDataToSave = [
             'item_id' => $userToLoad,
-            'extra_heures_disponibilite_par_semaine' => isset($userData['extra_heures_disponibilite_par_semaine']) ? $userData['extra_heures_disponibilite_par_semaine'] : ''
+            'extra_heures_disponibilite_par_semaine' => isset($userData['extra_heures_disponibilite_par_semaine']) ? $userData['extra_heures_disponibilite_par_semaine'] : '',
         ];
         $extraFieldValue->saveFieldValues($userDataToSave, true, false, ['heures_disponibilite_par_semaine']);
 
@@ -605,7 +598,7 @@ if ($form->validate()) {
             'extra_lire',
             'extra_participer_a_une_conversation',
             'extra_s_exprimer_oralement_en_continu',
-            'extra_ecrire'
+            'extra_ecrire',
         ];
 
         foreach ($userData as $key => $value) {
@@ -651,7 +644,7 @@ if ($form->validate()) {
 
             $search = [
                 'field' => $extraFieldObj,
-                'user' => $user
+                'user' => $user,
             ];
 
             /** @var ExtraFieldSavedSearch $saved */
@@ -678,7 +671,6 @@ if ($form->validate()) {
         Display::addFlash(Display::return_message(get_lang('Saved'), 'success'));
         header('Location: '.api_get_self().'?user_id='.$userToLoad);
         exit;
-
     }
 }
 
@@ -689,12 +681,12 @@ if (!empty($tagsData)) {
     foreach ($tagsData as $extraField => $tags) {
         foreach ($tags as $tag) {
             $tag = api_htmlentities($tag);
-           // $jsTag .= "$('#$extraField')[0].addItem('$tag', '$tag');";
+            // $jsTag .= "$('#$extraField')[0].addItem('$tag', '$tag');";
         }
     }
 }
 
-$htmlHeadXtra[] ='<script>
+$htmlHeadXtra[] = '<script>
 $(function() {
     '.$extra['jquery_ready_content'].'
     '.$jsTag.'
@@ -720,7 +712,7 @@ if (!empty($filterToSend)) {
 
     // Ofaj fix
     $userStartDateMinus = api_get_utc_datetime(substr($userStartDateMinus, 0, 11).'00:00:00');
-    $userEndDatePlus = api_get_utc_datetime(substr($userEndDatePlus, 0, 11). '23:59:59');
+    $userEndDatePlus = api_get_utc_datetime(substr($userEndDatePlus, 0, 11).'23:59:59');
 
     // Special OFAJ date logic
     if ($userEndDate == '') {
@@ -743,8 +735,8 @@ if (!empty($filterToSend)) {
     // Special filters
     // see https://task.beeznest.com/issues/10849#change-81902
     foreach ($filterToSend['rules'] as &$filterItem) {
-        if (isset($filterItem['field']))
-        switch ($filterItem['field']) {
+        if (isset($filterItem['field'])) {
+            switch ($filterItem['field']) {
             case 'extra_ecouter':
             case 'extra_lire':
             case 'extra_participer_a_une_conversation':
@@ -781,14 +773,14 @@ if (!empty($filterToSend)) {
                 $searchOptions = [];
                 for ($i = 1; $i < count($newOptions); $i++) {
                     if ($selectedValue == $newOptions[$i]) {
-                        if (isset($newOptions[$i-1])) {
-                            $searchOptions[] = $newOptions[$i-1];
+                        if (isset($newOptions[$i - 1])) {
+                            $searchOptions[] = $newOptions[$i - 1];
                         }
                         if (isset($newOptions[$i])) {
                             $searchOptions[] = $newOptions[$i];
                         }
-                        if (isset($newOptions[$i+1])) {
-                            $searchOptions[] = $newOptions[$i+1];
+                        if (isset($newOptions[$i + 1])) {
+                            $searchOptions[] = $newOptions[$i + 1];
                         }
                         break;
                     }
@@ -800,10 +792,10 @@ if (!empty($filterToSend)) {
                 // Special condition see:
                 // https://task.beeznest.com/issues/10849#note-218
                 // Remove filiere
-                $list =  [
+                $list = [
                     'vie-quotidienne',
                     //'competente-dans-mon-domaine-de-specialite',
-                    'arrivee-sur-mon-poste-de-travail'
+                    'arrivee-sur-mon-poste-de-travail',
                 ];
 
                 $deleteFiliere = false;
@@ -822,6 +814,7 @@ if (!empty($filterToSend)) {
                 }
                 break;
         }
+        }
 
         if ($deleteFiliere) {
             foreach ($filterToSend['rules'] as &$filterItem) {
@@ -846,16 +839,16 @@ $extra_params['autowidth'] = 'true';
 
 // height auto
 $extra_params['height'] = 'auto';
-$extra_params['postData'] = array(
-    'filters' => array(
+$extra_params['postData'] = [
+    'filters' => [
         "groupOp" => "AND",
-        "rules" => $result['rules']
-    )
-);
+        "rules" => $result['rules'],
+    ],
+];
 
 $sessionByUserList = SessionManager::get_sessions_by_user($userToLoad, true, true);
 
-$sessionUserList = array();
+$sessionUserList = [];
 if (!empty($sessionByUserList)) {
     foreach ($sessionByUserList as $sessionByUser) {
         $sessionUserList[] = (string) $sessionByUser['session_id'];
@@ -865,9 +858,9 @@ $action_links = 'function action_formatter(cellvalue, options, rowObject) {
     var sessionList = '.json_encode($sessionUserList).';    
     var id = options.rowId.toString();    
     if (sessionList.indexOf(id) == -1) {
-        return \'<a href="'.api_get_self().'?action=subscribe_user&user_id='.$userToLoad.'&session_id=\'+id+\'">'.Display::return_icon('add.png', addslashes(get_lang('Subscribe')),'',ICON_SIZE_SMALL).'</a>'.'\';
+        return \'<a href="'.api_get_self().'?action=subscribe_user&user_id='.$userToLoad.'&session_id=\'+id+\'">'.Display::return_icon('add.png', addslashes(get_lang('Subscribe')), '', ICON_SIZE_SMALL).'</a>'.'\';
     } else {
-        return \'<a href="'.api_get_self().'?action=unsubscribe_user&user_id='.$userToLoad.'&session_id=\'+id+\'">'.Display::return_icon('delete.png', addslashes(get_lang('Delete')),'',ICON_SIZE_SMALL).'</a>'.'\';
+        return \'<a href="'.api_get_self().'?action=unsubscribe_user&user_id='.$userToLoad.'&session_id=\'+id+\'">'.Display::return_icon('delete.png', addslashes(get_lang('Delete')), '', ICON_SIZE_SMALL).'</a>'.'\';
     }
 }';
 
@@ -879,7 +872,7 @@ $griJs = Display::grid_js(
     $columns,
     $column_model,
     $extra_params,
-    array(),
+    [],
     $action_links,
     true
 );
@@ -887,13 +880,13 @@ $grid = '<div id="session-table" class="table-responsive">';
 $grid .= Display::grid_html('sessions');
 $grid .= '</div>';
 
-$htmlHeadXtra[] ='<style>
+$htmlHeadXtra[] = '<style>
 	.control-label {
 	    width: 25% !important;
 	}
 </style>';
 
-$htmlHeadXtra[] ='<script>		
+$htmlHeadXtra[] = '<script>		
 $(document).ready(function() {
 	var blocks = [
         "#collapseOne",
@@ -911,7 +904,6 @@ $(document).ready(function() {
 });		
 </script>';
 
-
 $tpl = new Template(get_lang('Diagnosis'));
 
 if (empty($items)) {
@@ -922,7 +914,7 @@ if (empty($items)) {
 $tpl->assign('form', $view);
 $tpl->assign('form_search', $formSearch->returnForm().$userForm->returnForm());
 
-$table = new HTML_Table(array('class' => 'data_table'));
+$table = new HTML_Table(['class' => 'data_table']);
 $column = 0;
 $row = 0;
 
@@ -988,11 +980,11 @@ if ($data) {
 }
 
 $numHours = $total - $sumHours;
-$headers = array(
+$headers = [
     get_lang('TotalAvailableHours') => $total,
     get_lang('SumHoursSessionsSubscribed') => $sumHours,
-    get_lang('CountHoursAvailable') => $numHours
-);
+    get_lang('CountHoursAvailable') => $numHours,
+];
 foreach ($headers as $header => $value) {
     $table->setCellContents($row, 0, $header);
     $table->updateCellAttributes($row, 0, 'width="250px"');

+ 25 - 15
main/admin/access_url_add_courses_to_url.php

@@ -3,10 +3,12 @@
 /**
  * This script allows platform admins to add users to urls.
  * It displays a list of users and a list of courses;
- * you can select multiple users and courses and then click on
+ * you can select multiple users and courses and then click on.
+ *
  * @package chamilo.admin
+ *
  * @author Julio Montoya <gugli100@gmail.com>
-*/
+ */
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 
@@ -21,9 +23,9 @@ if (!api_get_multiple_access_url()) {
 
 $form_sent = 0;
 $first_letter_course = '';
-$courses = array();
-$url_list = array();
-$users = array();
+$courses = [];
+$url_list = [];
+$users = [];
 
 $tbl_access_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
 $tbl_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
@@ -32,8 +34,8 @@ $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
 
 /*	Header   */
 $tool_name = get_lang('AddCoursesToURL');
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')];
 
 Display :: display_header($tool_name);
 
@@ -48,8 +50,8 @@ api_display_tool_title($tool_name);
 
 if (isset($_POST['form_sent']) && $_POST['form_sent']) {
     $form_sent = $_POST['form_sent'];
-    $courses = is_array($_POST['course_list']) ? $_POST['course_list'] : array();
-    $url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array();
+    $courses = is_array($_POST['course_list']) ? $_POST['course_list'] : [];
+    $url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : [];
     $first_letter_course = $_POST['first_letter_course'];
 
     foreach ($users as $key => $value) {
@@ -118,11 +120,15 @@ unset($result);
    <tr>
     <td width="40%" align="center">
      <select name="course_list[]" multiple="multiple" size="20" style="width:400px;">
-		<?php foreach ($db_courses as $course) { ?>
-			<option value="<?php echo $course['code']; ?>" <?php if (in_array($course['code'], $courses)) echo 'selected="selected"'; ?>>
+		<?php foreach ($db_courses as $course) {
+        ?>
+			<option value="<?php echo $course['code']; ?>" <?php if (in_array($course['code'], $courses)) {
+            echo 'selected="selected"';
+        } ?>>
                 <?php echo $course['title'].' ('.$course['code'].')'; ?>
             </option>
-        <?php } ?>
+        <?php
+    } ?>
     </select>
    </td>
    <td width="20%" valign="middle" align="center">
@@ -130,11 +136,15 @@ unset($result);
    </td>
    <td width="40%" align="center">
     <select name="url_list[]" multiple="multiple" size="20" style="width:300px;">
-    <?php foreach ($db_urls as $url_obj) { ?>
-    <option value="<?php echo $url_obj['id']; ?>" <?php if (in_array($url_obj['id'], $url_list)) echo 'selected="selected"'; ?>>
+    <?php foreach ($db_urls as $url_obj) {
+        ?>
+    <option value="<?php echo $url_obj['id']; ?>" <?php if (in_array($url_obj['id'], $url_list)) {
+            echo 'selected="selected"';
+        } ?>>
         <?php echo $url_obj['url']; ?>
     </option>
-    <?php } ?>
+    <?php
+    } ?>
     </select>
    </td>
   </tr>

+ 23 - 13
main/admin/access_url_add_usergroup_to_url.php

@@ -3,8 +3,10 @@
 /**
  *  This script allows platform admins to add users to urls.
  *  It displays a list of users and a list of courses;
- *  you can select multiple users and courses and then click on
+ *  you can select multiple users and courses and then click on.
+ *
  *  @package chamilo.admin
+ *
  *  @author Julio Montoya <gugli100@gmail.com>
  */
 $cidReset = true;
@@ -20,8 +22,8 @@ if (!api_get_multiple_access_url()) {
 $userGroup = new UserGroup();
 $form_sent = 0;
 $firstLetterUserGroup = null;
-$courses = array();
-$url_list = array();
+$courses = [];
+$url_list = [];
 
 $tbl_access_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
 $tbl_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
@@ -29,8 +31,8 @@ $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
 $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
 
 $tool_name = get_lang('AddUserGroupToURL');
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')];
 
 Display::display_header($tool_name);
 
@@ -45,8 +47,8 @@ api_display_tool_title($tool_name);
 
 if (isset($_POST['form_sent']) && $_POST['form_sent']) {
     $form_sent = $_POST['form_sent'];
-    $userGroups = is_array($_POST['user_group_list']) ? $_POST['user_group_list'] : array();
-    $urlList = is_array($_POST['url_list']) ? $_POST['url_list'] : array();
+    $userGroups = is_array($_POST['user_group_list']) ? $_POST['user_group_list'] : [];
+    $urlList = is_array($_POST['url_list']) ? $_POST['url_list'] : [];
     $firstLetterUserGroup = $_POST['first_letter_user_group'];
 
     if ($form_sent == 1) {
@@ -97,10 +99,14 @@ $db_urls = Database::store_result($result);
    <tr>
         <td width="40%" align="center">
         <select name="user_group_list[]" multiple="multiple" size="20" style="width:400px;">
-		<?php foreach ($dbUserGroups as $item) { ?>
-			<option value="<?php echo $item['id']; ?>" <?php if (in_array($item['id'], $courses)) echo 'selected="selected"'; ?>><?php echo $item['name']; ?>
+		<?php foreach ($dbUserGroups as $item) {
+                    ?>
+			<option value="<?php echo $item['id']; ?>" <?php if (in_array($item['id'], $courses)) {
+                        echo 'selected="selected"';
+                    } ?>><?php echo $item['name']; ?>
             </option>
-        <?php } ?>
+        <?php
+                } ?>
     </select>
    </td>
    <td width="20%" valign="middle" align="center">
@@ -108,10 +114,14 @@ $db_urls = Database::store_result($result);
    </td>
    <td width="40%" align="center">
     <select name="url_list[]" multiple="multiple" size="20" style="width:300px;">
-        <?php foreach ($db_urls as $url_obj) { ?>
-        <option value="<?php echo $url_obj['id']; ?>" <?php if (in_array($url_obj['id'], $url_list)) echo 'selected="selected"'; ?>><?php echo $url_obj['url']; ?>
+        <?php foreach ($db_urls as $url_obj) {
+                    ?>
+        <option value="<?php echo $url_obj['id']; ?>" <?php if (in_array($url_obj['id'], $url_list)) {
+                        echo 'selected="selected"';
+                    } ?>><?php echo $url_obj['url']; ?>
         </option>
-		<?php } ?>
+		<?php
+                } ?>
     </select>
    </td>
   </tr>

+ 20 - 14
main/admin/access_url_add_users_to_url.php

@@ -3,8 +3,10 @@
 /**
  * This script allows platform admins to add users to urls.
  *    It displays a list of users and a list of courses;
- *    you can select multiple users and courses and then click on
+ *    you can select multiple users and courses and then click on.
+ *
  * @package chamilo.admin
+ *
  * @author Julio Montoya <gugli100@gmail.com>
  */
 $cidReset = true;
@@ -20,9 +22,9 @@ if (!api_get_multiple_access_url()) {
 $form_sent = 0;
 $first_letter_user = '';
 $first_letter_course = '';
-$courses = array();
-$url_list = array();
-$users = array();
+$courses = [];
+$url_list = [];
+$users = [];
 
 $tbl_access_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
 $tbl_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
@@ -30,8 +32,8 @@ $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
 
 /*	Header	*/
 $tool_name = get_lang('AddUsersToURL');
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')];
 
 Display :: display_header($tool_name);
 
@@ -46,8 +48,8 @@ api_display_tool_title($tool_name);
 
 if ($_POST['form_sent']) {
     $form_sent = $_POST['form_sent'];
-    $users = is_array($_POST['user_list']) ? $_POST['user_list'] : array();
-    $url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array();
+    $users = is_array($_POST['user_list']) ? $_POST['user_list'] : [];
+    $url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : [];
     $first_letter_user = $_POST['first_letter_user'];
     foreach ($users as $key => $value) {
         $users[$key] = intval($value);
@@ -84,9 +86,9 @@ $target_name = api_sort_by_first_name() ? 'firstname' : 'lastname';
 $target_name = 'lastname';
 $sql = "SELECT user_id,lastname,firstname,username FROM $tbl_user
 	    WHERE ".$target_name." LIKE '".$first_letter_user_lower."%' OR ".$target_name." LIKE '".$first_letter_user_lower."%'
-		ORDER BY ". (count($users) > 0 ? "(user_id IN(".implode(',', $users).")) DESC," : "")." ".$target_name;
-$result     = Database::query($sql);
-$db_users   = Database::store_result($result);
+		ORDER BY ".(count($users) > 0 ? "(user_id IN(".implode(',', $users).")) DESC," : "")." ".$target_name;
+$result = Database::query($sql);
+$db_users = Database::store_result($result);
 unset($result);
 
 $sql = "SELECT id, url FROM $tbl_access_url  WHERE active=1 ORDER BY url";
@@ -120,8 +122,10 @@ unset($result);
      <select name="user_list[]" multiple="multiple" size="20" style="width:380px;">
         <?php
         foreach ($db_users as $user) {
-        ?>
-            <option value="<?php echo $user['user_id']; ?>" <?php if (in_array($user['user_id'], $users)) echo 'selected="selected"'; ?>>
+            ?>
+            <option value="<?php echo $user['user_id']; ?>" <?php if (in_array($user['user_id'], $users)) {
+                echo 'selected="selected"';
+            } ?>>
             <?php echo api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; ?>
             </option>
         <?php
@@ -137,7 +141,9 @@ unset($result);
 		<?php
         foreach ($db_urls as $url_obj) {
             ?>
-			<option value="<?php echo $url_obj['id']; ?>" <?php if (in_array($url_obj['id'], $url_list)) echo 'selected="selected"'; ?>>
+			<option value="<?php echo $url_obj['id']; ?>" <?php if (in_array($url_obj['id'], $url_list)) {
+                echo 'selected="selected"';
+            } ?>>
                 <?php echo $url_obj['url']; ?>
 			</option>
 			<?php

+ 6 - 6
main/admin/access_url_check_user_session.php

@@ -2,9 +2,9 @@
 /* For licensing terms, see /license.txt */
 /**
  * @author Bart Mollet, Julio Montoya lot of fixes
+ *
  * @package chamilo.admin
  */
-
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 
@@ -14,8 +14,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 
 $tool_name = get_lang('SessionOverview');
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'session_list.php', 'name' => get_lang('SessionList'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'session_list.php', 'name' => get_lang('SessionList')];
 
 // Database Table Definitions
 $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
@@ -78,7 +78,7 @@ foreach ($session_list as $session_item) {
             $order_clause";
 
     $result = Database::query($sql);
-    $users  = Database::store_result($result);
+    $users = Database::store_result($result);
 
     if (!empty($users)) {
         $html .= '<table class="data_table"><tr><th>'.get_lang('User').'<th>'.get_lang('Actions').'</th></tr>';
@@ -92,8 +92,8 @@ foreach ($session_list as $session_item) {
             $link_to_add_user_in_url = '';
             if ($multiple_url_is_on) {
                 if ($user['access_url_id'] != $url_id) {
-                    $user_link .= ' '.Display::return_icon('warning.png', get_lang('UserNotAddedInURL'), array(), ICON_SIZE_MEDIUM);
-                    $add = Display::return_icon('add.png', get_lang('AddUsersToURL'), array(), ICON_SIZE_MEDIUM);
+                    $user_link .= ' '.Display::return_icon('warning.png', get_lang('UserNotAddedInURL'), [], ICON_SIZE_MEDIUM);
+                    $add = Display::return_icon('add.png', get_lang('AddUsersToURL'), [], ICON_SIZE_MEDIUM);
                     $link_to_add_user_in_url = '<a href="'.api_get_self().'?'.Security::remove_XSS($_SERVER['QUERY_STRING']).'&action=add_user_to_url&id_session='.$id_session.'&user_id='.$user['user_id'].'">'.$add.'</a>';
                 }
             }

+ 6 - 5
main/admin/access_url_edit.php

@@ -2,6 +2,7 @@
 /* For licensing terms, see /license.txt */
 /**
  * @package chamilo.admin
+ *
  * @author Julio Montoya <gugli100@gmail.com>
  */
 $cidReset = true;
@@ -40,7 +41,7 @@ if ($form->validate()) {
             }
             // URL Images
             $url_images_dir = api_get_path(SYS_PATH).'custompages/url-images/';
-            $image_fields = array("url_image_1", "url_image_2", "url_image_3");
+            $image_fields = ["url_image_1", "url_image_2", "url_image_3"];
             foreach ($image_fields as $image_field) {
                 if ($_FILES[$image_field]['error'] == 0) {
                     // Hardcoded: only PNG files allowed
@@ -81,7 +82,7 @@ if ($form->validate()) {
             $url .= (substr($url, strlen($url) - 1, strlen($url)) == '/') ? '' : '/';
             $url_id = UrlManager::get_url_id($url);
             $url_images_dir = api_get_path(SYS_PATH).'custompages/url-images/';
-            $image_fields = array("url_image_1", "url_image_2", "url_image_3");
+            $image_fields = ["url_image_1", "url_image_2", "url_image_3"];
             foreach ($image_fields as $image_field) {
                 if ($_FILES[$image_field]['error'] == 0) {
                     // Hardcoded: only PNG files allowed
@@ -106,7 +107,7 @@ if ($form->validate()) {
     }
     $token = Security::get_token();
     $form->addElement('hidden', 'sec_token');
-    $form->setConstants(array('sec_token' => $token));
+    $form->setConstants(['sec_token' => $token]);
 }
 
 $form->addElement('text', 'url', 'URL');
@@ -142,8 +143,8 @@ if (!api_is_multiple_url_enabled()) {
 }
 
 $tool_name = get_lang('AddUrl');
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array("url" => 'access_urls.php', "name" => get_lang('MultipleAccessURLs'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ["url" => 'access_urls.php', "name" => get_lang('MultipleAccessURLs')];
 
 Display :: display_header($tool_name);
 

+ 42 - 28
main/admin/access_url_edit_course_category_to_url.php

@@ -3,6 +3,7 @@
 
 /**
  * @package chamilo.admin
+ *
  * @author Julio Montoya <gugli100@gmail.com>
  */
 
@@ -12,7 +13,7 @@ require_once __DIR__.'/../inc/global.inc.php';
 
 $xajax = new xajax();
 $xajax->registerFunction(
-    array('searchCourseCategoryAjax', 'UrlManager', 'searchCourseCategoryAjax')
+    ['searchCourseCategoryAjax', 'UrlManager', 'searchCourseCategoryAjax']
 );
 
 // Setting the section (for the tabs)
@@ -27,8 +28,8 @@ if (!api_get_multiple_access_url()) {
 
 // Setting breadcrumbs
 $tool_name = get_lang('EditUserGroupToURL');
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')];
 
 $add_type = 'multiple';
 if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') {
@@ -72,15 +73,15 @@ function remove_item(origin) {
 </script>';
 
 $form_sent = 0;
-$UserList = $SessionList = array();
-$users = $sessions = array();
+$UserList = $SessionList = [];
+$users = $sessions = [];
 
 if (isset($_POST['form_sent']) && $_POST['form_sent']) {
     $form_sent = $_POST['form_sent'];
     $list = $_POST['course_list'];
 
     if (!is_array($list)) {
-        $list = array();
+        $list = [];
     }
 
     if ($form_sent == 1) {
@@ -99,7 +100,7 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
 Display::display_header($tool_name);
 api_display_tool_title($tool_name);
 
-$noUserGroupList = $userGroupList = array();
+$noUserGroupList = $userGroupList = [];
 $ajax_search = $add_type == 'unique' ? true : false;
 
 if ($ajax_search) {
@@ -119,30 +120,32 @@ if ($ajax_search) {
 }
 
 if ($add_type == 'multiple') {
-	$link_add_type_unique = '<a href="'.api_get_self().'?add_type=unique&access_url_id='.$access_url_id.'">'.
+    $link_add_type_unique = '<a href="'.api_get_self().'?add_type=unique&access_url_id='.$access_url_id.'">'.
         get_lang('SessionAddTypeUnique').'</a>';
-	$link_add_type_multiple = get_lang('SessionAddTypeMultiple');
+    $link_add_type_multiple = get_lang('SessionAddTypeMultiple');
 } else {
-	$link_add_type_unique = get_lang('SessionAddTypeUnique');
-	$link_add_type_multiple = '<a href="'.api_get_self().'?add_type=multiple&access_url_id='.$access_url_id.'">'.
+    $link_add_type_unique = get_lang('SessionAddTypeUnique');
+    $link_add_type_multiple = '<a href="'.api_get_self().'?add_type=multiple&access_url_id='.$access_url_id.'">'.
         get_lang('SessionAddTypeMultiple').'</a>';
 }
 
 $url_list = UrlManager::get_url_data();
 ?>
 <div style="text-align: left;">
-	<?php echo $link_add_type_unique ?>&nbsp;|&nbsp;<?php echo $link_add_type_multiple ?>
+	<?php echo $link_add_type_unique; ?>&nbsp;|&nbsp;<?php echo $link_add_type_multiple; ?>
 </div>
 <br /><br />
 <form
     name="formulaire"
     method="post"
     action="<?php echo api_get_self(); ?>"
-    style="margin:0px;" <?php if ($ajax_search) { echo ' onsubmit="valide();"'; } ?>
+    style="margin:0px;" <?php if ($ajax_search) {
+    echo ' onsubmit="valide();"';
+} ?>
 >
 <?php echo get_lang('SelectUrl').' : '; ?>
 <select name="access_url_id" onchange="javascript:send();">
-<option value="0">-- <?php echo get_lang('SelectUrl')?> -- </option>
+<option value="0">-- <?php echo get_lang('SelectUrl'); ?> -- </option>
 	<?php
     $url_selected = '';
     foreach ($url_list as $url_obj) {
@@ -153,7 +156,8 @@ $url_list = UrlManager::get_url_data();
                 $url_selected = $url_obj[1];
             }
         }
-        if ($url_obj['active'] == 1) { ?>
+        if ($url_obj['active'] == 1) {
+            ?>
             <option <?php echo $checked; ?> value="<?php echo $url_obj[0]; ?>"> <?php echo $url_obj[1]; ?>
             </option>
         <?php
@@ -163,11 +167,11 @@ $url_list = UrlManager::get_url_data();
 </select>
 <br /><br />
 <input type="hidden" name="form_sent" value="1" />
-<input type="hidden" name="add_type" value = "<?php echo $add_type ?>" />
+<input type="hidden" name="add_type" value = "<?php echo $add_type; ?>" />
 <table border="0" cellpadding="5" cellspacing="0" width="100%">
 <!-- Users -->
 <tr>
-  <td align="center"><b><?php echo get_lang('CourseCategoryInPlatform') ?> :</b>
+  <td align="center"><b><?php echo get_lang('CourseCategoryInPlatform'); ?> :</b>
   </td>
   <td></td>
   <td align="center"><b><?php printf(get_lang('CourseCategoryListInX'), $url_selected); ?></b></td>
@@ -176,24 +180,33 @@ $url_list = UrlManager::get_url_data();
 <tr>
   <td align="center">
   <div id="content_source">
-    <?php if ($ajax_search) { ?>
+    <?php if ($ajax_search) {
+    ?>
 		<input type="text" id="course_to_add" onkeyup="xajax_searchCourseCategoryAjax(this.value,document.formulaire.access_url_id.options[document.formulaire.access_url_id.selectedIndex].value)" />
 		<div id="ajax_list_courses"></div>
-    <?php } else { ?>
+    <?php
+} else {
+        ?>
 	  <select id="origin_users" name="no_course_list[]" multiple="multiple" size="15" style="width:380px;">
-		<?php foreach ($noUserGroupList as $noItem) { ?>
+		<?php foreach ($noUserGroupList as $noItem) {
+            ?>
 			<option value="<?php echo $noItem['id']; ?>">
                 <?php echo $noItem['name']; ?>
             </option>
-		<?php } ?>
+		<?php
+        } ?>
 	  </select>
-    <?php } ?>
+    <?php
+    } ?>
   </div>
   </td>
   <td width="10%" valign="middle" align="center">
-  <?php if ($ajax_search) { ?>
+  <?php if ($ajax_search) {
+        ?>
 	<button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('destination_users'))" ></button>
-  <?php } else { ?>
+  <?php
+    } else {
+        ?>
 	<button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('origin_users'), document.getElementById('destination_users'))" >
         <em class="fa fa-arrow-right"></em>
     </button>
@@ -201,19 +214,20 @@ $url_list = UrlManager::get_url_data();
 	<button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('destination_users'), document.getElementById('origin_users'))" >
         <em class="fa fa-arrow-left"></em>
     </button>
-   <?php } ?>
+   <?php
+    } ?>
 	<br /><br /><br /><br /><br /><br />
   </td>
   <td align="center">
   <select id="destination_users" name="course_list[]" multiple="multiple" size="15" style="width:380px;">
 <?php
 foreach ($userGroupList as $item) {
-?>
+        ?>
 	<option value="<?php echo $item['id']; ?>">
         <?php echo $item['name']; ?>
     </option>
 <?php
-}
+    }
 ?>
   </select>
   </td>
@@ -227,7 +241,7 @@ foreach ($userGroupList as $item) {
         } else {
             echo '<button class="save" onclick="valide()" >'.get_lang('Edit').'</button>';
         }
-		?>
+        ?>
 	</td>
 </tr>
 </table>

+ 18 - 17
main/admin/access_url_edit_courses_to_url.php

@@ -3,6 +3,7 @@
 
 /**
  * @package chamilo.admin
+ *
  * @author Julio Montoya <gugli100@gmail.com>
  */
 // resetting the course id
@@ -12,7 +13,7 @@ require_once __DIR__.'/../inc/global.inc.php';
 
 $xajax = new xajax();
 $xajax->registerFunction(
-    array('search_courses', 'Accessurleditcoursestourl', 'search_courses')
+    ['search_courses', 'Accessurleditcoursestourl', 'search_courses']
 );
 
 // setting the section (for the tabs)
@@ -32,8 +33,8 @@ $tbl_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
 
 // setting breadcrumbs
 $tool_name = get_lang('EditCoursesToURL');
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')];
 
 $add_type = 'multiple';
 if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') {
@@ -45,7 +46,7 @@ if (isset($_REQUEST['access_url_id']) && $_REQUEST['access_url_id'] != '') {
     $access_url_id = Security::remove_XSS($_REQUEST['access_url_id']);
 }
 
-$xajax -> processRequests();
+$xajax->processRequests();
 $htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/');
 $htmlHeadXtra[] = '<script>
 function add_user_to_url(code, content) {
@@ -76,15 +77,15 @@ function remove_item(origin) {
 </script>';
 
 $form_sent = 0;
-$UserList = $SessionList = array();
-$users = $sessions = array();
+$UserList = $SessionList = [];
+$users = $sessions = [];
 
 if (isset($_POST['form_sent']) && $_POST['form_sent']) {
     $form_sent = $_POST['form_sent'];
     $course_list = $_POST['course_list'];
 
     if (!is_array($course_list)) {
-        $course_list = array();
+        $course_list = [];
     }
 
     if ($form_sent == 1) {
@@ -111,7 +112,7 @@ echo '</div>';
 
 api_display_tool_title($tool_name);
 
-$no_course_list = $course_list = array();
+$no_course_list = $course_list = [];
 $ajax_search = $add_type == 'unique' ? true : false;
 
 if ($ajax_search) {
@@ -154,13 +155,15 @@ if ($add_type == 'multiple') {
 $url_list = UrlManager::get_url_data();
 ?>
 <div style="text-align: left;">
-    <?php echo $link_add_type_unique ?>&nbsp;|&nbsp;<?php echo $link_add_type_multiple ?>
+    <?php echo $link_add_type_unique; ?>&nbsp;|&nbsp;<?php echo $link_add_type_multiple; ?>
 </div>
 <br /><br />
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?> >
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>" style="margin:0px;" <?php if ($ajax_search) {
+    echo ' onsubmit="valide();"';
+}?> >
     <?php echo get_lang('SelectUrl').' : '; ?>
     <select name="access_url_id" onchange="javascript:send();">
-        <option value="0">-- <?php echo get_lang('SelectUrl')?> -- </option>
+        <option value="0">-- <?php echo get_lang('SelectUrl'); ?> -- </option>
         <?php
         $url_selected = '';
         foreach ($url_list as $url_obj) {
@@ -181,11 +184,11 @@ $url_list = UrlManager::get_url_data();
     </select>
     <br /><br />
     <input type="hidden" name="form_sent" value="1" />
-    <input type="hidden" name="add_type" value = "<?php echo $add_type ?>" />
+    <input type="hidden" name="add_type" value = "<?php echo $add_type; ?>" />
     <table border="0" cellpadding="5" cellspacing="0" width="100%">
         <!-- Users -->
         <tr>
-            <td align="center"><b><?php echo get_lang('CourseListInPlatform') ?> :</b>
+            <td align="center"><b><?php echo get_lang('CourseListInPlatform'); ?> :</b>
             </td>
             <td></td>
             <td align="center"><b><?php echo get_lang('CourseListIn').' '.$url_selected; ?></b></td>
@@ -208,8 +211,7 @@ $url_list = UrlManager::get_url_data();
                                 <option value="<?php echo $no_course['id']; ?>"><?php echo $no_course['title'].' ('.$no_course['code'].')'; ?></option>
                             <?php
                             }
-                            unset($no_course_list);
-                            ?>
+                        unset($no_course_list); ?>
                         </select>
                     <?php
                     }
@@ -242,8 +244,7 @@ $url_list = UrlManager::get_url_data();
                 <select id="destination_users" name="course_list[]" multiple="multiple" size="15" style="width:380px;">
                     <?php
                     foreach ($course_list as $course) {
-                        $courseInfo = api_get_course_info_by_id($course['id']);
-                        ?>
+                        $courseInfo = api_get_course_info_by_id($course['id']); ?>
                         <option value="<?php echo $course['id']; ?>">
                             <?php echo $course['title'].' ('.$courseInfo['code'].')'; ?>
                         </option>

+ 42 - 28
main/admin/access_url_edit_usergroup_to_url.php

@@ -2,6 +2,7 @@
 /* For licensing terms, see /license.txt */
 /**
  * @package chamilo.admin
+ *
  * @author Julio Montoya <gugli100@gmail.com>
  */
 // resetting the course id
@@ -10,7 +11,7 @@ $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 
 $xajax = new xajax();
-$xajax->registerFunction(array('searchUserGroupAjax', 'UserGroup', 'searchUserGroupAjax'));
+$xajax->registerFunction(['searchUserGroupAjax', 'UserGroup', 'searchUserGroupAjax']);
 $userGroup = new UserGroup();
 
 // Setting the section (for the tabs)
@@ -25,8 +26,8 @@ if (!api_get_multiple_access_url()) {
 
 // setting breadcrumbs
 $tool_name = get_lang('EditUserGroupToURL');
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')];
 
 $add_type = 'multiple';
 if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') {
@@ -54,7 +55,7 @@ function add_user_to_url(code, content) {
 function send() {
 	if (document.formulaire.access_url_id.value!=0) {
 		document.formulaire.form_sent.value=0;
-		document.formulaire.add_type.value=\'' . $add_type.'\';
+		document.formulaire.add_type.value=\''.$add_type.'\';
 		document.formulaire.submit();
 	}
 }
@@ -71,15 +72,15 @@ function remove_item(origin) {
 
 $form_sent = 0;
 $errorMsg = '';
-$UserList = $SessionList = array();
-$users = $sessions = array();
+$UserList = $SessionList = [];
+$users = $sessions = [];
 
 if (isset($_POST['form_sent']) && $_POST['form_sent']) {
     $form_sent = $_POST['form_sent'];
     $course_list = $_POST['course_list'];
 
     if (!is_array($course_list)) {
-        $course_list = array();
+        $course_list = [];
     }
 
     if ($form_sent == 1) {
@@ -106,7 +107,7 @@ echo '</div>';
 
 api_display_tool_title($tool_name);
 
-$noUserGroupList = $userGroupList = array();
+$noUserGroupList = $userGroupList = [];
 $ajax_search = $add_type == 'unique' ? true : false;
 
 if ($ajax_search) {
@@ -140,7 +141,7 @@ if ($add_type == 'multiple') {
                 get_lang('SessionAddTypeUnique'),
                 api_get_self().'?'.http_build_query([
                     'add_type' => 'unique',
-                    'access_url_id' => $access_url_id
+                    'access_url_id' => $access_url_id,
                 ]),
                 'file-o',
                 'default',
@@ -150,7 +151,7 @@ if ($add_type == 'multiple') {
                 get_lang('SessionAddTypeMultiple'),
                 api_get_self().'?'.http_build_query([
                     'add_type' => 'multiple',
-                    'access_url_id' => $access_url_id
+                    'access_url_id' => $access_url_id,
                 ]),
                 'files-o',
                 'default',
@@ -167,16 +168,16 @@ $url_list = UrlManager::get_url_data();
         method="post"
         action="<?php echo api_get_self(); ?>"
         style="margin:0px;" <?php if ($ajax_search) {
-        echo ' onsubmit="valide();"';
-    } ?>
+    echo ' onsubmit="valide();"';
+} ?>
     >
         <div class="row">
             <div class="col-xs-2">
-                <label for="access_url_id"><?php echo get_lang('SelectUrl') ?></label>
+                <label for="access_url_id"><?php echo get_lang('SelectUrl'); ?></label>
             </div>
             <div class="col-xs-5">
                 <select name="access_url_id" id="access_url_id" onchange="javascript:send();" class="form-control">
-                    <option value="0">-- <?php echo get_lang('SelectUrl') ?> --</option>
+                    <option value="0">-- <?php echo get_lang('SelectUrl'); ?> --</option>
                     <?php
                     $url_selected = '';
                     foreach ($url_list as $url_obj) {
@@ -187,7 +188,8 @@ $url_list = UrlManager::get_url_data();
                                 $url_selected = $url_obj[1];
                             }
                         }
-                        if ($url_obj['active'] == 1) { ?>
+                        if ($url_obj['active'] == 1) {
+                            ?>
                             <option <?php echo $checked; ?>
                                 value="<?php echo $url_obj[0]; ?>"> <?php echo $url_obj[1]; ?>
                             </option>
@@ -199,7 +201,7 @@ $url_list = UrlManager::get_url_data();
             </div>
         </div>
         <input type="hidden" name="form_sent" value="1"/>
-        <input type="hidden" name="add_type" value="<?php echo $add_type ?>"/>
+        <input type="hidden" name="add_type" value="<?php echo $add_type; ?>"/>
         <?php
         if (!empty($errorMsg)) {
             echo Display::return_message($errorMsg, 'normal'); //main API
@@ -207,29 +209,38 @@ $url_list = UrlManager::get_url_data();
         ?>
         <div class="row">
             <div class="col-sm-5">
-                <label for="<?php echo $ajax_search ? 'course_to_add' : 'origin_users' ?>"><?php echo get_lang('UserGroupListInPlatform') ?></label>
+                <label for="<?php echo $ajax_search ? 'course_to_add' : 'origin_users'; ?>"><?php echo get_lang('UserGroupListInPlatform'); ?></label>
                 <div id="content_source">
-                    <?php if ($ajax_search) { ?>
+                    <?php if ($ajax_search) {
+            ?>
                         <input type="text" id="course_to_add" class="form-control"
                                onkeyup="xajax_searchUserGroupAjax(this.value,document.formulaire.access_url_id.options[document.formulaire.access_url_id.selectedIndex].value)"/>
                         <div id="ajax_list_courses"></div>
-                    <?php } else { ?>
+                    <?php
+        } else {
+            ?>
                         <select id="origin_users" name="no_course_list[]" multiple="multiple" size="15" class="form-control">
-                            <?php foreach ($noUserGroupList as $noItem) { ?>
+                            <?php foreach ($noUserGroupList as $noItem) {
+                ?>
                                 <option value="<?php echo $noItem['id']; ?>"><?php echo $noItem['name']; ?></option>
-                            <?php } ?>
+                            <?php
+            } ?>
                         </select>
-                    <?php } ?>
+                    <?php
+        } ?>
                 </div>
             </div>
             <div class="col-sm-2 text-center">
                 <br><br><br><br>
-                <?php if ($ajax_search) { ?>
+                <?php if ($ajax_search) {
+            ?>
                     <button class="btn btn-default" type="button"
                             onclick="remove_item(document.getElementById('destination_users'))">
                         <em class="fa fa-arrow-left"></em>
                     </button>
-                <?php } else { ?>
+                <?php
+        } else {
+            ?>
                     <button class="btn btn-default" type="button"
                             onclick="moveItem(document.getElementById('origin_users'), document.getElementById('destination_users'))">
                         <em class="fa fa-arrow-right"></em>
@@ -239,16 +250,19 @@ $url_list = UrlManager::get_url_data();
                             onclick="moveItem(document.getElementById('destination_users'), document.getElementById('origin_users'))">
                         <em class="fa fa-arrow-left"></em>
                     </button>
-                <?php } ?>
+                <?php
+        } ?>
             </div>
             <div class="col-sm-5">
                 <label for="destination_users"><?php printf(get_lang('UserGroupListInX'), $url_selected); ?></label>
                 <select id="destination_users" name="course_list[]" multiple="multiple" size="15" class="form-control">
-                    <?php foreach ($userGroupList as $item) { ?>
+                    <?php foreach ($userGroupList as $item) {
+            ?>
                         <option value="<?php echo $item['id']; ?>">
                             <?php echo $item['name']; ?>
                         </option>
-                    <?php } ?>
+                    <?php
+        } ?>
                 </select>
             </div>
         </div>
@@ -256,7 +270,7 @@ $url_list = UrlManager::get_url_data();
             <div class="col-xs-12 text-center">
                 <button class="save btn btn-primary" onclick="valide()">
                     <span class="fa fa-save fa-fw" aria-hidden="true"></span>
-                    <?php echo isset($_GET['add']) ? get_lang('AddUserGroupToURL') : get_lang('EditUserGroupToURL') ?>
+                    <?php echo isset($_GET['add']) ? get_lang('AddUserGroupToURL') : get_lang('EditUserGroupToURL'); ?>
                 </button>
             </div>
         </div>

+ 32 - 25
main/admin/access_url_edit_users_to_url.php

@@ -2,6 +2,7 @@
 /* For licensing terms, see /license.txt */
 /**
  * @package chamilo.admin
+ *
  * @author Julio Montoya <gugli100@gmail.com>
  */
 // resetting the course id
@@ -9,7 +10,7 @@ $cidReset = true;
 
 require_once __DIR__.'/../inc/global.inc.php';
 $xajax = new xajax();
-$xajax->registerFunction(array('search_users', 'AccessUrlEditUsersToUrl', 'search_users'));
+$xajax->registerFunction(['search_users', 'AccessUrlEditUsersToUrl', 'search_users']);
 
 // setting the section (for the tabs)
 $this_section = SECTION_PLATFORM_ADMIN;
@@ -29,8 +30,8 @@ $tbl_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
 
 // setting breadcrumbs
 $tool_name = get_lang('EditUsersToURL');
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')];
 
 $add_type = 'multiple';
 if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') {
@@ -57,7 +58,7 @@ function add_user_to_url(code, content) {
 function send() {
 	if (document.formulaire.access_url_id.value!=0) {
 		document.formulaire.form_sent.value=0;
-		document.formulaire.add_type.value=\'' . $add_type.'\';
+		document.formulaire.add_type.value=\''.$add_type.'\';
 		document.formulaire.submit();
 	}
 }
@@ -74,7 +75,7 @@ function remove_item(origin) {
 
 $form_sent = 0;
 $errorMsg = '';
-$UserList = array();
+$UserList = [];
 $message = '';
 
 if (isset($_POST['form_sent']) && $_POST['form_sent']) {
@@ -82,7 +83,7 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
     $UserList = $_POST['sessionUsersList'];
 
     if (!is_array($UserList)) {
-        $UserList = array();
+        $UserList = [];
     }
     if ($form_sent == 1) {
         if ($access_url_id == 0) {
@@ -99,7 +100,7 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
             if (!empty($result['users_added'])) {
                 $message .= '<h4>'.get_lang('UsersAdded').':</h4>';
                 $i = 1;
-                $user_added_list = array();
+                $user_added_list = [];
                 foreach ($result['users_added'] as $user) {
                     $user_info = api_get_user_info($user);
                     if (!empty($user_info)) {
@@ -114,12 +115,12 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
 
             if (!empty($result['users_deleted'])) {
                 $message .= '<br /><h4>'.get_lang('UsersDeleted').': </h4>';
-                $user_deleted_list = array();
+                $user_deleted_list = [];
                 $i = 1;
                 foreach ($result['users_deleted'] as $user) {
                     $user_info = api_get_user_info($user);
                     if (!empty($user_info)) {
-                        $user_deleted_list [] = $i.'. '.api_get_person_name($user_info['firstname'], $user_info['lastname']);
+                        $user_deleted_list[] = $i.'. '.api_get_person_name($user_info['firstname'], $user_info['lastname']);
                         $i++;
                     }
                 }
@@ -146,7 +147,7 @@ echo '</div>';
 
 api_display_tool_title($tool_name);
 
-$nosessionUsersList = $sessionUsersList = array();
+$nosessionUsersList = $sessionUsersList = [];
 $ajax_search = $add_type == 'unique' ? true : false;
 
 if ($ajax_search) {
@@ -188,7 +189,7 @@ $url_list = UrlManager::get_url_data();
 ?>
 
 <div style="text-align: left;">
-<?php echo $link_add_type_unique ?>&nbsp;|&nbsp;<?php echo $link_add_type_multiple ?>
+<?php echo $link_add_type_unique; ?>&nbsp;|&nbsp;<?php echo $link_add_type_multiple; ?>
 </div>
 <br /><br />
 <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>" style="margin:0px;" <?php if ($ajax_search) {
@@ -196,7 +197,7 @@ $url_list = UrlManager::get_url_data();
 } ?> >
     <?php echo get_lang('SelectUrl').' : '; ?>
 <select name="access_url_id" onchange="javascript:send();">
-<option value="0"> <?php echo get_lang('SelectUrl') ?></option>
+<option value="0"> <?php echo get_lang('SelectUrl'); ?></option>
         <?php
         $url_selected = '';
         foreach ($url_list as $url_obj) {
@@ -217,12 +218,12 @@ $url_list = UrlManager::get_url_data();
 </select>
 <br /><br />
 <input type="hidden" name="form_sent" value="1" />
-<input type="hidden" name="add_type" value = "<?php echo $add_type ?>" />
+<input type="hidden" name="add_type" value = "<?php echo $add_type; ?>" />
 
 <?php
 if (!empty($errorMsg)) {
-    echo Display::return_message($errorMsg, 'normal'); //main API
-}
+            echo Display::return_message($errorMsg, 'normal'); //main API
+        }
 ?>
 
 <table border="0" cellpadding="5" cellspacing="0" width="100%">
@@ -237,7 +238,7 @@ if (!empty($errorMsg)) {
     </td>
 </tr>
 <tr>
-  <td align="center"><b><?php echo get_lang('UserListInPlatform') ?> : <?php echo count($nosessionUsersList); ?></b>
+  <td align="center"><b><?php echo get_lang('UserListInPlatform'); ?> : <?php echo count($nosessionUsersList); ?></b>
   </td>
   <td></td>
   <td align="center"><b><?php echo get_lang('UserListIn').' '.$url_selected; ?> : <?php echo count($sessionUsersList); ?></b></td>
@@ -245,19 +246,21 @@ if (!empty($errorMsg)) {
 <tr>
   <td align="center">
   <div id="content_source">
-    <?php if ($ajax_search) { ?>
+    <?php if ($ajax_search) {
+        ?>
     <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,document.formulaire.access_url_id.options[document.formulaire.access_url_id.selectedIndex].value)" />
     <div id="ajax_list_users"></div>
-    <?php } else { ?>
+    <?php
+    } else {
+        ?>
     <select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:380px;">
     <?php
         foreach ($nosessionUsersList as $enreg) {
-    ?>
+            ?>
     <option value="<?php echo $enreg['user_id']; ?>"><?php echo $enreg['username'].' - '.api_get_person_name($enreg['firstname'], $enreg['lastname']); ?></option>
     <?php
-     }
-    unset($nosessionUsersList);
-    ?>
+        }
+        unset($nosessionUsersList); ?>
     </select>
         <?php
     }
@@ -265,11 +268,14 @@ if (!empty($errorMsg)) {
   </div>
   </td>
   <td width="10%" valign="middle" align="center">
-    <?php if ($ajax_search) { ?>
+    <?php if ($ajax_search) {
+        ?>
         <button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('destination_users'))">
             <em class="fa fa-arrow-left"></em>
         </button>
-    <?php } else { ?>
+    <?php
+    } else {
+        ?>
         <button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('origin_users'), document.getElementById('destination_users'))" >
             <em class="fa fa-arrow-right"></em>
         </button>
@@ -278,7 +284,8 @@ if (!empty($errorMsg)) {
             <em class="fa fa-arrow-left"></em>
 
         </button>
-    <?php } ?>
+    <?php
+    } ?>
 	<br /><br /><br /><br /><br /><br />
   </td>
   <td align="center">

+ 14 - 13
main/admin/access_urls.php

@@ -1,12 +1,13 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
- * Frontend script for multiple access urls
+ * Frontend script for multiple access urls.
+ *
  * @package chamilo.admin
+ *
  * @author Julio Montoya <gugli100@gmail.com>
  * @author Yannick Warnier <yannick.warnier@beeznest.com>
  */
-
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 $this_section = SECTION_PLATFORM_ADMIN;
@@ -19,7 +20,7 @@ if (!api_get_multiple_access_url()) {
     exit;
 }
 
-$interbreadcrumb[] = array("url" => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ["url" => 'index.php', 'name' => get_lang('PlatformAdmin')];
 $tool_name = get_lang('MultipleAccessURLs');
 Display :: display_header($tool_name);
 
@@ -111,38 +112,38 @@ if ($current_access_url_id == -1) {
 // action menu
 echo '<div class="actions">';
 echo Display::url(
-    Display::return_icon('new_link.png', get_lang('AddUrl'), array(), ICON_SIZE_MEDIUM),
+    Display::return_icon('new_link.png', get_lang('AddUrl'), [], ICON_SIZE_MEDIUM),
     api_get_path(WEB_CODE_PATH).'admin/access_url_edit.php'
 );
 echo Display::url(
-    Display::return_icon('user.png', get_lang('ManageUsers'), array(), ICON_SIZE_MEDIUM),
+    Display::return_icon('user.png', get_lang('ManageUsers'), [], ICON_SIZE_MEDIUM),
     api_get_path(WEB_CODE_PATH).'admin/access_url_edit_users_to_url.php'
 );
 echo Display::url(
-    Display::return_icon('course.png', get_lang('ManageCourses'), array(), ICON_SIZE_MEDIUM),
+    Display::return_icon('course.png', get_lang('ManageCourses'), [], ICON_SIZE_MEDIUM),
     api_get_path(WEB_CODE_PATH).'admin/access_url_edit_courses_to_url.php'
 );
 
 $userGroup = new UserGroup();
 if ($userGroup->getUseMultipleUrl()) {
     echo Display::url(
-        Display::return_icon('class.png', get_lang('ManageUserGroup'), array(), ICON_SIZE_MEDIUM),
+        Display::return_icon('class.png', get_lang('ManageUserGroup'), [], ICON_SIZE_MEDIUM),
         api_get_path(WEB_CODE_PATH).'admin/access_url_edit_usergroup_to_url.php'
     );
 }
 
 echo Display::url(
-    Display::return_icon('folder.png', get_lang('ManageCourseCategories'), array(), ICON_SIZE_MEDIUM),
+    Display::return_icon('folder.png', get_lang('ManageCourseCategories'), [], ICON_SIZE_MEDIUM),
     api_get_path(WEB_CODE_PATH).'admin/access_url_edit_course_category_to_url.php'
 );
 
 echo '</div>';
 
 $sortable_data = UrlManager::get_url_data();
-$urls = array();
+$urls = [];
 foreach ($sortable_data as $row) {
     //title
-    $url = Display::url($row['url'], $row['url'], array('target'=>'_blank'));
+    $url = Display::url($row['url'], $row['url'], ['target' => '_blank']);
     $description = $row['description'];
 
     //Status
@@ -164,12 +165,12 @@ foreach ($sortable_data as $row) {
     }
     // Actions
     $url_id = $row['id'];
-    $actions = Display::url(Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), "access_url_edit.php?url_id=$url_id");
+    $actions = Display::url(Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL), "access_url_edit.php?url_id=$url_id");
     if ($url_id != '1') {
         $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;">'.
-            Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
+            Display::return_icon('delete.png', get_lang('Delete'), [], ICON_SIZE_SMALL).'</a>';
     }
-    $urls[] = array($url, $description, $status, $actions);
+    $urls[] = [$url, $description, $status, $actions];
 }
 
 $table = new SortableTableFromArrayConfig($urls, 2, 50, 'urls');

+ 36 - 31
main/admin/add_courses_to_usergroup.php

@@ -1,8 +1,8 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
-*   @package chamilo.admin
-*/
+ *   @package chamilo.admin
+ */
 
 // Resetting the course id.
 $cidReset = true;
@@ -20,8 +20,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 
 // Setting breadcrumbs.
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'usergroups.php', 'name' => get_lang('Classes')];
 
 // Setting the name of the tool.
 $tool_name = get_lang('SubscribeClassToCourses');
@@ -47,7 +47,7 @@ function remove_item(origin) {
 
 $form_sent = 0;
 $errorMsg = '';
-$sessions = array();
+$sessions = [];
 $usergroup = new UserGroup();
 $id = intval($_GET['id']);
 
@@ -55,7 +55,7 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
     $form_sent = $_POST['form_sent'];
     $elements_posted = $_POST['elements_in_name'];
     if (!is_array($elements_posted)) {
-        $elements_posted = array();
+        $elements_posted = [];
     }
     if ($form_sent == 1) {
         $usergroup->subscribe_courses_to_usergroup($id, $elements_posted);
@@ -66,26 +66,26 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
 }
 
 // Filters
-$filters = array(
-    array('type' => 'text', 'name' => 'code', 'label' => get_lang('CourseCode')),
-    array('type' => 'text', 'name' => 'title', 'label' => get_lang('Title'))
-);
+$filters = [
+    ['type' => 'text', 'name' => 'code', 'label' => get_lang('CourseCode')],
+    ['type' => 'text', 'name' => 'title', 'label' => get_lang('Title')],
+];
 
 $searchForm = new FormValidator('search', 'get', api_get_self().'?id='.$id);
 $searchForm->addHeader(get_lang('AdvancedSearch'));
-$renderer = & $searchForm->defaultRenderer();
+$renderer = &$searchForm->defaultRenderer();
 $searchForm->addElement('hidden', 'id', $id);
 foreach ($filters as $param) {
     $searchForm->addElement($param['type'], $param['name'], $param['label']);
 }
 $searchForm->addButtonSearch();
 
-$filterData = array();
+$filterData = [];
 if ($searchForm->validate()) {
     $filterData = $searchForm->getSubmitValues();
 }
 
-$conditions = array();
+$conditions = [];
 if (!empty($filters) && !empty($filterData)) {
     foreach ($filters as $filter) {
         if (isset($filter['name']) && isset($filterData[$filter['name']])) {
@@ -111,7 +111,7 @@ $course_list = CourseManager::get_courses_list(
     $conditions
 );
 
-$elements_not_in = $elements_in = array();
+$elements_not_in = $elements_in = [];
 
 foreach ($course_list_in as $course) {
     $elements_in[$course['id']] = $course['title']." (".$course['visual_code'].")";
@@ -157,6 +157,7 @@ function search($needle, $type)
             $xajax_response->addAssign('ajax_list_multiple', 'innerHTML', api_utf8_encode($return));
         }
     }
+
     return $xajax_response;
 }
 
@@ -175,15 +176,19 @@ if ($add_type == 'multiple') {
 
 echo '<div class="actions">';
 echo '<a href="usergroups.php">';
-echo Display::return_icon('back.png', get_lang('Back'), array(), ICON_SIZE_MEDIUM).'</a>';
-echo Display::url(get_lang('AdvancedSearch'), '#', array('class' => 'advanced_options', 'id' => 'advanced_search'));
+echo Display::return_icon('back.png', get_lang('Back'), [], ICON_SIZE_MEDIUM).'</a>';
+echo Display::url(get_lang('AdvancedSearch'), '#', ['class' => 'advanced_options', 'id' => 'advanced_search']);
 echo '</div>';
 
 echo '<div id="advanced_search_options" style="display:none">';
 $searchForm->display();
 echo '</div>';
 ?>
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?>>
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) {
+    echo '&add=true';
+} ?>" style="margin:0px;" <?php if ($ajax_search) {
+    echo ' onsubmit="valide();"';
+}?>>
 <?php echo '<legend>'.$data['name'].': '.$tool_name.'</legend>';
 echo Display::input('hidden', 'id', $id);
 echo Display::input('hidden', 'form_sent', '1');
@@ -195,47 +200,47 @@ if (!empty($errorMsg)) {
 
 <table border="0" cellpadding="5" cellspacing="0" width="100%">
 <tr>
-  <td align="center"><b><?php echo get_lang('CoursesInPlatform') ?> :</b>
+  <td align="center"><b><?php echo get_lang('CoursesInPlatform'); ?> :</b>
   </td>
   <td></td>
-  <td align="center"><b><?php echo get_lang('CoursesInGroup') ?> :</b></td>
+  <td align="center"><b><?php echo get_lang('CoursesInGroup'); ?> :</b></td>
 </tr>
 
-<?php if ($add_type == 'multiple') { ?>
+<?php if ($add_type == 'multiple') {
+    ?>
 <tr>
 <td align="center">
 <?php echo get_lang('FirstLetterCourseTitle'); ?> :
     <select name="firstLetterUser" onchange = "xajax_search(this.value,'multiple')" >
     <option value = "%">--</option>
     <?php
-    echo Display :: get_alphabet_options();
-    ?>
+    echo Display :: get_alphabet_options(); ?>
     </select>
 </td>
 <td align="center">&nbsp;</td>
 </tr>
-<?php } ?>
+<?php
+} ?>
 <tr>
   <td align="center">
   <div id="content_source">
       <?php
       if (!($add_type == 'multiple')) {
-        ?>
+          ?>
         <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" />
         <div id="ajax_list_users_single"></div>
         <?php
       } else {
-      ?>
+          ?>
       <div id="ajax_list_multiple">
         <?php
         echo Display::select(
             'elements_not_in_name',
             $elements_not_in,
             '',
-            array('style' => 'width:360px', 'multiple' => 'multiple', 'id' => 'elements_not_in', 'size' => '15px'),
+            ['style' => 'width:360px', 'multiple' => 'multiple', 'id' => 'elements_not_in', 'size' => '15px'],
             false
-        );
-        ?>
+        ); ?>
       </div>
     <?php
       }
@@ -245,13 +250,13 @@ if (!empty($errorMsg)) {
   <td width="10%" valign="middle" align="center">
   <?php
   if ($ajax_search) {
-  ?>
+      ?>
     <button class="btn bt-default" type="button" onclick="remove_item(document.getElementById('elements_in'))" >
         <em class="fa fa-arrow-left"></em>
     </button>
   <?php
   } else {
-  ?>
+      ?>
     <button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('elements_not_in'), document.getElementById('elements_in'))" onclick="moveItem(document.getElementById('elements_not_in'), document.getElementById('elements_in'))">
         <em class="fa fa-arrow-right"></em>
     </button>
@@ -270,7 +275,7 @@ echo Display::select(
     'elements_in_name[]',
     $elements_in,
     '',
-    array('style' => 'width:360px', 'multiple' => 'multiple', 'id' => 'elements_in', 'size' => '15px'),
+    ['style' => 'width:360px', 'multiple' => 'multiple', 'id' => 'elements_in', 'size' => '15px'],
     false
 );
 unset($sessionUsersList);

+ 3 - 3
main/admin/add_drh_to_user.php

@@ -1,8 +1,8 @@
 <?php
 /* For licensing terms, see /license.txt */
 
-use Chamilo\UserBundle\Entity\User;
 use Chamilo\CoreBundle\Entity\UserRelUser;
+use Chamilo\UserBundle\Entity\User;
 
 $cidReset = true;
 
@@ -50,14 +50,14 @@ $form->addSelectAjax(
 $form->addButtonSave(get_lang('Send'));
 $form->setDefaults([
     'u' => $user,
-    'hrm' => array_keys($hrmOptions)
+    'hrm' => array_keys($hrmOptions),
 ]);
 
 if ($form->validate()) {
     /** @var UserRelUser $subscribedUser */
     foreach ($subscribedUsers as $subscribedUser) {
         $em->remove($subscribedUser);
-    };
+    }
 
     $em->flush();
 

+ 30 - 27
main/admin/add_sessions_to_promotion.php

@@ -1,8 +1,8 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
-*   @package chamilo.admin
-*/
+ *   @package chamilo.admin
+ */
 // resetting the course id
 $cidReset = true;
 
@@ -19,8 +19,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'career_dashboard.php', 'name' => get_lang('CareersAndPromotions'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'career_dashboard.php', 'name' => get_lang('CareersAndPromotions')];
 
 // Setting the name of the tool
 $tool_name = get_lang('SubscribeSessionsToPromotions');
@@ -64,17 +64,16 @@ function validate_filter() {
 }
 </script>';
 
-
 $form_sent = 0;
 $errorMsg = '';
-$users = $sessions = array();
+$users = $sessions = [];
 $promotion = new Promotion();
 $id = intval($_GET['id']);
 if (isset($_POST['form_sent']) && $_POST['form_sent']) {
     $form_sent = $_POST['form_sent'];
     $session_in_promotion_posted = $_POST['session_in_promotion_name'];
     if (!is_array($session_in_promotion_posted)) {
-        $session_in_promotion_posted = array($session_in_promotion_posted);
+        $session_in_promotion_posted = [$session_in_promotion_posted];
     }
     if ($form_sent == 1) {
         // Added a parameter to send emails when registering a user
@@ -85,8 +84,8 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
 }
 
 $promotion_data = $promotion->get($id);
-$session_list = SessionManager::get_sessions_list(array(), array('name'));
-$session_not_in_promotion = $session_in_promotion = array();
+$session_list = SessionManager::get_sessions_list([], ['name']);
+$session_not_in_promotion = $session_in_promotion = [];
 
 if (!empty($session_list)) {
     foreach ($session_list as $session) {
@@ -123,14 +122,17 @@ echo '<a href="promotions.php">'.Display::return_icon('back.png', get_lang('Back
 echo '</div>';
 ?>
 
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?>>
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) {
+    echo '&add=true';
+} ?>" style="margin:0px;" <?php if ($ajax_search) {
+    echo ' onsubmit="valide();"';
+}?>>
 <?php echo '<legend>'.$tool_name.' '.$promotion_data['name'].'</legend>';
 
-
 if ($add_type == 'multiple') {
     $extraField = new \ExtraField('session');
     $extra_field_list = $extraField->get_all_extra_field_by_type(ExtraField::FIELD_TYPE_SELECT);
-    $new_field_list = array();
+    $new_field_list = [];
     if (is_array($extra_field_list) && (count($extra_field_list) > 0)) {
         echo '<h3>'.get_lang('FilterSessions').'</h3>';
         foreach ($extra_field_list as $new_field) {
@@ -164,39 +166,40 @@ if (!empty($errorMsg)) {
 
 <table border="0" cellpadding="5" cellspacing="0" width="100%">
 <tr>
-  <td align="center"><b><?php echo get_lang('SessionsInPlatform') ?> :</b>
+  <td align="center"><b><?php echo get_lang('SessionsInPlatform'); ?> :</b>
   </td>
   <td></td>
-  <td align="center"><b><?php echo get_lang('SessionsInPromotion') ?> :</b></td>
+  <td align="center"><b><?php echo get_lang('SessionsInPromotion'); ?> :</b></td>
 </tr>
 
-<?php if ($add_type == 'multiple') { ?>
+<?php if ($add_type == 'multiple') {
+    ?>
 <tr>
 <td align="center">
 <?php echo get_lang('FirstLetterSessions'); ?> :
      <select name="firstLetterUser" onchange = "xajax_search_sessions(this.value,'multiple')" >
       <option value = "%">--</option>
       <?php
-        echo Display :: get_alphabet_options();
-      ?>
+        echo Display :: get_alphabet_options(); ?>
      </select>
 </td>
 <td align="center">&nbsp;</td>
 </tr>
-<?php } ?>
+<?php
+} ?>
 <tr>
   <td align="center">
   <div id="content_source">
       <?php
       if (!($add_type == 'multiple')) {
-        ?>
+          ?>
         <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" />
         <div id="ajax_list_users_single"></div>
         <?php
       } else {
-      ?>
+          ?>
       <div id="ajax_list_multiple">
-        <?php echo Display::select('session_not_in_promotion_name', $session_not_in_promotion, '', array('style'=>'width:360px', 'multiple'=>'multiple', 'id'=>'session_not_in_promotion', 'size'=>'15px'), false); ?>
+        <?php echo Display::select('session_not_in_promotion_name', $session_not_in_promotion, '', ['style' => 'width:360px', 'multiple' => 'multiple', 'id' => 'session_not_in_promotion', 'size' => '15px'], false); ?>
       </div>
     <?php
       }
@@ -206,13 +209,13 @@ if (!empty($errorMsg)) {
   <td width="10%" valign="middle" align="center">
   <?php
   if ($ajax_search) {
-  ?>
+      ?>
     <button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('session_in_promotion'))" >
         <em class="fa fa-arrow-left"></em>
     </button>
   <?php
   } else {
-  ?>
+      ?>
     <button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('session_not_in_promotion'), document.getElementById('session_in_promotion'))" onclick="moveItem(document.getElementById('session_not_in_promotion'), document.getElementById('session_in_promotion'))">
         <em class="fa fa-arrow-right"></em>
     </button>
@@ -231,7 +234,7 @@ if (!empty($errorMsg)) {
         'session_in_promotion_name[]',
         $session_in_promotion,
         '',
-        array('style'=>'width:360px', 'multiple'=>'multiple', 'id'=>'session_in_promotion', 'size'=>'15px'),
+        ['style' => 'width:360px', 'multiple' => 'multiple', 'id' => 'session_in_promotion', 'size' => '15px'],
         false
     );
     unset($sessionUsersList);
@@ -332,7 +335,7 @@ function search_sessions($needle, $type)
     $return = '';
     if (!empty($needle) && !empty($type)) {
         $session_list = SessionManager::get_sessions_list(
-            array('s.name' => array('operator' => 'LIKE', 'value' => "$needle%"))
+            ['s.name' => ['operator' => 'LIKE', 'value' => "$needle%"]]
         );
         $return .= '<select id="session_not_in_promotion" name="session_not_in_promotion_name[]" multiple="multiple" size="15" style="width:360px;">';
         foreach ($session_list as $row) {
@@ -341,8 +344,8 @@ function search_sessions($needle, $type)
             }
         }
         $return .= '</select>';
-        $xajax_response -> addAssign('ajax_list_multiple', 'innerHTML', api_utf8_encode($return));
+        $xajax_response->addAssign('ajax_list_multiple', 'innerHTML', api_utf8_encode($return));
     }
 
     return $xajax_response;
-}
+}

+ 37 - 32
main/admin/add_sessions_to_usergroup.php

@@ -1,8 +1,8 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
-*   @package chamilo.admin
-*/
+ *   @package chamilo.admin
+ */
 // resetting the course id
 $cidReset = true;
 
@@ -21,8 +21,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'usergroups.php', 'name' => get_lang('Classes')];
 
 // Database Table Definitions
 
@@ -65,10 +65,10 @@ function remove_item(origin) {
 function display_advanced_search () {
         if ($("#advancedSearch").css("display") == "none") {
                 $("#advancedSearch").css("display","block");
-                $("#img_plus_and_minus").html(\'&nbsp;'.Display::return_icon('div_hide.gif', get_lang('Hide'), array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedSearch').'\');
+                $("#img_plus_and_minus").html(\'&nbsp;'.Display::return_icon('div_hide.gif', get_lang('Hide'), ['style' => 'vertical-align:middle']).'&nbsp;'.get_lang('AdvancedSearch').'\');
         } else {
                 $("#advancedSearch").css("display","none");
-                $("#img_plus_and_minus").html(\'&nbsp;'.Display::return_icon('div_show.gif', get_lang('Show'), array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedSearch').'\');
+                $("#img_plus_and_minus").html(\'&nbsp;'.Display::return_icon('div_show.gif', get_lang('Show'), ['style' => 'vertical-align:middle']).'&nbsp;'.get_lang('AdvancedSearch').'\');
         }
 }
 
@@ -79,17 +79,16 @@ function validate_filter() {
 }
 </script>';
 
-
-$form_sent  = 0;
-$errorMsg   = '';
-$sessions = array();
+$form_sent = 0;
+$errorMsg = '';
+$sessions = [];
 $usergroup = new UserGroup();
 $id = intval($_GET['id']);
 if (isset($_POST['form_sent']) && $_POST['form_sent']) {
-    $form_sent          = $_POST['form_sent'];
-    $elements_posted    = $_POST['elements_in_name'];
+    $form_sent = $_POST['form_sent'];
+    $elements_posted = $_POST['elements_in_name'];
     if (!is_array($elements_posted)) {
-        $elements_posted = array();
+        $elements_posted = [];
     }
     if ($form_sent == 1) {
         //added a parameter to send emails when registering a user
@@ -100,8 +99,8 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
 }
 $data = $usergroup->get($id);
 $session_list_in = $usergroup->get_sessions_by_usergroup($id);
-$session_list = SessionManager::get_sessions_list(array(), array('name'));
-$elements_not_in = $elements_in = array();
+$session_list = SessionManager::get_sessions_list([], ['name']);
+$elements_not_in = $elements_in = [];
 
 if (!empty($session_list)) {
     foreach ($session_list as $session) {
@@ -117,18 +116,19 @@ $ajax_search = $add_type == 'unique' ? true : false;
 
 //checking for extra field with filter on
 
-function search_usergroup_sessions($needle, $type) {
+function search_usergroup_sessions($needle, $type)
+{
     global $elements_in;
     $xajax_response = new xajaxResponse();
     $return = '';
     if (!empty($needle) && !empty($type)) {
         if ($type == 'searchbox') {
             $session_list = SessionManager::get_sessions_list(
-                array('s.name' => array('operator' => 'LIKE', 'value' => "%$needle%"))
+                ['s.name' => ['operator' => 'LIKE', 'value' => "%$needle%"]]
             );
         } elseif ($type != 'single') {
             $session_list = SessionManager::get_sessions_list(
-                array('s.name' => array('operator' => 'LIKE', 'value' => "$needle%"))
+                ['s.name' => ['operator' => 'LIKE', 'value' => "$needle%"]]
             );
         }
         if ($type != 'single') {
@@ -167,12 +167,16 @@ if ($add_type == 'multiple') {
 echo '<div class="actions">';
 echo '<a href="usergroups.php">'.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
 echo '<a href="javascript://" class="advanced_parameters" style="margin-top: 8px" onclick="display_advanced_search();"><span id="img_plus_and_minus">&nbsp;'.
-    Display::return_icon('div_show.gif', get_lang('Show'), array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedSearch').'</span></a>';
+    Display::return_icon('div_show.gif', get_lang('Show'), ['style' => 'vertical-align:middle']).' '.get_lang('AdvancedSearch').'</span></a>';
 echo '</div>';
 echo '<div id="advancedSearch" style="display: none">'.get_lang('SearchSessions'); ?> :
      <input name="SearchSession" onchange = "xajax_search_usergroup_sessions(this.value,'searchbox')" onkeyup="this.onchange()">
      </div>
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?>>
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) {
+    echo '&add=true';
+} ?>" style="margin:0px;" <?php if ($ajax_search) {
+    echo ' onsubmit="valide();"';
+}?>>
 <?php
 echo '<legend>'.$data['name'].': '.$tool_name.'</legend>';
 echo Display::input('hidden', 'id', $id);
@@ -185,40 +189,41 @@ if (!empty($errorMsg)) {
 
 <table border="0" cellpadding="5" cellspacing="0" width="100%">
 <tr>
-  <td align="center"><b><?php echo get_lang('SessionsInPlatform') ?> :</b>
+  <td align="center"><b><?php echo get_lang('SessionsInPlatform'); ?> :</b>
   </td>
   <td></td>
-  <td align="center"><b><?php echo get_lang('SessionsInGroup') ?> :</b></td>
+  <td align="center"><b><?php echo get_lang('SessionsInGroup'); ?> :</b></td>
 </tr>
 
-<?php if ($add_type == 'multiple') { ?>
+<?php if ($add_type == 'multiple') {
+    ?>
 <tr>
 <td align="center">
 <?php echo get_lang('FirstLetterSessions'); ?> :
      <select name="firstLetterUser" onchange = "xajax_search_usergroup_sessions(this.value,'multiple')" >
       <option value = "%">--</option>
       <?php
-        echo Display :: get_alphabet_options();
-      ?>
+        echo Display :: get_alphabet_options(); ?>
      </select>
 <?php echo '<br />'; ?>
 </td>
 <td align="center">&nbsp;</td>
 </tr>
-<?php } ?>
+<?php
+} ?>
 <tr>
   <td align="center">
   <div id="content_source">
       <?php
       if (!($add_type == 'multiple')) {
-        ?>
+          ?>
         <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" />
         <div id="ajax_list_users_single"></div>
         <?php
       } else {
-      ?>
+          ?>
       <div id="ajax_list_multiple">
-        <?php echo Display::select('elements_not_in_name', $elements_not_in, '', array('style'=>'width:360px', 'multiple'=>'multiple', 'id'=>'elements_not_in', 'size'=>'15px'), false); ?>
+        <?php echo Display::select('elements_not_in_name', $elements_not_in, '', ['style' => 'width:360px', 'multiple' => 'multiple', 'id' => 'elements_not_in', 'size' => '15px'], false); ?>
       </div>
     <?php
       }
@@ -228,13 +233,13 @@ if (!empty($errorMsg)) {
   <td width="10%" valign="middle" align="center">
   <?php
   if ($ajax_search) {
-  ?>
+      ?>
     <button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('elements_in'))" >
         <em class="fa fa-arrow-left"></em>
     </button>
   <?php
   } else {
-  ?>
+      ?>
     <button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('elements_not_in'), document.getElementById('elements_in'))" onclick="moveItem(document.getElementById('elements_not_in'), document.getElementById('elements_in'))">
         <em class="fa fa-arrow-right"></em>
     </button>
@@ -249,7 +254,7 @@ if (!empty($errorMsg)) {
   </td>
   <td align="center">
 <?php
-    echo Display::select('elements_in_name[]', $elements_in, '', array('style'=>'width:360px', 'multiple'=>'multiple', 'id'=>'elements_in', 'size'=>'15px'), false);
+    echo Display::select('elements_in_name[]', $elements_in, '', ['style' => 'width:360px', 'multiple' => 'multiple', 'id' => 'elements_in', 'size' => '15px'], false);
     unset($sessionUsersList);
 ?>
  </td>

+ 63 - 57
main/admin/add_users_to_usergroup.php

@@ -2,8 +2,8 @@
 /* For licensing terms, see /license.txt */
 
 /**
-*   @package chamilo.admin
-*/
+ *   @package chamilo.admin
+ */
 
 // resetting the course id
 $cidReset = true;
@@ -18,8 +18,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'usergroups.php', 'name' => get_lang('Classes')];
 
 // Database Table Definitions
 
@@ -90,15 +90,15 @@ function change_select(val) {
 $form_sent = 0;
 
 $extra_field_list = UserManager::get_extra_fields();
-$new_field_list = array();
+$new_field_list = [];
 if (is_array($extra_field_list)) {
     foreach ($extra_field_list as $extra_field) {
         //if is enabled to filter and is a "<select>" field type
         if ($extra_field[8] == 1 && $extra_field[2] == 4) {
-            $new_field_list[] = array(
-                'name'=> $extra_field[3],
-                'variable' => $extra_field[1], 'data'=> $extra_field[9]
-            );
+            $new_field_list[] = [
+                'name' => $extra_field[3],
+                'variable' => $extra_field[1], 'data' => $extra_field[9],
+            ];
         }
     }
 }
@@ -119,7 +119,7 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
     $first_letter_user = $_POST['firstLetterUser'];
 
     if (!is_array($elements_posted)) {
-        $elements_posted = array();
+        $elements_posted = [];
     }
 
     // If "social group" you need to select a role
@@ -144,11 +144,11 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
 if (isset($_GET['action']) && $_GET['action'] == 'export') {
     $users = $usergroup->getUserListByUserGroup($id);
     if (!empty($users)) {
-        $data = array(
-            array('UserName', 'ClassName')
-        );
+        $data = [
+            ['UserName', 'ClassName'],
+        ];
         foreach ($users as $user) {
-            $data[] = array($user['username'], $groupInfo['name']);
+            $data[] = [$user['username'], $groupInfo['name']];
         }
         $filename = 'export_user_class_'.api_get_local_time();
         Export::arrayToCsv($data, $filename);
@@ -176,7 +176,7 @@ if (is_array($extra_field_list)) {
 }
 
 if ($use_extra_fields) {
-    $final_result = array();
+    $final_result = [];
     if (count($extra_field_result) > 1) {
         for ($i = 0; $i < count($extra_field_result) - 1; $i++) {
             if (is_array($extra_field_result[$i + 1])) {
@@ -189,17 +189,17 @@ if ($use_extra_fields) {
 }
 
 // Filters
-$filters = array(
-    array('type' => 'text', 'name' => 'username', 'label' => get_lang('Username')),
-    array('type' => 'text', 'name' => 'firstname', 'label' => get_lang('FirstName')),
-    array('type' => 'text', 'name' => 'lastname', 'label' => get_lang('LastName')),
-    array('type' => 'text', 'name' => 'official_code', 'label' => get_lang('OfficialCode')),
-    array('type' => 'text', 'name' => 'email', 'label' => get_lang('Email'))
-);
+$filters = [
+    ['type' => 'text', 'name' => 'username', 'label' => get_lang('Username')],
+    ['type' => 'text', 'name' => 'firstname', 'label' => get_lang('FirstName')],
+    ['type' => 'text', 'name' => 'lastname', 'label' => get_lang('LastName')],
+    ['type' => 'text', 'name' => 'official_code', 'label' => get_lang('OfficialCode')],
+    ['type' => 'text', 'name' => 'email', 'label' => get_lang('Email')],
+];
 
 $searchForm = new FormValidator('search', 'get', api_get_self().'?id='.$id);
 $searchForm->addHeader(get_lang('AdvancedSearch'));
-$renderer = & $searchForm->defaultRenderer();
+$renderer = &$searchForm->defaultRenderer();
 
 $searchForm->addElement('hidden', 'id', $id);
 foreach ($filters as $param) {
@@ -207,7 +207,7 @@ foreach ($filters as $param) {
 }
 $searchForm->addButtonSearch();
 
-$filterData = array();
+$filterData = [];
 if ($searchForm->validate()) {
     $filterData = $searchForm->getSubmitValues();
 }
@@ -216,17 +216,17 @@ $data = $usergroup->get($id);
 $list_in = $usergroup->getUsersByUsergroupAndRelation($id, $relation);
 $list_all = $usergroup->get_users_by_usergroup();
 
-$order = array('lastname');
+$order = ['lastname'];
 if (api_is_western_name_order()) {
-    $order = array('firstname');
+    $order = ['firstname'];
 }
 
 $orderListByOfficialCode = api_get_setting('order_user_list_by_official_code');
 if ($orderListByOfficialCode === 'true') {
-    $order = array('official_code', 'lastname');
+    $order = ['official_code', 'lastname'];
 }
 
-$conditions = array();
+$conditions = [];
 if (!empty($first_letter_user)) {
     $conditions['lastname'] = $first_letter_user;
 }
@@ -242,8 +242,8 @@ if (!empty($filters) && !empty($filterData)) {
     }
 }
 
-$elements_not_in = $elements_in = array();
-$complete_user_list = UserManager::get_user_list_like(array(), $order);
+$elements_not_in = $elements_in = [];
+$complete_user_list = UserManager::get_user_list_like([], $order);
 
 if (!empty($complete_user_list)) {
     foreach ($complete_user_list as $item) {
@@ -283,7 +283,7 @@ $user_with_any_group = isset($_REQUEST['user_with_any_group']) && !empty($_REQUE
 
 if ($user_with_any_group) {
     $user_list = UserManager::get_user_list_like($conditions, $order, true);
-    $new_user_list = array();
+    $new_user_list = [];
     foreach ($user_list as $item) {
         if (!in_array($item['user_id'], $list_all)) {
             $new_user_list[] = $item;
@@ -332,22 +332,24 @@ Display::display_header($tool_name);
 
 echo '<div class="actions">';
 echo '<a href="usergroups.php">'.
-    Display::return_icon('back.png', get_lang('Back'), array(), ICON_SIZE_MEDIUM).'</a>';
+    Display::return_icon('back.png', get_lang('Back'), [], ICON_SIZE_MEDIUM).'</a>';
 
-echo Display::url(get_lang('AdvancedSearch'), '#', array('class' => 'advanced_options', 'id' => 'advanced_search'));
+echo Display::url(get_lang('AdvancedSearch'), '#', ['class' => 'advanced_options', 'id' => 'advanced_search']);
 
 echo '<a href="usergroup_user_import.php">'.
-    Display::return_icon('import_csv.png', get_lang('Import'), array(), ICON_SIZE_MEDIUM).'</a>';
+    Display::return_icon('import_csv.png', get_lang('Import'), [], ICON_SIZE_MEDIUM).'</a>';
 
 echo '<a href="'.api_get_self().'?id='.$id.'&action=export">'.
-    Display::return_icon('export_csv.png', get_lang('Export'), array(), ICON_SIZE_MEDIUM).'</a>';
+    Display::return_icon('export_csv.png', get_lang('Export'), [], ICON_SIZE_MEDIUM).'</a>';
 echo '</div>';
 
 echo '<div id="advanced_search_options" style="display:none">';
 $searchForm->display();
 echo '</div>';
 ?>
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;">
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) {
+    echo '&add=true';
+} ?>" style="margin:0px;">
 <?php
 echo '<legend>'.$tool_name.': '.$data['name'].'</legend>';
 
@@ -383,24 +385,26 @@ echo Display::input('hidden', 'add_type', null);
 ?>
 <div class="row">
     <div class="col-md-5">
-        <?php if ($data['group_type'] == UserGroup::SOCIAL_CLASS) { ?>
+        <?php if ($data['group_type'] == UserGroup::SOCIAL_CLASS) {
+    ?>
         <select name="relation" id="relation">
-            <option value=""><?php echo get_lang('SelectARelationType')?></option>
-            <option value="<?php echo GROUP_USER_PERMISSION_ADMIN ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_ADMIN) ? 'selected=selected' : '') ?> >
-                <?php echo get_lang('Admin') ?></option>
-            <option value="<?php echo GROUP_USER_PERMISSION_READER ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_READER) ? 'selected=selected' : '') ?> >
-                <?php echo get_lang('Reader') ?></option>
-            <option value="<?php echo GROUP_USER_PERMISSION_PENDING_INVITATION ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_PENDING_INVITATION) ? 'selected=selected' : '') ?> >
-                <?php echo get_lang('PendingInvitation') ?></option>
-            <option value="<?php echo GROUP_USER_PERMISSION_MODERATOR ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_MODERATOR) ? 'selected=selected' : '') ?> >
-                <?php echo get_lang('Moderator') ?></option>
-            <option value="<?php echo GROUP_USER_PERMISSION_HRM ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_HRM) ? 'selected=selected' : '') ?> >
-                <?php echo get_lang('Drh') ?></option>
+            <option value=""><?php echo get_lang('SelectARelationType'); ?></option>
+            <option value="<?php echo GROUP_USER_PERMISSION_ADMIN; ?>" <?php echo (isset($relation) && $relation == GROUP_USER_PERMISSION_ADMIN) ? 'selected=selected' : ''; ?> >
+                <?php echo get_lang('Admin'); ?></option>
+            <option value="<?php echo GROUP_USER_PERMISSION_READER; ?>" <?php echo (isset($relation) && $relation == GROUP_USER_PERMISSION_READER) ? 'selected=selected' : ''; ?> >
+                <?php echo get_lang('Reader'); ?></option>
+            <option value="<?php echo GROUP_USER_PERMISSION_PENDING_INVITATION; ?>" <?php echo (isset($relation) && $relation == GROUP_USER_PERMISSION_PENDING_INVITATION) ? 'selected=selected' : ''; ?> >
+                <?php echo get_lang('PendingInvitation'); ?></option>
+            <option value="<?php echo GROUP_USER_PERMISSION_MODERATOR; ?>" <?php echo (isset($relation) && $relation == GROUP_USER_PERMISSION_MODERATOR) ? 'selected=selected' : ''; ?> >
+                <?php echo get_lang('Moderator'); ?></option>
+            <option value="<?php echo GROUP_USER_PERMISSION_HRM; ?>" <?php echo (isset($relation) && $relation == GROUP_USER_PERMISSION_HRM) ? 'selected=selected' : ''; ?> >
+                <?php echo get_lang('Drh'); ?></option>
         </select>
-        <?php } ?>
+        <?php
+} ?>
 
         <div class="multiple_select_header">
-        <b><?php echo get_lang('UsersInPlatform') ?> :</b>
+        <b><?php echo get_lang('UsersInPlatform'); ?> :</b>
         <?php echo get_lang('FirstLetterUser'); ?> :
         <select id="first_letter_user" name="firstLetterUser" onchange="change_select();">
             <option value = "%">--</option>
@@ -414,18 +418,20 @@ echo Display::input('hidden', 'add_type', null);
         'elements_not_in_name',
         $elements_not_in,
         '',
-        array(
+        [
             'class' => 'form-control',
             'multiple' => 'multiple',
             'id' => 'elements_not_in',
             'size' => '15px',
-        ),
+        ],
         false
     );
     ?>
     <br />
       <label class="control-label">
-          <input type="checkbox" <?php if ($user_with_any_group) echo 'checked="checked"'; ?> onchange="checked_in_no_group(this.checked);" name="user_with_any_group" id="user_with_any_group_id">
+          <input type="checkbox" <?php if ($user_with_any_group) {
+        echo 'checked="checked"';
+    } ?> onchange="checked_in_no_group(this.checked);" name="user_with_any_group" id="user_with_any_group_id">
           <?php echo get_lang('UsersRegisteredInAnyGroup'); ?>
       </label>
     </div>
@@ -442,19 +448,19 @@ echo Display::input('hidden', 'add_type', null);
     </div>
     <div class="col-md-5">
         <div class="multiple_select_header">
-            <b><?php echo get_lang('UsersInGroup') ?> :</b>
+            <b><?php echo get_lang('UsersInGroup'); ?> :</b>
         </div>
     <?php
         echo Display::select(
             'elements_in_name[]',
             $elements_in,
             '',
-            array(
+            [
                 'class' => 'form-control',
                 'multiple' => 'multiple',
                 'id' => 'elements_in',
-                'size' => '15px'
-            ),
+                'size' => '15px',
+            ],
             false
         );
         unset($sessionUsersList);

+ 2 - 2
main/admin/archive_cleanup.php

@@ -16,14 +16,14 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 $form = new FormValidator(
     'archive_cleanup_form',
     'post',
     '',
     '',
-    array(),
+    [],
     FormValidator::LAYOUT_BOX
 );
 $form->addButtonSend(get_lang('ArchiveDirCleanupProceedButton'));

+ 25 - 25
main/admin/career_dashboard.php

@@ -2,10 +2,10 @@
 /* For licensing terms, see /license.txt */
 
 /**
- * Careers dashboard
+ * Careers dashboard.
+ *
  * @package chamilo.admin.career
  */
-
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 
@@ -19,14 +19,14 @@ $this_section = SECTION_PLATFORM_ADMIN;
 $htmlHeadXtra[] = api_get_jqgrid_js();
 
 // setting breadcrumbs
-$interbreadcrumb[] = array(
+$interbreadcrumb[] = [
     'url' => 'index.php',
-    'name' => get_lang('PlatformAdmin')
-);
-$interbreadcrumb[] = array(
+    'name' => get_lang('PlatformAdmin'),
+];
+$interbreadcrumb[] = [
     'url' => 'career_dashboard.php',
-    'name' => get_lang('CareersAndPromotions')
-);
+    'name' => get_lang('CareersAndPromotions'),
+];
 $tpl = new Template(get_lang('CareersAndPromotions'));
 
 $html = null;
@@ -34,17 +34,17 @@ $form = new FormValidator('filter_form', 'GET', api_get_self());
 
 $career = new Career();
 
-$condition = array('status = ?' => 1);
+$condition = ['status = ?' => 1];
 if ($form->validate()) {
     $data = $form->getSubmitValues();
     $filter = intval($data['filter']);
     if (!empty($filter)) {
-        $condition = array('status = ? AND id = ? ' => array(1, $filter));
+        $condition = ['status = ? AND id = ? ' => [1, $filter]];
     }
 }
 
-$careers = $career->get_all(array('status = ?' => 1)); //only status =1
-$career_select_list = array();
+$careers = $career->get_all(['status = ?' => 1]); //only status =1
+$career_select_list = [];
 $career_select_list[0] = ' -- '.get_lang('Select').' --';
 foreach ($careers as $item) {
     $career_select_list[$item['id']] = $item['name'];
@@ -54,7 +54,7 @@ $form->addSelect(
     'filter',
     get_lang('Career'),
     $career_select_list,
-    array('id' => 'filter_1')
+    ['id' => 'filter_1']
 );
 $form->addButtonSearch(get_lang('Filter'));
 
@@ -90,14 +90,14 @@ if (api_is_platform_admin()) {
     );
 }
 
-$actions = Display::toolbarAction('toolbar-career', array($actionLeft));
+$actions = Display::toolbarAction('toolbar-career', [$actionLeft]);
 $html .= $form->returnForm();
 $careers = $career->get_all($condition); //only status =1
 
 $column_count = 3;
 $i = 0;
 $grid_js = '';
-$career_array = array();
+$career_array = [];
 
 if (!empty($careers)) {
     foreach ($careers as $career_item) {
@@ -108,7 +108,7 @@ if (!empty($careers)) {
             'name ASC'
         );
         $career_content = '';
-        $promotion_array = array();
+        $promotion_array = [];
         if (!empty($promotions)) {
             foreach ($promotions as $promotion_item) {
                 if ($promotion_item['status'] == 0) {
@@ -119,30 +119,30 @@ if (!empty($careers)) {
                 $sessions = SessionManager::get_all_sessions_by_promotion(
                     $promotion_item['id']
                 );
-                $session_list = array();
+                $session_list = [];
                 foreach ($sessions as $session_item) {
                     $course_list = SessionManager::get_course_list_by_session_id(
                         $session_item['id']
                     );
-                    $session_list[] = array(
+                    $session_list[] = [
                         'data' => $session_item,
                         'courses' => $course_list,
-                    );
+                    ];
                 }
-                $promotion_array[$promotion_item['id']] = array(
+                $promotion_array[$promotion_item['id']] = [
                     'id' => $promotion_item['id'],
                     'name' => $promotion_item['name'],
                     'sessions' => $session_list,
-                );
+                ];
             }
         }
-        $career_array[$career_item['id']] = array(
+        $career_array[$career_item['id']] = [
             'name' => $career_item['name'],
             'promotions' => $promotion_array,
-        );
-        $careerList = array(
+        ];
+        $careerList = [
             'promotions' => $promotion_array,
-        );
+        ];
         $careers[$career_item['id']]['career'] = $careerList;
     }
 }

+ 9 - 12
main/admin/career_diagram.php

@@ -1,8 +1,6 @@
 <?php
 /* For licensing terms, see /license.txt */
 
-use ChamiloSession as Session;
-
 /**
  *  @package chamilo.admin
  */
@@ -42,30 +40,30 @@ if (empty($careerInfo)) {
 }
 
 // setting breadcrumbs
-$interbreadcrumb[] = array(
+$interbreadcrumb[] = [
     'url' => 'index.php',
     'name' => get_lang('PlatformAdmin'),
-);
-$interbreadcrumb[] = array(
+];
+$interbreadcrumb[] = [
     'url' => 'career_dashboard.php',
     'name' => get_lang('CareersAndPromotions'),
-);
+];
 
-$interbreadcrumb[] = array(
+$interbreadcrumb[] = [
     'url' => 'careers.php',
     'name' => get_lang('Careers'),
-);
+];
 
 $action = isset($_GET['action']) ? $_GET['action'] : '';
 $check = Security::check_token('request');
 $token = Security::get_token();
 
 if ($action == 'add') {
-    $interbreadcrumb[] = array('url' => 'careers.php', 'name' => get_lang('Careers'));
+    $interbreadcrumb[] = ['url' => 'careers.php', 'name' => get_lang('Careers')];
     $toolName = get_lang('Add');
 } elseif ($action == 'edit') {
-    $interbreadcrumb[] = array('url' => 'careers.php', 'name' => get_lang('Careers'));
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit'));
+    $interbreadcrumb[] = ['url' => 'careers.php', 'name' => get_lang('Careers')];
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Edit')];
     $toolName = get_lang('Edit');
 } else {
     $toolName = get_lang('Careers');
@@ -110,7 +108,6 @@ $html = Display::page_subheader2($careerInfo['name'].$urlToString);
 if (!empty($item) && isset($item['value']) && !empty($item['value'])) {
     $graph = unserialize($item['value']);
     $html .= Career::renderDiagram($careerInfo, $graph);
-
 } else {
     Display::addFlash(
         Display::return_message(

+ 19 - 21
main/admin/careers.php

@@ -6,7 +6,6 @@ use ChamiloSession as Session;
 /**
  *  @package chamilo.admin
  */
-
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 
@@ -19,14 +18,14 @@ api_protect_admin_script($allowCareer);
 $htmlHeadXtra[] = api_get_jqgrid_js();
 
 // setting breadcrumbs
-$interbreadcrumb[] = array(
+$interbreadcrumb[] = [
     'url' => 'index.php',
     'name' => get_lang('PlatformAdmin'),
-);
-$interbreadcrumb[] = array(
+];
+$interbreadcrumb[] = [
     'url' => 'career_dashboard.php',
     'name' => get_lang('CareersAndPromotions'),
-);
+];
 
 $action = isset($_GET['action']) ? $_GET['action'] : null;
 
@@ -34,11 +33,11 @@ $check = Security::check_token('request');
 $token = Security::get_token();
 
 if ($action == 'add') {
-    $interbreadcrumb[] = array('url' => 'careers.php', 'name' => get_lang('Careers'));
+    $interbreadcrumb[] = ['url' => 'careers.php', 'name' => get_lang('Careers')];
     $tool_name = get_lang('Add');
 } elseif ($action == 'edit') {
-    $interbreadcrumb[] = array('url' => 'careers.php', 'name' => get_lang('Careers'));
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit'));
+    $interbreadcrumb[] = ['url' => 'careers.php', 'name' => get_lang('Careers')];
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Edit')];
     $tool_name = get_lang('Edit');
 } else {
     $tool_name = get_lang('Careers');
@@ -48,32 +47,32 @@ if ($action == 'add') {
 $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_careers';
 
 //The order is important you need to check the the $column variable in the model.ajax.php file
-$columns = array(get_lang('Name'), get_lang('Description'), get_lang('Actions'));
+$columns = [get_lang('Name'), get_lang('Description'), get_lang('Actions')];
 
 // Column config
-$column_model = array(
-    array(
+$column_model = [
+    [
         'name' => 'name',
         'index' => 'name',
         'width' => '200',
         'align' => 'left',
-    ),
-    array(
+    ],
+    [
         'name' => 'description',
         'index' => 'description',
         'width' => '400',
         'align' => 'left',
         'sortable' => 'false',
-    ),
-    array(
+    ],
+    [
         'name' => 'actions',
         'index' => 'actions',
         'width' => '100',
         'align' => 'left',
         'formatter' => 'action_formatter',
         'sortable' => 'false',
-    ),
-);
+    ],
+];
 //Autowidth
 $extra_params['autowidth'] = 'true';
 //height auto
@@ -100,7 +99,6 @@ if (api_is_platform_admin()) {
     }";
 }
 
-
 $career = new Career();
 $content = '';
 
@@ -140,7 +138,7 @@ switch ($action) {
                 Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
             $content .= '</div>';
             $form->addElement('hidden', 'sec_token');
-            $form->setConstants(array('sec_token' => $token));
+            $form->setConstants(['sec_token' => $token]);
             $content .= $form->returnForm();
         }
         break;
@@ -187,7 +185,7 @@ switch ($action) {
             $content .= '<a href="'.api_get_self().'">'.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
             $content .= '</div>';
             $form->addElement('hidden', 'sec_token');
-            $form->setConstants(array('sec_token' => $token));
+            $form->setConstants(['sec_token' => $token]);
             $content .= $form->returnForm();
         }
         break;
@@ -241,7 +239,7 @@ Display::display_header($tool_name);
             $columns,
             $column_model,
             $extra_params,
-            array(),
+            [],
             $actionLinks,
             true
         );

+ 7 - 6
main/admin/cli.php

@@ -1,11 +1,12 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
-* Used for external support of chamilo's users
-*
-* @author Arnaud Ligot, CBlue SPRL
-* @package chamilo.admin.cli
-*/
+ * Used for external support of chamilo's users.
+ *
+ * @author Arnaud Ligot, CBlue SPRL
+ *
+ * @package chamilo.admin.cli
+ */
 
 // we are in the admin area so we do not need a course id
 $cidReset = true;
@@ -18,7 +19,7 @@ api_protect_admin_script();
 // setting the name of the tool
 $tool_name = get_lang('CommandLineInterpreter');
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 // including the header file (which includes the banner itself)
 Display :: display_header($tool_name);
 switch ($_GET["cmd"]) {

+ 140 - 139
main/admin/configure_extensions.php

@@ -4,14 +4,15 @@
 use Chamilo\CoreBundle\Component\Utils\ChamiloApi;
 
 /**
- * Edition of extensions configuration
+ * Edition of extensions configuration.
+ *
  * @package chamilo.admin
  */
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script();
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 // Database Table Definitions
 $tbl_settings_current = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
 $message = '';
@@ -69,7 +70,7 @@ if (isset($_POST['activeExtension'])) {
     }
 }
 
-$listActiveServices = array();
+$listActiveServices = [];
 
 // get the list of active services
 $sql = 'SELECT variable FROM '.$tbl_settings_current.'
@@ -135,10 +136,10 @@ Display::display_header($nameTool);
 ?>
 <div id="message" style="display: none">
 	<?php
-	if (!empty($message)) {
+    if (!empty($message)) {
         echo Display::return_message($message, 'normal');
     }
-	?>
+    ?>
 </div>
 
 <div id="content" align="center">
@@ -146,12 +147,12 @@ Display::display_header($nameTool);
     <div class="chamilo-rapid">
     <div class="row">
         <div class="col-md-12">
-            <?php echo Display::panel(get_lang('Ppt2lpDescription').' '.get_lang('Ppt2lpVoiceRecordingNeedsRed5'), get_lang('Ppt2lp')) ?>
+            <?php echo Display::panel(get_lang('Ppt2lpDescription').' '.get_lang('Ppt2lpVoiceRecordingNeedsRed5'), get_lang('Ppt2lp')); ?>
         </div>
     </div>
         <div class="row">
             <div class="col-md-5">
-                <?php Display::display_icon('screenshot_ppt2lp.jpg', get_lang('Ppt2lp'), array('class'=>'img-responsive')); ?>
+                <?php Display::display_icon('screenshot_ppt2lp.jpg', get_lang('Ppt2lp'), ['class' => 'img-responsive']); ?>
             </div>
             <div class="col-md-7">
                 <form method="POST" class="form-horizontal" action="<?php echo api_get_self(); ?>">
@@ -171,7 +172,7 @@ Display::display_header($nameTool);
                     $form->addElement('select', 'size', get_lang('SlideSize'), $options);
                     $form->addElement('hidden', 'extension_code', 'ppt2lp');
 
-                    $defaults = array();
+                    $defaults = [];
                     $renderer = $form->defaultRenderer();
                     $renderer->setElementTemplate(
                         '<div style="text-align:left">{label}</div><div style="text-align:left">{element}</div>'
@@ -201,144 +202,144 @@ Display::display_header($nameTool);
         </div>
     </div>
 	<?php
-	/*
-	<!-- EPHORUS -->
-	<div id="main_ephorus">
-		<div id="extension_header_ephorus" class="accordion_header">
-			<a href="#"><?php echo get_lang('EphorusPlagiarismPrevention') ?></a>
-		</div>
-		<div id="extension_content_ephorus" style="display:none;padding:0;width:780px;" class="accordion_content">
-			<table width="100%" cellpadding="0" cellspacing="0">
-				<tr>
-					<td align="center">
-						<TABLE style="WIDTH: 750px" cellSpacing="0" cellPadding="0" align="middle" border="0">
-						<TBODY>
-							<TR>
-								<TD>
-									<TABLE style="WIDTH: 475px" cellSpacing="0" cellPadding="0" border="0">
-									<TBODY>
-										<TR>
-											<TD>
-												&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-												<a title="http://www.ephorus.com/dokeos_activate.html" href="http://www.ephorus.com/dokeos_activate.html" target="_blank">
-												<?php Display::display_icon('ephorus.gif','Ephorus'); ?>
-												</a>
-											</TD>
-											<TD>
-												<P align=center>
-													<FONT color="#669966" size="3"><?php echo get_lang('EphorusLeadersInAntiPlagiarism') ?></FONT>
-												</P>
-											</TD>
-										</TR>
-									</TBODY>
-									</TABLE>
-								</TD>
-							</TR>
-							<TR>
-								<TD>
-									<P>
-										<TABLE style="WIDTH: 85%" cellSpacing="0" cellPadding="0" border="0">
-										<TBODY>
-											<TR>
-												<TD width="50">&nbsp;
+    /*
+    <!-- EPHORUS -->
+    <div id="main_ephorus">
+        <div id="extension_header_ephorus" class="accordion_header">
+            <a href="#"><?php echo get_lang('EphorusPlagiarismPrevention') ?></a>
+        </div>
+        <div id="extension_content_ephorus" style="display:none;padding:0;width:780px;" class="accordion_content">
+            <table width="100%" cellpadding="0" cellspacing="0">
+                <tr>
+                    <td align="center">
+                        <TABLE style="WIDTH: 750px" cellSpacing="0" cellPadding="0" align="middle" border="0">
+                        <TBODY>
+                            <TR>
+                                <TD>
+                                    <TABLE style="WIDTH: 475px" cellSpacing="0" cellPadding="0" border="0">
+                                    <TBODY>
+                                        <TR>
+                                            <TD>
+                                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+                                                <a title="http://www.ephorus.com/dokeos_activate.html" href="http://www.ephorus.com/dokeos_activate.html" target="_blank">
+                                                <?php Display::display_icon('ephorus.gif','Ephorus'); ?>
+                                                </a>
+                                            </TD>
+                                            <TD>
+                                                <P align=center>
+                                                    <FONT color="#669966" size="3"><?php echo get_lang('EphorusLeadersInAntiPlagiarism') ?></FONT>
+                                                </P>
+                                            </TD>
+                                        </TR>
+                                    </TBODY>
+                                    </TABLE>
+                                </TD>
+                            </TR>
+                            <TR>
+                                <TD>
+                                    <P>
+                                        <TABLE style="WIDTH: 85%" cellSpacing="0" cellPadding="0" border="0">
+                                        <TBODY>
+                                            <TR>
+                                                <TD width="50">&nbsp;
 
-												</TD>
-												<TD>
-													<P>
-														<?php echo get_lang('EphorusDescription') ?>
-													</P>
-													<P>
-														<A title="http://www.ephorus.nl/demo_account_en.html" href="http://www.ephorus.nl/demo_account_en.html" target="_blank"><?php echo get_lang('EphorusClickHereForADemoAccount') ?></A>
-													</P>
-													<P>
-														<A title="http://www.ephorus.nl:80/dokeos_activate.html" href="http://www.ephorus.nl/dokeos_activate.html" target="_blank"><?php echo get_lang('EphorusClickHereForInformationsAndPrices') ?></A>.
-													</P>
-												</TD>
-											</TR>
-										</TBODY>
-										</TABLE>
-									</P>
-								</TD>
-							</TR>
-						</TBODY>
-						</TABLE>
+                                                </TD>
+                                                <TD>
+                                                    <P>
+                                                        <?php echo get_lang('EphorusDescription') ?>
+                                                    </P>
+                                                    <P>
+                                                        <A title="http://www.ephorus.nl/demo_account_en.html" href="http://www.ephorus.nl/demo_account_en.html" target="_blank"><?php echo get_lang('EphorusClickHereForADemoAccount') ?></A>
+                                                    </P>
+                                                    <P>
+                                                        <A title="http://www.ephorus.nl:80/dokeos_activate.html" href="http://www.ephorus.nl/dokeos_activate.html" target="_blank"><?php echo get_lang('EphorusClickHereForInformationsAndPrices') ?></A>.
+                                                    </P>
+                                                </TD>
+                                            </TR>
+                                        </TBODY>
+                                        </TABLE>
+                                    </P>
+                                </TD>
+                            </TR>
+                        </TBODY>
+                        </TABLE>
                     </td>
-				</tr>
-			</table>
-		</div>
-	</div>
-	*/
+                </tr>
+            </table>
+        </div>
+    </div>
+    */
     /*
 
-	<!-- SEARCH -->
-	<div id="main_search">
-		<div id="extension_header_search" class="accordion_header">
-			<a href="#"><?php echo get_lang('SearchEngine') ?></a>
-		</div>
-		<div id="extension_content_search" style="display:none" class="accordion_content">
-			<?php echo get_lang('SearchEngineDescription') ?><br /><br />
-			<table width="100%">
-				<tr>
-					<td width="50%">
-						<?php Display::display_icon('screenshot_search.jpg', get_lang('SearchEngine')); ?>
-					</td>
-					<td align="center" width="50%">
-						<form method="POST" action="<?php echo api_get_self(); ?>">
-						<input type="hidden" name="extension_code" value="search" />
-						<button type="submit" class="save" name="activeExtension" value="<?php echo get_lang('ActivateExtension') ?>" ><?php echo get_lang('ActivateExtension') ?></button>
-						</form>
-					</td>
-				</tr>
-			</table>
-		</div>
-	</div>
+    <!-- SEARCH -->
+    <div id="main_search">
+        <div id="extension_header_search" class="accordion_header">
+            <a href="#"><?php echo get_lang('SearchEngine') ?></a>
+        </div>
+        <div id="extension_content_search" style="display:none" class="accordion_content">
+            <?php echo get_lang('SearchEngineDescription') ?><br /><br />
+            <table width="100%">
+                <tr>
+                    <td width="50%">
+                        <?php Display::display_icon('screenshot_search.jpg', get_lang('SearchEngine')); ?>
+                    </td>
+                    <td align="center" width="50%">
+                        <form method="POST" action="<?php echo api_get_self(); ?>">
+                        <input type="hidden" name="extension_code" value="search" />
+                        <button type="submit" class="save" name="activeExtension" value="<?php echo get_lang('ActivateExtension') ?>" ><?php echo get_lang('ActivateExtension') ?></button>
+                        </form>
+                    </td>
+                </tr>
+            </table>
+        </div>
+    </div>
 
-	<!-- SERVER STATS -->
-	<div id="main_serverstats">
-		<div id="extension_header_serverstats" class="accordion_header">
-			<a href="#"><?php echo get_lang('ServerStatistics') ?></a>
-		</div>
-		<div id="extension_content_serverstats" style="display:none" class="accordion_content">
-			<?php echo get_lang('ServerStatisticsDescription') ?><br /><br />
-			<table width="100%">
-				<tr>
-					<td width="50%">
-						<?php Display::display_icon('screenshot_serverstats.jpg', get_lang('ServerStatistics')); ?>
-					</td>
-					<td align="center" width="50%">
-						<form method="POST" action="<?php echo api_get_self(); ?>">
-						<input type="hidden" name="extension_code" value="serverstats" />
-						<button type="submit" class="save" name="activeExtension" value="<?php echo get_lang('ActivateExtension') ?>" ><?php echo get_lang('ActivateExtension') ?></button>
-						</form>
-					</td>
-				</tr>
-			</table>
-		</div>
-	</div>
+    <!-- SERVER STATS -->
+    <div id="main_serverstats">
+        <div id="extension_header_serverstats" class="accordion_header">
+            <a href="#"><?php echo get_lang('ServerStatistics') ?></a>
+        </div>
+        <div id="extension_content_serverstats" style="display:none" class="accordion_content">
+            <?php echo get_lang('ServerStatisticsDescription') ?><br /><br />
+            <table width="100%">
+                <tr>
+                    <td width="50%">
+                        <?php Display::display_icon('screenshot_serverstats.jpg', get_lang('ServerStatistics')); ?>
+                    </td>
+                    <td align="center" width="50%">
+                        <form method="POST" action="<?php echo api_get_self(); ?>">
+                        <input type="hidden" name="extension_code" value="serverstats" />
+                        <button type="submit" class="save" name="activeExtension" value="<?php echo get_lang('ActivateExtension') ?>" ><?php echo get_lang('ActivateExtension') ?></button>
+                        </form>
+                    </td>
+                </tr>
+            </table>
+        </div>
+    </div>
 
-	<!-- BANDWIDTH STATS -->
-	<div id="main_bandwidthstats">
-		<div id="extension_header_bandwidthstats" class="accordion_header">
-			<a href="#"><?php echo get_lang('BandWidthStatistics') ?></a>
-		</div>
-		<div id="extension_content_bandwidthstats" style="display:none" class="accordion_content">
-			<?php echo get_lang('BandWidthStatisticsDescription') ?><br /><br />
-			<table width="100%">
-				<tr>
-					<td width="50%">
-						<?php Display::display_icon('screenshot_bandwidth.jpg', get_lang('BandWidthStatistics')); ?>
-					</td>
-					<td align="center" width="50%">
-						<form method="POST" action="<?php echo api_get_self(); ?>">
-						<input type="hidden" name="extension_code" value="bandwidthstats" />
-						<button type="submit" class="save" name="activeExtension" value="<?php echo get_lang('ActivateExtension') ?>" ><?php echo get_lang('ActivateExtension') ?></button>
-						</form>
+    <!-- BANDWIDTH STATS -->
+    <div id="main_bandwidthstats">
+        <div id="extension_header_bandwidthstats" class="accordion_header">
+            <a href="#"><?php echo get_lang('BandWidthStatistics') ?></a>
+        </div>
+        <div id="extension_content_bandwidthstats" style="display:none" class="accordion_content">
+            <?php echo get_lang('BandWidthStatisticsDescription') ?><br /><br />
+            <table width="100%">
+                <tr>
+                    <td width="50%">
+                        <?php Display::display_icon('screenshot_bandwidth.jpg', get_lang('BandWidthStatistics')); ?>
+                    </td>
+                    <td align="center" width="50%">
+                        <form method="POST" action="<?php echo api_get_self(); ?>">
+                        <input type="hidden" name="extension_code" value="bandwidthstats" />
+                        <button type="submit" class="save" name="activeExtension" value="<?php echo get_lang('ActivateExtension') ?>" ><?php echo get_lang('ActivateExtension') ?></button>
+                        </form>
 
-					</td>
-				</tr>
-			</table>
-		</div>
-	</div>
+                    </td>
+                </tr>
+            </table>
+        </div>
+    </div>
      */ ?>
 </div><!-- /content -->
 

+ 43 - 45
main/admin/configure_homepage.php

@@ -2,12 +2,13 @@
 /* For licensing terms, see /license.txt */
 
 /**
- * Configure the portal homepage (manages multi-urls and languages)
+ * Configure the portal homepage (manages multi-urls and languages).
+ *
  * @package chamilo.admin
  */
 
 /**
- * Creates menu tabs for logged and anonymous users
+ * Creates menu tabs for logged and anonymous users.
  *
  * This function copies the file containing private a public tabs (home_tabs_logged_in_$language.html)
  * in to the public tab template (home_tabs_$language.html) but without the private tabs.
@@ -21,8 +22,8 @@ function home_tabs($file_logged_in)
     if ($post !== false) {
         $file_logged_out = str_replace('_logged_in', '', $file_logged_in);
         //variables initialization
-        $data_logged_out = array();
-        $data_logged_in = array();
+        $data_logged_out = [];
+        $data_logged_in = [];
 
         //we read the file with all links
         $file = file($file_logged_in);
@@ -72,16 +73,16 @@ $tbl_category = Database::get_main_table(TABLE_MAIN_CATEGORY);
 $tool_name = get_lang('ConfigureHomePage');
 $_languages = api_get_languages();
 $selfUrl = api_get_self();
-$interbreadcrumb[] = array(
+$interbreadcrumb[] = [
     'url' => 'index.php',
-    'name' => get_lang('PlatformAdmin')
-);
+    'name' => get_lang('PlatformAdmin'),
+];
 
 if (!empty($action)) {
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = [
         'url' => 'configure_homepage.php',
-        'name' => get_lang('ConfigureHomePage')
-    );
+        'name' => get_lang('ConfigureHomePage'),
+    ];
 
     switch ($action) {
         case 'edit_top':
@@ -170,7 +171,7 @@ $menutabs = 'home_tabs'; //menutabs for tabs Menu
 $mtloggedin = 'home_tabs_logged_in'; //menutabs for tabs Menu
 $ext = '.html'; //ext for HTML Extension - when used frequently, variables are
 // faster than hardcoded strings
-$homef = array($menuf, $newsf, $topf, $noticef, $menutabs, $mtloggedin);
+$homef = [$menuf, $newsf, $topf, $noticef, $menutabs, $mtloggedin];
 
 // If language-specific file does not exist, create it by copying default file
 foreach ($homef as $my_file) {
@@ -220,7 +221,6 @@ if (!empty($action)) {
                 // Filter
                 $home_top = trim(stripslashes($_POST['home_top']));
 
-
                 // Write
                 if (is_writable($homep)) {
                     // Default
@@ -260,7 +260,7 @@ if (!empty($action)) {
                 }
 
                 if (EventsMail::check_if_using_class('portal_homepage_edited')) {
-                    EventsDispatcher::events('portal_homepage_edited', array('about_user' => api_get_user_id()));
+                    EventsDispatcher::events('portal_homepage_edited', ['about_user' => api_get_user_id()]);
                 }
                 Event::addEvent(
                     LOG_HOMEPAGE_CHANGED,
@@ -273,7 +273,7 @@ if (!empty($action)) {
             case 'edit_notice':
                 // Filter
                 $notice_title = trim(strip_tags(stripslashes($_POST['notice_title'])));
-                $notice_text = trim(str_replace(array("\r", "\n"), array('', '<br />'), strip_tags(stripslashes($_POST['notice_text']), '<a>')));
+                $notice_text = trim(str_replace(["\r", "\n"], ['', '<br />'], strip_tags(stripslashes($_POST['notice_text']), '<a>')));
                 if (empty($notice_title) || empty($notice_text)) {
                     $errorMsg = get_lang('NoticeWillBeNotDisplayed');
                 }
@@ -453,7 +453,7 @@ if (!empty($action)) {
                     }
                     // If the requested action is to edit a link, open the file and
                     // write to it (if the file doesn't exist, create it)
-                    if (in_array($action, array('edit_link')) && !empty($link_html)) {
+                    if (in_array($action, ['edit_link']) && !empty($link_html)) {
                         $fp = @fopen($homep.$filename, 'w');
                         if ($fp) {
                             fputs($fp, $link_html);
@@ -563,7 +563,7 @@ if (!empty($action)) {
                 $menuf = ($action == 'delete_tabs') ? $mtloggedin : $menuf;
                 $home_menu = @file($homep.$menuf.'_'.$lang.$ext);
                 if (empty($home_menu)) {
-                    $home_menu = array();
+                    $home_menu = [];
                 }
                 foreach ($home_menu as $key => $enreg) {
                     if ($key == $link_index) {
@@ -613,7 +613,7 @@ if (!empty($action)) {
                     $errorMsg = get_lang('HomePageFilesNotReadable');
                 }
                 if (empty($home_notice)) {
-                    $home_notice = array();
+                    $home_notice = [];
                 }
                 $notice_title = strip_tags($home_notice[0]);
                 $notice_title = api_to_system_encoding($notice_title, api_detect_encoding($notice_title));
@@ -644,7 +644,7 @@ if (!empty($action)) {
                     $errorMsg = get_lang('HomePageFilesNotReadable');
                 }
                 if (empty($home_menu)) {
-                    $home_menu = array();
+                    $home_menu = [];
                 }
                 if (!empty($home_menu)) {
                     $home_menu = implode("\n", $home_menu);
@@ -666,7 +666,7 @@ if (!empty($action)) {
                     $errorMsg = get_lang('HomePageFilesNotReadable');
                 }
                 if (empty($home_menu)) {
-                    $home_menu = array();
+                    $home_menu = [];
                 }
                 if (!empty($home_menu)) {
                     $home_menu = implode("\n", $home_menu);
@@ -695,7 +695,7 @@ if (!empty($action)) {
                 }
 
                 if (empty($home_menu)) {
-                    $home_menu = array();
+                    $home_menu = [];
                 }
                 if (!empty($home_menu)) {
                     $home_menu = implode("\n", $home_menu);
@@ -724,7 +724,6 @@ if (!empty($action)) {
 
                 // For each line of the home_menu file
                 foreach ($home_menu as $key => $enreg) {
-
                     // Check if the current item is the one we want to update
                     if ($key == $link_index) {
                         // This is the link we want to update
@@ -849,24 +848,24 @@ switch ($action) {
         if (!empty($errorMsg)) {
             echo Display::return_message($errorMsg, 'normal');
         }
-        $default = array();
-        $form = new FormValidator('configure_homepage_'.$action, 'post', $selfUrl.'?action='.$action, '', array('style' => 'margin: 0px;'));
-        $renderer = & $form->defaultRenderer();
+        $default = [];
+        $form = new FormValidator('configure_homepage_'.$action, 'post', $selfUrl.'?action='.$action, '', ['style' => 'margin: 0px;']);
+        $renderer = &$form->defaultRenderer();
 
         $form->addElement('header', '', $tool_name);
         $form->addElement('hidden', 'formSent', '1');
         $form->addElement('hidden', 'link_index', ($action == 'edit_link' || $action == 'edit_tabs') ? $link_index : '0');
         $form->addElement('hidden', 'filename', ($action == 'edit_link' || $action == 'edit_tabs') ? (!empty($filename) ? $filename : '') : '');
 
-        $form->addElement('text', 'link_name', get_lang('LinkName'), array('size' => '30', 'maxlength' => '50'));
+        $form->addElement('text', 'link_name', get_lang('LinkName'), ['size' => '30', 'maxlength' => '50']);
         if (!empty($link_name)) {
             $default['link_name'] = $link_name;
         }
         $default['link_url'] = empty($link_url) ? 'http://' : api_htmlentities($link_url, ENT_QUOTES);
         $linkUrlComment = ($action == 'insert_tabs') ? get_lang('Optional').'<br />'.get_lang('GlobalLinkUseDoubleColumnPrivateToShowPrivately') : '';
-        $form->addElement('text', 'link_url', array(get_lang('LinkURL'), $linkUrlComment), array('size' => '30', 'maxlength' => '100', 'style' => 'width: 350px;'));
+        $form->addElement('text', 'link_url', [get_lang('LinkURL'), $linkUrlComment], ['size' => '30', 'maxlength' => '100', 'style' => 'width: 350px;']);
 
-        $options = array('-1' => get_lang('FirstPlace'));
+        $options = ['-1' => get_lang('FirstPlace')];
 
         $selected = '';
 
@@ -898,15 +897,14 @@ switch ($action) {
 
         if ($action == 'edit_link' && (empty($link_url) || $link_url == 'http://' || $link_url == 'https://')) {
             $default['link_html'] = isset($_POST['link_html']) ? $_POST['link_html'] : $link_html;
-            $form->addHtmlEditor('link_html', get_lang('Content'), false, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400'));
+            $form->addHtmlEditor('link_html', get_lang('Content'), false, false, ['ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400']);
             $form->addButtonSave(get_lang('Save'), 'submit');
-
         } else {
-            if (in_array($action, array('edit_tabs', 'insert_tabs'))) {
+            if (in_array($action, ['edit_tabs', 'insert_tabs'])) {
                 $default['link_html'] = isset($_POST['link_html']) ? $_POST['link_html'] : (!empty($link_html) ? $link_html : '');
-                $form->addHtmlEditor('link_html', get_lang('Content'), false, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400'));
+                $form->addHtmlEditor('link_html', get_lang('Content'), false, false, ['ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400']);
             }
-            $form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'), array('id' => 'all_langs'));
+            $form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'), ['id' => 'all_langs']);
             $form->addElement('html', '<table id="table_langs" style="margin-left:159px;"><tr>');
             $i = 0;
             foreach ($_languages['name'] as $key => $value) {
@@ -943,15 +941,15 @@ switch ($action) {
             echo Display::return_message($errorMsg, 'normal'); //main API
         }
 
-        $default = array();
+        $default = [];
         $form = new FormValidator(
             'configure_homepage_'.$action,
             'post',
             $selfUrl.'?action='.$action,
             '',
-            array('style' => 'margin: 0px;')
+            ['style' => 'margin: 0px;']
         );
-        $renderer = & $form->defaultRenderer();
+        $renderer = &$form->defaultRenderer();
         $renderer->setHeaderTemplate('');
         $renderer->setFormTemplate('<form{attributes}><table border="0" cellpadding="5" cellspacing="0" width="100%">{content}</table></form>');
         $renderer->setCustomElementTemplate('<tr><td>{element}</td></tr>');
@@ -976,8 +974,8 @@ switch ($action) {
         }
 
         $default[$name] = str_replace('{rel_path}', api_get_path(REL_PATH), $open);
-        $form->addHtmlEditor($name, '', true, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400'));
-        $form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'), array('id' => 'all_langs'));
+        $form->addHtmlEditor($name, '', true, false, ['ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400']);
+        $form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'), ['id' => 'all_langs']);
         $form->addElement('html', '<table id="table_langs" style="margin-left:5px;"><tr>');
 
         $currentLanguage = api_get_interface_language();
@@ -1047,7 +1045,7 @@ switch ($action) {
                                        href="#notice-list" aria-expanded="true" aria-controls="notice-list">
                                         <?php echo get_lang('Notice'); ?>
                                         <a class="pull-right"
-                                           href="<?php echo $selfUrl; ?>?action=edit_notice"><?php Display::display_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL); ?></a>
+                                           href="<?php echo $selfUrl; ?>?action=edit_notice"><?php Display::display_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL); ?></a>
                                     </a>
                                 </h4>
                             </div>
@@ -1097,7 +1095,7 @@ switch ($action) {
                                             $home_menu = @file($homep.$menuf.$ext);
                                         }
                                         if (empty($home_menu)) {
-                                            $home_menu = array();
+                                            $home_menu = [];
                                         }
                                         if (!empty($home_menu)) {
                                             $home_menu = implode("\n", $home_menu);
@@ -1110,7 +1108,7 @@ switch ($action) {
                                             if (!empty($enreg)) {
                                                 $edit_link = '<a href="'.$selfUrl.'?action=edit_link&amp;link_index='.$i.'">'.Display::return_icon('edit.png', get_lang('Edit')).'</a>';
                                                 $delete_link = '<a href="'.$selfUrl.'?action=delete_link&amp;link_index='.$i.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;">'.Display::return_icon('delete.png', get_lang('Delete')).'</a>';
-                                                echo str_replace(array('href="'.api_get_path(WEB_PATH).'index.php?include=', '</li>'), array('href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename($selfUrl).'?action=open_link&link=', $edit_link.' '.$delete_link.'</li>'), $enreg);
+                                                echo str_replace(['href="'.api_get_path(WEB_PATH).'index.php?include=', '</li>'], ['href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename($selfUrl).'?action=open_link&link=', $edit_link.' '.$delete_link.'</li>'], $enreg);
                                                 $i++;
                                             }
                                         }
@@ -1196,7 +1194,7 @@ switch ($action) {
                         }
                     }
                     if (empty($home_menu)) {
-                        $home_menu = array();
+                        $home_menu = [];
                     }
                     if (!empty($home_menu)) {
                         $home_menu = implode("\n", $home_menu);
@@ -1211,13 +1209,13 @@ switch ($action) {
                             $edit_link = ' <a href="'.$selfUrl.'?action=edit_tabs&amp;link_index='.$tab_counter.'" ><span>'.Display::return_icon('edit.png', get_lang('Edit')).'</span></a>';
                             $delete_link = ' <a href="'.$selfUrl.'?action=delete_tabs&amp;link_index='.$tab_counter.'"  onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;"><span>'.Display::return_icon('delete.png', get_lang('Delete')).'</span></a>';
                             $tab_string = str_replace(
-                                array('href="'.api_get_path(WEB_PATH).'index.php?include=', '</li>'),
-                                array('href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename($selfUrl).'?action=open_link&link=', $edit_link.$delete_link.'</li>'),
+                                ['href="'.api_get_path(WEB_PATH).'index.php?include=', '</li>'],
+                                ['href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename($selfUrl).'?action=open_link&link=', $edit_link.$delete_link.'</li>'],
                                 $enreg
                             );
                             $tab_string = str_replace([' class="hide_menu"', ' class="show_menu"'], '', $tab_string);
-                            $tab_string = str_replace(array('<li>', '</li>'), '', $tab_string);
-                            $link_list .= Display::tag('li', $tab_string, array('class' => 'list-group-item'));
+                            $tab_string = str_replace(['<li>', '</li>'], '', $tab_string);
+                            $link_list .= Display::tag('li', $tab_string, ['class' => 'list-group-item']);
                             $tab_counter++;
                         }
                     }

+ 28 - 28
main/admin/configure_inscription.php

@@ -3,6 +3,7 @@
 
 /**
  *	This script displays a form for registering new users.
+ *
  *	@package	 chamilo.admin
  */
 $cidReset = true;
@@ -42,10 +43,10 @@ if (api_get_setting('allow_terms_conditions') == 'true') {
 
 $action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : null;
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 $tool_name = get_lang('ConfigureInscription');
 if (!empty($action)) {
-    $interbreadcrumb[] = array('url' => 'configure_inscription.php', 'name' => get_lang('ConfigureInscription'));
+    $interbreadcrumb[] = ['url' => 'configure_inscription.php', 'name' => get_lang('ConfigureInscription')];
     switch ($action) {
         case 'edit_top':
             $tool_name = get_lang('EditTopRegister');
@@ -73,7 +74,6 @@ if (api_is_multiple_url_enabled()) {
         $clean_url = str_replace('/', '-', $clean_url);
         $clean_url .= '/';
 
-
         $homep = api_get_path(SYS_APP_PATH).'home/'; //homep for Home Path
         $homep_new = api_get_path(SYS_APP_PATH).'home/'.$clean_url; //homep for Home Path added the url
         $new_url_dir = api_get_path(SYS_APP_PATH).'home/'.$clean_url;
@@ -89,7 +89,7 @@ if (api_is_multiple_url_enabled()) {
 
 $topf = 'register_top'; //topf for Top File
 $ext = '.html'; //ext for HTML Extension - when used frequently, variables are
-$homef = array($topf);
+$homef = [$topf];
 
 // If language-specific file does not exist, create it by copying default file
 foreach ($homef as $my_file) {
@@ -182,12 +182,12 @@ if (api_get_setting('allow_terms_conditions') === 'true') {
 if ($display_all_form) {
     if (api_is_western_name_order()) {
         //	FIRST NAME and LAST NAME
-        $form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40, 'disabled' => 'disabled'));
-        $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40, 'disabled' => 'disabled'));
+        $form->addElement('text', 'firstname', get_lang('FirstName'), ['size' => 40, 'disabled' => 'disabled']);
+        $form->addElement('text', 'lastname', get_lang('LastName'), ['size' => 40, 'disabled' => 'disabled']);
     } else {
         //	LAST NAME and FIRST NAME
-        $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40, 'disabled' => 'disabled'));
-        $form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40, 'disabled' => 'disabled'));
+        $form->addElement('text', 'lastname', get_lang('LastName'), ['size' => 40, 'disabled' => 'disabled']);
+        $form->addElement('text', 'firstname', get_lang('FirstName'), ['size' => 40, 'disabled' => 'disabled']);
     }
     $form->applyFilter('firstname', 'trim');
     $form->applyFilter('lastname', 'trim');
@@ -195,32 +195,32 @@ if ($display_all_form) {
     $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
 
     //	EMAIL
-    $form->addElement('text', 'email', get_lang('Email'), array('size' => 40, 'disabled' => 'disabled'));
+    $form->addElement('text', 'email', get_lang('Email'), ['size' => 40, 'disabled' => 'disabled']);
     if (api_get_setting('registration', 'email') == 'true') {
         $form->addRule('email', get_lang('ThisFieldIsRequired'), 'required');
     }
     $form->addRule('email', get_lang('EmailWrong'), 'email');
     if (api_get_setting('openid_authentication') == 'true') {
-        $form->addElement('text', 'openid', get_lang('OpenIDURL'), array('size' => 40, 'disabled' => 'disabled'));
+        $form->addElement('text', 'openid', get_lang('OpenIDURL'), ['size' => 40, 'disabled' => 'disabled']);
     }
 
     //	USERNAME
-    $form->addElement('text', 'username', get_lang('UserName'), array('size' => USERNAME_MAX_LENGTH, 'disabled' => 'disabled'));
+    $form->addElement('text', 'username', get_lang('UserName'), ['size' => USERNAME_MAX_LENGTH, 'disabled' => 'disabled']);
     $form->addRule('username', get_lang('ThisFieldIsRequired'), 'required');
     $form->addRule('username', get_lang('UsernameWrong'), 'username');
     $form->addRule('username', get_lang('UserTaken'), 'username_available');
     $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
 
     //	PASSWORD
-    $form->addElement('password', 'pass1', get_lang('Pass'), array('size' => 40, 'disabled' => 'disabled'));
-    $form->addElement('password', 'pass2', get_lang('Confirmation'), array('size' => 40, 'disabled' => 'disabled'));
+    $form->addElement('password', 'pass1', get_lang('Pass'), ['size' => 40, 'disabled' => 'disabled']);
+    $form->addElement('password', 'pass2', get_lang('Confirmation'), ['size' => 40, 'disabled' => 'disabled']);
     $form->addRule('pass1', get_lang('ThisFieldIsRequired'), 'required');
     $form->addRule('pass2', get_lang('ThisFieldIsRequired'), 'required');
-    $form->addRule(array('pass1', 'pass2'), get_lang('PassTwo'), 'compare');
+    $form->addRule(['pass1', 'pass2'], get_lang('PassTwo'), 'compare');
     $form->addPasswordRule('pass1');
 
     //	PHONE
-    $form->addElement('text', 'phone', get_lang('Phone'), array('size' => 40, 'disabled' => 'disabled'));
+    $form->addElement('text', 'phone', get_lang('Phone'), ['size' => 40, 'disabled' => 'disabled']);
     if (api_get_setting('registration', 'phone') == 'true') {
         $form->addRule('phone', get_lang('ThisFieldIsRequired'), 'required');
     }
@@ -231,39 +231,39 @@ if ($display_all_form) {
             'language',
             get_lang('Language'),
             '',
-            array('disabled' => 'disabled')
+            ['disabled' => 'disabled']
         );
     }
 
     //	STUDENT/TEACHER
     if (api_get_setting('allow_registration_as_teacher') != 'false') {
-        $form->addElement('radio', 'status', get_lang('Status'), get_lang('RegStudent'), STUDENT, array('disabled' => 'disabled'));
-        $form->addElement('radio', 'status', null, get_lang('RegAdmin'), COURSEMANAGER, array('disabled' => 'disabled'));
+        $form->addElement('radio', 'status', get_lang('Status'), get_lang('RegStudent'), STUDENT, ['disabled' => 'disabled']);
+        $form->addElement('radio', 'status', null, get_lang('RegAdmin'), COURSEMANAGER, ['disabled' => 'disabled']);
     }
 
     //	EXTENDED FIELDS
     if (api_get_setting('extended_profile') == 'true' &&
         api_get_setting('extendedprofile_registration', 'mycomptetences') == 'true'
     ) {
-        $form->addHtmlEditor('competences', get_lang('MyCompetences'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
+        $form->addHtmlEditor('competences', get_lang('MyCompetences'), false, false, ['ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130']);
     }
 
     if (api_get_setting('extended_profile') == 'true' &&
         api_get_setting('extendedprofile_registration', 'mydiplomas') == 'true'
     ) {
-        $form->addHtmlEditor('diplomas', get_lang('MyDiplomas'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
+        $form->addHtmlEditor('diplomas', get_lang('MyDiplomas'), false, false, ['ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130']);
     }
 
     if (api_get_setting('extended_profile') == 'true' &&
         api_get_setting('extendedprofile_registration', 'myteach') == 'true'
     ) {
-        $form->addHtmlEditor('teach', get_lang('MyTeach'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
+        $form->addHtmlEditor('teach', get_lang('MyTeach'), false, false, ['ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130']);
     }
 
     if (api_get_setting('extended_profile') == 'true' &&
         api_get_setting('extendedprofile_registration', 'mypersonalopenarea') == 'true'
     ) {
-        $form->addHtmlEditor('openarea', get_lang('MyPersonalOpenArea'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
+        $form->addHtmlEditor('openarea', get_lang('MyPersonalOpenArea'), false, false, ['ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130']);
     }
 
     if (api_get_setting('extended_profile') == 'true') {
@@ -366,15 +366,15 @@ switch ($action) {
             echo Display::return_message($errorMsg, 'normal');
         }
 
-        $default = array();
+        $default = [];
         $form = new FormValidator(
             'configure_inscription_'.$action,
             'post',
             api_get_self().'?action='.$action,
             '',
-            array('style' => 'margin: 0px;')
+            ['style' => 'margin: 0px;']
         );
-        $renderer = & $form->defaultRenderer();
+        $renderer = &$form->defaultRenderer();
         $renderer->setHeaderTemplate('');
         $renderer->setFormTemplate('<form{attributes}><table border="0" cellpadding="5" cellspacing="0" width="100%">{content}</table></form>');
         $renderer->setCustomElementTemplate('<tr><td>{element}</td></tr>');
@@ -386,11 +386,11 @@ switch ($action) {
             '',
             true,
             false,
-            array(
+            [
                 'ToolbarSet' => 'PortalHomePage',
                 'Width' => '100%',
-                'Height' => '400'
-            )
+                'Height' => '400',
+            ]
         );
         $form->addButtonSave(get_lang('Save'));
         $form->setDefaults($default);

+ 13 - 13
main/admin/configure_plugin.php

@@ -4,9 +4,9 @@
 /**
  * @author Julio Montoya <gugli100@gmail.com> BeezNest 2012
  * @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
+ *
  * @package chamilo.admin
  */
-
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 
@@ -30,7 +30,7 @@ if (isset($pluginInfo['settings_form'])) {
     $form = $pluginInfo['settings_form'];
     if (isset($form)) {
         // We override the form attributes
-        $attributes = array('action' => $currentUrl, 'method' => 'POST');
+        $attributes = ['action' => $currentUrl, 'method' => 'POST'];
         $form->updateAttributes($attributes);
         if (isset($pluginInfo['settings'])) {
             $form->setDefaults($pluginInfo['settings']);
@@ -57,15 +57,15 @@ if (isset($form)) {
 
         $accessUrlId = api_get_current_access_url_id();
         api_delete_settings_params(
-            array(
-                'category = ? AND access_url = ? AND subkey = ? AND type = ? and variable <> ?' => array(
+            [
+                'category = ? AND access_url = ? AND subkey = ? AND type = ? and variable <> ?' => [
                     'Plugins',
                     $accessUrlId,
                     $pluginName,
                     'setting',
-                    'status'
-                )
-            )
+                    'status',
+                ],
+            ]
         );
 
         foreach ($values as $key => $value) {
@@ -103,14 +103,14 @@ if (isset($form)) {
     }
 }
 
-$interbreadcrumb[] = array(
+$interbreadcrumb[] = [
     'url' => api_get_path(WEB_CODE_PATH).'admin/index.php',
-    'name' => get_lang('PlatformAdmin')
-);
-$interbreadcrumb[] = array(
+    'name' => get_lang('PlatformAdmin'),
+];
+$interbreadcrumb[] = [
     'url' => api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins',
-    'name' => get_lang('Plugins')
-);
+    'name' => get_lang('Plugins'),
+];
 
 $tpl = new Template($pluginName, true, true, false, true, false);
 $tpl->assign('content', $content);

+ 21 - 22
main/admin/course_add.php

@@ -1,13 +1,12 @@
 <?php
 /* For licensing terms, see /license.txt */
 
-use Chamilo\CoreBundle\Entity\Repository\CourseCategoryRepository;
 use Chamilo\CoreBundle\Entity\CourseCategory;
+use Chamilo\CoreBundle\Entity\Repository\CourseCategoryRepository;
 
 /**
  * @package chamilo.admin
  */
-
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 $this_section = SECTION_PLATFORM_ADMIN;
@@ -15,8 +14,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script();
 
 $tool_name = get_lang('AddCourse');
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'course_list.php', 'name' => get_lang('CourseList'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'course_list.php', 'name' => get_lang('CourseList')];
 
 $em = Database::getManager();
 /** @var CourseCategoryRepository $courseCategoriesRepo */
@@ -33,9 +32,9 @@ $form->addText(
     'title',
     get_lang('Title'),
     true,
-    array(
-        'aria-label' => get_lang('Title')
-    )
+    [
+        'aria-label' => get_lang('Title'),
+    ]
 );
 $form->applyFilter('title', 'html_filter');
 $form->applyFilter('title', 'trim');
@@ -43,16 +42,16 @@ $form->applyFilter('title', 'trim');
 // Code
 $form->addText(
     'visual_code',
-    array(
+    [
         get_lang('CourseCode'),
-        get_lang('OnlyLettersAndNumbers')
-    ),
+        get_lang('OnlyLettersAndNumbers'),
+    ],
     false,
     [
         'maxlength' => CourseManager::MAX_COURSE_LENGTH_CODE,
         'pattern' => '[a-zA-Z0-9]+',
         'title' => get_lang('OnlyLettersAndNumbers'),
-        'id' => 'visual_code'
+        'id' => 'visual_code',
     ]
 );
 
@@ -103,7 +102,7 @@ $form->addSelectAjax(
     [
         'url' => api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?a=teacher_to_basis_course',
         'id' => 'course_teachers',
-        'multiple' => 'multiple'
+        'multiple' => 'multiple',
     ]
 );
 $form->applyFilter('course_teachers', 'html_filter');
@@ -113,7 +112,7 @@ $form->addText(
     'department_name',
     get_lang('CourseDepartment'),
     false,
-    array('size' => '60', 'id' => 'department_name')
+    ['size' => '60', 'id' => 'department_name']
 );
 $form->applyFilter('department_name', 'html_filter');
 $form->applyFilter('department_name', 'trim');
@@ -123,7 +122,7 @@ $form->addText(
     'department_url',
     get_lang('CourseDepartmentURL'),
     false,
-    array('size' => '60', 'id' => 'department_url')
+    ['size' => '60', 'id' => 'department_url']
 );
 $form->applyFilter('department_url', 'html_filter');
 
@@ -136,8 +135,8 @@ if (count($languages['name']) === 1) {
     $form->addSelectLanguage(
         'course_language',
         get_lang('Ln'),
-        array(),
-        array('style' => 'width:150px')
+        [],
+        ['style' => 'width:150px']
     );
 }
 
@@ -156,7 +155,7 @@ if (api_get_setting('teacher_can_select_course_template') === 'true') {
 
 $form->addElement('checkbox', 'exemplary_content', '', get_lang('FillWithExemplaryContent'));
 
-$group = array();
+$group = [];
 $group[] = $form->createElement('radio', 'visibility', get_lang('CourseAccess'), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD);
 $group[] = $form->createElement('radio', 'visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM);
 $group[] = $form->createElement('radio', 'visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED);
@@ -165,19 +164,19 @@ $group[] = $form->createElement('radio', 'visibility', null, get_lang('CourseVis
 
 $form->addGroup($group, '', get_lang('CourseAccess'));
 
-$group = array();
+$group = [];
 $group[] = $form->createElement('radio', 'subscribe', get_lang('Subscription'), get_lang('Allowed'), 1);
 $group[] = $form->createElement('radio', 'subscribe', null, get_lang('Denied'), 0);
 $form->addGroup($group, '', get_lang('Subscription'));
 
-$group = array();
+$group = [];
 $group[] = $form->createElement('radio', 'unsubscribe', get_lang('Unsubscription'), get_lang('AllowedToUnsubscribe'), 1);
 $group[] = $form->createElement('radio', 'unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0);
 $form->addGroup($group, '', get_lang('Unsubscription'));
 
-$form->addElement('text', 'disk_quota', array(get_lang('CourseQuota'), null, get_lang('MB')), array(
-    'id' => 'disk_quota'
-));
+$form->addElement('text', 'disk_quota', [get_lang('CourseQuota'), null, get_lang('MB')], [
+    'id' => 'disk_quota',
+]);
 $form->addRule('disk_quota', get_lang('ThisFieldShouldBeNumeric'), 'numeric');
 
 $obj = new GradeModel();

+ 5 - 6
main/admin/course_category.php

@@ -74,10 +74,10 @@ if (!empty($action)) {
 }
 
 $tool_name = get_lang('AdminCategories');
-$interbreadcrumb[] = array(
+$interbreadcrumb[] = [
     'url' => 'index.php',
     "name" => get_lang('PlatformAdmin'),
-);
+];
 
 Display::display_header($tool_name);
 
@@ -113,7 +113,7 @@ if ($action == 'add' || $action == 'edit') {
     }
 
     $form->addRule('code', get_lang('PleaseEnterCategoryInfo'), 'required');
-    $group = array(
+    $group = [
         $form->createElement(
             'radio',
             'auth_course_child',
@@ -128,7 +128,7 @@ if ($action == 'add' || $action == 'edit') {
             get_lang('No'),
             'FALSE'
         ),
-    );
+    ];
     $form->addGroup($group, null, get_lang("AllowCoursesInCategory"));
 
     if ($myCourseListAsCategory) {
@@ -162,11 +162,10 @@ if ($action == 'add' || $action == 'edit') {
     } else {
         $class = "add";
         $text = get_lang('AddCategory');
-        $form->setDefaults(array('auth_course_child' => 'TRUE'));
+        $form->setDefaults(['auth_course_child' => 'TRUE']);
         $form->addButtonCreate($text);
     }
     $form->display();
-
 } else {
     // If multiple URLs and not main URL, prevent deletion and inform user
     if ($action == 'delete' && api_get_multiple_access_url() && api_get_current_access_url_id() != 1) {

+ 21 - 22
main/admin/course_edit.php

@@ -1,14 +1,13 @@
 <?php
 /* For licensing terms, see /license.txt */
 
-use Chamilo\CoreBundle\Entity\Repository\CourseCategoryRepository;
 use Chamilo\CoreBundle\Entity\CourseCategory;
+use Chamilo\CoreBundle\Entity\Repository\CourseCategoryRepository;
 use Chamilo\UserBundle\Entity\User;
 
 /**
  * @package chamilo.admin
  */
-
 $cidReset = true;
 
 require_once __DIR__.'/../inc/global.inc.php';
@@ -37,8 +36,8 @@ if (empty($courseInfo)) {
 }
 
 $tool_name = get_lang('ModifyCourseInfo');
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array("url" => "course_list.php", "name" => get_lang('CourseList'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ["url" => "course_list.php", "name" => get_lang('CourseList')];
 
 // Get all course categories
 $table_user = Database::get_main_table(TABLE_MAIN_USER);
@@ -56,7 +55,7 @@ $sql = "SELECT user.user_id,lastname,firstname
             course_user.c_id ='".$courseId."'".
         $order_clause;
 $res = Database::query($sql);
-$course_teachers = array();
+$course_teachers = [];
 while ($obj = Database::fetch_object($res)) {
     $course_teachers[] = $obj->user_id;
 }
@@ -78,8 +77,8 @@ if (api_is_multiple_url_enabled()) {
 $courseInfo['tutor_name'] = null;
 
 $res = Database::query($sql);
-$teachers = array();
-$allTeachers = array();
+$teachers = [];
+$allTeachers = [];
 $platform_teachers[0] = '-- '.get_lang('NoManager').' --';
 while ($obj = Database::fetch_object($res)) {
     $allTeachers[$obj->user_id] = api_get_person_name($obj->firstname, $obj->lastname);
@@ -122,23 +121,23 @@ $form->applyFilter('title', 'trim');
 $element = $form->addElement(
     'text',
     'real_code',
-    array(get_lang('CourseCode'), get_lang('ThisValueCantBeChanged'))
+    [get_lang('CourseCode'), get_lang('ThisValueCantBeChanged')]
 );
 $element->freeze();
 
 // Visual code
 $form->addText(
     'visual_code',
-    array(
+    [
         get_lang('VisualCode'),
         get_lang('OnlyLettersAndNumbers'),
-        get_lang('ThisValueIsUsedInTheCourseURL')
-    ),
+        get_lang('ThisValueIsUsedInTheCourseURL'),
+    ],
     true,
     [
         'maxlength' => CourseManager::MAX_COURSE_LENGTH_CODE,
         'pattern' => '[a-zA-Z0-9]+',
-        'title' => get_lang('OnlyLettersAndNumbers')
+        'title' => get_lang('OnlyLettersAndNumbers'),
     ]
 );
 
@@ -214,7 +213,7 @@ if (!empty($coursesInSession) && $allowEditSessionCoaches) {
         );
         $teachers = $allTeachers;
 
-        $sessionTeachers = array();
+        $sessionTeachers = [];
         foreach ($coaches as $coachId) {
             $userInfo = api_get_user_info($coachId);
             $sessionTeachers[] = $coachId;
@@ -236,7 +235,7 @@ if (!empty($coursesInSession) && $allowEditSessionCoaches) {
             Display::url(
                 $session['name'],
                 $sessionUrl,
-                array('target' => '_blank')
+                ['target' => '_blank']
             ).' - '.get_lang('Coaches'),
             $allTeachers
         );
@@ -244,17 +243,17 @@ if (!empty($coursesInSession) && $allowEditSessionCoaches) {
     }
 }
 
-$form->addText('department_name', get_lang('CourseDepartment'), false, array('size' => '60'));
+$form->addText('department_name', get_lang('CourseDepartment'), false, ['size' => '60']);
 $form->applyFilter('department_name', 'html_filter');
 $form->applyFilter('department_name', 'trim');
 
-$form->addText('department_url', get_lang('CourseDepartmentURL'), false, array('size' => '60'));
+$form->addText('department_url', get_lang('CourseDepartmentURL'), false, ['size' => '60']);
 $form->applyFilter('department_url', 'html_filter');
 $form->applyFilter('department_url', 'trim');
 
 $form->addSelectLanguage('course_language', get_lang('CourseLanguage'));
 
-$group = array();
+$group = [];
 $group[] = $form->createElement('radio', 'visibility', get_lang("CourseAccess"), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD);
 $group[] = $form->createElement('radio', 'visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM);
 $group[] = $form->createElement('radio', 'visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED);
@@ -262,17 +261,17 @@ $group[] = $form->createElement('radio', 'visibility', null, get_lang('CourseVis
 $group[] = $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityHidden'), COURSE_VISIBILITY_HIDDEN);
 $form->addGroup($group, '', get_lang('CourseAccess'));
 
-$group = array();
+$group = [];
 $group[] = $form->createElement('radio', 'subscribe', get_lang('Subscription'), get_lang('Allowed'), 1);
 $group[] = $form->createElement('radio', 'subscribe', null, get_lang('Denied'), 0);
 $form->addGroup($group, '', get_lang('Subscription'));
 
-$group = array();
+$group = [];
 $group[] = $form->createElement('radio', 'unsubscribe', get_lang('Unsubscription'), get_lang('AllowedToUnsubscribe'), 1);
 $group[] = $form->createElement('radio', 'unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0);
 $form->addGroup($group, '', get_lang('Unsubscription'));
 
-$form->addElement('text', 'disk_quota', array(get_lang('CourseQuota'), null, get_lang('MB')));
+$form->addElement('text', 'disk_quota', [get_lang('CourseQuota'), null, get_lang('MB')]);
 $form->addRule('disk_quota', get_lang('ThisFieldIsRequired'), 'required');
 $form->addRule('disk_quota', get_lang('ThisFieldShouldBeNumeric'), 'numeric');
 
@@ -292,7 +291,7 @@ $extra = $extra_field->addElements(
 $htmlHeadXtra[] = '
 <script>
 $(function() {
-    ' . $extra['jquery_ready_content'].'
+    '.$extra['jquery_ready_content'].'
 });
 </script>';
 
@@ -457,7 +456,7 @@ Display::display_header($tool_name);
 
 echo '<div class="actions">';
 echo Display::url(Display::return_icon('back.png', get_lang('Back')), api_get_path(WEB_CODE_PATH).'admin/course_list.php');
-echo Display::url(Display::return_icon('course_home.png', get_lang('CourseHome')), $courseInfo['course_public_url'], array('target' => '_blank'));
+echo Display::url(Display::return_icon('course_home.png', get_lang('CourseHome')), $courseInfo['course_public_url'], ['target' => '_blank']);
 echo '</div>';
 
 echo "<script>

+ 6 - 6
main/admin/course_export.php

@@ -2,10 +2,10 @@
 /* For licensing terms, see /license.txt */
 
 /**
- * This tool allows platform admins to export courses to CSV file
+ * This tool allows platform admins to export courses to CSV file.
+ *
  * @package chamilo.admin
  */
-
 $cidReset = true;
 
 require_once __DIR__.'/../inc/global.inc.php';
@@ -14,13 +14,13 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script();
 
 $tool_name = get_lang('ExportCourses');
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 set_time_limit(0);
 
 $course_list = CourseManager::get_courses_list();
 $formSent = null;
-$courses = $selected_courses = array();
+$courses = $selected_courses = [];
 
 if (isset($_POST['formSent']) && $_POST['formSent']) {
     $formSent = $_POST['formSent'];
@@ -53,7 +53,7 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
             'Teacher',
             'Language',
             'Users',
-            'OtherTeachers'
+            'OtherTeachers',
         ];
 
         $dataToExport = [];
@@ -152,7 +152,7 @@ if (!empty($course_list)) {
 
 $form->addElement('radio', 'file_type', get_lang('OutputFileType'), 'CSV', 'csv', null);
 $form->addElement('radio', 'file_type', '', 'XLS', 'xls', null);
-$form->addElement('radio', 'file_type', null, 'XML', 'xml', null, array('id' => 'file_type_xml'));
+$form->addElement('radio', 'file_type', null, 'XML', 'xml', null, ['id' => 'file_type_xml']);
 
 $form->setDefaults(['select_type' => '1', 'file_type' => 'csv']);
 

+ 19 - 12
main/admin/course_import.php

@@ -3,7 +3,8 @@
 
 /**
  * This tool allows platform admins to create courses by uploading a CSV file
- * Copyright (c) 2005 Bart Mollet <bart.mollet@hogent.be>
+ * Copyright (c) 2005 Bart Mollet <bart.mollet@hogent.be>.
+ *
  * @package chamilo.admin
  */
 
@@ -11,17 +12,18 @@
  * Validates imported data.
  *
  * @param array $courses
+ *
  * @return array $errors
  */
 function validate_courses_data($courses)
 {
-    $errors = array();
-    $coursecodes = array();
+    $errors = [];
+    $coursecodes = [];
     foreach ($courses as $index => $course) {
         $course['line'] = $index + 1;
 
         // 1. Check whether mandatory fields are set.
-        $mandatory_fields = array('Code', 'Title', 'CourseCategory');
+        $mandatory_fields = ['Code', 'Title', 'CourseCategory'];
         foreach ($mandatory_fields as $field) {
             if (empty($course[$field])) {
                 $course['error'] = get_lang($field.'Mandatory');
@@ -79,9 +81,10 @@ function validate_courses_data($courses)
 }
 
 /**
- * Get the teacher list
+ * Get the teacher list.
  *
  * @param array $teachers
+ *
  * @return array
  */
 function getTeacherListInArray($teachers)
@@ -90,11 +93,12 @@ function getTeacherListInArray($teachers)
         return explode('|', $teachers);
     }
 
-    return array();
+    return [];
 }
 
 /**
  * Saves imported data.
+ *
  * @param array $courses List of courses
  */
 function save_courses_data($courses)
@@ -103,7 +107,7 @@ function save_courses_data($courses)
     foreach ($courses as $course) {
         $course_language = $course['Language'];
         $teachers = getTeacherListInArray($course['Teacher']);
-        $teacherList = array();
+        $teacherList = [];
         $creatorId = api_get_user_id();
 
         if (!empty($teachers)) {
@@ -115,7 +119,7 @@ function save_courses_data($courses)
             }
         }
 
-        $params = array();
+        $params = [];
         $params['title'] = $course['Title'];
         $params['wanted_code'] = $course['Code'];
         $params['tutor_name'] = null;
@@ -147,13 +151,16 @@ function save_courses_data($courses)
 }
 
 /**
- * Read the CSV-file
+ * Read the CSV-file.
+ *
  * @param string $file Path to the CSV-file
+ *
  * @return array All course-information read from the file
  */
 function parse_csv_courses_data($file)
 {
     $courses = Import::csv_reader($file);
+
     return $courses;
 }
 
@@ -172,7 +179,7 @@ if (isset($extAuthSource) && is_array($extAuthSource)) {
 
 $tool_name = get_lang('ImportCourses').' CSV';
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 set_time_limit(0);
 Display::display_header($tool_name);
@@ -182,7 +189,7 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
         $error_message = get_lang('UplUploadFailed');
         echo Display::return_message($error_message, 'error', false);
     } else {
-        $allowed_file_mimetype = array('csv');
+        $allowed_file_mimetype = ['csv'];
 
         $ext_import_file = substr($_FILES['import_file']['name'], (strrpos($_FILES['import_file']['name'], '.') + 1));
 
@@ -215,7 +222,7 @@ $form = new FormValidator(
     'post',
     api_get_self(),
     null,
-    array('enctype' => 'multipart/form-data')
+    ['enctype' => 'multipart/form-data']
 );
 $form->addHeader($tool_name);
 $form->addElement('file', 'import_file', get_lang('ImportCSVFileLocation'));

+ 19 - 16
main/admin/course_information.php

@@ -1,8 +1,10 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
- * This script gives information about a course
+ * This script gives information about a course.
+ *
  * @author Bart Mollet
+ *
  * @package chamilo.admin
  */
 $cidReset = true;
@@ -24,7 +26,8 @@ $sessionId = isset($_GET['id_session']) ? (int) $_GET['id_session'] : 0;
 
 /**
  * @param array $course
- * @param int $session_id
+ * @param int   $session_id
+ *
  * @return array
  */
 function get_course_usage($course, $session_id = 0)
@@ -62,7 +65,7 @@ function get_course_usage($course, $session_id = 0)
         [
             Database::get_course_table(TABLE_ANNOUNCEMENT),
             get_lang(ucfirst(TOOL_ANNOUNCEMENT)),
-        ]
+        ],
     ];
 
     $usage = [];
@@ -80,24 +83,24 @@ function get_course_usage($course, $session_id = 0)
         $rs = Database::query($sql);
         $row = Database::fetch_array($rs);
 
-        $usage[] = array(
+        $usage[] = [
             $title,
-            $row['count']
-        );
+            $row['count'],
+        ];
     }
 
     return $usage;
 }
 
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array("url" => 'course_list.php', "name" => get_lang('Courses'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ["url" => 'course_list.php', "name" => get_lang('Courses')];
 $courseId = $courseInfo['real_id'];
 $tool_name = $courseInfo['title'].' ('.$courseInfo['visual_code'].')';
 Display::display_header($tool_name);
 ?>
     <div class="actions">
         <a href="<?php echo $courseInfo['course_public_url']; ?>">
-            <?php Display::display_icon('home.png', get_lang('CourseHomepage'), array(), ICON_SIZE_MEDIUM); ?>
+            <?php Display::display_icon('home.png', get_lang('CourseHomepage'), [], ICON_SIZE_MEDIUM); ?>
         </a>
     </div>
 <?php
@@ -110,14 +113,14 @@ $table = new SortableTableFromArray(
     20,
     'usage_table'
 );
-$table->set_additional_parameters(array('code' => $courseInfo['code']));
-$table->set_other_tables(array('user_table', 'class_table'));
+$table->set_additional_parameters(['code' => $courseInfo['code']]);
+$table->set_other_tables(['user_table', 'class_table']);
 $table->set_header(0, get_lang('Tool'), true);
 $table->set_header(1, get_lang('NumberOfItems'), true);
 $table->display();
 
 /**
- * Show all users subscribed in this course
+ * Show all users subscribed in this course.
  */
 echo Display::page_header(get_lang('Users'));
 
@@ -138,9 +141,9 @@ $sql .= " WHERE
 $res = Database::query($sql);
 $is_western_name_order = api_is_western_name_order();
 if (Database::num_rows($res) > 0) {
-    $users = array();
+    $users = [];
     while ($obj = Database::fetch_object($res)) {
-        $user   = array();
+        $user = [];
         $user[] = $obj->official_code;
         if ($is_western_name_order) {
             $user[] = $obj->firstname;
@@ -156,8 +159,8 @@ if (Database::num_rows($res) > 0) {
         $users[] = $user;
     }
     $table = new SortableTableFromArray($users, 0, 20, 'user_table');
-    $table->set_additional_parameters(array('code' => $courseInfo['code']));
-    $table->set_other_tables(array('usage_table', 'class_table'));
+    $table->set_additional_parameters(['code' => $courseInfo['code']]);
+    $table->set_other_tables(['usage_table', 'class_table']);
     $table->set_header(0, get_lang('OfficialCode'), true);
     if ($is_western_name_order) {
         $table->set_header(1, get_lang('FirstName'), true);

+ 13 - 9
main/admin/course_intro_pdf_import.php

@@ -2,7 +2,8 @@
 /* For licensing terms, see /license.txt */
 /**
  * This tool allows platform admins to upload a massive amount of PDFs to be
- * uploaded in each course
+ * uploaded in each course.
+ *
  * @package chamilo.admin
  */
 $cidReset = true;
@@ -15,7 +16,7 @@ $subDir = '';
 $tool_name = get_lang('ImportPDFIntroToCourses');
 $errors = [];
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 set_time_limit(0);
 
@@ -24,7 +25,7 @@ if ($_POST['formSent']) {
         $error_message = get_lang('UplUploadFailed');
         Display::addFlash(Display::return_message($error_message, 'error', false));
     } else {
-        $allowed_file_mimetype = array('zip');
+        $allowed_file_mimetype = ['zip'];
         $ext_import_file = substr($_FILES['import_file']['name'], (strrpos($_FILES['import_file']['name'], '.') + 1));
 
         if (!in_array($ext_import_file, $allowed_file_mimetype)) {
@@ -94,20 +95,23 @@ ENG101_Introduction_to_English-101.pdf
 Display::display_footer();
 
 /**
- * Import PDFs
- * @param   string $subDir  The subdirectory in which to put the files in each course
+ * Import PDFs.
+ *
+ * @param string $subDir The subdirectory in which to put the files in each course
+ *
  * @return array List of possible errors found
  */
 function import_pdfs($subDir = '/')
 {
     $baseDir = api_get_path(SYS_ARCHIVE_PATH);
     $uploadPath = 'pdfimport/';
-    $errors = array();
+    $errors = [];
     if (!is_dir($baseDir.$uploadPath)) {
         @mkdir($baseDir.$uploadPath);
     }
     if (!unzip_uploaded_file($_FILES['import_file'], $uploadPath, $baseDir, 1024 * 1024 * 1024)) {
         error_log('Could not unzip uploaded file in '.__FILE__.', line '.__LINE__);
+
         return $errors;
     }
     $list = scandir($baseDir.$uploadPath);
@@ -152,7 +156,7 @@ function import_pdfs($subDir = '/')
                 );
                 // Redo visibility
                 api_set_default_visibility($docId, TOOL_DOCUMENT);
-                $errors[] = array('Line' => 0, 'Code' => $course['code'], 'Title' => $course['title']);
+                $errors[] = ['Line' => 0, 'Code' => $course['code'], 'Title' => $course['title']];
                 // Now add a link to the file from the Course description tool
                 $link = '<p>Sílabo de la asignatura 
                  <a href="'.api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq_params($course['code']).'&action=download&id='.$docId.'" target="_blank">
@@ -169,12 +173,12 @@ function import_pdfs($subDir = '/')
             }
         } else {
             error_log($parts[0].' is not a course, apparently');
-            $errors[] = array('Line' => 0, 'Code' => $parts[0], 'Title' => $parts[0].' - '.get_lang('CodeDoesNotExists'));
+            $errors[] = ['Line' => 0, 'Code' => $parts[0], 'Title' => $parts[0].' - '.get_lang('CodeDoesNotExists')];
         }
         $i++; //found at least one entry that is not a dir or a .
     }
     if ($i == 0) {
-        $errors[] = array('Line' => 0, 'Code' => '.', 'Title' => get_lang('NoPDFFoundAtRoot'));
+        $errors[] = ['Line' => 0, 'Code' => '.', 'Title' => get_lang('NoPDFFoundAtRoot')];
     }
 
     return $errors;

+ 48 - 44
main/admin/course_list.php

@@ -3,10 +3,10 @@
 
 /**
  * This script shows a list of courses and allows searching for courses codes
- * and names
+ * and names.
+ *
  * @package chamilo.admin
  */
-
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 $this_section = SECTION_PLATFORM_ADMIN;
@@ -16,7 +16,7 @@ api_protect_admin_script();
 $sessionId = isset($_GET['session_id']) ? $_GET['session_id'] : null;
 
 /**
- * Get the number of courses which will be displayed
+ * Get the number of courses which will be displayed.
  */
 function get_number_of_courses()
 {
@@ -73,10 +73,11 @@ function get_number_of_courses()
 }
 
 /**
- * Get course data to display
- * @param int $from
- * @param int $number_of_items
- * @param int $column
+ * Get course data to display.
+ *
+ * @param int    $from
+ * @param int    $number_of_items
+ * @param int    $column
  * @param string $direction
  *
  * @return array
@@ -147,7 +148,7 @@ function get_course_data($from, $number_of_items, $column, $direction)
     $sql .= " LIMIT $from, $number_of_items";
 
     $res = Database::query($sql);
-    $courses = array();
+    $courses = [];
     $languages = api_get_languages_to_array();
 
     $path = api_get_path(WEB_CODE_PATH);
@@ -176,13 +177,13 @@ function get_course_data($from, $number_of_items, $column, $direction)
             '<a href="'.$path.'tracking/courseLog.php?'.api_get_cidreq_params($courseCode).'">'.
             Display::return_icon('statistics.gif', get_lang('Tracking')).'</a>&nbsp;'.
             '<a href="'.$path.'admin/course_edit.php?id='.$courseId.'">'.
-            Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>&nbsp;'.
+            Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL).'</a>&nbsp;'.
             '<a href="'.$path.'coursecopy/create_backup.php?'.api_get_cidreq_params($courseCode).'">'.
             Display::return_icon('backup.gif', get_lang('CreateBackup')).'</a>&nbsp;'.
             '<a href="'.$path.'admin/course_list.php?delete_course='.$courseCode.'"  onclick="javascript: if (!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;">'.
-            Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
+            Display::return_icon('delete.png', get_lang('Delete'), [], ICON_SIZE_SMALL).'</a>';
 
-        $courseItem = array(
+        $courseItem = [
             $course[0],
             $course[1],
             $course[2],
@@ -190,8 +191,8 @@ function get_course_data($from, $number_of_items, $column, $direction)
             $course[4],
             $course[5],
             $course[6],
-            $actions
-        );
+            $actions,
+        ];
         $courses[] = $courseItem;
     }
 
@@ -199,11 +200,13 @@ function get_course_data($from, $number_of_items, $column, $direction)
 }
 
 /**
- * Get course data to display filtered by session name
- * @param int $from
- * @param int $number_of_items
- * @param int $column
+ * Get course data to display filtered by session name.
+ *
+ * @param int    $from
+ * @param int    $number_of_items
+ * @param int    $column
  * @param string $direction
+ *
  * @return array
  */
 function get_course_data_by_session($from, $number_of_items, $column, $direction)
@@ -260,7 +263,7 @@ function get_course_data_by_session($from, $number_of_items, $column, $direction
             $course[4],
             $course[5],
             $course[6],
-            $course[7]
+            $course[7],
         ];
         $courses[] = $row;
     }
@@ -269,9 +272,10 @@ function get_course_data_by_session($from, $number_of_items, $column, $direction
 }
 
 /**
- * Return an icon representing the visibility of the course
+ * Return an icon representing the visibility of the course.
  *
  * @param string $visibility
+ *
  * @return string
  */
 function get_course_visibility_icon($visibility)
@@ -282,35 +286,35 @@ function get_course_visibility_icon($visibility)
             return Display::return_icon(
                 'bullet_red.png',
                 get_lang('CourseVisibilityClosed'),
-                array('style' => $style)
+                ['style' => $style]
             );
             break;
         case 1:
             return Display::return_icon(
                 'bullet_orange.png',
                 get_lang('Private'),
-                array('style' => $style)
+                ['style' => $style]
             );
             break;
         case 2:
             return Display::return_icon(
                 'bullet_green.png',
                 get_lang('OpenToThePlatform'),
-                array('style' => $style)
+                ['style' => $style]
             );
             break;
         case 3:
             return Display::return_icon(
                 'bullet_blue.png',
                 get_lang('OpenToTheWorld'),
-                array('style' => $style)
+                ['style' => $style]
             );
             break;
         case 4:
             return Display::return_icon(
                 'bullet_grey.png',
                 get_lang('CourseVisibilityHidden'),
-                array('style' => $style)
+                ['style' => $style]
             );
             break;
         default:
@@ -339,14 +343,14 @@ $actions = '';
 
 if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
     // Get all course categories
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = [
         'url' => 'index.php',
-        'name' => get_lang('PlatformAdmin')
-    );
-    $interbreadcrumb[] = array(
+        'name' => get_lang('PlatformAdmin'),
+    ];
+    $interbreadcrumb[] = [
         'url' => 'course_list.php',
-        'name' => get_lang('CourseList')
-    );
+        'name' => get_lang('CourseList'),
+    ];
     $tool_name = get_lang('SearchACourse');
     $form = new FormValidator('advanced_course_search', 'get');
     $form->addElement('header', $tool_name);
@@ -361,9 +365,9 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
         'keyword_category',
         get_lang('CourseFaculty'),
         null,
-        array(
-            'url' => $url
-        )
+        [
+            'url' => $url,
+        ]
     );
 
     $el = $form->addSelectLanguage('keyword_language', get_lang('CourseLanguage'));
@@ -388,10 +392,10 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
     $form->setDefaults($defaults);
     $content .= $form->returnForm();
 } else {
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = [
         'url' => 'index.php',
-        'name' => get_lang('PlatformAdmin')
-    );
+        'name' => get_lang('PlatformAdmin'),
+    ];
     $tool_name = get_lang('CourseList');
     if (isset($_GET['delete_course'])) {
         CourseManager::delete_course($_GET['delete_course']);
@@ -404,14 +408,14 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
         'get',
         '',
         '',
-        array(),
+        [],
         FormValidator::LAYOUT_INLINE
     );
     $form->addElement(
         'text',
         'keyword',
         null,
-        array('id' => 'course-search-keyword', 'aria-label' => get_lang('SearchCourse'))
+        ['id' => 'course-search-keyword', 'aria-label' => get_lang('SearchCourse')]
     );
     $form->addButtonSearch(get_lang('SearchCourse'));
     $advanced = '<a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'admin/course_list.php?search=advanced">
@@ -424,7 +428,7 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
         'get',
         '',
         '',
-        array(),
+        [],
         FormValidator::LAYOUT_INLINE
     );
     $url = api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=search_session';
@@ -433,7 +437,7 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
         'session_name',
         get_lang('SearchCourseBySession'),
         null,
-        array('url' => $url)
+        ['url' => $url]
     );
 
     if (!empty($sessionId)) {
@@ -515,7 +519,7 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
 
     $parameters = [];
     if (isset($_GET['keyword'])) {
-        $parameters = array('keyword' => Security::remove_XSS($_GET['keyword']));
+        $parameters = ['keyword' => Security::remove_XSS($_GET['keyword'])];
     } elseif (isset($_GET['keyword_code'])) {
         $parameters['keyword_code'] = Security::remove_XSS($_GET['keyword_code']);
         $parameters['keyword_title'] = Security::remove_XSS($_GET['keyword_title']);
@@ -529,7 +533,7 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
     $table->set_additional_parameters($parameters);
 
     $table->set_header(0, '', false, 'width="8px"');
-    $table->set_header(1, get_lang('Title'), true, null, array('class' => 'title'));
+    $table->set_header(1, get_lang('Title'), true, null, ['class' => 'title']);
     $table->set_header(2, get_lang('Code'));
     $table->set_header(3, get_lang('Language'), false, 'width="70px"');
     $table->set_header(4, get_lang('Category'));
@@ -540,10 +544,10 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
         get_lang('Action'),
         false,
         null,
-        array('class' => 'td_actions')
+        ['class' => 'td_actions']
     );
     $table->set_form_actions(
-        array('delete_courses' => get_lang('DeleteCourse')),
+        ['delete_courses' => get_lang('DeleteCourse')],
         'course'
     );
     $content .= $table->return_table();

+ 11 - 11
main/admin/course_request_accepted.php

@@ -2,15 +2,15 @@
 /* For licensing terms, see /license.txt */
 
 /**
- * A list containig the accepted course requests
+ * A list containig the accepted course requests.
+ *
  * @package chamilo.admin
+ *
  * @author José Manuel Abuin Mosquera <chema@cesga.es>, 2010
  * @author Bruno Rubio Gayo <brubio@cesga.es>, 2010
  * Centro de Supercomputacion de Galicia (CESGA)
- *
  * @author Ivan Tcholakov <ivantcholakov@gmail.com> (technical adaptation for Chamilo 1.8.8), 2010
  */
-
 $cidReset = true;
 
 require_once __DIR__.'/../inc/global.inc.php';
@@ -76,7 +76,7 @@ function get_number_of_requests()
 }
 
 /**
- * Get course data to display
+ * Get course data to display.
  */
 function get_request_data($from, $number_of_items, $column, $direction)
 {
@@ -110,7 +110,7 @@ function get_request_data($from, $number_of_items, $column, $direction)
     $sql .= " LIMIT $from,$number_of_items";
     $res = Database :: query($sql);
 
-    $course_requests = array();
+    $course_requests = [];
     while ($course_request = Database :: fetch_row($res)) {
         $course_request[5] = api_get_local_time($course_request[5]);
         $course_requests[] = $course_request;
@@ -126,23 +126,23 @@ function modify_filter($id)
 {
     $code = CourseRequestManager::get_course_request_code($id);
     $result = '<a href="course_request_edit.php?id='.$id.'&caller=1">'.
-        Display::return_icon('edit.png', get_lang('Edit'), array('style' => 'vertical-align: middle;')).'</a>'.
+        Display::return_icon('edit.png', get_lang('Edit'), ['style' => 'vertical-align: middle;']).'</a>'.
         '&nbsp;<a href="?delete_course_request='.$id.'">'.
         Display::return_icon(
             'delete.png',
             get_lang('DeleteThisCourseRequest'),
-            array(
+            [
                 'style' => 'vertical-align: middle;',
                 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeDeleted'), $code), ENT_QUOTES)).'\')) return false;',
-            )
+            ]
         ).
         '</a>';
 
     return $result;
 }
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'course_list.php', 'name' => get_lang('CourseList'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'course_list.php', 'name' => get_lang('CourseList')];
 $tool_name = get_lang('AcceptedCourseRequests');
 
 // Display confirmation or error message.
@@ -189,7 +189,7 @@ $table->set_header(4, get_lang('Teacher'));
 $table->set_header(5, get_lang('CourseRequestDate'));
 $table->set_header(6, '', false);
 $table->set_column_filter(6, 'modify_filter');
-$table->set_form_actions(array('delete_course_requests' => get_lang('DeleteCourseRequests')), 'course_request');
+$table->set_form_actions(['delete_course_requests' => get_lang('DeleteCourseRequests')], 'course_request');
 $table->display();
 
 /* FOOTER */

+ 9 - 8
main/admin/course_request_edit.php

@@ -3,10 +3,11 @@
 
 /**
  * A page for detailed preview or edition of a given course request.
+ *
  * @package chamilo.admin
+ *
  * @author Ivan Tcholakov <ivantcholakov@gmail.com>, 2010
  */
-
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 $this_section = SECTION_PLATFORM_ADMIN;
@@ -48,7 +49,7 @@ if ($course_validation_feature) {
         $form->addElement('header', $tool_name);
 
         // Title.
-        $form->addElement('text', 'title', get_lang('CourseName'), array('size' => '60', 'id' => 'title'));
+        $form->addElement('text', 'title', get_lang('CourseName'), ['size' => '60', 'id' => 'title']);
         $form->applyFilter('title', 'html_filter');
         $form->addRule('title', get_lang('ThisFieldIsRequired'), 'required');
 
@@ -60,7 +61,7 @@ if ($course_validation_feature) {
             'category_code',
             get_lang('CourseFaculty'),
             null,
-            array('url' => $url)
+            ['url' => $url]
         );
 
         if (!empty($course_request_info['category_code'])) {
@@ -69,13 +70,13 @@ if ($course_validation_feature) {
         }
 
         // Course code.
-        $form->addText('wanted_code', get_lang('Code'), false, array('size' => '$maxlength', 'maxlength' => $maxlength));
+        $form->addText('wanted_code', get_lang('Code'), false, ['size' => '$maxlength', 'maxlength' => $maxlength]);
         $form->applyFilter('wanted_code', 'html_filter');
         $form->addRule('wanted_code', get_lang('Max'), 'maxlength', $maxlength);
         $form->addRule('wanted_code', get_lang('ThisFieldIsRequired'), 'required');
 
         // The teacher.
-        $titular = $form->addText('tutor_name', get_lang('Professor'), null, array('size' => '60', 'disabled' => 'disabled'));
+        $titular = $form->addText('tutor_name', get_lang('Professor'), null, ['size' => '60', 'disabled' => 'disabled']);
 
         // Description of the requested course.
         $form->addElement('textarea', 'description', get_lang('Description'));
@@ -151,7 +152,7 @@ if ($course_validation_feature) {
                 : !CourseRequestManager::course_code_exists($course_request_values['wanted_code']);
 
             if ($course_code_ok) {
-                $message = array();
+                $message = [];
 
                 // Update the course request.
                 $update_ok = CourseRequestManager::update_course_request(
@@ -318,8 +319,8 @@ function get_caller_name($caller_id)
 }
 
 // The header.
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'course_list.php', 'name' => get_lang('CourseList'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'course_list.php', 'name' => get_lang('CourseList')];
 
 Display :: display_header($tool_name);
 

+ 15 - 15
main/admin/course_request_rejected.php

@@ -2,15 +2,15 @@
 /* For licensing terms, see /license.txt */
 
 /**
- * A list containing the rejected course requests
+ * A list containing the rejected course requests.
+ *
  * @package chamilo.admin
+ *
  * @author José Manuel Abuin Mosquera <chema@cesga.es>, 2010
  * @author Bruno Rubio Gayo <brubio@cesga.es>, 2010
  * Centro de Supercomputacion de Galicia (CESGA)
- *
  * @author Ivan Tcholakov <ivantcholakov@gmail.com> (technical adaptation for Chamilo 1.8.8), 2010
  */
-
 $cidReset = true;
 
 require_once __DIR__.'/../inc/global.inc.php';
@@ -107,7 +107,7 @@ function get_number_of_requests()
 }
 
 /**
- * Get course data to display
+ * Get course data to display.
  */
 function get_request_data($from, $number_of_items, $column, $direction)
 {
@@ -141,7 +141,7 @@ function get_request_data($from, $number_of_items, $column, $direction)
     $sql .= " LIMIT $from,$number_of_items";
     $res = Database :: query($sql);
 
-    $course_requests = array();
+    $course_requests = [];
     while ($course_request = Database :: fetch_row($res)) {
         $course_request[5] = api_get_local_time($course_request[5]);
         $course_requests[] = $course_request;
@@ -157,15 +157,15 @@ function modify_filter($id)
 {
     $code = CourseRequestManager::get_course_request_code($id);
     $result = '<a href="course_request_edit.php?id='.$id.'&caller=2">'.
-        Display::return_icon('edit.png', get_lang('Edit'), array('style' => 'vertical-align: middle;')).'</a>'.
+        Display::return_icon('edit.png', get_lang('Edit'), ['style' => 'vertical-align: middle;']).'</a>'.
         '&nbsp;<a href="?accept_course_request='.$id.'">'.
         Display::return_icon(
             'accept.png',
             get_lang('AcceptThisCourseRequest'),
-            array(
+            [
                 'style' => 'vertical-align: middle;',
                 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ANewCourseWillBeCreated'), $code), ENT_QUOTES)).'\')) return false;',
-            )
+            ]
         ).
         '</a>';
     if (!CourseRequestManager::additional_info_asked($id)) {
@@ -173,10 +173,10 @@ function modify_filter($id)
             Display::return_icon(
                 'request_info.gif',
                 get_lang('AskAdditionalInfo'),
-                array(
+                [
                     'style' => 'vertical-align: middle;',
                     'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('AdditionalInfoWillBeAsked'), $code), ENT_QUOTES)).'\')) return false;',
-                )
+                ]
             ).
             '</a>';
     }
@@ -184,18 +184,18 @@ function modify_filter($id)
         Display::return_icon(
             'delete.png',
             get_lang('DeleteThisCourseRequest'),
-            array(
+            [
                 'style' => 'vertical-align: middle;',
                 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeDeleted'), $code), ENT_QUOTES)).'\')) return false;',
-            )
+            ]
         ).
         '</a>';
 
     return $result;
 }
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'course_list.php', 'name' => get_lang('CourseList'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'course_list.php', 'name' => get_lang('CourseList')];
 
 $tool_name = get_lang('RejectedCourseRequests');
 
@@ -245,7 +245,7 @@ $table->set_header(4, get_lang('Teacher'));
 $table->set_header(5, get_lang('CourseRequestDate'));
 $table->set_header(6, '', false);
 $table->set_column_filter(6, 'modify_filter');
-$table->set_form_actions(array('delete_course_requests' => get_lang('DeleteCourseRequests')), 'course_request');
+$table->set_form_actions(['delete_course_requests' => get_lang('DeleteCourseRequests')], 'course_request');
 $table->display();
 
 Display::display_footer();

+ 16 - 16
main/admin/course_request_review.php

@@ -2,14 +2,14 @@
 /* For licensing terms, see /license.txt */
 
 /**
- * A list containing the pending course requests
+ * A list containing the pending course requests.
+ *
  * @package chamilo.admin
+ *
  * @author José Manuel Abuin Mosquera <chema@cesga.es>, 2010
  * Centro de Supercomputacion de Galicia (CESGA)
- *
  * @author Ivan Tcholakov <ivantcholakov@gmail.com> (technical adaptation for Chamilo 1.8.8), 2010
  */
-
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 $this_section = SECTION_PLATFORM_ADMIN;
@@ -49,7 +49,7 @@ if ($course_validation_feature) {
         }
     } elseif (!empty($reject_course_request)) {
         /**
-         * Course rejection
+         * Course rejection.
          */
         $course_request_code = CourseRequestManager::get_course_request_code($reject_course_request);
         $result = CourseRequestManager::reject_course_request($reject_course_request);
@@ -61,7 +61,6 @@ if ($course_validation_feature) {
             $is_error_message = true;
         }
     } elseif (!empty($request_info)) {
-
         /**
          * Sending to the teacher a request for additional information about the proposed course.
          */
@@ -124,7 +123,7 @@ function get_number_of_requests()
 }
 
 /**
- * Get course data to display
+ * Get course data to display.
  */
 function get_request_data($from, $number_of_items, $column, $direction)
 {
@@ -160,7 +159,7 @@ function get_request_data($from, $number_of_items, $column, $direction)
     $sql .= " LIMIT $from,$number_of_items";
     $res = Database::query($sql);
 
-    $course_requests = array();
+    $course_requests = [];
     while ($course_request = Database::fetch_row($res)) {
         if (DELETE_ACTION_ENABLED) {
             $course_request[5] = api_get_local_time($course_request[5]);
@@ -174,7 +173,7 @@ function get_request_data($from, $number_of_items, $column, $direction)
 }
 
 /**
- * Enlace a la ficha del profesor
+ * Enlace a la ficha del profesor.
  */
 function email_filter($teacher)
 {
@@ -182,6 +181,7 @@ function email_filter($teacher)
             WHERE tutor_name LIKE '".$teacher."'";
     $res = Database::query($sql);
     $info = Database::fetch_array($res);
+
     return '<a href="./user_information.php?user_id='.$info[0].'">'.$teacher.'</a>';
 }
 
@@ -192,25 +192,25 @@ function modify_filter($id)
 {
     $code = CourseRequestManager::get_course_request_code($id);
     $result = '<a href="course_request_edit.php?id='.$id.'&caller=0">'.
-        Display::return_icon('edit.png', get_lang('Edit'), array('style' => 'vertical-align: middle;')).'</a>'.
+        Display::return_icon('edit.png', get_lang('Edit'), ['style' => 'vertical-align: middle;']).'</a>'.
         '&nbsp;<a href="?accept_course_request='.$id.'">'.
-        Display::return_icon('accept.png', get_lang('AcceptThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ANewCourseWillBeCreated'), $code), ENT_QUOTES)).'\')) return false;'), 16).'</a>'.
+        Display::return_icon('accept.png', get_lang('AcceptThisCourseRequest'), ['style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ANewCourseWillBeCreated'), $code), ENT_QUOTES)).'\')) return false;'], 16).'</a>'.
         '&nbsp;<a href="?reject_course_request='.$id.'">'.
-        Display::return_icon('error.png', get_lang('RejectThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeRejected'), $code), ENT_QUOTES)).'\')) return false;'), 16).'</a>';
+        Display::return_icon('error.png', get_lang('RejectThisCourseRequest'), ['style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeRejected'), $code), ENT_QUOTES)).'\')) return false;'], 16).'</a>';
     if (!CourseRequestManager::additional_info_asked($id)) {
         $result .= '&nbsp;<a href="?request_info='.$id.'">'.
-            Display::return_icon('request_info.gif', get_lang('AskAdditionalInfo'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('AdditionalInfoWillBeAsked'), $code), ENT_QUOTES)).'\')) return false;')).'</a>';
+            Display::return_icon('request_info.gif', get_lang('AskAdditionalInfo'), ['style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('AdditionalInfoWillBeAsked'), $code), ENT_QUOTES)).'\')) return false;']).'</a>';
     }
     if (DELETE_ACTION_ENABLED) {
         $result .= '&nbsp;<a href="?delete_course_request='.$id.'">'
-            .Display::return_icon('delete.png', get_lang('DeleteThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeDeleted'), $code), ENT_QUOTES)).'\')) return false;')).'</a>';
+            .Display::return_icon('delete.png', get_lang('DeleteThisCourseRequest'), ['style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeDeleted'), $code), ENT_QUOTES)).'\')) return false;']).'</a>';
     }
 
     return $result;
 }
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'course_list.php', 'name' => get_lang('CourseList'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'course_list.php', 'name' => get_lang('CourseList')];
 
 $tool_name = get_lang('ReviewCourseRequests');
 
@@ -265,7 +265,7 @@ $table->set_header(5 + $offet, '', false);
 $table->set_column_filter(3 + $offet, 'email_filter');
 $table->set_column_filter(5 + $offet, 'modify_filter');
 if (DELETE_ACTION_ENABLED) {
-    $table->set_form_actions(array('delete_course_requests' => get_lang('DeleteCourseRequests')), 'course_request');
+    $table->set_form_actions(['delete_course_requests' => get_lang('DeleteCourseRequests')], 'course_request');
 }
 $table->display();
 

+ 21 - 18
main/admin/course_user_import.php

@@ -3,7 +3,8 @@
 
 /**
  * This tool allows platform admins to update course-user relations by uploading
- * a CSV file
+ * a CSV file.
+ *
  * @package chamilo.admin
  */
 
@@ -12,16 +13,16 @@
  */
 function validate_data($users_courses)
 {
-    $errors = array();
-    $coursecodes = array();
+    $errors = [];
+    $coursecodes = [];
     foreach ($users_courses as $index => $user_course) {
         $user_course['line'] = $index + 1;
         // 1. Check whether mandatory fields are set.
-        $mandatory_fields = array('UserName', 'CourseCode', 'Status');
+        $mandatory_fields = ['UserName', 'CourseCode', 'Status'];
         foreach ($mandatory_fields as $key => $field) {
             if (!isset($user_course[$field]) || strlen($user_course[$field]) == 0) {
                 $user_course['error'] = get_lang($field.'Mandatory');
-                $errors[]             = $user_course;
+                $errors[] = $user_course;
             }
         }
 
@@ -36,7 +37,7 @@ function validate_data($users_courses)
                 $res = Database::query($sql);
                 if (Database::num_rows($res) == 0) {
                     $user_course['error'] = get_lang('CodeDoesNotExists');
-                    $errors[]             = $user_course;
+                    $errors[] = $user_course;
                 } else {
                     $coursecodes[$user_course['CourseCode']] = 1;
                 }
@@ -47,7 +48,7 @@ function validate_data($users_courses)
         if (isset($user_course['UserName']) && strlen($user_course['UserName']) != 0) {
             if (UserManager::is_username_available($user_course['UserName'])) {
                 $user_course['error'] = get_lang('UnknownUser');
-                $errors[]             = $user_course;
+                $errors[] = $user_course;
             }
         }
 
@@ -55,7 +56,7 @@ function validate_data($users_courses)
         if (isset($user_course['Status']) && strlen($user_course['Status']) != 0) {
             if ($user_course['Status'] != COURSEMANAGER && $user_course['Status'] != STUDENT) {
                 $user_course['error'] = get_lang('UnknownStatus');
-                $errors[]             = $user_course;
+                $errors[] = $user_course;
             }
         }
     }
@@ -70,8 +71,8 @@ function save_data($users_courses)
 {
     $user_table = Database::get_main_table(TABLE_MAIN_USER);
     $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
-    $csv_data = array();
-    $inserted_in_course = array();
+    $csv_data = [];
+    $inserted_in_course = [];
     $courseListCache = [];
     $courseListById = [];
     foreach ($users_courses as $user_course) {
@@ -94,12 +95,12 @@ function save_data($users_courses)
         $sql = "SELECT * FROM $course_user_table cu
                 WHERE cu.user_id = $user_id AND cu.relation_type <> ".COURSE_RELATION_TYPE_RRHH." ";
         $res = Database::query($sql);
-        $db_subscriptions = array();
+        $db_subscriptions = [];
         while ($obj = Database::fetch_object($res)) {
             $db_subscriptions[$obj->c_id] = $obj->status;
         }
 
-        $to_subscribe   = array_diff(array_keys($csv_subscriptions), array_keys($db_subscriptions));
+        $to_subscribe = array_diff(array_keys($csv_subscriptions), array_keys($db_subscriptions));
         $to_unsubscribe = array_diff(array_keys($db_subscriptions), array_keys($csv_subscriptions));
 
         if ($_POST['subscribe']) {
@@ -107,13 +108,12 @@ function save_data($users_courses)
                 $courseInfo = $courseListById[$courseId];
                 $courseCode = $courseInfo['code'];
 
-                    CourseManager::subscribe_user(
+                CourseManager::subscribe_user(
                         $user_id,
                         $courseCode,
                         $csv_subscriptions[$courseId]
                     );
-                    $inserted_in_course[$courseInfo['code']] = $courseInfo['title'];
-
+                $inserted_in_course[$courseInfo['code']] = $courseInfo['title'];
             }
         }
 
@@ -131,12 +131,15 @@ function save_data($users_courses)
 
 /**
  * Reads CSV-file.
+ *
  * @param string $file Path to the CSV-file
+ *
  * @return array All course-information read from the file
  */
 function parse_csv_data($file)
 {
     $courses = Import :: csvToArray($file);
+
     return $courses;
 }
 
@@ -152,7 +155,7 @@ api_protect_admin_script();
 
 $tool_name = get_lang('AddUsersToACourse').' CSV';
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 set_time_limit(0);
 
@@ -163,8 +166,8 @@ $form->addElement('file', 'import_file', get_lang('ImportFileLocation'));
 $form->addElement('checkbox', 'subscribe', get_lang('Action'), get_lang('SubscribeUserIfNotAllreadySubscribed'));
 $form->addElement('checkbox', 'unsubscribe', '', get_lang('UnsubscribeUserIfSubscriptionIsNotInFile'));
 $form->addButtonImport(get_lang('Import'));
-$form->setDefaults(array('subscribe' => '1', 'unsubscribe' => 1));
-$errors = array();
+$form->setDefaults(['subscribe' => '1', 'unsubscribe' => 1]);
+$errors = [];
 
 if ($form->validate()) {
     $users_courses = parse_csv_data($_FILES['import_file']['tmp_name']);

+ 19 - 15
main/admin/course_user_import_by_email.php

@@ -3,7 +3,8 @@
 exit;
 /**
  * This tool allows platform admins to update course-user relations by uploading
- * a CSV file
+ * a CSV file.
+ *
  * @package chamilo.admin
  */
 /**
@@ -11,16 +12,16 @@ exit;
  */
 function validate_data($users_courses)
 {
-    $errors = array();
-    $coursecodes = array();
+    $errors = [];
+    $coursecodes = [];
     foreach ($users_courses as $index => $user_course) {
         $user_course['line'] = $index + 1;
         // 1. Check whether mandatory fields are set.
-        $mandatory_fields = array('Email', 'CourseCode', 'Status');
+        $mandatory_fields = ['Email', 'CourseCode', 'Status'];
         foreach ($mandatory_fields as $key => $field) {
             if (!isset($user_course[$field]) || strlen($user_course[$field]) == 0) {
                 $user_course['error'] = get_lang($field.'Mandatory');
-                $errors[]             = $user_course;
+                $errors[] = $user_course;
             }
         }
 
@@ -35,7 +36,7 @@ function validate_data($users_courses)
                 $res = Database::query($sql);
                 if (Database::num_rows($res) == 0) {
                     $user_course['error'] = get_lang('CodeDoesNotExists');
-                    $errors[]             = $user_course;
+                    $errors[] = $user_course;
                 } else {
                     $coursecodes[$user_course['CourseCode']] = 1;
                 }
@@ -47,7 +48,7 @@ function validate_data($users_courses)
             $user = api_get_user_info_from_email($user_course['Email']);
             if (empty($user)) {
                 $user_course['error'] = get_lang('UnknownUser');
-                $errors[]             = $user_course;
+                $errors[] = $user_course;
             }
         }
 
@@ -55,7 +56,7 @@ function validate_data($users_courses)
         if (isset($user_course['Status']) && strlen($user_course['Status']) != 0) {
             if ($user_course['Status'] != COURSEMANAGER && $user_course['Status'] != STUDENT) {
                 $user_course['error'] = get_lang('UnknownStatus');
-                $errors[]             = $user_course;
+                $errors[] = $user_course;
             }
         }
     }
@@ -70,8 +71,8 @@ function save_data($users_courses)
 {
     $user_table = Database::get_main_table(TABLE_MAIN_USER);
     $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
-    $csv_data = array();
-    $inserted_in_course = array();
+    $csv_data = [];
+    $inserted_in_course = [];
 
     foreach ($users_courses as $user_course) {
         $csv_data[$user_course['Email']][$user_course['CourseCode']] = $user_course['Status'];
@@ -87,12 +88,12 @@ function save_data($users_courses)
         $sql = "SELECT * FROM $course_user_table cu
                 WHERE cu.user_id = $user_id AND cu.relation_type <> ".COURSE_RELATION_TYPE_RRHH." ";
         $res = Database::query($sql);
-        $db_subscriptions = array();
+        $db_subscriptions = [];
         while ($obj = Database::fetch_object($res)) {
             $db_subscriptions[$obj->c_id] = $obj->status;
         }
 
-        $to_subscribe   = array_diff(array_keys($csv_subscriptions), array_keys($db_subscriptions));
+        $to_subscribe = array_diff(array_keys($csv_subscriptions), array_keys($db_subscriptions));
         $to_unsubscribe = array_diff(array_keys($db_subscriptions), array_keys($csv_subscriptions));
 
         if (isset($_POST['subscribe']) && $_POST['subscribe']) {
@@ -132,12 +133,15 @@ function save_data($users_courses)
 
 /**
  * Reads CSV-file.
+ *
  * @param string $file Path to the CSV-file
+ *
  * @return array All course-information read from the file
  */
 function parse_csv_data($file)
 {
     $courses = Import::csv_reader($file);
+
     return $courses;
 }
 
@@ -153,7 +157,7 @@ api_protect_admin_script();
 
 $tool_name = get_lang('AddUsersToACourse').' CSV';
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 set_time_limit(0);
 
@@ -164,8 +168,8 @@ $form->addElement('file', 'import_file', get_lang('ImportFileLocation'));
 $form->addElement('checkbox', 'subscribe', get_lang('Action'), get_lang('SubscribeUserIfNotAllreadySubscribed'));
 $form->addElement('checkbox', 'unsubscribe', '', get_lang('UnsubscribeUserIfSubscriptionIsNotInFile'));
 $form->addButtonImport(get_lang('Import'));
-$form->setDefaults(array('subscribe' => '1', 'unsubscribe' => 1));
-$errors = array();
+$form->setDefaults(['subscribe' => '1', 'unsubscribe' => 1]);
+$errors = [];
 
 if ($form->validate()) {
     $users_courses = parse_csv_data($_FILES['import_file']['tmp_name']);

+ 21 - 16
main/admin/dashboard_add_courses_to_user.php

@@ -2,7 +2,8 @@
 /* For licensing terms, see /license.txt */
 
 /**
- * Interface for assigning courses to Human Resources Manager
+ * Interface for assigning courses to Human Resources Manager.
+ *
  * @package chamilo.admin
  */
 // resetting the course id
@@ -20,8 +21,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'user_list.php', 'name' => get_lang('UserList'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'user_list.php', 'name' => get_lang('UserList')];
 
 // Database Table Definitions
 $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
@@ -31,7 +32,7 @@ $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_
 // initializing variables
 $user_id = intval($_GET['user']);
 $user_info = api_get_user_info($user_id);
-$user_anonymous  = api_get_anonymous_id();
+$user_anonymous = api_get_anonymous_id();
 $current_user_id = api_get_user_id();
 
 // setting the name of the tool
@@ -94,8 +95,9 @@ function search_courses($needle, $type)
             $return .= '<option value="'.$course['code'].'" title="'.htmlspecialchars($course['title'], ENT_QUOTES).'">'.$course['title'].' ('.$course['code'].')</option>';
         }
         $return .= '</select>';
-        $xajax_response -> addAssign('ajax_list_courses_multiple', 'innerHTML', api_utf8_encode($return));
+        $xajax_response->addAssign('ajax_list_courses_multiple', 'innerHTML', api_utf8_encode($return));
     }
+
     return $xajax_response;
 }
 
@@ -153,7 +155,7 @@ function remove_item(origin) {
 
 $formSent = 0;
 $errorMsg = $firstLetterCourse = '';
-$UserList = array();
+$UserList = [];
 
 $msg = '';
 if (isset($_POST['formSent']) && intval($_POST['formSent']) == 1) {
@@ -173,7 +175,7 @@ $actionsLeft = '<a href="dashboard_add_users_to_user.php?user='.$user_id.'">'.
 $actionsLeft .= '<a href="dashboard_add_sessions_to_user.php?user='.$user_id.'">'.
     Display::return_icon('session-add.png', get_lang('AssignSessions'), null, ICON_SIZE_MEDIUM).'</a>';
 
-echo $html = Display::toolbarAction('toolbar-dashboard', array($actionsLeft));
+echo $html = Display::toolbarAction('toolbar-dashboard', [$actionsLeft]);
 
 echo Display::page_header(
     sprintf(get_lang('AssignCoursesToX'), api_get_person_name($user_info['firstname'], $user_info['lastname'])),
@@ -208,7 +210,6 @@ if (api_is_multiple_url_enabled()) {
                 c.code LIKE '$needle' $without_assigned_courses AND
                 access_url_id = ".api_get_current_access_url_id()."
             ORDER BY c.title";
-
 } else {
     $sql = " SELECT c.code, c.title
             FROM $tbl_course c
@@ -219,7 +220,7 @@ if (api_is_multiple_url_enabled()) {
 $result = Database::query($sql);
 
 ?>
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?user=<?php echo $user_id ?>" style="margin:0px;">
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?user=<?php echo $user_id; ?>" style="margin:0px;">
 <input type="hidden" name="formSent" value="1" />
 <?php
 if (!empty($msg)) {
@@ -229,26 +230,30 @@ if (!empty($msg)) {
 
 <div class="row">
     <div class="col-md-4">
-        <h5><?php echo get_lang('CoursesListInPlatform') ?> :</h5>
+        <h5><?php echo get_lang('CoursesListInPlatform'); ?> :</h5>
 
         <div id="ajax_list_courses_multiple">
     <select id="origin" name="NoAssignedCoursesList[]" multiple="multiple" size="20" style="width:340px;">
-    <?php while ($enreg = Database::fetch_array($result)) { ?>
+    <?php while ($enreg = Database::fetch_array($result)) {
+    ?>
             <option value="<?php echo $enreg['code']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'], ENT_QUOTES).'"'; ?>><?php echo $enreg['title'].' ('.$enreg['code'].')'; ?></option>
-    <?php } ?>
+    <?php
+} ?>
     </select>
         </div>
 
     </div>
     <div class="col-md-4">
         <div class="code-course">
-        <?php if ($add_type == 'multiple') { ?>
+        <?php if ($add_type == 'multiple') {
+        ?>
         <p><?php echo get_lang('FirstLetterCourse'); ?> :</p>
         <select name="firstLetterCourse" class="selectpicker form-control" onchange = "xajax_search_courses(this.value,'multiple')">
             <option value="%">--</option>
             <?php  echo Display :: get_alphabet_options($firstLetter); ?>
         </select>
-        <?php } ?>
+        <?php
+    } ?>
         </div>
         <div class="control-course">
             <div class="separate-action">
@@ -281,11 +286,11 @@ if (!empty($msg)) {
             <?php
             if (is_array($assigned_courses_to_hrm)) {
                 foreach ($assigned_courses_to_hrm as $enreg) {
-            ?>
+                    ?>
                 <option value="<?php echo $enreg['code']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'], ENT_QUOTES).'"'; ?>><?php echo $enreg['title'].' ('.$enreg['code'].')'; ?></option>
             <?php
-                    }
                 }
+            }
             ?>
         </select>
     </div>

+ 23 - 14
main/admin/dashboard_add_sessions_to_user.php

@@ -2,7 +2,8 @@
 /* For licensing terms, see /license.txt */
 
 /**
- *  Interface for assigning sessions to Human Resources Manager
+ *  Interface for assigning sessions to Human Resources Manager.
+ *
  *  @package chamilo.admin
  */
 // resetting the course id
@@ -21,8 +22,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'user_list.php', 'name' => get_lang('UserList'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'user_list.php', 'name' => get_lang('UserList')];
 
 // Database Table Definitions
 $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
@@ -153,7 +154,7 @@ function remove_item(origin) {
 $formSent = 0;
 $firstLetterSession = isset($_POST['firstLetterSession']) ? $_POST['firstLetterSession'] : null;
 $errorMsg = '';
-$UserList = array();
+$UserList = [];
 
 if (isset($_POST['formSent']) && intval($_POST['formSent']) == 1) {
     $sessions_list = $_POST['SessionsList'];
@@ -179,7 +180,7 @@ if ($user_info['status'] != SESSIONADMIN) {
     $actionsLeft .= '<a href="dashboard_add_courses_to_user.php?user='.$user_id.'">'.
         Display::return_icon('course-add.png', get_lang('AssignCourses'), null, ICON_SIZE_MEDIUM).'</a>';
 
-    echo Display::toolbarAction('toolbar-dashboard', array($actionsLeft));
+    echo Display::toolbarAction('toolbar-dashboard', [$actionsLeft]);
 }
 
 echo Display::page_header(
@@ -216,33 +217,38 @@ if (api_is_multiple_url_enabled()) {
 }
 $result = Database::query($sql);
 ?>
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?user=<?php echo $user_id ?>" style="margin:0px;" <?php if ($ajax_search) { echo ' onsubmit="valide();"'; }?>>
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?user=<?php echo $user_id; ?>" style="margin:0px;" <?php if ($ajax_search) {
+    echo ' onsubmit="valide();"';
+}?>>
     <input type="hidden" name="formSent" value="1" />
 
     <div class="row">
         <div class="col-md-4">
-            <h5><?php echo get_lang('SessionsListInPlatform') ?> :</h5>
+            <h5><?php echo get_lang('SessionsListInPlatform'); ?> :</h5>
             <div id="ajax_list_sessions_multiple">
                 <select id="origin" name="NoAssignedSessionsList[]" multiple="multiple" size="20" style="width:340px;">
                     <?php
                     while ($enreg = Database::fetch_array($result)) {
-                    ?>
+                        ?>
                         <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['name'], ENT_QUOTES).'"'; ?>>
                             <?php echo $enreg['name']; ?>
                         </option>
-                    <?php } ?>
+                    <?php
+                    } ?>
                 </select>
             </div>
         </div>
         <div class="col-md-4">
             <div class="code-course">
-                <?php if ($add_type == 'multiple') { ?>
+                <?php if ($add_type == 'multiple') {
+                        ?>
                 <p><?php echo get_lang('FirstLetterSession'); ?> :</p>
                 <select class="selectpicker form-control" name="firstLetterSession" onchange = "xajax_search_sessions(this.value, 'multiple')">
                     <option value="%">--</option>
                         <?php  echo Display :: get_alphabet_options($firstLetterSession); ?>
                 </select>
-                <?php } ?>
+                <?php
+                    } ?>
             </div>
             <div class="control-course">
             <?php
@@ -253,7 +259,9 @@ $result = Database::query($sql);
                             <em class="fa fa-arrow-left"></em>
                         </button>
                     </div>
-                <?php } else { ?>
+                <?php
+                } else {
+                    ?>
                 <div class="separate-action">
                     <button class="btn btn-primary" type="button" onclick="moveItem(document.getElementById('origin'), document.getElementById('destination'))" onclick="moveItem(document.getElementById('origin'), document.getElementById('destination'))">
                         <em class="fa fa-arrow-right"></em>
@@ -289,9 +297,10 @@ $result = Database::query($sql);
                     foreach ($assigned_sessions_to_hrm as $enreg) {
                         ?>
                         <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['name'], ENT_QUOTES).'"'; ?>>
-                            <?php echo $enreg['name'] ?>
+                            <?php echo $enreg['name']; ?>
                         </option>
-                <?php }
+                <?php
+                    }
                 }?>
             </select>
         </div>

+ 40 - 34
main/admin/dashboard_add_users_to_user.php

@@ -2,7 +2,8 @@
 /* For licensing terms, see /license.txt */
 
 /**
- *  Interface for assigning users to Human Resources Manager
+ *  Interface for assigning users to Human Resources Manager.
+ *
  *  @package chamilo.admin
  */
 
@@ -23,8 +24,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'user_list.php', 'name' => get_lang('UserList'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'user_list.php', 'name' => get_lang('UserList')];
 
 // Database Table Definitions
 $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
@@ -33,7 +34,7 @@ $tbl_access_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_US
 // initializing variables
 $user_id = intval($_GET['user']);
 $user_info = api_get_user_info($user_id);
-$user_anonymous  = api_get_anonymous_id();
+$user_anonymous = api_get_anonymous_id();
 $current_user_id = api_get_user_id();
 
 $userStatus = api_get_user_status($user_id);
@@ -69,11 +70,10 @@ function search_users($needle, $type)
     $xajax_response = new xajaxResponse();
     $return = '';
     if (!empty($needle) && !empty($type)) {
-        $assigned_users_to_hrm = array();
+        $assigned_users_to_hrm = [];
 
         switch ($userStatus) {
             case DRH:
-                //no break;
             case PLATFORM_ADMIN:
                 $assigned_users_to_hrm = UserManager::get_users_followed_by_drh($user_id);
                 break;
@@ -108,7 +108,6 @@ function search_users($needle, $type)
                         access_url_id = ".api_get_current_access_url_id()."
                     $order_clause
                     ";
-
         } else {
             $sql = "SELECT user_id, username, lastname, firstname
                     FROM $tbl_user user
@@ -248,20 +247,20 @@ function remove_item(origin) {
 
 $formSent = 0;
 $errorMsg = '';
-$UserList = array();
+$UserList = [];
 
 // Filters
-$filters = array(
-    array('type' => 'text', 'name' => 'username', 'label' => get_lang('Username')),
-    array('type' => 'text', 'name' => 'firstname', 'label' => get_lang('FirstName')),
-    array('type' => 'text', 'name' => 'lastname', 'label' => get_lang('LastName')),
-    array('type' => 'text', 'name' => 'official_code', 'label' => get_lang('OfficialCode')),
-    array('type' => 'text', 'name' => 'email', 'label' => get_lang('Email'))
-);
+$filters = [
+    ['type' => 'text', 'name' => 'username', 'label' => get_lang('Username')],
+    ['type' => 'text', 'name' => 'firstname', 'label' => get_lang('FirstName')],
+    ['type' => 'text', 'name' => 'lastname', 'label' => get_lang('LastName')],
+    ['type' => 'text', 'name' => 'official_code', 'label' => get_lang('OfficialCode')],
+    ['type' => 'text', 'name' => 'email', 'label' => get_lang('Email')],
+];
 
 $searchForm = new FormValidator('search', 'get', api_get_self().'?user='.$user_id);
 $searchForm->addHeader(get_lang('AdvancedSearch'));
-$renderer = & $searchForm->defaultRenderer();
+$renderer = &$searchForm->defaultRenderer();
 
 $searchForm->addElement('hidden', 'user', $user_id);
 foreach ($filters as $param) {
@@ -269,12 +268,12 @@ foreach ($filters as $param) {
 }
 $searchForm->addButtonSearch(get_lang('Search'));
 
-$filterData = array();
+$filterData = [];
 if ($searchForm->validate()) {
     $filterData = $searchForm->getSubmitValues();
 }
 
-$conditions = array();
+$conditions = [];
 if (!empty($filters) && !empty($filterData)) {
     foreach ($filters as $filter) {
         if (isset($filter['name']) && isset($filterData[$filter['name']])) {
@@ -290,7 +289,6 @@ if (isset($_POST['formSent']) && intval($_POST['formSent']) == 1) {
     $user_list = isset($_POST['UsersList']) ? $_POST['UsersList'] : null;
     switch ($userStatus) {
         case DRH:
-            //no break;
         case PLATFORM_ADMIN:
             $affected_rows = UserManager::subscribeUsersToHRManager($user_id, $user_list);
             break;
@@ -329,7 +327,7 @@ if ($userStatus != STUDENT_BOSS) {
 $actionsRight = Display::url(
     '<em class="fa fa-search"></em> '.get_lang('AdvancedSearch'),
     '#',
-    array('class' => 'btn btn-default advanced_options', 'id' => 'advanced_search')
+    ['class' => 'btn btn-default advanced_options', 'id' => 'advanced_search']
 );
 
 $toolbar = Display::toolbarAction('toolbar-dashboard', [$actionsLeft, $actionsRight]);
@@ -348,11 +346,10 @@ echo Display::page_header(
     'h3'
 );
 
-$assigned_users_to_hrm = array();
+$assigned_users_to_hrm = [];
 
 switch ($userStatus) {
     case DRH:
-        //no break;
     case PLATFORM_ADMIN:
         $assigned_users_to_hrm = UserManager::get_users_followed_by_drh($user_id);
         break;
@@ -375,7 +372,7 @@ if (!empty($firstLetterUser)) {
 
 $sqlConditions = null;
 if (!empty($conditions)) {
-    $temp_conditions = array();
+    $temp_conditions = [];
     foreach ($conditions as $field => $value) {
         $field = Database::escape_string($field);
         $value = Database::escape_string($value);
@@ -414,11 +411,13 @@ if (api_is_multiple_url_enabled()) {
 }
 $result = Database::query($sql);
 ?>
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?user=<?php echo $user_id ?>" class="form-horizontal" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?>>
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?user=<?php echo $user_id; ?>" class="form-horizontal" <?php if ($ajax_search) {
+    echo ' onsubmit="valide();"';
+}?>>
 <input type="hidden" name="formSent" value="1" />
 <div class="row">
     <div class="col-md-4">
-        <?php echo get_lang('UserListInPlatform') ?>
+        <?php echo get_lang('UserListInPlatform'); ?>
         <div class="form-group">
             <div class="col-sm-12">
                 <div id="ajax_list_users_multiple">
@@ -429,7 +428,8 @@ $result = Database::query($sql);
                             <option value="<?php echo $enreg['user_id']; ?>" <?php echo 'title="'.htmlspecialchars($person_name, ENT_QUOTES).'"'; ?>>
                             <?php echo $person_name.' ('.$enreg['username'].')'; ?>
                             </option>
-                        <?php } ?>
+                        <?php
+                        } ?>
                     </select>
                 </div>
             </div>
@@ -437,20 +437,25 @@ $result = Database::query($sql);
     </div>
     <div class="col-md-4">
         <div class="code-course">
-            <?php if ($add_type == 'multiple') { ?>
+            <?php if ($add_type == 'multiple') {
+                            ?>
                 <p><?php echo get_lang('FirstLetterUser'); ?></p>
                 <select class="selectpicker show-tick form-control" name="firstLetterUser" onchange = "xajax_search_users(this.value,'multiple')">
                     <option value="%">--</option>
                     <?php echo Display::get_alphabet_options($firstLetterUser); ?>
                 </select>
-            <?php } ?>
+            <?php
+                        } ?>
         </div>
         <div class="control-course">
-        <?php if ($ajax_search) { ?>
+        <?php if ($ajax_search) {
+                            ?>
             <div class="separate-action">
                 <button class="btn btn-primary" type="button" onclick="remove_item(document.getElementById('destination'))"></button>
             </div>
-        <?php } else { ?>
+        <?php
+                        } else {
+                            ?>
             <div class="separate-action">
                 <button id="add_user_button" class="btn btn-primary" type="button" onclick="moveItem(document.getElementById('origin'), document.getElementById('destination'))" onclick="moveItem(document.getElementById('origin'), document.getElementById('destination'))">
                 <em class="fa fa-chevron-right"></em>
@@ -461,7 +466,8 @@ $result = Database::query($sql);
                 <em class="fa fa-chevron-left"></em>
                 </button>
             </div>
-        <?php } ?>
+        <?php
+                        } ?>
             <div class="separate-action">
         <?php
         echo '<button id="assign_user" class="btn btn-success" type="button" value="" onclick="valide()" >'.$tool_name.'</button>';
@@ -492,12 +498,12 @@ $result = Database::query($sql);
                     <?php
                     if (is_array($assigned_users_to_hrm)) {
                         foreach ($assigned_users_to_hrm as $enreg) {
-                            $person_name = api_get_person_name($enreg['firstname'], $enreg['lastname']);
-                    ?>
+                            $person_name = api_get_person_name($enreg['firstname'], $enreg['lastname']); ?>
                             <option value="<?php echo $enreg['user_id']; ?>" <?php echo 'title="'.htmlspecialchars($person_name, ENT_QUOTES).'"'; ?>>
                             <?php echo $person_name.' ('.$enreg['username'].')'; ?>
                             </option>
-                        <?php }
+                        <?php
+                        }
                     }?>
                 </select>
             </div>

+ 3 - 2
main/admin/email_tester.php

@@ -1,7 +1,8 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
- * Index page of the admin tools
+ * Index page of the admin tools.
+ *
  * @package chamilo.admin
  */
 // Resetting the course id.
@@ -31,7 +32,7 @@ $form->addHtmlEditor(
 $form->addButtonSend(get_lang('SendMessage'), 'submit', false, ['cols-size' => [2, 8, 2]]);
 $form->setDefaults([
     'smtp_host' => $platform_email['SMTP_HOST'],
-    'smtp_port' => $platform_email['SMTP_PORT']
+    'smtp_port' => $platform_email['SMTP_PORT'],
 ]);
 $form->freeze(['smtp_host', 'smtp_port']);
 

+ 15 - 13
main/admin/event_controller.php

@@ -1,8 +1,10 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
- * Global events controller class
+ * Global events controller class.
+ *
  * @deprecated to be removed in 2.x
+ *
  * @package chamilo.admin
  */
 $cidReset = true;
@@ -41,23 +43,23 @@ switch ($action) {
 $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_event_email_template';
 
 //The order is important you need to check the the $column variable in the model.ajax.php file
-$columns = array(
+$columns = [
     get_lang('Subject'),
     get_lang('EventTypeName'),
     get_lang('Language'),
     get_lang('Status'),
     get_lang('Actions'),
-);
+];
 
 //Column config
-$column_model = array(
-    array('name' => 'subject', 'index' => 'subject', 'width' => '80', 'align' => 'left'),
+$column_model = [
+    ['name' => 'subject', 'index' => 'subject', 'width' => '80', 'align' => 'left'],
 //                        array('name'=>'message',        'index'=>'message', 'width'=>'500',  'align'=>'left','sortable'=>'false'),
-    array('name' => 'event_type_name', 'index' => 'event_type_name', 'width' => '80', 'align' => 'left'),
-    array('name' => 'language_id', 'index' => 'language_id', 'width' => '80', 'align' => 'left'),
-    array('name' => 'activated', 'index' => 'activated', 'width' => '80', 'align' => 'left'),
-    array('name' => 'actions', 'index' => 'actions', 'width' => '100'),
-);
+    ['name' => 'event_type_name', 'index' => 'event_type_name', 'width' => '80', 'align' => 'left'],
+    ['name' => 'language_id', 'index' => 'language_id', 'width' => '80', 'align' => 'left'],
+    ['name' => 'activated', 'index' => 'activated', 'width' => '80', 'align' => 'left'],
+    ['name' => 'actions', 'index' => 'actions', 'width' => '100'],
+];
 //Autowidth
 $extra_params['autowidth'] = 'true';
 //height auto
@@ -66,12 +68,12 @@ $extra_params['height'] = 'auto';
 $htmlHeadXtra[] = api_get_jqgrid_js();
 $htmlHeadXtra[] = '<script>
 $(function() {
-    '.Display::grid_js('event_email_template', $url, $columns, $column_model, $extra_params, array(), $action_links, true).'
+    '.Display::grid_js('event_email_template', $url, $columns, $column_model, $extra_params, [], $action_links, true).'
 });
 </script>';
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Events'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Events')];
 
 $tpl = new Template($tool_name);
 $tpl->assign('message', $message);

+ 31 - 28
main/admin/event_type.php

@@ -1,11 +1,12 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
- * Definition of new system event types
+ * Definition of new system event types.
+ *
  * @deprecated to be removed in 2.x
+ *
  * @package chamilo.admin.events
  */
-
 $cidReset = true;
 
 require_once __DIR__.'/../inc/global.inc.php';
@@ -30,7 +31,7 @@ if ($action == 'modEventType') {
     if ($eventUsers) {
         $users = explode(';', $eventUsers);
     } else {
-        $users = array();
+        $users = [];
     }
     if (!empty($event_name)) {
         $eventName = $event_name;
@@ -51,21 +52,21 @@ $ets = Event::get_all_event_types();
 $languages = api_get_languages();
 $ajaxPath = api_get_path(WEB_CODE_PATH).'inc/ajax/events.ajax.php';
 
-$action_array = array(
-    array(
+$action_array = [
+    [
         'url' => 'event_controller.php?action=listing',
         'content' => Display::return_icon(
             'view_text.png',
             get_lang('ListView'),
-            array(),
+            [],
             ICON_SIZE_MEDIUM
         ),
-    )
-);
+    ],
+];
 
 $key_lang = get_lang('YouHaveSomeUnsavedChanges');
-$users = UserManager::get_user_list(array(), array('firstname'));
-$new_user_list = array();
+$users = UserManager::get_user_list([], ['firstname']);
+$new_user_list = [];
 foreach ($users as $user) {
     if ($user['status'] == ANONYMOUS) {
         continue;
@@ -74,10 +75,10 @@ foreach ($users as $user) {
 }
 
 /**
- * Header definition
+ * Header definition.
  */
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'event_controller.php', 'name' => get_lang('Events'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'event_controller.php', 'name' => get_lang('Events')];
 $tool_name = get_lang('EventMessageManagement');
 
 Display::display_header($tool_name);
@@ -85,18 +86,19 @@ Display::display_header($tool_name);
 echo Display::actions($action_array);
 
 /**
- * JavaScript code
+ * JavaScript code.
+ *
  * @todo move into HTML header
  */
 ?>
 <script>
-    var usersList = <?php echo json_encode($new_user_list) ?>;
-    var eventTypes = <?php echo json_encode($ets) ?>;
-    var eventsConfig = <?php echo json_encode($event_config) ?>;
-    var currentLanguage = <?php echo json_encode(api_get_interface_language()) ?>;
+    var usersList = <?php echo json_encode($new_user_list); ?>;
+    var eventTypes = <?php echo json_encode($ets); ?>;
+    var eventsConfig = <?php echo json_encode($event_config); ?>;
+    var currentLanguage = <?php echo json_encode(api_get_interface_language()); ?>;
     var flagContentHasChanged = false;
-    var key_lang = "<?php echo $key_lang ?>";
-    var event_type_name = "<?php echo $event_name ?>";
+    var key_lang = "<?php echo $key_lang; ?>";
+    var event_type_name = "<?php echo $event_name; ?>";
 
     $(document).ready(function() {
         confirmMessage("eventList");
@@ -107,7 +109,7 @@ echo Display::actions($action_array);
 
     function ajax(params,func) {
         $.ajax({
-            url: "<?php echo $ajaxPath ?>",
+            url: "<?php echo $ajaxPath; ?>",
             type: "POST",
             data: params,
             success: func
@@ -195,7 +197,7 @@ echo Display::actions($action_array);
         if (self_sent == false ) {
 
             $.ajax({
-                url: '<?php echo $ajaxPath ?>?action=get_event_users&eventName=' +currentEventName,
+                url: '<?php echo $ajaxPath; ?>?action=get_event_users&eventName=' +currentEventName,
                 dataType: 'json',
                 success: function(data) {
                     removeAllOption($('#usersSubList'));
@@ -309,12 +311,13 @@ echo Display::actions($action_array);
 </script>
 <?php
 /**
- * HTML body
+ * HTML body.
+ *
  * @todo move as template layout
  */
 ?>
 <div class="page-header">
-<h2><?php echo get_lang('EventMessageManagement') ?></h2>
+<h2><?php echo get_lang('EventMessageManagement'); ?></h2>
 </div>
 
 <form method="POST" onSubmit="return submitForm(); ">
@@ -358,17 +361,18 @@ echo Display::actions($action_array);
     <br />
     <select id="languages" name="languages" style="margin-top:20px;" onclick='confirmMessage(this.name); return false;'>
 <?php foreach ($languages["name"] as $key => $value) {
-    $english_name = $languages['folder'][$key]; ?>
+            $english_name = $languages['folder'][$key]; ?>
     <option value="<?php echo $english_name; ?>" <?php echo ($english_name == api_get_interface_language()) ? "selected=selected" : ""; ?>>
         <?php echo $value; ?>
     </option>
-<?php } ?>
+<?php
+        } ?>
     </select>
 
     <input type="hidden" name="action" value="modEventType" />
     <input type="hidden" name="eventId" id="eventId"  />
     <input type="hidden" name="eventUsers" id="eventUsers" />
-    <input type="hidden" id="eventName" value="<?php echo $event_name ?>"/>
+    <input type="hidden" id="eventName" value="<?php echo $event_name; ?>"/>
 
     <br />
     <br />
@@ -403,4 +407,3 @@ echo Display::actions($action_array);
 </form>
 <?php
 Display :: display_footer();
-

+ 2 - 3
main/admin/export_certificates.php

@@ -4,14 +4,13 @@
 /**
  *  @package chamilo.admin
  */
-
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 Display::display_header(null);
 
 $form = new FormValidator('export_certificate');
 $courses = CourseManager::get_courses_list(0, 0, 'title');
-$options = array();
+$options = [];
 foreach ($courses as $course) {
     $options[$course['id']] = $course['title'];
 }
@@ -42,7 +41,7 @@ if ($form->validate()) {
 
         if (isset($cats[0])) {
             /** @var Category $cat */
-            $userList = array();
+            $userList = [];
             foreach ($users as $user) {
                 $userInfo = api_get_user_info_from_official_code(
                     $user['official_code']

+ 9 - 13
main/admin/extra_field_geo.php

@@ -4,7 +4,6 @@ exit;
 /**
  *  @package chamilo.admin
  */
-
 $cidReset = true;
 require_once '../inc/global.inc.php';
 
@@ -18,7 +17,7 @@ api_protect_admin_script();
 $htmlHeadXtra[] = api_get_jqgrid_js();
 
 // setting breadcrumbs
-$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 $tool_name = null;
 
@@ -41,23 +40,21 @@ $values = $extraFieldValue->get_values_by_handler_and_field_id(
     $field_id
 );
 
-
 $check = Security::check_token('request');
 $token = Security::get_token();
 
-$interbreadcrumb[]=array('url' => 'extra_fields.php?type='.$extra_field->type,'name' => $extra_field->pageName);
-$interbreadcrumb[]=array(
-    'url' =>  'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'],
-    'name' => $extra_field_info['display_text']
-);
-$interbreadcrumb[]=array('url' => '#','name' => get_lang('Geolocalization'));
-
+$interbreadcrumb[] = ['url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName];
+$interbreadcrumb[] = [
+    'url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'],
+    'name' => $extra_field_info['display_text'],
+];
+$interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Geolocalization')];
 
 //jqgrid will use this URL to do the selects
 $params = 'field_id='.$field_id.'&type='.$extra_field->type;
 $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_extra_field_options&'.$params;
 
-$htmlHeadXtra[]='<script>
+$htmlHeadXtra[] = '<script>
 $(function() {
     // grid definition see the $obj->display() function
     '.Display::grid_js(
@@ -66,7 +63,7 @@ $(function() {
         $columns,
         $column_model,
         $extra_params,
-        array(),
+        [],
         $action_links,
         true
     ).'
@@ -78,5 +75,4 @@ Display::display_header($tool_name);
 
 echo Display::page_header($extra_field_info['display_text']);
 
-
 Display :: display_footer();

+ 2 - 2
main/admin/extra_field_list.php

@@ -5,13 +5,13 @@ require_once __DIR__.'/../inc/global.inc.php';
 
 api_protect_global_admin_script();
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 $template = new Template(get_lang('ExtraFields'));
 
 $types = ExtraField::getValidExtraFieldTypes();
 
-$table = new HTML_Table(array('class' => 'table'));
+$table = new HTML_Table(['class' => 'table']);
 $table->setHeaderContents(0, 0, get_lang('Type'));
 $table->setHeaderContents(0, 1, get_lang('Actions'));
 $url = api_get_path(WEB_CODE_PATH).'admin/extra_fields.php?type=';

+ 32 - 33
main/admin/extra_field_options.php

@@ -4,7 +4,6 @@
 /**
  *  @package chamilo.admin
  */
-
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 
@@ -17,7 +16,7 @@ api_protect_admin_script();
 $htmlHeadXtra[] = api_get_jqgrid_js();
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 $tool_name = null;
 
@@ -38,23 +37,23 @@ $check = Security::check_token('request');
 $token = Security::get_token();
 
 if ($action == 'add') {
-    $interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName);
-    $interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'], 'name' => $extra_field_info['display_text']);
-    $interbreadcrumb[] = array('url' => 'extra_field_options.php?type='.$extra_field->type.'&field_id='.$extra_field_info['id'], 'name' => get_lang('EditExtraFieldOptions'));
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Add'));
+    $interbreadcrumb[] = ['url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName];
+    $interbreadcrumb[] = ['url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'], 'name' => $extra_field_info['display_text']];
+    $interbreadcrumb[] = ['url' => 'extra_field_options.php?type='.$extra_field->type.'&field_id='.$extra_field_info['id'], 'name' => get_lang('EditExtraFieldOptions')];
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Add')];
 } elseif ($action == 'edit') {
-    $interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName);
-    $interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'], 'name' => $extra_field_info['display_text']);
-    $interbreadcrumb[] = array('url' => 'extra_field_options.php?type='.$extra_field->type.'&field_id='.$extra_field_info['id'], 'name' => get_lang('EditExtraFieldOptions'));
+    $interbreadcrumb[] = ['url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName];
+    $interbreadcrumb[] = ['url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'], 'name' => $extra_field_info['display_text']];
+    $interbreadcrumb[] = ['url' => 'extra_field_options.php?type='.$extra_field->type.'&field_id='.$extra_field_info['id'], 'name' => get_lang('EditExtraFieldOptions')];
 
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit'));
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Edit')];
 } else {
-    $interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName);
-    $interbreadcrumb[] = array(
-        'url' =>  'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'],
-        'name' => $extra_field_info['display_text']
-    );
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('EditExtraFieldOptions'));
+    $interbreadcrumb[] = ['url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName];
+    $interbreadcrumb[] = [
+        'url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'],
+        'name' => $extra_field_info['display_text'],
+    ];
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('EditExtraFieldOptions')];
 }
 
 //jqgrid will use this URL to do the selects
@@ -62,44 +61,44 @@ $params = 'field_id='.$field_id.'&type='.$extra_field->type;
 $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_extra_field_options&'.$params;
 
 //The order is important you need to check the the $column variable in the model.ajax.php file
-$columns = array(
+$columns = [
     get_lang('Name'),
     get_lang('Value'),
     get_lang('Order'),
     get_lang('Actions'),
-);
+];
 
 //Column config
-$column_model = array(
-    array(
+$column_model = [
+    [
         'name' => 'display_text',
         'index' => 'display_text',
         'width' => '180',
         'align' => 'left',
-    ),
-    array(
+    ],
+    [
         'name' => 'option_value',
         'index' => 'option_value',
         'width' => '',
         'align' => 'left',
         'sortable' => 'false',
-    ),
-    array(
+    ],
+    [
         'name' => 'option_order',
         'index' => 'option_order',
         'width' => '',
         'align' => 'left',
         'sortable' => 'false',
-    ),
-    array(
+    ],
+    [
         'name' => 'actions',
         'index' => 'actions',
         'width' => '100',
         'align' => 'left',
         'formatter' => 'action_formatter',
         'sortable' => 'false',
-    ),
-);
+    ],
+];
 //Autowidth
 $extra_params['autowidth'] = 'true';
 //height auto
@@ -121,7 +120,7 @@ $(function() {
         $columns,
         $column_model,
         $extra_params,
-        array(),
+        [],
         $action_links,
         true
     ).'
@@ -142,7 +141,7 @@ switch ($action) {
         if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
             api_not_allowed();
         }
-        $url  = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&'.$params;
+        $url = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&'.$params;
         $form = $obj->return_form($url, 'add');
 
         // The validation or display
@@ -157,13 +156,13 @@ switch ($action) {
             $obj->display();
         } else {
             $form->addElement('hidden', 'sec_token');
-            $form->setConstants(array('sec_token' => $token));
+            $form->setConstants(['sec_token' => $token]);
             $form->display();
         }
         break;
     case 'edit':
         // Action handling: Editing
-        $url  = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&id='.intval($_GET['id']).'&'.$params;
+        $url = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&id='.intval($_GET['id']).'&'.$params;
         $form = $obj->return_form($url, 'edit');
 
         // The validation or display
@@ -176,7 +175,7 @@ switch ($action) {
             $obj->display();
         } else {
             $form->addElement('hidden', 'sec_token');
-            $form->setConstants(array('sec_token' => $token));
+            $form->setConstants(['sec_token' => $token]);
             $form->display();
         }
         break;

+ 47 - 49
main/admin/extra_field_workflow.php

@@ -4,7 +4,6 @@
 /**
  *  @package chamilo.admin
  */
-
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 
@@ -15,7 +14,7 @@ $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
 api_protect_admin_script();
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 $tool_name = null;
 
@@ -36,44 +35,44 @@ $check = Security::check_token('request');
 $token = Security::get_token();
 
 if ($action == 'add') {
-    $interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extraField->type, 'name' => $extraField->pageName);
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = ['url' => 'extra_fields.php?type='.$extraField->type, 'name' => $extraField->pageName];
+    $interbreadcrumb[] = [
         'url' => 'extra_fields.php?type='.$extraField->type.'&action=edit&id='.$extraFieldInfo['id'],
-        'name' => $extraFieldInfo['display_text']
-    );
-    $interbreadcrumb[] = array(
+        'name' => $extraFieldInfo['display_text'],
+    ];
+    $interbreadcrumb[] = [
         'url' => 'extra_field_options.php?type='.$extraField->type.'&field_id='.$extraFieldInfo['id'],
-        'name' => get_lang('EditExtraFieldOptions')
-    );
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Add'));
+        'name' => get_lang('EditExtraFieldOptions'),
+    ];
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Add')];
 } elseif ($action == 'edit') {
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = [
         'url' => 'extra_fields.php?type='.$extraField->type,
-        'name' => $extraField->pageName
-    );
-    $interbreadcrumb[] = array(
+        'name' => $extraField->pageName,
+    ];
+    $interbreadcrumb[] = [
         'url' => 'extra_fields.php?type='.$extraField->type.'&action=edit&id='.$extraFieldInfo['id'],
-        'name' => $extraFieldInfo['display_text']
-    );
-    $interbreadcrumb[] = array(
+        'name' => $extraFieldInfo['display_text'],
+    ];
+    $interbreadcrumb[] = [
         'url' => 'extra_field_options.php?type='.$extraField->type.'&field_id='.$extraFieldInfo['id'],
-        'name' => get_lang('EditExtraFieldOptions')
-    );
+        'name' => get_lang('EditExtraFieldOptions'),
+    ];
 
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit'));
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Edit')];
 } else {
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = [
         'url' => 'extra_fields.php?type='.$extraField->type,
-        'name' => $extraField->pageName
-    );
-    $interbreadcrumb[] = array(
+        'name' => $extraField->pageName,
+    ];
+    $interbreadcrumb[] = [
         'url' => 'extra_fields.php?type='.$extraField->type.'&action=edit&id='.$extraFieldInfo['id'],
-        'name' => $extraFieldInfo['display_text']
-    );
-    $interbreadcrumb[] = array(
+        'name' => $extraFieldInfo['display_text'],
+    ];
+    $interbreadcrumb[] = [
         'url' => '#',
-        'name' => get_lang('EditExtraFieldOptions')
-    );
+        'name' => get_lang('EditExtraFieldOptions'),
+    ];
 }
 
 $roleId = isset($_REQUEST['roleId']) ? $_REQUEST['roleId'] : null;
@@ -83,7 +82,7 @@ $params = 'field_id='.$field_id.'&type='.$extraField->type.'&roleId='.$roleId;
 $paramsNoRole = 'field_id='.$field_id.'&type='.$extraField->type;
 
 //The order is important you need to check the the $column variable in the model.ajax.php file
-$columns = array(get_lang('Name'), get_lang('Value'), get_lang('Order'), get_lang('Actions'));
+$columns = [get_lang('Name'), get_lang('Value'), get_lang('Order'), get_lang('Actions')];
 
 $htmlHeadXtra[] = '<script>
 
@@ -123,17 +122,17 @@ Display::display_header($tool_name);
 echo Display::page_header($extraFieldInfo['display_text']);
 
 $obj = new ExtraFieldOption($type);
-$columns = array('display_text', 'option_value', 'option_order');
+$columns = ['display_text', 'option_value', 'option_order'];
 $result = Database::select(
     '*',
     $obj->table,
-    array(
-        'where' => array("field_id = ? " => $field_id),
-        'order' => "option_order ASC"
-    )
+    [
+        'where' => ["field_id = ? " => $field_id],
+        'order' => "option_order ASC",
+    ]
 );
 
-$table = new HTML_Table(array('class' => 'data_table'));
+$table = new HTML_Table(['class' => 'data_table']);
 $column = 0;
 $row = 0;
 $table->setHeaderContents($row, $column, get_lang('CurrentStatus'));
@@ -148,12 +147,12 @@ $form = new FormValidator('workflow', 'post', api_get_self().'?'.$params);
 $options = api_get_user_roles();
 $options[0] = get_lang('SelectAnOption');
 ksort($options);
-$form->addElement('select', 'status', get_lang('SelectRole'), $options, array('onclick' => 'changeStatus(this)'));
+$form->addElement('select', 'status', get_lang('SelectRole'), $options, ['onclick' => 'changeStatus(this)']);
 
 $checks = $app['orm.em']->getRepository('ChamiloLMS\Entity\ExtraFieldOptionRelFieldOption')->findBy(
-    array('fieldId' => $field_id, 'roleId' => $roleId)
+    ['fieldId' => $field_id, 'roleId' => $roleId]
 );
-$includedFields = array();
+$includedFields = [];
 if (!empty($checks)) {
     foreach ($checks as $availableField) {
         $includedFields[$availableField->getFieldOptionId()][] = $availableField->getRelatedFieldOptionId();
@@ -169,7 +168,7 @@ foreach ($result as $item) {
     foreach ($result as $itemCol) {
         $id = 'extra_field_status_'.$item['id'].'_'.$itemCol['id'];
         $idForm = 'extra_field_status['.$item['id'].']['.$itemCol['id'].']';
-        $attributes = array('onclick' => 'setHidden(this)');
+        $attributes = ['onclick' => 'setHidden(this)'];
         $value = 0;
 
         if (isset($includedFields[$itemCol['id']]) && in_array($item['id'], $includedFields[$itemCol['id']])) {
@@ -179,7 +178,7 @@ foreach ($result as $item) {
 
         $element = Display::input('checkbox', $id, null, $attributes);
         $table->setCellContents($row, $column, $element);
-        $form->addElement('hidden', 'hidden_'.$idForm, $value, array('id' => 'hidden_'.$id));
+        $form->addElement('hidden', 'hidden_'.$idForm, $value, ['id' => 'hidden_'.$id]);
         $column++;
     }
     $row++;
@@ -187,13 +186,13 @@ foreach ($result as $item) {
 
 if (!empty($roleId)) {
     $form->addElement('html', $table->toHtml());
-    $group = array();
+    $group = [];
     $group[] = $form->createElement('button', 'submit', get_lang('Save'));
-    $group[] = $form->createElement('button', 'select_all', get_lang('SelectAll'), array('class' => 'btn select_all'));
-    $group[] = $form->createElement('button', 'unselect_all', get_lang('UnSelectAll'), array('class' => 'btn unselect_all'));
+    $group[] = $form->createElement('button', 'select_all', get_lang('SelectAll'), ['class' => 'btn select_all']);
+    $group[] = $form->createElement('button', 'unselect_all', get_lang('UnSelectAll'), ['class' => 'btn unselect_all']);
     $form->addGroup($group, '', null, ' ');
 
-    $form->setDefaults(array('status' => $roleId));
+    $form->setDefaults(['status' => $roleId]);
 } else {
     $form->addButtonUpdate(get_lang('Edit'));
 }
@@ -207,12 +206,12 @@ if ($form->validate()) {
         foreach ($result as $id => $items) {
             foreach ($items as $subItemId => $value) {
                 $extraFieldOptionRelFieldOption = $app['orm.em']->getRepository('ChamiloLMS\Entity\ExtraFieldOptionRelFieldOption')->findOneBy(
-                    array(
+                    [
                     'fieldId' => $field_id,
                     'fieldOptionId' => $subItemId,
                     'roleId' => $roleId,
-                    'relatedFieldOptionId' => $id
-                    )
+                    'relatedFieldOptionId' => $id,
+                    ]
                 );
 
                 if ($value == 1) {
@@ -229,7 +228,6 @@ if ($form->validate()) {
                         $app['orm.ems']['db_write']->remove($extraFieldOptionRelFieldOption);
                     }
                 }
-
             }
         }
         $app['orm.ems']['db_write']->flush();

+ 16 - 17
main/admin/extra_fields.php

@@ -4,7 +4,6 @@
 /**
  *  @package chamilo.admin
  */
-
 $cidReset = true;
 
 require_once __DIR__.'/../inc/global.inc.php';
@@ -19,7 +18,7 @@ api_protect_admin_script();
 $htmlHeadXtra[] = api_get_jqgrid_js();
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 $tool_name = null;
 
@@ -55,13 +54,13 @@ $action_links = $obj->getJqgridActionLinks($token);
 $htmlHeadXtra[] = '<script>
 $(function() {
     // grid definition see the $obj->display() function
-    ' .Display::grid_js(
+    '.Display::grid_js(
         $obj->type.'_fields',
         $url,
         $columns,
         $column_model,
         $extra_params,
-        array(),
+        [],
         $action_links,
         true
     ).'
@@ -70,37 +69,37 @@ $(function() {
         id = $(this).val();
         switch(id) {
             case "1":
-                $("#example").html("' . addslashes(Display::return_icon('userfield_text.png')).'");
+                $("#example").html("'.addslashes(Display::return_icon('userfield_text.png')).'");
                 break;
             case "2":
-                $("#example").html("' . addslashes(Display::return_icon('userfield_text_area.png')).'");
+                $("#example").html("'.addslashes(Display::return_icon('userfield_text_area.png')).'");
                 break;
             case "3":
-                $("#example").html("' . addslashes(Display::return_icon('add_user_field_howto.png')).'");
+                $("#example").html("'.addslashes(Display::return_icon('add_user_field_howto.png')).'");
                 break;
             case "4":
-                $("#example").html("' . addslashes(Display::return_icon('userfield_drop_down.png')).'");
+                $("#example").html("'.addslashes(Display::return_icon('userfield_drop_down.png')).'");
                 break;
             case "5":
-                $("#example").html("' . addslashes(Display::return_icon('userfield_multidropdown.png')).'");
+                $("#example").html("'.addslashes(Display::return_icon('userfield_multidropdown.png')).'");
                 break;
             case "6":
-                $("#example").html("' . addslashes(Display::return_icon('userfield_data.png')).'");
+                $("#example").html("'.addslashes(Display::return_icon('userfield_data.png')).'");
                 break;
             case "7":
-                $("#example").html("' . addslashes(Display::return_icon('userfield_date_time.png')).'");
+                $("#example").html("'.addslashes(Display::return_icon('userfield_date_time.png')).'");
                 break;
             case "8":
-                $("#example").html("' . addslashes(Display::return_icon('userfield_doubleselect.png')).'");
+                $("#example").html("'.addslashes(Display::return_icon('userfield_doubleselect.png')).'");
                 break;
             case "9":
-                $("#example").html("' . addslashes(Display::return_icon('userfield_divider.png')).'");
+                $("#example").html("'.addslashes(Display::return_icon('userfield_divider.png')).'");
                 break;
             case "10":
-                $("#example").html("' . addslashes(Display::return_icon('userfield_user_tag.png')).'");
+                $("#example").html("'.addslashes(Display::return_icon('userfield_user_tag.png')).'");
                 break;
             case "11":
-                $("#example").html("' . addslashes(Display::return_icon('userfield_data.png')).'");
+                $("#example").html("'.addslashes(Display::return_icon('userfield_data.png')).'");
                 break;
         }
     });
@@ -136,7 +135,7 @@ switch ($action) {
             Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
             echo '</div>';
             $form->addElement('hidden', 'sec_token');
-            $form->setConstants(array('sec_token' => $token));
+            $form->setConstants(['sec_token' => $token]);
             $form->display();
         }
         break;
@@ -161,7 +160,7 @@ switch ($action) {
             Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
             echo '</div>';
             $form->addElement('hidden', 'sec_token');
-            $form->setConstants(array('sec_token' => $token));
+            $form->setConstants(['sec_token' => $token]);
             $form->display();
         }
         break;

+ 3 - 3
main/admin/filler.php

@@ -2,7 +2,7 @@
 /* For licensing terms, see /license.txt */
 
 /**
- * Index of the admin tools
+ * Index of the admin tools.
  *
  * @package chamilo.admin
  */
@@ -22,12 +22,12 @@ api_protect_admin_script(true);
 $nameTools = get_lang('PlatformAdmin');
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => $nameTools);
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => $nameTools];
 
 // setting the name of the tool
 $nameTools = get_lang('DataFiller');
 
-$output = array();
+$output = [];
 if (!empty($_GET['fill'])) {
     switch ($_GET['fill']) {
         case 'users':

+ 25 - 26
main/admin/grade_models.php

@@ -4,7 +4,6 @@
 /**
  *  @package chamilo.admin
  */
-
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 
@@ -20,7 +19,7 @@ if (api_get_setting('gradebook_enable_grade_model') != 'true') {
 $htmlHeadXtra[] = api_get_jqgrid_js();
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 $action = isset($_GET['action']) ? $_GET['action'] : null;
 
@@ -28,13 +27,13 @@ $check = Security::check_token('request');
 $token = Security::get_token();
 
 if ($action === 'add') {
-    $interbreadcrumb[] = array('url' => 'grade_models.php', 'name' => get_lang('GradeModel'));
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Add'));
+    $interbreadcrumb[] = ['url' => 'grade_models.php', 'name' => get_lang('GradeModel')];
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Add')];
 } elseif ($action == 'edit') {
-    $interbreadcrumb[] = array('url' => 'grade_models.php', 'name' => get_lang('GradeModel'));
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit'));
+    $interbreadcrumb[] = ['url' => 'grade_models.php', 'name' => get_lang('GradeModel')];
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Edit')];
 } else {
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('GradeModel'));
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('GradeModel')];
 }
 
 $htmlHeadXtra[] = '<script>
@@ -74,36 +73,36 @@ Display::display_header();
 $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_grade_models';
 
 //The order is important you need to check the the $column variable in the model.ajax.php file
-$columns = array(
+$columns = [
     get_lang('Name'),
     get_lang('Description'),
     get_lang('Actions'),
-);
+];
 
 //Column config
-$column_model = array(
-    array(
+$column_model = [
+    [
         'name' => 'name',
         'index' => 'name',
         'width' => '80',
-        'align' => 'left'
-    ),
-    array(
+        'align' => 'left',
+    ],
+    [
         'name' => 'description',
         'index' => 'description',
         'width' => '500',
         'align' => 'left',
-        'sortable' => 'false'
-    ),
-    array(
+        'sortable' => 'false',
+    ],
+    [
         'name' => 'actions',
         'index' => 'actions',
         'width' => '100',
         'align' => 'left',
         'formatter' => 'action_formatter',
-        'sortable' => 'false'
-    )
-);
+        'sortable' => 'false',
+    ],
+];
 
 //Autowidth
 $extra_params['autowidth'] = 'true';
@@ -127,7 +126,7 @@ $(function() {
         $columns,
         $column_model,
         $extra_params,
-        array(),
+        [],
         $action_links,
         true
     );
@@ -144,13 +143,13 @@ switch ($action) {
             api_not_allowed();
         }
 
-        $url  = api_get_self().'?action='.Security::remove_XSS($_GET['action']);
+        $url = api_get_self().'?action='.Security::remove_XSS($_GET['action']);
         $form = $obj->return_form($url, 'add');
         // The validation or display
         if ($form->validate()) {
             if ($check) {
                 $values = $form->exportValues();
-                $res    = $obj->save($values);
+                $res = $obj->save($values);
                 if ($res) {
                     echo Display::return_message(get_lang('ItemAdded'), 'confirm');
                 }
@@ -163,13 +162,13 @@ switch ($action) {
                 '</a>';
             echo '</div>';
             $form->addElement('hidden', 'sec_token');
-            $form->setConstants(array('sec_token' => $token));
+            $form->setConstants(['sec_token' => $token]);
             $form->display();
         }
         break;
     case 'edit':
         // Action handling: Editing
-        $url  = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&id='.intval($_GET['id']);
+        $url = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&id='.intval($_GET['id']);
         $form = $obj->return_form($url, 'edit');
 
         // The validation or display
@@ -187,7 +186,7 @@ switch ($action) {
                 '</a>';
             echo '</div>';
             $form->addElement('hidden', 'sec_token');
-            $form->setConstants(array('sec_token' => $token));
+            $form->setConstants(['sec_token' => $token]);
             $form->display();
         }
         break;

+ 4 - 6
main/admin/gradebook_dependency.php

@@ -2,8 +2,6 @@
 /* For licensing terms, see /license.txt */
 
 use Chamilo\CoreBundle\Entity\GradebookCategory;
-use Doctrine\Common\Collections\Criteria;
-use Knp\Component\Pager\Paginator;
 
 require_once __DIR__.'/../inc/global.inc.php';
 
@@ -34,10 +32,10 @@ $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
 $currentUrl = api_get_self().'?';
 $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
 
-$interbreadcrumb[] = array(
+$interbreadcrumb[] = [
     'url' => api_get_path(WEB_CODE_PATH).'admin/gradebook_list.php',
-    'name' => get_lang('Gradebook')
-);
+    'name' => get_lang('Gradebook'),
+];
 
 $tpl = new Template(get_lang('CourseList'));
 $toolbar = Display::url(
@@ -137,7 +135,7 @@ foreach ($dependencyList as $courseId => $courseInfo) {
                 } else {
                     if ($userResult[$userId]['result_not_mandatory_80'] < 80 && $result) {
                         $userResult[$userId]['result_not_mandatory_80'] += 10;
-                      //  var_dump($userResult[$userId]['result_80'] );
+                        //  var_dump($userResult[$userId]['result_80'] );
                     }
                 }
             }

+ 8 - 9
main/admin/gradebook_list.php

@@ -50,15 +50,14 @@ $toolName = get_lang('Gradebook');
 switch ($action) {
     case 'add':
     case 'edit':
-        $interbreadcrumb[] = array(
+        $interbreadcrumb[] = [
             'url' => $currentUrl,
-            'name' => get_lang('Gradebook')
-        );
+            'name' => get_lang('Gradebook'),
+        ];
         $toolName = get_lang(ucfirst($action));
         break;
 }
 
-
 $tpl = new Template($toolName);
 
 switch ($action) {
@@ -79,7 +78,7 @@ switch ($action) {
             get_lang('Course'),
             null,
             [
-                'url' => api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_course'
+                'url' => api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_course',
             ]
         );
 
@@ -89,7 +88,7 @@ switch ($action) {
             null,
             [
                 'url' => api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_course',
-                'multiple' => 'multiple'
+                'multiple' => 'multiple',
             ]
         );
 
@@ -202,7 +201,7 @@ switch ($action) {
                 $options,
                 [
                     'url' => api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_course',
-                    'multiple' => 'multiple'
+                    'multiple' => 'multiple',
                 ]
             );
 
@@ -223,7 +222,7 @@ switch ($action) {
                 'weight' => $category->getWeight(),
                 'gradebooks_to_validate_in_dependence' => $categoryData['gradebooks_to_validate_in_dependence'],
                 'depends' => array_keys($options),
-                'minimum' => $categoryData['minimum_to_validate']
+                'minimum' => $categoryData['minimum_to_validate'],
             ];
             $form->setDefaults($defaults);
             $contentForm = $form->returnForm();
@@ -293,7 +292,7 @@ $searchForm = new FormValidator(
     'get',
     '',
     '',
-    array(),
+    [],
     FormValidator::LAYOUT_INLINE
 );
 $searchForm->addText('keyword', '', false);

+ 163 - 163
main/admin/index.php

@@ -1,7 +1,8 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
- * Index page of the admin tools
+ * Index page of the admin tools.
+ *
  * @package chamilo.admin
  */
 // Resetting the course id.
@@ -50,13 +51,13 @@ if (api_is_platform_admin()) {
     }
     $keyword_url = Security::remove_XSS((empty($_GET['keyword']) ? '' : $_GET['keyword']));
 }
-$blocks = array();
+$blocks = [];
 
 // Instantiate Hook Event for Admin Block
 $hook = HookAdminBlock::create();
 if (!empty($hook)) {
     // If not empty, then notify Pre process to Hook Observers for Admin Block
-    $hook->setEventData(array('blocks' => $blocks));
+    $hook->setEventData(['blocks' => $blocks]);
     $data = $hook->notifyAdminBlock(HOOK_EVENT_TYPE_PRE);
     // Check if blocks data is not null
     if (isset($data['blocks'])) {
@@ -69,7 +70,7 @@ if (!empty($hook)) {
 $blocks['users']['icon'] = Display::return_icon(
     'members.png',
     get_lang('Users'),
-    array(),
+    [],
     ICON_SIZE_MEDIUM,
     false
 );
@@ -88,7 +89,7 @@ $search_form = '
             <input class="form-control" type="text" name="keyword" value=""
              aria-label="'.get_lang('Search').'">
             <button class="btn btn-default" type="submit">
-                <em class="fa fa-search"></em> ' . get_lang('Search').'
+                <em class="fa fa-search"></em> '.get_lang('Search').'
             </button>
         </div>
     </form>';
@@ -96,31 +97,31 @@ $blocks['users']['search_form'] = $search_form;
 
 if (api_is_platform_admin()) {
     $blocks['users']['editable'] = true;
-    $items = array(
-        array('url' => 'user_list.php', 'label' => get_lang('UserList')),
-        array('url' => 'user_add.php', 'label' => get_lang('AddUsers')),
-        array('url' => 'user_export.php', 'label' => get_lang('ExportUserListXMLCSV')),
-        array('url' => 'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')),
-        array('url' => 'user_update_import.php', 'label' => get_lang('EditUserListCSV')),
-    );
+    $items = [
+        ['url' => 'user_list.php', 'label' => get_lang('UserList')],
+        ['url' => 'user_add.php', 'label' => get_lang('AddUsers')],
+        ['url' => 'user_export.php', 'label' => get_lang('ExportUserListXMLCSV')],
+        ['url' => 'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')],
+        ['url' => 'user_update_import.php', 'label' => get_lang('EditUserListCSV')],
+    ];
 
     if (isset($extAuthSource) && isset($extAuthSource['extldap']) && count($extAuthSource['extldap']) > 0) {
-        $items[] = array('url' => 'ldap_users_list.php', 'label' => get_lang('ImportLDAPUsersIntoPlatform'));
+        $items[] = ['url' => 'ldap_users_list.php', 'label' => get_lang('ImportLDAPUsersIntoPlatform')];
     }
-    $items[] = array('url' => 'extra_fields.php?type=user', 'label' => get_lang('ManageUserFields'));
-    $items[] = array('url'=>'usergroups.php', 'label' => get_lang('Classes'));
+    $items[] = ['url' => 'extra_fields.php?type=user', 'label' => get_lang('ManageUserFields')];
+    $items[] = ['url' => 'usergroups.php', 'label' => get_lang('Classes')];
     $items[] = ['url' => 'user_linking_requests.php', 'label' => get_lang('UserLinkingRequests')];
 } elseif (api_is_session_admin() && api_get_configuration_value('limit_session_admin_role')) {
-    $items = array(
-        array('url' => 'user_list.php', 'label' => get_lang('UserList')),
-        array('url' => 'user_add.php', 'label' => get_lang('AddUsers')),
-    );
+    $items = [
+        ['url' => 'user_list.php', 'label' => get_lang('UserList')],
+        ['url' => 'user_add.php', 'label' => get_lang('AddUsers')],
+    ];
 } else {
     $items = [
-        array('url' => 'user_list.php', 'label' => get_lang('UserList')),
-        array('url' => 'user_add.php', 'label' => get_lang('AddUsers')),
-        array('url' => 'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')),
-        array('url' => 'usergroups.php', 'label' => get_lang('Classes')),
+        ['url' => 'user_list.php', 'label' => get_lang('UserList')],
+        ['url' => 'user_add.php', 'label' => get_lang('AddUsers')],
+        ['url' => 'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')],
+        ['url' => 'usergroups.php', 'label' => get_lang('Classes')],
     ];
 }
 
@@ -132,7 +133,7 @@ if (api_is_platform_admin()) {
     $blocks['courses']['icon'] = Display::return_icon(
         'course.png',
         get_lang('Courses'),
-        array(),
+        [],
         ICON_SIZE_MEDIUM,
         false
     );
@@ -151,38 +152,38 @@ if (api_is_platform_admin()) {
                 <input class="form-control" type="text" name="keyword" value=""
                  aria-label="'.get_lang('Search').'">
                 <button class="btn btn-default" type="submit">
-                    <em class="fa fa-search"></em> ' . get_lang('Search').'
+                    <em class="fa fa-search"></em> '.get_lang('Search').'
                 </button>
             </div>
         </form>';
     $blocks['courses']['search_form'] = $search_form;
 
-    $items = array();
-    $items[] = array('url' => 'course_list.php', 'label' => get_lang('CourseList'));
-    $items[] = array('url' => 'course_add.php', 'label' => get_lang('AddCourse'));
+    $items = [];
+    $items[] = ['url' => 'course_list.php', 'label' => get_lang('CourseList')];
+    $items[] = ['url' => 'course_add.php', 'label' => get_lang('AddCourse')];
 
     if (api_get_setting('course_validation') == 'true') {
-        $items[] = array('url' => 'course_request_review.php', 'label' => get_lang('ReviewCourseRequests'));
-        $items[] = array('url' => 'course_request_accepted.php', 'label' => get_lang('AcceptedCourseRequests'));
-        $items[] = array('url' => 'course_request_rejected.php', 'label' => get_lang('RejectedCourseRequests'));
+        $items[] = ['url' => 'course_request_review.php', 'label' => get_lang('ReviewCourseRequests')];
+        $items[] = ['url' => 'course_request_accepted.php', 'label' => get_lang('AcceptedCourseRequests')];
+        $items[] = ['url' => 'course_request_rejected.php', 'label' => get_lang('RejectedCourseRequests')];
     }
 
-    $items[] = array('url' => 'course_export.php', 'label' => get_lang('ExportCourses'));
-    $items[] = array('url' => 'course_import.php', 'label' => get_lang('ImportCourses'));
-    $items[] = array('url' => 'course_category.php', 'label' => get_lang('AdminCategories'));
-    $items[] = array('url' => 'subscribe_user2course.php', 'label' => get_lang('AddUsersToACourse'));
-    $items[] = array('url' => 'course_user_import.php', 'label' => get_lang('ImportUsersToACourse'));
+    $items[] = ['url' => 'course_export.php', 'label' => get_lang('ExportCourses')];
+    $items[] = ['url' => 'course_import.php', 'label' => get_lang('ImportCourses')];
+    $items[] = ['url' => 'course_category.php', 'label' => get_lang('AdminCategories')];
+    $items[] = ['url' => 'subscribe_user2course.php', 'label' => get_lang('AddUsersToACourse')];
+    $items[] = ['url' => 'course_user_import.php', 'label' => get_lang('ImportUsersToACourse')];
     //$items[] = array('url'=>'course_intro_pdf_import.php', 	'label' => get_lang('ImportPDFIntroToCourses'));
 
     if (api_get_setting('gradebook_enable_grade_model') == 'true') {
-        $items[] = array('url' => 'grade_models.php', 'label' => get_lang('GradeModel'));
+        $items[] = ['url' => 'grade_models.php', 'label' => get_lang('GradeModel')];
     }
 
     if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
-        $items[] = array('url' => 'ldap_import_students.php', 'label' => get_lang('ImportLDAPUsersIntoCourse'));
+        $items[] = ['url' => 'ldap_import_students.php', 'label' => get_lang('ImportLDAPUsersIntoCourse')];
     }
 
-    $items[] = array('url' => 'extra_fields.php?type=course', 'label' => get_lang('ManageCourseFields'));
+    $items[] = ['url' => 'extra_fields.php?type=course', 'label' => get_lang('ManageCourseFields')];
 
     $blocks['courses']['items'] = $items;
     $blocks['courses']['extra'] = null;
@@ -191,7 +192,7 @@ if (api_is_platform_admin()) {
     $blocks['platform']['icon'] = Display::return_icon(
         'platform.png',
         get_lang('Platform'),
-        array(),
+        [],
         ICON_SIZE_MEDIUM,
         false
     );
@@ -213,59 +214,58 @@ if (api_is_platform_admin()) {
                 aria-label="'.get_lang('Search').'" >
                 <input type="hidden" value="search_setting" name="category">
                 <button class="btn btn-default" type="submit">
-                    <em class="fa fa-search"></em> ' . get_lang('Search').'
+                    <em class="fa fa-search"></em> '.get_lang('Search').'
                 </button>
             </div>
         </form>';
     $blocks['platform']['search_form'] = $search_form;
 
-    $items = array();
-    $items[] = array('url' => 'settings.php', 'label' => get_lang('PlatformConfigSettings'));
-    $items[] = array('url' => 'languages.php', 'label' => get_lang('Languages'));
-    $items[] = array('url' => 'settings.php?category=Plugins', 'label' => get_lang('Plugins'));
-    $items[] = array('url' => 'settings.php?category=Regions', 'label' => get_lang('Regions'));
-    $items[] = array('url' => 'system_announcements.php', 'label' => get_lang('SystemAnnouncements'));
-    $items[] = array(
+    $items = [];
+    $items[] = ['url' => 'settings.php', 'label' => get_lang('PlatformConfigSettings')];
+    $items[] = ['url' => 'languages.php', 'label' => get_lang('Languages')];
+    $items[] = ['url' => 'settings.php?category=Plugins', 'label' => get_lang('Plugins')];
+    $items[] = ['url' => 'settings.php?category=Regions', 'label' => get_lang('Regions')];
+    $items[] = ['url' => 'system_announcements.php', 'label' => get_lang('SystemAnnouncements')];
+    $items[] = [
         'url' => api_get_path(WEB_CODE_PATH).'calendar/agenda_js.php?type=admin',
-        'label' => get_lang('GlobalAgenda')
-    );
-    $items[] = array('url' => 'configure_homepage.php', 'label' => get_lang('ConfigureHomePage'));
-    $items[] = array('url' => 'configure_inscription.php', 'label' => get_lang('ConfigureInscription'));
-    $items[] = array('url' => 'statistics/index.php', 'label' => get_lang('Statistics'));
-    $items[] = array(
+        'label' => get_lang('GlobalAgenda'),
+    ];
+    $items[] = ['url' => 'configure_homepage.php', 'label' => get_lang('ConfigureHomePage')];
+    $items[] = ['url' => 'configure_inscription.php', 'label' => get_lang('ConfigureInscription')];
+    $items[] = ['url' => 'statistics/index.php', 'label' => get_lang('Statistics')];
+    $items[] = [
         'url' => api_get_path(WEB_CODE_PATH).'mySpace/company_reports.php',
-        'label' => get_lang('Reports')
-    );
-    $items[] = array(
+        'label' => get_lang('Reports'),
+    ];
+    $items[] = [
         'url' => api_get_path(WEB_CODE_PATH).'admin/teacher_time_report.php',
-        'label' => get_lang('TeacherTimeReport')
-    );
+        'label' => get_lang('TeacherTimeReport'),
+    ];
 
     if (api_get_configuration_value('chamilo_cms')) {
-        $items[] = array(
-            'url' => api_get_path(WEB_PATH) . 'web/app_dev.php/administration/dashboard',
-            'label' => get_lang('CMS')
-        );
+        $items[] = [
+            'url' => api_get_path(WEB_PATH).'web/app_dev.php/administration/dashboard',
+            'label' => get_lang('CMS'),
+        ];
     }
 
     /* Event settings */
 
     if (api_get_setting('activate_email_template') == 'true') {
         // @deprecated to be removed in 2.x
-        $items[] = array('url' => 'event_controller.php?action=listing', 'label' => get_lang('EventMessageManagement'));
+        $items[] = ['url' => 'event_controller.php?action=listing', 'label' => get_lang('EventMessageManagement')];
     }
 
-    $items[] = array('url' => 'extra_field_list.php', 'label' => get_lang('ExtraFields'));
+    $items[] = ['url' => 'extra_field_list.php', 'label' => get_lang('ExtraFields')];
 
     if (!empty($_configuration['multiple_access_urls'])) {
         if (api_is_global_platform_admin()) {
-            $items[] = array('url' => 'access_urls.php', 'label' => get_lang('ConfigureMultipleAccessURLs'));
+            $items[] = ['url' => 'access_urls.php', 'label' => get_lang('ConfigureMultipleAccessURLs')];
         }
     }
 
-
     if (api_get_setting('allow_terms_conditions') == 'true') {
-        $items[] = array('url' => 'legal_add.php', 'label' => get_lang('TermsAndConditions'));
+        $items[] = ['url' => 'legal_add.php', 'label' => get_lang('TermsAndConditions')];
     }
     $blocks['platform']['items'] = $items;
     $blocks['platform']['extra'] = null;
@@ -275,7 +275,7 @@ if (api_is_platform_admin()) {
 $blocks['sessions']['icon'] = Display::return_icon(
     'session.png',
     get_lang('Sessions'),
-    array(),
+    [],
     ICON_SIZE_MEDIUM,
     false
 );
@@ -301,42 +301,42 @@ $search_form = ' <form method="GET" class="form-inline" action="'.$sessionPath.'
                         value=""
                         aria-label="'.get_lang('Search').'">
                         <button class="btn btn-default" type="submit">
-                            <em class="fa fa-search"></em> ' . get_lang('Search').'
+                            <em class="fa fa-search"></em> '.get_lang('Search').'
                         </button>
                     </div>
                 </form>';
 $blocks['sessions']['search_form'] = $search_form;
-$items = array();
-$items[] = array('url' => $sessionPath.'session_list.php', 'label' => get_lang('ListSession'));
-$items[] = array('url' => $sessionPath.'session_add.php', 'label' => get_lang('AddSession'));
-$items[] = array('url' => $sessionPath.'session_category_list.php', 'label' => get_lang('ListSessionCategory'));
-$items[] = array('url' => $sessionPath.'session_import.php', 'label' => get_lang('ImportSessionListXMLCSV'));
-$items[] = array('url' => $sessionPath.'session_import_drh.php', 'label' => get_lang('ImportSessionDrhList'));
+$items = [];
+$items[] = ['url' => $sessionPath.'session_list.php', 'label' => get_lang('ListSession')];
+$items[] = ['url' => $sessionPath.'session_add.php', 'label' => get_lang('AddSession')];
+$items[] = ['url' => $sessionPath.'session_category_list.php', 'label' => get_lang('ListSessionCategory')];
+$items[] = ['url' => $sessionPath.'session_import.php', 'label' => get_lang('ImportSessionListXMLCSV')];
+$items[] = ['url' => $sessionPath.'session_import_drh.php', 'label' => get_lang('ImportSessionDrhList')];
 if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
-    $items[] = array(
+    $items[] = [
         'url' => 'ldap_import_students_to_session.php',
-        'label' => get_lang('ImportLDAPUsersIntoSession')
-    );
+        'label' => get_lang('ImportLDAPUsersIntoSession'),
+    ];
 }
-$items[] = array(
+$items[] = [
     'url' => $sessionPath.'session_export.php',
     'label' => get_lang('ExportSessionListXMLCSV'),
-);
+];
 
 if (api_is_global_platform_admin()) {
-    $items[] = array(
+    $items[] = [
         'url' => '../coursecopy/copy_course_session.php',
-        'label' => get_lang('CopyFromCourseInSessionToAnotherSession')
-    );
+        'label' => get_lang('CopyFromCourseInSessionToAnotherSession'),
+    ];
 }
 
 if (api_is_platform_admin()) {
     // option only visible in development mode. Enable through code if required
     if (is_dir(api_get_path(SYS_TEST_PATH).'datafiller/')) {
-        $items[] = array('url' => 'user_move_stats.php', 'label' => get_lang('MoveUserStats'));
+        $items[] = ['url' => 'user_move_stats.php', 'label' => get_lang('MoveUserStats')];
     }
-    $items[] = array('url' => 'career_dashboard.php', 'label' => get_lang('CareersAndPromotions'));
-    $items[] = array('url' => 'extra_fields.php?type=session', 'label' => get_lang('ManageSessionFields'));
+    $items[] = ['url' => 'career_dashboard.php', 'label' => get_lang('CareersAndPromotions')];
+    $items[] = ['url' => 'extra_fields.php?type=session', 'label' => get_lang('ManageSessionFields')];
 }
 
 $blocks['sessions']['items'] = $items;
@@ -347,7 +347,7 @@ if (api_is_platform_admin()) {
     $blocks['settings']['icon'] = Display::return_icon(
         'settings.png',
         get_lang('System'),
-        array(),
+        [],
         ICON_SIZE_MEDIUM,
         false
     );
@@ -355,40 +355,40 @@ if (api_is_platform_admin()) {
     $blocks['settings']['class'] = 'block-admin-settings';
 
     $items = [];
-    $items[] = array(
+    $items[] = [
         'url' => 'archive_cleanup.php',
-        'label' => get_lang('ArchiveDirCleanup')
-    );
+        'label' => get_lang('ArchiveDirCleanup'),
+    ];
 
-    $items[] = array(
+    $items[] = [
         'url' => 'special_exports.php',
-        'label' => get_lang('SpecialExports')
-    );
-    $items[] = array(
+        'label' => get_lang('SpecialExports'),
+    ];
+    $items[] = [
         'url' => 'system_status.php',
-        'label' => get_lang('SystemStatus')
-    );
+        'label' => get_lang('SystemStatus'),
+    ];
     if (is_dir(api_get_path(SYS_TEST_PATH).'datafiller/')) {
-        $items[] = array(
+        $items[] = [
             'url' => 'filler.php',
-            'label' => get_lang('DataFiller')
-        );
+            'label' => get_lang('DataFiller'),
+        ];
     }
 
-    $items[] = array(
+    $items[] = [
         'url' => 'resource_sequence.php',
-        'label' => get_lang('ResourcesSequencing')
-    );
+        'label' => get_lang('ResourcesSequencing'),
+    ];
     if (is_dir(api_get_path(SYS_TEST_PATH))) {
         $items[] = [
             'url' => 'email_tester.php',
-            'label' => get_lang('EMailTester')
+            'label' => get_lang('EMailTester'),
         ];
     }
 
     $items[] = [
         'url' => api_get_path(WEB_CODE_PATH).'ticket/tickets.php',
-        'label' => get_lang('TicketSystem')
+        'label' => get_lang('TicketSystem'),
     ];
 
     if (api_get_configuration_value('db_manager_enabled') == true &&
@@ -398,10 +398,10 @@ if (api_is_platform_admin()) {
         $username = $_configuration['db_user'];
         $databaseName = $_configuration['main_database'];
 
-        $items[] = array(
+        $items[] = [
             'url' => "db.php?username=$username&db=$databaseName&server=$host",
-            'label' => get_lang('DatabaseManager')
-        );
+            'label' => get_lang('DatabaseManager'),
+        ];
     }
 
     $blocks['settings']['items'] = $items;
@@ -413,43 +413,43 @@ if (api_is_platform_admin()) {
         $blocks['skills']['icon'] = Display::return_icon(
             'skill-badges.png',
             get_lang('Skills'),
-            array(),
+            [],
             ICON_SIZE_MEDIUM,
             false
         );
         $blocks['skills']['label'] = get_lang('Skills');
         $blocks['skills']['class'] = 'block-admin-skills';
 
-        $items = array();
-        $items[] = array(
+        $items = [];
+        $items[] = [
             'url' => 'skills_wheel.php',
-            'label' => get_lang('SkillsWheel')
-        );
-        $items[] = array(
+            'label' => get_lang('SkillsWheel'),
+        ];
+        $items[] = [
             'url' => 'skills_import.php',
-            'label' => get_lang('SkillsImport')
-        );
-        $items[] = array(
+            'label' => get_lang('SkillsImport'),
+        ];
+        $items[] = [
             'url' => 'skill_list.php',
-            'label' => get_lang('ManageSkills')
-        );
-        $items[] = array(
+            'label' => get_lang('ManageSkills'),
+        ];
+        $items[] = [
             'url' => 'skill.php',
-            'label' => get_lang('ManageSkillsLevels')
-        );
+            'label' => get_lang('ManageSkillsLevels'),
+        ];
 
-        $items[] = array(
+        $items[] = [
             'url' => api_get_path(WEB_CODE_PATH).'social/skills_ranking.php',
-            'label' => get_lang('SkillsRanking')
-        );
-        $items[] = array(
+            'label' => get_lang('SkillsRanking'),
+        ];
+        $items[] = [
             'url' => 'skills_gradebook.php',
-            'label' => get_lang('SkillsAndGradebooks')
-        );
-        $items[] = array(
+            'label' => get_lang('SkillsAndGradebooks'),
+        ];
+        $items[] = [
             'url' => api_get_path(WEB_CODE_PATH).'admin/skill_badge.php',
-            'label' => get_lang('Badges')
-        );
+            'label' => get_lang('Badges'),
+        ];
         $blocks['skills']['items'] = $items;
         $blocks['skills']['extra'] = null;
         $blocks['skills']['search_form'] = null;
@@ -460,18 +460,18 @@ if (api_is_platform_admin()) {
         $blocks['gradebook']['icon'] = Display::return_icon(
             'gradebook.png',
             get_lang('Gradebook'),
-            array(),
+            [],
             ICON_SIZE_MEDIUM,
             false
         );
         $blocks['gradebook']['label'] = get_lang('Gradebook');
         $blocks['gradebook']['class'] = 'block-admin-gradebook';
 
-        $items = array();
-        $items[] = array(
+        $items = [];
+        $items[] = [
             'url' => 'gradebook_list.php',
-            'label' => get_lang('List')
-        );
+            'label' => get_lang('List'),
+        ];
         $blocks['gradebook']['items'] = $items;
         $blocks['gradebook']['extra'] = null;
         $blocks['gradebook']['search_form'] = null;
@@ -490,7 +490,7 @@ if (api_is_platform_admin()) {
             $blocks['plugins']['icon'] = Display::return_icon(
                 'plugins.png',
                 get_lang('Plugins'),
-                array(),
+                [],
                 ICON_SIZE_MEDIUM,
                 false
             );
@@ -499,7 +499,7 @@ if (api_is_platform_admin()) {
             $blocks['plugins']['editable'] = true;
 
             $plugin_obj = new AppPlugin();
-            $items = array();
+            $items = [];
 
             foreach ($menuAdministratorItems as $pluginName) {
                 $pluginInfo = $plugin_obj->getPluginInfo($pluginName, true);
@@ -511,10 +511,10 @@ if (api_is_platform_admin()) {
                     continue;
                 }
 
-                $items[] = array(
+                $items[] = [
                     'url' => $pluginUrl,
-                    'label' => $pluginInfo['title']
-                );
+                    'label' => $pluginInfo['title'],
+                ];
             }
 
             $blocks['plugins']['items'] = $items;
@@ -527,27 +527,27 @@ if (api_is_platform_admin()) {
     $blocks['chamilo']['icon'] = Display::return_icon(
         'platform.png',
         'Chamilo.org',
-        array(),
+        [],
         ICON_SIZE_MEDIUM,
         false
     );
     $blocks['chamilo']['label'] = 'Chamilo.org';
     $blocks['chamilo']['class'] = 'block-admin-chamilo';
 
-    $items = array();
-    $items[] = array('url' => 'http://www.chamilo.org/', 'label' => get_lang('ChamiloHomepage'));
-    $items[] = array('url' => 'http://www.chamilo.org/forum', 'label' => get_lang('ChamiloForum'));
-
-    $items[] = array('url' => '../../documentation/installation_guide.html', 'label' => get_lang('InstallationGuide'));
-    $items[] = array('url' => '../../documentation/changelog.html', 'label' => get_lang('ChangesInLastVersion'));
-    $items[] = array('url' => '../../documentation/credits.html', 'label' => get_lang('ContributorsList'));
-    $items[] = array('url' => '../../documentation/security.html', 'label' => get_lang('SecurityGuide'));
-    $items[] = array('url' => '../../documentation/optimization.html', 'label' => get_lang('OptimizationGuide'));
-    $items[] = array('url' => 'http://www.chamilo.org/extensions', 'label' => get_lang('ChamiloExtensions'));
-    $items[] = array(
+    $items = [];
+    $items[] = ['url' => 'http://www.chamilo.org/', 'label' => get_lang('ChamiloHomepage')];
+    $items[] = ['url' => 'http://www.chamilo.org/forum', 'label' => get_lang('ChamiloForum')];
+
+    $items[] = ['url' => '../../documentation/installation_guide.html', 'label' => get_lang('InstallationGuide')];
+    $items[] = ['url' => '../../documentation/changelog.html', 'label' => get_lang('ChangesInLastVersion')];
+    $items[] = ['url' => '../../documentation/credits.html', 'label' => get_lang('ContributorsList')];
+    $items[] = ['url' => '../../documentation/security.html', 'label' => get_lang('SecurityGuide')];
+    $items[] = ['url' => '../../documentation/optimization.html', 'label' => get_lang('OptimizationGuide')];
+    $items[] = ['url' => 'http://www.chamilo.org/extensions', 'label' => get_lang('ChamiloExtensions')];
+    $items[] = [
         'url' => 'http://www.chamilo.org/en/providers',
-        'label' => get_lang('ChamiloOfficialServicesProviders')
-    );
+        'label' => get_lang('ChamiloOfficialServicesProviders'),
+    ];
 
     $blocks['chamilo']['items'] = $items;
     $blocks['chamilo']['extra'] = null;
@@ -557,7 +557,7 @@ if (api_is_platform_admin()) {
     $blocks['version_check']['icon'] = Display::return_icon(
         'platform.png',
         'Chamilo.org',
-        array(),
+        [],
         ICON_SIZE_MEDIUM,
         false
     );
@@ -570,7 +570,7 @@ if (api_is_platform_admin()) {
     // Check Hook Event for Admin Block Object
     if (!empty($hook)) {
         // If not empty, then notify Post process to Hook Observers for Admin Block
-        $hook->setEventData(array('blocks' => $blocks));
+        $hook->setEventData(['blocks' => $blocks]);
         $data = $hook->notifyAdminBlock(HOOK_EVENT_TYPE_POST);
         // Check if blocks data is not null
         if (isset($data['blocks'])) {
@@ -631,10 +631,10 @@ if (api_is_platform_admin()) {
         'post',
         '#',
         null,
-        array(
+        [
             'id' => 'block-extra-data',
-            'class' => ''
-        ),
+            'class' => '',
+        ],
         FormValidator::LAYOUT_BOX_NO_LABEL
     );
     $extraContentFormRenderer = $extraContentForm->getDefaultRenderer();
@@ -679,9 +679,9 @@ if (api_is_platform_admin()) {
         'hidden',
         'block',
         null,
-        array(
-            'id' => 'extra-block'
-        )
+        [
+            'id' => 'extra-block',
+        ]
     );
     $extraContentForm->addButtonExport(
         get_lang('Save'),

+ 27 - 26
main/admin/languages.php

@@ -10,7 +10,9 @@
  *
  * @author Patrick Cool, main author
  * @author Roan EMbrechts, code cleaning
+ *
  * @since Dokeos 1.6
+ *
  * @package chamilo.admin
  */
 
@@ -57,21 +59,21 @@ $htmlHeadXtra[] = '<script>
     var disabledLang = "'.$disabledLang.'"
 
     if (msgLang == 1) {
-        $("#id_content_message").html("<div class=\"warning-message alert alert-warning\">' . get_lang('ThereAreUsersUsingThisLanguagesDisableItManually').' <br /> " + disabledLang + "</div");
+        $("#id_content_message").html("<div class=\"warning-message alert alert-warning\">'.get_lang('ThereAreUsersUsingThisLanguagesDisableItManually').' <br /> " + disabledLang + "</div");
     }
 
     $("#disable_all_except_default").click(function () {
-        if(confirm("'. get_lang('ConfirmYourChoice').'")) {
+        if(confirm("'.get_lang('ConfirmYourChoice').'")) {
             $.ajax({
                 contentType: "application/x-www-form-urlencoded",
                 beforeSend: function(objeto) {
-                    $("#id_content_message").html("<div class=\"warning-message alert alert-warning\"><em class=\"fa fa-refresh fa-spin\"></em>  ' . get_lang('Loading').'</div>");
+                    $("#id_content_message").html("<div class=\"warning-message alert alert-warning\"><em class=\"fa fa-refresh fa-spin\"></em>  '.get_lang('Loading').'</div>");
                 },
                 type: "GET",
                 url: "../admin/languages.php",
                 data: "action=disable_all_except_default",
                 success: function(datos) {
-                    window.location.href = "' . api_get_self().'";
+                    window.location.href = "'.api_get_self().'";
                 }
             });
         }
@@ -107,7 +109,7 @@ $htmlHeadXtra[] = '<script>
 		$.ajax({
 			contentType: "application/x-www-form-urlencoded",
 			beforeSend: function(objeto) {
-				$("#id_content_message").html("<div class=\"warning-message alert alert-warning\"><em class=\"fa fa-refresh fa-spin\"></em>  ' . get_lang('Loading').'</div>");
+				$("#id_content_message").html("<div class=\"warning-message alert alert-warning\"><em class=\"fa fa-refresh fa-spin\"></em>  '.get_lang('Loading').'</div>");
 			},
 			type: "POST",
 			url: "../admin/languages.php",
@@ -118,19 +120,19 @@ $htmlHeadXtra[] = '<script>
                     $("#"+id_img_link_tool).attr("src",path_name_of_imglinktool);
 
                     if (my_image_tool=="visible.png") {
-                        $("#"+id_img_link_tool).attr("alt","' . get_lang('MakeAvailable', '').'");
-                        $("#"+id_img_link_tool).attr("title","' . get_lang('MakeAvailable', '').'");
+                        $("#"+id_img_link_tool).attr("alt","'.get_lang('MakeAvailable', '').'");
+                        $("#"+id_img_link_tool).attr("title","'.get_lang('MakeAvailable', '').'");
                     } else {
-                        $("#"+id_img_link_tool).attr("alt","' . get_lang('MakeUnavailable', '').'");
-                        $("#"+id_img_link_tool).attr("title","' . get_lang('MakeUnavailable', '').'");
+                        $("#"+id_img_link_tool).attr("alt","'.get_lang('MakeUnavailable', '').'");
+                        $("#"+id_img_link_tool).attr("title","'.get_lang('MakeUnavailable', '').'");
                     }
 
                     if (datos=="set_visible") {
-                        $("#id_content_message").html("<div class=\"confirmation-message alert alert-success\">' . get_lang('LanguageIsNowVisible', '').'</div>");
+                        $("#id_content_message").html("<div class=\"confirmation-message alert alert-success\">'.get_lang('LanguageIsNowVisible', '').'</div>");
                     }
 
                     if (datos=="set_hidden") {
-                        $("#id_content_message").html("<div class=\"confirmation-message alert alert-success\">' . get_lang('LanguageIsNowHidden', '').'</div>");
+                        $("#id_content_message").html("<div class=\"confirmation-message alert alert-success\">'.get_lang('LanguageIsNowHidden', '').'</div>");
                     }
                 }
 
@@ -191,7 +193,6 @@ if ($action == 'disable_all_except_default') {
     if ($checkFailed) {
         $_SESSION['disabled_languages'] = $failedDisabledLanguages;
     }
-
 }
 
 if (isset($_POST['Submit']) && $_POST['Submit']) {
@@ -200,7 +201,7 @@ if (isset($_POST['Submit']) && $_POST['Submit']) {
             WHERE id='{$_POST['edit_id']}'";
     $result = Database::query($sql);
     // changing the Platform language
-    if ($_POST['platformlanguage'] && $_POST['platformlanguage'] <> '') {
+    if ($_POST['platformlanguage'] && $_POST['platformlanguage'] != '') {
         //$sql_update_2 = "UPDATE $tbl_settings_current SET selected_value='{$_POST['platformlanguage']}' WHERE variable='platformLanguage'";
         //$result_2 = Database::query($sql_update_2);
         api_set_setting('platformLanguage', $_POST['platformlanguage'], null, null, $_configuration['access_url']);
@@ -209,7 +210,7 @@ if (isset($_POST['Submit']) && $_POST['Submit']) {
     switch ($_POST['action']) {
         case 'makeavailable':
             if (count($_POST['id']) > 0) {
-                $ids = array();
+                $ids = [];
                 foreach ($_POST['id'] as $index => $id) {
                     $ids[] = intval($id);
                 }
@@ -219,7 +220,7 @@ if (isset($_POST['Submit']) && $_POST['Submit']) {
             break;
         case 'makeunavailable':
             if (count($_POST['id']) > 0) {
-                $ids = array();
+                $ids = [];
                 foreach ($_POST['id'] as $index => $id) {
                     $ids[] = intval($id);
                 }
@@ -234,7 +235,7 @@ if (isset($_POST['Submit']) && $_POST['Submit']) {
 $tool_name = get_lang('PlatformLanguages');
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 if (isset($_GET['action']) && $_GET['action'] == 'make_unavailable_confirmed') {
     $language_info = SubLanguageManager::get_all_information_of_language($_GET['id']);
@@ -263,9 +264,9 @@ $result_select_lang = Database::query($sql_select_lang);
 $row_lang = Database::fetch_array($result_select_lang);
 
 // the table data
-$language_data = array();
+$language_data = [];
 while ($row = Database::fetch_array($result_select)) {
-    $row_td = array();
+    $row_td = [];
     $row_td[] = $row['id'];
     // the first column is the original name of the language OR a form containing the original name
     if ($action == 'edit' and $row['id'] == $_GET['id']) {
@@ -274,7 +275,7 @@ while ($row = Database::fetch_array($result_select)) {
         }
 
         $row_td[] = '<input type="hidden" name="edit_id" value="'.Security::remove_XSS($_GET['id']).'" /><input type="text" name="txt_name" value="'.$row['original_name'].'" /> '
-                . '<input type="checkbox" '.$checked.'name="platformlanguage" id="platformlanguage" value="'.$row['english_name'].'" /><label for="platformlanguage">'.$row['original_name'].' '.get_lang('AsPlatformLanguage').'</label> <input type="submit" name="Submit" value="'.get_lang('Ok').'" /><a name="value" />';
+                .'<input type="checkbox" '.$checked.'name="platformlanguage" id="platformlanguage" value="'.$row['english_name'].'" /><label for="platformlanguage">'.$row['original_name'].' '.get_lang('AsPlatformLanguage').'</label> <input type="submit" name="Submit" value="'.get_lang('Ok').'" /><a name="value" />';
     } else {
         $row_td[] = $row['original_name'];
     }
@@ -298,7 +299,7 @@ while ($row = Database::fetch_array($result_select)) {
 
         if ($verified_if_is_sub_language === false) {
             $verified_if_is_father = SubLanguageManager::check_if_language_is_father($row['id']);
-            $allow_use_sub_language = "&nbsp;<a href='sub_language_add.php?action=definenewsublanguage&id=".$row['id']."'>".Display::return_icon('new_language.png', get_lang('CreateSubLanguage'), array(), ICON_SIZE_SMALL)."</a>";
+            $allow_use_sub_language = "&nbsp;<a href='sub_language_add.php?action=definenewsublanguage&id=".$row['id']."'>".Display::return_icon('new_language.png', get_lang('CreateSubLanguage'), [], ICON_SIZE_SMALL)."</a>";
             if ($verified_if_is_father === true) {
                 //$allow_add_term_sub_language = "&nbsp;<a href='sub_language.php?action=registersublanguage&id=".$row['id']."'>".Display::return_icon('2rightarrow.png', get_lang('AddWordForTheSubLanguage'),array('width'=>ICON_SIZE_SMALL,'height'=>ICON_SIZE_SMALL))."</a>";
                 $allow_add_term_sub_language = '';
@@ -308,8 +309,8 @@ while ($row = Database::fetch_array($result_select)) {
         } else {
             $allow_use_sub_language = '';
             $all_information_of_sub_language = SubLanguageManager::get_all_information_of_language($row['id']);
-            $allow_add_term_sub_language = "&nbsp;<a href='sub_language.php?action=registersublanguage&id=".Security::remove_XSS($all_information_of_sub_language['parent_id'])."&sub_language_id=".Security::remove_XSS($row['id'])."'>".Display::return_icon('2rightarrow.png', get_lang('AddWordForTheSubLanguage'), array('width' => ICON_SIZE_SMALL, 'height' => ICON_SIZE_SMALL))."</a>";
-            $allow_delete_sub_language = "&nbsp;<a href='sub_language_add.php?action=deletesublanguage&id=".Security::remove_XSS($all_information_of_sub_language['parent_id'])."&sub_language_id=".Security::remove_XSS($row['id'])."'>".Display::return_icon('delete.png', get_lang('DeleteSubLanguage'), array('width' => ICON_SIZE_SMALL, 'height' => ICON_SIZE_SMALL))."</a>";
+            $allow_add_term_sub_language = "&nbsp;<a href='sub_language.php?action=registersublanguage&id=".Security::remove_XSS($all_information_of_sub_language['parent_id'])."&sub_language_id=".Security::remove_XSS($row['id'])."'>".Display::return_icon('2rightarrow.png', get_lang('AddWordForTheSubLanguage'), ['width' => ICON_SIZE_SMALL, 'height' => ICON_SIZE_SMALL])."</a>";
+            $allow_delete_sub_language = "&nbsp;<a href='sub_language_add.php?action=deletesublanguage&id=".Security::remove_XSS($all_information_of_sub_language['parent_id'])."&sub_language_id=".Security::remove_XSS($row['id'])."'>".Display::return_icon('delete.png', get_lang('DeleteSubLanguage'), ['width' => ICON_SIZE_SMALL, 'height' => ICON_SIZE_SMALL])."</a>";
         }
     } else {
         $allow_use_sub_language = '';
@@ -318,12 +319,12 @@ while ($row = Database::fetch_array($result_select)) {
 
     if ($row['english_name'] == $row_lang['selected_value']) {
         $row_td[] = Display::return_icon('visible.png', get_lang('Visible'))."<a href='".api_get_self()."?action=edit&id=".$row['id']."#value'>".Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL)."</a>
-                     &nbsp;" . $setplatformlanguage.$allow_use_sub_language.$allow_add_term_sub_language.$allow_delete_sub_language;
+                     &nbsp;".$setplatformlanguage.$allow_use_sub_language.$allow_add_term_sub_language.$allow_delete_sub_language;
     } else {
         if ($row['available'] == 1) {
-            $row_td[] = "<a class=\"make_visible_and_invisible\" id=\"linktool_".$row['id']."\" href='".api_get_self()."?action=makeunavailable&id=".$row['id']."'>".Display::return_icon('visible.png', get_lang('MakeUnavailable'), array('id' => 'imglinktool_'.$row['id']), ICON_SIZE_SMALL)."</a> <a href='".api_get_self()."?action=edit&id=".$row['id']."#value'>".Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL)."</a>&nbsp;".$setplatformlanguage.$allow_use_sub_language.$allow_add_term_sub_language.$allow_delete_sub_language;
+            $row_td[] = "<a class=\"make_visible_and_invisible\" id=\"linktool_".$row['id']."\" href='".api_get_self()."?action=makeunavailable&id=".$row['id']."'>".Display::return_icon('visible.png', get_lang('MakeUnavailable'), ['id' => 'imglinktool_'.$row['id']], ICON_SIZE_SMALL)."</a> <a href='".api_get_self()."?action=edit&id=".$row['id']."#value'>".Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL)."</a>&nbsp;".$setplatformlanguage.$allow_use_sub_language.$allow_add_term_sub_language.$allow_delete_sub_language;
         } else {
-            $row_td[] = "<a class=\"make_visible_and_invisible\" id=\"linktool_".$row['id']."\" href='".api_get_self()."?action=makeavailable&id=".$row['id']."'>".Display::return_icon('invisible.png', get_lang('MakeAvailable'), array('id' => 'imglinktool_'.$row['id']), ICON_SIZE_SMALL)."</a> <a href='".api_get_self()."?action=edit&id=".$row['id']."#value'>".Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL)."</a>&nbsp;".$setplatformlanguage.$allow_use_sub_language.$allow_add_term_sub_language.$allow_delete_sub_language;
+            $row_td[] = "<a class=\"make_visible_and_invisible\" id=\"linktool_".$row['id']."\" href='".api_get_self()."?action=makeavailable&id=".$row['id']."'>".Display::return_icon('invisible.png', get_lang('MakeAvailable'), ['id' => 'imglinktool_'.$row['id']], ICON_SIZE_SMALL)."</a> <a href='".api_get_self()."?action=edit&id=".$row['id']."#value'>".Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL)."</a>&nbsp;".$setplatformlanguage.$allow_use_sub_language.$allow_add_term_sub_language.$allow_delete_sub_language;
         }
     }
     $language_data[] = $row_td;
@@ -335,7 +336,7 @@ $table->set_header(1, get_lang('OriginalName'));
 $table->set_header(2, get_lang('EnglishName'));
 $table->set_header(3, get_lang('LMSFolder'));
 $table->set_header(4, get_lang('Properties'));
-$form_actions = array();
+$form_actions = [];
 $form_actions['makeavailable'] = get_lang('MakeAvailable');
 $form_actions['makeunavailable'] = get_lang('MakeUnavailable');
 $table->set_form_actions($form_actions);

+ 36 - 31
main/admin/ldap_form_add_users_group.php

@@ -1,13 +1,14 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
- * Form to add users through LDAP (deprecated?)
+ * Form to add users through LDAP (deprecated?).
+ *
  * @package chamilo.admin
  * Copyright (c) 2007 Mustapha Alouani (supervised by Michel Moreau-Belliard)
  */
 
 /**
- * This form is included by ldap_import_students.php and ldap_import_students_to_session.php
+ * This form is included by ldap_import_students.php and ldap_import_students_to_session.php.
  */
 $nbre = 0;
 echo '<form name="form" method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'">';
@@ -29,35 +30,39 @@ $is_western_name_order = api_is_western_name_order();
 echo '<input type="hidden" name="confirmed" value="yes">';
 echo '<table border="0" cellspacing="0" width="100%">';
 echo '<tr align="center" id="header3">'.
-		'<td width="15%"><input type="button" value="'.get_lang('AllSlashNone').'" onClick="checkAll();"></td>'.
-		'<td width="40%"><b>'.get_lang('Email').'</b></td>'.
-		($is_western_name_order
-			? '<td width="15%"><b>'.get_lang('FirstName').'</b></td>'.
-			'<td width="15%"><b>'.get_lang('Name').'</b></td>'
-			: '<td width="15%"><b>'.get_lang('Name').'</b></td>'.
-			'<td width="15%"><b>'.get_lang('FirstName').'</b></td>').
-		'<td width="15%"><b>'.get_lang('Login').'</b></td>'.
-	  '</tr>'."\n";
-while (list ($key, $val) = each($nom_form)) {
-	$nbre = $nbre + 1;
-	if ($nbre & 1) $ndiv = 2; else $ndiv = 3;
-	echo '<tr align="center" id="header'.$ndiv.'">';
-	echo '<td><input type="checkbox" name="checkboxes[]" value="'.$key.'" checked="checked"></td>';
-	echo '<td>'.$email_form[$key].'<input type="hidden" name="email_form['.$key.']" size="40" value="'.$email_form[$key].'"></td>';
-	if ($is_western_name_order) {
-		echo '<td>'.$prenom_form[$key].'<input type="hidden" name="prenom_form['.$key.']" size="20" value="'.$prenom_form[$key].'"></td>';
-		echo '<td>'.$nom_form[$key].'<input type="hidden" name="nom_form['.$key.']" size="20" value="'.$nom_form[$key].'"></td>';
-	} else {
-		echo '<td>'.$nom_form[$key].'<input type="hidden" name="nom_form['.$key.']" size="20" value="'.$nom_form[$key].'"></td>';
-		echo '<td>'.$prenom_form[$key].'<input type="hidden" name="prenom_form['.$key.']" size="20" value="'.$prenom_form[$key].'"></td>';
-	}
-	echo '<td>'.$username_form[$key].'<input type="hidden" name="username_form['.$key.']" size="10" value="'.$username_form[$key].'">';
-	echo '<input type="hidden" name="tutor_form['.$key.']" value="0">';
-	echo '<input type="hidden" name="admin_form['.$key.']" value="1">';
-	echo '<input type="hidden" name="password_form['.$key.']"  value="'.$password_form[$key].'">';
-	echo '<input type="hidden" name="statut['.$key.']"  value="'.$statut.'">';
-	echo '</td>';
-	echo '</tr>';
+        '<td width="15%"><input type="button" value="'.get_lang('AllSlashNone').'" onClick="checkAll();"></td>'.
+        '<td width="40%"><b>'.get_lang('Email').'</b></td>'.
+        ($is_western_name_order
+            ? '<td width="15%"><b>'.get_lang('FirstName').'</b></td>'.
+            '<td width="15%"><b>'.get_lang('Name').'</b></td>'
+            : '<td width="15%"><b>'.get_lang('Name').'</b></td>'.
+            '<td width="15%"><b>'.get_lang('FirstName').'</b></td>').
+        '<td width="15%"><b>'.get_lang('Login').'</b></td>'.
+      '</tr>'."\n";
+while (list($key, $val) = each($nom_form)) {
+    $nbre = $nbre + 1;
+    if ($nbre & 1) {
+        $ndiv = 2;
+    } else {
+        $ndiv = 3;
+    }
+    echo '<tr align="center" id="header'.$ndiv.'">';
+    echo '<td><input type="checkbox" name="checkboxes[]" value="'.$key.'" checked="checked"></td>';
+    echo '<td>'.$email_form[$key].'<input type="hidden" name="email_form['.$key.']" size="40" value="'.$email_form[$key].'"></td>';
+    if ($is_western_name_order) {
+        echo '<td>'.$prenom_form[$key].'<input type="hidden" name="prenom_form['.$key.']" size="20" value="'.$prenom_form[$key].'"></td>';
+        echo '<td>'.$nom_form[$key].'<input type="hidden" name="nom_form['.$key.']" size="20" value="'.$nom_form[$key].'"></td>';
+    } else {
+        echo '<td>'.$nom_form[$key].'<input type="hidden" name="nom_form['.$key.']" size="20" value="'.$nom_form[$key].'"></td>';
+        echo '<td>'.$prenom_form[$key].'<input type="hidden" name="prenom_form['.$key.']" size="20" value="'.$prenom_form[$key].'"></td>';
+    }
+    echo '<td>'.$username_form[$key].'<input type="hidden" name="username_form['.$key.']" size="10" value="'.$username_form[$key].'">';
+    echo '<input type="hidden" name="tutor_form['.$key.']" value="0">';
+    echo '<input type="hidden" name="admin_form['.$key.']" value="1">';
+    echo '<input type="hidden" name="password_form['.$key.']"  value="'.$password_form[$key].'">';
+    echo '<input type="hidden" name="statut['.$key.']"  value="'.$statut.'">';
+    echo '</td>';
+    echo '</tr>';
 }
 echo '</table>';
 echo '<br />';

+ 7 - 6
main/admin/ldap_import_students.php

@@ -2,7 +2,8 @@
 /* For licensing terms, see /license.txt */
 
 /**
- * Script to import students from LDAP
+ * Script to import students from LDAP.
+ *
  * @package chamilo.admin
  * Copyright (c) 2007 Mustapha Alouani (supervised by Michel Moreau-Belliard)
  */
@@ -14,13 +15,13 @@ $this_section = SECTION_PLATFORM_ADMIN;
 
 // Access restrictions
 api_protect_admin_script();
-require('../auth/ldap/authldap.php');
+require '../auth/ldap/authldap.php';
 
 $annee_base = date('Y');
 
 $tool_name = get_lang('LDAPImport');
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 $htmlHeadXtra[] = '<script>
 var buttoncheck = 1;
@@ -96,7 +97,7 @@ if (empty($annee) && empty($course)) {
 
         //$sr = @ ldap_search($ds, "ou=people,$LDAPbasedn", "(|(edupersonprimaryorgunitdn=ou=$etape,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn)(edupersonprimaryorgunitdn=ou=02PEL,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn))");
         //echo "(ou=*$annee,ou=$composante)";
-        $sr = @ ldap_search($ds, $ldap_basedn, "(ou=*$annee)");
+        $sr = @ldap_search($ds, $ldap_basedn, "(ou=*$annee)");
 
         $info = ldap_get_entries($ds, $sr);
 
@@ -128,8 +129,8 @@ if (empty($annee) && empty($course)) {
     echo '</div>';
 } elseif (!empty($annee) && !empty($course) && ($_POST['confirmed'] == 'yes')) {
     $id = $_POST['username_form'];
-    $UserList = array();
-    $userid_match_login = array();
+    $UserList = [];
+    $userid_match_login = [];
     foreach ($id as $form_index => $user_id) {
         if (is_array($_POST['checkboxes']) && in_array($form_index, array_values($_POST['checkboxes']))) {
             $tmp = ldap_add_user($user_id);

+ 9 - 10
main/admin/ldap_import_students_to_session.php

@@ -1,25 +1,26 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
- * Edition script for sessions categories
+ * Edition script for sessions categories.
+ *
  * @package chamilo.admin
  * Copyright (c) 2007 Mustapha Alouani (supervised by Michel Moreau-Belliard)
  */
 
 // resetting the course id
 $cidReset = true;
-require_once('../inc/global.inc.php');
+require_once '../inc/global.inc.php';
 // setting the section (for the tabs)
 $this_section = SECTION_PLATFORM_ADMIN;
 // Access restrictions
 api_protect_admin_script();
-require('../auth/ldap/authldap.php');
+ require('../auth/ldap/authldap.php');
 
 $annee_base = date('Y');
 
 $tool_name = get_lang('LDAPImport');
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 $htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript">
 var buttoncheck = 1;
@@ -46,7 +47,6 @@ function checkAll() {
 $annee = $_GET['annee'];
 $id_session = $_POST['id_session'];
 
-
 // form1 annee = 0; composante= 0 etape = 0
 //if ($annee == "" && $composante == "" && $etape == "") {
 if (empty($annee) && empty($id_session)) {
@@ -59,7 +59,6 @@ if (empty($annee) && empty($id_session)) {
     echo '<input type="submit" value="'.get_lang('Submit').'">';
     echo '</form>';
     echo '</div>';
-
 } elseif (!empty($annee) && empty($id_session)) {
     Display::display_header($tool_name);
     echo '<div style="align:center">';
@@ -103,7 +102,7 @@ elseif (!empty($annee) && !empty($id_session) && empty($_POST['confirmed'])) {
 
         //$sr = @ ldap_search($ds, "ou=people,$LDAPbasedn", "(|(edupersonprimaryorgunitdn=ou=$etape,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn)(edupersonprimaryorgunitdn=ou=02PEL,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn))");
         //echo "(ou=*$annee,ou=$composante)";
-        $sr = @ ldap_search($ds, $ldap_basedn, "(ou=*$annee)");
+        $sr = @ldap_search($ds, $ldap_basedn, "(ou=*$annee)");
 
         $info = ldap_get_entries($ds, $sr);
 
@@ -124,7 +123,7 @@ elseif (!empty($annee) && !empty($id_session) && empty($_POST['confirmed'])) {
         asort($nom_form);
         reset($nom_form);
         $statut = 5;
-        include('ldap_form_add_users_group.php');
+        include 'ldap_form_add_users_group.php';
     } else {
         echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>';
     }
@@ -134,8 +133,8 @@ elseif (!empty($annee) && !empty($id_session) && empty($_POST['confirmed'])) {
     echo '</div>';
 } elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed'] == 'yes')) {
     $id = $_POST['username_form'];
-    $UserList = array();
-    $userid_match_login = array();
+    $UserList = [];
+    $userid_match_login = [];
     foreach ($id as $form_index => $user_id) {
         if (is_array($_POST['checkboxes']) && in_array($form_index, array_values($_POST['checkboxes']))) {
             $tmp = ldap_add_user($user_id);

+ 10 - 12
main/admin/ldap_users_list.php

@@ -2,11 +2,12 @@
 /* For licensing terms, see /license.txt */
 /**
  * @author Mustapha Alouani
+ *
  * @package chamilo.admin
  */
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
-require('../auth/ldap/authldap.php');
+require '../auth/ldap/authldap.php';
 $this_section = SECTION_PLATFORM_ADMIN;
 
 api_protect_admin_script();
@@ -15,8 +16,7 @@ $action = @$_GET["action"] ?: null;
 $login_as_user_id = @$_GET["user_id"] ?: null;
 
 // Login as ...
-if ($action == "login_as" && !empty ($login_as_user_id))
-{
+if ($action == "login_as" && !empty($login_as_user_id)) {
     login_user($login_as_user_id);
 }
 
@@ -27,13 +27,12 @@ if (($_GET['action']=="add_user") && ($_GET['id_session'] == strval(intval($_GET
 }
 */
 
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
 $tool_name = get_lang('SearchLDAPUsers');
 //Display::display_header($tool_name); //cannot display now as we need to redirect
 //api_display_tool_title($tool_name);
 
-if (isset ($_GET['action']))
-{
+if (isset($_GET['action'])) {
     $check = Security::check_token('get');
     if ($check) {
         switch ($_GET['action']) {
@@ -61,8 +60,8 @@ if (isset ($_GET['action']))
                 break;
             case 'add_user':
                 $id = $_GET['id'];
-                $UserList = array();
-                $userid_match_login = array();
+                $UserList = [];
+                $userid_match_login = [];
                 foreach ($id as $user_id) {
                     $tmp = ldap_add_user($user_id);
                     $UserList[] = $tmp;
@@ -118,7 +117,7 @@ if (isset($_POST['action'])) {
             case 'add_user':
                 $number_of_selected_users = count($_POST['id']);
                 $number_of_added_users = 0;
-                $UserList = array();
+                $UserList = [];
                 foreach ($_POST['id'] as $index => $user_id) {
                     if ($user_id != $_user['user_id']) {
                         $UserList[] = ldap_add_user($user_id);
@@ -135,7 +134,6 @@ if (isset($_POST['action'])) {
                     echo Display::return_message(get_lang('NoUserAdded'));
                 }
                 break;
-
         }
         Security::clear_token();
     }
@@ -154,7 +152,7 @@ if (isset($_GET['id_session'])) {
     $form->addElement('hidden', 'id_session', $_GET['id_session']);
 }
 
-$type = array();
+$type = [];
 $type["all"] = get_lang('All');
 $type["employee"] = get_lang('Teacher');
 $type["student"] = get_lang('Student');
@@ -197,7 +195,7 @@ $table->set_header(5, get_lang('Actions'));
 //$table->set_column_filter(5, 'email_filter');
 //$table->set_column_filter(5, 'active_filter');
 $table->set_column_filter(5, 'modify_filter');
-$table->set_form_actions(array('add_user' => get_lang('AddLDAPUsers')));
+$table->set_form_actions(['add_user' => get_lang('AddLDAPUsers')]);
 $table->display();
 
 Display::display_footer();

+ 10 - 10
main/admin/ldap_users_synchro.php

@@ -4,23 +4,23 @@
  * @package chamilo.admin
  */
 /**
- * Code
+ * Code.
  */
 exit(); //not yet functional, needs to be revised
 
 $cidReset = true;
 
-require('../inc/global.inc.php');
+require '../inc/global.inc.php';
 $libpath = api_get_path(LIBRARY_PATH);
-require("../auth/ldap/authldap.php");
+require "../auth/ldap/authldap.php";
 $annee_base = date('Y');
 // setting the section (for the tabs)
 $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script();
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', "name" => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => api_get_self(), "name" => get_lang('SessionsList'));
+$interbreadcrumb[] = ['url' => 'index.php', "name" => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => api_get_self(), "name" => get_lang('SessionsList')];
 
 // Database Table Definitions
 $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
@@ -39,8 +39,8 @@ $id_session = intval($_GET['id_session']);
 
 $formSent = 0;
 $errorMsg = $firstLetterUser = $firstLetterSession = '';
-$UserList = $SessionList = array();
-$users = $sessions = array();
+$UserList = $SessionList = [];
+$users = $sessions = [];
 $noPHP_SELF = true;
 
 $page = intval($_GET['page']);
@@ -60,9 +60,9 @@ Display::display_header($tool_name);
 
 <?php
 if (isset($action) && ($action == "synchro")) {
-	$included = true;
-	require('ldap_synchro.php');
-	echo Display::return_message($message, 'normal', false);
+    $included = true;
+    require 'ldap_synchro.php';
+    echo Display::return_message($message, 'normal', false);
 }
 Display::display_footer();
 ?>

+ 13 - 15
main/admin/legal_add.php

@@ -2,7 +2,8 @@
 /* For licensing terms, see /license.txt */
 
 /**
- * Management of legal conditions
+ * Management of legal conditions.
+ *
  * @package chamilo.admin
  */
 $cidReset = true;
@@ -18,12 +19,12 @@ if (api_get_setting('allow_terms_conditions') !== 'true') {
 // Create the form
 $form = new FormValidator('addlegal');
 
-$defaults = array();
-$term_preview = array(
+$defaults = [];
+$term_preview = [
     'type' => 0,
     'content' => '',
-    'changes' => ''
-);
+    'changes' => '',
+];
 if ($form->validate()) {
     $check = Security::check_token('post');
     if ($check) {
@@ -104,20 +105,19 @@ $defaults['sec_token'] = $token;
 $form->addElement('header', get_lang('DisplayTermsConditions'));
 
 if (isset($_POST['language'])) {
-
-	$form->addElement('static', Security::remove_XSS($_POST['language']));
-	$form->addElement('hidden', 'language', Security::remove_XSS($_POST['language']));
+    $form->addElement('static', Security::remove_XSS($_POST['language']));
+    $form->addElement('hidden', 'language', Security::remove_XSS($_POST['language']));
     $form->addHtmlEditor(
         'content',
         get_lang('Content'),
         true,
         false,
-        array('ToolbarSet' => 'terms_and_conditions', 'Width' => '100%', 'Height' => '250')
+        ['ToolbarSet' => 'terms_and_conditions', 'Width' => '100%', 'Height' => '250']
     );
 
     $form->addElement('radio', 'type', '', get_lang('HTMLText'), '0');
     $form->addElement('radio', 'type', '', get_lang('PageLink'), '1');
-    $form->addElement('textarea', 'changes', get_lang('ExplainChanges'), array('width' => '20'));
+    $form->addElement('textarea', 'changes', get_lang('ExplainChanges'), ['width' => '20']);
 
     $preview = LegalManager::show_last_condition($term_preview);
 
@@ -135,15 +135,13 @@ if (isset($_POST['language'])) {
                 </div>
             </div>';
     $form->addElement('html', $buttons);
-
 } else {
-    $form->addSelectLanguage('language', get_lang('Language'), null, array());
-	$form->addButtonSearch(get_lang('Load'), 'send');
-
+    $form->addSelectLanguage('language', get_lang('Language'), null, []);
+    $form->addButtonSearch(get_lang('Load'), 'send');
 }
 
 $tool_name = get_lang('AddTermsAndConditions');
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
 Display :: display_header($tool_name);
 
 echo '<script>

+ 5 - 5
main/admin/legal_list.php

@@ -2,15 +2,15 @@
 /* For licensing terms, see /license.txt */
 
 /**
- * Sessions list script
+ * Sessions list script.
+ *
  * @package chamilo.admin
  */
-
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script();
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
 $tool_name = get_lang('TermsAndConditions');
 Display :: display_header($tool_name);
 
@@ -42,12 +42,12 @@ $table->display();
 // this 2 "mask" function are here just because the SortableTable
 function get_legal_data_mask($id, $params = null, $row = null)
 {
-	return LegalManager::get_legal_data($id, $params, $row);
+    return LegalManager::get_legal_data($id, $params, $row);
 }
 
 function count_mask()
 {
-	return LegalManager::count();
+    return LegalManager::count();
 }
 
 Display :: display_footer();

+ 32 - 33
main/admin/promotions.php

@@ -4,7 +4,6 @@
 /**
  *  @package chamilo.admin
  */
-
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 
@@ -16,8 +15,8 @@ api_protect_admin_script();
 $htmlHeadXtra[] = api_get_jqgrid_js();
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'career_dashboard.php', 'name' => get_lang('CareersAndPromotions'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'career_dashboard.php', 'name' => get_lang('CareersAndPromotions')];
 
 $action = isset($_GET['action']) ? $_GET['action'] : null;
 
@@ -25,19 +24,19 @@ $check = Security::check_token('request');
 $token = Security::get_token();
 
 if ($action == 'add') {
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = [
         'url' => 'promotions.php',
         'name' => get_lang('Promotions'),
-    );
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Add'));
+    ];
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Add')];
 } elseif ($action == 'edit') {
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = [
         'url' => 'promotions.php',
         'name' => get_lang('Promotions'),
-    );
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit'));
+    ];
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Edit')];
 } else {
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Promotions'));
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Promotions')];
 }
 
 // The header.
@@ -46,56 +45,56 @@ Display::display_header('');
 // Tool name
 if (isset($_GET['action']) && $_GET['action'] == 'add') {
     $tool = 'Add';
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = [
         'url' => api_get_self(),
         'name' => get_lang('Promotion'),
-    );
+    ];
 }
 if (isset($_GET['action']) && $_GET['action'] == 'edit') {
     $tool = 'Modify';
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = [
         'url' => api_get_self(),
         'name' => get_lang('Promotion'),
-    );
+    ];
 }
 
 $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_promotions';
 //The order is important you need to check the model.ajax.php the $column variable
-$columns = array(
+$columns = [
     get_lang('Name'),
     get_lang('Career'),
     get_lang('Description'),
     get_lang('Actions'),
-);
-$column_model = array(
-    array(
+];
+$column_model = [
+    [
         'name' => 'name',
         'index' => 'name',
         'width' => '180',
         'align' => 'left',
-    ),
-    array(
+    ],
+    [
         'name' => 'career',
         'index' => 'career',
         'width' => '100',
         'align' => 'left',
-    ),
-    array(
+    ],
+    [
         'name' => 'description',
         'index' => 'description',
         'width' => '500',
         'align' => 'left',
         'sortable' => 'false',
-    ),
-    array(
+    ],
+    [
         'name' => 'actions',
         'index' => 'actions',
         'width' => '100',
         'align' => 'left',
         'formatter' => 'action_formatter',
         'sortable' => 'false',
-    ),
-);
+    ],
+];
 $extra_params['autowidth'] = 'true'; //use the width of the parent
 //$extra_params['editurl'] = $url; //use the width of the parent
 
@@ -112,7 +111,7 @@ $action_links = 'function action_formatter (cellvalue, options, rowObject) {
 <script>
 $(function() {
 <?php
-     echo Display::grid_js('promotions', $url, $columns, $column_model, $extra_params, array(), $action_links, true);
+     echo Display::grid_js('promotions', $url, $columns, $column_model, $extra_params, [], $action_links, true);
 ?>
 });
 </script>
@@ -135,14 +134,14 @@ switch ($action) {
             exit;
         }
 
-        $url  = api_get_self().'?action='.Security::remove_XSS($_GET['action']);
+        $url = api_get_self().'?action='.Security::remove_XSS($_GET['action']);
         $form = $promotion->return_form($url, 'add');
 
         // The validation or display
         if ($form->validate()) {
             if ($check) {
                 $values = $form->exportValues();
-                $res    = $promotion->save($values);
+                $res = $promotion->save($values);
                 if ($res) {
                     echo Display::return_message(get_lang('ItemAdded'), 'confirm');
                 }
@@ -153,20 +152,20 @@ switch ($action) {
             echo Display::url(Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM), api_get_self());
             echo '</div>';
             $form->addElement('hidden', 'sec_token');
-            $form->setConstants(array('sec_token' => $token));
+            $form->setConstants(['sec_token' => $token]);
             $form->display();
         }
         break;
     case 'edit':
         //Editing
-        $url  = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&id='.intval($_GET['id']);
+        $url = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&id='.intval($_GET['id']);
         $form = $promotion->return_form($url, 'edit');
 
         // The validation or display
         if ($form->validate()) {
             if ($check) {
                 $values = $form->exportValues();
-                $res    = $promotion->update($values);
+                $res = $promotion->update($values);
                 $promotion->update_all_sessions_status_by_promotion_id($values['id'], $values['status']);
                 if ($res) {
                     echo Display::return_message(get_lang('PromotionUpdated').': '.$values['name'], 'confirm');
@@ -186,7 +185,7 @@ switch ($action) {
             );
             echo '</div>';
             $form->addElement('hidden', 'sec_token');
-            $form->setConstants(array('sec_token' => $token));
+            $form->setConstants(['sec_token' => $token]);
             $form->display();
         }
         break;

+ 2 - 3
main/admin/resource_sequence.php

@@ -10,7 +10,7 @@ require_once __DIR__.'/../inc/global.inc.php';
 api_protect_global_admin_script();
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 $tpl = new Template(get_lang('ResourcesSequencing'));
 
@@ -40,7 +40,7 @@ if ($formSequence->validate()) {
 }
 
 $selectSequence = new FormValidator('');
-$selectSequence ->addHidden('sequence_type', 'session');
+$selectSequence->addHidden('sequence_type', 'session');
 $em = Database::getManager();
 
 $sequenceList = $em->getRepository('ChamiloCoreBundle:Sequence')->findAll();
@@ -92,4 +92,3 @@ $tpl->assign('configure_sequence', $form->returnForm());
 $tpl->assign('save_sequence', $formSave->returnForm());
 $layout = $tpl->get_template('admin/resource_sequence.tpl');
 $tpl->display($layout);
-

+ 186 - 139
main/admin/settings.lib.php

@@ -1,25 +1,26 @@
 <?php
 /* For licensing terms, see /license.txt */
 
-use ChamiloSession as Session;
-use Symfony\Component\Filesystem\Filesystem;
 use Chamilo\CoreBundle\Component\Utils\ChamiloApi;
 use Chamilo\CoreBundle\Entity\SystemTemplate;
+use ChamiloSession as Session;
+use Symfony\Component\Filesystem\Filesystem;
 
 /**
- * Library of the settings.php file
+ * Library of the settings.php file.
  *
  * @author Julio Montoya <gugli100@gmail.com>
  * @author Guillaume Viguier <guillaume@viguierjust.com>
  *
  * @since Chamilo 1.8.7
+ *
  * @package chamilo.admin
  */
-
 define('CSS_UPLOAD_PATH', api_get_path(SYS_APP_PATH).'Resources/public/css/themes/');
 
 /**
- * This function allows easy activating and inactivating of regions
+ * This function allows easy activating and inactivating of regions.
+ *
  * @author Julio Montoya <gugli100@gmail.com> Beeznest 2012
  */
 function handleRegions()
@@ -40,7 +41,7 @@ function handleRegions()
     }
 
     $plugin_obj = new AppPlugin();
-    $possible_plugins  = $plugin_obj->read_plugins_from_path();
+    $possible_plugins = $plugin_obj->read_plugins_from_path();
     $installed_plugins = $plugin_obj->get_installed_plugins();
 
     echo '<form name="plugins" method="post" action="'.api_get_self().'?category='.Security::remove_XSS($_GET['category']).'">';
@@ -56,7 +57,7 @@ function handleRegions()
 
     /* We display all the possible plugins and the checkboxes */
 
-    $plugin_region_list = array();
+    $plugin_region_list = [];
     $my_plugin_list = $plugin_obj->get_plugin_regions();
     foreach ($my_plugin_list as $plugin_item) {
         $plugin_region_list[$plugin_item] = $plugin_item;
@@ -69,7 +70,7 @@ function handleRegions()
         $plugin_info_file = api_get_path(SYS_PLUGIN_PATH).$pluginName.'/plugin.php';
 
         if (file_exists($plugin_info_file)) {
-            $plugin_info = array();
+            $plugin_info = [];
             require $plugin_info_file;
             if (isset($_GET['name']) && $_GET['name'] === $pluginName) {
                 echo '<tr class="row_selected">';
@@ -101,7 +102,7 @@ function handleRegions()
                 'plugin_'.$pluginName.'[]',
                 $region_list,
                 $selected_plugins,
-                array('multiple' => 'multiple', 'style' => 'width:500px'),
+                ['multiple' => 'multiple', 'style' => 'width:500px'],
                 true,
                 get_lang('None')
             );
@@ -117,12 +118,13 @@ function handleExtensions()
 {
     echo Display::page_subheader(get_lang('ConfigureExtensions'));
     echo '<a class="btn btn-success" href="configure_extensions.php?display=ppt2lp" role="button">'.get_lang('Ppt2lp').'</a>';
-
 }
 
 /**
- * This function allows easy activating and inactivating of plugins
+ * This function allows easy activating and inactivating of plugins.
+ *
  * @todo: a similar function needs to be written to activate or inactivate additional tools.
+ *
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  * @author Julio Montoya <gugli100@gmail.com> Beeznest 2012
  */
@@ -170,7 +172,7 @@ function handlePlugins()
     foreach ($all_plugins as $pluginName) {
         $plugin_info_file = api_get_path(SYS_PLUGIN_PATH).$pluginName.'/plugin.php';
         if (file_exists($plugin_info_file)) {
-            $plugin_info = array();
+            $plugin_info = [];
             require $plugin_info_file;
 
             if (in_array($pluginName, $installed_plugins)) {
@@ -182,7 +184,6 @@ function handlePlugins()
             //Checkbox
             if (in_array($pluginName, $installed_plugins)) {
                 echo '<input type="checkbox" name="plugin_'.$pluginName.'[]" checked="checked">';
-
             } else {
                 echo '<input type="checkbox" name="plugin_'.$pluginName.'[]">';
             }
@@ -196,12 +197,12 @@ function handlePlugins()
                 echo Display::url(
                     '<em class="fa fa-cogs"></em> '.get_lang('Configure'),
                     'configure_plugin.php?name='.$pluginName,
-                    array('class' => 'btn btn-default')
+                    ['class' => 'btn btn-default']
                 );
                 echo Display::url(
                     '<em class="fa fa-th-large"></em> '.get_lang('Regions'),
                     'settings.php?category=Regions&name='.$pluginName,
-                    array('class' => 'btn btn-default')
+                    ['class' => 'btn btn-default']
                 );
             }
 
@@ -213,7 +214,7 @@ function handlePlugins()
                         'class' => 'btn btn-default ajax',
                         'data-title' => $plugin_info['title'],
                         'data-size' => 'lg',
-                        '_target' => '_blank'
+                        '_target' => '_blank',
                     ]
                 );
             }
@@ -227,7 +228,7 @@ function handlePlugins()
                         'class' => 'btn btn-default ajax',
                         'data-title' => $plugin_info['title'],
                         'data-size' => 'lg',
-                        '_target' => '_blank'
+                        '_target' => '_blank',
                     ]
                 );
             }
@@ -235,7 +236,6 @@ function handlePlugins()
             echo '</div>';
             echo '</td></tr>';
         }
-
     }
     echo '</table>';
 
@@ -248,7 +248,8 @@ function handlePlugins()
 }
 
 /**
- * This function allows the platform admin to choose the default stylesheet
+ * This function allows the platform admin to choose the default stylesheet.
+ *
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  * @author Julio Montoya <gugli100@gmail.com>, Chamilo
  */
@@ -266,7 +267,7 @@ function handleStylesheets()
         'text',
         'name_stylesheet',
         get_lang('NameStylesheet'),
-        array('size' => '40', 'maxlength' => '40')
+        ['size' => '40', 'maxlength' => '40']
     );
     $form->addRule(
         'name_stylesheet',
@@ -385,7 +386,7 @@ function handleStylesheets()
     if ($is_style_changeable) {
         $logoGroup = [
             $logoForm->addButtonUpload(get_lang('Upload'), 'logo_upload', true),
-            $logoForm->addButtonCancel(get_lang('Reset'), 'logo_reset', true)
+            $logoForm->addButtonCancel(get_lang('Reset'), 'logo_reset', true),
         ];
 
         $logoForm->addGroup($logoGroup);
@@ -396,8 +397,8 @@ function handleStylesheets()
             unlink($dir.$newLogoFileName);
             echo Display::return_message(get_lang('ResetToTheOriginalLogo'));
             echo '<script>'
-                . '$("#header-logo").attr("src","'.$url.$logoFileName.'");'
-            . '</script>';
+                .'$("#header-logo").attr("src","'.$url.$logoFileName.'");'
+            .'</script>';
         }
     } elseif (isset($_POST['logo_upload'])) {
         $logoForm->addRule(
@@ -429,8 +430,8 @@ function handleStylesheets()
                 if ($status) {
                     echo Display::return_message(get_lang('NewLogoUpdated'));
                     echo '<script>'
-                         . '$("#header-logo").attr("src","'.$url.$newLogoFileName.'");'
-                         . '</script>';
+                         .'$("#header-logo").attr("src","'.$url.$newLogoFileName.'");'
+                         .'</script>';
                 } else {
                     echo Display::return_message('Error - '.get_lang('UplNoFileUploaded'), 'error');
                 }
@@ -449,7 +450,7 @@ function handleStylesheets()
         'post',
         api_get_self().'?category=Stylesheets',
         null,
-        array('id' => 'stylesheets_id')
+        ['id' => 'stylesheets_id']
     );
 
     $styles = $form_change->addElement(
@@ -463,15 +464,15 @@ function handleStylesheets()
         $group = [
             $form_change->addButtonSave(get_lang('SaveSettings'), 'save', true),
             $form_change->addButtonPreview(get_lang('Preview'), 'preview', true),
-            $form_change->addButtonDownload(get_lang('Download'), 'download', true)
+            $form_change->addButtonDownload(get_lang('Download'), 'download', true),
         ];
 
         $form_change->addGroup($group);
 
         if ($show_upload_form) {
             echo Display::tabs(
-                array(get_lang('Update'), get_lang('UpdateLogo'), get_lang('UploadNewStylesheet')),
-                array($form_change->returnForm(), $logoForm->returnForm(), $form->returnForm())
+                [get_lang('Update'), get_lang('UpdateLogo'), get_lang('UploadNewStylesheet')],
+                [$form_change->returnForm(), $logoForm->returnForm(), $form->returnForm()]
             );
         } else {
             $form_change->display();
@@ -480,12 +481,12 @@ function handleStylesheets()
         // Little hack to update the logo image in update form when submiting
         if (isset($_POST['logo_reset'])) {
             echo '<script>'
-                    . '$("#header-logo-custom").attr("src","'.$url.$logoFileName.'");'
-                . '</script>';
+                    .'$("#header-logo-custom").attr("src","'.$url.$logoFileName.'");'
+                .'</script>';
         } elseif (isset($_POST['logo_upload']) && is_file($dir.$newLogoFileName)) {
             echo '<script>'
-                    . '$("#header-logo-custom").attr("src","'.$url.$newLogoFileName.'");'
-                . '</script>';
+                    .'$("#header-logo-custom").attr("src","'.$url.$newLogoFileName.'");'
+                .'</script>';
         }
     } else {
         $form_change->freeze();
@@ -493,12 +494,17 @@ function handleStylesheets()
 }
 
 /**
- * Creates the folder (if needed) and uploads the stylesheet in it
- * @param array $values the values of the form
+ * Creates the folder (if needed) and uploads the stylesheet in it.
+ *
+ * @param array $values  the values of the form
  * @param array $picture the values of the uploaded file
+ *
  * @return bool
+ *
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
+ *
  * @version May 2008
+ *
  * @since v1.8.5
  */
 function uploadStylesheet($values, $picture)
@@ -529,7 +535,7 @@ function uploadStylesheet($values, $picture)
             $num_files = $zip->numFiles;
             $valid = true;
             $single_directory = true;
-            $invalid_files = array();
+            $invalid_files = [];
 
             $allowedFiles = getAllowedFileTypes();
 
@@ -627,7 +633,7 @@ function storeRegions()
 
     // Get a list of all current 'Plugins' settings
     $installed_plugins = $plugin_obj->get_installed_plugins();
-    $shortlist_installed = array();
+    $shortlist_installed = [];
     if (!empty($installed_plugins)) {
         foreach ($installed_plugins as $plugin) {
             if (isset($plugin['subkey'])) {
@@ -654,7 +660,8 @@ function storeRegions()
 }
 
 /**
- * This function allows easy activating and inactivating of plugins
+ * This function allows easy activating and inactivating of plugins.
+ *
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  */
 function storePlugins()
@@ -664,7 +671,7 @@ function storePlugins()
     // Get a list of all current 'Plugins' settings
     $plugin_list = $appPlugin->read_plugins_from_path();
 
-    $installed_plugins = array();
+    $installed_plugins = [];
 
     foreach ($plugin_list as $plugin) {
         if (isset($_POST['plugin_'.$plugin])) {
@@ -685,7 +692,8 @@ function storePlugins()
 }
 
 /**
- * This function allows the platform admin to choose which should be the default stylesheet
+ * This function allows the platform admin to choose which should be the default stylesheet.
+ *
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  */
 function storeStylesheets()
@@ -700,14 +708,17 @@ function storeStylesheets()
             api_get_current_access_url_id()
         );
     }
+
     return true;
 }
 
 /**
  * This function checks if the given style is a recognize style that exists in the css directory as
  * a standalone directory.
+ *
  * @param string $style
- * @return bool     True if this style is recognized, false otherwise
+ *
+ * @return bool True if this style is recognized, false otherwise
  */
 function isStyle($style)
 {
@@ -718,7 +729,8 @@ function isStyle($style)
 
 /**
  * Search options
- * TODO: support for multiple site. aka $_configuration['access_url'] == 1
+ * TODO: support for multiple site. aka $_configuration['access_url'] == 1.
+ *
  * @author Marco Villegas <marvil07@gmail.com>
  */
 function handleSearch()
@@ -742,7 +754,7 @@ function handleSearch()
     $form->addGroup(
         $group,
         'search_enabled',
-        array(get_lang('SearchEnabledTitle'), get_lang('SearchEnabledComment')),
+        [get_lang('SearchEnabledTitle'), get_lang('SearchEnabledComment')],
         null,
         false
     );
@@ -767,16 +779,16 @@ function handleSearch()
         $form->addGroup(
             $group,
             'search_show_unlinked_results',
-            array(
+            [
                 get_lang('SearchShowUnlinkedResultsTitle'),
-                get_lang('SearchShowUnlinkedResultsComment')
-            ),
+                get_lang('SearchShowUnlinkedResultsComment'),
+            ],
             null,
             false
         );
         $default_values['search_show_unlinked_results'] = api_get_setting('search_show_unlinked_results');
 
-        $sf_values = array();
+        $sf_values = [];
         foreach ($specific_fields as $sf) {
             $sf_values[$sf['code']] = $sf['name'];
         }
@@ -785,7 +797,7 @@ function handleSearch()
                 get_lang('AddSpecificSearchField'),
                 'specific_fields.php'
             ),
-            array('class' => 'sectioncomment')
+            ['class' => 'sectioncomment']
         );
         if (empty($sf_values)) {
             $form->addElement('label', [get_lang('SearchPrefilterPrefix'), $url]);
@@ -793,7 +805,7 @@ function handleSearch()
             $form->addElement(
                 'select',
                 'search_prefilter_prefix',
-                array(get_lang('SearchPrefilterPrefix'), $url),
+                [get_lang('SearchPrefilterPrefix'), $url],
                 $sf_values,
                 ''
             );
@@ -862,11 +874,11 @@ function handleSearch()
             $dir_is_writable = Display::return_icon('bullet_red.png', get_lang('Error'));
         }
 
-        $data = array();
-        $data[] = array(get_lang('XapianModuleInstalled'), $xapianLoaded);
-        $data[] = array(get_lang('DirectoryExists').' - '.$xapianPath, $dir_exists);
-        $data[] = array(get_lang('IsWritable').' - '.$xapianPath, $dir_is_writable);
-        $data[] = array(get_lang('SpecificSearchFieldsAvailable'), $specific_fields_exists);
+        $data = [];
+        $data[] = [get_lang('XapianModuleInstalled'), $xapianLoaded];
+        $data[] = [get_lang('DirectoryExists').' - '.$xapianPath, $dir_exists];
+        $data[] = [get_lang('IsWritable').' - '.$xapianPath, $dir_is_writable];
+        $data[] = [get_lang('SpecificSearchFieldsAvailable'), $specific_fields_exists];
 
         showSearchSettingsTable($data);
         showSearchToolsStatusTable();
@@ -874,11 +886,13 @@ function handleSearch()
 }
 
 /**
- * Wrapper for the templates
+ * Wrapper for the templates.
  *
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
  * @author Julio Montoya.
+ *
  * @version August 2008
+ *
  * @since v1.8.6
  */
 function handleTemplates()
@@ -930,7 +944,9 @@ function handleTemplates()
  * Display a sortable table with all the templates that the platform administrator has defined.
  *
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
+ *
  * @version August 2008
+ *
  * @since v1.8.6
  */
 function displayTemplates()
@@ -942,11 +958,11 @@ function displayTemplates()
         1
     );
     $table->set_additional_parameters(
-        array('category' => Security::remove_XSS($_GET['category']))
+        ['category' => Security::remove_XSS($_GET['category'])]
     );
-    $table->set_header(0, get_lang('Image'), true, array('style' => 'width: 101px;'));
+    $table->set_header(0, get_lang('Image'), true, ['style' => 'width: 101px;']);
     $table->set_header(1, get_lang('Title'));
-    $table->set_header(2, get_lang('Actions'), false, array('style' => 'width:50px;'));
+    $table->set_header(2, get_lang('Actions'), false, ['style' => 'width:50px;']);
     $table->set_column_filter(2, 'actionsFilter');
     $table->set_column_filter(0, 'searchImageFilter');
     $table->display();
@@ -955,10 +971,12 @@ function displayTemplates()
 /**
  * Gets the number of templates that are defined by the platform admin.
  *
- * @return integer
+ * @return int
  *
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
+ *
  * @version August 2008
+ *
  * @since v1.8.6
  */
 function getNumberOfTemplates()
@@ -978,14 +996,17 @@ function getNumberOfTemplates()
 /**
  * Gets all the template data for the sortable table.
  *
- * @param integer $from the start of the limit statement
- * @param integer $number_of_items the number of elements that have to be retrieved from the database
- * @param integer $column the column that is
- * @param string $direction the sorting direction (ASC or DESC�
+ * @param int    $from            the start of the limit statement
+ * @param int    $number_of_items the number of elements that have to be retrieved from the database
+ * @param int    $column          the column that is
+ * @param string $direction       the sorting direction (ASC or DESC�
+ *
  * @return array
  *
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
+ *
  * @version August 2008
+ *
  * @since v1.8.6
  */
 function getTemplateData($from, $number_of_items, $column, $direction)
@@ -998,7 +1019,7 @@ function getTemplateData($from, $number_of_items, $column, $direction)
     $sql .= " ORDER BY col$column $direction ";
     $sql .= " LIMIT $from,$number_of_items";
     $result = Database::query($sql);
-    $return = array();
+    $return = [];
     while ($row = Database::fetch_array($result)) {
         $row['1'] = get_lang($row['1']);
         $return[] = $row;
@@ -1008,30 +1029,37 @@ function getTemplateData($from, $number_of_items, $column, $direction)
 }
 
 /**
- * display the edit and delete icons in the sortable table
+ * display the edit and delete icons in the sortable table.
+ *
+ * @param int $id the id of the template
  *
- * @param integer $id the id of the template
  * @return string code for the link to edit and delete the template
  *
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
+ *
  * @version August 2008
+ *
  * @since v1.8.6
  */
 function actionsFilter($id)
 {
     $return = '<a href="settings.php?category=Templates&action=edit&id='.Security::remove_XSS($id).'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
     $return .= '<a href="settings.php?category=Templates&action=delete&id='.Security::remove_XSS($id).'" onClick="javascript:if(!confirm('."'".get_lang('ConfirmYourChoice')."'".')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
+
     return $return;
 }
 
 /**
- * Display the image of the template in the sortable table
+ * Display the image of the template in the sortable table.
  *
  * @param string $image the image
+ *
  * @return string code for the image
  *
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
+ *
  * @version August 2008
+ *
  * @since v1.8.6
  */
 function searchImageFilter($image)
@@ -1045,10 +1073,12 @@ function searchImageFilter($image)
 
 /**
  * Add (or edit) a template. This function displays the form and also takes
- * care of uploading the image and storing the information in the database
+ * care of uploading the image and storing the information in the database.
  *
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
+ *
  * @version August 2008
+ *
  * @since v1.8.6
  */
 function addEditTemplate()
@@ -1218,19 +1248,21 @@ function addEditTemplate()
     } else {
         $token = Security::get_token();
         $form->addElement('hidden', 'sec_token');
-        $form->setConstants(array('sec_token' => $token));
+        $form->setConstants(['sec_token' => $token]);
         // Display the form.
         $form->display();
     }
 }
 
 /**
- * Delete a template
+ * Delete a template.
  *
- * @param integer $id the id of the template that has to be deleted
+ * @param int $id the id of the template that has to be deleted
  *
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
+ *
  * @version August 2008
+ *
  * @since v1.8.6
  */
 function deleteTemplate($id)
@@ -1256,9 +1288,11 @@ function deleteTemplate($id)
 /**
  * Returns the list of timezone identifiers used to populate the select
  * This function is called through a call_user_func() in the generate_settings_form function.
+ *
  * @return array List of timezone identifiers
  *
  * @author Guillaume Viguier <guillaume.viguier@beeznest.com>
+ *
  * @since Chamilo 1.8.7
  */
 function select_timezone_value()
@@ -1269,24 +1303,26 @@ function select_timezone_value()
 /**
  * Returns an array containing the list of options used to populate the gradebook_number_decimals variable
  * This function is called through a call_user_func() in the generate_settings_form function.
+ *
  * @return array List of gradebook_number_decimals options
  *
  * @author Guillaume Viguier <guillaume.viguier@beeznest.com>
  */
 function select_gradebook_number_decimals()
 {
-    return array('0', '1', '2');
+    return ['0', '1', '2'];
 }
 
 /**
- * Get the options for a select element to select gradebook default grade model
+ * Get the options for a select element to select gradebook default grade model.
+ *
  * @return array
  */
 function select_gradebook_default_grade_model_id()
 {
     $grade_model = new GradeModel();
     $models = $grade_model->get_all();
-    $options = array();
+    $options = [];
     $options[-1] = get_lang('None');
 
     if (!empty($models)) {
@@ -1302,11 +1338,11 @@ function select_gradebook_default_grade_model_id()
  * @param array $settings
  * @param array $settings_by_access_list
  *
- * @return FormValidator
- *
  * @throws \Doctrine\ORM\ORMException
  * @throws \Doctrine\ORM\OptimisticLockException
  * @throws \Doctrine\ORM\TransactionRequiredException
+ *
+ * @return FormValidator
  */
 function generateSettingsForm($settings, $settings_by_access_list)
 {
@@ -1335,7 +1371,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
         $form->addGroup($group, 'buttons_in_action_right');
     }*/
 
-    $default_values = array();
+    $default_values = [];
     $url_info = api_get_access_url($url_id);
     $i = 0;
     $addedSettings = [];
@@ -1386,14 +1422,14 @@ function generateSettingsForm($settings, $settings_by_access_list)
             }
         }
 
-        $hideme = array();
+        $hideme = [];
         $hide_element = false;
 
         if ($_configuration['access_url'] != 1) {
             if ($row['access_url_changeable'] == 0) {
                 // We hide the element in other cases (checkbox, radiobutton) we 'freeze' the element.
                 $hide_element = true;
-                $hideme = array('disabled');
+                $hideme = ['disabled'];
             } elseif ($url_info['active'] == 1) {
                 // We show the elements.
                 if (empty($row['variable'])) {
@@ -1422,12 +1458,12 @@ function generateSettingsForm($settings, $settings_by_access_list)
                     $form->addElement(
                         'text',
                         $row['variable'],
-                        array(
+                        [
                             get_lang($row['title']),
                             get_lang($row['comment']),
-                            get_lang('MB')
-                        ),
-                        array('maxlength' => '8', 'aria-label' => get_lang($row['title']))
+                            get_lang('MB'),
+                        ],
+                        ['maxlength' => '8', 'aria-label' => get_lang($row['title'])]
                     );
                     $form->applyFilter($row['variable'], 'html_filter');
                     $default_values[$row['variable']] = round($row['selected_value'] / 1024 / 1024, 1);
@@ -1435,16 +1471,16 @@ function generateSettingsForm($settings, $settings_by_access_list)
                     $form->addElement(
                         'text',
                         $row['variable'],
-                        array(
+                        [
                             get_lang($row['title']),
                             get_lang($row['comment']),
-                        ),
-                        array('maxlength' => '5', 'aria-label' => get_lang($row['title']))
+                        ],
+                        ['maxlength' => '5', 'aria-label' => get_lang($row['title'])]
                     );
                     $form->applyFilter($row['variable'], 'html_filter');
                     $default_values[$row['variable']] = $row['selected_value'];
 
-                    // For platform character set selection: Conversion of the textfield to a select box with valid values.
+                // For platform character set selection: Conversion of the textfield to a select box with valid values.
                 } elseif ($row['variable'] == 'platform_charset') {
                     continue;
                 } else {
@@ -1453,10 +1489,10 @@ function generateSettingsForm($settings, $settings_by_access_list)
                     $form->addElement(
                         'text',
                         $row['variable'],
-                        array(
+                        [
                             get_lang($row['title']),
-                            get_lang($row['comment'])
-                        ),
+                            get_lang($row['comment']),
+                        ],
                         $hideme
                     );
                     $form->applyFilter($row['variable'], 'html_filter');
@@ -1473,8 +1509,8 @@ function generateSettingsForm($settings, $settings_by_access_list)
                     $form->addElement(
                         'textarea',
                         $row['variable'],
-                        array(get_lang($row['title']), get_lang($row['comment'])),
-                        array('rows' => '10', 'id' => $row['variable']),
+                        [get_lang($row['title']), get_lang($row['comment'])],
+                        ['rows' => '10', 'id' => $row['variable']],
                         $hideme
                     );
                     $default_values[$row['variable']] = $value;
@@ -1487,8 +1523,8 @@ function generateSettingsForm($settings, $settings_by_access_list)
                     $form->addElement(
                         'textarea',
                         $row['variable'],
-                        array(get_lang($row['title']), get_lang($row['comment'])),
-                        array('rows' => '10', 'id' => $row['variable']),
+                        [get_lang($row['title']), get_lang($row['comment'])],
+                        ['rows' => '10', 'id' => $row['variable']],
                         $hideme
                     );
                     $default_values[$row['variable']] = $value;
@@ -1496,9 +1532,9 @@ function generateSettingsForm($settings, $settings_by_access_list)
                     $form->addElement(
                         'textarea',
                         $row['variable'],
-                        array(get_lang($row['title']),
-                        get_lang($row['comment'])),
-                        array('rows' => '10', 'id' => $row['variable']),
+                        [get_lang($row['title']),
+                        get_lang($row['comment']), ],
+                        ['rows' => '10', 'id' => $row['variable']],
                         $hideme
                     );
                     $default_values[$row['variable']] = $row['selected_value'];
@@ -1506,7 +1542,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
                 break;
             case 'radio':
                 $values = api_get_settings_options($row['variable']);
-                $group = array();
+                $group = [];
                 if (is_array($values)) {
                     foreach ($values as $key => $value) {
                         $element = &$form->createElement(
@@ -1525,7 +1561,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
                 $form->addGroup(
                     $group,
                     $row['variable'],
-                    array(get_lang($row['title']), get_lang($row['comment'])),
+                    [get_lang($row['title']), get_lang($row['comment'])],
                     null,
                     false
                 );
@@ -1537,7 +1573,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
                         WHERE variable='".$row['variable']."' AND access_url =  1";
 
                 $result = Database::query($sql);
-                $group = array();
+                $group = [];
                 while ($rowkeys = Database::fetch_array($result)) {
                     // Profile tab option should be hidden when the social tool is enabled.
                     if (api_get_setting('allow_social_tool') == 'true') {
@@ -1588,7 +1624,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
                 $form->addGroup(
                     $group,
                     $row['variable'],
-                    array(get_lang($row['title']), get_lang($row['comment'])),
+                    [get_lang($row['title']), get_lang($row['comment'])],
                     null
                 );
                 break;
@@ -1596,7 +1632,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
                 $form->addElement(
                     'static',
                     null,
-                    array(get_lang($row['title']), get_lang($row['comment'])),
+                    [get_lang($row['title']), get_lang($row['comment'])],
                     get_lang('CurrentValue').' : '.$row['selected_value'],
                     $hideme
                 );
@@ -1609,7 +1645,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
                 $form->addElement(
                     'select',
                     $row['variable'],
-                    array(get_lang($row['title']), get_lang($row['comment'])),
+                    [get_lang($row['title']), get_lang($row['comment'])],
                     call_user_func('select_'.$row['variable']),
                     $hideme
                 );
@@ -1647,7 +1683,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
                 }
 
                 $form->addElement('file', 'pdf_export_watermark_path', get_lang('AddWaterMark'));
-                $allowed_picture_types = array('jpg', 'jpeg', 'png', 'gif');
+                $allowed_picture_types = ['jpg', 'jpeg', 'png', 'gif'];
                 $form->addRule(
                     'pdf_export_watermark_path',
                     get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')',
@@ -1672,24 +1708,27 @@ function generateSettingsForm($settings, $settings_by_access_list)
     $form->addHtml('<div class="bottom_actions">');
     $form->addButtonSave(get_lang('SaveSettings'));
     $form->addHtml('</div>');
+
     return $form;
 }
 
 /**
- * Searches a platform setting in all categories except from the Plugins category
+ * Searches a platform setting in all categories except from the Plugins category.
+ *
  * @param string $search
+ *
  * @return array
  */
 function searchSetting($search)
 {
     if (empty($search)) {
-        return array();
+        return [];
     }
     $table_settings_current = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
     $sql = "SELECT * FROM $table_settings_current
             WHERE category <> 'Plugins' ORDER BY id ASC ";
     $result = Database::store_result(Database::query($sql), 'ASSOC');
-    $settings = array();
+    $settings = [];
 
     $search = api_strtolower($search);
 
@@ -1712,7 +1751,6 @@ function searchSetting($search)
                 } else {
                     $found = true;
                 }
-
             } else {
                 $found = true;
             }
@@ -1721,32 +1759,37 @@ function searchSetting($search)
             }
         }
     }
+
     return $settings;
 }
 /**
- * Helper function to generates a form elements group
- * @param object $form The form where the elements group has to be added
- * @param array $values Values to browse through
+ * Helper function to generates a form elements group.
+ *
+ * @param object $form   The form where the elements group has to be added
+ * @param array  $values Values to browse through
+ *
  * @return array
  */
-function formGenerateElementsGroup($form, $values = array(), $elementName)
+function formGenerateElementsGroup($form, $values = [], $elementName)
 {
-    $group = array();
+    $group = [];
     if (is_array($values)) {
         foreach ($values as $key => $value) {
             $element = &$form->createElement('radio', $elementName, '', get_lang($value['display_text']), $value['value']);
             $group[] = $element;
         }
     }
+
     return $group;
 }
 /**
- * Helper function with allowed file types for CSS
- * @return  array Array of file types (no indexes)
+ * Helper function with allowed file types for CSS.
+ *
+ * @return array Array of file types (no indexes)
  */
 function getAllowedFileTypes()
 {
-    $allowedFiles = array(
+    $allowedFiles = [
         'css',
         'zip',
         'jpeg',
@@ -1759,15 +1802,16 @@ function getAllowedFileTypes()
         'svg',
         'webp',
         'woff',
-        'woff2'
-    );
+        'woff2',
+    ];
+
     return $allowedFiles;
 }
 /**
- * Helper function to set settings in the database
- * @param   array   $parameters     List of values
- * @param   int     $accessUrl      The current access URL
- * @return  void
+ * Helper function to set settings in the database.
+ *
+ * @param array $parameters List of values
+ * @param int   $accessUrl  The current access URL
  */
 function setConfigurationSettingsInDatabase($parameters, $accessUrl)
 {
@@ -1779,9 +1823,9 @@ function setConfigurationSettingsInDatabase($parameters, $accessUrl)
 }
 
 /**
- * Helper function to show the status of the search settings table
- * @param   array   $data   Data to show
- * @return void
+ * Helper function to show the status of the search settings table.
+ *
+ * @param array $data Data to show
  */
 function showSearchSettingsTable($data)
 {
@@ -1792,14 +1836,13 @@ function showSearchSettingsTable($data)
     echo $table->display();
 }
 /**
- * Helper function to show status table for each command line tool installed
- * @return void
+ * Helper function to show status table for each command line tool installed.
  */
 function showSearchToolsStatusTable()
 {
     //@todo windows support
     if (api_is_windows_os() == false) {
-        $list_of_programs = array('pdftotext', 'ps2pdf', 'catdoc', 'html2text', 'unrtf', 'catppt', 'xls2csv');
+        $list_of_programs = ['pdftotext', 'ps2pdf', 'catdoc', 'html2text', 'unrtf', 'catppt', 'xls2csv'];
         foreach ($list_of_programs as $program) {
             $output = [];
             $ret_val = null;
@@ -1813,7 +1856,7 @@ function showSearchToolsStatusTable()
             if (!empty($output[0])) {
                 $icon = Display::return_icon('bullet_green.png', get_lang('Installed'));
             }
-            $data2[] = array($program, $output[0], $icon);
+            $data2[] = [$program, $output[0], $icon];
         }
         echo Display::tag('h3', get_lang('ProgramsNeededToConvertFiles'));
         $table = new SortableTableFromArray($data2);
@@ -1829,9 +1872,9 @@ function showSearchToolsStatusTable()
     }
 }
 /**
- * Helper function to generate and show CSS Zip download message
- * @param   string $style Style path
- * @return void
+ * Helper function to generate and show CSS Zip download message.
+ *
+ * @param string $style Style path
  */
 function generateCSSDownloadLink($style)
 {
@@ -1857,7 +1900,8 @@ function generateCSSDownloadLink($style)
 }
 
 /**
- * Helper function to tell if the style is changeable in the current URL
+ * Helper function to tell if the style is changeable in the current URL.
+ *
  * @return bool $changeable Whether the style can be changed in this URL or not
  */
 function isStyleChangeable()
@@ -1873,18 +1917,21 @@ function isStyleChangeable()
     } else {
         $changeable = true;
     }
+
     return $changeable;
 }
 
 /**
- * Get all settings of one category prepared for display in admin/settings.php
+ * Get all settings of one category prepared for display in admin/settings.php.
+ *
  * @param string $category
+ *
  * @return array
  */
 function getCategorySettings($category = '')
 {
     $url_id = api_get_current_access_url_id();
-    $settings_by_access_list = array();
+    $settings_by_access_list = [];
 
     if ($url_id == 1) {
         $settings = api_get_settings($category, 'group', $url_id);
@@ -1915,7 +1962,7 @@ function getCategorySettings($category = '')
                 if ($row['access_url_changeable'] == 1) {
                     $settings_by_access_list[$row['variable']][$row['subkey']][$row['category']] = $row;
                 } else {
-                    $settings_by_access_list[$row['variable']][$row['subkey']][$row['category']] = array();
+                    $settings_by_access_list[$row['variable']][$row['subkey']][$row['category']] = [];
                 }
             }
         }
@@ -1927,8 +1974,8 @@ function getCategorySettings($category = '')
         }
     }
 
-    return array(
+    return [
         'settings' => $settings,
-        'settings_by_access_list' => $settings_by_access_list
-    );
+        'settings_by_access_list' => $settings_by_access_list,
+    ];
 }

+ 42 - 41
main/admin/settings.php

@@ -9,6 +9,7 @@ use ChamiloSession as Session;
  *
  * @author Patrick Cool
  * @author Julio Montoya - Multiple URL site
+ *
  * @package chamilo.admin
  */
 
@@ -32,19 +33,19 @@ if (isset($_POST['save']) && isset($_GET['category']) && $_GET['category'] === '
 }
 
 // Settings to avoid
-$settings_to_avoid = array(
+$settings_to_avoid = [
     'use_session_mode' => 'true',
     'gradebook_enable' => 'false',
     // ON by default - now we have this option when  we create a course
-    'example_material_course_creation' => 'true'
-);
+    'example_material_course_creation' => 'true',
+];
 
-$convert_byte_to_mega_list = array(
+$convert_byte_to_mega_list = [
     'dropbox_max_filesize',
     'message_max_upload_filesize',
     'default_document_quotum',
-    'default_group_quotum'
-);
+    'default_group_quotum',
+];
 
 if (isset($_POST['style'])) {
     Display::$preview_style = $_POST['style'];
@@ -54,7 +55,7 @@ if (isset($_POST['style'])) {
 $table_settings_current = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
 
 // Setting breadcrumbs.
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 // Setting the name of the tool.
 $tool_name = get_lang('PlatformConfigSettings');
@@ -77,17 +78,17 @@ $form_search = new FormValidator(
     'get',
     api_get_self(),
     null,
-    array(),
+    [],
     FormValidator::LAYOUT_INLINE
 );
-$form_search->addElement('text', 'search_field', null, array(
+$form_search->addElement('text', 'search_field', null, [
     'id' => 'search_field',
-    'aria-label' => get_lang('Search')
-));
+    'aria-label' => get_lang('Search'),
+]);
 $form_search->addElement('hidden', 'category', 'search_setting');
 $form_search->addButtonSearch(get_lang('Search'), 'submit_button');
 $form_search->setDefaults(
-    array('search_field' => isset($_REQUEST['search_field']) ? $_REQUEST['search_field'] : null)
+    ['search_field' => isset($_REQUEST['search_field']) ? $_REQUEST['search_field'] : null]
 );
 
 $form_search_html = $form_search->returnForm();
@@ -98,7 +99,7 @@ $settings = null;
 
 // Build the form.
 if (!empty($_GET['category']) &&
-    !in_array($_GET['category'], array('Plugins', 'stylesheets', 'Search'))
+    !in_array($_GET['category'], ['Plugins', 'stylesheets', 'Search'])
 ) {
     $my_category = isset($_GET['category']) ? $_GET['category'] : null;
     $settings_array = getCategorySettings($my_category);
@@ -136,15 +137,15 @@ if (!empty($_GET['category']) &&
                             $changeable = 1;
                         }
 
-                        $params = array('variable = ?' => array($key));
+                        $params = ['variable = ?' => [$key]];
                         $data = api_get_settings_params($params);
 
                         if (!empty($data)) {
                             foreach ($data as $item) {
-                                $params = array(
+                                $params = [
                                     'id' => $item['id'],
                                     'access_url_changeable' => $changeable,
-                                );
+                                ];
                                 api_set_setting_simple($params);
                             }
                         }
@@ -211,7 +212,7 @@ if (!empty($_GET['category']) &&
         }
 
         // Save the settings.
-        $keys = array();
+        $keys = [];
 
         foreach ($values as $key => $value) {
             if (strcmp($key, 'MAX_FILE_SIZE') === 0) {
@@ -381,34 +382,34 @@ $action_images['facebook'] = 'facebook.png';
 $action_images['crons'] = 'crons.png';
 $action_images['webservices'] = 'webservices.png';
 
-$action_array = array();
-$resultcategories = array();
-
-$resultcategories[] = array('category' => 'Platform');
-$resultcategories[] = array('category' => 'Course');
-$resultcategories[] = array('category' => 'Session');
-$resultcategories[] = array('category' => 'Languages');
-$resultcategories[] = array('category' => 'User');
-$resultcategories[] = array('category' => 'Tools');
-$resultcategories[] = array('category' => 'Editor');
-$resultcategories[] = array('category' => 'Security');
-$resultcategories[] = array('category' => 'Tuning');
-$resultcategories[] = array('category' => 'Gradebook');
-$resultcategories[] = array('category' => 'Timezones');
-$resultcategories[] = array('category' => 'Tracking');
-$resultcategories[] = array('category' => 'Search');
-$resultcategories[] = array('category' => 'Stylesheets');
-$resultcategories[] = array('category' => 'Templates');
-$resultcategories[] = array('category' => 'Plugins');
-$resultcategories[] = array('category' => 'LDAP');
-$resultcategories[] = array('category' => 'CAS');
-$resultcategories[] = array('category' => 'Shibboleth');
-$resultcategories[] = array('category' => 'Facebook');
+$action_array = [];
+$resultcategories = [];
+
+$resultcategories[] = ['category' => 'Platform'];
+$resultcategories[] = ['category' => 'Course'];
+$resultcategories[] = ['category' => 'Session'];
+$resultcategories[] = ['category' => 'Languages'];
+$resultcategories[] = ['category' => 'User'];
+$resultcategories[] = ['category' => 'Tools'];
+$resultcategories[] = ['category' => 'Editor'];
+$resultcategories[] = ['category' => 'Security'];
+$resultcategories[] = ['category' => 'Tuning'];
+$resultcategories[] = ['category' => 'Gradebook'];
+$resultcategories[] = ['category' => 'Timezones'];
+$resultcategories[] = ['category' => 'Tracking'];
+$resultcategories[] = ['category' => 'Search'];
+$resultcategories[] = ['category' => 'Stylesheets'];
+$resultcategories[] = ['category' => 'Templates'];
+$resultcategories[] = ['category' => 'Plugins'];
+$resultcategories[] = ['category' => 'LDAP'];
+$resultcategories[] = ['category' => 'CAS'];
+$resultcategories[] = ['category' => 'Shibboleth'];
+$resultcategories[] = ['category' => 'Facebook'];
 $resultcategories[] = ['category' => 'Crons'];
 $resultcategories[] = ['category' => 'WebServices'];
 
 foreach ($resultcategories as $row) {
-    $url = array();
+    $url = [];
     $url['url'] = api_get_self()."?category=".$row['category'];
     $url['content'] = Display::return_icon(
         $action_images[strtolower($row['category'])],

+ 2 - 3
main/admin/skill.php

@@ -8,7 +8,6 @@ use Chamilo\CoreBundle\Entity\Skill;
  *
  * @package chamilo.skill
  */
-
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 api_protect_admin_script();
@@ -54,8 +53,8 @@ if (!empty($item)) {
 }
 $formToDisplay = $form->returnForm();
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => api_get_self(), 'name' => get_lang('ManageSkillsLevels'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => api_get_self(), 'name' => get_lang('ManageSkillsLevels')];
 
 $tpl = new Template($action);
 switch ($action) {

+ 8 - 6
main/admin/skill_badge.php

@@ -1,8 +1,10 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
- * Show information about Mozilla OpenBadges
+ * Show information about Mozilla OpenBadges.
+ *
  * @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
+ *
  * @package chamilo.admin.openbadges
  */
 $cidReset = true;
@@ -21,12 +23,12 @@ if (strcmp($backpack, $configBackpack) !== 0) {
     $backpack = $configBackpack;
 }
 
-$interbreadcrumb = array(
-    array(
+$interbreadcrumb = [
+    [
         'url' => api_get_path(WEB_CODE_PATH).'admin/index.php',
-        'name' => get_lang('Administration')
-    )
-);
+        'name' => get_lang('Administration'),
+    ],
+];
 
 $toolbar = Display::url(
     Display::return_icon(

+ 13 - 14
main/admin/skill_badge_create.php

@@ -1,14 +1,13 @@
 <?php
 /* For licensing terms, see /license.txt */
 
-use ChamiloSession as Session;
-
 /**
- * Show information about Mozilla OpenBadges
+ * Show information about Mozilla OpenBadges.
+ *
  * @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
+ *
  * @package chamilo.admin.openbadges
  */
-
 $cidReset = true;
 
 require_once __DIR__.'/../inc/global.inc.php';
@@ -30,13 +29,13 @@ $badgeStudio = [
     'media' => api_get_path(WEB_LIBRARY_JS_PATH).'badge-studio/media/',
     'templates' => api_get_path(WEB_LIBRARY_JS_PATH).'badge-studio/media/images/templates/',
     'masks' => api_get_path(WEB_LIBRARY_JS_PATH).'badge-studio/media/images/masks/',
-    'script_js' => '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'badge-studio/media/js/studio.js?"></script>'
+    'script_js' => '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'badge-studio/media/js/studio.js?"></script>',
 ];
 
 if ($_SERVER['REQUEST_METHOD'] === 'POST') {
-    $params = array(
-        'id' => $skillId
-    );
+    $params = [
+        'id' => $skillId,
+    ];
 
     if ((isset($_FILES['image']) && $_FILES['image']['error'] == 0) ||
         !empty($_POST['badge_studio_image'])
@@ -90,13 +89,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
     exit;
 }
 
-$interbreadcrumb = array(
-    array(
+$interbreadcrumb = [
+    [
         'url' => api_get_path(WEB_CODE_PATH).'admin/index.php',
-        'name' => get_lang('Administration')
-    )
-);
-$interbreadcrumb[] = array('url' => 'skill_list.php', 'name' => get_lang('ManageSkills'));
+        'name' => get_lang('Administration'),
+    ],
+];
+$interbreadcrumb[] = ['url' => 'skill_list.php', 'name' => get_lang('ManageSkills')];
 
 $toolbar = $objSkill->getToolBar();
 

+ 12 - 10
main/admin/skill_badge_list.php

@@ -2,12 +2,14 @@
 /* For licensing terms, see /license.txt */
 
 /**
- * Show information about Mozilla OpenBadges
+ * Show information about Mozilla OpenBadges.
+ *
  * @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
+ *
  * @package chamilo.admin.openbadges
+ *
  * @deprecated use skill_list.php
  */
-
 $cidReset = true;
 
 require_once __DIR__.'/../inc/global.inc.php';
@@ -20,16 +22,16 @@ $this_section = SECTION_PLATFORM_ADMIN;
 $objSkill = new Skill();
 $skills = $objSkill->get_all();
 
-$interbreadcrumb = array(
-    array(
+$interbreadcrumb = [
+    [
         'url' => api_get_path(WEB_CODE_PATH).'admin/index.php',
-        'name' => get_lang('Administration')
-    ),
-    array(
+        'name' => get_lang('Administration'),
+    ],
+    [
         'url' => api_get_path(WEB_CODE_PATH).'admin/skill_badge.php',
-        'name' => get_lang('Badges')
-    )
-);
+        'name' => get_lang('Badges'),
+    ],
+];
 
 $toolbar = Display::url(
     Display::return_icon(

+ 7 - 6
main/admin/skill_create.php

@@ -2,11 +2,12 @@
 /* For licensing terms, see /license.txt */
 
 /**
- * Create skill form
+ * Create skill form.
+ *
  * @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
+ *
  * @package chamilo.admin
  */
-
 $cidReset = true;
 
 require_once __DIR__.'/../inc/global.inc.php';
@@ -16,8 +17,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script();
 Skill::isAllowed();
 
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'skill_list.php', 'name' => get_lang('ManageSkills'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'skill_list.php', 'name' => get_lang('ManageSkills')];
 
 /* Process data */
 $skillParentId = isset($_GET['parent']) ? intval($_GET['parent']) : 0;
@@ -29,7 +30,7 @@ if ($skillParentId > 0) {
 
     $formDefaultValues = [
         'parent_id' => $skillParentInfo['id'],
-        'gradebook_id' => []
+        'gradebook_id' => [],
     ];
 
     foreach ($skillParentInfo['gradebooks'] as $gradebook) {
@@ -47,7 +48,7 @@ $jquery_ready_content = $returnParams['jquery_ready_content'];
 if (!empty($jquery_ready_content)) {
     $htmlHeadXtra[] = '<script>
     $(document).ready(function(){
-        ' . $jquery_ready_content.'
+        '.$jquery_ready_content.'
     });
     </script>';
 }

+ 7 - 6
main/admin/skill_edit.php

@@ -2,11 +2,12 @@
 /* For licensing terms, see /license.txt */
 
 /**
- * Skill edit form
+ * Skill edit form.
+ *
  * @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
+ *
  * @package chamilo.admin
  */
-
 $cidReset = true;
 
 require_once __DIR__.'/../inc/global.inc.php';
@@ -16,8 +17,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script();
 Skill::isAllowed();
 
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'skill_list.php', 'name' => get_lang('ManageSkills'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'skill_list.php', 'name' => get_lang('ManageSkills')];
 
 /* Process data */
 $skillId = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
@@ -35,7 +36,7 @@ $skillDefaultInfo = [
     'description' => $skillInfo['description'],
     'parent_id' => $skillInfo['extra']['parent_id'],
     'criteria' => $skillInfo['criteria'],
-    'gradebook_id' => []
+    'gradebook_id' => [],
 ];
 
 foreach ($skillInfo['gradebooks'] as $gradebook) {
@@ -59,7 +60,7 @@ $jquery_ready_content = $returnParams['jquery_ready_content'];
 if (!empty($jquery_ready_content)) {
     $htmlHeadXtra[] = '<script>
     $(document).ready(function(){
-        ' . $jquery_ready_content.'
+        '.$jquery_ready_content.'
     });
     </script>';
 }

+ 3 - 4
main/admin/skill_level.php

@@ -2,11 +2,10 @@
 /* For licensing terms, see /license.txt */
 
 /**
- * Add a skill Level
+ * Add a skill Level.
  *
  * @package chamilo.skill
  */
-
 $cidReset = true;
 
 require_once __DIR__.'/../inc/global.inc.php';
@@ -52,8 +51,8 @@ if (!empty($item)) {
 }
 $formToDisplay = $form->returnForm();
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => api_get_self(), 'name' => get_lang('SkillProfile'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => api_get_self(), 'name' => get_lang('SkillProfile')];
 
 $tpl = new Template($action);
 switch ($action) {

+ 4 - 4
main/admin/skill_list.php

@@ -2,11 +2,12 @@
 /* For licensing terms, see /license.txt */
 
 /**
- * Skill list for management
+ * Skill list for management.
+ *
  * @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
+ *
  * @package chamilo.admin
  */
-
 $cidReset = true;
 
 require_once __DIR__.'/../inc/global.inc.php';
@@ -110,9 +111,8 @@ switch ($action) {
         exit;
         break;
     case 'list':
-        // no break
     default:
-        $interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
+        $interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
 
         $toolbar = Display::url(
             Display::return_icon(

+ 4 - 5
main/admin/skill_profile.php

@@ -2,11 +2,10 @@
 /* For licensing terms, see /license.txt */
 
 /**
- * Add a skill Profile
+ * Add a skill Profile.
  *
  * @package chamilo.skill
  */
-
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 
@@ -42,9 +41,9 @@ if (!empty($item)) {
 }
 $formToDisplay = $form->returnForm();
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'skill.php', 'name' => get_lang('ManageSkillsLevels'));
-$interbreadcrumb[] = array('url' =>  api_get_self(), 'name' => get_lang('SkillProfile'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'skill.php', 'name' => get_lang('ManageSkillsLevels')];
+$interbreadcrumb[] = ['url' => api_get_self(), 'name' => get_lang('SkillProfile')];
 
 $toolbar = null;
 

+ 4 - 4
main/admin/skill_translate.php

@@ -1,10 +1,10 @@
 <?php
 /* For licensing terms, see /license.txt */
 
-use \Chamilo\CoreBundle\Entity\ExtraField;
-use Chamilo\CoreBundle\Entity\Skill;
-use Chamilo\CoreBundle\Entity\Language;
 use Chamilo\CoreBundle\Component\Utils\ChamiloApi;
+use Chamilo\CoreBundle\Entity\ExtraField;
+use Chamilo\CoreBundle\Entity\Language;
+use Chamilo\CoreBundle\Entity\Skill;
 
 $cidReset = true;
 
@@ -94,7 +94,7 @@ $form->setDefaults([
     'variable_language' => '$'.$variableLanguage,
     'original_name' => $originalName,
     'sub_language' => $languageId,
-    'new_language' => $action === 'code' ? $skill->getShortCode() : $skill->getName()
+    'new_language' => $action === 'code' ? $skill->getShortCode() : $skill->getName(),
 ]);
 $form->addRule('sub_language', get_lang('Required'), 'required');
 $form->freeze(['variable_language', 'original_name']);

+ 20 - 21
main/admin/skills_gradebook.php

@@ -4,7 +4,6 @@
 /**
  *  @package chamilo.admin
  */
-
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 
@@ -20,9 +19,9 @@ $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'display';
 
 // setting breadcrumbs
 $tool_name = get_lang('SkillsAndGradebooks');
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 if ($action == 'add_skill') {
-    $interbreadcrumb[] = array('url' => 'skills_gradebook.php', 'name' => get_lang('SkillsAndGradebooks'));
+    $interbreadcrumb[] = ['url' => 'skills_gradebook.php', 'name' => get_lang('SkillsAndGradebooks')];
     $tool_name = get_lang('Add');
 }
 
@@ -53,44 +52,44 @@ Display::display_header($tool_name);
 $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_gradebooks';
 
 //The order is important you need to check the the $column variable in the model.ajax.php file
-$columns = array(
+$columns = [
     get_lang('Name'),
     get_lang('CertificatesFiles'),
     get_lang('Skills'),
-    get_lang('Actions')
-);
+    get_lang('Actions'),
+];
 
 //Column config
-$column_model = array(
-    array(
+$column_model = [
+    [
         'name' => 'name',
         'index' => 'name',
         'width' => '150',
-        'align' => 'left'
-    ),
-    array(
+        'align' => 'left',
+    ],
+    [
         'name' => 'certificate',
         'index' => 'certificate',
         'width' => '25',
         'align' => 'left',
-        'sortable' => 'false'
-    ),
-    array(
+        'sortable' => 'false',
+    ],
+    [
         'name' => 'skills',
         'index' => 'skills',
         'width' => '300',
         'align' => 'left',
-        'sortable' => 'false'
-    ),
-    array(
+        'sortable' => 'false',
+    ],
+    [
         'name' => 'actions',
         'index' => 'actions',
         'width' => '30',
         'align' => 'left',
         'formatter' => 'action_formatter',
-        'sortable' => 'false'
-    )
-);
+        'sortable' => 'false',
+    ],
+];
 //Autowidth
 $extra_params['autowidth'] = 'true';
 //height auto
@@ -116,7 +115,7 @@ $(function() {
         $columns,
         $column_model,
         $extra_params,
-        array(),
+        [],
         $action_links,
         true
     );

+ 30 - 23
main/admin/skills_import.php

@@ -1,25 +1,27 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
- * This tool allows platform admins to add skills by uploading a CSV or XML file
+ * This tool allows platform admins to add skills by uploading a CSV or XML file.
+ *
  * @package chamilo.admin
  * @documentation Some interesting basic skills can be found in the "Skills"
  * section here: http://en.wikipedia.org/wiki/Personal_knowledge_management
  */
-
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 
 /**
  * Validate the imported data.
+ *
  * @param $skills
+ *
  * @return array
  */
 function validate_data($skills)
 {
-    $errors = array();
+    $errors = [];
     // 1. Check if mandatory fields are set.
-    $mandatory_fields = array('id', 'parent_id', 'name');
+    $mandatory_fields = ['id', 'parent_id', 'name'];
     foreach ($skills as $index => $skill) {
         foreach ($mandatory_fields as $field) {
             if (empty($skill[$field])) {
@@ -48,16 +50,17 @@ function validate_data($skills)
 }
 
 /**
- * Save the imported data
+ * Save the imported data.
+ *
  * @param   array   List of users
- * @return  void
- * @uses global variable $inserted_in_course,
+ *
+ * @uses \global variable $inserted_in_course,
  * which returns the list of courses the user was inserted in
  */
 function save_data($skills)
 {
     if (is_array($skills)) {
-        $parents = array();
+        $parents = [];
         foreach ($skills as $index => $skill) {
             if (isset($parents[$skill['parent_id']])) {
                 $skill['parent_id'] = $parents[$skill['parent_id']];
@@ -75,8 +78,10 @@ function save_data($skills)
 }
 
 /**
- * Read the CSV-file
+ * Read the CSV-file.
+ *
  * @param string $file Path to the CSV-file
+ *
  * @return array All userinformation read from the file
  */
 function parse_csv_data($file)
@@ -90,7 +95,7 @@ function parse_csv_data($file)
 }
 
 /**
- * XML-parser: handle start of element
+ * XML-parser: handle start of element.
  */
 function element_start($parser, $data)
 {
@@ -99,7 +104,7 @@ function element_start($parser, $data)
     global $current_tag;
     switch ($data) {
         case 'Skill':
-            $skill = array();
+            $skill = [];
             break;
         default:
             $current_tag = $data;
@@ -107,7 +112,7 @@ function element_start($parser, $data)
 }
 
 /**
- * XML-parser: handle end of element
+ * XML-parser: handle end of element.
  */
 function element_end($parser, $data)
 {
@@ -126,7 +131,7 @@ function element_end($parser, $data)
 }
 
 /**
- * XML-parser: handle character data
+ * XML-parser: handle character data.
  */
 function character_data($parser, $data)
 {
@@ -136,8 +141,10 @@ function character_data($parser, $data)
 }
 
 /**
- * Read the XML-file
+ * Read the XML-file.
+ *
  * @param string $file Path to the XML-file
+ *
  * @return array All userinformation read from the file
  */
 function parse_xml_data($file)
@@ -146,7 +153,7 @@ function parse_xml_data($file)
     global $current_value;
     global $skill;
     global $skills;
-    $skills = array();
+    $skills = [];
     $parser = xml_parser_create('UTF-8');
     xml_set_element_handler($parser, 'element_start', 'element_end');
     xml_set_character_data_handler($parser, 'character_data');
@@ -161,18 +168,18 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 
 $tool_name = get_lang('ImportSkillsListCSV');
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
 
 set_time_limit(0);
 $extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', true);
-$user_id_error = array();
+$user_id_error = [];
 $error_message = '';
 
 if (!empty($_POST['formSent']) && $_FILES['import_file']['size'] !== 0) {
     $file_type = $_POST['file_type'];
     Security::clear_token();
     $tok = Security::get_token();
-    $allowed_file_mimetype = array('csv', 'xml');
+    $allowed_file_mimetype = ['csv', 'xml'];
     $error_kind_file = false;
     $error_message = '';
 
@@ -195,7 +202,7 @@ if (!empty($_POST['formSent']) && $_FILES['import_file']['size'] !== 0) {
     }
 
     // List skill id with error.
-    $skills_to_insert = $skill_id_error = array();
+    $skills_to_insert = $skill_id_error = [];
     if (is_array($errors)) {
         foreach ($errors as $my_errors) {
             $skill_id_error[] = $my_errors['SkillName'];
@@ -238,7 +245,7 @@ if (!empty($_POST['formSent']) && $_FILES['import_file']['size'] !== 0) {
     }
 }
 
-$interbreadcrumb[] = array("url" => 'skill_list.php', "name" => get_lang('ManageSkills'));
+$interbreadcrumb[] = ["url" => 'skill_list.php', "name" => get_lang('ManageSkills')];
 
 Display :: display_header($tool_name);
 
@@ -256,7 +263,7 @@ $form = new FormValidator('user_import', 'post', 'skills_import.php');
 $form->addElement('header', '', $tool_name);
 $form->addElement('hidden', 'formSent');
 $form->addElement('file', 'import_file', get_lang('ImportFileLocation'));
-$group = array();
+$group = [];
 $group[] = $form->createElement(
     'radio',
     'file_type',
@@ -272,8 +279,8 @@ $defaults['file_type'] = 'csv';
 $form->setDefaults($defaults);
 $form->display();
 
-$list = array();
-$list_reponse = array();
+$list = [];
+$list_reponse = [];
 $result_xml = '';
 $i = 0;
 $count_fields = count($extra_fields);

+ 12 - 13
main/admin/skills_profile.php

@@ -6,7 +6,6 @@ use ChamiloSession as Session;
 /**
  *  @package chamilo.admin
  */
-
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 $this_section = SECTION_PLATFORM_ADMIN;
@@ -14,10 +13,10 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script();
 Skill::isAllowed();
 
-$interbreadcrumb[] = array(
+$interbreadcrumb[] = [
     'url' => 'index.php',
     "name" => get_lang('PlatformAdmin'),
-);
+];
 
 $skill = new Skill();
 $skill_profile = new SkillProfile();
@@ -28,21 +27,21 @@ $tpl = new Template(get_lang('Skills'));
 $form = new FormValidator('profile_search');
 
 $form->addElement('header', get_lang('SearchSkills'));
-$form->addElement('select', 'skills', null, null, array('id'=>'skills'));
+$form->addElement('select', 'skills', null, null, ['id' => 'skills']);
 $form->addButtonSearch(get_lang('Search'));
 
 $profiles = $skill_profile->get_all();
 
 $tpl->assign('profiles', $profiles);
 
-$total_skills_to_search = array();
+$total_skills_to_search = [];
 
 if ($form->validate()) {
     $values = $form->getSubmitValues();
 
     $skills = $values['skills'];
     if (!empty($skills)) {
-        $hidden_skills = isset($values['hidden_skills']) ? $values['hidden_skills'] : array();
+        $hidden_skills = isset($values['hidden_skills']) ? $values['hidden_skills'] : [];
         $skills = array_merge($skills, $hidden_skills);
         $skills = array_filter($skills);
         $skills = array_unique($skills);
@@ -54,7 +53,7 @@ if ($form->validate()) {
     $skills = Session::read('skills', []);
 }
 
-$user_list = array();
+$user_list = [];
 $count_skills = count($skills);
 $users = $skill_rel_user->getUserBySkills($skills);
 
@@ -63,7 +62,7 @@ if (!empty($users)) {
         $user_info = api_get_user_info($user['user_id']);
         $user_list[$user['user_id']]['user'] = $user_info;
         $my_user_skills = $skill_rel_user->getUserSkills($user['user_id']);
-        $user_skills = array();
+        $user_skills = [];
         $found_counts = 0;
         foreach ($my_user_skills as $my_skill) {
             $found = false;
@@ -71,16 +70,16 @@ if (!empty($users)) {
                 $found = true;
                 $found_counts++;
             }
-            $user_skills[] = array(
+            $user_skills[] = [
                 'skill_id' => $my_skill['skill_id'],
                 'found' => $found,
-            );
+            ];
             $total_skills_to_search[$my_skill['skill_id']] = $my_skill['skill_id'];
         }
         $user_list[$user['user_id']]['skills'] = $user_skills;
         $user_list[$user['user_id']]['total_found_skills'] = $found_counts;
     }
-    $ordered_user_list = array();
+    $ordered_user_list = [];
     foreach ($user_list as $user_id => $user_data) {
         $ordered_user_list[$user_data['total_found_skills']][] = $user_data;
     }
@@ -112,7 +111,7 @@ $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : null;
 
 switch ($action) {
     case 'remove_skill':
-        $new_skill = array();
+        $new_skill = [];
         foreach ($skills as $skill_id) {
             if ($id != $skill_id) {
                 $new_skill[] = $skill_id;
@@ -128,7 +127,7 @@ switch ($action) {
         break;
 }
 
-$skill_list = array();
+$skill_list = [];
 foreach ($total_skills_to_search as $skill_info) {
     $skill_list[$skill_info['id']] = $skill_info;
 }

+ 8 - 6
main/admin/special_exports.php

@@ -5,10 +5,11 @@ use Chamilo\CourseBundle\Component\CourseCopy\CourseBuilder;
 use Chamilo\CourseBundle\Component\CourseCopy\CourseSelectForm;
 
 /**
- * Special exports
+ * Special exports.
  *
  * @author Jhon Hinojosa
  * @author Julio Montoya Fixing pclzip folder + some clean <gugli100@gmail.com>
+ *
  * @package chamilo.include.export
  */
 
@@ -17,7 +18,7 @@ $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 
 $this_section = SECTION_PLATFORM_ADMIN;
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
 // Access restrictions
 api_protect_admin_script(true);
 $nameTools = get_lang('SpecialExports');
@@ -52,7 +53,7 @@ if ((isset($_POST['action']) && $_POST['action'] == 'course_select_form') ||
         $to_group_id = 0;
         $sql_session = "SELECT id, name FROM $tbl_session ";
         $query_session = Database::query($sql_session);
-        $ListSession = array();
+        $ListSession = [];
         while ($rows_session = Database::fetch_assoc($query_session)) {
             $ListSession[$rows_session['id']] = $rows_session['name'];
         }
@@ -192,13 +193,13 @@ function create_zip()
         closedir($handle);
     }
     $temp_zip_file = $temp_zip_dir."/".md5(time()).".zip"; //create zipfile of given directory
-    return array(
+    return [
         'PATH' => $path,
         'PATH_TEMP_ARCHIVE' => $temp_zip_dir,
         'PATH_COURSE' => $sys_course_path,
         'TEMP_FILE_ZIP' => $temp_zip_file,
-        'PATH_REMOVE' => $remove_dir
-    );
+        'PATH_REMOVE' => $remove_dir,
+    ];
 }
 
 function rename_zip($FileZip)
@@ -312,6 +313,7 @@ function fullexportspecial()
     } else {
         echo Display::return_message(get_lang('ErrorMsgSpecialExport'), 'error'); //main API
         $export = false;
+
         return false;
     }
 }

+ 7 - 6
main/admin/specific_fields.php

@@ -1,7 +1,7 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
- * Manage specific fields
+ * Manage specific fields.
  *
  * @package chamilo.admin
  */
@@ -15,8 +15,8 @@ require_once __DIR__.'/../inc/global.inc.php';
 api_protect_admin_script();
 
 // Breadcrumb
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'settings.php?category=Search', 'name' => get_lang('PlatformConfigSettings'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'settings.php?category=Search', 'name' => get_lang('PlatformConfigSettings')];
 
 $libpath = api_get_path(LIBRARY_PATH);
 
@@ -24,13 +24,13 @@ include_once $libpath.'specific_fields_manager.lib.php';
 
 // Create an add-field box
 $form = new FormValidator('add_field', 'post', '', '', null, false);
-$renderer = & $form->defaultRenderer();
+$renderer = &$form->defaultRenderer();
 $renderer->setCustomElementTemplate('<span>{element}</span> ');
 $form->addElement('static', 'search_advanced_link', null, '<a href="specific_fields_add.php">'.Display::return_icon('fieldadd.gif').get_lang('AddSpecificSearchField').'</a>');
 
 // Create a sortable table with specific fields data
-$column_show = array(1, 1, 1);
-$column_order = array(3, 2, 1);
+$column_show = [1, 1, 1];
+$column_order = [3, 2, 1];
 $extra_fields = get_specific_field_list();
 $number_of_extra_fields = count($extra_fields);
 
@@ -53,6 +53,7 @@ function edit_filter($id, $url_params, $row)
     global $charset;
     $return = '<a href="specific_fields_add.php?action=edit&field_id='.$row[0].'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
     $return .= ' <a href="'.api_get_self().'?action=delete&field_id='.$row[0].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset))."'".')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
+
     return $return;
 }
 

+ 11 - 10
main/admin/specific_fields_add.php

@@ -2,7 +2,8 @@
 /* For licensing terms, see /license.txt */
 
 /**
- * Add form
+ * Add form.
+ *
  * @package chamilo.admin
  */
 
@@ -19,18 +20,18 @@ $this_section = SECTION_PLATFORM_ADMIN;
 // user permissions
 api_protect_admin_script();
 $fieldId = isset($_REQUEST['field_id']) ? intval($_REQUEST['field_id']) : 0;
-$interbreadcrumb[] = array(
+$interbreadcrumb[] = [
     'url' => 'index.php',
     'name' => get_lang('PlatformAdmin'),
-);
-$interbreadcrumb[] = array(
+];
+$interbreadcrumb[] = [
     'url' => 'settings.php?category=Search',
     'name' => get_lang('PlatformConfigSettings'),
-);
-$interbreadcrumb[] = array(
+];
+$interbreadcrumb[] = [
     'url' => 'specific_fields.php',
     'name' => get_lang('SpecificSearchFields'),
-);
+];
 
 $tool_name = get_lang('AddSpecificSearchField');
 
@@ -49,9 +50,9 @@ $form->addRule('field_name', get_lang('OnlyLettersAndNumbersAllowed'), 'username
 $form->addRule('field_name', '', 'maxlength', 20);
 
 // Set default values (only not empty when editing)
-$defaults = array();
+$defaults = [];
 if ($fieldId) {
-    $form_information = get_specific_field_list(array('id' => $fieldId));
+    $form_information = get_specific_field_list(['id' => $fieldId]);
     $defaults['field_name'] = $form_information[0]['name'];
 }
 $form->setDefaults($defaults);
@@ -62,7 +63,7 @@ $form->addButtonCreate(get_lang('Add'), 'submit');
 if ($form->validate()) {
     $field = $form->exportValues();
     $field_name = $field['field_name'];
-    if (is_numeric($field['field_id']) && $field['field_id'] <> 0 && !empty($field['field_id'])) {
+    if (is_numeric($field['field_id']) && $field['field_id'] != 0 && !empty($field['field_id'])) {
         edit_specific_field($field['field_id'], $field['field_name']);
         $message = get_lang('FieldEdited');
     } else {

+ 3 - 4
main/admin/statistics.php

@@ -2,16 +2,15 @@
 /* For licensing terms, see /license.txt */
 
 /**
-*   @package chamilo.admin
-*/
-
+ *   @package chamilo.admin
+ */
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 $this_section = SECTION_PLATFORM_ADMIN;
 
 api_protect_admin_script();
 
-$interbreadcrumb[] = array('url' => 'index.php', "name" => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', "name" => get_lang('PlatformAdmin')];
 $tool_name = get_lang('Statistics');
 Display::display_header($tool_name);
 Display::display_footer();

+ 9 - 8
main/admin/statistics/index.php

@@ -2,7 +2,8 @@
 /* For licensing terms, see /license.txt */
 
 /**
- * This tool show global Statistics on general platform events
+ * This tool show global Statistics on general platform events.
+ *
  * @package chamilo.Statistics
  */
 $cidReset = true;
@@ -10,7 +11,7 @@ $cidReset = true;
 require_once __DIR__.'/../../inc/global.inc.php';
 api_protect_admin_script();
 
-$interbreadcrumb[] = array('url' => '../index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => '../index.php', 'name' => get_lang('PlatformAdmin')];
 
 $report = isset($_REQUEST['report']) ? $_REQUEST['report'] : '';
 
@@ -20,7 +21,7 @@ if ($report) {
         <script>
             $(document).ready(function() {
                 $.ajax({
-                    url: "'. api_get_path(WEB_CODE_PATH).'inc/ajax/statistics.ajax.php?a=recentlogins",
+                    url: "'.api_get_path(WEB_CODE_PATH).'inc/ajax/statistics.ajax.php?a=recentlogins",
                     type: "POST",
                     success: function(data) {
                         Chart.defaults.global.responsive = true;
@@ -101,14 +102,14 @@ switch ($report) {
         break;
     case 'users':
         // total amount of users
-        $teachers = $students = array();
+        $teachers = $students = [];
         $countInvisible = isset($_GET['count_invisible_courses']) ? intval($_GET['count_invisible_courses']) : null;
         Statistics::printStats(
             get_lang('NumberOfUsers'),
-            array(
+            [
                 get_lang('Teachers') => Statistics::countUsers(COURSEMANAGER, null, $countInvisible),
-                get_lang('Students') => Statistics::countUsers(STUDENT, null, $countInvisible)
-            )
+                get_lang('Students') => Statistics::countUsers(STUDENT, null, $countInvisible),
+            ]
         );
         foreach ($course_categories as $code => $name) {
             $name = str_replace(get_lang('Department'), "", $name);
@@ -136,7 +137,7 @@ switch ($report) {
         Statistics::printUsersNotLoggedInStats();
         break;
     case 'zombies':
-        ZombieReport::create(array('report' => 'zombies'))->display();
+        ZombieReport::create(['report' => 'zombies'])->display();
         break;
     case 'activities':
         Statistics::printActivitiesStats();

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است