Browse Source

Solve merge conflict with 1.10.x - refs BT9022

Imanol Losada 10 years ago
parent
commit
80ba7fe4f0
100 changed files with 5551 additions and 2968 deletions
  1. 15 0
      .gitattributes
  2. 15 0
      .gitignore
  3. 2 0
      CONTRIBUTING.md
  4. 26 0
      README.md
  5. 0 2
      README.txt
  6. 53 2
      composer.json
  7. 3374 174
      composer.lock
  8. 0 13
      custompages/README
  9. 24 0
      custompages/README.md
  10. 0 0
      custompages/first_login-dist.php
  11. 0 0
      custompages/index-logged-dist.php
  12. 0 0
      custompages/index-unlogged-dist.php
  13. 0 0
      custompages/loggedout-dist.php
  14. 0 0
      custompages/lostpassword-dist.php
  15. 119 0
      custompages/registration-dist.php
  16. 0 0
      custompages/registration-feedback-dist.php
  17. 0 124
      custompages/registration.php
  18. 6 0
      data/index.html
  19. 62 29
      documentation/changelog.html
  20. 24 19
      documentation/credits.html
  21. 13 13
      documentation/dependencies.html
  22. 1 1
      documentation/index.html
  23. 46 38
      documentation/installation_guide.html
  24. 5 2
      documentation/installation_guide_es_ES.html
  25. 5 2
      documentation/installation_guide_fr_FR.html
  26. 5 2
      documentation/installation_guide_it_IT.html
  27. 28 4
      documentation/optimization.html
  28. 23 11
      index.php
  29. 4 5
      main/admin/access_url_add_courses_to_url.php
  30. 0 2
      main/admin/access_url_add_usergroup_to_url.php
  31. 0 1
      main/admin/access_url_add_users_to_url.php
  32. 0 2
      main/admin/access_url_check_user_session.php
  33. 0 1
      main/admin/access_url_edit.php
  34. 0 3
      main/admin/access_url_edit_course_category_to_url.php
  35. 187 203
      main/admin/access_url_edit_courses_to_url.php
  36. 1 4
      main/admin/access_url_edit_usergroup_to_url.php
  37. 0 3
      main/admin/access_url_edit_users_to_url.php
  38. 2 6
      main/admin/access_urls.php
  39. 0 1
      main/admin/add_courses_to_session.php
  40. 2 4
      main/admin/add_courses_to_usergroup.php
  41. 0 2
      main/admin/add_many_session_to_category.php
  42. 1 5
      main/admin/add_sessions_to_promotion.php
  43. 1 3
      main/admin/add_sessions_to_usergroup.php
  44. 0 2
      main/admin/add_students_to_session.php
  45. 0 2
      main/admin/add_teachers_to_session.php
  46. 1 3
      main/admin/add_users_to_group.php
  47. 13 3
      main/admin/add_users_to_session.php
  48. 1 3
      main/admin/add_users_to_usergroup.php
  49. 1 395
      main/admin/calendar.lib.php
  50. 2 1
      main/admin/calendar.php
  51. 1 2
      main/admin/calendar_ical_export.php
  52. 31 37
      main/admin/career_dashboard.php
  53. 1 2
      main/admin/careers.php
  54. 2 2
      main/admin/class_add.php
  55. 1 2
      main/admin/class_edit.php
  56. 1 4
      main/admin/class_import.php
  57. 0 2
      main/admin/class_information.php
  58. 1 4
      main/admin/class_list.php
  59. 12 16
      main/admin/class_user_import.php
  60. 8 11
      main/admin/configure_extensions.php
  61. 472 475
      main/admin/configure_homepage.php
  62. 7 25
      main/admin/configure_inscription.php
  63. 59 32
      main/admin/configure_plugin.php
  64. 16 7
      main/admin/course_add.php
  65. 5 7
      main/admin/course_category.php
  66. 163 158
      main/admin/course_edit.php
  67. 1 4
      main/admin/course_import.php
  68. 0 8
      main/admin/course_intro_pdf_import.php
  69. 2 5
      main/admin/course_list.php
  70. 0 10
      main/admin/course_request_accepted.php
  71. 2 14
      main/admin/course_request_edit.php
  72. 0 11
      main/admin/course_request_rejected.php
  73. 0 11
      main/admin/course_request_review.php
  74. 0 4
      main/admin/course_user_import.php
  75. 0 4
      main/admin/course_user_import_by_email.php
  76. 0 390
      main/admin/course_virtual.php
  77. 1 3
      main/admin/dashboard_add_courses_to_user.php
  78. 1 2
      main/admin/dashboard_add_sessions_to_user.php
  79. 76 18
      main/admin/dashboard_add_users_to_user.php
  80. 16 18
      main/admin/event_controller.php
  81. 35 36
      main/admin/event_type.php
  82. 1 1
      main/admin/example_class.csv
  83. 1 4
      main/admin/export_certificates.php
  84. 25 25
      main/admin/extra_fields.php
  85. 29 33
      main/admin/grade_models.php
  86. 1 3
      main/admin/group_add.php
  87. 0 4
      main/admin/group_edit.php
  88. 5 7
      main/admin/group_list.php
  89. 0 5
      main/admin/inactive_user_list.php
  90. 118 19
      main/admin/index.php
  91. 0 1
      main/admin/languages.php
  92. 1 2
      main/admin/ldap_import_students.php
  93. 0 2
      main/admin/ldap_import_students_to_session.php
  94. 0 2
      main/admin/ldap_synchro.php
  95. 12 21
      main/admin/ldap_users_list.php
  96. 0 2
      main/admin/ldap_users_synchro.php
  97. 1 1
      main/admin/legal_add.php
  98. 1 1
      main/admin/promotions.php
  99. 56 56
      main/admin/resume_session.php
  100. 324 365
      main/admin/session_add.php

+ 15 - 0
.gitattributes

@@ -2,3 +2,18 @@
 .gitignore export-ignore
 .travis.yml export-ignore
 /tests export-ignore
+
+/vendor/ezyang/htmlpurifier/docs export-ignore
+/vendor/ezyang/htmlpurifier/benchmarks export-ignore
+/vendor/ezyang/htmlpurifier/tests export-ignore
+/vendor/ezyang/htmlpurifier/smoketests export-ignore
+/vendor/ezyang/htmlpurifier/package.php export-ignore
+/vendor/ezyang/htmlpurifier/release1-update.php export-ignore
+/vendor/ezyang/htmlpurifier/release2-tag.php export-ignore
+/vendor/ezyang/htmlpurifier/test-settings.sample.php export-ignore
+/vendor/twig/twig/test export-ignore
+/vendor/monolog/monolog/tests/ export-ignore
+/vendor/neutron/temporary-filesystem/tests export-ignore
+/vendor/sabre/vobject/tests export-ignore
+/vendor/twig/twig/test export-ignore
+/vendor/symfony/console/Symfony/Component/Console/Tests export-ignore

+ 15 - 0
.gitignore

@@ -17,6 +17,14 @@ home/*
 main/upload/users/*
 !main/upload/users/index.html
 
+# Session images
+main/upload/sessions/*
+!main/upload/sessions/index.html
+
+# Course images
+main/upload/courses/*
+!main/upload/courses/index.html
+
 # Logs and databases #
 *.log
 
@@ -35,3 +43,10 @@ searchdb/*
 nbproject/*
 
 plugin/bbb/config.vm.php
+
+main/cron/incoming/*
+vendor
+data/*
+!data/index.html
+data/badges/*
+!data/badges/index.html

+ 2 - 0
CONTRIBUTING.md

@@ -9,6 +9,8 @@ If you'd like to contribute, please read the following document:
 * [PSR-1][2]: PSR-1 are standard conventions rules we use as a base (conversion of old code still in progress)
 * [PSR-2][3]: PSR-2 are more detailed standard conventions rules we use as base (conversion of old code still in progress)
 
+We expect contributions to be sent through Pull Requests, a special feature of Github. We recommend you follow this guide to understand a little more about the way it works: https://guides.github.com/activities/contributing-to-open-source/
+
 [1]: https://support.chamilo.org/projects/chamilo-18/wiki/Coding_conventions
 [2]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md
 [3]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md

+ 26 - 0
README.md

@@ -0,0 +1,26 @@
+# Chamilo 1.10.x
+
+## Installation
+
+Clone the repository
+
+```
+git clone https://github.com/chamilo/chamilo-lms.git chamilo-1.10
+```
+
+Checkout branch 1.10.x
+
+```
+cd chamilo-1.10
+git checkout --track origin/1.10.x
+git config --global push.default current
+```
+
+Update dependencies using Composer
+
+```
+composer update
+```
+
+# Documentation
+For more information on Chamilo, visit https://stable.chamilo.org/documentation

+ 0 - 2
README.txt

@@ -1,2 +0,0 @@
-For more information on Chamilo, open documentation/index.html in this directory with a web browser.
-

+ 53 - 2
composer.json

@@ -1,11 +1,62 @@
 {
+    "name": "chamilo/chamilo-lms",
+    "description": "E-learning and collaboration software",
+    "type": "project",
+    "homepage": "http://www.chamilo.org",
+    "license": "GPL-3.0",
+    "support": {
+        "forum": "http://www.chamilo.org/forum",
+        "irc": "irc://irc.freenode.org/chamilo"
+    },
+    "autoload": {
+        "psr-0": {
+            "Chamilo": "src/"
+        },
+        "classmap": [
+            "main/auth",
+            "main/admin",
+            "main/cron/lang",
+            "main/coursecopy",
+            "main/course_description",
+            "main/dropbox",
+            "main/exercice",
+            "main/gradebook/lib",
+            "main/newscorm",
+            "main/inc/lib",
+            "plugin",
+            "main/install",
+            "main/inc/lib/getid3",
+            "main/survey",
+            "main/inc/lib/hook"
+        ]
+    },
     "require": {
-        "php-ffmpeg/php-ffmpeg": "0.3.x-dev@dev",
+        "php": ">=5.4",
+        "php-ffmpeg/php-ffmpeg": "~0.6",
         "sabre/vobject": "~3.1",
         "toin0u/digitalocean": "~1.4",
         "twig/twig": "1.*",
         "michelf/php-markdown": "1.4.1",
         "emojione/emojione": "1.3.0",
-        "zendframework/zend-config": "2.3.3"
+        "zendframework/zend-config": "2.3.3",
+        "ezyang/htmlpurifier": "4.6.0",
+        "aferrandini/phpqrcode": "1.0.1",
+        "ckeditor/ckeditor": "4.4.7",
+        "szymach/c-pchart": "1.*",
+        "aferrandini/phpqrcode": "1.0.1",
+        "mpdf/mpdf": "5.7.4",
+        "barryvdh/elfinder-builds": "2.1.0.3",
+        "jbroadway/urlify": "1.0.3-stable",
+        "monolog/monolog": "~1.0",
+        "doctrine/orm": "~2.2,>=2.2.3,<2.5",
+        "symfony/doctrine-bridge": "2.6.4",
+        "symfony/validator": "2.6.4",
+        "gedmo/doctrine-extensions": "~2.3",
+        "sonata-project/user-bundle": "~2.2"
+    },
+    "extra": {
+        "branch-alias": {
+            "dev-master": "1.10.x-dev"
+        }
     }
 }

File diff suppressed because it is too large
+ 3374 - 174
composer.lock


+ 0 - 13
custompages/README

@@ -1,13 +0,0 @@
-CustomPages looks for alternatives in this directory, and displays them if present. The user-provided custom pages must exactly be named as such :
-
-- index-logged.php for the general landing page before login
-- index-unlogged.php for the general landing page when already logged-in
-- registration.php for the registration form
-- registration-feedback.php for the registration success feedback
-- lostpassword.php for the password recovery form
-- lostpassword-feedback.php for the password recovery feedback page
-
-Important note :
-Enable the use_custom_pages setting
-
-If you pull this feature from a repo, not through an upgrade or install process, you have to exectute the following SQL statements in the main database or this option won't appear in the admin interface :

+ 24 - 0
custompages/README.md

@@ -0,0 +1,24 @@
+Custom pages
+=============
+
+CustomPages looks for alternatives in this directory, and displays them if present.
+The user-provided custom pages must exactly be named as such :
+
+- index-logged.php for the general landing page before login
+- index-unlogged.php for the general landing page when already logged-in
+- registration.php for the registration form
+- registration-feedback.php for the registration success feedback
+- lostpassword.php for the password recovery form
+
+
+### Installation
+
+- Enable the use_custom_pages setting
+- Create your own modifications based in the files with the suffix "-dist.php"
+
+### Important notes
+
+- Do not replace the images in the images/ directory.
+  Instead, create new images, as the current ones will be overwritten
+  by each Chamilo upgrade.
+

+ 0 - 0
custompages/first_login.php → custompages/first_login-dist.php


+ 0 - 0
custompages/index-logged.php → custompages/index-logged-dist.php


+ 0 - 0
custompages/index-unlogged.php → custompages/index-unlogged-dist.php


+ 0 - 0
custompages/loggedout.php → custompages/loggedout-dist.php


+ 0 - 0
custompages/lostpassword.php → custompages/lostpassword-dist.php


+ 119 - 0
custompages/registration-dist.php

@@ -0,0 +1,119 @@
+<?php
+/* For licensing terms, see /license.txt */
+/**
+ * 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)
+ * @package chamilo.custompages
+ **/
+
+require_once('language.php');
+require_once('../inc/global.inc.php');
+
+/**
+ * Removes some unwanted elementend of the form object
+ */
+$content['form']->removeElement('extra_mail_notify_invitation');
+$content['form']->removeElement('extra_mail_notify_message');
+$content['form']->removeElement('extra_mail_notify_group_message');
+$content['form']->removeElement('official_code');
+$content['form']->removeElement('phone');
+$content['form']->removeElement('submit');
+if (isset($content['form']->_elementIndex['status'])) {
+    $content['form']->removeElement('status');
+    $content['form']->removeElement('status');
+}
+/**
+ * Code to change the way QuickForm render html
+ */
+/*
+$renderer = & $content['form']->defaultRenderer();
+$form_template = <<<EOT
+
+<form {attributes}>
+{content}
+  <div class="clear">
+    &nbsp;
+  </div>
+  <p><a href="#" class="btn" onclick="$('#registration-form').submit()"><span>S'inscrire</span></a></p>
+</form>
+
+EOT;
+$renderer->setFormTemplate($form_template);
+
+$element_template = <<<EOT
+  <div class="field decalle">
+    <label>
+      <!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->{label}
+    </label>
+    <div class="formw">
+      <!-- BEGIN error --><span class="form_error">{error}</span><br /><!-- END error --> {element}
+    </div>
+  </div>
+
+EOT;
+$element_template_wimage = <<<EOT
+  <div class="field decalle display">
+    <label>
+      <!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->{label}
+    </label>
+    <div class="formw">
+      <!-- BEGIN error --><span class="form_error">{error}</span><br /><!-- END error --> {element}
+      <img src="/custompages/images/perso.jpg" alt="" />
+    </div>
+  </div>
+
+EOT;
+$renderer->setElementTemplate($element_template_wimage,'pass1');
+$renderer->setElementTemplate($element_template);
+
+$header_template = <<<EOT
+  <div class="row">
+    <div class="form_header">{header}</div>
+  </div>
+
+EOT;
+
+ */
+?>
+<html>
+<head>
+	<title>Registration</title>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+	<!--[if !IE 6]><!-->
+	<link rel="stylesheet" type="text/css" href="../../custompages/style.css" />
+	<!--<![endif]-->
+	<!--[if IE 6]>
+	<link rel="stylesheet" type="text/css" href="../../custompages/style-ie6.css" />
+	<![endif]-->
+	<script type="text/javascript" src="../../main/inc/lib/javascript/jquery.min.js"></script>
+</head>
+<body>
+	<div id="backgroundimage">
+		<img src="/custompages/images/page-background.png" class="backgroundimage" />
+	</div>
+	<div id="wrapper">
+		<div id="header">
+			<img src="../../custompages/images/header.png" alt="Ambassador logo" />
+		</div> <!-- #header -->
+		<div id="registration-form-box" class="form-box">
+		<?php if (isset($form_error) && !empty($form_error)) {
+			echo '<div id="registration-form-error" class="form-error"><ul>'.$form_error.'</ul></div>';
+		}?>
+      <?php
+      $content['form']->display();
+      ?>
+			<div id="registration-form-submit" class="form-submit" onclick="document.forms['registration'].submit();">
+				<span><?php echo custompages_get_lang('Subscribe');?></span>
+			</div> <!-- #form-submit -->
+			<div id="links">
+      <!--<a href="mailto: support@cblue.be"><?php echo custompages_get_lang('NeedContactAdmin')?></a><br />-->
+			</div>
+		</div> <!-- #form -->
+		<div id="footer">
+			<img src="../../custompages/images/footer.png" />
+		</div> <!-- #footer -->
+	</div> <!-- #wrapper -->
+</body>
+</html>

+ 0 - 0
custompages/registration-feedback.php → custompages/registration-feedback-dist.php


+ 0 - 124
custompages/registration.php

@@ -1,124 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-/**
- * 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)
- * @package chamilo.custompages
- **/
-/**
- * Initialization
- */
-require_once('language.php');
-require_once('../inc/global.inc.php');
-require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
-require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
-require_once api_get_path(CONFIGURATION_PATH).'profile.conf.php';
-require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
-/**
- * Removes some unwanted elementend of the form object
- */
-$content['form']->removeElement('extra_mail_notify_invitation');
-$content['form']->removeElement('extra_mail_notify_message');
-$content['form']->removeElement('extra_mail_notify_group_message');
-$content['form']->removeElement('official_code');
-$content['form']->removeElement('phone');
-$content['form']->removeElement('submit');
-if (isset($content['form']->_elementIndex['status'])) {
-    $content['form']->removeElement('status');
-    $content['form']->removeElement('status');
-}
-/**
- * Code to change the way QuickForm render html
- */
-/*
-$renderer = & $content['form']->defaultRenderer();
-$form_template = <<<EOT
-
-<form {attributes}>
-{content}
-  <div class="clear">
-    &nbsp;
-  </div>
-  <p><a href="#" class="btn" onclick="$('#registration-form').submit()"><span>S'inscrire</span></a></p>
-</form>
-
-EOT;
-$renderer->setFormTemplate($form_template);
-
-$element_template = <<<EOT
-  <div class="field decalle">
-    <label>
-      <!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->{label}
-    </label>
-    <div class="formw">
-      <!-- BEGIN error --><span class="form_error">{error}</span><br /><!-- END error --> {element}
-    </div>
-  </div>
-
-EOT;
-$element_template_wimage = <<<EOT
-  <div class="field decalle display">
-    <label>
-      <!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->{label}
-    </label>
-    <div class="formw">
-      <!-- BEGIN error --><span class="form_error">{error}</span><br /><!-- END error --> {element}
-      <img src="/custompages/images/perso.jpg" alt="" />
-    </div>
-  </div>
-
-EOT;
-$renderer->setElementTemplate($element_template_wimage,'pass1');
-$renderer->setElementTemplate($element_template);
-
-$header_template = <<<EOT
-  <div class="row">
-    <div class="form_header">{header}</div>
-  </div>
-
-EOT;
-
- */
-?>
-<html>
-<head>
-	<title>Registration</title>
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-	<!--[if !IE 6]><!-->
-	<link rel="stylesheet" type="text/css" href="../../custompages/style.css" />
-	<!--<![endif]-->
-	<!--[if IE 6]>
-	<link rel="stylesheet" type="text/css" href="../../custompages/style-ie6.css" />
-	<![endif]-->
-	<script type="text/javascript" src="../../main/inc/lib/javascript/jquery.min.js"></script>
-</head>
-<body>
-	<div id="backgroundimage">
-		<img src="/custompages/images/page-background.png" class="backgroundimage" />
-	</div>
-	<div id="wrapper">
-		<div id="header">
-			<img src="../../custompages/images/header.png" alt="Ambassador logo" />
-		</div> <!-- #header -->
-		<div id="registration-form-box" class="form-box">
-		<?php if (isset($form_error) && !empty($form_error)) {
-			echo '<div id="registration-form-error" class="form-error"><ul>'.$form_error.'</ul></div>';
-		}?>
-      <?php
-      $content['form']->display();
-      ?>
-			<div id="registration-form-submit" class="form-submit" onclick="document.forms['registration'].submit();">
-				<span><?php echo custompages_get_lang('Subscribe');?></span>
-			</div> <!-- #form-submit -->
-			<div id="links">
-      <!--<a href="mailto: support@cblue.be"><?php echo custompages_get_lang('NeedContactAdmin')?></a><br />-->
-			</div>
-		</div> <!-- #form -->
-		<div id="footer">
-			<img src="../../custompages/images/footer.png" />
-		</div> <!-- #footer -->
-	</div> <!-- #wrapper -->
-</body>
-</html>

+ 6 - 0
data/index.html

@@ -0,0 +1,6 @@
+<html>
+<head>
+</head>
+<body>
+</body>
+</html>

+ 62 - 29
documentation/changelog.html

@@ -44,9 +44,22 @@
 <p><i>Note: most #wxyz references are issue numbers you can find in <a href="http://support.chamilo.org/projects/chamilo-18/issues" target="_blank">our public bug tracking system</a>. Some references marked BT#xyz are developments made externally for BeezNest customers and integrated into Chamilo. The details of these tasks cannot be seen for confidentiality reasons, but the code change is public and can be reviewed by anyone.</i></p>
 <p>&nbsp;</p>
 
-<h1>Chamilo 1.9.10 - Huánuco, 10th of November, 2014</h1>
+<h1>Chamilo 1.10.0 - ???, ??? 2015</h1>
 <h3>Release notes - summary</h3>
-<p>Chamilo 1.9.10 is a patch version with a few minor bugfixes and a new packaging. This will be packaged and promoted as 1.9.8, but the folder inside the 1.9.8 will be called 1.9.10, with a few changes to this changelog file and a few fixes throughout the code (as such, you can just overwrite previous files to upgrade from 1.9.8, 1.9.8.1 or 1.9.8.2 to 1.9.10).</p>
+<p>Chamilo 1.10.0 is a major version of the 1.10.x branch, with new features and bugfixes on top of 1.9.10. As a major version, it requires the use of the upgrade script in order to upgrade an existing Chamilo portal. See install instructions</p>
+<h3>Release name</h3>
+<h3>Security fixes</h3>
+<h3>Possibly breaking changes</h3>
+<h3>Notable new Features</h3>
+<h3>Improvements (minor features) and debug</h3>
+<h3>Stylesheets and theming</h3>
+<h3>Web services</h3>
+<h3>Removals</h3>
+
+
+<h1>Chamilo 1.9.10 - Huánuco, 25th of January, 2015</h1>
+<h3>Release notes - summary</h3>
+<p>Chamilo 1.9.10 is a new minor version of the 1.9.x branch, with many bugfixes and a few interesting new features (as such, you can just overwrite previous files to upgrade from 1.9.8, 1.9.8.1 or 1.9.8.2 to 1.9.10).</p>
 <h3>Release name</h3>
 <p><a href="http://es.wikipedia.org/wiki/Departamento_de_Huánuco">Huánuco</a> is
   a small city in the Peruvian Andes, Northeast of Lima. This is a special
@@ -63,46 +76,47 @@
   platform, that will serve its purpose, helping making education better and
   more widely available, better than ever before.</p>
 
-<h3>Possibly breaking changes</h3>
-<p>Two changes have been made to the forum tool code, which might make some of your forums disappear and require a direct database intervention.<br />
-First case: If you use forums with sessions and have placed a session forum inside a base-course forum category, the forum category will now no longer appear in any session, and as such, the session forums contained in that category will disappear. You can easily fix that by checking the c_forum_forum table for any record with session_id != 0 that points to a forum category that has session_id == 0. This is related to issue #7264.<br />
-Second case: if you use group forums and have had issues with posts appearing twice, then this release will fix this bug, but might also make some forum posts disappear. Although we could not reproduce the error, you should be able to fix it by changing the group_id column inside the c_forum_thread table. This is related to issue #7267<br />
-This is an exceptional event in the history of Chamilo, and we believe it should only affect very few portals, but we prefer to take precautionnary measures and warn you upfront.<br />
-</p>
-
-<h3>Security</h3>
+<h3>Security fixes</h3>
 All security issues are published and patches are attached on <a href="https://support.chamilo.org/projects/chamilo-18/wiki/Security_issues">our security issues page</a>. If you think you found an additional security issue you'd like to report, please check our procedure there.
 <ul>
   <li>(8a75f65 - #7242) Fix SQL injection in mySpace/users.php</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/d64a02c156c7adf3983807be860a7848311dbfb3">d64a02c1</a> - <a href="https://support.chamilo.org/issues/7272">#7272</a>) Fix SQL injection threats and replace SESSION variable with api_get_user_id</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/587961662a8f9d035e52f14cd0aa4fee3aee68d8">58796166</a> - <a href="https://support.chamilo.org/issues/7275">#7275</a>) Add security token to course copy tool</li>
-  <li>(#7440) Fix a series of SQL injections due to integer filtering</li>
+  <li>(<a href="https://support.chamilo.org/issues/7440">#7440</a>) Fix a series of SQL injection vulnerabilities due to integer filtering</li>
 </ul>
 
+<h3>Possibly breaking changes</h3>
+<p>Two changes have been made to the forum tool code, which might make some of your forums disappear and require a direct database intervention.<br />
+    First case: If you use forums with sessions and have placed a session forum inside a base-course forum category, the forum category will now no longer appear in any session, and as such, the session forums contained in that category will disappear. You can easily fix that by checking the c_forum_forum table for any record with session_id != 0 that points to a forum category that has session_id == 0. This is related to issue #7264.<br />
+    Second case: In very rare occasions, if you use group forums and have had issues with posts appearing twice, then this release will fix this bug, but might also make some forum posts disappear. Although we could not reproduce the error, you should be able to fix it by changing the group_id column inside the c_forum_thread table. This is related to issue #7267<br />
+    This is an exceptional event in the history of Chamilo, and we believe it should only affect very few portals, but we prefer to take precautionnary measures and warn you upfront.<br />
+</p>
+
 <h3>Notable new Features</h3>
 <ul>
-
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/7e67dd29ccd7198ffb26e06847b48409895bc161">7e67dd29</a> - <a href="https://task.beeznest.com/issues/9018">BT#9018</a>) Add PDF export for student publications list</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/5e8ae687fd8a303e707a6a4fa677313056eb87c7">5e8ae687</a> - <a href="https://support.chamilo.org/issues/7478">#7478</a>) Add cookie warning message to comply with new European legislation</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/e637608c553c1041ae0c7f217d74f748f48bd789">e637608c</a> - <a href="https://task.beeznest.com/issues/8814">BT#8814</a>) Add "Auto attendance" based on course login</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/960899a6b227e1547751fcade680a696dffdcb1e">960899a6</a>) Add possibility to hide previous videoconferences even if recording is not enabled</li>
-  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/3bc8fd6fad15e6d92e8c1fd32e28d531c8c07d1d">3bc8fd6f</a>) Adding $_configuration['document_if_file_exists_option']</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/3bc8fd6fad15e6d92e8c1fd32e28d531c8c07d1d">3bc8fd6f</a>) Add $_configuration['document_if_file_exists_option']</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/73e381620438970423d371e717ad0bb8d5667a29">73e38162</a> - <a href="https://task.beeznest.com/issues/9247">BT#9247</a>) Adding exercise_max_fckeditors_in_page setting</li>
-  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/b14bcb36ad2145721205145561ae9a2d024a3a36">b14bcb36</a>) Adding option $_configuration['certificate_pdf_orientation']</li>
-  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/6bd4b5df0db53da2e586f1dac514873aca11ba7b">6bd4b5df</a> - <a href="https://task.beeznest.com/issues/8814">BT#8814</a>) Adding auto attendance</li>
-  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/7dbed8004f3a7da69a187df1de1cf7034097dfd7">7dbed800</a> - <a href="https://task.beeznest.com/issues/8703">BT#8703</a>) Adding hosting total size checker</li>
-  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/218dc6a4d7f27026b51df142a4b41d944bf44423">218dc6a4</a> - <a href="https://task.beeznest.com/issues/9175">BT#9175</a>) Adding hosting_limit_active_courses setting</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/b14bcb36ad2145721205145561ae9a2d024a3a36">b14bcb36</a>) Add option $_configuration['certificate_pdf_orientation']</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/7dbed8004f3a7da69a187df1de1cf7034097dfd7">7dbed800</a> - <a href="https://task.beeznest.com/issues/8703">BT#8703</a>) Add hosting total size checker</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/218dc6a4d7f27026b51df142a4b41d944bf44423">218dc6a4</a> - <a href="https://task.beeznest.com/issues/9175">BT#9175</a>) Add hosting_limit_active_courses setting</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/1d68db47b2dcb00a36e5b2d90e5be3cd6494cd56">1d68db47</a> - <a href="https://support.chamilo.org/issues/398">#398</a>) Support Opale/Scenarii by adding variable to better support SCORM 1.2 by watching over the definition, by the SCO, of the lesson_status and the call to LMSFinish() or the move to another element</li>
-  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/57750c212909bb4d74fb7b4bbba93b836c69979e">57750c21</a> - <a href="https://task.beeznest.com/issues/8900">BT#8900</a>) Adding progress in learning paths report</li>
-  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/903436eadfd7bc4cb8b20136301ceaba165b4ae1">903436ea</a> - <a href="https://task.beeznest.com/issues/8902">BT#8902</a>) Adding learning paths reduced report</li><li>(<a href="https://github.com/chamilo/chamilo-lms/commit/1a6a4a927eaf9aa919e47852a5ea7d6698063fac">1a6a4a92</a> - <a href="https://support.chamilo.org/issues/7272">#7272</a>) Add possibility for plugins to define main tabs</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/57750c212909bb4d74fb7b4bbba93b836c69979e">57750c21</a> - <a href="https://task.beeznest.com/issues/8900">BT#8900</a>) Add progress in learning paths report</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/903436eadfd7bc4cb8b20136301ceaba165b4ae1">903436ea</a> - <a href="https://task.beeznest.com/issues/8902">BT#8902</a>) Add learning paths reduced report</li><li>(<a href="https://github.com/chamilo/chamilo-lms/commit/1a6a4a927eaf9aa919e47852a5ea7d6698063fac">1a6a4a92</a> - <a href="https://support.chamilo.org/issues/7272">#7272</a>) Add possibility for plugins to define main tabs</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/ef242abd937637ec96973ecd7ad7b431949eab87">ef242abd</a> - <a href="https://support.chamilo.org/issues/7255">#7255</a>) Add multiple file upload in forum, and show list of attachment files from view threads</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/c8f940be4aa4587e57fb36bab800b3e90a4f8762">c8f940be</a> - <a href="https://support.chamilo.org/issues/7338">#7338</a>) Add REST web service to get personal messages (from inbox)</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/2db9057d7b589e1d91554f5f39df415c810aeb95">2db9057d</a> - <a href="https://support.chamilo.org/issues/7328">#7328</a>) Add theme_backup and default_template settings</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/8d9a82535e9a1f6e11832f8217809d6e8cae9b36">8d9a8253</a>) Add script to check users data in CSV file</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/f52df87bded7b10787bec5516124024b5ad4edea">f52df87b</a> - <a href="https://task.beeznest.com/issues/8845">BT#8845</a>) Add script to move users from one course to another depending on them having passed an exam or not</li>
-  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/27493b32acc9d6cde3e95b5a34e4c03dcc004589">27493b32</a> - <a href="https://support.chamilo.org/issues/7324">#7324</a>) Add possibility to hide recordings to students in conferences list in BBB plugin</li>
-  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/c24c758f7469fd73646892f2d37636d158c9fd8a">c24c758f</a> - <a href="https://task.beeznest.com/issues/8840">BT#8840</a>) Adding $_configuration['auto_detect_language_custom_pages'] to detect the language in custom pages</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/27493b32acc9d6cde3e95b5a34e4c03dcc004589">27493b32</a> - <a href="https://support.chamilo.org/issues/7324">#7324</a>) Add possibility to hide recordings from students in conferences list in BBB plugin</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/c24c758f7469fd73646892f2d37636d158c9fd8a">c24c758f</a> - <a href="https://task.beeznest.com/issues/8840">BT#8840</a>) Add $_configuration['auto_detect_language_custom_pages'] to detect the language in custom pages</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/a2ff44cf6978393a3b5577afd408f11d58694c3c">a2ff44cf</a> - <a href="https://support.chamilo.org/issues/7212">#7212</a>) Add calculated answers feature (in beta test)</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/25cd7ddc4928c76591dd983b05abf6a7cf929654">25cd7ddc</a>) Use .gitattributes file to enable special Github features for versions packaging</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/002a0ab5a3901e8f8ef277ba06d841598c7ea93d">002a0ab5</a> - <a href="https://support.chamilo.org/issues/7309">#7309</a>) New icons for questions types</li>
-  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/0d131f9e4ee054d8099cbe470130aaa4e5ac01bc">0d131f9e</a> - <a href="https://task.beeznest.com/issues/8746">BT#8746</a>) Adding option "include all users" to export</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/0d131f9e4ee054d8099cbe470130aaa4e5ac01bc">0d131f9e</a> - <a href="https://task.beeznest.com/issues/8746">BT#8746</a>) Add option "include all users" to export</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/88126fe2e20114c0a62dcf282b37624ac6837965">88126fe2</a> - <a href="https://task.beeznest.com/issues/8796">BT#8796</a>) Add option to prevent multiple simultaneous login option ($_configuration['multiple_connection_not_allowed'])</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/58334f81813bf4f98fd29c1c0b39e8510fb7de2e">58334f81</a> - <a href="https://task.beeznest.com/issues/8746">BT#8746</a>) Add OnlyBestAttempts option to show only the best attempts in exercise results list</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/8ad728a6637a44570712e7c14e66b3b7bcea5f33">8ad728a6</a> - <a href="https://support.chamilo.org/issues/7279">#7279</a>) Add tour plugin</li>
@@ -132,21 +146,40 @@ All security issues are published and patches are attached on <a href="https://s
 
 <h3>Improvements (minor features) and debug</h3>
 <ul>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/110060be24244a8f8cfb9837bf9500aaddf2bc3a">110060be</a> - <a href="https://support.chamilo.org/issues/7462">#7462</a>) Fix pages blocked due to course restriction</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/299ba994390549c0193348c498760e727236609c">299ba994</a> - <a href="https://support.chamilo.org/issues/7477">#7477</a>) Restore admin view in reports (was lost in 1.9.8)</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/7f55f83751bd8d0e641afb85f05093f5e42c8bd6">7f55f837</a>) Rename the custompages php files in order to avoid overwrites</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/306c7b08d9a89cdde94e76cb47c1054eb01688fd">306c7b08</a>) Fix possible error when there are a lot of certicates to load.</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/bc07d715730d3035c2282a9de0ee8a2aba8b9f24">bc07d715</a> - <a href="https://task.beeznest.com/issues/9289">BT#9289</a>) Adds set_time_limit(0) in the certificate generation page</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/f1c9210c4dce32a7b8dca9c3b545bd1e515f3c2b">f1c9210c</a> - <a href="https://task.beeznest.com/issues/9287">BT#9287</a>) Add name_order_conventions configuration option</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/7820985bdda730332f7a0432b53611f904bce811">7820985b</a> - <a href="https://task.beeznest.com/issues/9280">BT#9280</a>) Fix homepage edition</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/e57d9a668f0f8824350e56be4ba6dca9e481b065">e57d9a66</a>) Fix category link now forcing the registration in itemproperty table</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/c303f2392ddcf944e3c8afa62fd6db4e5dc5eea9">c303f239</a>) Add id_session in gradebook links</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/94ff182d7f46739afa9dfcb06b2a92d8b23f2efe">94ff182d</a>) Deprecate get_statistic_table() in favour of get_main_table()</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/a4a4118afbeeea1c20b9c5cedf776b7a07ab7832">a4a4118a</a>) Fix gradebook form link</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/4c70421ccf99006f0019805a2f83e4f69fe46f2c">4c70421c</a> - <a href="https://task.beeznest.com/issues/9200">BT#9200</a>) Fix link categories (no visibility is used)</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/57e2ffbed22849e1848cf4dd79bfb4d83e5de636">57e2ffbe</a>) Fix comments in student publication list</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/699f26c5ff54c70b18ae0381a26b43c1188c0f07">699f26c5</a> - <a href="https://support.chamilo.org/issues/7441">#7441</a>) Fix default user list order</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/533b0385015281818a0a8fbfac6171d11f1432e7">533b0385</a> - <a href="https://support.chamilo.org/issues/7457">#7457</a>) Fix deletion of personal files in documents</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/28c6e5e610e294f167c0f687e8de7a4c0746f3fc">28c6e5e6</a> - <a href="https://support.chamilo.org/issues/7447">#7447</a>) Fix api_mail_html (adding error log, adding return)</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/8cb2d42f7d391e47a7ff07675ea4a24ca9480523">8cb2d42f</a> - <a href="https://support.chamilo.org/issues/7455">#7455</a>) Using strict mode when cleaning files</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/4a17ad6ba29c4c6c8a1b52ce00131cefddbd6fb7">4a17ad6b</a> - <a href="https://task.beeznest.com/issues/8897">BT#8897</a>) Fix chapter status when saving sub elements in learning paths</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/4f2ac346557fba49def05489f32afccdc5ea062e">4f2ac346</a> - <a href="https://support.chamilo.org/issues/6064">#6064</a>) Fix language list</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/a667212d82788c6676fa9be76a245c48ba5ce99d">a667212d</a> - <a href="https://support.chamilo.org/issues/398">#398</a>) Fix query bug in learnpathItem::write_to_db()</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/4f2ac346557fba49def05489f32afccdc5ea062e">4f2ac346</a> - <a href="https://support.chamilo.org/issues/6064">#6064</a>) Fixing language list in portal homepage edition</li>
-  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/d36c633267b4ec66dec8e04054be2c1db0aae55f">d36c6332</a> - <a href="https://task.beeznest.com/issues/9250">BT#9250</a>) Adding certificate_filter_by_official_code</li>
-  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/ef1dc064ea934ad27f4972d223de8420c3c42854">ef1dc064</a> - <a href="https://support.chamilo.org/issues/9250">#9250</a>) Adding export certificates by user list</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/d36c633267b4ec66dec8e04054be2c1db0aae55f">d36c6332</a> - <a href="https://task.beeznest.com/issues/9250">BT#9250</a>) Add certificate_filter_by_official_code</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/ef1dc064ea934ad27f4972d223de8420c3c42854">ef1dc064</a> - <a href="https://support.chamilo.org/issues/9250">#9250</a>) Add export certificates by user list</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/d9a6fc7d5a02858e5a5dc0469ed219ee18b0521c">d9a6fc7d</a> - <a href="https://task.beeznest.com/issues/9235">BT#9235</a>) If user selects overwrite then we overwrite the file</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/74c25067aa05e139ab84ab3730d3b1a267fe0730">74c25067</a> - <a href="https://task.beeznest.com/issues/9233">BT#9233</a>) Coach can download files if session is read only</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/5d74663bae828477d30211af5cf51ab65b9302f0">5d74663b</a>) Fixing session list when session is read only and inside a category.</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/52c806a671d8f782f128edeefe8f42977e4c1907">52c806a6</a>) Fix possible issue checking the courses directory during installation on a host with default IP</li>
-  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/c916b21c1cf7291a0099caadfa97bd91bda387e4">c916b21c</a>) Adding reporting icon for DRH see 7064</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/c916b21c1cf7291a0099caadfa97bd91bda387e4">c916b21c</a>) Add reporting icon for DRH see 7064</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/e316005a56a9dea6f51697a7f5f7a0a15eddcdc7">e316005a</a> - <a href="https://support.chamilo.org/issues/7064">#7064</a>) Drh can see wiki</li>
-  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/0a64437eed2aceb4d4dbae766236409cc9ae88ac">0a64437e</a> - <a href="https://support.chamilo.org/issues/7064">#7064</a>) Adding DRH support for the survey tool</li>
-  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/3adf5c2d5761498fe51242821e342b8010c96498">3adf5c2d</a> - <a href="https://support.chamilo.org/issues/7064">#7064</a>) Adding DRH support in Assignments</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/0a64437eed2aceb4d4dbae766236409cc9ae88ac">0a64437e</a> - <a href="https://support.chamilo.org/issues/7064">#7064</a>) Add DRH support for the survey tool</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/3adf5c2d5761498fe51242821e342b8010c96498">3adf5c2d</a> - <a href="https://support.chamilo.org/issues/7064">#7064</a>) Add DRH support in Assignments</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/1d2626f2f264012e3a071f2e6931210bc61c6ff1">1d2626f2</a> - <a href="https://task.beeznest.com/issues/6986">BT#6986</a>) Fixing hotpotatoe bug while saving inside a LP</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/5e410a7ffed94a7402360f01ee59c87be2f36c53">5e410a7f</a> - <a href="https://task.beeznest.com/issues/6986">BT#6986</a>) Deleting LP objects in course homepage just in case</li>
-  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/dc784cfe99e7e87ec0c026cd7d2c896e13b26e60">dc784cfe</a> - <a href="https://task.beeznest.com/issues/7802">BT#7802</a>) Adding calendar event extra fields</li>
+  <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/dc784cfe99e7e87ec0c026cd7d2c896e13b26e60">dc784cfe</a> - <a href="https://task.beeznest.com/issues/7802">BT#7802</a>) Add calendar event extra fields</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/3684281a884a3f7702d268e2f676f165b19350e9">3684281a</a> - <a href="https://task.beeznest.com/issues/7064">BT#7064</a>) DRH user can see exercise results</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/c6209ec7accc6cbf03ed63f550420f310532d71e">c6209ec7</a> - <a href="https://task.beeznest.com/issues/8816">BT#8816</a>) Adding "student_publication_to_take_in_gradebook" setting</li>
   <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/601f44fe751ec172e1d3aed18c4e2bc2232f91e3">601f44fe</a> - <a href="https://task.beeznest.com/issues/8816">BT#8816</a>) Showing feedback if exists</li>
@@ -356,7 +389,7 @@ All security issues are published and patches are attached on <a href="https://s
 <h3>Stylesheets and theming</h3>
 <ul>
   <li>No major style changes in this version, but a lot of visual improvements</li>
-  <li>The possibility to select a template (from main/template/) through the configuration.php file has been added, although no new template is available yet</li>
+  <li>The possibility to select a template (from main/template/) through the configuration.php file has been added, although no new template is available yet (at least now you can create your own and use it)</li>
   <li>Old question types icons were replaced by new icons</li>
   <li>Old session "window" icon was replaced by a new icon</li>
 </ul>

+ 24 - 19
documentation/credits.html

@@ -20,11 +20,11 @@
             <ul class="nav">
                 <li><a href="index.html">Home</a></li>
                 <li ><a href="readme.html">About</a></li>
-                <li ><a href="license.html">License</a></li>            
-                <li class="active"><a href="credits.html">Credits</a></li>            
-                <li><a href="dependencies.html">Dependencies</a></li>            
+                <li ><a href="license.html">License</a></li>
+                <li class="active"><a href="credits.html">Credits</a></li>
+                <li><a href="dependencies.html">Dependencies</a></li>
                 <li><a href="changelog.html">Changelog</a></li>
-            </ul>        
+            </ul>
             </div><!--/.nav-collapse -->
         </div>
     </div>
@@ -34,7 +34,7 @@
     <li>
         <a href="index.html">Documentation</a>
         <span class="divider">/</span>
-    </li>    
+    </li>
     <li>Credits</li>
 </ul>
 <h1>Chamilo Credits</h1>
@@ -58,10 +58,15 @@ In the following credits, when possible, we tried to put the latest contributors
 <a name="core-developers"></a>
 <h1>Core contributors / Core team</h1>
 <p>The core contributors are the people who contributed most to the Chamilo software. We are eternally thankful to them for having demonstrated a very high level of commitment, contributing their time and ideas to the project. Since version 1.9, we also include non-developer contributors as we consider their help is essential to the success of our project. This list is updated with each version.</p>
+<h2>Chamilo LMS 1.10.*</h2>
+<ul>
+  <li>Yannick Warnier (yannick.warnier@beeznest.com) - Technical coordinator, Project Leader - BeezNest, Belgium/Peru</li>
+  <li>Julio Montoya (gugli100@gmail.com) - Lead developer - BeezNest, France</li>
+</ul>
 <h2>Chamilo LMS 1.9.*</h2>
 <ul>
   <li>Yannick Warnier (yannick.warnier@beeznest.com) - Technical coordinator, Project Leader - BeezNest, Belgium/Peru</li>
-  <li>Julio Allen Montoya Armas (gugli100@gmail.com) - Lead developer - BeezNest, France</li>
+  <li>Julio Montoya (gugli100@gmail.com) - Lead developer - BeezNest, France</li>
   <li>Hubert Borderiou - Developer responsible for exercises categories and many other practical fixes - Université de Grenoble, France</li>
   <li>Michela Mosquera - Community manager for the (very large) Latin American community - BeezNest, Peru</li>
   <li>Coursenligne45 - Anonymous reporter and contributor to many bugfixes - Independent, France</li>
@@ -78,7 +83,7 @@ In the following credits, when possible, we tried to put the latest contributors
   <li>BeezNest Latino (2007-2014) (aka Dokeos Latinoamérica from 2007-2009)
   <ul>
       <li>Yannick Warnier (ywarnier@beeznest.org) - Lead developer</li>
-      <li>Julio Allen Montoya Armas (gugli100@gmail.com) - Lead Latino developer</li>
+      <li>Julio Montoya (gugli100@gmail.com) - Lead Latino developer</li>
       <li>Christian Fasanando (christian534@hotmail.com) - 2009-2010</li>
       <li>Yoselyn Castillo (yoselyn.castillo@beeznest.com) - Developer</li>
     </ul>
@@ -255,7 +260,7 @@ Rewritten by
   <li>First version:</li>
   <li>Adapted from PHPBB 1.4 (http://www.phpbb.com)</li>
   <li>Modifications: Patrick Cool (patrick.cool@ugent.be)</li>
-  <li>Julio Montoya Armas (gugli100@gmail.com)</li>
+  <li>Julio Montoya (gugli100@gmail.com)</li>
   <li>Management of scoring of threads:</li>
   <li>Christian Fasanando</li>
   <li>Isaac Flores</li>
@@ -289,7 +294,7 @@ Rewritten by
 </ul>
 <h2>Interface and CSS</h2>
 <ul>
-  <li>Julio Montoya Armas (gugli100@gmail.com)</li>
+  <li>Julio Montoya (gugli100@gmail.com)</li>
   <li>Noa Orizales Iglesias (noa@contidosdixitais.com)</li>
   <li>Sandra Matthys</li>
   <li>Wolfgang Schneider (webmaster@bibelcenter.de)</li>
@@ -342,7 +347,7 @@ Rewritten by
   <li>Vargas Palma Rubén (thiefdp@hotmail.com)</li>
   <li>Dokeos 1.8 integration and refactoring:</li>
   <li> Evie Embrechts </li>
-  <li>Julio Montoya Armas (gugli100@gmail.com)</li>
+  <li>Julio Montoya (gugli100@gmail.com)</li>
   <li>Isaac Flores</li>
 </ul>
 
@@ -403,7 +408,7 @@ Rewritten by
 <h2>Survey</h2>
 <ul>
   <li>Patrick Cool</li>
-  <li>Julio Montoya Armas (gugli100@gmail.com)</li>
+  <li>Julio Montoya (gugli100@gmail.com)</li>
   <li>Yannick Warnier</li>
 </ul>
 
@@ -414,7 +419,7 @@ Rewritten by
   <li> Denes Nagy (hotpotatoes integration)</li>
   <li> Eric Marguin </li>
   <li> Julian Prud'homme</li>
-  <li>Julio Montoya Armas (gugli100@gmail.com)</li>
+  <li>Julio Montoya (gugli100@gmail.com)</li>
 </ul>
 
 <h2>Wiki</h2>
@@ -427,7 +432,7 @@ Rewritten by
 <h2>Social Network</h2>
 <ul>
   <li>Thanks to Universidad San Ignacio de Loyola, Lima for the sponsoring of this development</li>
-  <li>Julio Montoya Armas (gugli100@gmail.com)</li>
+  <li>Julio Montoya (gugli100@gmail.com)</li>
   <li>Isaac Flores</li>
   <li>Christian Fasanando</li>
 </ul>
@@ -435,7 +440,7 @@ Rewritten by
 <h2>Platform group tool</h2>
 <ul>
   <li>Thanks to Universidad San Ignacio de Loyola, Lima for the sponsoring of this development</li>
-  <li>Julio Montoya Armas (gugli100@gmail.com)</li>
+  <li>Julio Montoya (gugli100@gmail.com)</li>
   <li>Christian Fasanando</li>
 </ul>
 
@@ -455,7 +460,7 @@ Rewritten by
   <li> Elie Harfouche (elie at harfdesign dot com)</li>
   <li> Roan Embrechts (roan.embrechts@vub.ac.be)</li>
   <li> Bart Mollet (bart.mollet@hogent.be)</li>
-  <li> Julio Montoya Armas (gugli100@gmail.com)</li>
+  <li> Julio Montoya (gugli100@gmail.com)</li>
 </ul>
 
 <h2>(un)zip</h2>
@@ -489,7 +494,7 @@ Rewritten by
   <li>Patrick Cool (patrick.cool@UGent.be)</li>
   <li>Eric Marguin</li>
   <li>Yannick Warnier</li>
-  <li>Social network improvements: Julio Montoya Armas (gugli100@gmail.com)</li>
+  <li>Social network improvements: Julio Montoya (gugli100@gmail.com)</li>
 </ul>
 
 <h2>Web services</h2>
@@ -513,7 +518,7 @@ Rewritten by
 <ul>
   <li>First integration: HTMLArea</li>
   <li>Second integration: FCKEditor</li>
-  <li>Update to FCKEditor 2.6.2: Julio Montoya Armas(gugli100@gmail.com)</li>
+  <li>Update to FCKEditor 2.6.2: Julio Montoya (gugli100@gmail.com)</li>
   <li>Update to FCKEditor 2.6.6 and addition of other plugins: Ivan Tcholakov</li>
   <li>ASCIIMathML-based formula rendering and ASCIIsvg-based mathematical graphics:
     <ul>
@@ -584,7 +589,7 @@ There are too much translators to list them all. Please check http://translate.c
 <h1>Our special thanks also go to</h1>
 (in no particular order - bug reporters are only listed when having contributed 4 reports or more)
 
-Note that we are infinitely grateful to our translators, having made the spread of Chamilo to other cultures possible. Sadly, we aren't quite as organized as we would like, and we haven't been able to sort the real translators out from people having just registered on our translation portal. This is on our TO DO list, so please be just a little more patient. We know we can count on you! Thank you. Your efforts mean a lot to us! 
+Note that we are infinitely grateful to our translators, having made the spread of Chamilo to other cultures possible. Sadly, we aren't quite as organized as we would like, and we haven't been able to sort the real translators out from people having just registered on our translation portal. This is on our TO DO list, so please be just a little more patient. We know we can count on you! Thank you. Your efforts mean a lot to us!
 <ul>
   <li> Hubert Borderiou for various bugfixes</li>
   <li> Philippe Béranger</li>
@@ -691,7 +696,7 @@ Note that we are infinitely grateful to our translators, having made the spread
   <li>Guillaume Fosset, Aix-Marseilles Academy, for issues reporting and improvement suggestions in 1.9.*</li>
   <li>Laurent Goossens, for Encora, Antwerp, for issues reporting and improvement suggestions in 1.9.* (most notably on the assignments tool)</li>
   <li>Diego Escalante, Peru, for issues reporting and fixes in 1.9.*</li>
-  <li>All the supporting parents, partners, children, friends, colleagues and sometimes students, of the very special geeks that we are, for their continous support and inspiration</li> 
+  <li>All the supporting parents, partners, children, friends, colleagues and sometimes students, of the very special geeks that we are, for their continous support and inspiration</li>
 </ul>
 
 <a name="organisations"></a>

+ 13 - 13
documentation/dependencies.html

@@ -20,11 +20,11 @@
             <ul class="nav">
                 <li><a href="index.html">Home</a></li>
                 <li ><a href="readme.html">About</a></li>
-                <li ><a href="license.html">License</a></li>            
-                <li><a href="credits.html">Credits</a></li>            
-                <li class="active"><a href="dependencies.html">Dependencies</a></li>            
+                <li ><a href="license.html">License</a></li>
+                <li><a href="credits.html">Credits</a></li>
+                <li class="active"><a href="dependencies.html">Dependencies</a></li>
                 <li><a href="changelog.html">Changelog</a></li>
-            </ul>        
+            </ul>
             </div><!--/.nav-collapse -->
         </div>
     </div>
@@ -34,24 +34,24 @@
     <li>
         <a href="index.html">Documentation</a>
         <span class="divider">/</span>
-    </li>    
+    </li>
     <li>Dependencies</li>
 </ul>
 <h1>Chamilo - Server Dependencies</h1>
 
 <h2>Introduction</h2>
-<p>In the ever-evoluting web environment, Chamilo has to rely on 
-state-of-the-art third-party software in order to provide you with useful and 
+<p>In the ever-evoluting web environment, Chamilo has to rely on
+state-of-the-art third-party software in order to provide you with useful and
 practical features. Some of this third-party software usually come bundled with
 your operating system, but some don't. This means that if that software is
-not installed on your Chamilo server, along with Chamilo, you might not enjoy 
+not installed on your Chamilo server, along with Chamilo, you might not enjoy
 the best possible experience with your Chamilo platform. To avoid this problem,
 most of the sofware we used is bundled into a typical Chamilo installation.</p>
 <p>
-However, if such a third-party software is too big to be included, or if it 
-doesn't make sense to include it for whatever reason, you must make sure it is 
-installed on your system. This is the goal of this list: to help you keep a 
-track of what software is needed and, as much as possible, where to get the 
+However, if such a third-party software is too big to be included, or if it
+doesn't make sense to include it for whatever reason, you must make sure it is
+installed on your system. This is the goal of this list: to help you keep a
+track of what software is needed and, as much as possible, where to get the
 required information to install it.</p>
 
 <a name="dependencies"></a>
@@ -69,7 +69,7 @@ We recommend using HTML5-compatible technology.
 <h2>Dependencies - server-side</h2>
 <ul>
   <li>Apache 2+</li>
-  <li> PHP 5.3 or higher with MySQL bindings (mysqlnd is recommended) and php-gd extension to allow Chamilo to resize pictures. The 
+  <li> PHP 5.4 or higher with MySQL bindings (mysqlnd is recommended) and php-gd extension to allow Chamilo to resize pictures. The
   <li>MySQL 5.1+ or any version of MariaDB database server</li>
   new components we have included from the Symfony framework highly depend on namespaces, a feature that appeared in PHP 5.3.0</li>
   <li>php5-intl package (for international behaviour support)</li>

+ 1 - 1
documentation/index.html

@@ -33,7 +33,7 @@
 <div class="container">
     <div class="row">
         <div class="hero-unit">
-            <h1>Chamilo 1.9 - Documentation</h1>
+            <h1>Chamilo 1.10 - Documentation</h1>
             <br />
 
             <a class="btn btn-primary btn-large" href="installation_guide.html">English installation guide</a>

+ 46 - 38
documentation/installation_guide.html

@@ -77,9 +77,12 @@ optimal flexibility, remote control and scalability. <br />
 
 <br />
 
-Chamilo is mainly a LMS running <span style="font-weight: bold;">Apache (2.2 recommended)</span>, <span style="font-weight: bold;">MySQL 5.1 or 5.5 (or MariaDB)</span> and <span style="font-weight: bold;">PHP 5.3, 5.4 or 5.5 (5.5 recommended for greater efficiency)</span> (the so called <span style="font-weight: bold;">AMP</span> trilogy). <br />
-
-
+Chamilo is mainly a LMS running (the so called <span style="font-weight: bold;">AMP</span> trilogy): <br />
+<ul>
+<li><span style="font-weight: bold;">Apache (2.2 recommended)</span></li>
+<li><span style="font-weight: bold;">MySQL 5.1 or 5.5 (or MariaDB)</span></li>
+<li><span style="font-weight: bold;">PHP 5.4, 5.5 or 5.6 (5.6 recommended for greater efficiency)</span></li>
+</ul>
 <br />
 
 All these pieces of software are free software and freely available. <br />
@@ -144,10 +147,13 @@ The following directories need to be readable, writeable and executable by your
 <ul>
   <li>[chamilo]/main/inc/conf/</li>
   <li>[chamilo]/main/upload/users/</li>
+  <li>[chamilo]/main/upload/sessions/</li>
+  <li>[chamilo]/main/upload/courses/</li>
   <li>[chamilo]/main/default_course_document/images/</li>
   <li>[chamilo]/archive/</li>
   <li>[chamilo]/courses/</li>
   <li>[chamilo]/home/</li>
+  <li>[chamilo]/data/</li>
 </ul>
 Optionally, you can do the same to the following directories if you want to
 enable CSS styles package upload and sub-language definition:
@@ -155,8 +161,7 @@ enable CSS styles package upload and sub-language definition:
   <li>[chamilo]/main/css/</li>
   <li>[chamilo]/main/lang/</li>
 </ul>
-Starting from Chamilo 1.8.8, you can also enable full-text indexing features which
-require the php5-xapian PHP's extension module to be installed. If you do use
+Starting from Chamilo 1.8.8, you can also enable full-text indexing features which require the php5-xapian PHP's extension module to be installed. If you do use
 it, you will need to allow your system to write into the sarchdb directory:
 <ul>
   <li>[chamilo]/searchdb</li>
@@ -282,7 +287,7 @@ Past Chamilo versions required register_globals to be set to On. This is
 no longer necessary, this can (and should) be set to Off.
 <span class="muted">It is considered a bad choice in terms of security to set register_globals to On.</a></p>
 
-<p><strong>Note:</strong> if you are using PHP 5.3 or higher, you need to set
+<p><strong>Note:</strong> You need to set
 your <em>date.timezone</em> setting to whatever your server's timezone is.
 For example, if your server is in the 'America/New_York' timezone, set this
 in your php.ini:</p>
@@ -326,50 +331,50 @@ previous version of Chamilo LMS (1.*) or Dok€os (&lt;2.0)</h2>
 Before upgrading, we <b>heavily</b> recommend you do a full backup of the previous
 Chamilo or Dok€os directories and databases. If you are unsure how to achieve this
 please ask your hosting provider for advice.<br />
-<em>Chamilo LMS 1.9 comes with a new database structure in comparison to 1.8. 
+<em>Chamilo LMS 1.10 comes with a new database structure in comparison to 1.9, and so between 1.9 and 1.8.
 Although the upgrade script takes the migration in charge, it might be generating
-a very heavy load on your server during the upgrade, and will change your 
-database completely, preserving the data as well as possible (we have tested 
-the procedure many times, but remember this is GNU/GPLv3 and we cannot be held 
+a very heavy load on your server during the upgrade, and will change your
+database completely, preserving the data as well as possible (we have tested
+the procedure many times, but remember this is GNU/GPLv3 and we cannot be held
 responsible for what would happen to your data without professional supervision).
-This is why we *really* recommend you take a full backup of your system before 
+This is why we *really* recommend you take a full backup of your system before
 you upgrade.</em>
 <br />
-<div class="muted"> NOTE: For very heavy Chamilo databases, some of our official 
+<div class="muted"> NOTE: For very heavy Chamilo databases, some of our official
 providers have developed improved migration procedures that use more memory but
 process the upgrades up to 20 times faster. If this is the kind of thing you
 need, we highly recommend you contact them (see reference below).</div>
-<div class="muted"> NOTE: This version of Chamilo can only be used to upgrade from
-smaller versions of Chamilo or Dok€os. For example, you cannot use the normal
-upgrade scripts from Chamilo 1.9 to upgrade from Dok€os 2.0. If you need this,
-please contact one of the Chamilo Association's official providers &lt;providers@chamilo.org&gt;)</div>
+<div class="muted"> NOTE: This version of Chamilo can only be used to upgrade from earlier versions of Chamilo or Dok€os. For example, you cannot use the normal
+upgrade scripts from Chamilo 1.9 to upgrade from Dok€os 2.0 (which was born after the split with Chamilo). If you need this, please contact one of the Chamilo Association's <a href="https://chamilo.org/providers">official providers</a>)</div>
 
 <p></p>
 
-<h3>3.1 Upgrading from Chamilo 1.9.x (minor upgrade)</h3>
-As this is only a minor version change from previous 1.9.* versions of Chamilo, the only thing you need to do is:
+<h3>3.1 Upgrading from Chamilo 1.10.x (minor upgrade)</h3>
+As this is only a minor version change from previous 1.10.* versions of Chamilo, the only thing you need to do is:
 <ul>
   <li> check that you haven't left any customised stylesheet or image <span class="muted">(if you have, make sure you keep a copy on the side*)</span></li>
-  <li> download the Chamilo 1.9 install package from the <a href="http://www.chamilo.org/download">Chamilo download page</a></li>
-  <li> unzip the new files of Chamilo 1.9 over the files of the older version
+  <li> download the Chamilo 1.10 install package from the <a href="http://www.chamilo.org/download">Chamilo download page</a></li>
+  <li> unzip the new files of Chamilo 1.10 over the files of the older version
     (or unzip the files in one folder and then copy the files from there to the
     older version's directory). Note that you should remove the "home" and
     "searchdb" directories from the package before you overwrite the previous
     files.</li>
-  <li> edit the main/inc/conf/configuration.php file: at the en of the file, locate the previous version number (e.g. '1.9.4') and change it to this new version (e.g. '1.9.8')</li>
+  <li> edit the main/inc/conf/configuration.php file: at the en of the file, locate the previous version number (e.g. '1.10.4') and change it to this new version (e.g. '1.10.8')</li>
+  <li> clean your archive/ directory: take a temporary copy of index.html, delete all the contents *in* this directory (do NOT remove the directory itself, only its contents!). It will all be re-generated. You can also delete the contents of this directory through the "Archive directory cleanup" option in the "System" box of the Administration page.</li>
   <li> you're done! No other upgrade procedure is required</li>
 </ul>
 
 <br />
 
 
-<h3>3.2 Upgrading from Chamilo 1.8.x</h3>
+<h3>3.2 Upgrading from Chamilo 1.8.x or 1.9.x</h3>
 <ul>
   <li> check that you haven't left any customised stylesheet or image <span class="muted">(if you have, make sure you keep a copy on the side*)</span></li>
-  <li> download the Chamilo 1.9 install package from the <a href="http://www.chamilo.org/download">Chamilo download page</a></li>
-  <li> unzip the new files of Chamilo 1.9 over the files of the older version (or unzip the files in one folder and then copy the files from there to the older version's directory)</li>
+  <li> download the Chamilo 1.10 install package from the <a href="http://www.chamilo.org/download">Chamilo download page</a></li>
+  <li> unzip the new files of Chamilo 1.10 over the files of the older version (or unzip the files in one folder and then copy the files from there to the older version's directory)</li>
   <li> point your browser on your portal URL + main/install/</li>
-  <li> choose your language and click&nbsp;<span style="font-style: italic;">Upgrade from 1.8.x</span></li>
+  <li> choose your language and click&nbsp;<span style="font-style: italic;">Upgrade from 1.8.x/1.9.x</span></li>
+  <li> clean your archive/ directory: take a temporary copy of index.html, delete all the contents *in* this directory (do NOT remove the directory itself, only its contents!). It will all be re-generated. You can also delete the contents of this directory through the "Archive directory cleanup" option in the "System" box of the Administration page.</li>
 </ul>
 
 <br />
@@ -379,10 +384,11 @@ As this is only a minor version change from previous 1.9.* versions of Chamilo,
 <em>If you upgrade from Dok€os 1.8.x</em> :&nbsp;
 <ul>
   <li> check that you haven't left any customised stylesheet or image <span class="muted">(if you have, make sure you keep a copy on the side*)</span></li>
-  <li> download the Chamilo 1.9 install package from the <a href="http://www.chamilo.org/download">Chamilo download page</a></li>
-  <li> unzip the new files of Chamilo 1.9 over the files of the older version (or unzip the files in one folder and then copy the files from there to the older version's directory)</li>
+  <li> download the Chamilo 1.10 install package from the <a href="http://www.chamilo.org/download">Chamilo download page</a></li>
+  <li> unzip the new files of Chamilo 1.10 over the files of the older version (or unzip the files in one folder and then copy the files from there to the older version's directory)</li>
   <li> point your browser on your portal URL + main/install/</li>
-  <li> choose your language and click&nbsp;<span style="font-style: italic;">Upgrade from 1.8.x</span></li>
+  <li> choose your language and click&nbsp;<span style="font-style: italic;">Upgrade from 1.8.x/1.9.x</span></li>
+  <li> clean your archive/ directory: take a temporary copy of index.html, delete all the contents *in* this directory (do NOT remove the directory itself, only its contents!). It will all be re-generated. You can also delete the contents of this directory through the "Archive directory cleanup" option in the "System" box of the Administration page.</li>
 </ul>
 A bunch of Chamilo administrators have reported minor issues with the migration between versions considerably apart (like from Dok€os to Chamilo).
 This might include loosing some assignments or forum posts. To avoid any ugly effect on your users, we recommend you first establish a checklist
@@ -425,14 +431,15 @@ The complete process is as follow:
     <em>old_version</em> and make it writeable by the web server. This
 is important to allow the move of the courses/ and upload/ directories
 to the new install</li>
-  <li> download the Chamilo 1.9 install package from the
+  <li> download the Chamilo 1.10 install package from the
     <a href="http://www.chamilo.org/download">Chamilo download page</a></li>
-  <li> unzip the new files of Chamilo 1.9 in the main Chamilo/Dok€os directory. The
+  <li> unzip the new files of Chamilo 1.10 in the main Chamilo/Dok€os directory. The
 new directory <em>main</em> should be located directly inside your
 Chamilo/Dok€os root folder</li>
   <li> point your browser on your portal URL</li>
   <li> choose your language and click&nbsp;<span style="font-style: italic;">Upgrade from 1.6.x</span> and confirm the
 current directory of the old version</li>
+  <li> clean your archive/ directory: take a temporary copy of index.html, delete all the contents *in* this directory (do NOT remove the directory itself, only its contents!). It will all be re-generated. You can also delete the contents of this directory through the "Archive directory cleanup" option in the "System" box of the Administration page.</li>
 </ul>
 
 <br />
@@ -477,7 +484,7 @@ On Linux, Mac OS X and BSD operating systems you can quick-fix this using the
 your own OS on <a href="http://www.chamilo.org/forum">our forum</a>.
 In Windows, you may need to check the properties of the folders.
 <p></p>
-<h3>3.6 Quick-upgrade from 1.8.x guide for Linux</h3>
+<h3>3.6 Quick-upgrade from 1.9.x guide for Linux</h3>
 
 
 The following quick-upgrade guide assumes that:
@@ -498,11 +505,11 @@ On the command-line, type:
   <li>mkdir /var/www/chamilo/old_version</li>
   <li>mv /var/www/chamilo/* /var/www/chamilo/old_version/</li>
   <li>chmod -R 0777 /var/www/chamilo/old_version/</li>
-  <li>wget http://chamilo.googlecode.com/files/chamilo-1.9.10.tar.gz</li>
-  <li>tar zxvf chamilo-1.9.10.tar.gz</li>
-  <li>sudo cp -ra chamilo-1.9.10/* /var/www/chamilo/</li>
-  <li>rm chamilo-1.9.10.tar.gz</li>
-  <li>sudo rm -r chamilo-1.9.10/</li>
+  <li>wget https://github.com/chamilo/chamilo-lms/archive/v1.9.10.tar.gz</li>
+  <li>tar zxvf chamilo-lms-1.9.10.tar.gz</li>
+  <li>sudo cp -ra chamilo-lms-1.9.10/* /var/www/chamilo/</li>
+  <li>rm chamilo-lms-1.9.10.tar.gz</li>
+  <li>sudo rm -r chamilo-lms-1.9.10/</li>
 </ul>
 
 <br />
@@ -793,8 +800,9 @@ Then go to your administration page -&gt; Configuration settings -&gt; Search
 and enable the search tool. Follow the recommendations on the page to get the
 complete indexing suite installed. Once you're done, all documents you import
 into your Chamilo portal in a recognized format will be indexed and searchable.
-Chamilo Administrators training (which you can ask any <a href="http://www.chamilo.org/en/providers">Chamilo's Official
-Provider</a> for) include a full review of the full-text search feature.
+Chamilo intermediate Administrators training (which you can ask any <a href="http://www.chamilo.org/en/providers">Chamilo's Official Provider</a> for) include a full review of the full-text search feature.</p>
+<p class="muted">
+Note: Xapian's licensing for the PHP extension is a bit different than what is necessary to enter the Debian repositories, so it has been excluded. You can, however, generate your own package by following the <a href="http://trac.xapian.org/wiki/FAQ/PHP%20Bindings%20Package">packaging instructions on Xapian's wiki</a>.
 </p>
 
 <hr style="width: 100%; height: 2px;" />

+ 5 - 2
documentation/installation_guide_es_ES.html

@@ -83,7 +83,7 @@
 Chamilo puede ser instalado indiferentemente en servidores Windows, Linux, Mac OS X y UNIX. Sin embargo, nosotros recomendamos el uso de un servidor Linux para una óptima flexibilidad, control remoto y escalabilidad.
 </p>
 <p>
-Chamilo es fundamentalmente un LMS que se ejecuta con Apache (1.3, 2.0 o 2.2), MySQL 5.1 (o MariaDB) y PHP 5.3 (o 5.4) (trilogía también llamada AMP).
+Chamilo es fundamentalmente un LMS que se ejecuta con Apache (1.3, 2.0 o 2.2), MySQL 5.1 (o MariaDB) y PHP 5.4 (trilogía también llamada AMP).
 </p>
 <p>
 Todo este software es software de código abierto y está disponible libremente.
@@ -132,10 +132,13 @@ Remplace [chamilo] por el directorio en el cual está ubicado su Chamilo:
 <ul>
   <li>[chamilo]/main/inc/conf/</li>
   <li>[chamilo]/main/upload/users/</li>
+  <li>[chamilo]/main/upload/sessions/</li>
+  <li>[chamilo]/main/upload/courses/</li>
   <li>[chamilo]/main/default_course_document/images/</li>
   <li>[chamilo]/archive/</li>
   <li>[chamilo]/courses/</li>
   <li>[chamilo]/home/</li>
+  <li>[chamilo]/data/</li>
 </ul>
 Opcionalmente, puede hacer lo mismo a los directorios siguientes si desea
 activar la subida de paquetes de estilos CSS y la definición de sub-idiomas:
@@ -240,7 +243,7 @@ En versiones de Chamilo/Dok€os anteriores se requería que register_globals es
 necesario, puede (y debería) estar configurado en Off y Chamilo funcionará bien.<span>Se considera una mala elección en términos de seguridad configurar register_globals a On.</span>
 </p>
 
-<p><strong>Nota:</strong> si se usa PHP 5.3 o superior, se necesita configurar la variable <em>date.timezone</em> a la zona horaria de su servidor.
+<p><strong>Nota:</strong> Se necesita configurar la variable <em>date.timezone</em> a la zona horaria de su servidor.
 Por ejemplo, si su servidor está en la zona horaria 'America/Lima', modificar en el php.ini:</p>
 
 <div class="code">

+ 5 - 2
documentation/installation_guide_fr_FR.html

@@ -81,7 +81,7 @@ distribution Debian (ou sa petite soeur Ubuntu)<br />
 Chamilo est un système de gestion de l'apprentissage (LMS) qui fonctionne
 principallement sur base d'un <span style="font-weight: bold;">serveur web (Apache 2.2
 recommandé)</span>, de <span style="font-weight: bold;">MySQL (5.1 ou 5.5) ou de MariaDB
-(5 ou 10)</span> et de <span style="font-weight: bold;">PHP 5.3, 5.4 ou 5.5 (5.5 recommandé
+(5 ou 10)</span> et de <span style="font-weight: bold;">PHP 5.4, 5.5 ou 5.6 (5.6 recommandé
 pour une plus grande efficacité)</span> (la trilogie aussi appelée
 <span style="font-weight: bold;">AMP</span>). <br />
 
@@ -176,10 +176,13 @@ Remplacez [chamilo] par le répertoire où vous avez placé le contenu du zip:
 <ul>
   <li>[chamilo]/main/inc/conf/</li>
   <li>[chamilo]/main/upload/users/</li>
+  <li>[chamilo]/main/upload/sessions/</li>
+  <li>[chamilo]/main/upload/courses/</li>
   <li>[chamilo]/main/default_course_document/images/</li>
   <li>[chamilo]/archive/</li>
   <li>[chamilo]/courses/</li>
   <li>[chamilo]/home/</li>
+  <li>[chamilo]/data/</li>
 </ul>
 Optionnellement, vous pouvez faire la même chose pour les répertoires suivants
 si vous souhaitez permettre l'envoi de styles CSS ou la définition de nouvelles
@@ -325,7 +328,7 @@ devrait désormais être configuré à Off (bien que les dernières versions de
 ne proposent même plus ce paramètre de configuration et le mettent d'office à Off).
 <span class="muted">L'activation du register_globals est désormais largement considérée comme un mauvais choix au niveau sécurité.</span></p>
 
-<p><strong>Note:</strong> si vous utilisez PHP 5.3 ou supérieur, vous
+<p><strong>Note:</strong> Vous
 <em>devez</em> configurer le paramètre <em>date.timezone</em> à la zone horaire
 de votre serveur. Par exemple, si votre serveur est dans la zone horaire
 'America/New_York', configurez-le de la manière suivante dans votre php.ini:</p>

+ 5 - 2
documentation/installation_guide_it_IT.html

@@ -72,7 +72,7 @@
 <p class="p8"><span class="s1"></span><br></p>
 <p class="p2"><span class="s1"><b>Chamilo</b> può essere installato indifferentemente su server Windows, Linux, Mac OS X e Unix. Tuttavia raccomandiamo l’utilizzo di server Linux per sfruttarne al meglio le caratteristiche di flessibilità, controllo remoto e scalabilità.</span></p>
 <p class="p3"><span class="s1"></span><br></p>
-<p class="p2"><span class="s1"><b>Chamilo</b> è principalmente un <b>LMS (Learning Management System)</b> che gira sulla piattaforma composta da <b>Apache (1.3,2.0 or 2.2)</b>, <b>MySQL 5.1 (o MariaDB</b>) e <b>PHP 5.3 (o 5.4)</b>, meglio nota come piattaforma <b>AMP</b>.</span></p>
+<p class="p2"><span class="s1"><b>Chamilo</b> è principalmente un <b>LMS (Learning Management System)</b> che gira sulla piattaforma composta da <b>Apache (1.3,2.0 or 2.2)</b>, <b>MySQL 5.1 (o MariaDB</b>) e <b>PHP 5.4, 5.5 o 5.6</b>, meglio nota come piattaforma <b>AMP</b>.</span></p>
 <p class="p3"><span class="s1"></span><br></p>
 <p class="p2"><span class="s1">Tutti questi software sono gratuiti e liberamente scaricabili.</span></p>
 <p class="p3"><span class="s1"></span><br></p>
@@ -108,10 +108,13 @@
 <ul>
   <li class="li2"><span class="s1">[chamilo]/main/inc/conf/</span></li>
   <li class="li2"><span class="s1">[chamilo]/main/upload/users/</span></li>
+  <li clasS="li2">[chamilo]/main/upload/sessions/</li>
+  <li class="li2">[chamilo]/main/upload/courses/</li>
   <li class="li2"><span class="s1">[chamilo]/main/default_course_document/images/</span></li>
   <li class="li2"><span class="s1">[chamilo]/archive/</span></li>
   <li class="li2"><span class="s1">[chamilo]/courses/</span></li>
   <li class="li2"><span class="s1">[chamilo]/home/</span></li>
+  <li class="li2"><span class="s1">[chamilo]/data/</span></li>
 </ul>
 <p class="p3"><span class="s1"></span><br></p>
 <p class="p2"><span class="s1">Opzionalmente puoi fare lo stesso alle seguenti cartelle se vuoi consentire il caricamento dei pacchetti di stile CSS (CSS styles package) e la definizione di sotto-linguaggi (sub-language definition):</span></p>
@@ -175,7 +178,7 @@
 </ul>
 <p class="p3"><span class="s1"></span><br></p>
 <p class="p1"><span class="s1">Le versioni precedenti di Chamilo richiedevano che la variabile register_globals fosse impostata come “On”. Questo non è più necessario nelle versioni attuali e future di Chamilo, per cui può essere e dovrebbe essere impostata sempre su “Off”. E’ considerata una scelta scorretta impostare register_globals su “On” in termini di sicurezza.</span></p>
-<p class="p1"><span class="s1"><b>Nota:</b> se stai utilizzando PHP 5.3 o superiori, devi impostare il tuo valore di <i>date.timezone</i> rispetto alla timezone del tuo server. Per esempio se il tuo server si trova nella timezone 'America/New_York', imposta il parametro date.timezone in php.ini come segue:</span></p>
+<p class="p1"><span class="s1"><b>Nota:</b> Devi impostare il tuo valore di <i>date.timezone</i> rispetto alla timezone del tuo server. Per esempio se il tuo server si trova nella timezone 'America/New_York', imposta il parametro date.timezone in php.ini come segue:</span></p>
 <p class="p2"><span class="s1">date.timezone = 'America/New_York'</span></p>
 <p class="p3"><span class="s1"></span><br></p>
 <p class="p3"><span class="s1"></span><br></p>

+ 28 - 4
documentation/optimization.html

@@ -51,6 +51,7 @@
   <li><a href="#9.xsendfile">Speeding file downloads with mod_xsendfile</a></li>
   <li><a href="#10.igbinary">IGBinary for faster courses backups and better sessions</a></li>
   <li><a href="#11.permissions-check">Removing files download permissions check</a></li>
+  <li><a href="#12.MySQL-compression">MySQL/MariaDB compression</a></li>
 </ol>
 
 <h2><a name="1.Using-XCache"></a>1. Using xCache or APC</h2>
@@ -355,12 +356,14 @@ Don't have time or resources to optimize your Chamilo installation yourself? Hir
 		<img src="http://jigsaw.w3.org/css-validator/images/vcss-blue" style="margin: 1em; float: right;" alt="Valid CSS" />
 	</a>
 <hr />
+
 <h2><a name="7.High-numbers-memory"></a>Memory considerations for high numbers of users</h2>
 Some administration scripts *have to* handle lists of all users, and this might have a considerable impact on portals with very high numbers of users. For example, the main/admin/add_users_to_session.php script that handles the registration of users into a specific session, if used with the (non-default) full list of users, will devour about 3KB per user, which, for 100,000 users, translates into the need for around 300MB of RAM just to show this page, and to around 3GB for 1,000,000 users.<br />
 This mode is not loaded by default, but could still be selected, leading to a "Fatal error: Allowed memory size ... exhausted" message.<br />
 The only non-scripted solution here is to allow for the corresponding amount of RAM for your PHP configuration (<em>memory_limit = 300M</em>) or your specific VirtualHost if you use mod-php5 (<em>php_value memory_limit 300M</em>).<br/>
 <hr />
-<h2><a name="#8.Avoid-non-fixed-values"></a>Avoiding non-fixed values</h2>
+
+<h2><a name="8.Avoid-non-fixed-values"></a>Avoiding non-fixed values</h2>
 Many things in Chamilo are written focusing on the ease of use, even for the administrator. Sometimes, these settings are weighing a little bit more on the system. This is the case, between others, of the mail.conf.php file (being loaded unconditionally) and its CONSTANT "IS_WINDOWS_OS", which is defined by a function call (api_is_windows_os()) at the beginning of main_api.lib.php.
 
 The definition of this constant (which is executed at *every* page load) can easily be avoided, and the only place where it is used inconditionally (mail.conf.php) can be modified to set the line as you expect it (depending on whether you use sendmail/exim or smtp).
@@ -372,8 +375,11 @@ or
 $platform_email['SMTP_MAILER']       = 'mail';
 </pre>
 In fact, the complete loading of mail.conf.php can also be avoided if loaded conditionally (with <i>require_once</i>) when sending an e-mail (which is the only case where it is useful).
+<p>
+As an additional node, on very active portals with a lot of courses for each users, the icons that appear next to the courses illustrating changes in the corresponding course might be heavyweighted. You can alter slightly the behaviour by not querying for notifications you don't care about, like dropbox, notebook or chat. Change this in main/inc/lib/display.lib.php, in function show_notification().
+</p>
 <hr />
-<h2><a name="#9.xsendfile"></a>Speeding file downloads with mod_xsendfile</h2>
+<h2><a name="9.xsendfile"></a>Speeding file downloads with mod_xsendfile</h2>
 <p>It might have come to your attention that file downloads through Chamilo might get slow, under default conditions, in particular using Apache 2.</p>
 <p>There are several ways to fix this, one of which is removing the .htaccess inside the courses/ directory. This, however, will remove all permissions checks on the files contained in this directory, so... most of the time, not ideal unless your portal is *really* open to the world.</p>
 <p>Another technique, revealed to us by <a href="http://stackoverflow.com/users/46594/virtualblackfox">VirtualBlackFox</a> on <a href="http://stackoverflow.com/questions/3697748/fastest-way-to-serve-a-file-using-php">this Stackoverflow post</a>, is to use the X-SendFile module for Apache 2.2+ (other web servers might offer other solutions, or avoid the problem initially).</p>
@@ -398,11 +404,13 @@ $_configuration['enable_x_sendfile_headers'] = true;
 </pre>
 Done! Now your downloads should go substantially faster. This is still a feature in observation. We're not sure the benefits are sufficient, so don't hesitate to let us know in <a href="https://support.chamilo.org/issues/6853">the related issue in Chamilo's tracking system</a>
 </p>
-<h2><a name="#10.igbinary"></a>IGBinary for courses backups and better sessions management</h2>
+<hr />
+<h2><a name="10.igbinary"></a>IGBinary for courses backups and better sessions management</h2>
 <p>
 <a href="http://pecl.php.net/package/igbinary">IGBinary</a> is a small PECL library that replaces the PHP serializer. It uses less space (so less memory for serialized objects) and is particularly efficient with memory-based storages (like Memcached). Use it for course backups (see <a href="https://support.chamilo.org/issues/4443">issue 4443</a>) or <a href="http://www.neanderthal-technology.com/2011/11/ubuntu-10-install-php-memcached-with-igbinary-support/">to boost sessions management</a>.
 </p>
-<h2><a name="#11.permissions-check"></a>Removing files download permissions check</h2>
+<hr />
+<h2><a name="11.permissions-check"></a>Removing files download permissions check</h2>
 <p>
 This measure is not cumulative with mod_xsendfile explained above. It is not *recommended* either, as it removes an important security layer.<br />
 <br />
@@ -435,13 +443,29 @@ RewriteRule ([^/]+)/work/(.*)$ /main/work/download.php?file=work/$2&cDir=$1 [QSA
 </pre><br />
 This is easy, doesn't require a server reload and you should see the results pretty quickly. As mentioned above, if security of your content is an issue, though, you should avoid using this technique.
 </p>
+<hr />
+<h2><a name="12.MySQL-compression"></a>MySQL/MariaDB compression</h2>
 <p>
+If your database server is separate from your web server, you have to play with bandwidth, firewalls, and network restrictions in general.<br />
+In particular, when dealing with large-scale portals, the time a SQL query will take to return to the web server will take longer and, eventually, in the most critical cases, will take <b>too long</b>, and your web servers will be completely overloaded (load average very high because the system is waiting for I/O operations, but processors usage not being very high is a clear sign of this).<br />
+To solve this kind of issues, MySQL and MariaDB offer a data compression mechanism, which will reduce the amount of data passed between PHP and the database server. Ultimately, this reduction will lower bandwidth usage and reduce the impact of numerous and heavy data requests (and save you).<br />
+In 1.10.0, we have added the possibility to enable this compression very easily, from the configuration.php file, uncommenting the following line:
+<pre>
+//$_configuration['db_client_flags'] = MYSQL_CLIENT_COMPRESS;
+</pre>
+This should have an immediate effect on the load average on your server.
 </p>
 <hr />
 <h2>Authors</h2>
 <ul>
 <li>Yannick Warnier, Zend Certified PHP Engineer, BeezNest Belgium SPRL, <a href="mailto:ywarnier@beeznest.net">ywarnier@beeznest.net</a></li>
 </ul>
+<hr />
+Don't have time or resources to optimize your Chamilo installation yourself? Hire an <a href="http://www.chamilo.org/en/providers">official Chamilo provider</a> and get it sorted out professionally by specialists.
+    <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Transitional" style="margin: 1em; float: right;" height="31" width="88" /></a>
+	<a href="http://jigsaw.w3.org/css-validator/">
+		<img src="http://jigsaw.w3.org/css-validator/images/vcss-blue" style="margin: 1em; float: right;" alt="Valid CSS" />
+	</a>
 </div>
 </body>
 </html>

+ 23 - 11
index.php

@@ -66,7 +66,7 @@ $_setting['display_courses_to_anonymous_users'] = 'true';
  */
 if (isset($_GET['submitAuth']) && $_GET['submitAuth'] == 1) {
     $i = api_get_anonymous_id();
-    event_system(LOG_ATTEMPTED_FORCED_LOGIN, 'tried_hacking_get', $_SERVER['REMOTE_ADDR'].(empty($_POST['login'])?'':'/'.$_POST['login']),null,$i);
+    Event::addEvent(LOG_ATTEMPTED_FORCED_LOGIN, 'tried_hacking_get', $_SERVER['REMOTE_ADDR'].(empty($_POST['login'])?'':'/'.$_POST['login']),null,$i);
     echo 'Attempted breakin - sysadmins notified.';
     session_destroy();
     die();
@@ -95,7 +95,7 @@ if (!api_get_user_id() && CustomPages::enabled()) {
 if (!empty($_POST['submitAuth'])) {
     // The user has been already authenticated, we are now to find the last login of the user.
     if (isset ($_user['user_id'])) {
-        $track_login_table      = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN);
+        $track_login_table      = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
         $sql_last_login = "SELECT UNIX_TIMESTAMP(login_date)
                                 FROM $track_login_table
                                 WHERE login_user_id = '".$_user['user_id']."'
@@ -110,7 +110,7 @@ if (!empty($_POST['submitAuth'])) {
         }
         Database::free_result($result_last_login);
 
-        //event_login();
+        //Event::event_login();
         if (api_is_platform_admin()) {
             // decode all open event informations and fill the track_c_* tables
             include api_get_path(LIBRARY_PATH).'stats.lib.inc.php';
@@ -118,10 +118,9 @@ if (!empty($_POST['submitAuth'])) {
         }
     }
     // End login -- if ($_POST['submitAuth'])
-}
-else {
+} else {
     // Only if login form was not sent because if the form is sent the user was already on the page.
-    event_open();
+    Event::event_open();
 }
 
 if (api_get_setting('display_categories_on_homepage') == 'true') {
@@ -142,8 +141,7 @@ if (!api_is_anonymous()) {
 
     if (api_is_platform_admin()) {
         $controller->tpl->assign('course_block', $controller->return_course_block());
-    }
-    else {
+    } else {
         $controller->tpl->assign('teacher_block', $controller->return_teacher_link());
     }
 }
@@ -151,6 +149,22 @@ if (!api_is_anonymous()) {
 $hot_courses = null;
 $announcements_block = null;
 
+
+// Display the Site Use Cookie Warning Validation
+$useCookieValidation = api_get_configuration_value('cookie_warning');
+if ($useCookieValidation) {
+    if (isset($_POST['acceptCookies'])) {
+        api_set_site_use_cookie_warning_cookie();
+    } else if (!api_site_use_cookie_warning_cookie_exist()) {
+        if (Template::isToolBarDisplayedForUser()) {
+            $controller->tpl->assign('toolBarDisplayed', true);
+        } else {
+            $controller->tpl->assign('toolBarDisplayed', false);
+        }
+        $controller->tpl->assign('displayCookieUsageWarning', true);
+    }
+}
+
 // When loading a chamilo page do not include the hot courses and news
 
 if (!isset($_REQUEST['include'])) {
@@ -163,9 +177,7 @@ if (!isset($_REQUEST['include'])) {
 $controller->tpl->assign('hot_courses', $hot_courses);
 $controller->tpl->assign('announcements_block', $announcements_block);
 $controller->tpl->assign('home_page_block', $controller->return_home_page());
-
 $controller->tpl->assign('navigation_course_links', $controller->return_navigation_links());
-
 $controller->tpl->assign('notice_block', $controller->return_notice());
 $controller->tpl->assign('main_navigation_block', $controller->return_navigation_links());
 $controller->tpl->assign('help_block', $controller->return_help());
@@ -183,7 +195,7 @@ if (isset($_GET['firstpage'])) {
     api_set_firstpage_parameter($_GET['firstpage']);
     // if we are already logged, go directly to course
     if (api_user_is_login()) {
-        echo "<script type='text/javascript'>self.location.href='index.php?firstpage=".$_GET['firstpage']."'</script>";
+        echo "<script type='text/javascript'>self.location.href='index.php?firstpage=".Security::remove_XSS($_GET['firstpage'])."'</script>";
     }
 } else {
     api_delete_firstpage_parameter();

+ 4 - 5
main/admin/access_url_add_courses_to_url.php

@@ -12,7 +12,6 @@
 $language_file = 'admin';
 $cidReset = true;
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
 
 $this_section=SECTION_PLATFORM_ADMIN;
 
@@ -29,10 +28,10 @@ $courses = array ();
 $url_list = array();
 $users = array();
 
-$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);
-$tbl_user 					= Database :: get_main_table(TABLE_MAIN_USER);
-$tbl_course					= Database :: get_main_table(TABLE_MAIN_COURSE);
+$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);
+$tbl_user = Database:: get_main_table(TABLE_MAIN_USER);
+$tbl_course = Database:: get_main_table(TABLE_MAIN_COURSE);
 
 /*	Header   */
 $tool_name = get_lang('AddCoursesToURL');

+ 0 - 2
main/admin/access_url_add_usergroup_to_url.php

@@ -12,8 +12,6 @@
 $language_file = 'admin';
 $cidReset = true;
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
-require_once api_get_path(LIBRARY_PATH).'usergroup.lib.php';
 $this_section = SECTION_PLATFORM_ADMIN;
 
 api_protect_global_admin_script();

+ 0 - 1
main/admin/access_url_add_users_to_url.php

@@ -14,7 +14,6 @@ $cidReset = true;
 require_once '../inc/global.inc.php';
 $this_section = SECTION_PLATFORM_ADMIN;
 
-require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
 api_protect_global_admin_script();
 if (!api_get_multiple_access_url()) {
 	header('Location: index.php');

+ 0 - 2
main/admin/access_url_check_user_session.php

@@ -11,8 +11,6 @@ $language_file = 'admin';
 $cidReset = true;
 require_once '../inc/global.inc.php';
 
-require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
-
 // setting the section (for the tabs)
 $this_section = SECTION_PLATFORM_ADMIN;
 

+ 0 - 1
main/admin/access_url_edit.php

@@ -8,7 +8,6 @@
 $language_file = 'admin';
 $cidReset = true;
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
 $this_section = SECTION_PLATFORM_ADMIN;
 
 api_protect_global_admin_script();

+ 0 - 3
main/admin/access_url_edit_course_category_to_url.php

@@ -12,9 +12,6 @@ $language_file = 'admin';
 $cidReset = true;
 
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
-require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
-require_once api_get_path(LIBRARY_PATH).'xajax/xajax.inc.php';
 
 $xajax = new xajax();
 $xajax->registerFunction(array('searchCourseCategoryAjax', 'UrlManager', 'searchCourseCategoryAjax'));

+ 187 - 203
main/admin/access_url_edit_courses_to_url.php

@@ -1,10 +1,9 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
-*	@package chamilo.admin
-*	@author Julio Montoya <gugli100@gmail.com>
-*/
-
+ *	@package chamilo.admin
+ *	@author Julio Montoya <gugli100@gmail.com>
+ */
 
 // name of the language file that needs to be included
 $language_file = 'admin';
@@ -13,11 +12,11 @@ $language_file = 'admin';
 $cidReset = true;
 
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
-require_once api_get_path(LIBRARY_PATH).'access_url_edit_courses_to_url_functions.lib.php';
 
 $xajax = new xajax();
-$xajax -> registerFunction (array('search_courses', 'Accessurleditcoursestourl', 'search_courses'));
+$xajax->registerFunction(
+	array('search_courses', 'Accessurleditcoursestourl', 'search_courses')
+);
 
 // setting the section (for the tabs)
 $this_section = SECTION_PLATFORM_ADMIN;
@@ -29,23 +28,22 @@ if (!api_get_multiple_access_url()) {
 	exit;
 }
 
-
 // Database Table Definitions
 $tbl_access_url_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
-$tbl_course 			 = Database :: get_main_table(TABLE_MAIN_COURSE);
-$tbl_access_url 		 = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
+$tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
+$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[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
 
 $add_type = 'multiple';
-if(isset($_REQUEST['add_type']) && $_REQUEST['add_type']!='') {
+if (isset($_REQUEST['add_type']) && $_REQUEST['add_type']!='') {
 	$add_type = Security::remove_XSS($_REQUEST['add_type']);
 }
 
-$access_url_id=1;
+$access_url_id = 1;
 if (isset($_REQUEST['access_url_id']) && $_REQUEST['access_url_id']!='') {
 	$access_url_id = Security::remove_XSS($_REQUEST['access_url_id']);
 }
@@ -99,8 +97,7 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
 	if ($form_sent == 1) {
 		if ($access_url_id==0) {
 			header('Location: access_url_edit_users_to_url.php?action=show_message&message='.get_lang('SelectURL'));
-		}
-		elseif(is_array($course_list) ) {
+		} elseif(is_array($course_list) ) {
 			UrlManager::update_urls_rel_course($course_list, $access_url_id);
 			header('Location: access_urls.php?action=show_message&message='.get_lang('CoursesWereEdited'));
 		}
@@ -148,7 +145,6 @@ 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.'">'.get_lang('SessionAddTypeUnique').'</a>';
 	$link_add_type_multiple = get_lang('SessionAddTypeMultiple');
@@ -156,207 +152,195 @@ if($add_type == 'multiple') {
 	$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 ?>
-</div>
-<br /><br />
-<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>
-	<?php
-	$url_selected='';
-	foreach ($url_list as $url_obj) {
-		$checked = '';
-		if (!empty($access_url_id)) {
-			if ($url_obj[0]==$access_url_id) {
-			$checked = 'selected=true';
-			$url_selected=$url_obj[1];
+	<div style="text-align: left;">
+		<?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();"';}?> >
+		<?php echo get_lang('SelectUrl').' : '; ?>
+		<select name="access_url_id" onchange="javascript:send();">
+			<option value="0">-- <?php echo get_lang('SelectUrl')?> -- </option>
+			<?php
+			$url_selected='';
+			foreach ($url_list as $url_obj) {
+				$checked = '';
+				if (!empty($access_url_id)) {
+					if ($url_obj[0]==$access_url_id) {
+						$checked = 'selected=true';
+						$url_selected=$url_obj[1];
+					}
+				}
+				if ($url_obj['active']==1) {
+					?>
+					<option <?php echo $checked;?> value="<?php echo $url_obj[0]; ?>"> <?php echo $url_obj[1]; ?></option>
+				<?php
+				}
 			}
-		}
-		if ($url_obj['active']==1) {
 			?>
-				<option <?php echo $checked;?> value="<?php echo $url_obj[0]; ?>"> <?php echo $url_obj[1]; ?></option>
-			<?php
-		}
-	}
-	?>
-</select>
-<br /><br />
-<input type="hidden" name="form_sent" value="1" />
-<input type="hidden" name="add_type" value = "<?php echo $add_type ?>" />
-
-<?php
-if(!empty($errorMsg)) {
-	Display::display_normal_message($errorMsg); //main API
-}
-
-?>
-
-<table border="0" cellpadding="5" cellspacing="0" width="100%">
-
-<!-- Users -->
-<tr>
-  <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>
-</tr>
-
-<tr>
-  <td align="center">
-  <div id="content_source">
-  	  <?php
-  	  if($ajax_search) {
-  	  	?>
-		<input type="text" id="course_to_add" onkeyup="xajax_search_courses(this.value,document.formulaire.access_url_id.options[document.formulaire.access_url_id.selectedIndex].value)" />
-		<div id="ajax_list_courses"></div>
-		<?php
-  	  } else {
-  	  ?>
-	  <select id="origin_users" name="no_course_list[]" multiple="multiple" size="15" style="width:380px;">
-		<?php
-		foreach($no_course_list as $no_course) {
-		?>
-			<option value="<?php echo $no_course['code']; ?>"><?php echo $no_course['title'].' ('.$no_course['code'].')'; ?></option>
+		</select>
+		<br /><br />
+		<input type="hidden" name="form_sent" value="1" />
+		<input type="hidden" name="add_type" value = "<?php echo $add_type ?>" />
 		<?php
+		if(!empty($errorMsg)) {
+			Display::display_normal_message($errorMsg); //main API
 		}
-		unset($no_course_list);
-		?>
-	  </select>
-	<?php
-  	  }
-  	 ?>
-  </div>
-  </td>
-  <td width="10%" valign="middle" align="center">
-  <?php
-  if($ajax_search) {
-	?>
-	<button class="arrowl" type="button" onclick="remove_item(document.getElementById('destination_users'))" ></button>
-  	<?php
-  } else {
-  	?>
-	<button class="arrowr" type="button" onclick="moveItem(document.getElementById('origin_users'), document.getElementById('destination_users'))" ></button>
-	<br /><br />
-	<button class="arrowl" type="button" onclick="moveItem(document.getElementById('destination_users'), document.getElementById('origin_users'))" ></button>
-	<?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($course_list as $course) {
-?>
-	<option value="<?php echo $course['course_code']; ?>"><?php echo $course['title'].' ('.$course['course_code'].')'; ?></option>
-<?php
-}
-unset($course_list);
-?>
-
-  </select></td>
-</tr>
-<tr>
-	<td colspan="3" align="center">
-		<br />
-		<?php
-		if(isset($_GET['add']))
-			echo '<button class="save" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>';
-		else
-			echo '<button class="save" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>';
 		?>
-	</td>
-</tr>
-</table>
-</form>
-
-<script type="text/javascript">
-<!--
-function moveItem(origin , destination) {
-	for(var i = 0 ; i<origin.options.length ; i++) {
-		if(origin.options[i].selected) {
-			destination.options[destination.length] = new Option(origin.options[i].text,origin.options[i].value);
-			origin.options[i]=null;
-			i = i-1;
+		<table border="0" cellpadding="5" cellspacing="0" width="100%">
+
+			<!-- Users -->
+			<tr>
+				<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>
+			</tr>
+
+			<tr>
+				<td align="center">
+					<div id="content_source">
+						<?php
+						if($ajax_search) {
+							?>
+							<input type="text" id="course_to_add" onkeyup="xajax_search_courses(this.value,document.formulaire.access_url_id.options[document.formulaire.access_url_id.selectedIndex].value)" />
+							<div id="ajax_list_courses"></div>
+						<?php
+						} else {
+							?>
+							<select id="origin_users" name="no_course_list[]" multiple="multiple" size="15" style="width:380px;">
+								<?php
+								foreach($no_course_list as $no_course) {
+									?>
+									<option value="<?php echo $no_course['code']; ?>"><?php echo $no_course['title'].' ('.$no_course['code'].')'; ?></option>
+								<?php
+								}
+								unset($no_course_list);
+								?>
+							</select>
+						<?php
+						}
+						?>
+					</div>
+				</td>
+				<td width="10%" valign="middle" align="center">
+					<?php
+					if($ajax_search) {
+						?>
+						<button class="arrowl" type="button" onclick="remove_item(document.getElementById('destination_users'))" ></button>
+					<?php
+					} else {
+						?>
+						<button class="arrowr" type="button" onclick="moveItem(document.getElementById('origin_users'), document.getElementById('destination_users'))" ></button>
+						<br /><br />
+						<button class="arrowl" type="button" onclick="moveItem(document.getElementById('destination_users'), document.getElementById('origin_users'))" ></button>
+					<?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($course_list as $course) {
+							?>
+							<option value="<?php echo $course['course_code']; ?>"><?php echo $course['title'].' ('.$course['course_code'].')'; ?></option>
+						<?php
+						}
+						unset($course_list);
+						?>
+
+					</select></td>
+			</tr>
+			<tr>
+				<td colspan="3" align="center">
+					<br />
+					<?php
+					if(isset($_GET['add']))
+						echo '<button class="save" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>';
+					else
+						echo '<button class="save" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>';
+					?>
+				</td>
+			</tr>
+		</table>
+	</form>
+
+	<script type="text/javascript">
+		function moveItem(origin , destination) {
+			for(var i = 0 ; i<origin.options.length ; i++) {
+				if(origin.options[i].selected) {
+					destination.options[destination.length] = new Option(origin.options[i].text,origin.options[i].value);
+					origin.options[i]=null;
+					i = i-1;
+				}
+			}
+			destination.selectedIndex = -1;
+			sortOptions(destination.options);
 		}
-	}
-	destination.selectedIndex = -1;
-	sortOptions(destination.options);
-}
-
-function sortOptions(options) {
-	newOptions = new Array();
-	for (i = 0 ; i<options.length ; i++)
-		newOptions[i] = options[i];
-
-	newOptions = newOptions.sort(mysort);
-	options.length = 0;
-	for(i = 0 ; i < newOptions.length ; i++)
-		options[i] = newOptions[i];
 
-}
+		function sortOptions(options) {
+			newOptions = new Array();
+			for (i = 0 ; i<options.length ; i++)
+				newOptions[i] = options[i];
 
-function mysort(a, b) {
-	if(a.text.toLowerCase() > b.text.toLowerCase()){
-		return 1;
-	}
-	if(a.text.toLowerCase() < b.text.toLowerCase()){
-		return -1;
-	}
-	return 0;
-}
-
-function valide(){
-	var options = document.getElementById('destination_users').options;
-	for (i = 0 ; i<options.length ; i++)
-		options[i].selected = true;
-	document.forms.formulaire.submit();
-}
-
-
-function loadUsersInSelect(select){
-
-	var xhr_object = null;
+			newOptions = newOptions.sort(mysort);
+			options.length = 0;
+			for(i = 0 ; i < newOptions.length ; i++)
+				options[i] = newOptions[i];
+		}
 
-	if(window.XMLHttpRequest) // Firefox
-		xhr_object = new XMLHttpRequest();
-	else if(window.ActiveXObject) // Internet Explorer
-		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
-	else  // XMLHttpRequest non supporté par le navigateur
-	alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
+		function mysort(a, b) {
+			if(a.text.toLowerCase() > b.text.toLowerCase()){
+				return 1;
+			}
+			if(a.text.toLowerCase() < b.text.toLowerCase()){
+				return -1;
+			}
+			return 0;
+		}
 
-	xhr_object.open("POST", "loadUsersInSelect.ajax.php");
-	xhr_object.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
-	nosessionUsers = makepost(document.getElementById('origin_users'));
-	sessionUsers = makepost(document.getElementById('destination_users'));
-	nosessionClasses = makepost(document.getElementById('origin_classes'));
-	sessionClasses = makepost(document.getElementById('destination_classes'));
-	xhr_object.send("nosessionusers="+nosessionUsers+"&sessionusers="+sessionUsers+"&nosessionclasses="+nosessionClasses+"&sessionclasses="+sessionClasses);
+		function valide(){
+			var options = document.getElementById('destination_users').options;
+			for (i = 0 ; i<options.length ; i++)
+				options[i].selected = true;
+			document.forms.formulaire.submit();
+		}
 
-	xhr_object.onreadystatechange = function() {
-		if(xhr_object.readyState == 4) {
-			document.getElementById('content_source').innerHTML = result = xhr_object.responseText;
-			//alert(xhr_object.responseText);
+		function loadUsersInSelect(select) {
+			var xhr_object = null;
+			if(window.XMLHttpRequest) // Firefox
+				xhr_object = new XMLHttpRequest();
+			else if(window.ActiveXObject) // Internet Explorer
+				xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
+			else  // XMLHttpRequest non supporté par le navigateur
+				alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
+
+			xhr_object.open("POST", "loadUsersInSelect.ajax.php");
+			xhr_object.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+			nosessionUsers = makepost(document.getElementById('origin_users'));
+			sessionUsers = makepost(document.getElementById('destination_users'));
+			nosessionClasses = makepost(document.getElementById('origin_classes'));
+			sessionClasses = makepost(document.getElementById('destination_classes'));
+			xhr_object.send("nosessionusers="+nosessionUsers+"&sessionusers="+sessionUsers+"&nosessionclasses="+nosessionClasses+"&sessionclasses="+sessionClasses);
+
+			xhr_object.onreadystatechange = function() {
+				if(xhr_object.readyState == 4) {
+					document.getElementById('content_source').innerHTML = result = xhr_object.responseText;
+					//alert(xhr_object.responseText);
+				}
+			}
 		}
-	}
-}
 
-function makepost(select){
-	var options = select.options;
-	var ret = "";
-	for (i = 0 ; i<options.length ; i++)
-		ret = ret + options[i].value +'::'+options[i].text+";;";
+		function makepost(select){
+			var options = select.options;
+			var ret = "";
+			for (i = 0 ; i<options.length ; i++)
+				ret = ret + options[i].value +'::'+options[i].text+";;";
 
-	return ret;
-}
-</script>
+			return ret;
+		}
+	</script>
 <?php
 Display::display_footer();

+ 1 - 4
main/admin/access_url_edit_usergroup_to_url.php

@@ -12,9 +12,6 @@ $language_file = 'admin';
 $cidReset = true;
 
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
-require_once api_get_path(LIBRARY_PATH).'usergroup.lib.php';
-require_once api_get_path(LIBRARY_PATH).'xajax/xajax.inc.php';
 
 $xajax = new xajax();
 $xajax->registerFunction(array('searchUserGroupAjax', 'UserGroup', 'searchUserGroupAjax'));
@@ -343,4 +340,4 @@ function makepost(select){
 }
 </script>
 <?php
-Display::display_footer();
+Display::display_footer();

+ 0 - 3
main/admin/access_url_edit_users_to_url.php

@@ -11,9 +11,6 @@ $language_file = 'admin';
 $cidReset = true;
 
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH) . 'urlmanager.lib.php';
-require_once api_get_path(LIBRARY_PATH) . 'access_url_edit_users_to_url_functions.lib.php';
-require_once '../inc/lib/xajax/xajax.inc.php';
 $xajax = new xajax();
 //$xajax->debugOn();
 $xajax->registerFunction(array('search_users', 'Accessurledituserstourl', 'search_users'));

+ 2 - 6
main/admin/access_urls.php

@@ -24,10 +24,6 @@ $interbreadcrumb[] = array ("url" => 'index.php', 'name' => get_lang('PlatformAd
 $tool_name = get_lang('MultipleAccessURLs');
 Display :: display_header($tool_name);
 
-require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
-require_once api_get_path(LIBRARY_PATH).'usergroup.lib.php';
-require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
-
 $my_user_url_list = api_get_access_url_from_user(api_get_user_id());
 $current_access_url_id = api_get_current_access_url_id();
 $url_list = UrlManager::get_url_data();
@@ -111,7 +107,7 @@ echo Display::url(Display::return_icon('user.png',      get_lang('ManageUsers'),
 echo Display::url(Display::return_icon('course.png',    get_lang('ManageCourses'), array(), ICON_SIZE_MEDIUM),   api_get_path(WEB_CODE_PATH).'admin/access_url_edit_courses_to_url.php');
 //echo Display::url(Display::return_icon('session.png',   get_lang('ManageSessions'), array(), ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH).'admin/access_url_edit_sessions_to_url.php');
 
-$userGroup = new Usergroup();
+$userGroup = new UserGroup();
 if ($userGroup->getUseMultipleUrl()) {
     echo Display::url(
         Display::return_icon('class.png', get_lang('ManageUserGroup'), array(), ICON_SIZE_MEDIUM),
@@ -171,4 +167,4 @@ $table->set_header(2, get_lang('Active'));
 $table->set_header(3, get_lang('Modify'), false);
 $table->display();
 
-Display :: display_footer();
+Display :: display_footer();

+ 0 - 1
main/admin/add_courses_to_session.php

@@ -13,7 +13,6 @@ $language_file = 'admin';
 $cidReset = true;
 
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'add_courses_to_session_functions.lib.php';
 
 $sessionId = isset($_GET['id_session']) ? intval($_GET['id_session']) : null;
 $add = isset($_GET['add']) ? Security::remove_XSS($_GET['add']) : null;

+ 2 - 4
main/admin/add_courses_to_usergroup.php

@@ -12,8 +12,6 @@ $cidReset = true;
 
 // Including some necessary files.
 require_once '../inc/global.inc.php';
-require_once '../inc/lib/xajax/xajax.inc.php';
-require_once api_get_path(LIBRARY_PATH).'usergroup.lib.php';
 
 $xajax = new xajax();
 $xajax->registerFunction('search');
@@ -102,7 +100,7 @@ $filters = array(
 );
 
 $searchForm = new FormValidator('search', 'get', api_get_self().'?id='.$id);
-$searchForm->add_header(get_lang('AdvancedSearch'));
+$searchForm->addHeader(get_lang('AdvancedSearch'));
 $renderer =& $searchForm->defaultRenderer();
 $searchForm->addElement('hidden', 'id', $id);
 foreach ($filters as $param) {
@@ -150,7 +148,7 @@ $ajax_search = $add_type == 'unique' ? true : false;
 function search($needle,$type)
 {
     global $elements_in;
-    $xajax_response = new XajaxResponse();
+    $xajax_response = new xajaxResponse();
     $return = '';
     if (!empty($needle) && !empty($type)) {
 

+ 0 - 2
main/admin/add_many_session_to_category.php

@@ -11,8 +11,6 @@ $language_file='admin';
 $cidReset = true;
 
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'add_many_session_to_category_functions.lib.php';
-require_once api_get_path(LIBRARY_PATH).'sessionmanager.lib.php';
 
 $xajax = new xajax();
 $xajax->registerFunction('search_courses');

+ 1 - 5
main/admin/add_sessions_to_promotion.php

@@ -12,10 +12,6 @@ $cidReset = true;
 
 // including some necessary files
 require_once '../inc/global.inc.php';
-require_once '../inc/lib/xajax/xajax.inc.php';
-require_once api_get_path(LIBRARY_PATH).'promotion.lib.php';
-require_once api_get_path(LIBRARY_PATH).'career.lib.php';
-require_once api_get_path(LIBRARY_PATH).'sessionmanager.lib.php';
 
 $xajax = new xajax();
 $xajax->registerFunction ('search_sessions');
@@ -117,7 +113,7 @@ $ajax_search = $add_type == 'unique' ? true : false;
 function search_sessions($needle, $type)
 {
     global $session_in_promotion;
-    $xajax_response = new XajaxResponse();
+    $xajax_response = new xajaxResponse();
     $return = '';
     if (!empty($needle) && !empty($type)) {
 

+ 1 - 3
main/admin/add_sessions_to_usergroup.php

@@ -12,8 +12,6 @@ $cidReset=true;
 
 // including some necessary files
 require_once '../inc/global.inc.php';
-require_once '../inc/lib/xajax/xajax.inc.php';
-require_once api_get_path(LIBRARY_PATH).'usergroup.lib.php';
 
 $xajax = new xajax();
 
@@ -127,7 +125,7 @@ $ajax_search = $add_type == 'unique' ? true : false;
 
 function search_sessions($needle,$type) {
     global $tbl_user,$elements_in;
-    $xajax_response = new XajaxResponse();
+    $xajax_response = new xajaxResponse();
     $return = '';
     if (!empty($needle) && !empty($type)) {
 

+ 0 - 2
main/admin/add_students_to_session.php

@@ -12,8 +12,6 @@ $cidReset = true;
 
 // including some necessary files
 require_once '../inc/global.inc.php';
-require_once '../inc/lib/xajax/xajax.inc.php';
-require_once api_get_path(LIBRARY_PATH).'sessionmanager.lib.php';
 
 // setting the section (for the tabs)
 $this_section = SECTION_PLATFORM_ADMIN;

+ 0 - 2
main/admin/add_teachers_to_session.php

@@ -12,8 +12,6 @@ $cidReset = true;
 
 // including some necessary files
 require_once '../inc/global.inc.php';
-require_once '../inc/lib/xajax/xajax.inc.php';
-require_once api_get_path(LIBRARY_PATH).'sessionmanager.lib.php';
 
 // setting the section (for the tabs)
 $this_section = SECTION_PLATFORM_ADMIN;

+ 1 - 3
main/admin/add_users_to_group.php

@@ -12,8 +12,6 @@ $cidReset = true;
 
 // including some necessary files
 require_once '../inc/global.inc.php';
-require_once '../inc/lib/xajax/xajax.inc.php';
-require_once '../inc/lib/group_portal_manager.lib.php';
 
 // setting the section (for the tabs)
 $this_section = SECTION_PLATFORM_ADMIN;
@@ -49,7 +47,7 @@ $xajax->registerFunction('search_users');
 function search_users($needle, $type, $relation_type)
 {
     global $tbl_user, $tbl_user_rel_access_url, $tbl_group_rel_user, $group_id;
-    $xajax_response = new XajaxResponse();
+    $xajax_response = new xajaxResponse();
     $return = $return_origin = $return_destination = '';
     $without_user_id = $without_user_id = $condition_relation = '';
 

+ 13 - 3
main/admin/add_users_to_session.php

@@ -13,7 +13,6 @@ $cidReset = true;
 
 // including some necessary files
 require_once '../inc/global.inc.php';
-require_once '../inc/lib/xajax/xajax.inc.php';
 $xajax = new xajax();
 
 $xajax->registerFunction('search_users');
@@ -70,7 +69,7 @@ function search_users($needle, $type)
 {
     global $tbl_user, $tbl_session_rel_user, $id_session;
 
-    $xajax_response = new XajaxResponse();
+    $xajax_response = new xajaxResponse();
     $return = '';
 
     if (!empty($needle) && !empty($type)) {
@@ -95,8 +94,19 @@ function search_users($needle, $type)
             $order_clause = ' ORDER BY official_code, firstname, lastname, username';
         }
 
+        if (api_is_session_admin()
+            && isset($_configuration['prevent_session_admins_to_manage_all_users'])
+            && $_configuration['prevent_session_admins_to_manage_all_users'] == 'true'
+        ) {
+            $order_clause = " AND user.creator_id = " . api_get_user_id() . $order_clause;
+        }
+
         $cond_user_id = '';
 
+        if (api_is_session_admin() && api_get_setting('prevent_session_admins_to_manage_all_users')  == 'true') {
+            $order_clause = " AND user.creator_id = ".api_get_user_id().$order_clause;
+        }
+
         // Only for single & multiple
         if (in_array($type, array('single','multiple')))
         if (!empty($id_session)) {
@@ -198,7 +208,7 @@ function search_users($needle, $type)
                 }
             }
         }
-        //echo Database::fixQuery($sql);
+
         $rs = Database::query($sql);
         $i = 0;
         if ($type=='single') {

+ 1 - 3
main/admin/add_users_to_usergroup.php

@@ -12,7 +12,6 @@ $cidReset = true;
 
 // including some necessary files
 require_once '../inc/global.inc.php';
-require_once '../inc/lib/xajax/xajax.inc.php';
 
 // setting the section (for the tabs)
 $this_section = SECTION_PLATFORM_ADMIN;
@@ -129,7 +128,6 @@ if (isset($_GET['action']) && $_GET['action'] == 'export') {
     $groupInfo = $usergroup->get($id);
     $users = $usergroup->getUserListByUserGroup($id);
     if (!empty($users)) {
-        require_once api_get_path(LIBRARY_PATH) . 'export.lib.inc.php';
 
         $data = array(
             array('UserName', 'ClassName')
@@ -186,7 +184,7 @@ $filters = array(
 );
 
 $searchForm = new FormValidator('search', 'get', api_get_self().'?id='.$id);
-$searchForm->add_header(get_lang('AdvancedSearch'));
+$searchForm->addHeader(get_lang('AdvancedSearch'));
 $renderer =& $searchForm->defaultRenderer();
 
 $searchForm->addElement('hidden', 'id', $id);

+ 1 - 395
main/admin/calendar.lib.php

@@ -1151,399 +1151,6 @@ function show_user_group_filter_form()
 	echo "</select>";
 }
 
-function show_add_form($id = '') {
-	global $MonthsLong;
-
-	$htmlHeadXtra[] = to_javascript();
-	// the default values for the forms
-	if ($_GET['originalresource'] !== 'no') {
-		$day	= date('d');
-		$month	= date('m');
-		$year	= date('Y');
-		$hours	= 9;
-		$minutes= '00';
-
-		$end_day	= date('d');
-		$end_month	= date('m');
-		$end_year	= date('Y');
-		$end_hours	= 17;
-		$end_minutes= '00';
-        $repeat = false;
-	} else {
-		// we are coming from the resource linker so there might already have been some information in the form.
-		// When we clicked on the button to add resources we stored every form information into a session and now we
-		// are doing the opposite thing: getting the information out of the session and putting it into variables to
-		// display it in the forms.
-		$form_elements=$_SESSION['formelements'];
-		$day=$form_elements['day'];
-		$month=$form_elements['month'];
-		$year=$form_elements['year'];
-		$hours=$form_elements['hour'];
-		$minutes=$form_elements['minutes'];
-		$end_day=$form_elements['end_day'];
-		$end_month=$form_elements['end_month'];
-		$end_year=$form_elements['end_year'];
-		$end_hours=$form_elements['end_hours'];
-		$end_minutes=$form_elements['end_minutes'];
-		$title=$form_elements['title'];
-		$content=$form_elements['content'];
-		$id=$form_elements['id'];
-		$to=$form_elements['to'];
-        $repeat = $form_elements['repeat'];
-	}
-
-
-	//	switching the send to all/send to groups/send to users
-	if ($_POST['To']) {
-			$day			= $_POST['fday'];
-			$month			= $_POST['fmonth'];
-			$year			= $_POST['fyear'];
-			$hours			= $_POST['fhour'];
-			$minutes		= $_POST['fminute'];
-			$end_day		= $_POST['end_fday'];
-			$end_month		= $_POST['end_fmonth'];
-			$end_year		= $_POST['end_fyear'];
-			$end_hours		= $_POST['end_fhour'];
-			$end_minutes	= $_POST['end_fminute'];
-			$title 			= $_POST['title'];
-			$content		= $_POST['content'];
-			// the invisible fields
-			$action			= $_POST['action'];
-			$id				= $_POST['id'];
-            $repeat         = !empty($_POST['repeat'])?true:false;
-		}
-
-
-	// if the id is set then we are editing an agenda item
-
-	if (is_int($id)) {
-		//echo "before get_agenda_item".$_SESSION['allow_individual_calendar'];
-		$item_2_edit=get_agenda_item($id);
-
-		$title	= $item_2_edit['title'];
-		$content= $item_2_edit['content'];
-
-		// start date
-        $item_2_edit['start_date'] = api_get_local_time($item_2_edit['start_date']);
-
-		// start date
-		list($datepart, $timepart) = split(" ", $item_2_edit['start_date']);
-		list($year, $month, $day) = explode("-", $datepart);
-		list($hours, $minutes, $seconds) = explode(":", $timepart);
-
-		// end date
-        $item_2_edit['end_date'] = api_get_local_time($item_2_edit['end_date']);
-		list($datepart, $timepart) = split(" ", $item_2_edit['end_date']);
-		list($end_year, $end_month, $end_day) = explode("-", $datepart);
-		list($end_hours, $end_minutes, $end_seconds) = explode(":", $timepart);
-		// attachments
-		//edit_added_resources("Agenda", $id);
-		$to=$item_2_edit['to'];
-		//echo "<br />after get_agenda_item".$_SESSION['allow_individual_calendar'];
-	}
-	$content=stripslashes($content);
-	$title=stripslashes($title);
-	// we start a completely new item, we do not come from the resource linker
-	if ($_GET['originalresource']!=="no" and $_GET['action']=="add") {
-		$_SESSION["formelements"]=null;
-	}
-?>
-
-<!-- START OF THE FORM  -->
-<form enctype="multipart/form-data"  action="<?php echo api_get_self().'?origin='.Security::remove_XSS($_GET['origin']).'&amp;action='.Security::remove_XSS($_GET['action']); ?>" method="post" name="new_calendar_item">
-<input type="hidden" name="id" value="<?php if (isset($id)) echo $id; ?>" />
-<input type="hidden" name="action" value="<?php if (isset($_GET['action'])) echo Security::remove_XSS($_GET['action']); ?>" />
-<input type="hidden" name="sort" value="asc" />
-<input type="hidden" name="submit_event" value="ok" />
-<?php
-	echo '<legend>';
-	echo (isset($id) AND $id<>'')?get_lang('ModifyCalendarItem'):get_lang("AddCalendarItem");
-	echo '<legend>';
-	?>
-<table border="0" cellpadding="5" cellspacing="0" width="80%" id="newedit_form">
-	<!-- START date and time -->
-<tr>
-<div>
-<table border="0" width="100%">
-				<tr><td colspan="4">
-					<div id="err_date" style="display:none;color:red"></div>
-					<div id="err_start_date" style="display:none;color:red"></div>
-				</td></tr>
-				<td width="10%">
-					<!-- date: 1 -> 31 -->
-					<nobr><?php echo get_lang('StartDate').": "; ?></nobr>
-				</td>
-				<td width="35%">
-					<select name="fday" onchange="javascript:document.new_calendar_item.end_fday.value=this.value;">
-							<?php
-							// small loop for filling all the dates
-							// 2do: the available dates should be those of the selected month => february is from 1 to 28 (or 29) and not to 31
-							foreach (range(1, 31) as $i) {
-                            // values have to have double digits
-                            $value = ($i <= 9 ? '0'.$i : $i );
-                            // the current day is indicated with [] around the date
-                            if ($value==$day)
-                            {
-                                echo " <option value=\"".$value."\" selected> ".$i." </option>";
-                            }
-                            else
-                            {
-                                echo "<option value=\"$value\">$i</option>";
-                            }
-                        }
-                         ?>
-					</select>
-					<!-- month: january -> december -->
-					<select name="fmonth" onchange="javascript:document.new_calendar_item.end_fmonth.value=this.value;">
-					<?php
-                        for ($i=1; $i<=12; $i++) {
-                            // values have to have double digits
-                            if ($i<=9)
-                            {
-                                $value="0".$i;
-                            }
-                            else
-                            {
-                                $value=$i;
-                            }
-                            if ($value==$month)
-                            {
-                                echo " <option value=\"".$value."\" selected>".$MonthsLong[$i-1]."</option>\n";
-                            }
-                            else
-                            {
-                                echo " <option value=\"".$value."\">".$MonthsLong[$i-1]."</option>\n";
-                            }
-                        } ?>
-					</select>
-					<select name="fyear" onchange="javascript:document.new_calendar_item.end_fyear.value=this.value;">
-										<option value="<?php echo ($year-1); ?>"><?php echo ($year-1); ?></option>
-											<option value="<?php echo $year; ?>" selected="selected"><?php echo $year; ?></option>
-											<?php
-												echo "\n";
-												for ($i=1; $i<=5; $i++)
-												{
-													$value=$year+$i;
-													echo "<option value=\"$value\">$value</option>\n";
-												} ?>
-					</select>
-					<a href="javascript:openCalendar('new_calendar_item','f')"><?php Display::display_icon('calendar_select.gif', get_lang('Select'), array ('style' => 'vertical-align: middle;')); ?></a>
-					</td>
-					<td width="10%">
-						<nobr><?php echo get_lang('StartTime').": \n"; ?></nobr>
-					</td>
-					<td>
-						<select name="fhour" onchange="javascript:document.new_calendar_item.end_fhour.value=this.value;">
-							<!-- <option value="--">--</option> -->
-							<?php
-								echo "\n";
-								foreach (range(0, 23) as $i)
-								{
-									// values have to have double digits
-									$value = ($i <= 9 ? '0'.$i : $i );
-									// the current hour is indicated with [] around the hour
-									if ($hours==$value)
-									{
-										echo "<option value=\"".$value."\" selected> ".$value." </option>\n";
-									}
-									else
-									{
-										echo "<option value=\"$value\">$value</option>\n";
-									}
-								} ?>
-						</select>
-
-						<select name="fminute" onchange="javascript:document.new_calendar_item.end_fminute.value=this.value;">
-							<!-- <option value="<?php echo $minutes ?>"><?php echo $minutes; ?></option> -->
-							<!-- <option value="--">--</option> -->
-							<?php
-								foreach (range(0, 59) as $i)
-								{
-									// values have to have double digits
-									$value = ($i <= 9 ? '0'.$i : $i );
-									if ($minutes == $value) {
-										echo "<option value=\"".$value."\" selected> ".$value." </option>";
-									} else {
-										echo "<option value=\"$value\">$value</option>";
-									}
-								} ?>
-						</select>
-					</td>
-
-</div>
-</tr>
-			<!-- END date and time -->
-<tr>
-<div>
-					<tr><td colspan="4"><div id="err_end_date" style="display:none;color:red"></div></td></tr>
-					<td >
-							<!-- date: 1 -> 31 -->
-							<nobr><?php echo get_lang('EndDate').": "; ?></nobr>
-					</td>
-					<td  >
-						<select name="end_fday">
-							<?php
-								// small loop for filling all the dates
-								// 2do: the available dates should be those of the selected month => february is from 1 to 28 (or 29) and not to 31
-								echo "\n";
-								foreach (range(1, 31) as $i)
-								{
-									// values have to have double digits
-									$value = ($i <= 9 ? '0'.$i : $i );
-									// the current day is indicated with [] around the date
-									if ($value==$end_day)
-										{ echo " <option value=\"".$value."\" selected> ".$i." </option>\n";}
-									else
-										{ echo " <option value=\"".$value."\">".$i."</option>\n"; }
-									}?>
-						</select>
-							<!-- month: january -> december -->
-						<select name="end_fmonth">
-                            <?php
-                            echo "\n";
-                            foreach (range(1, 12) as $i)
-                            {
-                                // values have to have double digits
-                                $value = ($i <= 9 ? '0'.$i : $i );
-                                if ($value==$end_month)
-                                    { echo " <option value=\"".$value."\" selected>".$MonthsLong[$i-1]."</option>\n"; }
-                                else
-                                    { echo " <option value=\"".$value."\">".$MonthsLong[$i-1]."</option>\n"; }
-                                }?>
-						</select>
-						<select name="end_fyear">
-                            <option value="<?php echo ($end_year-1) ?>"><?php echo ($end_year-1) ?></option>
-                            <option value="<?php echo $end_year ?>" selected> <?php echo $end_year ?> </option>
-                            <?php
-                            echo "\n";
-                            for ($i=1; $i<=5; $i++)
-                            {
-                                $value=$end_year+$i;
-                                echo "<option value=\"$value\">$value</option>\n";
-                            } ?>
-						</select>
-						<a href="javascript:openCalendar('new_calendar_item', 'end_f')"><?php Display::display_icon('calendar_select.gif',get_lang('Select'), array ('style' => 'vertical-align: middle;')); ?></a>
-					</td>
-					<td >
-						<nobr><?php echo get_lang('EndTime').": \n"; ?></nobr>
-					</td>
-					<td >
-						<select name="end_fhour">
-							<!-- <option value="--">--</option> -->
-							<?php
-								echo "\n";
-								foreach (range(0, 23) as $i)
-								{
-									// values have to have double digits
-									$value = ($i <= 9 ? '0'.$i : $i );
-									// the current hour is indicated with [] around the hour
-									if ($end_hours==$value)
-										{ echo "<option value=\"".$value."\" selected> ".$value." </option>\n"; }
-									else
-										{ echo "<option value=\"".$value."\"> ".$value." </option>\n"; }
-								} ?>
-						</select>
-
-						<select name="end_fminute">
-							<!-- <option value="<?php echo $end_minutes; ?>"><?php echo $end_minutes; ?></option> -->
-							<!-- <option value="--">--</option> -->
-							<?php
-								foreach (range(0, 59) as $i)
-								{
-									// values have to have double digits
-									$value = ($i <= 9 ? '0'.$i : $i );
-									if ($minutes == $value) {
-										echo "<option value=\"".$value."\" selected> ".$value." </option>";
-									} else {
-										echo "<option value=\"$value\">$value</option>";
-									}
-								} ?>
-						</select>
-						<br>
-				</td>
-</div>
-</tr>
-<tr><td colspan="4">
-<hr noshade="noshade" color="#cccccc" />
-	<div id="err_title" style="display:none;color:red"></div>
-</td></tr>
-<tr class="subtitle">
-		<td colspan="4" valign="top"><?php echo get_lang('ItemTitle'); ?> :
-			<!--<div style='margin-left: 80px'><textarea name="title" cols="50" rows="2" wrap="virtual" style="vertical-align:top; width:75%; height:50px;"><?php  if (isset($title)) echo $title; ?></textarea></div>-->
-			<input type="text" size="60" name="title" value="<?php  if (isset($title)) echo $title; ?>" />
-		</td>
-	</tr>
-
-	<tr>
-		<td colspan="4">
-
-			<?php
-			require_once api_get_path(LIBRARY_PATH) . "/fckeditor/fckeditor.php";
-
-			$oFCKeditor = new FCKeditor('content') ;
-
-			$oFCKeditor->ToolbarSet = 'GlobalAgenda';
-			$oFCKeditor->Width		= '100%';
-			$oFCKeditor->Height		= '175';
-			$oFCKeditor->Value		= $content;
-
-			$return =	$oFCKeditor->CreateHtml();
-
-			echo $return;
-
- ?>
-		</td>
-	</tr>
-	<!--<?php /* ADDED BY UGENT, Patrick Cool, march 2004 */ ?>
-	<tr>
-		<td colspan="4">
-	    <?php
-			//onclick="selectAll(this.form.elements[6],true)"
-
-//				show_addresource_button('onclick="selectAll(this.form.elements[6],true)"');
-
-		?>
-		</td>
-	</tr>-->
-	<?php
-	   //if ($_SESSION['addedresource'])
-	   echo "<tr>\n";
-	   echo "<td colspan=\"4\">\n";
-	   //echo display_resources(0);//--------------------------------------------------------
-	   $test=$_SESSION['addedresource'];
-	   echo "</td>\n</tr>\n";
-	   /* END ADDED BY UGENT, Patrick Cool, march 2004 */
-    if(empty($id)) //only show repeat fields when adding the first time
-    {
-	?>
-
-    <tr>
-      <td colspan="4" />
-    </tr>
-    <?php
-    }//only show repeat fields if adding, not if editing
-    ?>
-	<tr>
-		<td colspan="4">
-		<?php
-		if ($_GET['action']=='edit'){
-			$class='save';
-			$text=get_lang('ModifyEvent');
-
-		}else{
-			$class='add';
-			$text=get_lang('AddEvent');
-		}
-		?>
-		<button type="button" class="add" value="<?php echo get_lang('Ok'); ?>" onclick="validate_date()" ><?php echo $text;  ?></button>
-
-		</td>
-	</tr>
-</table>
-</form>
-<?php
-}
-
 function display_upcoming_events() {
 	echo '<br /><b>'.get_lang('UpcomingEvent').'</b><br />';
 	$number_of_items_to_show = (int)api_get_setting('number_of_upcoming_events');
@@ -2881,7 +2488,6 @@ function agenda_add_repeat_item($course_info,$orig_id,$type,$end,$orig_dest)
 
 function agenda_import_ical($course_info,$file) {
 
-	require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
     $charset = api_get_system_encoding();
     $filepath = api_get_path(SYS_ARCHIVE_PATH).$file['name'];
     if(!@move_uploaded_file($file['tmp_name'],$filepath))
@@ -2889,7 +2495,7 @@ function agenda_import_ical($course_info,$file) {
     	error_log('Problem moving uploaded file: '.$file['error'].' in '.__FILE__.' line '.__LINE__);
     	return false;
     }
-    require_once api_get_path(LIBRARY_PATH).'icalcreator/iCalcreator.class.php';
+
     $ical = new vcalendar();
     $ical->setConfig('directory', dirname($filepath) );
     $ical->setConfig('filename', basename($filepath) );

+ 2 - 1
main/admin/calendar.php

@@ -155,7 +155,8 @@ if (empty($select_year) && empty($select_month)) {
 echo '<div class="actions">';
 if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous())) {
 	display_student_links();
-	display_courseadmin_links();
+    // Deprecated since 2014-10-31
+	//display_courseadmin_links();
 }
 
 echo '</div><br /><br />';

+ 1 - 2
main/admin/calendar_ical_export.php

@@ -16,8 +16,7 @@ $cidReset = true;
 require_once '../inc/global.inc.php';
 $this_section = SECTION_MYAGENDA;
 api_block_anonymous_users();
-require_once (api_get_path(LIBRARY_PATH).'groupmanager.lib.php');
-require_once (api_get_path(LIBRARY_PATH).'icalcreator/iCalcreator.class.php');
+
 // setting the name of the tool
 $nameTools = get_lang('MyAgenda');
 

+ 31 - 37
main/admin/career_dashboard.php

@@ -13,12 +13,6 @@ $language_file = array('courses', 'index', 'admin');
 $cidReset = true;
 require_once '../inc/global.inc.php';
 $libpath = api_get_path(LIBRARY_PATH);
-require_once $libpath.'career.lib.php';
-require_once $libpath.'promotion.lib.php';
-
-require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathList.class.php';
-require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php';
-require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.class.php';
 
 api_protect_admin_script();
 
@@ -39,8 +33,8 @@ $career = new Career();
 
 $condition = array('status = ?' => 1);
 if ($form->validate()) {
-    $data = $form->getSubmitValues(); 
-    $filter = intval($data['filter']);   
+    $data = $form->getSubmitValues();
+    $filter = intval($data['filter']);
     if (!empty($filter)) {
         $condition = array('status = ? AND id = ? ' => array(1, $filter));
     }
@@ -49,7 +43,7 @@ if ($form->validate()) {
 $careers = $career->get_all(array('status = ?' => 1)); //only status =1
 $career_select_list = array();
 $career_select_list[0] = ' -- '.get_lang('Select').' --';
-foreach ($careers as $item) {    
+foreach ($careers as $item) {
     $career_select_list[$item['id']] = $item['name'];
 }
 
@@ -61,7 +55,7 @@ $form->addElement('style_submit_button', 'submit', get_lang('Filter'), 'class="s
 echo '<div class="actions" style="margin-bottom:20px">';
     echo  '<a href="../admin/index.php">'.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('PlatformAdmin'),'',ICON_SIZE_MEDIUM).'</a>';
     echo '<a href="careers.php">'.Display::return_icon('career.png',get_lang('Careers'),'',ICON_SIZE_MEDIUM).'</a>';
-    echo '<a href="promotions.php">'.Display::return_icon('promotion.png',get_lang('Promotions'),'',ICON_SIZE_MEDIUM).'</a>'; 
+    echo '<a href="promotions.php">'.Display::return_icon('promotion.png',get_lang('Promotions'),'',ICON_SIZE_MEDIUM).'</a>';
 echo '</div>';
 
 $form->display();
@@ -73,78 +67,78 @@ $i = 0;
 $grid_js = '';
 $career_array = array();
 if (!empty($careers)) {
-    foreach($careers as $career_item) {   
+    foreach($careers as $career_item) {
         $promotion = new Promotion();
         //Getting all promotions
-        $promotions = $promotion->get_all_promotions_by_career_id($career_item['id'], 'name DESC');        
-        $career_content = '';        
+        $promotions = $promotion->get_all_promotions_by_career_id($career_item['id'], 'name DESC');
+        $career_content = '';
         $promotion_array = array();
-        if (!empty($promotions)) {            
+        if (!empty($promotions)) {
             foreach($promotions as $promotion_item) {
                 if (!$promotion_item['status']) {
                     continue; //avoid status = 0
                 }
-                //Getting all sessions from this promotion      
-                $sessions = SessionManager::get_all_sessions_by_promotion($promotion_item['id']); 
-                   
-                $session_list = array();    
-                foreach($sessions as $session_item) {       
+                //Getting all sessions from this promotion
+                $sessions = SessionManager::get_all_sessions_by_promotion($promotion_item['id']);
+
+                $session_list = array();
+                foreach($sessions as $session_item) {
                     $course_list = SessionManager::get_course_list_by_session_id($session_item['id']);
                     $session_list[] = array('data'=>$session_item,'courses'=>$course_list);
-                }   
-                $promotion_array[$promotion_item['id']] =array('name'=>$promotion_item['name'], 'sessions'=>$session_list);  
+                }
+                $promotion_array[$promotion_item['id']] =array('name'=>$promotion_item['name'], 'sessions'=>$session_list);
             }
         }
         $career_array[$career_item['id']] = array('name'=>$career_item['name'],'promotions'=>$promotion_array);
-    }   
+    }
 }
 
 echo '<table class="data_table">';
 
 foreach($career_array as $career_id => $data) {
     $career     = $data['name'];
-    $promotions = $data['promotions'];        
+    $promotions = $data['promotions'];
     $career = Display::url($career,'careers.php?action=edit&id='.$career_id);
     $career = Display::tag('h3',$career);
-    echo '<tr><td style="background-color:#eee" colspan="3">'.$career.'</td></tr>';   
-    foreach($promotions as $promotion_id => $promotion) {         
+    echo '<tr><td style="background-color:#eee" colspan="3">'.$career.'</td></tr>';
+    foreach($promotions as $promotion_id => $promotion) {
     	$promotion_name = $promotion['name'];
         $promotion_url  = Display::url($promotion_name,'promotions.php?action=edit&id='.$promotion_id);
         $sessions       = $promotion['sessions'];
         echo '<tr>';
         $count = count($sessions);
         $rowspan = '';
-        if (!empty($count)) {     
+        if (!empty($count)) {
             $count++;
         	$rowspan = 'rowspan="'.$count.'"';
         }
-        echo '<td '.$rowspan.'>';        
+        echo '<td '.$rowspan.'>';
         //echo $promotion_url;
           echo Display::tag('h4',$promotion_url);
         echo '</td>';
-        echo '</tr>';      
-         
+        echo '</tr>';
+
         if (!empty($sessions))
         foreach($sessions as $session) {
             $course_list = $session['courses'];
-            
-            $url = Display::url($session['data']['name'], 'resume_session.php?id_session='.$session['data']['id']); 
+
+            $url = Display::url($session['data']['name'], 'resume_session.php?id_session='.$session['data']['id']);
             echo '<tr>';
                 //Session name
-                echo Display::tag('td',$url);         
+                echo Display::tag('td',$url);
                 echo '<td>';
                     //Courses
                     echo '<table>';
                     foreach($course_list as $course) {
                        echo '<tr>';
-                       
-                       $url = Display::url($course['title'], api_get_path(WEB_COURSE_PATH).$course['directory'].'/?id_session='.$session['data']['id']);                       
+
+                       $url = Display::url($course['title'], api_get_path(WEB_COURSE_PATH).$course['directory'].'/?id_session='.$session['data']['id']);
                        echo Display::tag('td',$url);
-                       echo '</tr>';	
+                       echo '</tr>';
                     }
                     echo '</table>';
-                echo '</td>';    
-            echo '</tr>';       
+                echo '</td>';
+            echo '</tr>';
         }
     }
 }

+ 1 - 2
main/admin/careers.php

@@ -10,7 +10,6 @@ $language_file = array('admin');
 
 $cidReset = true;
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'career.lib.php';
 
 $this_section = SECTION_PLATFORM_ADMIN;
 
@@ -164,4 +163,4 @@ switch ($action) {
         $career->display();
         break;
 }
-Display :: display_footer();
+Display :: display_footer();

+ 2 - 2
main/admin/class_add.php

@@ -29,7 +29,7 @@ $interbreadcrumb[] = array ('url' => 'class_list.php', 'name' => get_lang('Class
 $tool_name = get_lang("AddClasses");
 
 $form = new FormValidator('add_class');
-$form->add_textfield('name', get_lang('ClassName'));
+$form->addText('name', get_lang('ClassName'));
 $form->addElement('style_submit_button', 'submit', get_lang('Ok'), 'class="add"');
 if ($form->validate()) {
     $values = $form->exportValues();
@@ -44,4 +44,4 @@ Display :: display_header($tool_name);
 $form->display();
 
 // Displaying the footer.
-Display :: display_footer();
+Display :: display_footer();

+ 1 - 2
main/admin/class_edit.php

@@ -14,7 +14,6 @@ $cidReset = true;
 
 // Including some necessary dokeos files.
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'classmanager.lib.php';
 
 // Setting the section (for the tabs).
 $this_section = SECTION_PLATFORM_ADMIN;
@@ -34,7 +33,7 @@ $tool_name = get_lang('ModifyClassInfo');
 $class_id = intval($_GET['idclass']);
 $class = ClassManager :: get_class_info($class_id);
 $form = new FormValidator('edit_class', 'post', 'class_edit.php?idclass='.$class_id);
-$form->add_textfield('name',get_lang('ClassName'));
+$form->addText('name',get_lang('ClassName'));
 $form->addElement('style_submit_button', 'submit', get_lang('Ok'), 'class="add"');
 $form->setDefaults(array('name'=>$class['name']));
 if($form->validate())

+ 1 - 4
main/admin/class_import.php

@@ -54,9 +54,6 @@ $cidReset = true;
 
 // Including some necessary dokeos files.
 include '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
-require_once api_get_path(LIBRARY_PATH).'classmanager.lib.php';
-require_once api_get_path(LIBRARY_PATH).'import.lib.php';
 
 // Setting the section (for the tabs).
 $this_section = SECTION_PLATFORM_ADMIN;
@@ -116,4 +113,4 @@ $form->display();
 <?php
 
 // Displaying the footer.
-Display :: display_footer();
+Display :: display_footer();

+ 0 - 2
main/admin/class_information.php

@@ -18,8 +18,6 @@ $this_section = SECTION_PLATFORM_ADMIN;
 
 api_protect_admin_script();
 
-require_once api_get_path(LIBRARY_PATH).'classmanager.lib.php';
-
 if (!isset($_GET['id'])) {
     api_not_allowed();
 }

+ 1 - 4
main/admin/class_list.php

@@ -69,9 +69,6 @@ function modify_filter($class_id) {
     return $result;
 }
 
-require api_get_path(LIBRARY_PATH).'fileManage.lib.php';
-require api_get_path(LIBRARY_PATH).'classmanager.lib.php';
-
 $tool_name = get_lang('ClassList');
 $interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
 
@@ -130,4 +127,4 @@ $tpl = new Template($tool_name);
 $tpl->assign('content', $content);
 $tpl->assign('actions', $actions);
 $tpl->assign('message', $message);
-$tpl->display_one_col_template();
+$tpl->display_one_col_template();

+ 12 - 16
main/admin/class_user_import.php

@@ -16,7 +16,7 @@ function validate_data($user_classes) {
     global $purification_option_for_usernames;
     $errors = array ();
     $classcodes = array ();
-    
+
     if (!isset($_POST['subscribe']) && !isset($_POST['subscribe']))  {
           $user_class['error'] = get_lang('SelectAnAction');
           $errors[] = $user_class;
@@ -26,20 +26,20 @@ function validate_data($user_classes) {
         $user_class['line'] = $index + 1;
         // 1. Check whether mandatory fields are set.
         $mandatory_fields = array ('UserName', 'ClassName');
-        
-        foreach ($mandatory_fields as $key => $field) {            
-            if (!isset ($user_class[$field]) || strlen($user_class[$field]) == 0) {                
+
+        foreach ($mandatory_fields as $key => $field) {
+            if (!isset ($user_class[$field]) || strlen($user_class[$field]) == 0) {
                 $user_class['error'] = get_lang($field.'Mandatory');
                 $errors[] = $user_class;
             }
         }
-        
+
         // 2. Check whether classcode exists.
         if (isset ($user_class['ClassName']) && strlen($user_class['ClassName']) != 0) {
             // 2.1 Check whether code has been allready used in this CVS-file.
             if (!isset ($classcodes[$user_class['ClassName']])) {
                 // 2.1.1 Check whether code exists in DB.
-                $class_table = Database :: get_main_table(TABLE_MAIN_CLASS);                
+                $class_table = Database :: get_main_table(TABLE_MAIN_CLASS);
                 $sql = "SELECT * FROM $class_table WHERE name = '".Database::escape_string($user_class['ClassName'])."'";
                 $res = Database::query($sql);
                 if (Database::num_rows($res) == 0) {
@@ -57,7 +57,7 @@ function validate_data($user_classes) {
                 $user_class['error'] = get_lang('UserNameTooLong').': '.$user_class['UserName'];
                 $errors[] = $user_class;
             }
-            $username = UserManager::purify_username($user_class['UserName'], $purification_option_for_usernames);            
+            $username = UserManager::purify_username($user_class['UserName'], $purification_option_for_usernames);
             // 3.2. Check whether username exists.
             if (UserManager::is_username_available($username)) {
                 $user_class['error'] = get_lang('UnknownUser').': '.$username;
@@ -83,7 +83,7 @@ function save_data($users_classes) {
     // Data parsing: purification + conversion (UserName, ClassName) --> (user_is, class_id)
     $csv_data = array ();
     foreach ($users_classes as $index => $user_class) {
-        
+
         $sql1 = "SELECT user_id FROM $user_table WHERE username = '".Database::escape_string(UserManager::purify_username($user_class['UserName'], $purification_option_for_usernames))."'";
         $res1 = Database::query($sql1);
         $obj1 = Database::fetch_object($res1);
@@ -94,7 +94,7 @@ function save_data($users_classes) {
             $csv_data[$obj1->user_id][$obj2->id] = 1;
         }
     }
-    
+
     // Logic for processing the request (data + UI options).
     $db_subscriptions = array();
     foreach ($csv_data as $user_id => $csv_subscriptions) {
@@ -105,7 +105,7 @@ function save_data($users_classes) {
         }
         $to_subscribe   = array_diff(array_keys($csv_subscriptions), array_keys($db_subscriptions));
         $to_unsubscribe = array_diff(array_keys($db_subscriptions), array_keys($csv_subscriptions));
-        
+
         // Subscriptions for new classes.
         if ($_POST['subscribe']) {
             foreach ($to_subscribe as $class_id) {
@@ -139,10 +139,6 @@ require_once '../inc/global.inc.php';
 $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 
-require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
-require_once api_get_path(LIBRARY_PATH).'import.lib.php';
-require_once api_get_path(LIBRARY_PATH).'classmanager.lib.php';
-
 $tool_name = get_lang('AddUsersToAClass').' CSV';
 
 $interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
@@ -161,9 +157,9 @@ $form->addElement('style_submit_button', 'submit', get_lang('Import'), 'class="s
 
 if ($form->validate()) {
     $users_classes = parse_csv_data($_FILES['import_file']['tmp_name']);
-    
+
     $errors = validate_data($users_classes);
-    if (count($errors) == 0) {        
+    if (count($errors) == 0) {
         save_data($users_classes);
         header('Location: class_list.php?action=show_message&message='.urlencode(get_lang('FileImported')));
         exit();

+ 8 - 11
main/admin/configure_extensions.php

@@ -4,9 +4,7 @@
  * Edition of extensions configuration
  * @package chamilo.admin
  */
-/**
- * Code
- */
+
 // name of the language file that needs to be included
 $language_file='admin';
 $cidReset=true;
@@ -154,17 +152,18 @@ if (isset($_POST['activeExtension'])) {
 $listActiveServices = array();
 
 // get the list of active services
-$sql = 'SELECT variable FROM '.$tbl_settings_current.' WHERE variable LIKE "service_%" AND subkey="active" and selected_value="true"';
+$sql = 'SELECT variable FROM '.$tbl_settings_current.'
+		WHERE variable LIKE "service_%" AND subkey="active" and selected_value="true"';
 
 $rs = Database::query($sql);
 while($row = Database::fetch_array($rs)){
 	$listActiveServices[] = $row['variable'];
 }
 
-$javascript_service_displayed = '';
-if(isset($_GET['display'])){
+/*$javascript_service_displayed = '';
+if (isset($_GET['display'])) {
 	$javascript_service_displayed = 'document.getElementById("extension_content_'.$_GET['display'].'").style.display = "block"';
-}
+}*/
 
 // javascript to handle accordion behaviour
 $javascript_message = '';
@@ -223,8 +222,6 @@ $nameTool = get_lang('ConfigureExtensions');
 Display::display_header($nameTool);
 
 ?>
-
-
 <div id="message" style="display: none">
 	<?php
 	if(!empty($message))
@@ -299,7 +296,7 @@ Display::display_header($nameTool);
 	</div>
 
  */ ?>
-    
+
 	<!-- PPT2LP -->
 	<div id="main_ppt2lp">
 		<div id="extension_header_ppt2lp" class="accordion_header">
@@ -441,7 +438,7 @@ Display::display_header($nameTool);
 	</div>
 	*/
     /*
-   
+
 	<!-- SEARCH -->
 	<div id="main_search">
 		<div id="extension_header_search" class="accordion_header">

+ 472 - 475
main/admin/configure_homepage.php

@@ -1,9 +1,11 @@
 <?php
 /* For licensing terms, see /license.txt */
+
 /**
  * Configure the portal homepage (manages multi-urls and languages)
  * @package chamilo.admin
  */
+
 /**
  * Creates menu tabs for logged and anonymous users
  *
@@ -15,36 +17,38 @@
  */
 function home_tabs($file_logged_in)
 {
-    $post = strpos($file_logged_in, "_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();
-
-        //we read the file with all links
-        $file = file($file_logged_in);
-        foreach ($file as $line) {
-            $line = str_replace("\n", '',$line);
-            //not logged user only sees public links
-            if (!preg_match('/::private/',$line)) {
-                $data_logged_out[] = $line;
-            }
-            //logged user only sees all links
-            $data_logged_in[] = $line;
-        }
-        //tabs file for logged out users
-        $fp = fopen($file_logged_out, 'w');
-        fputs($fp, implode("\n", $data_logged_out));
-        fclose($fp);
-        //tabs file for logged in users
-        $fp = fopen($file_logged_in, 'w');
-        fputs($fp, implode("\n", $data_logged_in));
-        fclose($fp);
-    }
+	$post = strpos($file_logged_in, "_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();
+
+		//we read the file with all links
+		$file = file($file_logged_in);
+		foreach ($file as $line) {
+			$line = str_replace("\n", '',$line);
+			//not logged user only sees public links
+			if (!preg_match('/::private/',$line)) {
+				$data_logged_out[] = $line;
+			}
+			//logged user only sees all links
+			$data_logged_in[] = $line;
+		}
+		//tabs file for logged out users
+		if (file_exists($file_logged_out)) {
+			$fp = fopen($file_logged_out, 'w');
+			fputs($fp, implode("\n", $data_logged_out));
+			fclose($fp);
+		}
+		//tabs file for logged in users
+		$fp = fopen($file_logged_in, 'w');
+		fputs($fp, implode("\n", $data_logged_in));
+		fclose($fp);
+	}
 }
 
-$language_file = array('index','admin', 'accessibility');
+$language_file = array('index', 'admin');
 $cidReset = true;
 require_once '../inc/global.inc.php';
 
@@ -54,10 +58,6 @@ $this_page = '';
 
 api_protect_admin_script();
 
-require_once api_get_path(LIBRARY_PATH).'WCAG/WCAG_rendering.php';
-require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
-require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
-
 $htmlHeadXtra[] = '<script>
 $(function() {
     $("#all_langs").change(function() {
@@ -78,10 +78,17 @@ $tbl_category = Database::get_main_table(TABLE_MAIN_CATEGORY);
 $tool_name = get_lang('ConfigureHomePage');
 $_languages = api_get_languages();
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = array(
+	'url' => 'index.php',
+	'name' => get_lang('PlatformAdmin')
+);
 
 if (!empty($action)) {
-	$interbreadcrumb[] = array('url' => 'configure_homepage.php', 'name' => get_lang('ConfigureHomePage'));
+	$interbreadcrumb[] = array(
+		'url' => 'configure_homepage.php',
+		'name' => get_lang('ConfigureHomePage')
+	);
+
 	switch ($action) {
 		case 'edit_top':
 			$tool_name = get_lang('EditHomePage');
@@ -134,6 +141,8 @@ if (!empty($_SESSION['user_language_choice'])) {
 	$lang = api_get_setting('platformLanguage');
 }
 
+$languageGet = isset($_GET['language']) ? Security::remove_XSS($_GET['language']) : $lang;
+
 // Ensuring availability of main files in the corresponding language
 
 if (api_is_multiple_url_enabled()) {
@@ -165,36 +174,34 @@ $noticef = 'home_notice'; //noticef for Notice File
 $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
+// faster than hardcoded strings
 $homef = array($menuf, $newsf, $topf, $noticef, $menutabs, $mtloggedin);
 
 // If language-specific file does not exist, create it by copying default file
 foreach ($homef as $my_file) {
-    if (api_is_multiple_url_enabled()) {
-        if (!file_exists($homep_new.$my_file.'_'.$lang.$ext)) {
-            if (!file_exists($homep.$my_file.$ext)) {
-                touch($homep.$my_file.$ext);
-            }
-            @copy($homep.$my_file.$ext, $homep_new.$my_file.'_'.$lang.$ext);
-        }
-    } else {
-        if (!file_exists($homep.$my_file.'_'.$lang.$ext)) {
-            if (!file_exists($homep.$my_file.$ext)) {
-                touch($homep.$my_file.$ext);
-            }
-            @copy($homep.$my_file.$ext, $homep.$my_file.'_'.$lang.$ext);
-        }
-    }
+	if (api_is_multiple_url_enabled()) {
+		if (!file_exists($homep_new.$my_file.'_'.$lang.$ext)) {
+			if (!file_exists($homep.$my_file.$ext)) {
+				touch($homep.$my_file.$ext);
+			}
+			@copy($homep.$my_file.$ext, $homep_new.$my_file.'_'.$lang.$ext);
+		}
+	} else {
+		if (!file_exists($homep.$my_file.'_'.$lang.$ext)) {
+			if (!file_exists($homep.$my_file.$ext)) {
+				touch($homep.$my_file.$ext);
+			}
+			@copy($homep.$my_file.$ext, $homep.$my_file.'_'.$lang.$ext);
+		}
+	}
 }
+
 if (api_is_multiple_url_enabled()) {
-    $homep = $homep_new;
+	$homep = $homep_new;
 }
 
 // Check WCAG settings and prepare edition using WCAG
 $errorMsg = '';
-if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
-	$errorMsg = WCAG_Rendering::request_validation();
-}
 
 // Filter link param
 $link = '';
@@ -216,33 +223,25 @@ if (!empty($action)) {
 		switch ($action) {
 			case 'edit_top':
 				// Filter
-				$home_top = '';
-				if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
-					$home_top = WCAG_Rendering::prepareXHTML();
-				} else {
-					$home_top = trim(stripslashes($_POST['home_top']));
-				}
+				$home_top = trim(stripslashes($_POST['home_top']));
 
 				// Write
-				if (file_exists($homep.$topf.'_'.$lang.$ext)) {
+				if (is_writable($homep)) {
+					// Default
 					if (is_writable($homep.$topf.'_'.$lang.$ext)) {
 						$fp = fopen($homep.$topf.'_'.$lang.$ext, 'w');
 						fputs($fp, $home_top);
 						fclose($fp);
 
-                    foreach ($_languages['name'] as $key => $value) {
-                        $lang_name = $_languages['folder'][$key];
-                        if (isset($_POST[$lang_name])) {
-                            if (file_exists($homep.$topf.'_'.$lang_name.$ext)) {
-                                if (is_writable($homep.$topf.'_'.$lang_name.$ext)) {
-                                    $fp = fopen($homep.$topf.'_'.$lang_name.$ext, 'w');
-                                    fputs($fp, $home_top);
-                                    fclose($fp);
-                                }
-                            }
-                        }
-                    }
-
+						// Language
+						foreach ($_languages['name'] as $key => $value) {
+							$lang_name = $_languages['folder'][$key];
+							if (isset($_POST[$lang_name])) {
+								$fp = fopen($homep.$topf.'_'.$lang_name.$ext, 'w');
+								fputs($fp, $home_top);
+								fclose($fp);
+							}
+						}
 					} else {
 						$errorMsg = get_lang('HomePageFilesNotWritable');
 					}
@@ -252,22 +251,28 @@ if (!empty($action)) {
 					fputs($fp, $home_top);
 					fclose($fp);
 
-                    foreach ($_languages['name'] as $key => $value) {
-                        $lang_name = $_languages['folder'][$key];
-                        if (isset($_POST[$lang_name])) {
-                            if (file_exists($homep.$topf.'_'.$lang_name.$ext)) {
-                                $fp = fopen($homep.$topf.'_'.$lang_name.$ext, 'w');
-                                fputs($fp, $home_top);
-                                fclose($fp);
-                            }
-                        }
-                    }
-                }
-
-                if (EventsMail::check_if_using_class('portal_homepage_edited')) {
-                    EventsDispatcher::events('portal_homepage_edited',array('about_user' => api_get_user_id()));
-                }
-                event_system(LOG_HOMEPAGE_CHANGED, 'edit_top', cut(strip_tags($home_top), 254), api_get_utc_datetime(), api_get_user_id());
+					foreach ($_languages['name'] as $key => $value) {
+						$lang_name = $_languages['folder'][$key];
+						if (isset($_POST[$lang_name])) {
+							if (file_exists($homep.$topf.'_'.$lang_name.$ext)) {
+								$fp = fopen($homep.$topf.'_'.$lang_name.$ext, 'w');
+								fputs($fp, $home_top);
+								fclose($fp);
+							}
+						}
+					}
+				}
+
+				if (EventsMail::check_if_using_class('portal_homepage_edited')) {
+					EventsDispatcher::events('portal_homepage_edited',array('about_user' => api_get_user_id()));
+				}
+				Event::addEvent(
+					LOG_HOMEPAGE_CHANGED,
+					'edit_top',
+					cut(strip_tags($home_top), 254),
+					api_get_utc_datetime(),
+					api_get_user_id()
+				);
 				break;
 			case 'edit_notice':
 				// Filter
@@ -283,32 +288,32 @@ if (!empty($action)) {
 						if ($errorMsg == '') {
 							fputs($fp, "<b>$notice_title</b><br />\n$notice_text");
 
-                            foreach ($_languages['name'] as $key => $value) {
-                                $lang_name = $_languages['folder'][$key];
-                                if (isset($_POST[$lang_name])) {
-                                    if (file_exists($homep.$noticef.'_'.$lang_name.$ext)) {
-                                        if (is_writable($homep.$noticef.'_'.$lang_name.$ext)) {
-                                            $fp = fopen($homep.$noticef.'_'.$lang_name.$ext, 'w');
-                                            fputs($fp, "<b>$notice_title</b><br />\n$notice_text");
-                                            fclose($fp);
-                                        }
-                                    }
-                                }
-                            }
-                        } else {
+							foreach ($_languages['name'] as $key => $value) {
+								$lang_name = $_languages['folder'][$key];
+								if (isset($_POST[$lang_name])) {
+									if (file_exists($homep.$noticef.'_'.$lang_name.$ext)) {
+										if (is_writable($homep.$noticef.'_'.$lang_name.$ext)) {
+											$fp = fopen($homep.$noticef.'_'.$lang_name.$ext, 'w');
+											fputs($fp, "<b>$notice_title</b><br />\n$notice_text");
+											fclose($fp);
+										}
+									}
+								}
+							}
+						} else {
 							fputs($fp, '');
 
-                            foreach ($_languages['name'] as $key => $value) {
-                                $lang_name = $_languages['folder'][$key];
-                                if (isset($_POST[$lang_name])) {
-                                    if (file_exists($homep.$noticef.'_'.$lang_name.$ext)) {
-                                        $fp1 = fopen($homep.$noticef.'_'.$lang_name.$ext, 'w');
-                                        fputs($fp1, '');
-                                        fclose($fp1);
-                                    }
-                                }
-                            }
-                        }
+							foreach ($_languages['name'] as $key => $value) {
+								$lang_name = $_languages['folder'][$key];
+								if (isset($_POST[$lang_name])) {
+									if (file_exists($homep.$noticef.'_'.$lang_name.$ext)) {
+										$fp1 = fopen($homep.$noticef.'_'.$lang_name.$ext, 'w');
+										fputs($fp1, '');
+										fclose($fp1);
+									}
+								}
+							}
+						}
 						fclose($fp);
 					} else {
 						$errorMsg .= "<br/>\n".get_lang('HomePageFilesNotWritable');
@@ -319,16 +324,12 @@ if (!empty($action)) {
 					fputs($fp, "<b>$notice_title</b><br />\n$notice_text");
 					fclose($fp);
 				}
-                event_system(LOG_HOMEPAGE_CHANGED, 'edit_notice', cut(strip_tags($notice_title), 254), api_get_utc_datetime(), api_get_user_id());
+				Event::addEvent(LOG_HOMEPAGE_CHANGED, 'edit_notice', cut(strip_tags($notice_title), 254), api_get_utc_datetime(), api_get_user_id());
 				break;
 			case 'edit_news':
 				//Filter
-				//$s_languages_news=$_POST["news_languages"]; // TODO: Why this line has been disabled?
-				if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
-					$home_news = WCAG_rendering::prepareXHTML();
-				} else {
-					$home_news = trim(stripslashes($_POST['home_news']));
-				}
+				$home_news = trim(stripslashes($_POST['home_news']));
+
 				//Write
 				if ($s_languages_news != 'all') {
 					if (file_exists($homep.$newsf.'_'.$s_languages_news.$ext)) {
@@ -365,7 +366,7 @@ if (!empty($action)) {
 						}
 					}
 				}
-                event_system(LOG_HOMEPAGE_CHANGED, 'edit_news', strip_tags(cut($home_news, 254)), api_get_utc_datetime(), api_get_user_id());
+				Event::addEvent(LOG_HOMEPAGE_CHANGED, 'edit_news', strip_tags(cut($home_news, 254)), api_get_utc_datetime(), api_get_user_id());
 				break;
 			case 'insert_tabs':
 			case 'edit_tabs':
@@ -375,15 +376,8 @@ if (!empty($action)) {
 				$insert_where   = intval($_POST['insert_where']);
 				$link_name      = trim(stripslashes($_POST['link_name']));
 				$link_url       = trim(stripslashes($_POST['link_url']));
-                $add_in_tab     = intval($_POST['add_in_tab']);
-
-				// WCAG
-				if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
-					$link_html = WCAG_Rendering::prepareXHTML();
-				} else {
-					$link_html = trim(stripslashes($_POST['link_html']));
-				}
-
+				$add_in_tab     = intval($_POST['add_in_tab']);
+				$link_html = trim(stripslashes($_POST['link_html']));
 				$filename = trim(stripslashes($_POST['filename']));
 				$target_blank = $_POST['target_blank'] ? true : false;
 
@@ -437,33 +431,33 @@ if (!empty($action)) {
 						// If the file doesn't exist, then create it and
 						// fill it with default text
 
-                        $fp = @fopen($homep.$filename, 'w');
-                        if ($fp) {
-                            if (empty($link_html)) {
-                                fputs($fp, get_lang('MyTextHere'));
-                                home_tabs($homep.$filename);
-                            } else {
-                            	fputs($fp, $link_html);
-                            	home_tabs($homep.$filename);
-                            }
-                            fclose($fp);
-                        }
+						$fp = @fopen($homep.$filename, 'w');
+						if ($fp) {
+							if (empty($link_html)) {
+								fputs($fp, get_lang('MyTextHere'));
+								home_tabs($homep.$filename);
+							} else {
+								fputs($fp, $link_html);
+								home_tabs($homep.$filename);
+							}
+							fclose($fp);
+						}
 					}
 					// 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)) {
-						  $fp = @fopen($homep.$filename, 'w');
-						  if ($fp) {
-							 fputs($fp, $link_html);
-							 home_tabs($homep.$filename);
-							 fclose($fp);
-						  }
+						$fp = @fopen($homep.$filename, 'w');
+						if ($fp) {
+							fputs($fp, $link_html);
+							home_tabs($homep.$filename);
+							fclose($fp);
+						}
 					}
 
-                    $class_add_in_tab = 'class="show_menu"';
-                    if (!$add_in_tab) {
-                        $class_add_in_tab = 'class="hide_menu"';
-                    }
+					$class_add_in_tab = 'class="show_menu"';
+					if (!$add_in_tab) {
+						$class_add_in_tab = 'class="hide_menu"';
+					}
 
 					// If the requested action is to create a link, make some room
 					// for the new link in the home_menu array at the requested place
@@ -491,15 +485,15 @@ if (!empty($action)) {
 							home_tabs($homep.$menuf.'_'.$lang.$ext);
 							fclose($fp);
 
-                            foreach ($_languages['name'] as $key => $value) {
-                                $lang_name = $_languages['folder'][$key];
-                                if (isset($_POST[$lang_name])) {
-                                    $fp = fopen($homep.$menuf.'_'.$lang_name.$ext, 'w');
-                                    fputs($fp, $home_menu);
-                                    home_tabs($homep.$menuf.'_'.$lang_name.$ext);
-                                    fclose($fp);
-                                }
-                            }
+							foreach ($_languages['name'] as $key => $value) {
+								$lang_name = $_languages['folder'][$key];
+								if (isset($_POST[$lang_name])) {
+									$fp = fopen($homep.$menuf.'_'.$lang_name.$ext, 'w');
+									fputs($fp, $home_menu);
+									home_tabs($homep.$menuf.'_'.$lang_name.$ext);
+									fclose($fp);
+								}
+							}
 
 							if (file_exists($homep.$menuf.$ext)) {
 								if (is_writable($homep.$menuf.$ext)) {
@@ -519,23 +513,29 @@ if (!empty($action)) {
 						home_tabs($homep.$menuf.'_'.$lang.$ext);
 						fclose($fp);
 
-                        foreach ($_languages['name'] as $key => $value) {
-                            $lang_name = $_languages['folder'][$key];
-                            if (isset($_POST[$lang_name])) {
-                                $fp = fopen($homep.$menuf.'_'.$lang_name.$ext, 'w');
-                                fputs($fp, $home_menu);
-                                home_tabs($homep.$menuf.'_'.$lang_name.$ext);
-                                fclose($fp);
-                            }
-                        }
-                    }
+						foreach ($_languages['name'] as $key => $value) {
+							$lang_name = $_languages['folder'][$key];
+							if (isset($_POST[$lang_name])) {
+								$fp = fopen($homep.$menuf.'_'.$lang_name.$ext, 'w');
+								fputs($fp, $home_menu);
+								home_tabs($homep.$menuf.'_'.$lang_name.$ext);
+								fclose($fp);
+							}
+						}
+					}
 				}
-                event_system(LOG_HOMEPAGE_CHANGED, $action, cut($link_name.':'.$link_url, 254), api_get_utc_datetime(), api_get_user_id());
+				Event::addEvent(
+					LOG_HOMEPAGE_CHANGED,
+					$action,
+					cut($link_name . ':' . $link_url, 254),
+					api_get_utc_datetime(),
+					api_get_user_id()
+				);
 				break;
 		} //end of switch($action)
 
 		if (empty($errorMsg)) {
-			header('Location: '.api_get_self());
+			header('Location: '.api_get_self().'?language='.$languageGet);
 			exit();
 		}
 	} else {
@@ -651,7 +651,7 @@ if (!empty($action)) {
 				} elseif (is_file($homep.$mtloggedin.$lang.$ext) && is_readable($homep.$mtloggedin.$lang.$ext)) {
 					$home_menu = @file($homep.$mtloggedin.$lang.$ext);
 				} elseif (touch($homep.$mtloggedin.'_'.$lang.$ext)) {
-                    $home_menu = @file($homep.$mtloggedin.'_'.$lang.$ext);
+					$home_menu = @file($homep.$mtloggedin.'_'.$lang.$ext);
 				} else {
 					$errorMsg = get_lang('HomePageFilesNotReadable');
 				}
@@ -678,11 +678,11 @@ if (!empty($action)) {
 					$errorMsg = get_lang('HomePageFilesNotReadable');
 				}
 
-                if (empty($home_menu)) {
-                    if (file_exists($homep.$menutabs.'_'.$lang.$ext)) {
-                        $home_menu = @file($homep.$menutabs.'_'.$lang.$ext);
-                    }
-                }
+				if (empty($home_menu)) {
+					if (file_exists($homep.$menutabs.'_'.$lang.$ext)) {
+						$home_menu = @file($homep.$menutabs.'_'.$lang.$ext);
+					}
+				}
 
 				if (empty($home_menu)) {
 					$home_menu = array();
@@ -723,11 +723,11 @@ if (!empty($action)) {
 							$target_blank = true;
 						}
 
-                        if (strstr($enreg, 'hide_menu')) {
+						if (strstr($enreg, 'hide_menu')) {
 							$add_in_tab = false;
 						} else {
-                            $add_in_tab = true;
-                        }
+							$add_in_tab = true;
+						}
 
 						// Remove dangerous HTML tags from the link itself (this is an
 						// additional measure in case a link previously contained
@@ -782,32 +782,32 @@ switch ($action) {
 		// Display for edit_notice case
 		?>
 		<form action="<?php echo api_get_self(); ?>?action=<?php echo $action; ?>" method="post" style="margin:0px;">
-		<legend><?php echo $tool_name; ?></legend>
-		<input type="hidden" name="formSent" value="1"/>
-		<?php
-		if (!empty($errorMsg)) {
-			Display::display_normal_message($errorMsg);
-		}
-		?>
-		<table border="0" cellpadding="5" cellspacing="0">
-		<tr><td colspan="2"><?php echo '<span style="font-style: italic;">'.get_lang('LetThoseFieldsEmptyToHideTheNotice').'</span>'; ?></tr>
-		<tr>
-		  <td nowrap="nowrap"><?php echo get_lang('NoticeTitle'); ?> :</td>
-		  <td><input type="text" name="notice_title" size="30" maxlength="50" value="<?php echo $notice_title; ?>" style="width: 350px;"/></td>
-		</tr>
-		<tr>
-		  <td nowrap="nowrap" valign="top"><?php echo get_lang('NoticeText'); ?> :</td>
-		  <td><textarea name="notice_text" cols="30" rows="5" wrap="virtual" style="width: 350px;"><?php echo $notice_text; ?></textarea></td>
-		</tr>
-        <tr>
-          <td><label><?php echo get_lang('ApplyAllLanguages'); ?></label>
-          <td><input type="checkbox" name="all_langs" value="<?php echo get_lang('ApplyAllLanguages'); ?>"/></td>
-        </tr>
-		<tr>
-		  <td>&nbsp;</td>
-		  <td><button class="save" type="submit" value="<?php echo get_lang('Ok'); ?>"><?php echo get_lang('Ok'); ?></button></td>
-		</tr>
-		</table>
+			<legend><?php echo $tool_name; ?></legend>
+			<input type="hidden" name="formSent" value="1"/>
+			<?php
+			if (!empty($errorMsg)) {
+				Display::display_normal_message($errorMsg);
+			}
+			?>
+			<table border="0" cellpadding="5" cellspacing="0">
+				<tr><td colspan="2"><?php echo '<span style="font-style: italic;">'.get_lang('LetThoseFieldsEmptyToHideTheNotice').'</span>'; ?></tr>
+				<tr>
+					<td nowrap="nowrap"><?php echo get_lang('NoticeTitle'); ?> :</td>
+					<td><input type="text" name="notice_title" size="30" maxlength="50" value="<?php echo $notice_title; ?>" style="width: 350px;"/></td>
+				</tr>
+				<tr>
+					<td nowrap="nowrap" valign="top"><?php echo get_lang('NoticeText'); ?> :</td>
+					<td><textarea name="notice_text" cols="30" rows="5" wrap="virtual" style="width: 350px;"><?php echo $notice_text; ?></textarea></td>
+				</tr>
+				<tr>
+					<td><label><?php echo get_lang('ApplyAllLanguages'); ?></label>
+					<td><input type="checkbox" name="all_langs" value="<?php echo get_lang('ApplyAllLanguages'); ?>"/></td>
+				</tr>
+				<tr>
+					<td>&nbsp;</td>
+					<td><button class="save" type="submit" value="<?php echo get_lang('Ok'); ?>"><?php echo get_lang('Ok'); ?></button></td>
+				</tr>
+			</table>
 		</form>
 		<?php
 		break;
@@ -815,7 +815,7 @@ switch ($action) {
 	case 'edit_tabs':
 	case 'insert_link':
 	case 'edit_link':
-       $menuf = ($action == 'insert_tabs' || $action == 'edit_tabs') ? $mtloggedin : $menuf;
+		$menuf = ($action == 'insert_tabs' || $action == 'edit_tabs') ? $mtloggedin : $menuf;
 		if (!empty($errorMsg)) {
 			Display::display_normal_message($errorMsg);
 		}
@@ -830,74 +830,65 @@ switch ($action) {
 
 		$form->addElement('text', 'link_name', get_lang('LinkName'), array('size' => '30', 'maxlength' => '50'));
 		if (!empty($link_name)) {
-        $default['link_name'] = $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;'));
-        
-        $options = array('-1' => get_lang('FirstPlace'));
+		$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;'));
+
+		$options = array('-1' => get_lang('FirstPlace'));
 
 		$selected = '';
 
 		if ($action == 'insert_link' || $action == 'insert_tabs') {
-            $add_in_tab = 1;
+			$add_in_tab = 1;
 			if (is_array($home_menu)){
 				foreach ($home_menu as $key => $enreg) {
 					if (strlen($enreg = trim(strip_tags($enreg))) > 0) {
-                        $options[$key] = get_lang('After').' &quot;'.$enreg.'&quot;';
-                        $formSentCheck = (!empty($_POST['formSent']) ? true : false);
-                        $selected = $formSentCheck && $insert_where == $key ? $key : '';
+						$options[$key] = get_lang('After').' &quot;'.$enreg.'&quot;';
+						$formSentCheck = (!empty($_POST['formSent']) ? true : false);
+						$selected = $formSentCheck && $insert_where == $key ? $key : '';
 					}
 				}
 			}
-            $default['insert_link'] = $selected;
-            $form->addElement('select', 'insert_where', get_lang('InsertThisLink') , $options);
+			$default['insert_link'] = $selected;
+			$form->addElement('select', 'insert_where', get_lang('InsertThisLink') , $options);
 		}
 
 		$target_blank_checkbox = $form->addElement('checkbox', 'target_blank', null, get_lang('OpenInNewWindow'), 1);
 
-        if ($action == 'insert_tabs' || $action == 'edit_tabs') {
-            $form->addElement('checkbox', 'add_in_tab', null, get_lang('AddInMenu'), 1);
-            $default['add_in_tab'] = $add_in_tab;
-        }
+		if ($action == 'insert_tabs' || $action == 'edit_tabs') {
+			$form->addElement('checkbox', 'add_in_tab', null, get_lang('AddInMenu'), 1);
+			$default['add_in_tab'] = $add_in_tab;
+		}
 
 		if (!empty($target_blank)) { $target_blank_checkbox->setChecked(true); }
 
 		if ($action == 'edit_link' && (empty($link_url) || $link_url == 'http://' || $link_url == 'https://')) {
-			if (api_get_setting('wcag_anysurfer_public_pages')=='true') {
-				$form->addElement('html', WCAG_Rendering::create_xhtml(isset($_POST['link_html'])?$_POST['link_html']:$link_html));
-			} else {
-				$default['link_html'] = isset($_POST['link_html']) ? $_POST['link_html'] : $link_html;
-				$form->add_html_editor('link_html', get_lang('Content'), false, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400'));
-			}
+			$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->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
 		} else {
-            if (in_array($action, array('edit_tabs','insert_tabs'))) {
-                if (api_get_setting('wcag_anysurfer_public_pages')=='true') {
-                    $form->addElement('html', get_lang('Content').' ('.get_lang('Optional').')');
-                    $form->addElement('html', WCAG_Rendering::create_xhtml(isset($_POST['link_html'])?$_POST['link_html']:(!empty($link_html) ? $link_html : '')));
-                } else {
-                    $default['link_html'] = isset($_POST['link_html']) ? $_POST['link_html'] : (!empty($link_html) ? $link_html : '');
-                    $form->add_html_editor('link_html', get_lang('Content'), false, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400'));
-                }
-            }
-            $form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'), array('id' => 'all_langs'));
-            $form->addElement('html','<table id="table_langs" style="margin-left:159px;"><tr>');
-            $i = 0;
-            foreach ($_languages['name'] as $key => $value) {
-                $i++;
-                $lang_name = $_languages['folder'][$key];
-                $html_langs = '<td width="300">';
-                $html_langs .= '<label><input type="checkbox" id="lang" name="'.$lang_name.'" />&nbsp;'.$lang_name.'<label/>';
-                $html_langs .= '</td>';
-                if ($i%5 == 0) {
-                $html_langs .= '</tr><tr>';
-                }
-                $form->addElement('html', $html_langs);
-            }
-            $form->addElement('html','</tr></table><br/>');
-      		$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
+			if (in_array($action, array('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->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'), array('id' => 'all_langs'));
+			$form->addElement('html','<table id="table_langs" style="margin-left:159px;"><tr>');
+			$i = 0;
+			foreach ($_languages['name'] as $key => $value) {
+				$i++;
+				$lang_name = $_languages['folder'][$key];
+				$html_langs = '<td width="300">';
+				$html_langs .= '<label><input type="checkbox" id="lang" name="'.$lang_name.'" />&nbsp;'.$lang_name.'<label/>';
+				$html_langs .= '</td>';
+				if ($i % 5 == 0) {
+					$html_langs .= '</tr><tr>';
+				}
+				$form->addElement('html', $html_langs);
+			}
+			$form->addElement('html','</tr></table><br/>');
+			$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
 		}
 
 		$form->setDefaults($default);
@@ -920,7 +911,13 @@ switch ($action) {
 		}
 
 		$default = array();
-		$form = new FormValidator('configure_homepage_'.$action, 'post', api_get_self().'?action='.$action, '', array('style' => 'margin: 0px;'));
+		$form = new FormValidator(
+			'configure_homepage_'.$action,
+			'post',
+			api_get_self().'?action='.$action,
+			'',
+			array('style' => 'margin: 0px;')
+		);
 		$renderer =& $form->defaultRenderer();
 		$renderer->setHeaderTemplate('');
 		$renderer->setFormTemplate('<form{attributes}><table border="0" cellpadding="5" cellspacing="0" width="100%">{content}</table></form>');
@@ -944,34 +941,31 @@ switch ($action) {
 			$html .= '</select></td></tr>';
 			$form->addElement('html', $html);
 		}
-		if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
-			//TODO: review these lines
-			// Print WCAG-specific HTML editor
-			$html = '<tr><td>';
-			$html .= WCAG_Rendering::create_xhtml($open);
-			$html .= '</td></tr>';
-			$form->addElement('html', $html);
-		} else {
-			$default[$name] = str_replace('{rel_path}', api_get_path(REL_PATH), $open);
-			$form->add_html_editor($name, '', true, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400'));
+
+		$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->addElement('html','<table id="table_langs" style="margin-left:5px;"><tr>');
+
+		$currentLanguage = api_get_interface_language();
+		$i = 0;
+		foreach ($_languages['name'] as $key => $value) {
+			$lang_name = $_languages['folder'][$key];
+			$i++;
+
+			$checked = null;
+			if ($languageGet == $lang_name)  {
+				$checked = "checked";
+			}
+			$html_langs = '<td width="300">';
+			$html_langs .= '<label><input type="checkbox" '.$checked.' id="lang" name="'.$lang_name.'" />&nbsp;'.$value.'<label/>';
+			$html_langs .= '</td>';
+			if ($i % 5 == 0) {
+				$html_langs .= '</tr><tr>';
+			}
+			$form->addElement('html', $html_langs);
 		}
-        $form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'),array('id' => 'all_langs'));
-        $form->addElement('html','<table id="table_langs" style="margin-left:5px;"><tr>');
-        $i = 0;
-        foreach ($_languages['name'] as $key => $value) {
-            $i++;
-            $lang_name = $_languages['folder'][$key];
-			//if (file_exists($homep.$topf.'_'.$lang_name.$ext)) {
-                $html_langs = '<td width="300">';
-                $html_langs .= '<label><input type="checkbox" id="lang" name="'.$lang_name.'" />&nbsp;'.$lang_name.'<label/>';
-                $html_langs .= '</td>';
-                if($i%5 == 0) {
-                    $html_langs .= '</tr><tr>';
-                }
-                $form->addElement('html', $html_langs);
-			//}
-        }
-        $form->addElement('html','</tr></table><br/>');
+		$form->addElement('html','</tr></table><br/>');
 		$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
 		$form->setDefaults($default);
 		$form->display();
@@ -980,208 +974,211 @@ switch ($action) {
 	default: // When no action applies, default page to update campus homepage
 		?>
 		<table border="0" cellpadding="5" cellspacing="0" width="100%">
-		<tr>
-		  <td width="70%" valign="top">
-		  	<div class="actions">
-			<a href="<?php echo api_get_self(); ?>?action=edit_top"><?php Display::display_icon('edit.gif', get_lang('EditHomePage')); ?></a>
-			<a href="<?php echo api_get_self(); ?>?action=edit_top"><?php echo get_lang('EditHomePage'); ?></a>
-		  	</div>
-
-			<table border="0" cellpadding="5" cellspacing="0" width="100%">
-			<tr>
-			  <td colspan="2">
-				<?php
-					//print home_top contents
-					if (file_exists($homep.$topf.'_'.$lang.$ext)) {
-						$home_top_temp = @(string)file_get_contents($homep.$topf.'_'.$lang.$ext);
-					} else {
-						$home_top_temp = @(string)file_get_contents($homep.$topf.$ext);
-					}
-					$open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp);
-					$open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
-					echo $open;
-				?>
-			  </td>
-			</tr>
 			<tr>
-			<?php
-
-			$access_url_id = 1;
-			// we only show the category options for the main chamilo installation
-			if (api_is_multiple_url_enabled()) {
-				$access_url_id = api_get_current_access_url_id();
-			}
-			echo '<td width="50%">';
-			if ($access_url_id == 1) {
-				echo '<div class="actions">';
-				echo '<a href="course_category.php">'.Display::display_icon('edit.gif', get_lang('Edit')).'</a>
+				<td width="70%" valign="top">
+					<div class="actions">
+						<a href="<?php echo api_get_self(); ?>?action=edit_top&language=<?php echo $languageGet; ?>">
+							<?php Display::display_icon('edit.gif', get_lang('EditHomePage')); ?>
+						</a>
+						<a href="<?php echo api_get_self(); ?>?action=edit_top&language=<?php echo $languageGet; ?>">
+							<?php echo get_lang('EditHomePage'); ?>
+						</a>
+					</div>
+
+					<table border="0" cellpadding="5" cellspacing="0" width="100%">
+						<tr>
+							<td colspan="2">
+								<?php
+								//print home_top contents
+								if (file_exists($homep.$topf.'_'.$lang.$ext)) {
+									$home_top_temp = @(string)file_get_contents($homep.$topf.'_'.$lang.$ext);
+								} else {
+									$home_top_temp = @(string)file_get_contents($homep.$topf.$ext);
+								}
+								$open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp);
+								$open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
+								echo $open;
+								?>
+							</td>
+						</tr>
+						<tr>
+							<?php
+
+							$access_url_id = 1;
+							// we only show the category options for the main chamilo installation
+							if (api_is_multiple_url_enabled()) {
+								$access_url_id = api_get_current_access_url_id();
+							}
+							echo '<td width="50%">';
+							if ($access_url_id == 1) {
+								echo '<div class="actions">';
+								echo '<a href="course_category.php">'.Display::display_icon('edit.gif', get_lang('Edit')).'</a>
 					  <a href="course_category.php">'.get_lang('EditCategories').'</a>';
-				echo '</div>';
-			}
-			echo '</td>
+								echo '</div>';
+							}
+							echo '</td>
 				  <td width="50%">
 				  <br />';
-			/* <!--<a href="<?php echo api_get_self(); ?>?action=edit_news"><?php Display::display_icon('edit.gif', get_lang('Edit')); ?></a> <a href="<?php echo api_get_self(); ?>?action=edit_news"><?php echo get_lang('EditNews'); ?></a>--> */
-			echo '</td></tr>
+							/* <!--<a href="<?php echo api_get_self(); ?>?action=edit_news"><?php Display::display_icon('edit.gif', get_lang('Edit')); ?></a> <a href="<?php echo api_get_self(); ?>?action=edit_news"><?php echo get_lang('EditNews'); ?></a>--> */
+							echo '</td></tr>
 				<tr>
 				<td width="50%" valign="top">
 				<table border="0" cellpadding="5" cellspacing="0" width="100%">';
-				if ($access_url_id == 1) {
-					if (sizeof($Categories)) {
-						foreach ($Categories as $enreg) {
-							echo '<tr><td>'.Display::return_icon('folder_document.gif', $enreg['name']).'&nbsp;'.$enreg['name'].'</td></tr>';
-						}
-						unset($Categories);
-					} else {
-						echo get_lang('NoCategories');
-					}
-				}
+							if ($access_url_id == 1) {
+								if (sizeof($Categories)) {
+									foreach ($Categories as $enreg) {
+										echo '<tr><td>'.Display::return_icon('folder_document.gif', $enreg['name']).'&nbsp;'.$enreg['name'].'</td></tr>';
+									}
+									unset($Categories);
+								} else {
+									echo get_lang('NoCategories');
+								}
+							}
 
-				echo '</table>';
-				?>
-			  </td>
-			  <!--<td width="50%" valign="top">
+							echo '</table>';
+							?>
+							</td>
+							<!--<td width="50%" valign="top">
 				<?php
-				if (file_exists($homep.$newsf.'_'.$lang.$ext)) {
-					$open = @(string)file_get_contents($homep.$newsf.'_'.$lang.$ext);
-					$open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
-					echo $open;
-				} else {
-					$open = @(string)file_get_contents($homep.$newsf.$ext);
-					$open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
-					echo $open;
-				}
-			?>
+							if (file_exists($homep.$newsf.'_'.$lang.$ext)) {
+								$open = @(string)file_get_contents($homep.$newsf.'_'.$lang.$ext);
+								$open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
+								echo $open;
+							} else {
+								$open = @(string)file_get_contents($homep.$newsf.$ext);
+								$open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
+								echo $open;
+							}
+							?>
 			  </td>-->
-			</tr>
-			</table>
-			<?php
+						</tr>
+					</table>
+					<?php
 
-			// Add new page
-
-			$home_menu = '';
-
-            if (file_exists($homep.$mtloggedin.'_'.$lang.$ext)) {
-                $home_menu = @file($homep.$mtloggedin.'_'.$lang.$ext);
-            } else {
-                $home_menu = @file($homep.$mtloggedin.$ext);
-            }
-
-            if (empty($home_menu)) {
-                if (file_exists($homep.$menutabs.'_'.$lang.$ext)) {
-                    $home_menu = @file($homep.$menutabs.'_'.$lang.$ext);
-                }
-            }
-
-            if (empty($home_menu)) {
-                $home_menu = array();
-            }
-
-            if (!empty($home_menu)) {
-                $home_menu = implode("\n", $home_menu);
-                $home_menu = api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu)));
-                $home_menu = explode("\n", $home_menu);
-            }
-            $link_list = '';
-            $tab_counter = 0;
-            foreach ($home_menu as $enreg) {
-                $enreg = trim($enreg);
-                if (!empty($enreg)) {
-                    $edit_link   = ' <a href="'.api_get_self().'?action=edit_tabs&amp;link_index='.$tab_counter.'" ><span>'.Display::return_icon('edit.gif', get_lang('Edit')).'</span></a>';
-                    $delete_link = ' <a href="'.api_get_self().'?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.gif', 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(api_get_self()).'?action=open_link&link=', $edit_link.$delete_link.'</li>'),
-                                              $enreg);
-                    $tab_string = str_replace(array('<li>', '</li>','class="hide_menu"', 'hide_menu'), '', $tab_string);
-
-                    $link_list .= Display::tag('tr', Display::tag('td', $tab_string));
-                    $tab_counter++;
-                }
-            }
-            ?>
-            <div class="actions">
-                <a href="<?php echo api_get_self(); ?>?action=insert_tabs"><?php Display::display_icon('addd.gif', get_lang('InsertLink')); echo get_lang('InsertLink'); ?></a>
-            </div>
-            <?php
-            echo '<table class="data_table">';
-            echo $link_list;
-            echo '</table>';
-			?>
-		  </td>
-		  <td width="10%" valign="top"></td>
-		  <td width="20%" rowspan="3" valign="top">
-
-		    <div id="login_block" class="well sidebar-nav">
-                <?php echo api_display_language_form(); ?>
-                <form id="formLogin">
-                    <div><label><?php echo get_lang('LoginName'); ?></label></div>
-                    <div><input type="text" id="login" size="15" value="" disabled="disabled" /></div>
-                    <div><label><?php echo get_lang('UserPassword'); ?></label></div>
-                    <div><input type="password" id="password" size="15" value="" disabled="disabled" /></div>
-                    <div><button class="btn" type="button" name="submitAuth" value="<?php echo get_lang('Ok'); ?>" disabled="disabled"><?php echo get_lang('Ok'); ?></button></div>
-                </form>
-			</div>
-
-			<div id="profile_block" class="well sidebar-nav">
-				<h4><?php echo get_lang('MenuUser'); ?></h4>
-				<ul class="nav nav-list">
-				<li><span style="color: #9D9DA1; font-weight: bold;"><?php echo api_ucfirst(get_lang('Registration')); ?></span></li>
-				<li><span style="color: #9D9DA1; font-weight: bold;"><?php echo api_ucfirst(get_lang('LostPassword')); ?></span></li>
-				</ul>
-			</div>
-
-			<div id="notice_block" class="well sidebar-nav">
-                <h4><?php echo get_lang('Notice'); ?>
-                    <a href="<?php echo api_get_self(); ?>?action=edit_notice"><?php Display::display_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL); ?></a>
-                </h4>
-            <?php
-            $home_notice = '';
-            if (file_exists($homep.$noticef.'_'.$lang.$ext)) {
-                $home_notice = @(string)file_get_contents($homep.$noticef.'_'.$lang.$ext);
-            } else {
-                $home_notice = @(string)file_get_contents($homep.$noticef.$ext);
-            }
-            $home_notice = api_to_system_encoding($home_notice, api_detect_encoding(strip_tags($home_notice)));
-            echo '<div class="homepage_notice">';
-            echo $home_notice;
-            echo '</div>';
-            ?>
-            </div>
-           	<div class="well sidebar-nav">
-                <a href="<?php echo api_get_self(); ?>?action=insert_link"><?php Display::display_icon('addd.gif', get_lang('InsertLink')); ?></a>
-                <a href="<?php echo api_get_self(); ?>?action=insert_link"><?php echo get_lang('InsertLink'); ?></a>
-    			<h4><?php echo api_ucfirst(get_lang('General')); ?></h4>
-    				<ul class="menulist">
-    				<?php
-    					$home_menu = '';
-    					if (file_exists($homep.$menuf.'_'.$lang.$ext)) {
-    						$home_menu = @file($homep.$menuf.'_'.$lang.$ext);
-    					} else {
-    						$home_menu = @file($homep.$menuf.$ext);
-    					}
-    					if (empty($home_menu)) {
-    						$home_menu = array();
-    					}
-    					if (!empty($home_menu)) {
-    						$home_menu = implode("\n", $home_menu);
-    						$home_menu = api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu)));
-    						$home_menu = explode("\n", $home_menu);
-    					}
-    					$i = 0;
-    					foreach ($home_menu as $enreg) {
-    						$enreg = trim($enreg);
-    						if (!empty($enreg)) {
-    							$edit_link = '<a href="'.api_get_self().'?action=edit_link&amp;link_index='.$i.'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
-    							$delete_link = '<a href="'.api_get_self().'?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.gif', 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(api_get_self()).'?action=open_link&link=', '<br />'.$edit_link.' '.$delete_link.'</li>'), $enreg);
-    							$i++;
-    						}
-    					}
-    				?>
-    				</ul>
-			     </div>
-		  </td>
-		</tr>
+					// Add new page
+
+					$home_menu = '';
+
+					if (file_exists($homep.$mtloggedin.'_'.$lang.$ext)) {
+						$home_menu = @file($homep.$mtloggedin.'_'.$lang.$ext);
+					} else {
+						$home_menu = @file($homep.$mtloggedin.$ext);
+					}
+
+					if (empty($home_menu)) {
+						if (file_exists($homep.$menutabs.'_'.$lang.$ext)) {
+							$home_menu = @file($homep.$menutabs.'_'.$lang.$ext);
+						}
+					}
+
+					if (empty($home_menu)) {
+						$home_menu = array();
+					}
+
+					if (!empty($home_menu)) {
+						$home_menu = implode("\n", $home_menu);
+						$home_menu = api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu)));
+						$home_menu = explode("\n", $home_menu);
+					}
+					$link_list = '';
+					$tab_counter = 0;
+					foreach ($home_menu as $enreg) {
+						$enreg = trim($enreg);
+						if (!empty($enreg)) {
+							$edit_link   = ' <a href="'.api_get_self().'?action=edit_tabs&amp;link_index='.$tab_counter.'" ><span>'.Display::return_icon('edit.gif', get_lang('Edit')).'</span></a>';
+							$delete_link = ' <a href="'.api_get_self().'?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.gif', 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(api_get_self()).'?action=open_link&link=', $edit_link.$delete_link.'</li>'),
+								$enreg);
+							$tab_string = str_replace(array('<li>', '</li>','class="hide_menu"', 'hide_menu'), '', $tab_string);
+
+							$link_list .= Display::tag('tr', Display::tag('td', $tab_string));
+							$tab_counter++;
+						}
+					}
+					?>
+					<div class="actions">
+						<a href="<?php echo api_get_self(); ?>?action=insert_tabs"><?php Display::display_icon('addd.gif', get_lang('InsertLink')); echo get_lang('InsertLink'); ?></a>
+					</div>
+					<?php
+					echo '<table class="data_table">';
+					echo $link_list;
+					echo '</table>';
+					?>
+				</td>
+				<td width="10%" valign="top"></td>
+				<td width="20%" rowspan="3" valign="top">
+					<div id="login_block" class="well sidebar-nav">
+						<?php echo api_display_language_form(); ?>
+						<form id="formLogin">
+							<div><label><?php echo get_lang('LoginName'); ?></label></div>
+							<div><input type="text" id="login" size="15" value="" disabled="disabled" /></div>
+							<div><label><?php echo get_lang('UserPassword'); ?></label></div>
+							<div><input type="password" id="password" size="15" value="" disabled="disabled" /></div>
+							<div><button class="btn" type="button" name="submitAuth" value="<?php echo get_lang('Ok'); ?>" disabled="disabled"><?php echo get_lang('Ok'); ?></button></div>
+						</form>
+					</div>
+
+					<div id="profile_block" class="well sidebar-nav">
+						<h4><?php echo get_lang('MenuUser'); ?></h4>
+						<ul class="nav nav-list">
+							<li><span style="color: #9D9DA1; font-weight: bold;"><?php echo api_ucfirst(get_lang('Registration')); ?></span></li>
+							<li><span style="color: #9D9DA1; font-weight: bold;"><?php echo api_ucfirst(get_lang('LostPassword')); ?></span></li>
+						</ul>
+					</div>
+
+					<div id="notice_block" class="well sidebar-nav">
+						<h4><?php echo get_lang('Notice'); ?>
+							<a href="<?php echo api_get_self(); ?>?action=edit_notice"><?php Display::display_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL); ?></a>
+						</h4>
+						<?php
+						$home_notice = '';
+						if (file_exists($homep.$noticef.'_'.$lang.$ext)) {
+							$home_notice = @(string)file_get_contents($homep.$noticef.'_'.$lang.$ext);
+						} else {
+							$home_notice = @(string)file_get_contents($homep.$noticef.$ext);
+						}
+						$home_notice = api_to_system_encoding($home_notice, api_detect_encoding(strip_tags($home_notice)));
+						echo '<div class="homepage_notice">';
+						echo $home_notice;
+						echo '</div>';
+						?>
+					</div>
+					<div class="well sidebar-nav">
+						<a href="<?php echo api_get_self(); ?>?action=insert_link"><?php Display::display_icon('addd.gif', get_lang('InsertLink')); ?></a>
+						<a href="<?php echo api_get_self(); ?>?action=insert_link"><?php echo get_lang('InsertLink'); ?></a>
+						<h4><?php echo api_ucfirst(get_lang('General')); ?></h4>
+						<ul class="menulist">
+							<?php
+							$home_menu = '';
+							if (file_exists($homep.$menuf.'_'.$lang.$ext)) {
+								$home_menu = @file($homep.$menuf.'_'.$lang.$ext);
+							} else {
+								$home_menu = @file($homep.$menuf.$ext);
+							}
+							if (empty($home_menu)) {
+								$home_menu = array();
+							}
+							if (!empty($home_menu)) {
+								$home_menu = implode("\n", $home_menu);
+								$home_menu = api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu)));
+								$home_menu = explode("\n", $home_menu);
+							}
+							$i = 0;
+							foreach ($home_menu as $enreg) {
+								$enreg = trim($enreg);
+								if (!empty($enreg)) {
+									$edit_link = '<a href="'.api_get_self().'?action=edit_link&amp;link_index='.$i.'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
+									$delete_link = '<a href="'.api_get_self().'?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.gif', 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(api_get_self()).'?action=open_link&link=', '<br />'.$edit_link.' '.$delete_link.'</li>'), $enreg);
+									$i++;
+								}
+							}
+							?>
+						</ul>
+					</div>
+				</td>
+			</tr>
 		</table>
 		<?php
 		break;

+ 7 - 25
main/admin/configure_inscription.php

@@ -12,9 +12,6 @@ require_once '../inc/global.inc.php';
 
 api_protect_admin_script();
 
-require_once api_get_path(CONFIGURATION_PATH).'profile.conf.php';
-require_once api_get_path(INCLUDE_PATH).'lib/mail.lib.inc.php';
-
 // Load terms & conditions from the current lang
 if (get_setting('allow_terms_conditions') == 'true') {
     $get = array_keys($_GET);
@@ -118,14 +115,8 @@ if (!empty($action)) {
         switch ($action) {
             case 'edit_top':
                 // Filter
-                $home_top = '';
-                if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
-                    $home_top = WCAG_Rendering::prepareXHTML();
-                } else {
-                    $home_top = trim(stripslashes($_POST['register_top']));
-                }
+                $home_top = trim(stripslashes($_POST['register_top']));
                 // Write
-
                 if (file_exists($homep.$topf.'_'.$lang.$ext)) {
                     if (is_writable($homep.$topf.'_'.$lang.$ext)) {
                         $fp = fopen($homep.$topf.'_'.$lang.$ext, 'w');
@@ -252,16 +243,16 @@ if ($display_all_form) {
 
     //	EXTENDED FIELDS
     if (api_get_setting('extended_profile') == 'true' && api_get_setting('extendedprofile_registration','mycomptetences') == 'true') {
-        $form->add_html_editor('competences', get_lang('MyCompetences'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
+        $form->addHtmlEditor('competences', get_lang('MyCompetences'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
     }
     if (api_get_setting('extended_profile') == 'true' && api_get_setting('extendedprofile_registration','mydiplomas') == 'true') {
-        $form->add_html_editor('diplomas', get_lang('MyDiplomas'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
+        $form->addHtmlEditor('diplomas', get_lang('MyDiplomas'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
     }
     if (api_get_setting('extended_profile') == 'true' && api_get_setting('extendedprofile_registration','myteach') == 'true') {
-        $form->add_html_editor('teach', get_lang('MyTeach'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
+        $form->addHtmlEditor('teach', get_lang('MyTeach'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
     }
     if (api_get_setting('extended_profile') == 'true' && api_get_setting('extendedprofile_registration','mypersonalopenarea') == 'true') {
-        $form->add_html_editor('openarea', get_lang('MyPersonalOpenArea'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
+        $form->addHtmlEditor('openarea', get_lang('MyPersonalOpenArea'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
     }
     if (api_get_setting('extended_profile') == 'true') {
         if (api_get_setting('extendedprofile_registrationrequired', 'mycomptetences') == 'true') {
@@ -364,17 +355,8 @@ switch ($action){
         $renderer->setElementTemplate('<tr><td>{element}</td></tr>');
         $renderer->setRequiredNoteTemplate('');
         $form->addElement('hidden', 'formSent', '1');
-        if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
-            //TODO: review these lines
-            // Print WCAG-specific HTML editor
-            $html = '<tr><td>';
-            $html .= WCAG_Rendering::create_xhtml($open);
-            $html .= '</td></tr>';
-            $form->addElement('html', $html);
-        } else {
-            $default[$name] = str_replace('{rel_path}', api_get_path(REL_PATH), $open);
-            $form->add_html_editor($name, '', true, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400'));
-        }
+        $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('style_submit_button', null, get_lang('Save'), 'class="save"');
         $form->setDefaults($default);
         $form->display();

+ 59 - 32
main/admin/configure_plugin.php

@@ -1,44 +1,44 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
-	@author Julio Montoya <gugli100@gmail.com> BeezNest 2012
-*	@package chamilo.admin
-*/
+ * @author Julio Montoya <gugli100@gmail.com> BeezNest 2012
+ * @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
+ * @package chamilo.admin
+ */
+use \ChamiloSession as Session;
 
 // name of the language file that needs to be included
-$language_file = array ('registration','admin');
+$language_file = array('registration', 'admin');
 $cidReset = true;
 require_once '../inc/global.inc.php';
 
 // Access restrictions
 api_protect_admin_script();
 
-$plugin_name = $_GET['name'];
+$pluginName = $_GET['name'];
 
-$plugin_obj = new AppPlugin();
-$plugin_info = $plugin_obj->getPluginInfo($plugin_name, true);
+$appPlugin = new AppPlugin();
+$installedPlugins = $appPlugin->get_installed_plugins();
+$pluginInfo = $appPlugin->getPluginInfo($pluginName, true);
 
-if (empty($plugin_info)) {
-    api_not_allowed();
-}
-
-$installed_plugins = $plugin_obj->get_installed_plugins();
-
-if (!in_array($plugin_name, $installed_plugins)) {
-    api_not_allowed();
+if (!in_array($pluginName, $installedPlugins) || empty($pluginInfo)) {
+    api_not_allowed(true);
 }
 
 global $_configuration;
+
 $message = null;
 $content = null;
 
-if (isset($plugin_info['settings_form'])) {
-    $form = $plugin_info['settings_form'];
+$currentUrl = api_get_self() . "?name=$pluginName";
+
+if (isset($pluginInfo['settings_form'])) {
+    $form = $pluginInfo['settings_form'];
     if (isset($form)) {
         //We override the form attributes
-        $attributes = array('action'=>api_get_self().'?name='.$plugin_name, 'method'=>'POST');
+        $attributes = array('action' => $currentUrl, 'method' => 'POST');
         $form->updateAttributes($attributes);
-        $content = Display::page_header($plugin_info['title']);
+        $content = Display::page_header($pluginInfo['title']);
         $content .= $form->toHtml();
     }
 } else {
@@ -49,19 +49,28 @@ if (isset($form)) {
     if ($form->validate()) {
         $values = $form->exportValues();
 
-        //api_delete_category_settings_by_subkey($plugin_name);
-        $access_url_id = api_get_current_access_url_id();
-        api_delete_settings_params(array('category = ? AND access_url = ? AND subkey = ? AND type = ? and variable <> ?' =>
-                                    array('Plugins', $access_url_id, $plugin_name, 'setting', "status")));
+        //api_delete_category_settings_by_subkey($pluginName);
+        $accessUrlId = api_get_current_access_url_id();
+
+        api_delete_settings_params(
+            array(
+                'category = ? AND access_url = ? AND subkey = ? AND type = ? and variable <> ?' => array(
+                    'Plugins',
+                    $accessUrlId,
+                    $pluginName,
+                    'setting',
+                    "status"
+                )
+            )
+        );
+
         foreach ($values as $key => $value) {
-            $key = Database::escape_string($plugin_name.'_'.$key);
             api_add_setting(
-                $value,
-                $key,
-                $plugin_name,
+                $value, Database::escape_string($pluginName . '_' . $key),
+                $pluginName,
                 'setting',
                 'Plugins',
-                $plugin_name,
+                $pluginName,
                 null,
                 null,
                 null,
@@ -70,17 +79,35 @@ if (isset($form)) {
             );
         }
         if (isset($values['show_main_menu_tab'])) {
-            $objPlugin = $plugin_info['plugin_class']::create();
+            $objPlugin = $pluginInfo['plugin_class']::create();
             $objPlugin->manageTab($values['show_main_menu_tab']);
         }
+
         $message = Display::return_message(get_lang('Updated'), 'success');
+
+        Session::write('message', $message);
+
+        header("Location: $currentUrl");
+        exit;
     }
 }
 
-$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'admin/index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins', 'name' => get_lang('Plugins'));
+if (Session::has('message')) {
+    $message = Session::read('message');
+}
+
+$interbreadcrumb[] = array(
+    'url' => api_get_path(WEB_CODE_PATH) . 'admin/index.php',
+    'name' => get_lang('PlatformAdmin')
+);
+$interbreadcrumb[] = array(
+    'url' => api_get_path(WEB_CODE_PATH) . 'admin/settings.php?category=Plugins',
+    'name' => get_lang('Plugins')
+);
 
-$tpl = new Template($plugin_name, true, true, false, true, false);
+$tpl = new Template($pluginName, true, true, false, true, false);
 $tpl->assign('message', $message);
 $tpl->assign('content', $content);
 $tpl->display_one_col_template();
+
+Session::erase('message');

+ 16 - 7
main/admin/course_add.php

@@ -16,9 +16,6 @@ $this_section = SECTION_PLATFORM_ADMIN;
 
 api_protect_admin_script();
 
-require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
-require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
-
 $tool_name = get_lang('AddCourse');
 $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
 $interbreadcrumb[] = array('url' => 'course_list.php', 'name' => get_lang('CourseList'));
@@ -49,12 +46,12 @@ $form = new FormValidator('update_course');
 $form->addElement('header', $tool_name);
 
 // Title
-$form->add_textfield('title', get_lang('Title'), true, array ('class' => 'span6'));
+$form->addText('title', get_lang('Title'), true, array ('class' => 'span6'));
 $form->applyFilter('title', 'html_filter');
 $form->applyFilter('title', 'trim');
 
 // Code
-$form->add_textfield('visual_code', array(get_lang('CourseCode'), get_lang('OnlyLettersAndNumbers')) , false, array('class' => 'span3', 'maxlength' => CourseManager::MAX_COURSE_LENGTH_CODE));
+$form->addText('visual_code', array(get_lang('CourseCode'), get_lang('OnlyLettersAndNumbers')) , false, array('class' => 'span3', 'maxlength' => CourseManager::MAX_COURSE_LENGTH_CODE));
 
 $form->applyFilter('visual_code', 'api_strtoupper');
 $form->applyFilter('visual_code', 'html_filter');
@@ -78,12 +75,12 @@ $form->addElement(
 );
 
 // Course department
-$form->add_textfield('department_name', get_lang('CourseDepartment'), false, array ('size' => '60'));
+$form->addText('department_name', get_lang('CourseDepartment'), false, array ('size' => '60'));
 $form->applyFilter('department_name', 'html_filter');
 $form->applyFilter('department_name', 'trim');
 
 // Department URL
-$form->add_textfield('department_url', get_lang('CourseDepartmentURL'), false, array ('size' => '60'));
+$form->addText('department_url', get_lang('CourseDepartmentURL'), false, array ('size' => '60'));
 $form->applyFilter('department_url', 'html_filter');
 
 $form->addElement('select_language', 'course_language', get_lang('CourseLanguage'));
@@ -116,6 +113,18 @@ $form->addRule('disk_quota', get_lang('ThisFieldShouldBeNumeric'), 'numeric');
 $obj = new GradeModel();
 $obj->fill_grade_model_select_in_form($form);
 
+//Extra fields
+$extra_field = new CourseField();
+$extra = $extra_field->addElements($form);
+
+$htmlHeadXtra[] ='
+<script>
+
+$(function() {
+    '.$extra['jquery_ready_content'].'
+});
+</script>';
+
 $form->add_progress_bar();
 $form->addElement('style_submit_button', 'submit', get_lang('CreateCourse'), 'class="add"');
 

+ 5 - 7
main/admin/course_category.php

@@ -3,14 +3,11 @@
 /**
  * 	@package chamilo.admin
  */
-/**
- * Code
- */
+
 // name of the language file that needs to be included
 $language_file = 'admin';
 $cidReset = true;
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
 $this_section = SECTION_PLATFORM_ADMIN;
 
 api_protect_admin_script();
@@ -75,7 +72,7 @@ if ($action == 'add' || $action == 'edit') {
         echo '<div class="actions">';
         echo Display::url(
             Display::return_icon('folder_up.png', get_lang("Back"), '', ICON_SIZE_MEDIUM),
-            api_get_path(WEB_CODE_PATH).'admin/course_category.php?category='.$category
+            api_get_path(WEB_CODE_PATH).'admin/course_category.php?category='.Security::remove_XSS($category)
         );
         echo '</div>';
 
@@ -83,10 +80,11 @@ if ($action == 'add' || $action == 'edit') {
         if (!empty($category)) {
             $form_title .= ' ' . get_lang('Into') . ' ' . Security::remove_XSS($category);
         }
-        $url = api_get_self().'?action='.Security::remove_XSS($action).'&category='.Security::remove_XSS($category).'&id='.$categoryId;
+        $url = api_get_self().'?action='.Security::remove_XSS($action).'&category='.Security::remove_XSS($category).'&id='.Security::remove_XSS($category);
         $form = new FormValidator('course_category', 'post', $url);
         $form->addElement('header', '', $form_title);
         $form->addElement('hidden', 'formSent', 1);
+
         $form->addElement('text', 'code', get_lang("CategoryCode"));
         $form->addElement('text', 'name', get_lang("CategoryName"));
         $form->addRule('name', get_lang('PleaseEnterCategoryInfo'), 'required');
@@ -130,7 +128,7 @@ if ($action == 'add' || $action == 'edit') {
     if (empty($parentInfo) || $parentInfo['auth_cat_child'] == 'TRUE') {
         echo Display::url(
             Display::return_icon('new_folder.png', get_lang("AddACategory"), '', ICON_SIZE_MEDIUM),
-            api_get_path(WEB_CODE_PATH).'admin/course_category.php?action=add&category='.$category
+            api_get_path(WEB_CODE_PATH).'admin/course_category.php?action=add&category='.Security::remove_XSS($category)
         );
     }
 

+ 163 - 158
main/admin/course_edit.php

@@ -1,9 +1,8 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
-*	@package chamilo.admin
-*/
-
+ * 	@package chamilo.admin
+ */
 // name of the language file that needs to be included
 $language_file = 'admin';
 $cidReset = true;
@@ -13,23 +12,22 @@ $this_section = SECTION_PLATFORM_ADMIN;
 
 api_protect_admin_script();
 
-require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
-require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
+$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/tag/jquery.fcbkcomplete.js" type="text/javascript" language="javascript"></script>';
 
-$course_table       = Database::get_main_table(TABLE_MAIN_COURSE);
-$course_user_table  = Database::get_main_table(TABLE_MAIN_COURSE_USER);
+$course_table = Database::get_main_table(TABLE_MAIN_COURSE);
+$course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
 
 $course_code = isset($_GET['course_code']) ? $_GET['course_code'] : $_POST['code'];
 $noPHP_SELF = true;
 $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[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = array("url" => "course_list.php", "name" => get_lang('CourseList'));
 
 // Get all course categories
 $table_user = Database :: get_main_table(TABLE_MAIN_USER);
 
 //Get the course infos
-$sql = "SELECT * FROM $course_table WHERE code='".Database::escape_string($course_code)."'";
+$sql = "SELECT * FROM $course_table WHERE code='" . Database::escape_string($course_code) . "'";
 $result = Database::query($sql);
 if (Database::num_rows($result) != 1) {
     header('Location: course_list.php');
@@ -42,7 +40,7 @@ $course_info = api_get_course_info($course_code);
 // Get course teachers
 $table_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
 $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname';
-$sql = "SELECT user.user_id,lastname,firstname FROM $table_user as user,$table_course_user as course_user WHERE course_user.status='1' AND course_user.user_id=user.user_id AND course_user.course_code='".$course_code."'".$order_clause;
+$sql = "SELECT user.user_id,lastname,firstname FROM $table_user as user,$table_course_user as course_user WHERE course_user.status='1' AND course_user.user_id=user.user_id AND course_user.course_code='" . $course_code . "'" . $order_clause;
 $res = Database::query($sql);
 $course_teachers = array();
 while ($obj = Database::fetch_object($res)) {
@@ -51,22 +49,22 @@ while ($obj = Database::fetch_object($res)) {
 
 // Get all possible teachers without the course teachers
 if (api_is_multiple_url_enabled()) {
-	$access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
-	$sql = "SELECT u.user_id,lastname,firstname
-	        FROM $table_user as u
-			INNER JOIN $access_url_rel_user_table url_rel_user
-			ON (u.user_id=url_rel_user.user_id)
-			WHERE url_rel_user.access_url_id=".api_get_current_access_url_id()." AND status=1".$order_clause;
+    $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
+    $sql = "SELECT u.user_id,lastname,firstname
+            FROM $table_user as u
+            INNER JOIN $access_url_rel_user_table url_rel_user
+            ON (u.user_id=url_rel_user.user_id)
+            WHERE url_rel_user.access_url_id=" . api_get_current_access_url_id() . " AND status=1" . $order_clause;
 } else {
     $sql = "SELECT user_id, lastname, firstname
-            FROM $table_user WHERE status='1'".$order_clause;
+            FROM $table_user WHERE status='1'" . $order_clause;
 }
 
 $res = Database::query($sql);
 $teachers = array();
 $allTeachers = array();
 
-$platform_teachers[0] = '-- '.get_lang('NoManager').' --';
+$platform_teachers[0] = '-- ' . get_lang('NoManager') . ' --';
 while ($obj = Database::fetch_object($res)) {
     $allTeachers[$obj->user_id] = api_get_person_name($obj->firstname, $obj->lastname);
     if (!array_key_exists($obj->user_id, $course_teachers)) {
@@ -82,7 +80,7 @@ while ($obj = Database::fetch_object($res)) {
 
 // Case where there is no teacher in the course
 if (count($course_teachers) == 0) {
-    $sql='SELECT tutor_name FROM '.$course_table.' WHERE code="'.$course_code.'"';
+    $sql = 'SELECT tutor_name FROM ' . $course_table . ' WHERE code="' . $course_code . '"';
     $res = Database::query($sql);
     $tutor_name = Database::result($res, 0, 0);
     $course['tutor_name'] = array_search($tutor_name, $platform_teachers);
@@ -90,11 +88,11 @@ if (count($course_teachers) == 0) {
 
 // Build the form
 $form = new FormValidator('update_course');
-$form->addElement('header', get_lang('Course').'  #'.$course_info['real_id'].' '.$course_code);
+$form->addElement('header', get_lang('Course') . '  #' . $course_info['real_id'] . ' ' . $course_code);
 $form->addElement('hidden', 'code', $course_code);
 
 //title
-$form->add_textfield('title', get_lang('Title'), true, array ('class' => 'span6'));
+$form->addText('title', get_lang('Title'), true, array('class' => 'span6'));
 $form->applyFilter('title', 'html_filter');
 $form->applyFilter('title', 'trim');
 
@@ -103,7 +101,7 @@ $element = $form->addElement('text', 'real_code', array(get_lang('CourseCode'),
 $element->freeze();
 
 // Visual code
-$form->add_textfield('visual_code', array(get_lang('VisualCode'), get_lang('OnlyLettersAndNumbers'), get_lang('ThisValueIsUsedInTheCourseURL')), true, array('class' => 'span4'));
+$form->addText('visual_code', array(get_lang('VisualCode'), get_lang('OnlyLettersAndNumbers'), get_lang('ThisValueIsUsedInTheCourseURL')), true, array('class' => 'span4'));
 
 $form->applyFilter('visual_code', 'strtoupper');
 $form->applyFilter('visual_code', 'html_filter');
@@ -114,23 +112,23 @@ $group = array(
 );
 
 $element_template = <<<EOT
-	<div class="control-group">
-		<label>
-			<!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->{label}
-		</label>
-		<div class="controls">
-			<table cellpadding="0" cellspacing="0">
-				<tr>
-					<!-- BEGIN error --><span class="form_error">{error}</span><br /><!-- END error -->	<td>{element}</td>
-				</tr>
-			</table>
-		</div>
-	</div>
+    <div class="control-group">
+        <label>
+            <!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->{label}
+        </label>
+        <div class="controls">
+            <table cellpadding="0" cellspacing="0">
+                <tr>
+                    <!-- BEGIN error --><span class="form_error">{error}</span><br /><!-- END error -->	<td>{element}</td>
+                </tr>
+            </table>
+        </div>
+    </div>
 EOT;
 
 $renderer = $form->defaultRenderer();
 $renderer->setElementTemplate($element_template, 'group');
-$form->addGroup($group, 'group', get_lang('CourseTeachers'), '</td><td width="80" align="center">'.
+$form->addGroup($group, 'group', get_lang('CourseTeachers'), '</td><td width="80" align="center">' .
     '<input class="arrowr" style="width:30px;height:30px;padding-right:12px" type="button" onclick="moveItem(document.getElementById(\'platform_teachers\'), document.getElementById(\'course_teachers\'))"><br><br>'.
     '<input class="arrowl" style="width:30px;height:30px;padding-left:13px" type="button" onclick="moveItem(document.getElementById(\'course_teachers\'), document.getElementById(\'platform_teachers\'))"></td><td>'
 );
@@ -156,33 +154,35 @@ if (!empty($coursesInSession)) {
             }
         }
 
-        $groupName =  'session_coaches['.$sessionId.']';
-        $platformTeacherId = 'platform_teachers_by_session_'.$sessionId;
-        $coachId = 'coaches_by_session_'.$sessionId;
+        $groupName = 'session_coaches[' . $sessionId . ']';
+        $platformTeacherId = 'platform_teachers_by_session_' . $sessionId;
+        $coachId = 'coaches_by_session_' . $sessionId;
 
         $platformTeacherName = 'platform_teachers_by_session';
         $coachName = 'coaches_by_session';
 
         $group = array(
-            $form->createElement('select', $platformTeacherName, '', $teachers, ' id="'.$platformTeacherId.'" multiple=multiple size="4" style="width:300px;"'),
-            $form->createElement('select', $coachName, '', $sessionTeachers, ' id="'.$coachId.'" multiple=multiple size="4" style="width:300px;"')
+            $form->createElement('select', $platformTeacherName, '', $teachers, ' id="' . $platformTeacherId . '" multiple=multiple size="4" style="width:300px;"'),
+            $form->createElement('select', $coachName, '', $sessionTeachers, ' id="' . $coachId . '" multiple=multiple size="4" style="width:300px;"')
         );
 
         $renderer = $form->defaultRenderer();
         $renderer->setElementTemplate($element_template, $groupName);
-        $sessionUrl = api_get_path(WEB_CODE_PATH).'admin/resume_session.php?id_session='.$sessionId;
-        $form->addGroup($group, $groupName, Display::url($session['name'], $sessionUrl, array('target' => '_blank')).' - '.get_lang('Coaches'), '</td>
+        $sessionUrl = api_get_path(WEB_CODE_PATH) . 'admin/resume_session.php?id_session=' . $sessionId;
+        $form->addGroup($group, $groupName,
+            Display::url($session['name'], $sessionUrl, array('target' => '_blank')) . ' - ' . get_lang('Coaches'),
+            '</td>
             <td width="80" align="center">
-                <input class="arrowr" style="width:30px;height:30px;padding-right:12px" type="button" onclick="moveItem(document.getElementById(\''.$platformTeacherId.'\'), document.getElementById(\''.$coachId.'\'));">
+                <input class="arrowr" style="width:30px;height:30px;padding-right:12px" type="button" onclick="moveItem(document.getElementById(\'' . $platformTeacherId . '\'), document.getElementById(\'' . $coachId . '\'));">
                 <br><br>
-                <input class="arrowl" style="width:30px;height:30px;padding-left:13px" type="button" onclick="moveItem(document.getElementById(\''.$coachId.'\'), document.getElementById(\''.$platformTeacherId.'\'));">
+                <input class="arrowl" style="width:30px;height:30px;padding-left:13px" type="button" onclick="moveItem(document.getElementById(\'' . $coachId . '\'), document.getElementById(\'' . $platformTeacherId . '\'));">
             </td><td>'
         );
     }
 }
 
 // Category code
-$url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_category';
+$url = api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?a=search_category';
 $categoryList = array();
 if (!empty($course['category_code'])) {
     $data = getCategory($course['category_code']);
@@ -192,11 +192,11 @@ if (!empty($course['category_code'])) {
 $form->addElement('select_ajax', 'category_code', get_lang('CourseFaculty'), null, array('url' => $url, 'defaults' => $categoryList));
 
 
-$form->add_textfield('department_name', get_lang('CourseDepartment'), false, array('size' => '60'));
+$form->addText('department_name', get_lang('CourseDepartment'), false, array('size' => '60'));
 $form->applyFilter('department_name', 'html_filter');
 $form->applyFilter('department_name', 'trim');
 
-$form->add_textfield('department_url', get_lang('CourseDepartmentURL'), false, array('size' => '60'));
+$form->addText('department_url', get_lang('CourseDepartmentURL'), false, array('size' => '60'));
 $form->applyFilter('department_url', 'html_filter');
 $form->applyFilter('department_url', 'trim');
 
@@ -212,13 +212,13 @@ $group[]= $form->createElement('radio', 'visibility', null, get_lang('CourseVisi
 $form->addGroup($group, '', get_lang('CourseAccess'), '<br />');
 
 $group = array();
-$group[]= $form->createElement('radio', 'subscribe', get_lang('Subscription'), get_lang('Allowed'), 1);
-$group[]= $form->createElement('radio', 'subscribe', null, get_lang('Denied'), 0);
+$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'), '<br />');
 
 $group = array();
-$group[]= $form->createElement('radio', 'unsubscribe', get_lang('Unsubscription'), get_lang('AllowedToUnsubscribe'), 1);
-$group[]= $form->createElement('radio', 'unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0);
+$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'), '<br />');
 
 $form->addElement('text', 'disk_quota', array(get_lang('CourseQuota'), null, get_lang('MB')));
@@ -227,21 +227,41 @@ $form->addRule('disk_quota', get_lang('ThisFieldShouldBeNumeric'), 'numeric');
 
 $list_course_extra_field = CourseManager::get_course_extra_field_list($course_code);
 
-//@todo this is wrong
-foreach ($list_course_extra_field as $extra_field) {
-    switch ($extra_field['field_type']) {
-        case CourseManager::COURSE_FIELD_TYPE_CHECKBOX:
-            $checked = (array_key_exists('extra_field_value', $extra_field) && $extra_field['extra_field_value'] == 1)? array('checked'=>'checked'): '';
-            $form->addElement('hidden', '_extra_'.$extra_field['field_variable'], 0);
-            $field_display_text = $extra_field['field_display_text'];
-            $form->addElement('checkbox', 'extra_'.$extra_field['field_variable'], array(null, get_lang('AllUsersAreAutomaticallyRegistered')), get_lang('SpecialCourse'), $checked);
-            break;
+$specialCourseField = new CourseField();
+$specialCourseFieldInfo = $specialCourseField->get_handler_field_info_by_field_variable('special_course');
+
+if (!empty($specialCourseFieldInfo)) {
+    $specialCourseValue = new ExtraFieldValue('course');
+    $specialCourseValueInfo = $specialCourseValue->get_values_by_handler_and_field_variable($course_code, 'special_course');
+
+    $specialCourseAttributes = array();
+
+    if (!empty($specialCourseValueInfo) && $specialCourseValueInfo['field_value'] == 1) {
+        $specialCourseAttributes['checked'] = '';
     }
+
+    $form->addElement('hidden', '_extra_special_course', 0);
+    $form->addElement('checkbox', 'extra_special_course', array(
+        null, get_lang('AllUsersAreAutomaticallyRegistered')
+    ), get_lang('SpecialCourse'), $specialCourseAttributes);
 }
+
+//Extra fields
+$extra_field = new CourseField();
+$extra = $extra_field->addElements($form, $course_code);
+
+$htmlHeadXtra[] = '
+<script>
+
+$(function() {
+    ' . $extra['jquery_ready_content'] . '
+});
+</script>';
+
 $form->addElement('style_submit_button', 'button', get_lang('ModifyCourseInfo'), 'onclick="valide()"; class="save"');
 
 // Set some default values
-$course['disk_quota'] = round(DocumentManager::get_course_quota($course_code) /1024/1024, 1);
+$course['disk_quota'] = round(DocumentManager::get_course_quota($course_code) / 1024 / 1024, 1);
 $course['title'] = api_html_entity_decode($course['title'], ENT_QUOTES, $charset);
 $course['real_code'] = $course['code'];
 $course['add_teachers_to_sessions_courses'] = isset($course['add_teachers_to_sessions_courses']) ? $course['add_teachers_to_sessions_courses'] : 0;
@@ -278,75 +298,60 @@ if ($form->validate()) {
 
     $course_code = $course['code'];
     $visual_code = $course['visual_code'];
-    $visual_code = generate_course_code($visual_code);
+    $visual_code = CourseManager::generate_course_code($visual_code);
 
     // Check if the visual code is already used by *another* course
     $visual_code_is_used = false;
 
-    $warn = get_lang('TheFollowingCoursesAlreadyUseThisVisualCode').':';
+    $warn = get_lang('TheFollowingCoursesAlreadyUseThisVisualCode');
     if (!empty($visual_code)) {
         $list = CourseManager::get_courses_info_from_visual_code($visual_code);
         foreach ($list as $course_temp) {
             if ($course_temp['code'] != $course_code) {
-               $visual_code_is_used = true;
-               $warn .= ' '.$course_temp['title'].' ('.$course_temp['code'].'),';
+                $visual_code_is_used = true;
+                $warn .= ' ' . $course_temp['title'] . ' (' . $course_temp['code'] . '),';
             }
         }
         $warn = substr($warn, 0, -1);
     }
 
-    // an extra field
-    $extras = array();
-    foreach ($course as $key => $value) {
-        if (substr($key, 0, 6) == 'extra_') {
-            $extras[substr($key, 6)] = $value;
-        }
-
-        if (substr($key, 0, 7) == '_extra_') {
-            if (!array_key_exists(substr($key, 7), $extras)) {
-                $extras[substr($key, 7)] = $value;
-            }
-        }
+    $tutor_id = isset($course['tutor_name']) ? $course['tutor_name'] : null;
+    $tutor_name = isset($platform_teachers[$tutor_id]) ? $platform_teachers[$tutor_id] : null;
+    $teachers = $course['group']['course_teachers'];
+
+    $title = $course['title'];
+    $category_code = $course['category_code'];
+    $department_name = $course['department_name'];
+    $department_url = $course['department_url'];
+    $course_language = $course['course_language'];
+    $course['disk_quota'] = $course['disk_quota'] * 1024 * 1024;
+    $disk_quota = $course['disk_quota'];
+    $subscribe = $course['subscribe'];
+    $unsubscribe = $course['unsubscribe'];
+    $course['course_code'] = $course_code;
+    $courseId = $course['id'];
+
+    if (!stristr($department_url, 'http://')) {
+        $department_url = 'http://' . $department_url;
     }
 
-	$tutor_id = isset($course['tutor_name']) ? $course['tutor_name'] : null;
-	$tutor_name = isset($platform_teachers[$tutor_id]) ? $platform_teachers[$tutor_id] : null;
-	$teachers = $course['group']['course_teachers'];
-
-	$title = $course['title'];
-	$category_code = $course['category_code'];
-	$department_name = $course['department_name'];
-	$department_url = $course['department_url'];
-	$course_language = $course['course_language'];
-    $course['disk_quota'] = $course['disk_quota']*1024*1024;
-	$disk_quota = $course['disk_quota'];
-	$subscribe = $course['subscribe'];
-	$unsubscribe = $course['unsubscribe'];
-
-	if (!stristr($department_url, 'http://')) {
-		$department_url = 'http://'.$department_url;
-	}
-
-    $sql = "UPDATE $course_table SET course_language='".Database::escape_string($course_language)."',
-                title='".Database::escape_string($title)."',
-                category_code='".Database::escape_string($category_code)."',
-                tutor_name='".Database::escape_string($tutor_name)."',
-                visual_code='".Database::escape_string($visual_code)."',
-                department_name='".Database::escape_string($department_name)."',
-                department_url='".Database::escape_string($department_url)."',
-                disk_quota='".Database::escape_string($disk_quota)."',
-                visibility = '".Database::escape_string($visibility)."',
-                subscribe = '".Database::escape_string($subscribe)."',
-                unsubscribe='".Database::escape_string($unsubscribe)."'
-            WHERE code='".Database::escape_string($course_code)."'";
-	Database::query($sql);
-
-	// update the extra fields
-	if (count($extras) > 0) {
-		foreach ($extras as $key => $value) {
-			CourseManager::update_course_extra_field_value($course_code, $key, $value);
-		}
-	}
+    $sql = "UPDATE $course_table SET course_language='" . Database::escape_string($course_language) . "',
+                title='" . Database::escape_string($title) . "',
+                category_code='" . Database::escape_string($category_code) . "',
+                tutor_name='" . Database::escape_string($tutor_name) . "',
+                visual_code='" . Database::escape_string($visual_code) . "',
+                department_name='" . Database::escape_string($department_name) . "',
+                department_url='" . Database::escape_string($department_url) . "',
+                disk_quota='" . Database::escape_string($disk_quota) . "',
+                visibility = '" . Database::escape_string($visibility) . "',
+                subscribe = '" . Database::escape_string($subscribe) . "',
+                unsubscribe='" . Database::escape_string($unsubscribe) . "'
+            WHERE id = $courseId ";
+    Database::query($sql);
+
+    // update the extra fields
+    $courseFieldValue = new ExtraFieldValue('course');
+    $courseFieldValue->save_field_values($course);
 
     $addTeacherToSessionCourses = isset($course['add_teachers_to_sessions_courses']) && !empty($course['add_teachers_to_sessions_courses']) ? 1 : 0;
 
@@ -385,31 +390,31 @@ if ($form->validate()) {
         }
     }
 
-	$sql = "INSERT IGNORE INTO ".$course_user_table . " SET
-				course_code = '".Database::escape_string($course_code). "',
-				user_id = '".$tutor_id . "',
-				status = '1',
-				role = '',
-				tutor_id='0',
-				sort='0',
-				user_course_cat='0'";
-	Database::query($sql);
+    $sql = "INSERT IGNORE INTO " . $course_user_table . " SET
+                course_code = '" . Database::escape_string($course_code) . "',
+                user_id = '" . $tutor_id . "',
+                status = '1',
+                role = '',
+                tutor_id='0',
+                sort='0',
+                user_course_cat='0'";
+    Database::query($sql);
 
     if (array_key_exists('add_teachers_to_sessions_courses', $course_info)) {
         $sql = "UPDATE $course_table SET add_teachers_to_sessions_courses = '$addTeacherToSessionCourses'
-                WHERE id = ".$course_info['real_id'];
+                WHERE id = " . $course_info['real_id'];
         Database::query($sql);
     }
 
-	$course_id = $course_info['real_id'];
-	/*$forum_config_table = Database::get_course_table(TOOL_FORUM_CONFIG_TABLE);
-	$sql = "UPDATE ".$forum_config_table." SET default_lang='".Database::escape_string($course_language)."' WHERE c_id = $course_id ";*/
-	if ($visual_code_is_used) {
-	    header('Location: course_list.php?action=show_msg&warn='.urlencode($warn));
-	} else {
+    $course_id = $course_info['real_id'];
+    /* $forum_config_table = Database::get_course_table(TOOL_FORUM_CONFIG_TABLE);
+      $sql = "UPDATE ".$forum_config_table." SET default_lang='".Database::escape_string($course_language)."' WHERE c_id = $course_id "; */
+    if ($visual_code_is_used) {
+        header('Location: course_list.php?action=show_msg&warn=' . urlencode($warn));
+    } else {
         header('Location: course_list.php');
-	}
-	exit;
+    }
+    exit;
 }
 
 Display::display_header($tool_name);
@@ -421,38 +426,38 @@ echo '</div>';
 
 echo "<script>
 function moveItem(origin , destination) {
-	for (var i = 0 ; i<origin.options.length ; i++) {
-		if (origin.options[i].selected) {
-			destination.options[destination.length] = new Option(origin.options[i].text,origin.options[i].value);
-			origin.options[i]=null;
-			i = i-1;
-		}
-	}
-	destination.selectedIndex = -1;
-	sortOptions(destination.options);
+    for (var i = 0 ; i<origin.options.length ; i++) {
+        if (origin.options[i].selected) {
+            destination.options[destination.length] = new Option(origin.options[i].text,origin.options[i].value);
+            origin.options[i]=null;
+            i = i-1;
+        }
+    }
+    destination.selectedIndex = -1;
+    sortOptions(destination.options);
 }
 
 function sortOptions(options) {
 
-	newOptions = new Array();
-	for (i = 0 ; i<options.length ; i++) {
-		newOptions[i] = options[i];
+    newOptions = new Array();
+    for (i = 0 ; i<options.length ; i++) {
+        newOptions[i] = options[i];
+    }
+    newOptions = newOptions.sort(mysort);
+    options.length = 0;
+    for (i = 0 ; i < newOptions.length ; i++) {
+        options[i] = newOptions[i];
     }
-	newOptions = newOptions.sort(mysort);
-	options.length = 0;
-	for (i = 0 ; i < newOptions.length ; i++) {
-		options[i] = newOptions[i];
-	}
 }
 
 function mysort(a, b) {
-	if (a.text.toLowerCase() > b.text.toLowerCase()) {
-		return 1;
-	}
-	if (a.text.toLowerCase() < b.text.toLowerCase()) {
-		return -1;
-	}
-	return 0;
+    if (a.text.toLowerCase() > b.text.toLowerCase()) {
+        return 1;
+    }
+    if (a.text.toLowerCase() < b.text.toLowerCase()) {
+        return -1;
+    }
+    return 0;
 }
 
 function valide() {

+ 1 - 4
main/admin/course_import.php

@@ -63,7 +63,6 @@ function validate_data($courses)
 
         // 4. Check whether course category exists.
         if (isset($course['CourseCategory']) && strlen($course['CourseCategory']) != 0) {
-            require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
             $categoryInfo = getCategory($course['CourseCategory']);
             if (empty($categoryInfo)) {
                 //@todo this is so bad even all lang variables are wrong ...
@@ -165,8 +164,6 @@ require '../inc/global.inc.php';
 $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script();
 
-require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
-require_once api_get_path(LIBRARY_PATH).'import.lib.php';
 $defined_auth_sources[] = PLATFORM_AUTH_SOURCE;
 
 if (isset($extAuthSource) && is_array($extAuthSource)) {
@@ -213,7 +210,7 @@ if (isset($errors) && count($errors) != 0) {
 }
 
 $form = new FormValidator('import', 'post', api_get_self(), null, array('enctype' => 'multipart/form-data'));
-$form->add_header($tool_name);
+$form->addHeader($tool_name);
 $form->addElement('file', 'import_file', get_lang('ImportCSVFileLocation'));
 $form->addElement('checkbox', 'add_me_as_teacher', null, get_lang('AddMeAsTeacherInCourses'));
 $form->addElement('button', 'save', get_lang('Import'));

+ 0 - 8
main/admin/course_intro_pdf_import.php

@@ -14,11 +14,6 @@ api_protect_admin_script();
 // temporary configuration of in which folder to upload the file in each course.
 // Should default to '', and start with a '/' and end without it, if defined
 $subDir = '';
-
-//require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
-//require_once api_get_path(LIBRARY_PATH).'import.lib.php';
-require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
-
 $tool_name = get_lang('ImportPDFIntroToCourses');
 
 $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
@@ -105,9 +100,6 @@ function import_pdfs($file, $subDir = '/') {
         error_log('Could not unzip uploaded file in '.__FILE__.', line '.__LINE__);
         return $errors;
     }
-    require_once api_get_path(LIBRARY_PATH).'course_description.lib.php';
-    require_once api_get_path(LIBRARY_PATH).'app_view.php';
-    require_once '../course_description/course_description_controller.php';
     $list = scandir($baseDir.$uploadPath);
     $i = 0;
     foreach ($list as $file) {

+ 2 - 5
main/admin/course_list.php

@@ -14,9 +14,6 @@ require_once '../inc/global.inc.php';
 $this_section = SECTION_PLATFORM_ADMIN;
 
 api_protect_admin_script();
-require_once '../gradebook/lib/be/gradebookitem.class.php';
-require_once '../gradebook/lib/be/category.class.php';
-require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
 
 $sessionId = isset($_GET['session_id']) ? $_GET['session_id'] : null;
 
@@ -281,8 +278,8 @@ if (isset ($_GET['search']) && $_GET['search'] == 'advanced') {
     //api_display_tool_title($tool_name);
     $form = new FormValidator('advanced_course_search', 'get');
     $form->addElement('header', $tool_name);
-    $form->add_textfield('keyword_code', get_lang('CourseCode'), false);
-    $form->add_textfield('keyword_title', get_lang('Title'), false);
+    $form->addText('keyword_code', get_lang('CourseCode'), false);
+    $form->addText('keyword_title', get_lang('Title'), false);
 
     // Category code
     $url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_category';

+ 0 - 10
main/admin/course_request_accepted.php

@@ -22,16 +22,6 @@ $this_section = SECTION_PLATFORM_ADMIN;
 
 api_protect_admin_script();
 
-require_once api_get_path(LIBRARY_PATH).'add_course.lib.inc.php';
-require_once api_get_path(CONFIGURATION_PATH).'course_info.conf.php';
-require_once api_get_path(LIBRARY_PATH).'course_request.lib.php';
-
-// Including a configuration file.
-require api_get_path(CONFIGURATION_PATH).'add_course.conf.php';
-
-// Include additional libraries
-require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
-
 // A check whether the course validation feature is enabled.
 $course_validation_feature = api_get_setting('course_validation') == 'true';
 

+ 2 - 14
main/admin/course_request_edit.php

@@ -17,18 +17,6 @@ $tool_name = get_lang('CourseRequestEdit');
 
 api_protect_admin_script();
 
-require_once api_get_path(LIBRARY_PATH).'add_course.lib.inc.php';
-require_once api_get_path(CONFIGURATION_PATH).'course_info.conf.php';
-require_once api_get_path(LIBRARY_PATH).'course_request.lib.php';
-require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
-require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
-
-// Including a configuration file.
-require_once api_get_path(CONFIGURATION_PATH).'add_course.conf.php';
-
-// Including additional libraries.
-require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
-
 // A check whether the course validation feature is enabled.
 $course_validation_feature = api_get_setting('course_validation') == 'true';
 
@@ -84,13 +72,13 @@ if ($course_validation_feature) {
         );
 
         // Course code.
-        $form->add_textfield('wanted_code', get_lang('Code'), false, array('size' => '$maxlength', 'maxlength' => $maxlength));
+        $form->addText('wanted_code', get_lang('Code'), false, array('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->add_textfield('tutor_name', get_lang('Professor'), null, array('size' => '60', 'disabled' => 'disabled'));
+        $titular = $form->addText('tutor_name', get_lang('Professor'), null, array('size' => '60', 'disabled' => 'disabled'));
 
         // Description of the requested course.
         $form->addElement('textarea', 'description', get_lang('Description'), array('style' => 'border:#A5ACB2 solid 1px; font-family:arial,verdana,helvetica,sans-serif; font-size:12px', 'rows' => '3', 'cols' => '116'));

+ 0 - 11
main/admin/course_request_rejected.php

@@ -22,17 +22,6 @@ $this_section = SECTION_PLATFORM_ADMIN;
 
 api_protect_admin_script();
 
-require_once api_get_path(LIBRARY_PATH).'add_course.lib.inc.php';
-require_once api_get_path(CONFIGURATION_PATH).'course_info.conf.php';
-require_once api_get_path(LIBRARY_PATH).'course_request.lib.php';
-require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
-
-// Including a configuration file.
-require api_get_path(CONFIGURATION_PATH).'add_course.conf.php';
-
-// Including additional libraries.
-require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
-
 // A check whether the course validation feature is enabled.
 $course_validation_feature = api_get_setting('course_validation') == 'true';
 

+ 0 - 11
main/admin/course_request_review.php

@@ -19,17 +19,6 @@ $this_section = SECTION_PLATFORM_ADMIN;
 
 api_protect_admin_script();
 
-require_once api_get_path(LIBRARY_PATH).'add_course.lib.inc.php';
-require_once api_get_path(CONFIGURATION_PATH).'course_info.conf.php';
-require_once api_get_path(LIBRARY_PATH).'course_request.lib.php';
-require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
-
-// Including a configuration file.
-require_once api_get_path(CONFIGURATION_PATH).'add_course.conf.php';
-
-// Including additional libraries.
-require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
-
 // The delete action should be deactivated in this page.
 // Better reject the target request, after that you can delete it.
 // see DELETE_ACTION_ENABLED constant in main_api.lib.php

+ 0 - 4
main/admin/course_user_import.php

@@ -145,10 +145,6 @@ $this_section = SECTION_PLATFORM_ADMIN;
 // Protecting the admin section.
 api_protect_admin_script();
 
-// Including additional libraries.
-require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
-require_once api_get_path(LIBRARY_PATH).'import.lib.php';
-
 $tool_name = get_lang('AddUsersToACourse').' CSV';
 
 $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));

+ 0 - 4
main/admin/course_user_import_by_email.php

@@ -150,10 +150,6 @@ $this_section = SECTION_PLATFORM_ADMIN;
 // Protecting the admin section.
 api_protect_admin_script();
 
-// Including additional libraries.
-require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
-require_once api_get_path(LIBRARY_PATH).'import.lib.php';
-
 $tool_name = get_lang('AddUsersToACourse').' CSV';
 
 $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));

+ 0 - 390
main/admin/course_virtual.php

@@ -1,390 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-/**
- * @author Roan Embrechts - initial admin interface
- * @package chamilo.admin
- * @deprecated
- */
-/**
- * INIT SECTION
- */
-
-// name of the language file that needs to be included
-$language_file = 'admin';
-$extra_lang_file = "create_course";
-
-// global settings initialisation
-// also provides access to main api (inc/lib/main_api.lib.php)
-include("../inc/global.inc.php");
-$this_section=SECTION_PLATFORM_ADMIN;
-
-api_protect_admin_script();
-
-if (isset($extra_lang_file)) include(api_get_path(INCLUDE_PATH)."../lang/english/".$extra_lang_file.".inc.php");
-if (isset($extra_lang_file)) include(api_get_path(INCLUDE_PATH)."../lang/".$language_interface."/".$extra_lang_file.".inc.php");
-
-/*
-	Constants
-*/
-
-define ("CREATE_VIRTUAL_COURSE_OPTION", "create_virtual_course");
-define ("DISPLAY_VIRTUAL_COURSE_LIST_OPTION", "display_virtual_course_list");
-
-define ("FORM_ELEMENT_CODE_SIZE", "20");
-define ("FORM_ELEMENT_TEXT_SIZE", "60");
-define ("SELECT_BOX_SIZE", "10");
-
-define ("COURSE_TITLE_FORM_NAME", "course_title");
-define ("LANGUAGE_SELECT_FORM_NAME" , "course_language");
-define ("REAL_COURSE_SELECT_FORM_NAME" , "real_course_code");
-define ("WANTED_COURSE_CODE_FORM_NAME" , "wanted_course_code");
-define ("COURSE_CATEGORY_FORM_NAME" , "course_category");
-
-/*
------------------------------------------------------------
-	Header
------------------------------------------------------------
-*/
-
-$tool_name = get_lang('AdminManageVirtualCourses'); // title of the page (should come from the language file)
-
-$interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
-
-Display::display_header($tool_name);
-
-/*
-==============================================================================
-		DISPLAY FUNCTIONS
-==============================================================================
-*/
-
-function make_strong($text)
-{
-	return "<strong>" . $text . "</strong>";
-}
-
-
-/**
-*	Return a list of language directories.
-*	@todo function does not belong here, move to code library,
-*	also see infocours.php and index.php which contain a similar function
-*/
-function get_language_folder_list($dirname)
-{
-	if($dirname[strlen($dirname)-1]!='/') $dirname.='/';
-	$handle=opendir($dirname);
-	while ($entries = readdir($handle))
-	{
-		if ($entries=='.' || $entries=='..' || $entries=='CVS') continue;
-		if (is_dir($dirname.$entries))
-		{
-			$language_list[] = $entries;
-		}
-	}
-	closedir($handle);
-	return $language_list;
-}
-
-/**
-* Displays a select element (drop down menu) so the user can select
-* the course language.
-* @todo function does not belong here, move to (display?) library,
-* @todo language display used apparently no longer existing array, converted to english for now.
-* but we should switch to display the real language names.
-*/
-function display_language_select($element_name)
-{
-	global $platformLanguage;
-
-	//get language list
-	$dirname = api_get_path(SYS_PATH)."main/lang/";
-	$language_list = get_language_folder_list($dirname);
-	sort($language_list);
-
-	//build array with strings to display
-	foreach ($language_list as $this_language)
-	{
-		$language_to_display[$this_language] = $this_language;
-	}
-
-	//sort alphabetically
-	//warning: key,value association needs to be maintained --> asort instead of sort
-	asort($language_to_display);
-
-	$user_selected_language = $_SESSION["user_language_choice"];
-	if (! isset($user_selected_language) ) $user_selected_language = $platformLanguage;
-
-	//display
-	echo "<select name=\"$element_name\">";
-	foreach ($language_to_display as $key => $value)
-	{
-		if ($key == $user_selected_language) $option_end = "selected >";
-		else $option_end = ">";
-		echo "<option value=\"$key\" $option_end";
-
-		echo $value;
-		echo "</option>\n";
-	}
-	echo "</select>";
-}
-
-/**
-*	This code creates a select form element to let the user
-*	choose a real course to link to.
-*
-*	We display the course code, but internally store the course id.
-*/
-function display_real_course_code_select($element_name)
-{
-	$real_course_list = CourseManager::get_real_course_list();
-
-	echo "<select name=\"$element_name\" size=\"".SELECT_BOX_SIZE."\" >\n";
-	foreach($real_course_list as $real_course)
-	{
-		$course_code = $real_course["code"];
-		echo "<option value=\"". $course_code ."\">";
-		echo $course_code;
-		echo "</option>\n";
-	}
-	echo "</select>\n";
-}
-
-
-function display_create_virtual_course_form()
-{
-	global $charset;
-
-	$category_table = Database::get_main_table(TABLE_MAIN_CATEGORY);
-
-	$message = make_strong(get_lang('AdminCreateVirtualCourse')) . "<br/>" . get_lang('AdminCreateVirtualCourseExplanation') . "<br/>This feature is in development phase, bug reports welcome.";
-	?>
-	<p><?php echo $message;	?></p>
-	<b><?php echo get_lang('MandatoryFields') ?></b>
-	<form method="post" action="<?php echo api_get_self(); ?>">
-	<table>
-	<tr valign="top">
-	<td colspan="2">
-
-	</td>
-	</tr>
-
-	<tr valign="top">
-	<td align="right">
-		<?php
-			echo make_strong(get_lang('CourseTitle')) . "&nbsp;";
-			echo "</td>";
-			echo "<td valign=\"top\">";
-			echo "<input type=\"Text\" name=\"".COURSE_TITLE_FORM_NAME."\" size=\"".FORM_ELEMENT_TEXT_SIZE."\" value=\"$valueIntitule\"/><br />".get_lang('Ex') ;
-		?>
-	</td>
-	</tr>
-
-	<tr valign="top">
-	<td align="right"><?php echo make_strong(get_lang('CourseFaculty')) . "&nbsp;"; ?> </td>
-	<td>
-		<?php
-			echo "<select name=\"".COURSE_CATEGORY_FORM_NAME."\">";
-
-			$sql_query = "SELECT code, name
-									FROM $category_table
-									WHERE auth_course_child ='TRUE'
-									ORDER BY tree_pos";
-			$category_result = Database::query($sql_query);
-
-			while ($current_category = Database::fetch_array($category_result))
-			{
-				echo "<option value=\"", $current_category["code"], "\"";
-				echo ">(", $current_category["code"], ") ", $current_category["name"];
-				echo "</option>\n";
-			}
-		?>
-	</select>
-	<br /><?php echo make_strong(get_lang('TargetFac'))  . "&nbsp;" ?>
-	</td>
-	</tr>
-
-	<tr valign="top">
-	<td align="right"><?php echo make_strong(get_lang('Code'))  . "&nbsp;" ?> </td>
-	<td>
-	<?php
-	echo "<input type=\"Text\" name=\"".WANTED_COURSE_CODE_FORM_NAME."\" maxlength=\"".FORM_ELEMENT_CODE_SIZE."\" value=\"$valuePublicCode\"/>
-	<br/>" . get_lang('Max');
-	?>
-	</td>
-	</tr>
-
-	<tr valign="top">
-	<td align="right">
-	<?php echo make_strong(get_lang('RealCourseCode'))  . "&nbsp;" ?>
-	</td>
-	<td>
-		<?php
-			display_real_course_code_select(REAL_COURSE_SELECT_FORM_NAME);
-			//echo "<input type=\"Text\" name=\"real_course_code\" maxlength=\"".FORM_ELEMENT_CODE_SIZE."\" value=\"" . api_htmlentities($valueTitular, ENT_COMPAT, $charset) . "\"/>";
-		?>
-	</td>
-	</tr>
-
-	<tr valign="top">
-	<td align="right">
-		<?php
-			echo make_strong(get_lang('CourseLanguage')) . "&nbsp;";
-		?>
-	</td>
-	<td> <?php  display_language_select(LANGUAGE_SELECT_FORM_NAME); ?>
-
-	</td>
-	</tr>
-	<tr valign="top">
-	<td>
-	</td>
-	<td>
-	<input type="Submit" name="submit_create_virtual_course" value="<?php echo get_lang('Ok')?>"/>
-	</td>
-	</tr>
-	</table>
-	</form>
-	<?php
-}
-
-function display_main_options()
-{
-	$message = "<ul><li><a href=\"?action=".CREATE_VIRTUAL_COURSE_OPTION."\">".get_lang('CreateVirtualCourse')."</a></li>";
-	$message .= "<li><a href=\"?action=".DISPLAY_VIRTUAL_COURSE_LIST_OPTION."\">".get_lang('DisplayListVirtualCourses')."</a></li></ul>";
-	echo $message;
-}
-
-function display_virtual_course_list()
-{
-	$course_list = CourseManager::get_virtual_course_list();
-	if (! is_array($course_list) )
-	{
-		//there are no virtual courses
-		echo "<i>".get_lang('ThereAreNoVirtualCourses')."</i>";
-		return;
-	}
-
-	$column_header[] = array(get_lang('Title'),true);
-	$column_header[] = array(get_lang('Code'),true);
-	$column_header[] = array(get_lang('VisualCode'),true);
-	$column_header[] = array(get_lang('LinkedCourseTitle'),true);
-	$column_header[] = array(get_lang('LinkedCourseCode'),true);
-	$table_data = array();
-	for($i = 0; $i < count($course_list); $i++)
-	{
-		$course_list[$i] = Database::generate_abstract_course_field_names($course_list[$i]);
-		$target_course_code = $course_list[$i]["target_course_code"];
-		$real_course_info = Database::get_course_info($target_course_code);
-
-		$row = array();
-		$row[] = $course_list[$i]["title"];
-		$row[] = $course_list[$i]["system_code"];
-		$row[] = $course_list[$i]["visual_code"];
-		$row[] = $real_course_info["title"];
-		$row[]= $real_course_info["system_code"];
-		$table_data[] = $row;
-	}
-	Display::display_sortable_table($column_header,$table_data,array(),array(),array('action'=>$_GET['action']));
-}
-
-
-/*
-==============================================================================
-		TOOL LOGIC FUNCTIONS
-==============================================================================
-*/
-
-/**
-*	Checks all parameters needed to create a virtual course.
-*	If they are all set, the virtual course creation procedure is called.
-*	Call this function instead of create_virtual_course
-*/
-function attempt_create_virtual_course($real_course_code, $course_title, $wanted_course_code, $course_language, $course_category)
-{
-	//better: create parameter list, check the entire list, when false display errormessage
-	CourseManager::check_parameter_or_fail($real_course_code, "Unspecified parameter: real course id.");
-	CourseManager::check_parameter_or_fail($course_title, "Unspecified parameter: course title.");
-	CourseManager::check_parameter_or_fail($wanted_course_code, "Unspecified parameter: wanted course code.");
-	CourseManager::check_parameter_or_fail($course_language, "Unspecified parameter: course language.");
-	CourseManager::check_parameter_or_fail($course_category, "Unspecified parameter: course category.");
-
-	$message = get_lang('AttemptedCreationVirtualCourse') . "<br/>";
-	$message .= get_lang('CourseTitle') . " " . $course_title . "<br/>";
-	$message .= get_lang('WantedCourseCode') . " " . $wanted_course_code . "<br/>";
-	$message .= get_lang('CourseLanguage') . " " . $course_language . "<br/>";
-	$message .= get_lang('CourseFaculty') . " " . $course_category . "<br/>";
-	$message .= get_lang('LinkedToRealCourseCode') . " " . $real_course_code . "<br/>";
-
-	Display::display_normal_message($message);
-
-	$creation_success = CourseManager::create_virtual_course( $real_course_code, $course_title, $wanted_course_code, $course_language, $course_category );
-
-	if ($creation_success)
-	{
-		Display::display_normal_message( $course_title . " - " . get_lang('CourseCreationSucceeded') );
-		return true;
-	}
-	return false;
-}
-
-/*
-==============================================================================
-		MAIN CODE
-==============================================================================
-*/
-
-$action = $_GET["action"];
-$attempt_create_virtual_course = $_POST["submit_create_virtual_course"];
-
-//api_display_tool_title($tool_name);
-
-if ( isset($attempt_create_virtual_course) && $attempt_create_virtual_course )
-{
-	$real_course_code = $_POST[REAL_COURSE_SELECT_FORM_NAME];
-	$course_title = $_POST[COURSE_TITLE_FORM_NAME];
-	$wanted_course_code = $_POST[WANTED_COURSE_CODE_FORM_NAME];
-	$course_language = $_POST[LANGUAGE_SELECT_FORM_NAME];
-	$course_category = $_POST[COURSE_CATEGORY_FORM_NAME];
-
-	$message = get_lang('AttemptedCreationVirtualCourse') . "<br/>";
-	$message .= get_lang('CourseTitle') . " " . $course_title . "<br/>";
-	$message .= get_lang('WantedCourseCode') . " " . $wanted_course_code . "<br/>";
-	$message .= get_lang('CourseLanguage') . " " . $course_language . "<br/>";
-	$message .= get_lang('CourseFaculty') . " " . $course_category . "<br/>";
-	$message .= get_lang('LinkedToRealCourseCode') . " " . $real_course_code . "<br/>";
-
-	Display::display_normal_message($message);
-
-	$creation_success = CourseManager::attempt_create_virtual_course($real_course_code, $course_title, $wanted_course_code, $course_language, $course_category);
-
-	if ($creation_success)
-	{
-		Display::display_normal_message( $course_title . " - " . get_lang('CourseCreationSucceeded') );
-	}
-	else
-	{
-		//should display error message
-	}
-	echo "<br/>";
-}
-
-
-display_main_options();
-
-switch($action)
-{
-	case CREATE_VIRTUAL_COURSE_OPTION:
-							display_create_virtual_course_form();
-							break;
-	case DISPLAY_VIRTUAL_COURSE_LIST_OPTION:
-							display_virtual_course_list();
-							break;
-}
-
-/*
-==============================================================================
-		FOOTER
-==============================================================================
-*/
-Display::display_footer();
-?>

+ 1 - 3
main/admin/dashboard_add_courses_to_user.php

@@ -11,9 +11,7 @@ $language_file = 'admin';
 // resetting the course id
 $cidReset = true;
 
-// including some necessary dokeos files
 require_once '../inc/global.inc.php';
-require_once '../inc/lib/xajax/xajax.inc.php';
 
 global $_configuration;
 
@@ -63,7 +61,7 @@ function search_courses($needle, $type)
 {
     global $_configuration, $tbl_course, $tbl_course_rel_access_url,$user_id;
 
-    $xajax_response = new XajaxResponse();
+    $xajax_response = new xajaxResponse();
     $return = '';
     if (!empty($needle) && !empty($type)) {
         // xajax send utf8 datas... datas in db can be non-utf8 datas

+ 1 - 2
main/admin/dashboard_add_sessions_to_user.php

@@ -12,7 +12,6 @@ $language_file = 'admin';
 $cidReset = true;
 
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'xajax/xajax.inc.php';
 global $_configuration;
 
 // create an ajax object
@@ -63,7 +62,7 @@ function search_sessions($needle, $type)
 {
     global $_configuration, $tbl_session_rel_access_url, $tbl_session, $user_id;
 
-    $xajax_response = new XajaxResponse();
+    $xajax_response = new xajaxResponse();
     $return = '';
     if (!empty($needle) && !empty($type)) {
         // xajax send utf8 datas... datas in db can be non-utf8 datas

+ 76 - 18
main/admin/dashboard_add_users_to_user.php

@@ -12,7 +12,6 @@ $language_file = 'admin';
 $cidReset = true;
 
 require_once '../inc/global.inc.php';
-require_once '../inc/lib/xajax/xajax.inc.php';
 
 global $_configuration;
 $ajax_search = false;
@@ -40,6 +39,8 @@ $user_info = api_get_user_info($user_id);
 $user_anonymous  = api_get_anonymous_id();
 $current_user_id = api_get_user_id();
 
+$userStatus = api_get_user_status($user_id);
+
 $firstLetterUser = isset($_POST['firstLetterUser']) ? $_POST['firstLetterUser'] : null;
 
 // setting the name of the tool
@@ -47,6 +48,8 @@ if (UserManager::is_admin($user_id)) {
     $tool_name= get_lang('AssignUsersToPlatformAdministrator');
 } else if ($user_info['status'] == SESSIONADMIN) {
     $tool_name= get_lang('AssignUsersToSessionsAdministrator');
+} else if  ($user_info['status'] == STUDENT_BOSS) {
+    $tool_name= get_lang('AssignUsersToBoss');
 } else {
     $tool_name= get_lang('AssignUsersToHumanResourcesManager');
 }
@@ -62,16 +65,25 @@ if (!api_is_platform_admin()) {
 
 function search_users($needle,$type)
 {
-    global $tbl_access_url_rel_user,  $tbl_user, $user_anonymous, $current_user_id, $user_id;
+    global $tbl_access_url_rel_user,  $tbl_user, $user_anonymous, $current_user_id, $user_id, $userStatus;
 
-    $xajax_response = new XajaxResponse();
+    $xajax_response = new xajaxResponse();
     $return = '';
     if (!empty($needle) && !empty($type)) {
         // xajax send utf8 datas... datas in db can be non-utf8 datas
         $charset = api_get_system_encoding();
         $needle = api_convert_encoding($needle, $charset, 'utf-8');
+        $assigned_users_to_hrm = array();
+
+        switch ($userStatus) {
+            case DRH:
+                $assigned_users_to_hrm = UserManager::get_users_followed_by_drh($user_id);
+                break;
+            case STUDENT_BOSS:
+                $assigned_users_to_hrm = UserManager::getUsersFollowedByStudentBoss($user_id);
+                break;
+        }
 
-        $assigned_users_to_hrm = UserManager::get_users_followed_by_drh($user_id);
         $assigned_users_id = array_keys($assigned_users_to_hrm);
         $without_assigned_users = '';
 
@@ -92,7 +104,7 @@ function search_users($needle,$type)
                     LEFT JOIN $tbl_access_url_rel_user au ON (au.user_id = user.user_id)
                     WHERE
                         ".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%' AND
-                        status NOT IN(".DRH.", ".SESSIONADMIN.") AND
+                        status NOT IN(".DRH.", ".SESSIONADMIN.", " . STUDENT_BOSS . ") AND
                         user.user_id NOT IN ($user_anonymous, $current_user_id, $user_id)
                         $without_assigned_users AND
                         access_url_id = ".api_get_current_access_url_id()."
@@ -104,7 +116,7 @@ function search_users($needle,$type)
                     FROM $tbl_user user
                     WHERE
                         ".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%' AND
-                        status NOT IN(".DRH.", ".SESSIONADMIN.") AND
+                        status NOT IN(".DRH.", ".SESSIONADMIN.", " . STUDENT_BOSS . ") AND
                         user_id NOT IN ($user_anonymous, $current_user_id, $user_id)
                     $without_assigned_users
                     $order_clause
@@ -127,10 +139,19 @@ function search_users($needle,$type)
                             username LIKE "'.$needle.'%" OR
                             firstname LIKE "'.$needle.'%" OR
                             lastname LIKE "'.$needle.'%"
-                        ) AND
-                        user.status<>6 AND user.status<>'.DRH.' '.
-                    $order_clause.
-                   ' LIMIT 11';
+                        ) AND ';
+
+            switch ($userStatus) {
+                case DRH:
+                    $sql .= " user.status <> 6 AND user.status <> " . DRH;
+                    break;
+                case STUDENT_BOSS:
+                    $sql .= " user.status <> 6 AND user.status <> " . STUDENT_BOSS;
+                    break;
+            }
+
+            $sql .= " $order_clause LIMIT 11";
+
             $rs = Database::query($sql);
             $i = 0;
             while ($user = Database :: fetch_array($rs)) {
@@ -238,7 +259,7 @@ $filters = array(
 );
 
 $searchForm = new FormValidator('search', 'get', api_get_self().'?user='.$user_id);
-$searchForm->add_header(get_lang('AdvancedSearch'));
+$searchForm->addHeader(get_lang('AdvancedSearch'));
 $renderer =& $searchForm->defaultRenderer();
 
 $searchForm->addElement('hidden', 'user', $user_id);
@@ -267,7 +288,18 @@ if (!empty($filters) && !empty($filterData)) {
 $msg = '';
 if (isset($_POST['formSent']) && intval($_POST['formSent']) == 1) {
 	$user_list = $_POST['UsersList'];
-    $affected_rows = UserManager::suscribe_users_to_hr_manager($user_id, $user_list);
+
+    switch ($userStatus) {
+        case DRH:
+            $affected_rows = UserManager::suscribe_users_to_hr_manager($user_id, $user_list);
+            break;
+        case STUDENT_BOSS;
+            $affected_rows = UserManager::subscribeUsersToBoss($user_id, $user_list);
+            break;
+        default:
+            $affected_rows = 0;
+    }
+
     if ($affected_rows)	{
         $msg = get_lang('AssignedUsersHaveBeenUpdatedSuccessfully');
     }
@@ -278,11 +310,27 @@ Display::display_header($tool_name);
 
 // actions
 echo '<div class="actions">';
-echo '<span style="float: right;margin:0px;padding:0px;">
-<a href="dashboard_add_courses_to_user.php?user='.$user_id.'">'.
-    Display::return_icon('course_add.gif', get_lang('AssignCourses'), array('style'=>'vertical-align:middle')).' '.get_lang('AssignCourses').'</a>
-<a href="dashboard_add_sessions_to_user.php?user='.$user_id.'">'.
-    Display::return_icon('view_more_stats.gif', get_lang('AssignSessions'), array('style'=>'vertical-align:middle')).' '.get_lang('AssignSessions').'</a></span>';
+
+if ($userStatus != STUDENT_BOSS) {
+    $actions = Display::url(
+        Display::return_icon('course_add.gif', get_lang('AssignCourses'),
+            array(
+            'style' => 'vertical-align:middle'
+        )) . get_lang('AssignCourses'), "dashboard_add_courses_to_user.php?user=$user_id"
+    );
+
+    $actions .= Display::url(
+        Display::return_icon('view_more_stats.gif', get_lang('AssignSessions'),
+            array(
+            'style' => 'vertical-align:middle'
+        )) . get_lang('AssignSessions'), "dashboard_add_sessions_to_user.php?user=$user_id"
+    );
+
+    echo Display::span($actions, array(
+        'style' => 'float: right; margin: 0; paddingg: 0;'
+    ));
+}
+
 echo Display::url(get_lang('AdvancedSearch'), '#', array('class' => 'advanced_options', 'id' => 'advanced_search'));
 echo '</div>';
 
@@ -294,7 +342,15 @@ echo Display::page_header(
     sprintf(get_lang('AssignUsersToX'), api_get_person_name($user_info['firstname'], $user_info['lastname']))
 );
 
-$assigned_users_to_hrm = UserManager::get_users_followed_by_drh($user_id);
+switch ($userStatus) {
+    case DRH:
+        $assigned_users_to_hrm = UserManager::get_users_followed_by_drh($user_id);
+        break;
+    case STUDENT_BOSS;
+        $assigned_users_to_hrm = UserManager::getUsersFollowedByStudentBoss($user_id);
+        break;
+}
+
 $assigned_users_id = array_keys($assigned_users_to_hrm);
 $without_assigned_users = '';
 if (count($assigned_users_id) > 0) {
@@ -368,6 +424,8 @@ if(!empty($msg)) {
 		echo get_lang('AssignedUsersListToPlatformAdministrator');
 	} else if ($user_info['status'] == SESSIONADMIN) {
 		echo get_lang('AssignedUsersListToSessionsAdministrator');
+	} else if ($user_info['status'] == STUDENT_BOSS) {
+		echo get_lang('AssignedUsersListToStudentBoss');
 	} else {
 		echo get_lang('AssignedUsersListToHumanResourcesManager');
 	}

+ 16 - 18
main/admin/event_controller.php

@@ -4,9 +4,7 @@
  * Global events controller class
  * @package chamilo.admin
  */
-/**
- * Code
- */
+
 // name of the language file that needs to be included
 $language_file = array('admin');
 $cidReset = true;
@@ -19,26 +17,26 @@ if (api_get_setting('activate_email_template') != 'true') {
 
 class eventController { // extends Controller {
     public function showAction() {
-               
+
     }
-    
+
     public function newAction() {
-        
+
     }
-    
+
     public function addAction() {
-        
+
     }
-    
+
     public function listingAction() {
         $event_email_template = new EventEmailTemplate();
-        return $event_email_template->display(); 
+        return $event_email_template->display();
     }
-    
+
     public function deleteAction($id) {
          $event_email_template = new EventEmailTemplate();
-        return $event_email_template->delete($id); 
-    }    
+        return $event_email_template->delete($id);
+    }
 }
 
 $event_controller = new eventController();
@@ -67,7 +65,7 @@ switch ($action) {
 //jqgrid will use this URL to do the selects
 $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 
+//The order is important you need to check the the $column variable in the model.ajax.php file
 $columns        = array(get_lang('Subject'), get_lang('EventTypeName'), get_lang('Language'), get_lang('Status'), get_lang('Actions'));
 
 //Column config
@@ -78,16 +76,16 @@ $column_model   = array(
                         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')
-                       );            
-//Autowidth             
+                       );
+//Autowidth
 $extra_params['autowidth'] = 'true';
-//height auto 
+//height auto
 $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, array(), $action_links,true).'
 });
 </script>';
 

+ 35 - 36
main/admin/event_type.php

@@ -12,7 +12,6 @@ $language_file = array('admin');
 $cidReset = true;
 
 require_once '../inc/global.inc.php';
-require_once '../inc/conf/events.conf.php';
 $this_section = SECTION_PLATFORM_ADMIN;
 
 api_protect_admin_script();
@@ -35,16 +34,16 @@ if ($action == 'modEventType') {
         $users = explode(';', $eventUsers);
     } else {
         $users = array();
-    }        
+    }
     if (!empty($event_name)) {
         $eventName = $event_name;
-    }    
-    save_event_type_message($eventName, $users, $eventMessage, $eventSubject, $eventMessageLanguage, $activated);
+    }
+    Event::save_event_type_message($eventName, $users, $eventMessage, $eventSubject, $eventMessageLanguage, $activated);
     header('location: event_controller.php');
     exit;
 }
 
-$ets = get_all_event_types();
+$ets = Event::get_all_event_types();
 
 $languages = api_get_languages();
 
@@ -64,7 +63,7 @@ foreach ($users as $user) {
 
 /**
  * Header definition
- */ 
+ */
 $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
 $interbreadcrumb[] = array('url' => 'event_controller.php', 'name' => get_lang('Events'));
 $tool_name = get_lang('EventMessageManagement');
@@ -84,16 +83,16 @@ echo Display::actions($action_array);
     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 key_lang = "<?php echo $key_lang ?>";
     var event_type_name = "<?php echo $event_name ?>";
-    
-    $(document).ready(function() {        
+
+    $(document).ready(function() {
         confirmMessage("eventList");
         if (event_type_name != 0) {
             $("#event_list_group").hide();
         }
     });
-    
+
     function ajax(params,func) {
         $.ajax({
             url: "<?php echo $ajaxPath ?>",
@@ -103,27 +102,27 @@ echo Display::actions($action_array);
         });
     }
 
-    function refreshUsersList() {    
+    function refreshUsersList() {
         removeAllOption($('#usersList'));
-        $.each(usersList, function(ind,item) {              
+        $.each(usersList, function(ind,item) {
             addOption($('#usersList'), item.user_id, item.firstname + ' '+item.lastname);
-        });        
+        });
     }
 
     function getCurrentEventTypeName() {
         var name = false;
-        
+
         if (event_type_name != 0) {
             return event_type_name;
         } else {
             return $('#eventList option:selected').first().attr('value');
         }
-        
+
     }
-    
+
     function self_sent_lock(self_sent) {
         if (self_sent == true) {
-            $(".registration_case").show();        
+            $(".registration_case").show();
             $("#usersList").attr('disabled', 'true');
             $("#usersSubList").attr('disabled', 'true');
             removeAllOption($('#usersSubList'));
@@ -135,17 +134,17 @@ echo Display::actions($action_array);
     }
 
     function showEventType() {
-        cleanInput();        
+        cleanInput();
         currentEventName = getCurrentEventTypeName();
-        
+
         $("span#activated_checkbox").css("display", "inline"); // make checkbox visible
         $('input[name=activated]').attr('checked', false);
-        
-        var self_sent = false;        
+
+        var self_sent = false;
 
         if (typeof(eventsConfig[currentEventName])!='undefined') {
             // if registration, only sent to self_user
-            if (eventsConfig[currentEventName].self_sent == true) {                
+            if (eventsConfig[currentEventName].self_sent == true) {
                 self_sent = true;
             }
         }
@@ -180,9 +179,9 @@ echo Display::actions($action_array);
                 $('#keys').append('<li>'+key+'</li>');
             });
         }
-        
+
         if (self_sent == false ) {
-        
+
             $.ajax({
                 url: '<?php echo $ajaxPath ?>?action=get_event_users&eventName=' +currentEventName,
                 dataType: 'json',
@@ -190,8 +189,8 @@ echo Display::actions($action_array);
                     removeAllOption($('#usersSubList'));
                     refreshUsersList();
                     usersIds = new Array();
-                    var json = jQuery.parseJSON(data);                
-                    $.each(json, function(ind,item) {                    
+                    var json = jQuery.parseJSON(data);
+                    $.each(json, function(ind,item) {
                         addOption($('#usersSubList'),item.user_id, item.firstname + ' '+item.lastname);
                         usersIds[ind] = item.value;
                         removeOption($('#usersList'),item.user_id);
@@ -224,7 +223,7 @@ echo Display::actions($action_array);
         select.find('option[value='+value+']').remove();
     }
 
-    function removeAllOption(select) {          
+    function removeAllOption(select) {
         select.find('option').remove();
     }
 
@@ -267,8 +266,8 @@ echo Display::actions($action_array);
     /**
      * Asks if user want to abandon the changes he's done
      */
-    function confirmMessage(sender) {   
-        
+    function confirmMessage(sender) {
+
         if (flagContentHasChanged == true) {
             if (confirm(key_lang)) {
                 flagContentHasChanged = false;
@@ -308,23 +307,23 @@ echo Display::actions($action_array);
 
 <form method="POST" onSubmit="return submitForm(); ">
     <div class="row">
-        
+
     <div class="span12" id="event_list_group">
-        <h4><?php echo get_lang('Events'); ?></h4>       
+        <h4><?php echo get_lang('Events'); ?></h4>
         <select class="span6" multiple="1" id="eventList" onchange="confirmMessage(this.name); return false;" name="eventList">
         <?php
         foreach ($event_config as $key => $config) {
             echo '<option value="' . $key . '">' . $config['name_lang_var'] . '</option>';
         }
         ?>
-        </select>        
+        </select>
     </div>
-        
+
     <div class="span4">
         <h4><?php echo get_lang('Users'); ?></h4>
         <select multiple="1" id="usersList" class="span3 registration_case"></select>
     </div>
-    <div class="span4">          
+    <div class="span4">
         <div class="registration_case">
             <button class="arrowr" onclick='moveUsers($("#usersList"),$("#usersSubList")); return false;'></button>
             <br />
@@ -336,13 +335,13 @@ echo Display::actions($action_array);
         <h4><?php echo get_lang('ToBeWarnedUserList'); ?></h4>
         <select class="span3" multiple="1" id="usersSubList" class="registration_case"></select>
     </div>
-    </div>    
+    </div>
 
     <br />
     <h2 id="eventNameTitle"></h2>
         <span id="activated_checkbox">
             <input type="checkbox" name="activated" value="1" />
-            <label for="activated" style="display:inline;"><?php echo get_lang('ActivateEvent'); ?></label>        
+            <label for="activated" style="display:inline;"><?php echo get_lang('ActivateEvent'); ?></label>
         </span>
     <br />
     <select id="languages" name="languages" style="margin-top:20px;" onclick='confirmMessage(this.name); return false;'>

+ 1 - 1
main/admin/example_class.csv

@@ -1,3 +1,3 @@
-name;description
+name;description;
 Class A4;20 students in general courses
 Class B5;20 students from technical background

+ 1 - 4
main/admin/export_certificates.php

@@ -13,9 +13,6 @@ $cidReset = true;
 
 require_once '../inc/global.inc.php';
 
-require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be.inc.php';
-require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/gradebook_functions.inc.php';
-
 Display::display_header(null);
 
 $form = new FormValidator('export_certificate');
@@ -26,7 +23,7 @@ foreach ($courses as $course) {
 }
 $form->addElement('select', 'course', get_lang('Course'), $options);
 $form->addElement('file', 'file', get_lang('File'));
-$form->add_button('submit', get_lang('Submit'));
+$form->addButton('submit', get_lang('Submit'));
 $form->display();
 
 if ($form->validate()) {

+ 25 - 25
main/admin/extra_fields.php

@@ -10,10 +10,9 @@ $language_file = array('admin');
 
 $cidReset = true;
 
-$cidReset = true;
 require_once '../inc/global.inc.php';
 
-$extraFieldType =  isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
+$extraFieldType = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
 
 $this_section = SECTION_PLATFORM_ADMIN;
 
@@ -23,7 +22,7 @@ api_protect_admin_script();
 $htmlHeadXtra[] = api_get_jqgrid_js();
 
 // setting breadcrumbs
-$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
 
 $tool_name = null;
 
@@ -40,7 +39,7 @@ $obj = new ExtraField($extraFieldType);
 $obj->setupBreadcrumb($interbreadcrumb, $action);
 
 //jqgrid will use this URL to do the selects
-$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_extra_fields&type='.$extraFieldType;
+$url = api_get_path(WEB_AJAX_PATH) . 'model.ajax.php?a=get_extra_fields&type=' . $extraFieldType;
 
 //The order is important you need to check the the $column variable in the model.ajax.php file
 $columns = $obj->getJqgridColumnNames();
@@ -56,46 +55,47 @@ $extra_params['sortname'] = 'field_order';
 
 $action_links = $obj->getJqgridActionLinks($token);
 
-$htmlHeadXtra[]='<script>
+$htmlHeadXtra[] = '<script>
 $(function() {
     // grid definition see the $obj->display() function
-    '.Display::grid_js($obj->type.'_fields',  $url, $columns, $column_model, $extra_params, array(), $action_links, true).'
+    ' . Display::grid_js($obj->type . '_fields', $url, $columns, $column_model, $extra_params, array(), $action_links,
+        true) . '
 
     $("#field_type").on("change", 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;
         }
     });
@@ -112,14 +112,14 @@ switch ($action) {
         if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
             api_not_allowed();
         }
-        $url  = api_get_self().'?type='.$obj->type.'&action='.Security::remove_XSS($_GET['action']);
+        $url = api_get_self() . '?type=' . $obj->type . '&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) {
                 Display::display_confirmation_message(get_lang('ItemAdded'));
             }
@@ -127,8 +127,8 @@ switch ($action) {
             $obj->display();
         } else {
             echo '<div class="actions">';
-            echo '<a href="'.api_get_self().'?type='.$obj->type.'">'.
-                Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>';
+            echo '<a href="' . api_get_self() . '?type=' . $obj->type . '">' .
+            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));
@@ -137,21 +137,21 @@ switch ($action) {
         break;
     case 'edit':
         // Action handling: Editing
-        $url  = api_get_self().'?type='.$obj->type.'&action='.Security::remove_XSS($_GET['action']).'&id='.intval($_GET['id']);
+        $url = api_get_self() . '?type=' . $obj->type . '&action=' . Security::remove_XSS($_GET['action']) . '&id=' . intval($_GET['id']);
         $form = $obj->return_form($url, 'edit');
 
         // The validation or display
         if ($form->validate()) {
             //if ($check) {
             $values = $form->exportValues();
-            $res    = $obj->update($values);
+            $res = $obj->update($values);
             Display::display_confirmation_message(sprintf(get_lang('ItemUpdated'), $values['field_variable']), false);
             //}
             $obj->display();
         } else {
             echo '<div class="actions">';
-            echo '<a href="'.api_get_self().'?type='.$obj->type.'">'.
-                Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>';
+            echo '<a href="' . api_get_self() . '?type=' . $obj->type . '">' .
+            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));

+ 29 - 33
main/admin/grade_models.php

@@ -10,7 +10,6 @@ $language_file = array('admin', 'gradebook');
 
 $cidReset = true;
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'grade_model.lib.php';
 
 $this_section = SECTION_PLATFORM_ADMIN;
 
@@ -29,9 +28,9 @@ $interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'
 $action = isset($_GET['action']) ? $_GET['action'] : null;
 
 $check = Security::check_token('request');
-$token = Security::get_token();    
+$token = Security::get_token();
 
-if ($action == 'add') {    
+if ($action == 'add') {
     $interbreadcrumb[]=array('url' => 'grade_models.php','name' => get_lang('GradeModel'));
     $interbreadcrumb[]=array('url' => '#','name' => get_lang('Add'));
 } elseif ($action == 'edit') {
@@ -42,7 +41,7 @@ if ($action == 'add') {
 }
 
 $htmlHeadXtra[]= '<script>
-    
+
 function plusItem(item) {
         if (item != 1) {
 		document.getElementById(item).style.display = "inline";
@@ -54,7 +53,7 @@ function plusItem(item) {
 	 	//document.getElementById("txta-"+(item-1)).value = "";
         }
   }
-  
+
 function minItem(item) {
     if (item != 1) {
      document.getElementById(item).style.display = "none";
@@ -76,7 +75,7 @@ Display::display_header($tool_name);
 //jqgrid will use this URL to do the selects
 $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 
+//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'));
 
 //Column config
@@ -84,25 +83,25 @@ $column_model   = array(
                         array('name'=>'name',           'index'=>'name',        'width'=>'80',   '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')
-                       );            
-//Autowidth             
+                       );
+//Autowidth
 $extra_params['autowidth'] = 'true';
-//height auto 
-$extra_params['height'] = 'auto'; 
+//height auto
+$extra_params['height'] = 'auto';
 
 //With this function we can add actions to the jgrid (edit, delete, etc)
 $action_links = 'function action_formatter(cellvalue, options, rowObject) {
-                         return \'<a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'.                         
+                         return \'<a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'.
                          '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;"  href="?sec_token='.$token.'&action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'.
-                         '\'; 
+                         '\';
                  }';
 ?>
 <script>
 $(function() {
-<?php 
+<?php
     // grid definition see the $obj->display() function
-    echo Display::grid_js('grade_model',  $url, $columns, $column_model, $extra_params, array(), $action_links,true);       
-?> 
+    echo Display::grid_js('grade_model',  $url, $columns, $column_model, $extra_params, array(), $action_links,true);
+?>
 });
 </script>
 <?php
@@ -113,44 +112,41 @@ switch ($action) {
     case 'add':
         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']);
         $form = $obj->return_form($url, 'add');
-        
-        
-        
         // The validation or display
-        if ($form->validate()) {            
-            if ($check) {     
+        if ($form->validate()) {
+            if ($check) {
                 $values = $form->exportValues();
-                $res    = $obj->save($values);            
+                $res    = $obj->save($values);
                 if ($res) {
                     Display::display_confirmation_message(get_lang('ItemAdded'));
                 }
-            }        
+            }
             $obj->display();
         } else {
             echo '<div class="actions">';
             echo '<a href="'.api_get_self().'">'.Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>';
-            echo '</div>';            
+            echo '</div>';
             $form->addElement('hidden', 'sec_token');
             $form->setConstants(array('sec_token' => $token));
             $form->display();
         }
         break;
     case 'edit':
-        // Action handling: Editing 
+        // Action handling: Editing
         $url  = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&id='.intval($_GET['id']);
-        $form = $obj->return_form($url, 'edit');    
+        $form = $obj->return_form($url, 'edit');
 
         // The validation or display
-        if ($form->validate()) {            
+        if ($form->validate()) {
             if ($check) {
-                $values = $form->exportValues();                
+                $values = $form->exportValues();
                 $res    = $obj->update($values);
-                Display::display_confirmation_message(get_lang('ItemUpdated'), false);                
-            }            
+                Display::display_confirmation_message(get_lang('ItemUpdated'), false);
+            }
             $obj->display();
         } else {
             echo '<div class="actions">';
@@ -170,9 +166,9 @@ switch ($action) {
             }
         }
         $obj->display();
-        break;   
+        break;
     default:
-        $obj->display();   
+        $obj->display();
         break;
 }
-Display :: display_footer();
+Display :: display_footer();

+ 1 - 3
main/admin/group_add.php

@@ -12,8 +12,6 @@ $cidReset = true;
 // Including necessary libraries.
 require '../inc/global.inc.php';
 $libpath = api_get_path(LIBRARY_PATH);
-require_once $libpath.'fileManage.lib.php';
-require_once $libpath.'fileUpload.lib.php';
 
 // Section for the tabs
 $this_section = SECTION_PLATFORM_ADMIN;
@@ -143,7 +141,7 @@ if( $form->validate()) {
 			else {
 				$emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($firstname, $lastname)).",\n\n".get_lang('YouAreReg')." ".api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : ". $username ."\n". get_lang('Pass')." : ".stripslashes($password)."\n\n" .get_lang('Address') ." ". api_get_setting('siteName') ." ". get_lang('Is') ." : ". $_configuration['root_web'] ."\n\n". get_lang('Problem'). "\n\n". get_lang('SignatureFormula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator');
 			}
-			@api_mail($recipient_name, $email, $emailsubject, $emailbody, $sender_name, $email_admin);
+			@api_mail_html($recipient_name, $email, $emailsubject, $emailbody, $sender_name, $email_admin);
 		}*/
 
 		Security::clear_token();

+ 0 - 4
main/admin/group_edit.php

@@ -12,10 +12,6 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script();
 
 $libpath = api_get_path(LIBRARY_PATH);
-require_once $libpath.'fileManage.lib.php';
-require_once $libpath.'fileUpload.lib.php';
-require_once $libpath.'group_portal_manager.lib.php';
-require_once $libpath.'mail.lib.inc.php';
 
 $group_id = isset($_GET['id']) ? intval($_GET['id']) : intval($_POST['id']);
 $tool_name = get_lang('GroupEdit');

+ 5 - 7
main/admin/group_list.php

@@ -10,8 +10,6 @@
 $language_file = array('registration', 'admin', 'userInfo');
 $cidReset = true;
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'xajax/xajax.inc.php';
-require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
 
 $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
@@ -265,11 +263,11 @@ if (isset($_GET['search']) && $_GET['search'] == 'advanced') {
     //api_display_tool_title($tool_name);
     $form = new FormValidator('advanced_search', 'get');
     $form->addElement('header', '', $tool_name);
-    $form->add_textfield('keyword_firstname', get_lang('FirstName'), false);
-    $form->add_textfield('keyword_lastname', get_lang('LastName'), false);
-    $form->add_textfield('keyword_username', get_lang('LoginName'), false);
-    $form->add_textfield('keyword_email', get_lang('Email'), false);
-    $form->add_textfield('keyword_officialcode', get_lang('OfficialCode'), false);
+    $form->addText('keyword_firstname', get_lang('FirstName'), false);
+    $form->addText('keyword_lastname', get_lang('LastName'), false);
+    $form->addText('keyword_username', get_lang('LoginName'), false);
+    $form->addText('keyword_email', get_lang('Email'), false);
+    $form->addText('keyword_officialcode', get_lang('OfficialCode'), false);
     $status_options = array();
     $status_options['%'] = get_lang('All');
     $status_options[STUDENT] = get_lang('Student');

+ 0 - 5
main/admin/inactive_user_list.php

@@ -13,12 +13,7 @@
 $language_file = array ('registration','admin');
 $cidReset = true;
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'sortable_table.class.php';
-require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
-require_once api_get_path(LIBRARY_PATH).'security.lib.php';
-require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
 
-$tbl_stats_access 		= Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS);
 $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 

+ 118 - 19
main/admin/index.php

@@ -16,7 +16,6 @@ $cidReset = true;
 
 // Including some necessary chamilo files.
 require_once '../inc/global.inc.php';
-require_once api_get_path(SYS_CODE_PATH).'admin/statistics/statistics.lib.php';
 
 // Setting the section (for the tabs).
 $this_section = SECTION_PLATFORM_ADMIN;
@@ -26,6 +25,20 @@ api_protect_admin_script(true);
 
 $nameTools = get_lang('PlatformAdmin');
 
+if (api_is_multiple_url_enabled()) {
+    $accessUrlId = api_get_current_access_url_id();
+
+    if ($accessUrlId != -1) {
+        $urlInfo = api_get_access_url($accessUrlId);
+        $url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $urlInfo['url']));
+        $cleanUrl = str_replace('/', '-', $url);
+
+        $adminExtraContentDir = api_get_path(SYS_PATH) . "home/$cleanUrl/admin/";
+    }
+} else {
+    $adminExtraContentDir = api_get_path(SYS_PATH) . "home/admin/";
+}
+
 // Displaying the header
 $message = '';
 
@@ -61,17 +74,40 @@ if (isset($_GET['msg']) && isset($_GET['type'])) {
 
 $blocks = array();
 
+// 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));
+    $data = $hook->notifyAdminBlock(HOOK_EVENT_TYPE_PRE);
+    // Check if blocks data is not null
+    if (isset($data['blocks'])) {
+        // Get modified blocks
+        $blocks = $data['blocks'];
+    }
+}
+
 /* Users */
 
 $blocks['users']['icon']  = Display::return_icon('members.gif', get_lang('Users'), array(), ICON_SIZE_SMALL, false);
 $blocks['users']['label'] = api_ucfirst(get_lang('Users'));
 $blocks['users']['class'] = 'block-admin-users';
 
+$usersBlockExtraFile = "{$adminExtraContentDir}block-admin-users_extra.html";
+
+if (file_exists($usersBlockExtraFile)) {
+    $blocks['users']['extraContent'] = file_get_contents($usersBlockExtraFile);
+}
+
 if (api_is_platform_admin()) {
+    $blocks['users']['editable'] = true;
+
     $search_form = '
-            <form method="get" class="form-search" action="user_list.php">
-                <input class="span3" type="text" name="keyword" value="">
-                <button class="btn" type="submit">'.get_lang('Search').'</button>
+            <form method="get" class="form-inline" action="user_list.php">
+                <div class="form-group">
+                <input class="form-control" type="text" name="keyword" value="">
+                <button class="btn btn-default" type="submit">'.get_lang('Search').'</button>
+                </div>
             </form>';
     $blocks['users']['search_form'] = $search_form;
     $items = array(
@@ -81,12 +117,10 @@ if (api_is_platform_admin()) {
         array('url'=>'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')),
         array('url'=>'user_update_import.php', 'label' => get_lang('EditUserListCSV')),
     );
+    $items[] = array('url'=>'group_add.php', 	'label' => get_lang('AddGroups'));
+    $items[] = array('url'=>'group_list.php', 	'label' => get_lang('GroupList'));
 
-    if (api_get_setting('allow_social_tool') == 'true') {
-        $items[] = array('url'=>'group_add.php', 	'label' => get_lang('AddGroups'));
-        $items[] = array('url'=>'group_list.php', 	'label' => get_lang('GroupList'));
-    }
-    if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
+    if (isset($extAuthSource) && isset($extAuthSource['extldap']) && count($extAuthSource['extldap']) > 0) {
         $items[] = array('url'=>'ldap_users_list.php', 	'label' => get_lang('ImportLDAPUsersIntoPlatform'));
     }
     $items[] = array('url'=>'user_fields.php', 	'label' => get_lang('ManageUserFields'));
@@ -108,10 +142,19 @@ if (api_is_platform_admin()) {
     $blocks['courses']['icon']  = Display::return_icon('course.gif', get_lang('Courses'), array(), ICON_SIZE_MEDIUM, false);
     $blocks['courses']['label'] = api_ucfirst(get_lang('Courses'));
     $blocks['courses']['class'] = 'block-admin-courses';
+    $blocks['courses']['editable'] = true;
 
-    $search_form = ' <form method="get" class="form-search" action="course_list.php">
-							<input class="span3" type="text" name="keyword" value="">
-							<button class="btn" type="submit">'.get_lang('Search').'</button>
+    $coursesBlockExtraFile = "{$adminExtraContentDir}block-admin-courses_extra.html";
+
+    if (file_exists($coursesBlockExtraFile)) {
+        $blocks['courses']['extraContent'] = file_get_contents($coursesBlockExtraFile);
+    }
+
+    $search_form = ' <form method="get" class="form-inline" action="course_list.php">
+                            <div class="form-group">
+							<input class="form-control" type="text" name="keyword" value="">
+							<button class="btn btn-default" type="submit">'.get_lang('Search').'</button>
+							</div>
 	            		</form>';
     $blocks['courses']['search_form'] = $search_form;
 
@@ -140,6 +183,9 @@ if (api_is_platform_admin()) {
     if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
         $items[] = array('url'=>'ldap_import_students.php', 'label' => get_lang('ImportLDAPUsersIntoCourse'));
     }
+
+    $items[] = array('url'=>'extra_fields.php?type=course', 	'label' => get_lang('ManageCourseFields'));
+
     $blocks['courses']['items'] = $items;
     $blocks['courses']['extra'] = null;
 
@@ -147,16 +193,23 @@ if (api_is_platform_admin()) {
     $blocks['platform']['icon']  = Display::return_icon('platform.png', get_lang('Platform'), array(), ICON_SIZE_MEDIUM, false);
     $blocks['platform']['label'] = api_ucfirst(get_lang('Platform'));
     $blocks['platform']['class'] = 'block-admin-platform';
+    $blocks['platform']['editable'] = true;
+
+    $platformBlockExtraFile = "{$adminExtraContentDir}block-admin-platform_extra.html";
 
+    if (file_exists($platformBlockExtraFile)) {
+        $blocks['platform']['extraContent'] = file_get_contents($platformBlockExtraFile);
+    }
 
-    $search_form = ' <form method="get" action="settings.php" class="form-search">
-							<input class="span3" type="text" name="search_field" value="" >
+    $search_form = ' <form method="get" action="settings.php" class="form-inline">
+                            <div class="form-group">
+							<input class="form-control" type="text" name="search_field" value="" >
                             <input type="hidden" value="search_setting" name="category">
-							<button class="btn" type="submit">'.get_lang('Search').'</button>
+							<button class="btn btn-default" type="submit">'.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'=>'settings.php?category=Plugins','label' => get_lang('Plugins'));
@@ -167,6 +220,10 @@ if (api_is_platform_admin()) {
     $items[] = array('url'=>'configure_inscription.php', 	'label' => get_lang('ConfigureInscription'));
     $items[] = array('url'=>'statistics/index.php', 		'label' => get_lang('Statistics'));
     $items[] = array('url'=> api_get_path(WEB_CODE_PATH).'mySpace/company_reports.php',          'label' => get_lang('Reports'));
+    $items[] = array(
+        'url'=> api_get_path(WEB_CODE_PATH) . 'admin/teacher_time_report.php',
+        'label' => get_lang('TeacherTimeReport')
+    );
 
     /* Event settings */
 
@@ -195,10 +252,21 @@ $blocks['sessions']['icon']  = Display::return_icon('session.png', get_lang('Ses
 $blocks['sessions']['label'] = api_ucfirst(get_lang('Sessions'));
 $blocks['sessions']['class'] = 'block-admin-sessions';
 
+$sessionsBlockExtraFile = "{$adminExtraContentDir}block-admin-sessions_extra.html";
+
+if (file_exists($sessionsBlockExtraFile)) {
+    $blocks['sessions']['extraContent'] = file_get_contents($sessionsBlockExtraFile);
+}
+
+if (api_is_platform_admin()) {
+    $blocks['sessions']['editable'] = true;
+}
 
-$search_form = ' <form method="GET" class="form-search" action="session_list.php">
-                    <input class="span3" type="text" name="keyword" value="">
-                    <button class="btn" type="submit">'.get_lang('Search').'</button>
+$search_form = ' <form method="GET" class="form-inline" action="session_list.php">
+                    <div class="form-group">
+                    <input class="form-control" type="text" name="keyword" value="">
+                    <button class="btn btn-default" type="submit">'.get_lang('Search').'</button>
+                    </div>
                 </form>';
 $blocks['sessions']['search_form'] = $search_form;
 $items = array();
@@ -220,6 +288,8 @@ if (api_is_platform_admin()) {
     $items[] = array('url'=>'career_dashboard.php', 	'label' => get_lang('CareersAndPromotions'));
 }
 
+$items[] = array('url'=>'extra_fields.php?type=session', 	'label' => get_lang('ManageSessionFields'));
+
 $blocks['sessions']['items'] = $items;
 $blocks['sessions']['extra'] = null;
 
@@ -293,6 +363,7 @@ if (api_is_platform_admin()) {
         //$items[] = array('url'=>'skills_profile.php',   'label' => get_lang('SkillsProfile'));
         $items[] = array('url'=>api_get_path(WEB_CODE_PATH).'social/skills_ranking.php',   'label' => get_lang('SkillsRanking'));
         $items[] = array('url'=>'skills_gradebook.php', 'label' => get_lang('SkillsAndGradebooks'));
+        $items[] = array('url'=> api_get_path(WEB_CODE_PATH) . 'admin/skill_badge.php', 'label' => get_lang('Badges'));
         $blocks['skills']['items'] = $items;
         $blocks['skills']['extra'] = null;
         $blocks['skills']['search_form'] = null;
@@ -334,10 +405,38 @@ if (api_is_platform_admin()) {
     $blocks['version_check']['items'] = null;
     $blocks['version_check']['class'] = 'block-admin-version_check';
 
+    // 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));
+        $data = $hook->notifyAdminBlock(HOOK_EVENT_TYPE_POST);
+        // Check if blocks data is not null
+        if (isset($data['blocks'])) {
+            // Get modified blocks
+            $blocks = $data['blocks'];
+        }
+    }
+
 }
 $admin_ajax_url = api_get_path(WEB_AJAX_PATH).'admin.ajax.php';
 
 $tpl = new Template();
+
+// Display the Site Use Cookie Warning Validation
+$useCookieValidation = api_get_configuration_value('cookie_warning');
+if ($useCookieValidation) {
+    if (isset($_POST['acceptCookies'])) {
+        api_set_site_use_cookie_warning_cookie();
+    } else if (!api_site_use_cookie_warning_cookie_exist()) {
+        if (Template::isToolBarDisplayedForUser()) {
+            $tpl->assign('toolBarDisplayed', true);
+        } else {
+            $tpl->assign('toolBarDisplayed', false);
+        }
+        $tpl->assign('displayCookieUsageWarning', true);
+    }
+}
+
 $tpl->assign('web_admin_ajax_url', $admin_ajax_url);
 $tpl->assign('blocks', $blocks);
 // The template contains the call to the AJAX version checker

+ 0 - 1
main/admin/languages.php

@@ -24,7 +24,6 @@ $cidReset = true;
 
 // include global script
 require_once '../inc/global.inc.php';
-require_once 'sub_language.class.php';
 $this_section = SECTION_PLATFORM_ADMIN;
 
 api_protect_admin_script();

+ 1 - 2
main/admin/ldap_import_students.php

@@ -16,8 +16,7 @@ $cidReset=true;
 require_once('../inc/global.inc.php');
 // setting the section (for the tabs)
 $this_section = SECTION_PLATFORM_ADMIN;
-require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'usermanager.lib.php');
+
 // Access restrictions
 api_protect_admin_script();
 require('../auth/ldap/authldap.php');

+ 0 - 2
main/admin/ldap_import_students_to_session.php

@@ -16,8 +16,6 @@ $cidReset=true;
 require_once('../inc/global.inc.php');
 // setting the section (for the tabs)
 $this_section = SECTION_PLATFORM_ADMIN;
-require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'usermanager.lib.php');
 // Access restrictions
 api_protect_admin_script();
 require('../auth/ldap/authldap.php');

+ 0 - 2
main/admin/ldap_synchro.php

@@ -14,8 +14,6 @@ $cidReset=true;
 
 require('../inc/global.inc.php');
 $libpath = api_get_path(LIBRARY_PATH);
-require_once($libpath.'formvalidator/FormValidator.class.php');
-require_once($libpath.'usermanager.lib.php');
 require_once('../auth/ldap/authldap.php');
 $annee_base=date('Y');
 // setting the section (for the tabs)

+ 12 - 21
main/admin/ldap_users_list.php

@@ -12,25 +12,16 @@ $language_file[] = 'registration';
 $language_file[] = 'admin';
 $cidReset = true;
 require('../inc/global.inc.php');
-require_once(api_get_path(LIBRARY_PATH).'sortable_table.class.php');
-require_once(api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
-require_once(api_get_path(LIBRARY_PATH).'security.lib.php');
 require('../auth/ldap/authldap.php');
 $this_section = SECTION_PLATFORM_ADMIN;
 
 api_protect_admin_script();
 
-/**
-==============================================================================
-		INIT SECTION
-==============================================================================
-*/
-require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php');
-$action = $_GET["action"];
-$login_as_user_id = $_GET["user_id"];
+$action = @$_GET["action"] ?: null;
+$login_as_user_id = @$_GET["user_id"] ?: null;
 
 // Login as ...
-if ($_GET['action'] == "login_as" && isset ($login_as_user_id))
+if ($action == "login_as" && !empty ($login_as_user_id))
 {
 	login_user($login_as_user_id);
 }
@@ -180,16 +171,16 @@ if (isset ($_POST['action']))
 }
 
 $form = new FormValidator('advanced_search','get');
-$form->add_textfield('keyword_username',get_lang('LoginName'),false);
+$form->addText('keyword_username',get_lang('LoginName'),false);
 if (api_is_western_name_order())
 {
-	$form->add_textfield('keyword_firstname', get_lang('FirstName'), false);
-	$form->add_textfield('keyword_lastname', get_lang('LastName'), false);
+	$form->addText('keyword_firstname', get_lang('FirstName'), false);
+	$form->addText('keyword_lastname', get_lang('LastName'), false);
 }
 else
 {
-	$form->add_textfield('keyword_lastname',get_lang('LastName'),false);
-	$form->add_textfield('keyword_firstname',get_lang('FirstName'),false);
+	$form->addText('keyword_lastname',get_lang('LastName'),false);
+	$form->addText('keyword_firstname',get_lang('FirstName'),false);
 }
 if (isset($_GET['id_session']))
 	$form->addElement('hidden','id_session',$_GET['id_session']);
@@ -209,10 +200,10 @@ $form->display();
 
 
 
-$parameters['keyword_username'] = $_GET['keyword_username'];
-$parameters['keyword_firstname'] = $_GET['keyword_firstname'];
-$parameters['keyword_lastname'] = $_GET['keyword_lastname'];
-$parameters['keyword_email'] = $_GET['keyword_email'];
+$parameters['keyword_username'] = @$_GET['keyword_username'] ?: null;
+$parameters['keyword_firstname'] = @$_GET['keyword_firstname'] ?: null;
+$parameters['keyword_lastname'] = @$_GET['keyword_lastname'] ?: null;
+$parameters['keyword_email'] = @$_GET['keyword_email'] ?: null;
 if (isset($_GET['id_session']))
 	$parameters['id_session'] = $_GET['id_session'];
 // Create a sortable table with user-data

+ 0 - 2
main/admin/ldap_users_synchro.php

@@ -14,8 +14,6 @@ $cidReset=true;
 
 require('../inc/global.inc.php');
 $libpath = api_get_path(LIBRARY_PATH);
-require_once($libpath.'formvalidator/FormValidator.class.php');
-require_once($libpath.'usermanager.lib.php');
 require("../auth/ldap/authldap.php");
 $annee_base=date('Y');
 // setting the section (for the tabs)

+ 1 - 1
main/admin/legal_add.php

@@ -99,7 +99,7 @@ if (isset($_POST['language'])) {
 
 	$form->addElement('static', Security::remove_XSS($_POST['language']));
 	$form->addElement('hidden', 'language',Security::remove_XSS($_POST['language']));
-	$form->add_html_editor('content', get_lang('Content'), true, false, array('ToolbarSet' => 'terms_and_conditions', 'Width' => '100%', 'Height' => '250'));
+	$form->addHtmlEditor('content', get_lang('Content'), true, false, array('ToolbarSet' => 'terms_and_conditions', 'Width' => '100%', 'Height' => '250'));
 
 	$form->addElement('radio', 'type', '', get_lang('HTMLText') ,'0');
 	$form->addElement('radio', 'type', '', get_lang('PageLink') ,'1');

+ 1 - 1
main/admin/promotions.php

@@ -171,4 +171,4 @@ switch ($action) {
         $promotion->display();
         break;
 }
-Display::display_footer();
+Display::display_footer();

+ 56 - 56
main/admin/resume_session.php

@@ -51,7 +51,8 @@ $sql = 'SELECT
             nb_days_access_before_beginning,
             nb_days_access_after_end,
             session_category_id,
-            visibility
+            visibility,
+            show_description, description
 		FROM '.$tbl_session.'
 		LEFT JOIN '.$tbl_user.'
 		ON id_coach = user_id
@@ -217,6 +218,17 @@ echo Display::page_subheader(get_lang('GeneralProperties').$url);
 </tr>
 
 <?php
+$sessionField = new ExtraField('session');
+$extraFieldData = $sessionField->getDataAndFormatedValues($sessionId);
+
+foreach ($extraFieldData as $displayExtraField) {
+?>
+    <tr>
+        <td><?php echo $displayExtraField['text'] ?></td>
+        <td><?php echo $displayExtraField['value'] ?></td>
+    </tr>
+<?php
+}
 
 $multiple_url_is_on = api_get_multiple_access_url();
 
@@ -232,18 +244,24 @@ if ($multiple_url_is_on) {
     echo '</td></tr>';
 }
 
-if (SessionManager::durationPerUserIsEnabled()) {
-    $sessionInfo = api_get_session_info($sessionId);
-    echo '<tr><td>';
-    echo get_lang('Duration');
-    echo '</td>';
-    echo '<td>';
-    echo $sessionInfo['duration'].' ';
-    echo get_lang('Days');
-    echo '</td></tr>';
+$sessionInfo = api_get_session_info($sessionId);
+echo '<tr><td>';
+echo get_lang('Duration');
+echo '</td>';
+echo '<td>';
+echo $sessionInfo['duration'].' ';
+echo get_lang('Days');
+echo '</td></tr>';
 
-}
 ?>
+    <tr>
+        <td><?php echo get_lang('Description'); ?></td>
+        <td><?php echo $session['description'] ?></td>
+    </tr>
+    <tr>
+        <td><?php echo get_lang('ShowDescription'); ?></td>
+        <td><?php echo $session['show_description'] == 1 ? get_lang('Yes') : get_lang('No') ?></td>
+    </tr>
 </table>
 <br />
 
@@ -273,10 +291,7 @@ if ($session['nbr_courses'] == 0) {
 } else {
 	// select the courses
 
-    $orderBy = "ORDER BY title";
-    if (SessionManager::orderCourseIsEnabled()) {
-        $orderBy = "ORDER BY position";
-    }
+    $orderBy = "ORDER BY position";
 
 	$sql = "SELECT code,title,visual_code, nbr_users
 			FROM $tbl_course, $tbl_session_rel_course
@@ -332,34 +347,32 @@ if ($session['nbr_courses'] == 0) {
 
         $orderButtons = null;
 
-        if (SessionManager::orderCourseIsEnabled()) {
-            $upIcon = 'up.png';
-            $urlUp = api_get_self().'?id_session='.$sessionId.'&course_code='.$course['code'].'&action=move_up';
+        $upIcon = 'up.png';
+        $urlUp = api_get_self().'?id_session='.$sessionId.'&course_code='.$course['code'].'&action=move_up';
 
-            if ($count == 0) {
-                $upIcon = 'up_na.png';
-                $urlUp = '#';
-            }
-
-            $orderButtons = Display::url(
-                Display::return_icon($upIcon, get_lang('MoveUp')),
-                $urlUp
-            );
+        if ($count == 0) {
+            $upIcon = 'up_na.png';
+            $urlUp = '#';
+        }
 
-            $downIcon = 'down.png';
-            $downUrl = api_get_self().'?id_session='.$sessionId.'&course_code='.$course['code'].'&action=move_down';
+        $orderButtons = Display::url(
+            Display::return_icon($upIcon, get_lang('MoveUp')),
+            $urlUp
+        );
 
-            if ($count +1 == count($courses)) {
-                $downIcon = 'down_na.png';
-                $downUrl = '#';
-            }
+        $downIcon = 'down.png';
+        $downUrl = api_get_self().'?id_session='.$sessionId.'&course_code='.$course['code'].'&action=move_down';
 
-            $orderButtons .= Display::url(
-                Display::return_icon($downIcon, get_lang('MoveDown')),
-                $downUrl
-            );
+        if ($count +1 == count($courses)) {
+            $downIcon = 'down_na.png';
+            $downUrl = '#';
         }
 
+        $orderButtons .= Display::url(
+            Display::return_icon($downIcon, get_lang('MoveDown')),
+            $downUrl
+        );
+
 		$orig_param = '&origin=resume_session';
 		//hide_course_breadcrumb the parameter has been added to hide the name of the course, that appeared in the default $interbreadcrumb
 		echo '
@@ -449,14 +462,12 @@ if (!empty($userList)) {
         }
 
         $editUrl = null;
-        if (SessionManager::durationPerUserIsEnabled()) {
-            if (isset($sessionInfo['duration']) && !empty($sessionInfo['duration'])) {
-                $editUrl = api_get_path(WEB_CODE_PATH) . 'admin/session_user_edit.php?session_id=' . $sessionId . '&user_id=' . $userId;
-                $editUrl = Display::url(
-                    Display::return_icon('agenda.png', get_lang('SessionDurationEdit')),
-                    $editUrl
-                );
-            }
+        if (isset($sessionInfo['duration']) && !empty($sessionInfo['duration'])) {
+            $editUrl = api_get_path(WEB_CODE_PATH) . 'admin/session_user_edit.php?session_id=' . $sessionId . '&user_id=' . $userId;
+            $editUrl = Display::url(
+                Display::return_icon('agenda.png', get_lang('SessionDurationEdit')),
+                $editUrl
+            );
         }
 
         $table->setCellContents($row, 0, $userLink);
@@ -481,14 +492,3 @@ if (!empty($userList)) {
 }
 
 Display :: display_footer();
-
-/*
- ALTER TABLE session_rel_course ADD COLUMN position int;
- ALTER TABLE session_rel_course ADD COLUMN category varchar(255);
-
- https://task.beeznest.com/issues/8317:
-
- ALTER TABLE session ADD COLUMN duration int;
- ALTER TABLE session_rel_user ADD COLUMN duration int;
- *
-*/

+ 324 - 365
main/admin/session_add.php

@@ -3,7 +3,6 @@
 
 /**
 *	@package chamilo.admin
-* 	@todo use formvalidator for the form, remove all the select harcoded values
 */
 
 // name of the language file that needs to be included
@@ -14,9 +13,6 @@ $cidReset=true;
 // including the global Chamilo file
 require_once '../inc/global.inc.php';
 
-// including additional libraries
-require_once '../inc/lib/xajax/xajax.inc.php';
-
 $xajax = new xajax();
 //$xajax->debugOn();
 $xajax -> registerFunction ('search_coachs');
@@ -38,7 +34,7 @@ $tbl_user		= Database::get_main_table(TABLE_MAIN_USER);
 function search_coachs($needle) {
 	global $tbl_user;
 
-	$xajax_response = new XajaxResponse();
+	$xajax_response = new xajaxResponse();
 	$return = '';
 
 	if(!empty($needle)) {
@@ -86,63 +82,73 @@ $xajax -> processRequests();
 
 $htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/');
 
-$htmlHeadXtra[] = '
-<script type="text/javascript">
+$htmlHeadXtra[] = "
+<script type=\"text/javascript\">
 function fill_coach_field (username) {
-	document.getElementById("coach_username").value = username;
-	document.getElementById("ajax_list_coachs").innerHTML = "";
+	document.getElementById('coach_username').value = username;
+	document.getElementById('ajax_list_coachs').innerHTML = '';
 }
-</script>';
 
+$(document).on('ready', function () {
+    var value = 1;
+    $('#advanced_parameters').on('click', function() {
+        $('#options').toggle(function() {
+            if (value == 1) {
+                $('#advanced_parameters').addClass('btn-hide');
+                value = 0;
+            } else {
+                $('#advanced_parameters').removeClass('btn-hide');
+                value = 1;
+            }
+        });
+    });
+});
 
-if (isset($_POST['formSent']) && $_POST['formSent']) {
-	$formSent = 1;
-    $name = $_POST['name'];
-    $year_start = $_POST['year_start'];
-    $month_start = $_POST['month_start'];
-    $day_start = $_POST['day_start'];
-    $year_end = $_POST['year_end'];
-    $month_end = $_POST['month_end'];
-    $day_end = $_POST['day_end'];
-    $nb_days_acess_before = $_POST['nb_days_acess_before'];
-    $nb_days_acess_after = $_POST['nb_days_acess_after'];
-    $coach_username = $_POST['coach_username'];
-    $id_session_category = $_POST['session_category'];
-    $id_visibility = $_POST['session_visibility'];
-    $end_limit = $_POST['end_limit'];
-    $start_limit = $_POST['start_limit'];
-    $duration = isset($_POST['duration']) ? $_POST['duration'] : null;
+function setDisable(select){
+	document.forms['edit_session'].elements['session_visibility'].disabled = (select.checked) ? true : false;
+	document.forms['edit_session'].elements['session_visibility'].selectedIndex = 0;
 
-    if (empty($end_limit) && empty($start_limit)) {
-        $nolimit = 1;
-    } else {
-    	$nolimit = null;
-    }
+    document.forms['edit_session'].elements['start_limit'].disabled = (select.checked) ? true : false;
+    document.forms['edit_session'].elements['start_limit'].checked = false;
+    document.forms['edit_session'].elements['end_limit'].disabled = (select.checked) ? true : false;
+    document.forms['edit_session'].elements['end_limit'].checked = false;
 
-    $return = SessionManager::create_session(
-        $name,
-        $year_start,
-        $month_start,
-        $day_start,
-        $year_end,
-        $month_end,
-        $day_end,
-        $nb_days_acess_before,
-        $nb_days_acess_after,
-        $nolimit,
-        $coach_username,
-        $id_session_category,
-        $id_visibility,
-        $start_limit,
-        $end_limit,
-        $duration
-    );
+    var end_div = document.getElementById('end_date');
+    end_div.style.display = 'none';
 
-	if ($return == strval(intval($return))) {
-		// integer => no error on session creation
-		header('Location: add_courses_to_session.php?id_session='.$return.'&add=true&msg=');
-		exit();
-	}
+    var start_div = document.getElementById('start_date');
+    start_div.style.display = 'none';
+}
+
+function disable_endtime(select) {
+    var end_div = document.getElementById('end_date');
+    if (end_div.style.display == 'none')
+        end_div.style.display = 'block';
+     else
+        end_div.style.display = 'none';
+
+    emptyDuration();
+}
+
+function disable_starttime(select) {
+    var start_div = document.getElementById('start_date');
+    if (start_div.style.display == 'none')
+        start_div.style.display = 'block';
+     else
+        start_div.style.display = 'none';
+
+    emptyDuration();
+}
+
+function emptyDuration() {
+    if ($('#duration').val()) {
+        $('#duration').val('');
+    }
+}
+</script>";
+
+if (isset($_POST['formSent']) && $_POST['formSent']) {
+	$formSent = 1;
 }
 
 global $_configuration;
@@ -158,339 +164,292 @@ $thisYear=date('Y');
 $thisMonth=date('m');
 $thisDay=date('d');
 
+$dayList = array();
+
+for ($i = 1; $i <= 31; $i++) {
+    $day = sprintf("%02d", $i);
+    $dayList[$day] = $day;
+}
+
+$monthList = array();
+
+for ($i = 1; $i <= 12; $i++) {
+    $month = sprintf("%02d", $i);
+
+    $monthList[$month] = $month;
+}
+
+$yearList = array();
+
+for ($i = $thisYear - 5; $i <= ($thisYear + 5); $i++) {
+    $yearList[$i] = $i;
+}
+
 $tool_name = get_lang('AddSession');
 
-Display::display_header($tool_name);
+$urlAction = api_get_self();
 
-if (!empty($return)) {
-	Display::display_error_message($return,false);
+$categoriesList = SessionManager::get_all_session_category();
+
+$categoriesOptions = array(
+    '0' => get_lang('None')
+);
+
+if ($categoriesList != false) {
+    foreach ($categoriesList as $categoryItem) {
+        $categoriesOptions[$categoryItem['id']] = $categoryItem['name'];
+    }
 }
-echo '<div class="actions">';
-echo '<a href="../admin/index.php">'.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('PlatformAdmin'),'',ICON_SIZE_MEDIUM).'</a>';
-echo '</div>';
 
-?>
-<form class="form-horizontal" method="post" name="form" action="<?php echo api_get_self(); ?>" style="margin:0px;">
-    <input type="hidden" name="formSent" value="1">
-    <div class="control-group">
-        <label class="control-label">
-            <?php echo get_lang('SessionName') ?>
-        </label>
-        <div class="controls">
-            <input type="text" name="name" class="span4" maxlength="50" value="<?php if($formSent) echo api_htmlentities($name,ENT_QUOTES,$charset); ?>">
-        </div>
-    </div>
-
-    <div class="control-group">
-        <label class="control-label">
-            <?php echo get_lang('CoachName') ?>
-        </label>
-        <div class="controls">
+function check_session_name($name) {
+    $session = SessionManager::get_session_by_name($name);
 
-<?php
+    return empty($session) ? true : false;
+}
+
+$form = new FormValidator('add_session', 'post', $urlAction);
+
+$form->addElement('header', $tool_name);
 
-$sql = 'SELECT COUNT(1) FROM '.$tbl_user.' WHERE status=1';
+$form->addElement('text', 'name', get_lang('SessionName'), array(
+    'class' => 'span4',
+    'maxlength' => 50,
+    'value' => $formSent ? api_htmlentities($name,ENT_QUOTES,$charset) : ''
+));
+$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
+$form->addRule('name', get_lang('SessionNameAlreadyExists'), 'callback', 'check_session_name');
+
+$sql = "SELECT COUNT(1) FROM $tbl_user WHERE status = 1";
 $rs = Database::query($sql);
-$count_users = Database::result($rs, 0, 0);
-
-if (intval($count_users)<50) {
-	$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
-	$sql="SELECT user_id, lastname,firstname,username FROM $tbl_user WHERE status='1'".$order_clause;
-
-	if (api_is_multiple_url_enabled()) {
-		$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
-		$access_url_id = api_get_current_access_url_id();
-		if ($access_url_id != -1){
-			$sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user
-			INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id)
-			WHERE access_url_id = '.$access_url_id.'  AND status=1'.$order_clause;
-		}
-	}
-	$result = Database::query($sql);
-	$Coaches = Database::store_result($result);
-
-	?>
-	<select id="coach_username" class="chzn-select" name="coach_username" style="width:350px;" title="<?php echo get_lang('Select'); ?>" >
-		<option value="0"><?php get_lang('None'); ?></option>
-		<?php foreach($Coaches as $enreg): ?>
-		<option value="<?php echo $enreg['username']; ?>"> <?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']).' ('.$enreg['username'].')'; ?></option>
-		<?php endforeach; ?>
-	</select>
-	<?php
-	echo Display::return_icon('synthese_view.gif',get_lang('ActivityCoach'));
+$countUsers = Database::result($rs, 0, 0);
+
+if (intval($countUsers) < 50) {
+    $orderClause = "ORDER BY ";
+    $orderClause .= api_sort_by_first_name() ? "firstname, lastname, username"  : "lastname, firstname, username";
+
+    $sql="SELECT user_id, lastname, firstname, username FROM $tbl_user "
+        . "WHERE status = '1' "
+        . $orderClause;
+
+    if (api_is_multiple_url_enabled()) {
+        $userRelAccessUrlTable = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
+        $accessUrlId = api_get_current_access_url_id();
+
+        if ($accessUrlId != -1) {
+            $sql = "SELECT user.user_id, username, lastname, firstname FROM $tbl_user user "
+                . "INNER JOIN $userRelAccessUrlTable url_user ON (url_user.user_id = user.user_id) "
+                . "WHERE access_url_id = $accessUrlId AND status = 1 "
+                . $orderClause;
+        }
+    }
+
+    $result = Database::query($sql);
+	$coachesList = Database::store_result($result);
+
+    $coachesOptions = array();
+
+    foreach($coachesList as $coachItem){
+        $coachesOptions[$coachItem['username']] = api_get_person_name(
+            $coachItem['firstname'],
+            $coachItem['lastname']
+        ).' ('.$coachItem['username'].')';
+    }
+
+    $form->addElement('select', 'coach_username', get_lang('CoachName'), $coachesOptions, array(
+        'id' => 'coach_username',
+        'class' => 'chzn-select',
+        'style' => 'width:370px;'
+    ));
+    $form->addElement('advanced_settings', Display::return_icon('synthese_view.gif') . ' ' . get_lang('ActivityCoach'));
 } else {
-	?>
-	<input type="text" name="coach_username" id="coach_username" onkeyup="xajax_search_coachs(document.getElementById('coach_username').value)" /><div id="ajax_list_coachs"></div>
-	<?php
-}
-$Categories = SessionManager::get_all_session_category();
-?>
-        </div>
-    </div>
-    <div class="control-group">
-        <label class="control-label">
-            <?php echo get_lang('SessionCategory') ?>
-        </label>
-        <div class="controls">
-            <select id="session_category" class="chzn-select" name="session_category" style="width:350px;" title="<?php echo get_lang('Select'); ?>">
-                <option value="0"><?php get_lang('None'); ?></option>
-            <?php
-            if (!empty($Categories)) {
-                foreach($Categories as $Rows) { ?>
-                    <option value="<?php echo $Rows['id']; ?>" <?php if($Rows['id'] == $id_session_category) echo 'selected="selected"'; ?>><?php echo $Rows['name']; ?></option>
-                <?php }
-            }
-            ?>
-        </select>
-        </div>
-    </div>
-
- <div class="control-group">
-        <div class="controls">
-            <a href="javascript://" onclick="if(document.getElementById('options').style.display == 'none'){document.getElementById('options').style.display = 'block';}else{document.getElementById('options').style.display = 'none';}"><?php echo get_lang('DefineSessionOptions') ?></a>
-        <div style="display: <?php if($formSent && ($nb_days_acess_before!=0 || $nb_days_acess_after!=0)) echo 'block'; else echo 'none'; ?>;" id="options">
-            <br />
-            <input type="text" name="nb_days_acess_before" value="<?php echo $nb_days_acess_before; ?>" style="width: 30px;">&nbsp;<?php echo get_lang('DaysBefore') ?><br /><br />
-            <input type="text" name="nb_days_acess_after" value="<?php echo $nb_days_acess_after; ?>" style="width: 30px;">&nbsp;<?php echo get_lang('DaysAfter') ?>
-            <br />
-        </div>
-        </div>
-</div>
-
- <div class="control-group">
-        <div class="controls">
-    <label for="start_limit">
-        <input id="start_limit" type="checkbox" name="start_limit" onchange="disable_starttime(this)" />
-    <?php echo get_lang('DateStartSession');?>
-    </label>
-
-    <div id="start_date" style="display:none">
-       <br />
-
-  <select name="day_start">
-	<option value="1">01</option>
-	<option value="2" <?php if((!$formSent && $thisDay == 2) || ($formSent && $day_start == 2)) echo 'selected="selected"'; ?> >02</option>
-	<option value="3" <?php if((!$formSent && $thisDay == 3) || ($formSent && $day_start == 3)) echo 'selected="selected"'; ?> >03</option>
-	<option value="4" <?php if((!$formSent && $thisDay == 4) || ($formSent && $day_start == 4)) echo 'selected="selected"'; ?> >04</option>
-	<option value="5" <?php if((!$formSent && $thisDay == 5) || ($formSent && $day_start == 5)) echo 'selected="selected"'; ?> >05</option>
-	<option value="6" <?php if((!$formSent && $thisDay == 6) || ($formSent && $day_start == 6)) echo 'selected="selected"'; ?> >06</option>
-	<option value="7" <?php if((!$formSent && $thisDay == 7) || ($formSent && $day_start == 7)) echo 'selected="selected"'; ?> >07</option>
-	<option value="8" <?php if((!$formSent && $thisDay == 8) || ($formSent && $day_start == 8)) echo 'selected="selected"'; ?> >08</option>
-	<option value="9" <?php if((!$formSent && $thisDay == 9) || ($formSent && $day_start == 9)) echo 'selected="selected"'; ?> >09</option>
-	<option value="10" <?php if((!$formSent && $thisDay == 10) || ($formSent && $day_start == 10)) echo 'selected="selected"'; ?> >10</option>
-	<option value="11" <?php if((!$formSent && $thisDay == 11) || ($formSent && $day_start == 11)) echo 'selected="selected"'; ?> >11</option>
-	<option value="12" <?php if((!$formSent && $thisDay == 12) || ($formSent && $day_start == 12)) echo 'selected="selected"'; ?> >12</option>
-	<option value="13" <?php if((!$formSent && $thisDay == 13) || ($formSent && $day_start == 13)) echo 'selected="selected"'; ?> >13</option>
-	<option value="14" <?php if((!$formSent && $thisDay == 14) || ($formSent && $day_start == 14)) echo 'selected="selected"'; ?> >14</option>
-	<option value="15" <?php if((!$formSent && $thisDay == 15) || ($formSent && $day_start == 15)) echo 'selected="selected"'; ?> >15</option>
-	<option value="16" <?php if((!$formSent && $thisDay == 16) || ($formSent && $day_start == 16)) echo 'selected="selected"'; ?> >16</option>
-	<option value="17" <?php if((!$formSent && $thisDay == 17) || ($formSent && $day_start == 17)) echo 'selected="selected"'; ?> >17</option>
-	<option value="18" <?php if((!$formSent && $thisDay == 18) || ($formSent && $day_start == 18)) echo 'selected="selected"'; ?> >18</option>
-	<option value="19" <?php if((!$formSent && $thisDay == 19) || ($formSent && $day_start == 19)) echo 'selected="selected"'; ?> >19</option>
-	<option value="20" <?php if((!$formSent && $thisDay == 20) || ($formSent && $day_start == 20)) echo 'selected="selected"'; ?> >20</option>
-	<option value="21" <?php if((!$formSent && $thisDay == 21) || ($formSent && $day_start == 21)) echo 'selected="selected"'; ?> >21</option>
-	<option value="22" <?php if((!$formSent && $thisDay == 22) || ($formSent && $day_start == 22)) echo 'selected="selected"'; ?> >22</option>
-	<option value="23" <?php if((!$formSent && $thisDay == 23) || ($formSent && $day_start == 23)) echo 'selected="selected"'; ?> >23</option>
-	<option value="24" <?php if((!$formSent && $thisDay == 24) || ($formSent && $day_start == 24)) echo 'selected="selected"'; ?> >24</option>
-	<option value="25" <?php if((!$formSent && $thisDay == 25) || ($formSent && $day_start == 25)) echo 'selected="selected"'; ?> >25</option>
-	<option value="26" <?php if((!$formSent && $thisDay == 26) || ($formSent && $day_start == 26)) echo 'selected="selected"'; ?> >26</option>
-	<option value="27" <?php if((!$formSent && $thisDay == 27) || ($formSent && $day_start == 27)) echo 'selected="selected"'; ?> >27</option>
-	<option value="28" <?php if((!$formSent && $thisDay == 28) || ($formSent && $day_start == 28)) echo 'selected="selected"'; ?> >28</option>
-	<option value="29" <?php if((!$formSent && $thisDay == 29) || ($formSent && $day_start == 29)) echo 'selected="selected"'; ?> >29</option>
-	<option value="30" <?php if((!$formSent && $thisDay == 30) || ($formSent && $day_start == 30)) echo 'selected="selected"'; ?> >30</option>
-	<option value="31" <?php if((!$formSent && $thisDay == 31) || ($formSent && $day_start == 31)) echo 'selected="selected"'; ?> >31</option>
-  </select>
-  /
-  <select name="month_start">
-	<option value="1">01</option>
-	<option value="2" <?php if((!$formSent && $thisMonth == 2) || ($formSent && $month_start == 2)) echo 'selected="selected"'; ?> >02</option>
-	<option value="3" <?php if((!$formSent && $thisMonth == 3) || ($formSent && $month_start == 3)) echo 'selected="selected"'; ?> >03</option>
-	<option value="4" <?php if((!$formSent && $thisMonth == 4) || ($formSent && $month_start == 4)) echo 'selected="selected"'; ?> >04</option>
-	<option value="5" <?php if((!$formSent && $thisMonth == 5) || ($formSent && $month_start == 5)) echo 'selected="selected"'; ?> >05</option>
-	<option value="6" <?php if((!$formSent && $thisMonth == 6) || ($formSent && $month_start == 6)) echo 'selected="selected"'; ?> >06</option>
-	<option value="7" <?php if((!$formSent && $thisMonth == 7) || ($formSent && $month_start == 7)) echo 'selected="selected"'; ?> >07</option>
-	<option value="8" <?php if((!$formSent && $thisMonth == 8) || ($formSent && $month_start == 8)) echo 'selected="selected"'; ?> >08</option>
-	<option value="9" <?php if((!$formSent && $thisMonth == 9) || ($formSent && $month_start == 9)) echo 'selected="selected"'; ?> >09</option>
-	<option value="10" <?php if((!$formSent && $thisMonth == 10) || ($formSent && $month_start == 10)) echo 'selected="selected"'; ?> >10</option>
-	<option value="11" <?php if((!$formSent && $thisMonth == 11) || ($formSent && $month_start == 11)) echo 'selected="selected"'; ?> >11</option>
-	<option value="12" <?php if((!$formSent && $thisMonth == 12) || ($formSent && $month_start == 12)) echo 'selected="selected"'; ?> >12</option>
-  </select>
-  /
-  <select name="year_start">
-<?php
-for ($i=$thisYear-5;$i <= ($thisYear+5);$i++) {
-?>
-	<option value="<?php echo $i; ?>" <?php if((!$formSent && $thisYear == $i) || ($formSent && $year_start == $i)) echo 'selected="selected"'; ?> ><?php echo $i; ?></option>
-<?php
+    $form->addElement('text', 'coach_username', get_lang('CoachName'), array(
+        'class' => 'span4',
+        'maxlength' => 50,
+        'onkeyup' => "xajax_search_coachs(document.getElementById('coach_username').value)",
+        'id' => 'coach_username'
+    ));
 }
-?>
-    </select>
-    </div>
-
-        </div>
-    </div>
-
-
-
- <div class="control-group">
-        <div class="controls">
-            <label for="end_limit">
-                <input id="end_limit" type="checkbox" name="end_limit" onchange="disable_endtime(this)" />
-                <?php echo get_lang('DateEndSession') ?>
-            </label>
-  <div id="end_date" style="display:none">
-  <br />
-
-  <select name="day_end">
-	<option value="1">01</option>
-	<option value="2" <?php if((!$formSent && $thisDay == 2) || ($formSent && $day_end == 2)) echo 'selected="selected"'; ?> >02</option>
-	<option value="3" <?php if((!$formSent && $thisDay == 3) || ($formSent && $day_end == 3)) echo 'selected="selected"'; ?> >03</option>
-	<option value="4" <?php if((!$formSent && $thisDay == 4) || ($formSent && $day_end == 4)) echo 'selected="selected"'; ?> >04</option>
-	<option value="5" <?php if((!$formSent && $thisDay == 5) || ($formSent && $day_end == 5)) echo 'selected="selected"'; ?> >05</option>
-	<option value="6" <?php if((!$formSent && $thisDay == 6) || ($formSent && $day_end == 6)) echo 'selected="selected"'; ?> >06</option>
-	<option value="7" <?php if((!$formSent && $thisDay == 7) || ($formSent && $day_end == 7)) echo 'selected="selected"'; ?> >07</option>
-	<option value="8" <?php if((!$formSent && $thisDay == 8) || ($formSent && $day_end == 8)) echo 'selected="selected"'; ?> >08</option>
-	<option value="9" <?php if((!$formSent && $thisDay == 9) || ($formSent && $day_end == 9)) echo 'selected="selected"'; ?> >09</option>
-	<option value="10" <?php if((!$formSent && $thisDay == 10) || ($formSent && $day_end == 10)) echo 'selected="selected"'; ?> >10</option>
-	<option value="11" <?php if((!$formSent && $thisDay == 11) || ($formSent && $day_end == 11)) echo 'selected="selected"'; ?> >11</option>
-	<option value="12" <?php if((!$formSent && $thisDay == 12) || ($formSent && $day_end == 12)) echo 'selected="selected"'; ?> >12</option>
-	<option value="13" <?php if((!$formSent && $thisDay == 13) || ($formSent && $day_end == 13)) echo 'selected="selected"'; ?> >13</option>
-	<option value="14" <?php if((!$formSent && $thisDay == 14) || ($formSent && $day_end == 14)) echo 'selected="selected"'; ?> >14</option>
-	<option value="15" <?php if((!$formSent && $thisDay == 15) || ($formSent && $day_end == 15)) echo 'selected="selected"'; ?> >15</option>
-	<option value="16" <?php if((!$formSent && $thisDay == 16) || ($formSent && $day_end == 16)) echo 'selected="selected"'; ?> >16</option>
-	<option value="17" <?php if((!$formSent && $thisDay == 17) || ($formSent && $day_end == 17)) echo 'selected="selected"'; ?> >17</option>
-	<option value="18" <?php if((!$formSent && $thisDay == 18) || ($formSent && $day_end == 18)) echo 'selected="selected"'; ?> >18</option>
-	<option value="19" <?php if((!$formSent && $thisDay == 19) || ($formSent && $day_end == 19)) echo 'selected="selected"'; ?> >19</option>
-	<option value="20" <?php if((!$formSent && $thisDay == 20) || ($formSent && $day_end == 20)) echo 'selected="selected"'; ?> >20</option>
-	<option value="21" <?php if((!$formSent && $thisDay == 21) || ($formSent && $day_end == 21)) echo 'selected="selected"'; ?> >21</option>
-	<option value="22" <?php if((!$formSent && $thisDay == 22) || ($formSent && $day_end == 22)) echo 'selected="selected"'; ?> >22</option>
-	<option value="23" <?php if((!$formSent && $thisDay == 23) || ($formSent && $day_end == 23)) echo 'selected="selected"'; ?> >23</option>
-	<option value="24" <?php if((!$formSent && $thisDay == 24) || ($formSent && $day_end == 24)) echo 'selected="selected"'; ?> >24</option>
-	<option value="25" <?php if((!$formSent && $thisDay == 25) || ($formSent && $day_end == 25)) echo 'selected="selected"'; ?> >25</option>
-	<option value="26" <?php if((!$formSent && $thisDay == 26) || ($formSent && $day_end == 26)) echo 'selected="selected"'; ?> >26</option>
-	<option value="27" <?php if((!$formSent && $thisDay == 27) || ($formSent && $day_end == 27)) echo 'selected="selected"'; ?> >27</option>
-	<option value="28" <?php if((!$formSent && $thisDay == 28) || ($formSent && $day_end == 28)) echo 'selected="selected"'; ?> >28</option>
-	<option value="29" <?php if((!$formSent && $thisDay == 29) || ($formSent && $day_end == 29)) echo 'selected="selected"'; ?> >29</option>
-	<option value="30" <?php if((!$formSent && $thisDay == 30) || ($formSent && $day_end == 30)) echo 'selected="selected"'; ?> >30</option>
-	<option value="31" <?php if((!$formSent && $thisDay == 31) || ($formSent && $day_end == 31)) echo 'selected="selected"'; ?> >31</option>
-  </select>
-  /
-  <select name="month_end">
-	<option value="1">01</option>
-	<option value="2" <?php if((!$formSent && $thisMonth == 2) || ($formSent && $month_end == 2)) echo 'selected="selected"'; ?> >02</option>
-	<option value="3" <?php if((!$formSent && $thisMonth == 3) || ($formSent && $month_end == 3)) echo 'selected="selected"'; ?> >03</option>
-	<option value="4" <?php if((!$formSent && $thisMonth == 4) || ($formSent && $month_end == 4)) echo 'selected="selected"'; ?> >04</option>
-	<option value="5" <?php if((!$formSent && $thisMonth == 5) || ($formSent && $month_end == 5)) echo 'selected="selected"'; ?> >05</option>
-	<option value="6" <?php if((!$formSent && $thisMonth == 6) || ($formSent && $month_end == 6)) echo 'selected="selected"'; ?> >06</option>
-	<option value="7" <?php if((!$formSent && $thisMonth == 7) || ($formSent && $month_end == 7)) echo 'selected="selected"'; ?> >07</option>
-	<option value="8" <?php if((!$formSent && $thisMonth == 8) || ($formSent && $month_end == 8)) echo 'selected="selected"'; ?> >08</option>
-	<option value="9" <?php if((!$formSent && $thisMonth == 9) || ($formSent && $month_end == 9)) echo 'selected="selected"'; ?> >09</option>
-	<option value="10" <?php if((!$formSent && $thisMonth == 10) || ($formSent && $month_end == 10)) echo 'selected="selected"'; ?> >10</option>
-	<option value="11" <?php if((!$formSent && $thisMonth == 11) || ($formSent && $month_end == 11)) echo 'selected="selected"'; ?> >11</option>
-	<option value="12" <?php if((!$formSent && $thisMonth == 12) || ($formSent && $month_end == 12)) echo 'selected="selected"'; ?> >12</option>
-  </select>
-  /
-  <select name="year_end">
-<?php
-for ($i=$thisYear-5;$i <= ($thisYear+5);$i++) {
-?>
-	<option value="<?php echo $i; ?>" <?php if((!$formSent && ($thisYear+1) == $i) || ($formSent && $year_end == $i)) echo 'selected="selected"'; ?> ><?php echo $i; ?></option>
-<?php
-}
-?>
-    </select>
-    <br />    <br />
-    <?php echo get_lang('SessionVisibility') ?>
-    <select name="session_visibility" style="width:250px;">
-        <?php
-        $visibility_list = array(
-            SESSION_VISIBLE_READ_ONLY => get_lang('SessionReadOnly'),
-            SESSION_VISIBLE => get_lang('SessionAccessible'),
-            SESSION_INVISIBLE => api_ucfirst(get_lang('SessionNotAccessible'))
-        );
-        foreach($visibility_list as $key=>$item): ?>
-        <option value="<?php echo $key; ?>"><?php echo $item; ?></option>
-        <?php endforeach; ?>
-    </select>
-     </div>
-        </div>
-    </div>
-
-    <?php
-    if (SessionManager::durationPerUserIsEnabled()) {
-        ?>
-        <div class="control-group">
-            <label class="control-label">
-                <?php echo get_lang('SessionDurationTitle') ?> <br />
-            </label>
-            <div class="controls">
-                <input id="duration" type="text" name="duration" class="span1" maxlength="50" value="">
-                <br />
-                <?php echo get_lang('SessionDurationDescription') ?>
-            </div>
-        </div>
-
-    <?php
-    }
-    ?>
 
- <div class="control-group">
-    <div class="controls">
-        <button class="save" type="submit" value="<?php echo get_lang('NextStep') ?>"><?php echo get_lang('NextStep') ?></button>
-    </div>
-</div>
-</form>
-<script type="text/javascript">
+$form->addRule('coach_username', get_lang('ThisFieldIsRequired'), 'required');
+$form->addHtml('<div id="ajax_list_coachs"></div>');
 
-function setDisable(select){
-	document.form.day_start.disabled = (select.checked) ? true : false;
-	document.form.month_start.disabled = (select.checked) ? true : false;
-	document.form.year_start.disabled = (select.checked) ? true : false;
+$form->addSelect('session_category', get_lang('SessionCategory'), $categoriesOptions, array(
+    'id' => 'session_category',
+    'class' => 'chzn-select',
+    'style' => 'width:370px;'
+));
 
-	document.form.day_end.disabled = (select.checked) ? true : false;
-	document.form.month_end.disabled = (select.checked) ? true : false;
-	document.form.year_end.disabled = (select.checked) ? true : false;
+$form->addElement('advanced_settings','<a class="btn-show" id="advanced_parameters" href="javascript://">'.get_lang('DefineSessionOptions').'</a>');
 
-	document.form.session_visibility.disabled = (select.checked) ? true : false;
-	document.form.session_visibility.selectedIndex = 0;
+$form->addElement('html','<div id="options" style="display:none">');
 
-    document.form.start_limit.disabled = (select.checked) ? true : false;
-    document.form.start_limit.checked = false;
-    document.form.end_limit.disabled = (select.checked) ? true : false;
-    document.form.end_limit.checked = false;
+$form->addElement('text', 'nb_days_acess_before', array('', '', get_lang('DaysBefore')), array(
+    'style' => 'width: 30px;',
+    'value' => $nb_days_acess_before
+));
 
-    var end_div = document.getElementById('end_date');
-    end_div.style.display = 'none';
+$form->addElement('text', 'nb_days_acess_after', array('', '', get_lang('DaysAfter')), array(
+    'style' => 'width: 30px;',
+    'value' => $nb_days_acess_after
+));
 
-    var start_div = document.getElementById('start_date');
-    start_div.style.display = 'none';
-}
+$form->addElement('html','</div>');
 
-function disable_endtime(select) {
-    var end_div = document.getElementById('end_date');
-    if (end_div.style.display == 'none')
-        end_div.style.display = 'block';
-     else
-        end_div.style.display = 'none';
+$form->addElement('checkbox', 'start_limit', '', get_lang('DateStartSession'), array(
+    'onchange' => 'disable_starttime(this)',
+    'id' => 'start_limit'
+));
 
-    emptyDuration();
-}
+$form->addElement('html','<div id="start_date" style="display:none">');
 
-function disable_starttime(select) {
-    var start_div = document.getElementById('start_date');
-    if (start_div.style.display == 'none')
-        start_div.style.display = 'block';
-     else
-        start_div.style.display = 'none';
+$form->addElement('date_picker', 'date_start');
 
-    emptyDuration();
+$form->addElement('html','</div>');
+
+$form->addElement('checkbox', 'end_limit', '', get_lang('DateEndSession'), array(
+    'onchange' => 'disable_endtime(this)',
+    'id' => 'end_limit'
+));
+
+$form->addElement('html','<div id="end_date" style="display:none">');
+
+$form->addElement('date_picker', 'date_end');
+
+$visibilityGroup = array();
+$visibilityGroup[] = $form->createElement('advanced_settings', get_lang('SessionVisibility'));
+$visibilityGroup[] = $form->createElement('select', 'session_visibility', null, array(
+    SESSION_VISIBLE_READ_ONLY => get_lang('SessionReadOnly'),
+    SESSION_VISIBLE => get_lang('SessionAccessible'),
+    SESSION_INVISIBLE => api_ucfirst(get_lang('SessionNotAccessible'))
+));
+
+$form->addGroup($visibilityGroup, 'visibility_group', null, null, false);
+
+$form->addElement('html','</div>');
+
+$form->addElement(
+    'textarea',
+    'description',
+    get_lang('Description'),
+    array(
+        'class' => 'span4',
+        'rows' => 3
+    )
+);
+
+$form->addElement('checkbox', 'show_description', null, get_lang('ShowDescription'));
+
+$form->addElement(
+    'text',
+    'duration',
+    array(
+        get_lang('SessionDurationTitle'),
+        get_lang('SessionDurationDescription')
+    ),
+    array(
+        'class' => 'span1',
+        'maxlength' => 50
+    )
+);
+
+//Extra fields
+$extra_field = new ExtraField('session');
+$extra = $extra_field->addElements($form, null);
+
+$htmlHeadXtra[] ='
+<script>
+
+$(function() {
+    '.$extra['jquery_ready_content'].'
+});
+</script>';
+
+$form->addElement('button', 'submit', get_lang('NextStep'), array(
+    'class' => 'save'
+));
+
+$formDefaults = array(
+    'nb_days_acess_before' => $nb_days_acess_before,
+    'nb_days_acess_after' => $nb_days_acess_after
+);
+
+if (!$formSent) {
+    $formDefaults['date_start'] = "$thisYear-$thisMonth-$thisDay";
+
+    $formDefaults['date_end'] = date('Y-m-d', strtotime("$thisYear-$thisMonth-$thisDay +1 year"));
+} else {
+    $formDefaults['name'] = api_htmlentities($name,ENT_QUOTES,$charset);
 }
 
-function emptyDuration() {
-    if ($('#duration').val()) {
-        $('#duration').val('');
+$form->setDefaults($formDefaults);
+
+if ($form->validate()) {
+    $params = $form->getSubmitValues();
+
+    $name = $params['name'];
+    $startDate = $params['date_start'];
+    $endDate = $params['date_end'];
+    $nb_days_acess_before = $params['nb_days_acess_before'];
+    $nb_days_acess_after = $params['nb_days_acess_after'];
+    $coach_username = $params['coach_username'];
+    $id_session_category = $params['session_category'];
+    $id_visibility = $params['session_visibility'];
+    $end_limit = isset($params['end_limit']);
+    $start_limit = isset($params['start_limit']);
+    $duration = isset($params['duration']) ? $params['duration'] : null;
+    $description = $params['description'];
+    $showDescription = isset($params['show_description']) ? 1: 0;
+
+    if (empty($end_limit) && empty($start_limit)) {
+        $nolimit = 1;
+    } else {
+        $nolimit = null;
+    }
+
+    $extraFields = array();
+
+    foreach ($params as $key => $value) {
+        if (strpos($key, 'extra_') === 0) {
+            $extraFields[$key] = $value;
+        }
+    }
+
+    $return = SessionManager::create_session(
+        $name,
+        $startDate,
+        $endDate,
+        $nb_days_acess_before,
+        $nb_days_acess_after,
+        $nolimit,
+        $coach_username,
+        $id_session_category,
+        $id_visibility,
+        $start_limit,
+        $end_limit,
+        false,
+        $duration,
+        $description,
+        $showDescription,
+        $extraFields
+    );
+
+    if ($return == strval(intval($return))) {
+        // integer => no error on session creation
+        header('Location: add_courses_to_session.php?id_session=' . $return . '&add=true&msg=');
+        exit();
     }
 }
-</script>
-<?php
+
+Display::display_header($tool_name);
+
+if (!empty($return)) {
+	Display::display_error_message($return,false);
+}
+
+echo '<div class="actions">';
+echo '<a href="../admin/index.php">'.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('PlatformAdmin'),'',ICON_SIZE_MEDIUM).'</a>';
+echo '</div>';
+
+$form->display();
+
 Display::display_footer();

Some files were not shown because too many files changed in this diff