Browse Source

Merge branch '1.10.x' of github.com:chamilo/chamilo-lms into AngelFQC-7768

Yannick Warnier 9 years ago
parent
commit
b98aab21d1
73 changed files with 2618 additions and 3224 deletions
  1. 3 0
      app/Migrations/Schema/V110/Version110.php
  2. 5 16
      app/Resources/public/css/base.css
  3. 2 14
      app/Resources/public/css/responsive.css
  4. 117 0
      documentation/changelog.html
  5. 3 2
      main/admin/index.php
  6. 71 17
      main/admin/settings.lib.php
  7. 4 1
      main/admin/settings.php
  8. 124 54
      main/gradebook/gradebook_edit_all.php
  9. 2 2
      main/inc/ajax/admin.ajax.php
  10. 11 6
      main/inc/ajax/user_manager.ajax.php
  11. 5 0
      main/inc/lib/GamificationUtils.php
  12. 0 215
      main/inc/lib/access.class.php
  13. 0 198
      main/inc/lib/access_token.class.php
  14. 1 1
      main/inc/lib/agenda.lib.php
  15. 1 1
      main/inc/lib/api.lib.php
  16. 0 169
      main/inc/lib/debug.lib.php
  17. 14 16
      main/inc/lib/events_dispatcher.class.php
  18. 69 47
      main/inc/lib/events_email.class.php
  19. 170 150
      main/inc/lib/extra_field_value.lib.php
  20. 0 223
      main/inc/lib/log.class.php
  21. 23 2
      main/inc/lib/social.lib.php
  22. 1 0
      main/inc/lib/system/session.class.php
  23. 2 0
      main/inc/lib/system/web/header.class.php
  24. 1 0
      main/inc/lib/system/web/request.class.php
  25. 1 1
      main/install/data.sql
  26. 1 1
      main/install/index.php
  27. 2 2
      main/install/install.lib.php
  28. 1 1
      main/install/update-configuration.inc.php
  29. 1 1
      main/install/update-files-1.9.0-1.10.0.inc.php
  30. 12 49
      main/newscorm/learnpath.class.php
  31. 1 2
      main/newscorm/lp_admin_view.php
  32. 0 108
      main/newscorm/lp_ajax_last_update_status.php
  33. 0 1
      main/newscorm/lp_controller.php
  34. 20 9
      main/newscorm/lp_impress.php
  35. 15 7
      main/newscorm/lp_list_search.php
  36. 0 1
      main/newscorm/lp_save.php
  37. 36 32
      main/newscorm/resourcelinker.inc.php
  38. 228 227
      main/newscorm/storageapi.php
  39. 21 20
      main/search/search_suggestions.php
  40. 17 2
      main/social/search.php
  41. 1 0
      main/survey/ch_dropdown.php
  42. 1 0
      main/survey/ch_multiplechoice.php
  43. 8 2
      main/survey/generate_link.php
  44. 0 9
      main/survey/question.php
  45. 0 1
      main/survey/reporting.php
  46. 77 76
      main/survey/survey.download.inc.php
  47. 3 3
      main/template/default/admin/settings_index.tpl
  48. 1 1
      main/template/default/social/add_groups.tpl
  49. 1 1
      main/template/default/social/edit_profile.tpl
  50. 1 45
      main/template/default/social/form_modals.tpl
  51. 1 1
      main/template/default/social/friends.tpl
  52. 1 1
      main/template/default/social/group_waiting_list.tpl
  53. 1 1
      main/template/default/social/groups.tpl
  54. 1 1
      main/template/default/social/home.tpl
  55. 1 1
      main/template/default/social/inbox.tpl
  56. 1 1
      main/template/default/social/invitations.tpl
  57. 1 1
      main/template/default/social/myfiles.tpl
  58. 1 1
      main/template/default/social/profile.tpl
  59. 1 1
      main/template/default/social/search.tpl
  60. 1 1
      plugin/skype/src/Skype.php
  61. 1 1
      plugin/ticket/src/assign_tickets.php
  62. 2 4
      plugin/ticket/src/course_user_list.php
  63. 1 3
      plugin/ticket/src/index.php
  64. 4 3
      plugin/ticket/src/myticket.php
  65. 19 16
      plugin/ticket/src/new_ticket.php
  66. 7 7
      plugin/ticket/src/report.php
  67. 21 10
      plugin/ticket/src/ticket.class.php
  68. 2 2
      plugin/tour/config/tour.json
  69. 1 1
      plugin/tour/lang/english.php
  70. 1 1
      plugin/tour/lang/french.php
  71. 1 1
      plugin/tour/lang/spanish.php
  72. 1406 1429
      tests/main/newscorm/learnpath.class.test.php
  73. 64 0
      tests/video/index.php

+ 3 - 0
app/Migrations/Schema/V110/Version110.php

@@ -476,7 +476,10 @@ class Version110 extends AbstractMigrationChamilo
         $this->addSql("UPDATE c_student_publication_assignment SET expires_on = NULL WHERE expires_on = '0000-00-00 00:00:00'");
         $this->addSql("UPDATE c_student_publication_assignment SET ends_on = NULL WHERE ends_on = '0000-00-00 00:00:00'");
 
+        $this->addSql("UPDATE settings_current SET type = 'checkbox' WHERE variable = 'registration' AND category = 'User'");
+
         $this->addSql("UPDATE settings_current SET selected_value = 'UTF-8' WHERE variable = 'platform_charset'");
+
     }
 
     /**

+ 5 - 16
app/Resources/public/css/base.css

@@ -1528,7 +1528,7 @@ div.image-social-content center.friend {
 }
 
 /*  SOCIAL MENU VERTICAL */
-.social-menu  {
+.social-network-menu  {
     width:100%;
     height:auto;
 }
@@ -3689,7 +3689,6 @@ a:active{
 }
 
 #my_timeline {
-    background: url("dot.gif") repeat-x scroll left 45px;
     margin: 0px auto;
 }
 
@@ -3706,7 +3705,6 @@ a:active{
 }
 
 #dates li {
-    background: url("biggerdot.png") no-repeat scroll center bottom transparent;
     float: left;
     font-size: 14px;
     height: 50px;
@@ -4393,12 +4391,6 @@ i.size-32.icon-new-work{
 #filepaths input{
     margin-bottom:5px;
 }
-.section-social #main_content .span3 {
-  float: left;
-}
-.section-social #main_content .span9 {
-  float: right;
-}
 
 .xdebug-error {
     margin-top: 20px;
@@ -4419,7 +4411,6 @@ i.size-32.icon-new-work{
     margin-left: 110px;
 }
 .btn-msg {
-  background: url("send_msg.png") no-repeat left center;
   background-position: 3px;
   padding: 2px 4px;
   padding-left: 22px;
@@ -4429,7 +4420,6 @@ i.size-32.icon-new-work{
   background-color: #e6e6e6;
 }
 .btn-inv {
-  background: url("send_inv.png") no-repeat left center;
   background-position: 3px;
   padding: 2px 4px;
   padding-left: 22px;
@@ -4439,7 +4429,6 @@ i.size-32.icon-new-work{
   background-color: #e6e6e6;
 }
 .btn-inv-off {
-  background: url("send_inv_off.png") no-repeat left center;
   background-position: 3px;
   padding: 2px 4px;
   padding-left: 22px;
@@ -4473,10 +4462,10 @@ i.size-32.icon-new-work{
     height: 52px;
 }
 
-#settings .span6 .well_border .edit-block {
+#settings .panel .admin-edit-block {
     display: none;
 }
-#settings .span6 .well_border:hover .edit-block {
+#settings .panel:hover .admin-edit-block {
     display: block;
 }
 
@@ -4957,11 +4946,11 @@ i.size-32.icon-new-work{
   vertical-align: bottom;
   margin-right: 5px;
 }
-.social-menu .nav li a{
+.social-network-menu .nav li a{
   padding: 8px;
   font-size: 12px;
 }
-.social-menu .nav li a img{
+.social-network-menu .nav li a img{
   vertical-align: bottom;
   margin-right: 5px;
 }

+ 2 - 14
app/Resources/public/css/responsive.css

@@ -637,9 +637,6 @@ The more frequent ones have been marked with *
                 border-radius: 4px 4px 0 0;
     }
 
-    #section-social .row > [class*="span"], #section-social .row-fluid > [class*="span"] {
-        float: left;
-    }
     /* Some fixes for w~720px */
     .section-mycampus #top_main_content .content-column {
         float: left;
@@ -689,7 +686,7 @@ The more frequent ones have been marked with *
     footer .container .row {
         padding-top: 15px;
     }
-    .social-menu .social-background-content .thumbnail{
+    .social-network-menu .social-background-content .thumbnail{
         border:none;
         box-shadow: none;
     }
@@ -822,9 +819,6 @@ The more frequent ones have been marked with *
     #topbar_push {
         height: 0px;
     }
-    .section-social .span9 {
-        width: 530px;
-    }
 }
 
 @media (min-width: 980px) and (max-width: 1200px) {
@@ -841,15 +835,9 @@ The more frequent ones have been marked with *
     .course-tool {
         width: 280px;
     }
-    .section-social .span9, .section-mycourses .span9{
-        width: 680px;
-    }
-    .section-social .social-menu {
+    .section-social-network .social-network-menu {
         width: 200px;
     }
-    .section-social .span5 {
-        width: 350px;
-    }
     
 }
 @media (min-width: 980px) and (max-width: 1024px) {

+ 117 - 0
documentation/changelog.html

@@ -169,6 +169,18 @@
     <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/fcc9030fafb047c4a62eb671a6213671797edabd">fcc9030f</a> - <a href="https://task.beeznest.com/issues/9881">BT#9881</a>) Add fields to associate forum to lp</li>
     <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/389f0c2d3a0591c289d068fab6c8d24f8fb64504">389f0c2d</a> - <a href="https://task.beeznest.com/issues/9901">BT#9901</a>) Fix issue with sublanguage terms saving (update jQuery call for the value of textarea)</li>
     <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/265fd2eac15ef7ce2f6f3fef7183d47bbf5d25b4">265fd2ea</a>) Update introduction to sub-languages to explain a bit better what's supposed to happen</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/d1992debd3c9777cfbbf63d0712f351f85471330">d1992deb</a> - <a href="https://support.chamilo.org/issues/7150">#7150</a>) Add tracking page link to learning paths list</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/4d2f0513909bf7777499ce6093a1269fd78987a9">4d2f0513</a> - <a href="https://support.chamilo.org/issues/7808">#7808</a>) Save asset time in learning paths</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/95e9710dd5f94c70c41d8393082a0e34a6d3b0b5">95e9710d</a> - <a href="https://support.chamilo.org/issues/5208">#5208</a>) Add CKEditor to textarea in agenda event creation form</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/863b7c49bdf3c367565e3c850778b99ebe4541d0">863b7c49</a> - <a href="https://task.beeznest.com/issues/10219">BT#10219</a>) Show Sign-Up button on sesion details page for not-logged user</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/3ff85070c8b452f2606bacee19cfd4b744f8938e">3ff85070</a>) PrestaShop plugin fixes.</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/f0f62976b23ef76f776cc84f45396a56b97ecb68">f0f62976</a> - <a href="https://task.beeznest.com/issues/10175">BT#10175</a>) Allow subscription to open session</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/56d0756a2e32258b45923f4def0c4a4ba6899ffa">56d0756a</a> - <a href="https://task.beeznest.com/issues/10175">BT#10175</a>) Add setting option to hide the course catalogue</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/cd77a3ef861e2997df983b1233acfd6564ac9010">cd77a3ef</a> - <a href="https://support.chamilo.org/issues/7448">#7448</a>) Prevent coach to edit feedback on exercise result</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/4190658cc1056e03d2f678c3b9732bc1e986ea14">4190658c</a> - <a href="https://task.beeznest.com/issues/9896">BT#9896</a>) Send email when user has been subscribed to session</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/92ffaf62c2a2587fe4af423fe3a53c12da685a9e">92ffaf62</a> - <a href="https://support.chamilo.org/issues/7619">#7619</a>) Add session view (option my_courses_view_by_session) in my courses list</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/9096794b57005e39e3216efdb348f157d309eff6">9096794b</a> - <a href="https://support.chamilo.org/issues/7618">#7618</a>) Add new options in fill blanks question type</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/5f231873215312eaf430caa980f1aaeb2d6a58bb">5f231873</a> - <a href="https://task.beeznest.com/issues/9896">BT#9896</a>) Add option to send an email when a user is being subscribed to a sessino</li>
   </ul>
   <h4>For developers and sysadmins</h4>
   <ul>
@@ -336,6 +348,59 @@
     <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/3cd5b4bc0621a40b73af4ece196df854790eece2">3cd5b4bc</a> - <a href="https://support.chamilo.org/issues/7510">#7510</a>) Add DB compression flag configuration</li>
     <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/646a600e3ebe11c649e33323f3bd607a2e32bd1c">646a600e</a> - <a href="https://task.beeznest.com/issues/9325">BT#9325</a>) Save extra data in admin panel</li>
     <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/370fd8c85193e081ebf499ca334076a27866f312">370fd8c8</a> - <a href="https://support.chamilo.org/issues/7501">#7501</a>) Adds composer as autoloader instead of custom autoloader</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/431576b2b9bda713b5f29b85b553a6a6265d195f">431576b2</a> - <a href="https://support.chamilo.org/issues/6579">#6579</a>) Load favicon from CSS theme directory if it exists</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/f2a03393774e8dd02f1d33acc69022f3cd6fb133">f2a03393</a> - <a href="https://support.chamilo.org/issues/7558">#7558</a>) Add method to get a HTML code for a icon by Font Awesome</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/e94602ec57b374c05e4acc78142889fbea36fdb3">e94602ec</a> - <a href="https://support.chamilo.org/issues/7837">#7837</a>) Replace old code with api_get_user_info</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/22dc909a3893264ab5d15953a5554bada84d2ee1">22dc909a</a> - <a href="https://task.beeznest.com/issues/10259">BT#10259</a>) Add expiration_date validation</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/57f99efbdc9224512a242096482998bef0df4cf7">57f99efb</a> - <a href="https://task.beeznest.com/issues/10253">BT#10253</a>) Add dropbox_hide_general_coach setting</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/8371a3754f643658cd9e71e811bbd804bb560373">8371a375</a> - <a href="https://task.beeznest.com/issues/10217">BT#10217</a>) XFrameOptions work around</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/7a11b484f5f21401d051353de69c400ec346e75c">7a11b484</a> - <a href="https://task.beeznest.com/issues/10248">BT#10248</a>) Show session_admin on Resume Session page</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/7cc56e6946ed1e27f837d86877ef1bbfb39e4e7c">7cc56e69</a> - <a href="https://support.chamilo.org/issues/7220">#7220</a>) Fix missing variable in function orig_item_type (learning paths)</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/ca6f82131805bdd78b4a469da98930592b8e3431">ca6f8213</a>) Remove use of dbName or db_name</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/98f4510ab80a17a27637c0e9f4467270bf27af86">98f4510a</a>) Remove virtual course code.</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/5a9ae8837d9142c114a3c55998d78b83e92ca9a0">5a9ae883</a> - <a href="https://support.chamilo.org/issues/7823">#7823</a>) Set default value auth_cat_child</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/a2d3f1c99ccb4ab25c180fbf1bdb896395009288">a2d3f1c9</a> - <a href="https://support.chamilo.org/issues/7819">#7819</a>) Add database port to installation procedure and configuration file</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/5451fd535fc5e9c7c14bddca4d081f4707e50f83">5451fd53</a>) Delete group category and group  when deleting a course.</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/2ce8bedf327eb7d75264fba4427b261f7f2b47d7">2ce8bedf</a> - <a href="https://task.beeznest.com/issues/10219">BT#10219</a>) Add method to search session by name on course catalog</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/c169d7fcac7911dd4eeee71b26083cc804456c60">c169d7fc</a> - <a href="https://task.beeznest.com/issues/10045">BT#10045</a>) Attempt at Nginx and Apache config examples in installation guide (Spanish only for now). Still presenting issues with file uploads under Nginx</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/a1429e93dcd4bc45dced3374efab27650bba885f">a1429e93</a>) Add section about testing with Docker in CONTRIBUTING.md</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/28a2a5e9a8ec37e27afeb2e176e23f68c86ea8f8">28a2a5e9</a> - <a href="https://task.beeznest.com/issues/10145">BT#10145</a>) Add param to prevent limitless redirections in SSO for Drupal</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/e1be9c9864bcf280aac058aa1127a95acd6e5d62">e1be9c98</a>) Update fxp version requirement in README</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/9b5dc83734c455f59f5c62d764b888a81e9c99c7">9b5dc837</a> - <a href="https://task.beeznest.com/issues/10174">BT#10174</a>) Force session user data reload when login through sso</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/da5c70c191ade10c67a4a941ad71adeb30a0dae6">da5c70c1</a> - <a href="https://task.beeznest.com/issues/10181">BT#10181</a>) Add option to enable/disable individual skills</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/d2f674b4633f44b8d6f42195cccea97644d75eed">d2f674b4</a> - <a href="https://task.beeznest.com/issues/10181">BT#10181</a>) Add status and update_at on skill table</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/5542e7b6619e86bc3a47a2f62f6907128c29514c">5542e7b6</a> - <a href="https://task.beeznest.com/issues/10175">BT#10175</a>) Show number of user in session for Advanced Subscription</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/d5467da510ae696d298c3691e6355edbb9f84ea5">d5467da5</a> - <a href="https://task.beeznest.com/issues/10175">BT#10175</a>) Add student status on admin_view for Advanced Subsciption</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/a7f2c5f67730537a65b25c3e7f621069955a7be2">a7f2c5f6</a> - <a href="https://task.beeznest.com/issues/10175">BT#10175</a>) Add RewriteRule to get files in course directories</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/c897c8e180c7bc081ae279a01c07471e066d19d6">c897c8e1</a>) Add option to boost encoding detection for learning paths - see https://github.com/chamilo/chamilo-lms/pull/771</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/443b7823f7791b7a03dcbe8acbb562d587ee2c83">443b7823</a> - <a href="https://task.beeznest.com/issues/10174">BT#10174</a>) Add referrer_uri variable to enable the right redirect to happen when user is authenticated after a Single Sign On operation </li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/1481dd4573c0e559936b24b6007ee8c944994fad">1481dd45</a> - <a href="https://task.beeznest.com/issues/10175">BT#10175</a>) Fix links to example files in session imports</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/98d0cf7828f5c608f9df4dba30ea1c87d2996538">98d0cf78</a> - <a href="https://support.chamilo.org/issues/7794">#7794</a>) Move my_courses_view_by_session setting to database</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/a740f7ff0324a8cf4b53bf8f88758fde527e8edf">a740f7ff</a> - <a href="https://support.chamilo.org/issues/7794">#7794</a>) Move user_reset_password and user_reset_password_token_limit settings to database</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/ea94df0669cda8ab7ed95863845a3a6d02ff14bd">ea94df06</a> - <a href="https://support.chamilo.org/issues/7794">#7794</a>) Move course_catalog_published setting to database</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/189ea94d9a92830f58f2fc9c11fbcfa22ee25ad5">189ea94d</a>) Fix query error when saving an lp_item imported from a ppt file -refs bt10091</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/9ed26091d29e05bb9f9b7fe116efd4b4685f72cf">9ed26091</a> - <a href="https://support.chamilo.org/issues/7794">#7794</a>) Move gradebook_detailed_admin_view setting to database</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/628e0ccd81e4ff0e3d8639ecaeb294e238ead3e3">628e0ccd</a> - <a href="https://support.chamilo.org/issues/7794">#7794</a>) Move prevent_multiple_simultaneous_login setting to database</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/5331084f626ab0e3150a5b8574a4a4223c748fab">5331084f</a> - <a href="https://support.chamilo.org/issues/7792">#7792</a>) Add mathajax lib</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/620e79631f26a86c1a9743e606eb73498ae59d34">620e7963</a> - <a href="https://support.chamilo.org/issues/7794">#7794</a>) Remove db_admin_path setting, now replaced by db_manager_enabled</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/9a04803fb157e7b959737cedaf8d9c6c39622396">9a04803f</a> - <a href="https://support.chamilo.org/issues/7448">#7448</a>) Add setting to allow feedback from coaches on exercise results</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/00c59b690fdaa923331ad2ceec1004ccc6519ca9">00c59b69</a> - <a href="https://support.chamilo.org/issues/1483">#1483</a>) Add install profiles mechanism (beta)</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/a9d953db390e0d67497a3f1e91004e869867c505">a9d953db</a>) If error in the query then hide the sql error (in production mode)</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/003ee63187bcac677de01909aef65c8d3c0c5534">003ee631</a>) Replace Spreadsheet_Excel_Writer/Writer with PHPExcel</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/b1786914ed9746442a635ec6708c3436df02ed8d">b1786914</a> - <a href="https://task.beeznest.com/issues/10139">BT#10139</a>) Create new extra fields types 'letters' and 'alphanumeric with spaces' -  refs BT#10139 #TMI</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/69422fa712e400a5b656d5d21875e21d2236927a">69422fa7</a> - <a href="https://task.beeznest.com/issues/10139">BT#10139</a>) Add pattern to validate only letters and numbers on course code</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/dc17948791649dc4ac2cfbf2847bcccc7066b9a4">dc179487</a>) Add script to delete old unused courses</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/dbe3b890c6f26b5066e8d5ebbb17981ffb082169">dbe3b890</a> - <a href="https://task.beeznest.com/issues/10139">BT#10139</a>) Change date params when agenda event is created</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/e296bc849040c1aee97d4e29d10d7c254cdb5bba">e296bc84</a> - <a href="https://task.beeznest.com/issues/10139">BT#10139</a>) Add 'only_letters' and 'alphanumeric' types of extra fields</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/8d4d575690ccf30865718e123f103c5729c4b30e">8d4d5756</a> - <a href="https://task.beeznest.com/issues/10139">BT#10139</a>) Add validation pattern for course code in create course form</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/a37f8d44bf4df0940b3275ba21dd15ec46af3c23">a37f8d44</a> - <a href="https://task.beeznest.com/issues/10139">BT#10139</a>) Update jquery jqplot lib</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/5af5c2834c9c152cdffef6b0e056571ca586dc0a">5af5c283</a> - <a href="https://task.beeznest.com/issues/9897">BT#9897</a>) Delete token and time from user password reset after first use</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/b458a6f0ec07302c1642515b9f950f9e5f2e9f46">b458a6f0</a>) Add iid in c_group_info</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/541fdf612f95c671b3ccb30a2fd26a754f51f7c9">541fdf61</a> - <a href="https://task.beeznest.com/issues/9898">BT#9898</a>) Add management for Cron Job</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/41608e948ccb7956a3644d0a399cf14fdd4212d8">41608e94</a>) Add basis for Claroline to Chamilo migration scripts</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/4c0780aa76778c390ace24f6cf85a100fc6459ba">4c0780aa</a> - <a href="https://task.beeznest.com/issues/9897">BT#9897</a>) Add new reset password option</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/67b0693c31b338c18ee0a8aa5868c411c81a5c66">67b0693c</a> - <a href="https://task.beeznest.com/issues/10092">BT#10092</a>) Create TrackECourseAccessRepository entity</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/fcc9030fafb047c4a62eb671a6213671797edabd">fcc9030f</a> - <a href="https://task.beeznest.com/issues/9881">BT#9881</a>) Add fields to associate forum to lp</li>
   </ul>
 
   <h3>Improvements (minor features) and debug</h3>
@@ -823,6 +888,57 @@
     <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/2fa39544aaaade7fcc87b6f47f74a068be3f3238">2fa39544</a> - <a href="https://support.chamilo.org/issues/7370">#7370</a>) Fix a few buy courses plugin issues</li>
     <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/f37f0bd3c6e0ae4707227f5a5c6583ab288644cc">f37f0bd3</a> - <a href="https://task.beeznest.com/issues/9068">BT#9068</a>) Fix session_id and visible_result creation issue</li>
     <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/2fd2c2b7a4284204138662bd432a7301c625579d">2fd2c2b7</a> - <a href="https://task.beeznest.com/issues/9022">BT#9022</a>) Add certificate path to the web service. Add 'add_gradebook_certificates_cron_task_enabled' configuration parameter</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/56504c645d2003fd1e28fc965298760dddd8aabc">56504c64</a> - <a href="https://task.beeznest.com/issues/10254">BT#10254</a>) Fix download zip when using windows</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/9a4c0f5fa725a5247217340e0b7b454f4a5ebc64">9a4c0f5f</a>) Fix announcement, thematic and wiki imports</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/29fb361f8fc4441d64e496b03dfb54b7726946de">29fb361f</a>) Move class UTCDateTimeType  inside app folder (permissions issue)</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/7913f289f7fabcce38a95f91494056cc91f22776">7913f289</a> - <a href="https://support.chamilo.org/issues/7808">#7808</a>) Show link only if message tool is on, in e-mails sent to users</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/76d25d799a39ca3d2dd37201a829a99e58426e67">76d25d79</a> - <a href="https://task.beeznest.com/issues/10102">BT#10102</a>) Increase year range for date pickers</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/c65dbc37821ea5893e5cdbdd7ac2e56e62968afd">c65dbc37</a> - <a href="https://support.chamilo.org/issues/7807">#7807</a>) Move js code into 2 separate files</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/666cb686fb6be62123dc6ff9361c2fbbf1804fb4">666cb686</a>) Display: add functions toolbar actions for pages</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/108a252aaa644d8c33b7eb019667f43849f2d299">108a252a</a> - <a href="https://support.chamilo.org/issues/5405">#5405</a>) Remove remaining now() call in course.lib.php</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/0a8495e3b54f34510188404e6cf1bb21cd0bbf19">0a8495e3</a>) Remove gid unset, use api_get_group_id, api_get_course_id</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/21318bb1287644d6481d064063b7d276016454e9">21318bb1</a>) Fix "Multiple answer true/false/don't know" question CRUD</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/546e927ed0791b04c568fbfe5d71f8a94bec3b83">546e927e</a>) Change main/inc/conf references to app/config/</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/c9acd1f54a19008165205af87aadd2b1def9cc0d">c9acd1f5</a> - <a href="https://support.chamilo.org/issues/7768">#7768</a>) Add class method for get user from course by status</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/9ba243744578424a6317041e398134c840218b23">9ba24374</a>) Fix jsplumb error in admin question list</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/dd8733e65b743317902ab76a3a9c74603b7ffda0">dd8733e6</a> - <a href="https://task.beeznest.com/issues/10175">BT#10175</a>) Fix generate PDF when output mode is F</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/5d15b58832785044bb766634ccb289800597cd1f">5d15b588</a>) Updating status for open sessions -refs BT10175 #FGE</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/87af6dcf9cb620f8eaacedcac7f64e098515a7ea">87af6dcf</a> - <a href="https://task.beeznest.com/issues/10175">BT#10175</a>) Show always the skill name like a tooltip on skill wheel</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/fcb12ae9431ac83b031cd3e346d2bf40f55ed86f">fcb12ae9</a> - <a href="https://task.beeznest.com/issues/10175">BT#10175</a>) Allow show full skill name on skill wheel</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/6a67ed2a52a0c95066c1eb8c4b45c84956b7bab8">6a67ed2a</a> - <a href="https://task.beeznest.com/issues/10175">BT#10175</a>) Fix showing description in exercise execution</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/30629475b583a47a849001097124a2dd8ddda727">30629475</a>) Get rid of username column in the certificates' result page -refs BT10175 #FGE</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/3887d26ed8c66f657a6985e823ce5458989d3724">3887d26e</a>) Update install documentation link to localized version for French, Spanish and Italian</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/53cd9c7e96e8273a5bb1f7bb492e67650abfc66a">53cd9c7e</a> - <a href="https://task.beeznest.com/issues/10175">BT#10175</a>) Fix URL link when searching skills</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/abae544df32afd8d58df17b5b4e387bfcca2181d">abae544d</a> - <a href="https://task.beeznest.com/issues/10175">BT#10175</a>) Improve admin_view on Advanced Subscription</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/cd4d275823e1e9ae55f7c3a34d678dfe7e1f1f3e">cd4d2758</a> - <a href="https://task.beeznest.com/issues/10139">BT#10139</a>) Add new export types</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/7832686cc41393b7feeb564683fc3a0a8d6b9966">7832686c</a> - <a href="https://task.beeznest.com/issues/10139">BT#10139</a>) Add export to xls</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/fccfb6b77df1a98fca296f8d9232ad043418ed87">fccfb6b7</a> - <a href="https://task.beeznest.com/issues/7683">BT#7683</a>) Add frame.css in CkEditor BT#7683</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/76e9608ef4bf0b1fb83c49a3b47f6bb799fda228">76e9608e</a>) Add CSS SCORM iFrame style</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/0672f0386cc87e6a815664c5627eed9fe802c0c0">0672f038</a>) Fix course cateogory order.</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/e7323004863d21841401ce76dcdc7765355663bf">e7323004</a>) deleted base_chamilo.css obsolete</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/1bc2b02f45b651a5f1f069b089a15293912b3537">1bc2b02f</a> - <a href="https://task.beeznest.com/issues/7683">BT#7683</a>) Add icons for chat online status BT#7683</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/a9aec19920c1537915d34ec118ac654b9363b60f">a9aec199</a>) Fix iid/id issues when using exporting/importing courses.</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/8b3b37451dfeff9752c3c3dc549b84ce5d752506">8b3b3745</a>) Remove unused build_datetime_from_array, fix dates.</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/4a3d526cd58d961eca6a1754cefee277d8bf8c03">4a3d526c</a>) Avoid double header.</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/f3724f53714b8f5898718dcf266a6cefb8c95637">f3724f53</a> - <a href="https://task.beeznest.com/issues/10139">BT#10139</a>) Rename FormValidator functions</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/bcdaab02b3f95a51695bfc91a5e44c948e024ca2">bcdaab02</a> - <a href="https://task.beeznest.com/issues/10139">BT#10139</a>) Show input dates with format</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/d44ab51077cc0adf4e81e1a84d24128bc5770e87">d44ab510</a>) Add message if no courses in the session.</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/dcaad88a2e69f8facc8db6a44a7cf5cacb417d81">dcaad88a</a> - <a href="https://support.chamilo.org/issues/7788">#7788</a>) Fix issue with missing image in auto-created forum</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/7d2eec85d9e6812e6847f31d8884372dd9779a0a">7d2eec85</a> - <a href="https://support.chamilo.org/issues/7788">#7788</a>) Fix issue with missing thread_qualify</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/3ea9c064321a60031ff3c831fe66aa7e2ecb1fa4">3ea9c064</a> - <a href="https://task.beeznest.com/issues/10139">BT#10139</a>) If course plugin image does not exists then use default image.</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/dde0a54a44357946c9cd41158785823393b3446b">dde0a54a</a> - <a href="https://task.beeznest.com/issues/9898">BT#9898</a>) Create template for mail sent by the Course Finished cron</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/0934761879af2ea245818bede37c24398909695f">09347618</a> - <a href="https://task.beeznest.com/issues/9898">BT#9898</a>) Create template for mail sent by the Remind Course Expiration cron</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/d11fe19094c58516c3f0c05ebd5ca63fb72ed51f">d11fe190</a>) Replace &amp; with &</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/731f0fb2a6f89b53ddf67f14ce364b475fbd34c8">731f0fb2</a> - <a href="https://task.beeznest.com/issues/7683">BT#7683</a>) Change hot courses image size - BT#7683</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/38d5bb28643fb640f1d2e237dc83694c9f5ad4af">38d5bb28</a> - <a href="https://task.beeznest.com/issues/9895">BT#9895</a>) update session subscription tpls and enable use of tpl for registration mail confirmation</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/98e741c8002c8513e6e19f8ce7378519e31cae41">98e741c8</a>) Add stats for distinct users in number of logins report on admin statistics page</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/2b8f8a384be5a7f0e04e233d368dedd8e3929300">2b8f8a38</a>) Fix missing values on call to chamilo_void_save_asset() in exercises included in learning paths #TMI</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/141be5d9d1851ef2b3cb081cdfc46855984298c2">141be5d9</a> - <a href="https://task.beeznest.com/issues/9889">BT#9889</a>) Add session subscription confirmation request</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/433999d04ca1248e2d1e67568083bbf2e9dae707">433999d0</a> - <a href="https://task.beeznest.com/issues/9889">BT#9889</a>) Show subscribe to session button when user is logged on session description page</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/e6c81faef7fc59d834e16a5634ddd341245469f9">e6c81fae</a> - <a href="https://task.beeznest.com/issues/10092">BT#10092</a>) Fix calculate points and stars by lps in courses</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/3ae531093d48ea9ce5e1cec71151f17db34829e8">3ae53109</a> - <a href="https://task.beeznest.com/issues/9886">BT#9886</a>) Show lp_view progress bar when gamification is active</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/95d977931a4f0fe8af863a8fdff09a615c1f249e">95d97793</a> - <a href="https://task.beeznest.com/issues/9886">BT#9886</a>) Calculate stars and points when gamification is active</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/389f0c2d3a0591c289d068fab6c8d24f8fb64504">389f0c2d</a> - <a href="https://task.beeznest.com/issues/9901">BT#9901</a>) Fix issue with sublanguage terms saving (update jQuery call for the value of textarea)</li>
   </ul>
 <h3>Stylesheets and theming</h3>
   <ul>
@@ -831,6 +947,7 @@
     <li>Removed all previous stylesheets and rewritten main ones from scratch</li>
     <li>Most of the CSS classes to most elements have been changed, making it practically impossible to maintain previous CSS styles with this new version (we're very sorry about that, but it was either this or sticking to non-mobile-friendly design)</li>
     <li>Many pages have been moved to TPL, making it easier to redesign them</li>
+    <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/10e8ff1ed2f2dd20b32e6b8d45f68537c7801ed6">10e8ff1e</a> - <a href="https://support.chamilo.org/issues/7539">#7539</a>) Add Beach CSS theme - CT#7539</li>
   </ul>
 <h3>Web services</h3>
   <ul>

+ 3 - 2
main/admin/index.php

@@ -19,7 +19,7 @@ api_protect_admin_script(true);
 $nameTools = get_lang('PlatformAdmin');
 
 $accessUrlId = 0;
-$adminExtraContentDir = api_get_path(SYS_PATH) . "home/admin/";
+$adminExtraContentDir = api_get_path(SYS_APP_PATH) . "home/admin/";
 
 if (api_is_multiple_url_enabled()) {
     $accessUrlId = api_get_current_access_url_id();
@@ -28,7 +28,7 @@ if (api_is_multiple_url_enabled()) {
         $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/";
+        $adminExtraContentDir = api_get_path(SYS_APP_PATH) . "home/$cleanUrl/admin/";
     }
 }
 
@@ -481,6 +481,7 @@ if (api_is_platform_admin()) {
 
         if (!empty($extraData['block'])) {
             if (!is_dir($adminExtraContentDir)) {
+                var_dump($adminExtraContentDir);
                 mkdir(
                     $adminExtraContentDir,
                     api_get_permissions_for_new_directories(),

+ 71 - 17
main/admin/settings.lib.php

@@ -1166,7 +1166,8 @@ function update_gradebook_score_display_custom_values($values) {
     $scoredisplay->update_custom_score_display_settings($final);
 }
 
-function generate_settings_form($settings, $settings_by_access_list) {
+function generate_settings_form($settings, $settings_by_access_list)
+{
     global $_configuration, $settings_to_avoid, $convert_byte_to_mega_list;
     $table_settings_current = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
 
@@ -1185,10 +1186,11 @@ function generate_settings_form($settings, $settings_by_access_list) {
 
     $default_values = array();
     $url_info = api_get_access_url($url_id);
-
     $i = 0;
     foreach ($settings as $row) {
-        if (in_array($row['variable'], array_keys($settings_to_avoid))) { continue; }
+        if (in_array($row['variable'], array_keys($settings_to_avoid))) {
+            continue;
+        }
 
         if (!empty($_configuration['multiple_access_urls'])) {
             if (api_is_global_platform_admin()) {
@@ -1234,7 +1236,7 @@ function generate_settings_form($settings, $settings_by_access_list) {
                 if (is_array($settings_by_access_list[ $row['variable'] ] [ $row['subkey'] ] [ $row['category'] ])) {
                     // We are sure that the other site have a selected value.
                     if ($settings_by_access_list[ $row['variable'] ] [ $row['subkey'] ] [ $row['category'] ]['selected_value'] != '')
-                        $row['selected_value'] =$settings_by_access_list[$row['variable']] [$row['subkey']] [ $row['category'] ]['selected_value'];
+                        $row['selected_value'] = $settings_by_access_list[$row['variable']] [$row['subkey']] [$row['category']]['selected_value'];
                 }
                 // There is no else{} statement because we load the default $row['selected_value'] of the main Chamilo site.
             }
@@ -1243,11 +1245,28 @@ function generate_settings_form($settings, $settings_by_access_list) {
         switch ($row['type']) {
             case 'textfield':
                 if (in_array($row['variable'], $convert_byte_to_mega_list)) {
-                    $form->addElement('text', $row['variable'], array(get_lang($row['title']), get_lang($row['comment']), get_lang('MB')), array('maxlength' => '8'));
+                    $form->addElement(
+                        'text',
+                        $row['variable'],
+                        array(
+                            get_lang($row['title']),
+                            get_lang($row['comment']),
+                            get_lang('MB'),
+                        ),
+                        array('maxlength' => '8')
+                    );
                     $form->applyFilter($row['variable'], 'html_filter');
                     $default_values[$row['variable']] = round($row['selected_value']/1024/1024, 1);
                 } elseif ($row['variable'] == 'account_valid_duration') {
-                    $form->addElement('text', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('maxlength' => '5'));
+                    $form->addElement(
+                        'text',
+                        $row['variable'],
+                        array(
+                            get_lang($row['title']),
+                            get_lang($row['comment']),
+                        ),
+                        array('maxlength' => '5')
+                    );
                     $form->applyFilter($row['variable'], 'html_filter');
                     $default_values[$row['variable']] = $row['selected_value'];
 
@@ -1256,7 +1275,15 @@ function generate_settings_form($settings, $settings_by_access_list) {
                     continue;
                 } else {
                     $hideme['class'] = 'span4';
-                    $form->addElement('text', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), $hideme);
+                    $form->addElement(
+                        'text',
+                        $row['variable'],
+                        array(
+                            get_lang($row['title']),
+                            get_lang($row['comment']),
+                        ),
+                        $hideme
+                    );
                     $form->applyFilter($row['variable'],'html_filter');
                     $default_values[$row['variable']] = $row['selected_value'];
                 }
@@ -1286,27 +1313,38 @@ function generate_settings_form($settings, $settings_by_access_list) {
             case 'radio':
                 $values = api_get_settings_options($row['variable']);
                 $group = array ();
-                if (is_array($values )) {
+                if (is_array($values)) {
                     foreach ($values as $key => $value) {
-                        $element = & $form->createElement('radio', $row['variable'], '', get_lang($value['display_text']), $value['value']);
+                        $element = &$form->createElement(
+                            'radio',
+                            $row['variable'],
+                            '',
+                            get_lang($value['display_text']),
+                            $value['value']
+                        );
                         if ($hide_element) {
                             $element->freeze();
                         }
                         $group[] = $element;
                     }
                 }
-                $form->addGroup($group, $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), '', false); //julio
+                $form->addGroup(
+                    $group,
+                    $row['variable'],
+                    array(get_lang($row['title']), get_lang($row['comment'])),
+                    '',
+                    false
+                );
                 $default_values[$row['variable']] = $row['selected_value'];
                 break;
             case 'checkbox';
                 // 1. We collect all the options of this variable.
-                $sql = "SELECT * FROM $table_settings_current WHERE variable='".$row['variable']."' AND access_url =  1";
+                $sql = "SELECT * FROM $table_settings_current
+                        WHERE variable='".$row['variable']."' AND access_url =  1";
 
                 $result = Database::query($sql);
                 $group = array ();
                 while ($rowkeys = Database::fetch_array($result)) {
-                    //if ($rowkeys['variable'] == 'course_create_active_tools' && $rowkeys['subkey'] == 'enable_search') { continue; }
-
                     // Profile tab option should be hidden when the social tool is enabled.
                     if (api_get_setting('allow_social_tool') == 'true') {
                         if ($rowkeys['variable'] == 'show_tabs' && $rowkeys['subkey'] == 'my_profile') {
@@ -1319,14 +1357,25 @@ function generate_settings_form($settings, $settings_by_access_list) {
                         continue;
                     }
 
-                    $element = & $form->createElement('checkbox', $rowkeys['subkey'], '', get_lang($rowkeys['subkeytext']));
+                    $element = &$form->createElement(
+                        'checkbox',
+                        $rowkeys['subkey'],
+                        '',
+                        get_lang($rowkeys['subkeytext'])
+                    );
+
                     if ($row['access_url_changeable'] == 1) {
                         // 2. We look into the DB if there is a setting for a specific access_url.
                         $access_url = $_configuration['access_url'];
                         if (empty($access_url)) {
                             $access_url = 1;
                         }
-                        $sql = "SELECT selected_value FROM $table_settings_current WHERE variable='".$rowkeys['variable']."' AND subkey='".$rowkeys['subkey']."'  AND  subkeytext='".$rowkeys['subkeytext']."' AND access_url =  $access_url";
+                        $sql = "SELECT selected_value FROM $table_settings_current
+                                WHERE
+                                    variable='".$rowkeys['variable']."' AND
+                                    subkey='".$rowkeys['subkey']."' AND
+                                    subkeytext='".$rowkeys['subkeytext']."' AND
+                                    access_url =  $access_url";
                         $result_access = Database::query($sql);
                         $row_access = Database::fetch_array($result_access);
                         if ($row_access['selected_value'] == 'true' && !$form->isSubmitted()) {
@@ -1342,7 +1391,12 @@ function generate_settings_form($settings, $settings_by_access_list) {
                     }
                     $group[] = $element;
                 }
-                $form->addGroup($group, $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])),'');
+                $form->addGroup(
+                    $group,
+                    $row['variable'],
+                    array(get_lang($row['title']), get_lang($row['comment'])),
+                    ''
+                );
                 break;
             case 'link':
                 $form->addElement('static', null, array(get_lang($row['title']), get_lang($row['comment'])), get_lang('CurrentValue').' : '.$row['selected_value'], $hideme);
@@ -1413,7 +1467,7 @@ function search_setting($search)
             $found = false;
 
             $title = api_strtolower(get_lang($setting['title']));
-            //try the title
+            // try the title
             if (strpos($title, $search) === false) {
                 $comment = api_strtolower(get_lang($setting['comment']));
                 //Try the comment

+ 4 - 1
main/admin/settings.php

@@ -85,12 +85,14 @@ $url_id = api_get_current_access_url_id();
 
 $settings = null;
 
-function get_settings($category = null) {
+function get_settings($category = null)
+{
     $url_id = api_get_current_access_url_id();
     $settings_by_access_list = array();
 
     if ($url_id == 1) {
         $settings = api_get_settings($category, 'group', $url_id);
+
     } else {
         $url_info = api_get_access_url($url_id);
         if ($url_info['active'] == 1) {
@@ -119,6 +121,7 @@ function get_settings($category = null) {
             }
         }
     }
+
     if (isset($category) && $category== 'search_setting') {
         if (!empty($_REQUEST['search_field'])) {
             $settings = search_setting($_REQUEST['search_field']);

+ 124 - 54
main/gradebook/gradebook_edit_all.php

@@ -34,23 +34,58 @@ $tbl_forum_thread = Database:: get_course_table(TABLE_FORUM_THREAD);
 $tbl_work = Database:: get_course_table(TABLE_STUDENT_PUBLICATION);
 $tbl_attendance = Database:: get_course_table(TABLE_ATTENDANCE);
 
-$table_evaluated[LINK_EXERCISE] = array(TABLE_QUIZ_TEST, 'title', 'id', get_lang('Exercise'));
-$table_evaluated[LINK_DROPBOX] = array(TABLE_DROPBOX_FILE, 'name','id', get_lang('Dropbox'));
-$table_evaluated[LINK_STUDENTPUBLICATION] = array(TABLE_STUDENT_PUBLICATION, 'url','id', get_lang('Student_publication'));
-$table_evaluated[LINK_LEARNPATH] = array(TABLE_LP_MAIN, 'name','id', get_lang('Learnpath'));
-$table_evaluated[LINK_FORUM_THREAD] = array(TABLE_FORUM_THREAD, 'thread_title_qualify', 'thread_id', get_lang('Forum'));
-$table_evaluated[LINK_ATTENDANCE] = array(TABLE_ATTENDANCE, 'attendance_title_qualify', 'id', get_lang('Attendance'));
-$table_evaluated[LINK_SURVEY] = array(TABLE_SURVEY, 'code', 'survey_id', get_lang('Survey'));
+$table_evaluated[LINK_EXERCISE] = array(
+    TABLE_QUIZ_TEST,
+    'title',
+    'id',
+    get_lang('Exercise'),
+);
+$table_evaluated[LINK_DROPBOX] = array(
+    TABLE_DROPBOX_FILE,
+    'name',
+    'id',
+    get_lang('Dropbox'),
+);
+$table_evaluated[LINK_STUDENTPUBLICATION] = array(
+    TABLE_STUDENT_PUBLICATION,
+    'url',
+    'id',
+    get_lang('Student_publication'),
+);
+$table_evaluated[LINK_LEARNPATH] = array(
+    TABLE_LP_MAIN,
+    'name',
+    'id',
+    get_lang('Learnpath'),
+);
+$table_evaluated[LINK_FORUM_THREAD] = array(
+    TABLE_FORUM_THREAD,
+    'thread_title_qualify',
+    'thread_id',
+    get_lang('Forum'),
+);
+$table_evaluated[LINK_ATTENDANCE] = array(
+    TABLE_ATTENDANCE,
+    'attendance_title_qualify',
+    'id',
+    get_lang('Attendance'),
+);
+$table_evaluated[LINK_SURVEY] = array(
+    TABLE_SURVEY,
+    'code',
+    'survey_id',
+    get_lang('Survey'),
+);
 
 $submitted = isset($_POST['submitted']) ? $_POST['submitted'] : '';
-if ($submitted==1) {
+if ($submitted == 1) {
     Display :: display_confirmation_message(get_lang('GradebookWeightUpdated')) . '<br /><br />';
     if (isset($_POST['evaluation'])) {
         $eval_log = new Evaluation();
     }
 }
 
-$output='';
+$output = '';
 $my_cat = Category::load($my_selectcat);
 $my_cat = $my_cat[0];
 
@@ -70,12 +105,10 @@ $links = Database::store_result($result, 'ASSOC');
 
 foreach ($links as &$row) {
     $item_weight = $row['weight'];
-    //$item_weight = $masked_total*$item_weight/$original_total;
-    //
     $sql = 'SELECT * FROM '.GradebookUtils::get_table_type_course($row['type']).'
             WHERE c_id = '.$course_id.' AND '.$table_evaluated[$row['type']][2].' = '.$row['ref_id'];
     $result = Database::query($sql);
-    $resource_name = Database ::fetch_array($result);
+    $resource_name = Database::fetch_array($result);
 
     if (isset($resource_name['lp_type'])) {
         $resource_name = $resource_name[4];
@@ -86,15 +119,21 @@ foreach ($links as &$row) {
 
     // Update only if value changed
     if (isset($_POST['link'][$row['id']])) {
-        //$new_weight = trim($_POST['link'][$row['id']]*$original_total/$masked_total);
         $new_weight = trim($_POST['link'][$row['id']]);
-        GradebookUtils::updateLinkWeight($row['id'], $resource_name, $new_weight);
+        GradebookUtils::updateLinkWeight(
+            $row['id'],
+            $resource_name,
+            $new_weight
+        );
         $item_weight = $new_weight;
     }
 
-    $output.= '<tr><td>'.GradebookUtils::build_type_icon_tag($row['type']).'</td>
-               <td> '.$resource_name.' '.Display::label($table_evaluated[$row['type']][3],'info').' </td>';
-    $output.= '<td>
+    $output .= '<tr><td>'.GradebookUtils::build_type_icon_tag($row['type']).'</td>
+               <td> '.$resource_name.' '.Display::label(
+            $table_evaluated[$row['type']][3],
+            'info'
+        ).' </td>';
+    $output .= '<td>
                     <input type="hidden" name="link_'.$row['id'].'" value="'.$resource_name.'" />
                     <input size="10" type="text" name="link['.$row['id'].']" value="'.$item_weight.'"/>
                </td></tr>';
@@ -105,29 +144,31 @@ $result = Database::query($sql);
 $evaluations = Database::store_result($result);
 foreach ($evaluations as $evaluationRow) {
     $item_weight = $evaluationRow['weight'];
-    //$item_weight = $masked_total*$item_weight/$original_total;
-
-    //update only if value changed
+    // update only if value changed
     if (isset($_POST['evaluation'][$evaluationRow['id']])) {
-        //$new_weight = trim($_POST['evaluation'][$evaluationRow['id']]*$original_total/$masked_total);
         $new_weight = trim($_POST['evaluation'][$evaluationRow['id']]);
-        GradebookUtils::updateEvaluationWeight($evaluationRow['id'], $new_weight);
+        GradebookUtils::updateEvaluationWeight(
+            $evaluationRow['id'],
+            $new_weight
+        );
 
         $item_weight = $new_weight;
     }
 
-    $output.= '<tr>
+    $output .= '<tr>
                 <td>'.GradebookUtils::build_type_icon_tag('evalnotempty').'</td>
-                <td>'.$evaluationRow['name'].' '.Display::label(get_lang('Evaluation')).'</td>';
-    $output.= '<td>
+                <td>'.$evaluationRow['name'].' '.Display::label(
+            get_lang('Evaluation')
+        ).'</td>';
+    $output .= '<td>
                     <input type="hidden" name="eval_'.$evaluationRow['id'].'" value="'.$evaluationRow['name'].'" />
                     <input type="text" size="10" name="evaluation['.$evaluationRow['id'].']" value="'.$item_weight.'"/>
                 </td></tr>';
 }
 
 $my_api_cidreq = api_get_cidreq();
-if ($my_api_cidreq=='') {
-    $my_api_cidreq='cidReq='.$my_category['course_code'];
+if ($my_api_cidreq == '') {
+    $my_api_cidreq = 'cidReq='.$my_category['course_code'];
 }
 
 $currentUrl = api_get_self().'?'.api_get_cidreq().'&selectcat='.$my_selectcat;
@@ -175,7 +216,10 @@ if ($form->validate()) {
                 $diffApplied = true;
             }
         }
-        GradebookUtils::updateEvaluationWeight($evaluation['id'], $weightToApply);
+        GradebookUtils::updateEvaluationWeight(
+            $evaluation['id'],
+            $weightToApply
+        );
     }
 
     header('Location:'.$currentUrl);
@@ -186,22 +230,47 @@ if ($form->validate()) {
 // 	DISPLAY HEADERS AND MESSAGES
 if (!isset($_GET['exportpdf']) and !isset($_GET['export_certificate'])) {
     if (isset ($_GET['studentoverview'])) {
-        $interbreadcrumb[]= array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat=' . $my_selectcat,'name' => get_lang('Gradebook'));
-        Display :: display_header(get_lang('FlatView'));
+        $interbreadcrumb[] = array(
+            'url' => Security::remove_XSS(
+                    $_SESSION['gradebook_dest']
+                ).'?selectcat='.$my_selectcat,
+            'name' => get_lang('Gradebook'),
+        );
+        Display:: display_header(get_lang('FlatView'));
     } elseif (isset ($_GET['search'])) {
-        $interbreadcrumb[]= array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat=' . $my_selectcat,'name' => get_lang('Gradebook'));
-        Display :: display_header(get_lang('SearchResults'));
+        $interbreadcrumb[] = array(
+            'url' => Security::remove_XSS(
+                    $_SESSION['gradebook_dest']
+                ).'?selectcat='.$my_selectcat,
+            'name' => get_lang('Gradebook'),
+        );
+        Display:: display_header(get_lang('SearchResults'));
     } else {
-        $interbreadcrumb[] = array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat=1', 'name' => get_lang('Gradebook'));
-        $interbreadcrumb[] = array ('url' => '#','name' => get_lang('EditAllWeights'));
-        Display :: display_header('');
+        $interbreadcrumb[] = array(
+            'url' => Security::remove_XSS(
+                    $_SESSION['gradebook_dest']
+                ).'?selectcat=1',
+            'name' => get_lang('Gradebook'),
+        );
+        $interbreadcrumb[] = array(
+            'url' => '#',
+            'name' => get_lang('EditAllWeights'),
+        );
+        Display:: display_header('');
     }
 }
 
 ?>
     <div class="actions">
-        <a href="<?php echo Security::remove_XSS($_SESSION['gradebook_dest']).'?'.$my_api_cidreq ?>&selectcat=<?php echo $my_selectcat ?>">
-            <?php echo Display::return_icon('back.png',get_lang('FolderView'),'',ICON_SIZE_MEDIUM); ?>
+        <a href="<?php echo Security::remove_XSS(
+                $_SESSION['gradebook_dest']
+            ).'?'.$my_api_cidreq ?>&selectcat=<?php echo $my_selectcat ?>">
+            <?php echo Display::return_icon(
+                'back.png',
+                get_lang('FolderView'),
+                '',
+                ICON_SIZE_MEDIUM
+            ); ?>
         </a>
     </div>
 <?php
@@ -212,25 +281,26 @@ $formNormal = new FormValidator('normal_weight', 'post', $currentUrl);
 $formNormal->addHeader(get_lang('EditWeight'));
 $formNormal->display();
 
-//$warning_message = sprintf(get_lang('TotalWeightMustBeX'), $masked_total);
 $warning_message = sprintf(get_lang('TotalWeightMustBeX'), $original_total);
 Display::display_warning_message($warning_message, false);
 
 ?>
-<form method="post" action="gradebook_edit_all.php?<?php echo $my_api_cidreq ?>&selectcat=<?php echo $my_selectcat?>">
-    <table class="data_table">
-        <tr class="row_odd">
-            <th style="width: 35px;"><?php echo get_lang('Type'); ?></th>
-            <th><?php echo get_lang('Resource'); ?></th>
-            <th><?php echo get_lang('Weight'); ?></th>
-        </tr>
-        <?php echo $output; ?>
-    </table>
-    <input type="hidden" name="submitted" value="1" />
-    <br />
-    <button class="btn btn-primary" type="submit" name="name" value="<?php echo get_lang('Save') ?>">
-        <?php echo get_lang('SaveScoringRules') ?>
-    </button>
-</form>
+    <form method="post"
+          action="gradebook_edit_all.php?<?php echo $my_api_cidreq ?>&selectcat=<?php echo $my_selectcat ?>">
+        <table class="data_table">
+            <tr class="row_odd">
+                <th style="width: 35px;"><?php echo get_lang('Type'); ?></th>
+                <th><?php echo get_lang('Resource'); ?></th>
+                <th><?php echo get_lang('Weight'); ?></th>
+            </tr>
+            <?php echo $output; ?>
+        </table>
+        <input type="hidden" name="submitted" value="1"/>
+        <br/>
+        <button class="btn btn-primary" type="submit" name="name"
+                value="<?php echo get_lang('Save') ?>">
+            <?php echo get_lang('SaveScoringRules') ?>
+        </button>
+    </form>
 <?php
-Display :: display_footer();
+Display:: display_footer();

+ 2 - 2
main/inc/ajax/admin.ajax.php

@@ -50,9 +50,9 @@ switch ($action) {
             $url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $urlInfo['url']));
             $cleanUrl = str_replace('/', '-', $url);
 
-            $newUrlDir = api_get_path(SYS_PATH) . "home/$cleanUrl/admin/";
+            $newUrlDir = api_get_path(SYS_APP_PATH) . "home/$cleanUrl/admin/";
         } else {
-            $newUrlDir = api_get_path(SYS_PATH) . "home/admin/";
+            $newUrlDir = api_get_path(SYS_APP_PATH) . "home/admin/";
         }
 
         if (!file_exists($newUrlDir)) {

+ 11 - 6
main/inc/ajax/user_manager.ajax.php

@@ -11,14 +11,13 @@ switch ($action) {
         $user_info = api_get_user_info($_REQUEST['user_id']);
         $ajax_url = api_get_path(WEB_AJAX_PATH).'message.ajax.php';
 
-        echo '<div class="well">';
         echo '<div class="row">';
-        echo '<div class="span2">';
+        echo '<div class="col-sm-5">';
         echo '<div class="thumbnail">';
         echo '<img src="'.$user_info['avatar'].'" /> ';
         echo '</div>';
         echo '</div>';
-        echo '<div class="span3">';
+        echo '<div class="col-sm-7">';
         if (api_get_setting('show_email_addresses') == 'false') {
             $user_info['mail'] = ' ';
         } else {
@@ -55,9 +54,15 @@ switch ($action) {
                 'block'
             );
 
-            echo '<a class="btn btn-primary" id="send_message_link">'.
-                get_lang('Send').
-                '</a>';
+            echo '
+                <div class="row">
+                    <div class="col-sm-10 col-sm-offset-2">
+                        <a class="btn btn-primary" id="send_message_link">
+                            <i class="fa fa-envelope"></i> ' . get_lang('Send') . '
+                        </a>
+                    </div>
+                </div>
+            ';
         }
         break;
     case 'user_id_exists':

+ 5 - 0
main/inc/lib/GamificationUtils.php

@@ -40,6 +40,7 @@ class GamificationUtils
      * Get the achieved points for an user in a session
      * @param int $sessionId The session ID
      * @param int $userId The user ID
+     *
      * @return int The count of points
      */
     public static function getSessionPoints($sessionId, $userId)
@@ -89,6 +90,7 @@ class GamificationUtils
      * Get the calculated progress for an user in a session
      * @param int $sessionId The session ID
      * @param int $userId The user ID
+     *
      * @return float The progress
      */
     public static function getSessionProgress($sessionId, $userId)
@@ -124,6 +126,7 @@ class GamificationUtils
      * Get the number of stars achieved for an user in a session
      * @param int $sessionId The session ID
      * @param int $userId The user ID
+     *
      * @return int The number of stars
      */
     public static function getSessionStars($sessionId, $userId)
@@ -173,6 +176,7 @@ class GamificationUtils
      * Get the stars on sessions with gamification mode
      * @param int $userId The user ID
      * @param int $userStatus The user Status
+     *
      * @return int
      */
     public static function getTotalUserStars($userId, $userStatus)
@@ -199,6 +203,7 @@ class GamificationUtils
      * Get the total progress on sessions with gamification mode
      * @param int $userId The user ID
      * @param int $userStatus The user Status
+     *
      * @return float
      */
     public static function getTotalUserProgress($userId, $userStatus)

+ 0 - 215
main/inc/lib/access.class.php

@@ -1,215 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-/**
- * Definition of the Access class
- * @package chamilo.library
- */
-/**
- * Authorize or deny calls. 
- * 
- * 
- * Note:
- * 
- * This class stores locally the security token so that the current call
- * can still be validated after generating the new token.
- * 
- * The new security token is generated only on first call. Successive calls
- * return the same token. This ensure that different parts of the application
- * (form, javascript for javascript, etc) can get access to the same token.
- * 
- * @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Geneva
- */
-abstract class Access
-{
-
-    const SEC_TOKEN = 'sec_token';
-    
-    /**
-     * Return view and edit access.
-     * 
-     * @return  \Access
-     * @assert () !== null
-     */
-    public static function all()
-    {
-        return AccessAll::instance();
-    }
-
-    /**
-     * Return no access.
-     * 
-     * @return  \Access
-     * @assert () === null
-     */
-    public static function forbidden()
-    {
-        AccessForbidden::instance();
-    }
-
-    protected $session_token;
-    protected $token;
-
-    /**
-     * Returns true if security token is valid, false otherwise.
-     * 
-     * @return bool
-     * @assert () === false
-     */
-    public function is_token_valid()
-    {
-        $call_token = Request::get_security_token();
-        if (empty($call_token)) {
-            return false;
-        }
-        $session_token = $this->get_session_token();
-        return $session_token == $call_token;
-    }
-
-    /**
-     * Returns the token contained in the session. 
-     * Stores the token for further reuse so that it can be changed in session.
-     * 
-     * @return string
-     * @assert () !== null
-     */
-    public function get_session_token()
-    {
-        if (empty($this->session_token)) {
-            $key = self::SEC_TOKEN;
-            $this->session_token = isset($_SESSION[$key]) ? $_SESSION[$key] : '';
-        }
-        return $this->session_token;
-    }
-
-    /*
-     * On first call generate a new security token and save it in session.
-     * On successful calls returns the same (new) token (function is repeatable).
-     * If user do not have the right to edit, returns a blank (invalid) token.
-     * 
-     * Stores the existing session token before saving the new one so that 
-     * the current call can still be validated after calling this function.
-     * @assert () === ''
-     */
-
-    public function get_token()
-    {
-        if (!$this->can_edit()) {
-            return '';
-        }
-        if ($this->token) {
-            return $this->token;
-        }
-        $this->session_token = $this->get_session_token();
-
-
-        $this->token = \Security::get_token();
-    }
-
-    /**
-     * Returns true if the user has the right to edit.
-     * 
-     * @return boolean 
-     */
-    public abstract function can_edit();
-
-    /**
-     * Returns true if the current user has the right to view
-     * 
-     * @return boolean 
-     */
-    public abstract function can_view();
-
-    /**
-     * Returns whether this access is authorized or not. Synonym for can_view()
-     * @assert () === false
-     */
-    public function authorize()
-    {
-        return $this->can_view();
-    }
-
-}
-
-/**
- * Authorize access and view access. 
- */
-class AccessAll extends Access
-{
-
-    /**
-     * Return the instance.
-     * 
-     * @return  \Access
-     */
-    public static function instance()
-    {
-        static $result = null;
-        if (empty($result)) {
-            $result = new self();
-        }
-        return $result;
-    }
-
-    private function __construct()
-    {
-        
-    }
-
-    public function can_edit()
-    {
-        return true;
-    }
-
-    public function can_view()
-    {
-        return true;
-    }
-
-    public function authorize()
-    {
-        return true;
-    }
-
-}
-
-/**
- * Authorizev view access only 
- */
-class AccessForbidden extends Access
-{
-
-    /**
-     * Return the instance.
-     * 
-     * @return  \AccessView
-     */
-    public static function instance()
-    {
-        static $result = null;
-        if (empty($result)) {
-            $result = new self();
-        }
-        return $result;
-    }
-
-    private function __construct()
-    {
-        
-    }
-
-    public function can_edit()
-    {
-        return false;
-    }
-
-    public function can_view()
-    {
-        return false;
-    }
-
-    public function authorize()
-    {
-        return false;
-    }
-
-}

+ 0 - 198
main/inc/lib/access_token.class.php

@@ -1,198 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-/**
- * Definition of the AccessToken class
- * @package chamilo.library
- */
-/**
- * An access token. Can be passed between applications to grant access.
- * 
- * The token aggregate several values together (key id, api key, user id). This
- * is useful to pass a single value between application and avoid passing
- * each value as a separate parameter.
- * 
- * Note that values are aggregated but not crypted. An external application could
- * have access to individual components.
- * 
- * @see /main/auth/key_auth.class.php
- * @see table user_api_key
- * 
- * Usage:
- * 
- * Validate token:
- * 
- *      $data = Request::get('access_token');
- *      $token = AccessToken::parse($data); 
- *      $token->is_valid();
- * 
- * Pass token
- * 
- *      $token = new AccessToken(1, 1, '+*ç*%ç*ç');
- *      $url = '.....?access_token=' . $token;
- *
- * @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Geneva
- */
-class AccessToken
-{
-
-    /**
-     * Makes sure the static token exists and is a reference to an AccessToken
-     * object
-     * @assert () !== null
-     */
-    static function empty_token()
-    {
-        static $result = null;
-        if (empty($result)) {
-            $result = new self(0, 0, '');
-        }
-        return $result;
-    }
-
-    /**
-     * Parses a given string to find a token
-     * @param string A base64-encoded string
-     * @return AccessToken 
-     * @assert ('') !== null
-     * @assert (base64_encode('a/b')) !== null
-     * @assert (base64_encode('a/b/c')) !== null
-     */
-    static function parse($string)
-    {
-        if (empty($string)) {
-            return self::empty_token();
-        }
-
-        $data = base64_decode($string);
-        $data = explode('/', $data);
-
-        if (count($data) != 3) {
-            return self::empty_token();
-        }
-
-        $id = $data[0];
-        $user_id = $data[1];
-        $key = $data[2];
-        return new self($id, $user_id, $key);
-    }
-    
-    /**
-     * Creates a token based on an ID, an user ID and a key
-     * @param int       ID
-     * @param int       User id
-     * @param string    Key
-     * @return AccessToken
-     * @assert (0, 0, 'a') !== null
-     */
-    static function create($id, $user_id, $key)
-    {
-        $is_valid = !empty($id) && !empty($user_id) && !empty($key);
-        return $is_valid ? new self($id, $user_id, $key) : self::empty_token();
-    }
-
-    protected $id = 0;
-    protected $user_id = 0;
-    protected $key = '';
-
-    /**
-     * Constructor
-     * @param int       ID
-     * @param int       User ID
-     * @param string    Key
-     * @assert (1,1,1) === null
-     */
-    function __construct($id, $user_id, $key)
-    {
-        $this->id = $id;
-        $this->user_id = $user_id;
-        $this->key = $key;
-    }
-
-    /**
-     * The user_api_key id.
-     * @return int
-     * @assert () > 0
-     */
-    function get_id()
-    {
-        return $this->id;
-    }
-
-    /**
-     * User id
-     * @return string
-     * @assert () > 0
-     */
-    function get_user_id()
-    {
-        return $this->user_id;
-    }
-
-    /**
-     * User api key.
-     * @return string
-     * @assert () !== null
-     */
-    function get_key()
-    {
-        return $this->key;
-    }
-
-    /**
-     * True if the token is an empty token. I.e. a no access token.
-     * @return bool
-     * @assert () === true
-     */
-    function is_empty()
-    {
-        return empty($this->id) || empty($this->user_id) || empty($this->key);
-    }
-
-    /**
-     * Validate token against the database. Returns true if token is valid, 
-     * false otherwise.
-     * @return boolean 
-     * @assert () === false
-     */
-    function is_valid()
-    {
-        if ($this->is_empty()) {
-            return false;
-        }
-        $key = UserApiKeyManager::get_by_id($this->id);
-        if (empty($key)) {
-            return false;
-        }
-
-        if ($key['api_key'] != $this->key) {
-            return false;
-        }
-
-        if ($key['user_id'] != $this->user_id) {
-            return false;
-        }
-
-        $time = time();
-        $validity_start_date = $key['validity_start_date'] ? strtotime($key['validity_start_date']) : $time;
-        $validity_end_date = $key['validity_end_date'] ? strtotime($key['validity_end_date']) : $time + 100000;
-        return $validity_start_date <= $time && $time <= $validity_end_date;
-    }
-
-    /**
-     * Returns a string representation of the token that can be passed in a url or a form.
-     * The string representation can be parsed by calling AccessToken::parse();
-     * @return string
-     * @assert () !== null
-     */
-    function __toString()
-    {
-        $data[] = $this->id;
-        $data[] = $this->user_id;
-        $data[] = $this->key;
-
-        $result = implode('/', $data);
-        $result = base64_encode($result);
-        return $result;
-    }
-
-}

+ 1 - 1
main/inc/lib/agenda.lib.php

@@ -1573,7 +1573,7 @@ class Agenda
                     continue;
                 }
 
-                $eventsAdded[] = $row['unique_id'];
+                $eventsAdded[] = $event['unique_id'];
                 $attachment = $this->getAttachment($row['id'], $courseInfo);
 
                 if (!empty($attachment)) {

+ 1 - 1
main/inc/lib/api.lib.php

@@ -154,7 +154,7 @@ define('SECTION_COURSE_ADMIN', 'course_admin');
 define('SECTION_PLATFORM_ADMIN', 'platform_admin');
 define('SECTION_MYGRADEBOOK', 'mygradebook');
 define('SECTION_TRACKING', 'session_my_space');
-define('SECTION_SOCIAL', 'social');
+define('SECTION_SOCIAL', 'social-network');
 define('SECTION_DASHBOARD', 'dashboard');
 define('SECTION_REPORTS', 'reports');
 define('SECTION_GLOBAL', 'global');

+ 0 - 169
main/inc/lib/debug.lib.php

@@ -1,169 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-/**
-* This is the debug library for Chamilo.
-* Include/require it in your code to use its functionality.
-* @package chamilo.debug
-*/
-/**
-* This is the debug library for Chamilo.
-* Include/require it in your code to use its functionality.
-* @package chamilo.debug
-*/
-class Debug {
-	/**
-	 * This function displays the contend of a variable, array or object in a nicely formatted way.
-	 * @param	Mixed	A variable, array or object
-	 * @return 	void	Prints \<pre\> HTML block to output
-	 * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
-	 * @version November 2006
-	 */
-	public function printr($variable) {
-		echo '<pre>';
-		print_r($variable);
-		echo '</pre>';
-	}
-	
-	/**
-	 * This function displays all the information of the dokeos $_course array
-	 * This array stores all the information of the current course if the user is in a course.
-	 * This is why this array is used to check weither the user is currently is in the course.
-	 * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
-	 * @version November 2006
-	 */
-	public function course() {
-		global $_course;
-		self::printr($_course);
-	}
-	
-	/**
-	 * This function displays all the information of the dokeos $_user array
-	 * This array stores all the information of the current user.
-	 * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
-	 * @version November 2006
-	 */
-	public function user() {
-		global $_user;
-		self::printr($_user);
-	}
-	
-	/**
-	 * This function displays an overview of the different path constants that can be used with the api_get_path function
-	 * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
-	 * @version November 2006
-	 * @return	void
-	 */
-	public function debug_paths() {
-		echo 'WEB_PATH :'.api_get_path(WEB_PATH).'<br />';
-		echo 'SYS_PATH :'.api_get_path(SYS_PATH).'<br />';
-		echo 'REL_PATH :'.api_get_path(REL_PATH).'<br />';
-		echo 'WEB_COURSE_PATH :'.api_get_path(WEB_COURSE_PATH).'<br />';
-		echo 'SYS_COURSE_PATH :'.api_get_path(SYS_COURSE_PATH).'<br />';
-		echo 'REL_COURSE_PATH :'.api_get_path(REL_COURSE_PATH).'<br />';
-		echo 'REL_CLARO_PATH :'.api_get_path(REL_CODE_PATH).'<br />';
-		echo 'WEB_CODE_PATH :'.api_get_path(WEB_CODE_PATH).'<br />';
-		echo 'SYS_CODE_PATH :'.api_get_path(SYS_CODE_PATH).'<br />';
-		echo 'SYS_LANG_PATH :'.api_get_path(SYS_LANG_PATH).'<br />';
-		echo 'WEB_IMG_PATH :'.api_get_path(WEB_IMG_PATH).'<br />';
-		echo 'PLUGIN_PATH :'.api_get_path(PLUGIN_PATH).'<br />';
-		echo 'SYS_ARCHIVE_PATH :'.api_get_path(SYS_ARCHIVE_PATH).'<br />';
-		echo 'INCLUDE_PATH :'.api_get_path(INCLUDE_PATH).'<br />';
-		echo 'LIBRARY_PATH :'.api_get_path(LIBRARY_PATH).'<br />';
-		echo 'CONFIGURATION_PATH :'.api_get_path(CONFIGURATION_PATH).'<br />';
-	
-	}
-	
-	/**
-	 * Dump variable contents on screen in a nice format
-	 * @param	mixed	Variable to dump
-	 * @param	string	Variable name to print
-	 * @return void
-	 */
-	public function print_var($var, $varName = "@") {
-		GLOBAL $DEBUG;
-		if ($DEBUG)
-		{
-			echo "<blockquote>\n";
-			echo "<b>[$varName]</b>";
-			echo "<hr noshade size=\"1\" style=\"color:blue\">";
-			echo "<pre style=\"color:red\">\n";
-			var_dump($var);
-			echo "</pre>\n";
-			echo "<hr noshade size=\"1\" style=\"color:blue\">";
-			echo "</blockquote>\n";
-		}
-		else
-		{
-			echo "<!-- DEBUG is OFF -->";
-			echo "DEBUG is OFF";
-		}
-	}
-	
-	/**
-	 * Log the given string into the default log if mode confirms it
-	 * @param	string	String to be logged
-	 * @param	bool	Whether to force the log even in production mode or not
-	 * @return	bool	True on success, false on failure
-	 */
-	public function log_s($msg, $force_log = false) {
-		$server_type = api_get_setting('server_type');
-		if ($server_type == 'production' && !$force_log) {
-			//not logging in production mode
-			return false;
-		}
-		$backtrace = debug_backtrace(); // Retrieving information about the caller statement.
-		$backtrace_string = self::_get_backtrace_raw_string($backtrace);
-		return error_log($msg.$backtrace_string);
-	}
-	/**
-	 * Log the given variables' dump into the default log if mode confirms it
-	 * @param	string	String to be logged
-	 * @param	bool	Whether to force the log even in production mode or not
-	 * @return	bool	True on success, false on failure
-	 */
-	public function log_v($variable, $force_log = false) {
-		$server_type = api_get_setting('server_type');
-		if ($server_type == 'production' && !$force_log) {
-			//not logging in production mode
-			return null;
-		}
-		$backtrace = debug_backtrace(); // Retrieving information about the caller statement.
-		$backtrace_string = self::_get_backtrace_raw_string($backtrace);
-		return error_log(print_r($variable,1).$backtrace_string);
-	}
-	/**
-	 * Get a string formatted with all backtrace info
-	 * @param	array	Backtrace data
-	 * @return	string	Backtrace formatted string
-	 */
-	private function _get_backtrace_raw_string($backtrace=array()) {
-		$file = $line = $type = $function = $class = '';
-		if (isset($backtrace[0])) {
-			$caller = & $backtrace[0];
-		} else {
-			$caller = array();
-		}
-		if (isset($backtrace[1])) {
-			$owner = & $backtrace[1];
-		} else {
-			$owner = array();
-		}
-		$file = $caller['file'];
-		$line = $caller['line'];
-		$type = $owner['type'];
-		$function = $owner['function'];
-		$class = $owner['class'];
-		$info = ' CHAMILO LOG INFO :: FILE: ' . (empty($file) ? ' unknown ' : $file) . ' LINE: ' . (empty($line) ? ' unknown ' : $line).' ' ;
-		if (empty($type)) {
-			if (!empty($function)) {
-				$info .= 'FUNCTION: ' . $function;
-			}
-		} else {
-			if (!empty($class) && !empty($function)) {
-				$info .= 'CLASS: ' . $class;
-				$info .= 'METHOD: ' . $function;
-			}
-		}
-		return $info;
-	}
-}

+ 14 - 16
main/inc/lib/events_dispatcher.class.php

@@ -2,21 +2,21 @@
 include_once api_get_path(CONFIGURATION_PATH).'events.conf.php';
 
 /**
- * 
- * Entry point for every event in the application. 
+ *  Class EventsDispatcher
+ * Entry point for every event in the application.
  * Fires the functions linked to the events according to the event's conf.
  * Every function got its own filter, it's fired inside the functiones fired
  * by this class. The filter config is next to the event config, in conf/events.conf.php
- *  
+ *
  */
-class EventsDispatcher 
+class EventsDispatcher
 {
     public static function events($event_name, $event_data = array())
     {
         global $event_config;
         // get the config for the event passed in parameter ($event_name)
         // and execute every actions with the values
-        
+
         foreach ($event_config[$event_name]["actions"] as $func) {
             $execute = true;
             if (!function_exists($func)) // if the function doesn't exist, we log
@@ -24,26 +24,24 @@ class EventsDispatcher
                 error_log("EventsDispatcher warning : ".$func." does not exist.");
                 $execute = false;
             }
-            
+
             // check if the event's got a filter
-            if (function_exists($event_name."_".$func."_filter_func")) 
-            {
+            if (function_exists($event_name."_".$func."_filter_func")) {
                 $filter = $event_name."_".$func."_filter_func";
-                // if it does, we execute the filter (which changes the data 
+                // if it does, we execute the filter (which changes the data
                 // in-place and returns true on success or false on error)
                 $execute = $filter($event_data);
-            }
-            else // if there's no filter
-            {
+            } else {
+                // if there's no filter
                 error_log("EventsDispatcher warning : ".$event_name."_".$func."_filter_func does not exist.");
             }
 
-            if (!$execute) // if the filter says we cannot send the mail, we get out of here
-            {
+            if (!$execute) {
+                // if the filter says we cannot send the mail, we get out of here
                 return false;
             }
-            // finally, if the filter says yes (or the filter doesn't exist), 
-            // we execute the in-between function that will call the needed 
+            // finally, if the filter says yes (or the filter doesn't exist),
+            // we execute the in-between function that will call the needed
             // function
             $func($event_name, $event_data);
         }

+ 69 - 47
main/inc/lib/events_email.class.php

@@ -51,8 +51,7 @@ class EventsMail
 
         // Fill the array's cells with info regarding the user that fired the event
         // (for the keys in the template)
-        if ( isset($event_data["about_user"]) )
-        {
+        if (isset($event_data["about_user"])) {
             $about_user = api_get_user_info($event_data["about_user"]);
             $event_data["firstname"] = $about_user["firstname"];
             $event_data["lastname"] = $about_user["lastname"];
@@ -63,24 +62,27 @@ class EventsMail
         }
 
         // First, we send the mail to people we put in the $event_data["send_to"]
-        if ($event_data["send_to"] != null) // the users we precised need to receive the mail
-        {
-            foreach ($event_data["send_to"] as $id) // for every member put in the array
-            {
+        if ($event_data["send_to"] != null) {
+            // the users we precised need to receive the mail
+            foreach ($event_data["send_to"] as $id) {
+                // for every member put in the array
                 // get user's info (to know where to send)
                 $user_info = api_get_user_info($id);
 
                 // get the language the email will be in
-                if ($event_data["prior_lang"] != null) // if $lang is not null, we use that lang
-                {
+                if ($event_data["prior_lang"] != null) {
+                    // if $lang is not null, we use that lang
                     $language = $event_data["prior_lang"];
-                }
-                else  // else we use the user's language
-                {
-                    $sql = 'SELECT language FROM ' . Database::get_main_table(TABLE_MAIN_USER) . ' u
-                    WHERE u.user_id = "' . $id . '"
+                } else {
+                    // else we use the user's language
+                    $sql = 'SELECT language
+                            FROM '.Database::get_main_table(TABLE_MAIN_USER).' u
+                            WHERE u.user_id = "'.$id.'"
                     ';
-                    $language = Database::store_result(Database::query($sql), 'ASSOC');
+                    $language = Database::store_result(
+                        Database::query($sql),
+                        'ASSOC'
+                    );
                     $language = $language[0]["language"];
                 }
 
@@ -99,18 +101,32 @@ class EventsMail
                 // checks if there's a file we need to join to the mail
                 if (isset($values["certificate_pdf_file"])) {
                     $message = str_replace("\n", "<br />", $message);
-                    api_mail_html($recipient_name, $user_info["mail"], $subject, $message, $sender_name, $email_admin, null, array($values['certificate_pdf_file']));
+                    api_mail_html(
+                        $recipient_name,
+                        $user_info["mail"],
+                        $subject,
+                        $message,
+                        $sender_name,
+                        $email_admin,
+                        null,
+                        array($values['certificate_pdf_file'])
+                    );
                 } else {
-                    api_mail_html($recipient_name, $user_info["mail"], $subject, $message, $sender_name, $email_admin);
+                    api_mail_html(
+                        $recipient_name,
+                        $user_info["mail"],
+                        $subject,
+                        $message,
+                        $sender_name,
+                        $email_admin
+                    );
                 }
 
                 // If the mail only need to be send once (we know that thanks to the events.conf), we log it in the table
-                if ($event_config[$event_name]["sending_mail_once"])
-                {
-                    $sql = 'INSERT INTO ' . Database::get_main_table(TABLE_EVENT_SENT) . '
-                        (user_from, user_to, event_type_name)
-                        VALUES ('.$event_data["user_id"].', '.$id.' ,"'.Database::escape_string($event_name).'");
-                        ';
+                if ($event_config[$event_name]["sending_mail_once"]) {
+                    $sql = 'INSERT INTO ' . Database::get_main_table(TABLE_EVENT_SENT) . ' (user_from, user_to, event_type_name)
+                            VALUES ('.$event_data["user_id"].', '.$id.' ,"'.Database::escape_string($event_name).'")
+                    ';
                     Database::query($sql);
                 }
             }
@@ -118,20 +134,19 @@ class EventsMail
 
         // Second, we send to people linked to the event
         // So, we get everyone
-        $sql = 'SELECT u.user_id, u.language, u.email, u.firstname, u.lastname FROM ' . Database::get_main_table(TABLE_EVENT_TYPE_REL_USER) . ' ue
+        $sql = 'SELECT u.user_id, u.language, u.email, u.firstname, u.lastname
+                FROM ' . Database::get_main_table(TABLE_EVENT_TYPE_REL_USER) . ' ue
                 INNER JOIN '.Database::get_main_table(TABLE_MAIN_USER).' u ON u.user_id = ue.user_id
                 WHERE event_type_name = "' . $event_name . '"';
         $result = Database::store_result(Database::query($sql), 'ASSOC');
-
-        foreach ($result as $key => $value) // for each of the linked users
-        {
+        // for each of the linked users
+        foreach ($result as $key => $value) {
             // we get the language
-            if ($event_data["prior_lang"] != null) // if $lang is not null, we use that lang
-            {
+            if ($event_data["prior_lang"] != null) {
+                // if $lang is not null, we use that lang
                 $language = $event_data["prior_lang"];
-            }
-            else // else we get the user's lang
-            {
+            } else {
+                // else we get the user's lang
                 $sql = 'SELECT language FROM '.Database::get_main_table(TABLE_MAIN_USER).'
                     where user_id = '.$value["user_id"].' ';
                 $result = Database::store_result(Database::query($sql), 'ASSOC');
@@ -151,11 +166,17 @@ class EventsMail
             // we send the mail
             $recipient_name = api_get_person_name($value['firstname'], $value['lastname']);
 
-            api_mail_html($recipient_name, $value["email"], $subject, $message, $sender_name, $email_admin);
+            api_mail_html(
+                $recipient_name,
+                $value["email"],
+                $subject,
+                $message,
+                $sender_name,
+                $email_admin
+            );
 
             // If the mail only need to be send once (we know that thanks to the events.conf, we log it in the table
-            if ($event_config[$event_name]["sending_mail_once"])
-            {
+            if ($event_config[$event_name]["sending_mail_once"]) {
                 $sql = 'INSERT INTO ' . Database::get_main_table(TABLE_EVENT_SENT) . '
                     (user_from, user_to, event_type_name)
                     VALUES ('.$event_data["user_id"].', '.$value["user_id"].' , "'.Database::escape_string($event_name).'");
@@ -206,10 +227,14 @@ class EventsMail
      */
     private static function getMessage($event_name, $language)
     {
-        $sql = 'SELECT message, subject, l.dokeos_folder FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE) . ' em
+        $sql = 'SELECT message, subject, l.dokeos_folder
+                FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE) . ' em
                 INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE) . ' l
                 ON em.language_id = l.id
-                WHERE em.event_type_name = "' . $event_name . '" and (l.dokeos_folder = "' . $language . '" OR l.dokeos_folder = "english") and em.message <> ""
+                WHERE
+                    em.event_type_name = "' . $event_name . '" AND
+                    (l.dokeos_folder = "' . $language . '" OR l.dokeos_folder = "english") AND
+                    em.message <> ""
                 ';
         return Database::store_result(Database::query($sql), 'ASSOC');
     }
@@ -224,18 +249,16 @@ class EventsMail
      */
     private static function getCorrectMessage(&$message, &$subject, $language, $result)
     {
-        foreach ($result as $msg)
-        {
-            if ($msg["dokeos_folder"] == $language)
-            {
+        foreach ($result as $msg) {
+            if ($msg["dokeos_folder"] == $language) {
                 $message = $msg["message"];
                 $subject = $msg["subject"];
                 break;
-            }
-            else if ($msg["dokeos_folder"] == "english")
-            {
-                $message = $msg["message"];
-                $subject = $msg["subject"];
+            } else {
+                if ($msg["dokeos_folder"] == "english") {
+                    $message = $msg["message"];
+                    $subject = $msg["subject"];
+                }
             }
         }
     }
@@ -250,8 +273,7 @@ class EventsMail
      */
     private static function formatMessage(&$message, &$subject, $event_config, $event_name, &$event_data)
     {
-        foreach ($event_config[$event_name]["available_keyvars"] as $key => $word)
-        {
+        foreach ($event_config[$event_name]["available_keyvars"] as $key => $word) {
             $message = str_replace('((' . $key . '))', $event_data[$word], $message);
             $subject = str_replace('((' . $key . '))', $event_data[$word], $subject);
         }

+ 170 - 150
main/inc/lib/extra_field_value.lib.php

@@ -79,11 +79,14 @@ class ExtraFieldValue extends Model
     {
         foreach ($params as $key => $value) {
             $found = strpos($key, '__persist__');
-            if ($found) {
-                $tempKey = str_replace('__persist__', '', $key);
-                if (!isset($params[$tempKey])) {
-                    $params[$tempKey] = array();
-                }
+
+            if ($found === FALSE) {
+                continue;
+            }
+
+            $tempKey = str_replace('__persist__', '', $key);
+            if (!isset($params[$tempKey])) {
+                $params[$tempKey] = array();
             }
         }
 
@@ -94,169 +97,186 @@ class ExtraFieldValue extends Model
         $type = $this->getExtraField()->getExtraFieldType();
         // Parse params.
         foreach ($params as $key => $value) {
-            if (substr($key, 0, 6) == 'extra_' ||
-                substr($key, 0, 7) == '_extra_'
+            if (
+                substr($key, 0, 6) != 'extra_' &&
+                substr($key, 0, 7) != '_extra_'
             ) {
-                // An extra field.
-                $field_variable = substr($key, 6);
-                $extraFieldInfo = $this->getExtraField()->get_handler_field_info_by_field_variable($field_variable);
-
-                if ($extraFieldInfo) {
-                    $commentVariable = 'extra_'.$field_variable.'_comment';
-                    $comment = isset($params[$commentVariable]) ? $params[$commentVariable] : null;
-
-                    switch ($extraFieldInfo['field_type']) {
-
-                        case ExtraField::FIELD_TYPE_TAG:
-                            if ($type == EntityExtraField::USER_FIELD_TYPE) {
-
-                                UserManager::delete_user_tags(
-                                    $params['item_id'],
-                                    $extraFieldInfo['id']
-                                );
-
-                                UserManager::process_tags(
-                                    $value,
-                                    $params['item_id'],
-                                    $extraFieldInfo['id']
-                                );
-                            } else {
-                                $em = Database::getManager();
-                                
-                                $currentTags = $em
-                                    ->getRepository('ChamiloCoreBundle:ExtraFieldRelTag')
-                                    ->findBy([
-                                        'fieldId' => $extraFieldInfo['id'],
-                                        'itemId' => $params['item_id']
-                                    ]);
-
-                                foreach ($currentTags as $extraFieldtag) {
-                                    $em->remove($extraFieldtag);
-                                }
+                continue;
+            }
 
-                                $tagValues = is_array($value) ? $value : [$value];
-                                $tags = [];
-
-                                foreach ($tagValues as $tagValue) {
-                                    $tagsResult = $em->getRepository('ChamiloCoreBundle:Tag')->findBy([
-                                        'tag' => $tagValue,
-                                        'fieldId' => $extraFieldInfo['id']
-                                    ]);
-
-                                    if (empty($tagsResult)) {
-                                        $tag = new \Chamilo\CoreBundle\Entity\Tag();
-                                        $tag->setCount(0);
-                                        $tag->setFieldId($extraFieldInfo['id']);
-                                        $tag->setTag($tagValue);
-
-                                        $tags[] = $tag;
-                                    } else {
-                                        $tags = array_merge($tags, $tagsResult);
-                                    }
-                                }
+            // An extra field.
+            $field_variable = substr($key, 6);
+            $extraFieldInfo = $this->getExtraField()->get_handler_field_info_by_field_variable($field_variable);
 
-                                foreach ($tags as $tag) {
-                                    $tag->setCount($tag->getCount() + 1);
-                                    $em->persist($tag);
+            if (!$extraFieldInfo) {
+                continue;
+            }
 
-                                    $fieldRelTag = new Chamilo\CoreBundle\Entity\ExtraFieldRelTag();
-                                    $fieldRelTag->setFieldId($extraFieldInfo['id']);
-                                    $fieldRelTag->setItemId($params['item_id']);
-                                    $fieldRelTag->setTagId($tag->getId());
+            $commentVariable = 'extra_'.$field_variable.'_comment';
+            $comment = isset($params[$commentVariable]) ? $params[$commentVariable] : null;
 
-                                    $em->persist($fieldRelTag);
-                                }
+            switch ($extraFieldInfo['field_type']) {
+                case ExtraField::FIELD_TYPE_TAG:
+                    if ($type == EntityExtraField::USER_FIELD_TYPE) {
+                        UserManager::delete_user_tags(
+                            $params['item_id'],
+                            $extraFieldInfo['id']
+                        );
+
+                        UserManager::process_tags(
+                            $value,
+                            $params['item_id'],
+                            $extraFieldInfo['id']
+                        );
+                        break;
+                    }
 
-                                $em->flush();
-                            }
-                            break;
-                        case ExtraField::FIELD_TYPE_FILE_IMAGE:
-                            $dirPermissions = api_get_permissions_for_new_directories();
-                            switch ($this->type) {
-                                case 'course':
-                                    $fileDir = api_get_path(SYS_UPLOAD_PATH)."courses/";
-                                    $fileDirStored = "courses/";
-                                    break;
-                                case 'session':
-                                    $fileDir = api_get_path(SYS_UPLOAD_PATH)."sessions/";
-                                    $fileDirStored = "sessions/";
-                                    break;
-                                case 'user':
-                                    $fileDir = UserManager::getUserPathById($params['item_id'], 'system');
-                                    $fileDirStored = UserManager::getUserPathById($params['item_id'], 'last');
-                                    break;
-                            }
+                    $em = Database::getManager();
 
-                            $fileName = ExtraField::FIELD_TYPE_FILE_IMAGE . "_{$params['item_id']}.png";
+                    $currentTags = $em
+                        ->getRepository('ChamiloCoreBundle:ExtraFieldRelTag')
+                        ->findBy([
+                            'fieldId' => $extraFieldInfo['id'],
+                            'itemId' => $params['item_id']
+                        ]);
 
-                            if (!file_exists($fileDir)) {
-                                mkdir($fileDir, $dirPermissions, true);
-                            }
+                    foreach ($currentTags as $extraFieldtag) {
+                        $em->remove($extraFieldtag);
+                    }
 
-                            if ($value['error'] == 0) {
-                                $imageExtraField = new Image($value['tmp_name']);
-                                $imageExtraField->send_image($fileDir . $fileName, -1, 'png');
-                                $newParams = array(
-                                    'item_id' => $params['item_id'],
-                                    'field_id' => $extraFieldInfo['id'],
-                                    'value' => $fileDirStored . $fileName,
-                                    'comment' => $comment
-                                );
-
-                                self::save($newParams);
-                            }
-                            break;
-                        case ExtraField::FIELD_TYPE_FILE:
-                            $dirPermissions = api_get_permissions_for_new_directories();
+                    $em->flush();
 
-                            switch ($this->type) {
-                                case 'course':
-                                    $fileDir = api_get_path(SYS_UPLOAD_PATH)."courses/";
-                                    $fileDirStored = "courses/";
-                                    break;
-                                case 'session':
-                                    $fileDir = api_get_path(SYS_UPLOAD_PATH)."sessions/";
-                                    $fileDirStored = "sessions/";
-                                    break;
-                                case 'user':
-                                    $fileDir = UserManager::getUserPathById($params['item_id'], 'system');
-                                    $fileDirStored = UserManager::getUserPathById($params['item_id'], 'last');
-                                    break;
-                            }
+                    $tagValues = is_array($value) ? $value : [$value];
+                    $tags = [];
 
-                            $cleanedName = api_replace_dangerous_char($value['name']);
-                            $fileName = ExtraField::FIELD_TYPE_FILE . "_{$params['item_id']}_$cleanedName";
-                            if (!file_exists($fileDir)) {
-                                mkdir($fileDir, $dirPermissions, true);
-                            }
+                    foreach ($tagValues as $tagValue) {
+                        $tagsResult = $em
+                            ->getRepository('ChamiloCoreBundle:Tag')
+                            ->findBy([
+                                'tag' => $tagValue,
+                                'fieldId' => $extraFieldInfo['id']
+                            ]);
 
-                            if ($value['error'] == 0) {
-                                moveUploadedFile($value, $fileDir . $fileName);
+                        if (empty($tagsResult)) {
+                            $tag = new \Chamilo\CoreBundle\Entity\Tag();
+                            $tag->setFieldId($extraFieldInfo['id']);
+                            $tag->setTag($tagValue);
 
-                                $new_params = array(
-                                    'item_id' => $params['item_id'],
-                                    'field_id' => $extraFieldInfo['id'],
-                                    'value' => $fileDirStored . $fileName
-                                );
+                            $tags[] = $tag;
+                        } else {
+                            $tags = array_merge($tags, $tagsResult);
+                        }
+                    }
 
-                                if ($this->type !== 'session' && $this->type !== 'course') {
-                                    $new_params['comment'] = $comment;
-                                }
+                    foreach ($tags as $tag) {
+                        $tagUses = $em
+                            ->getRepository('ChamiloCoreBundle:ExtraFieldRelTag')
+                            ->findBy([
+                                'tagId' => $tag->getId()
+                            ]);
 
-                                self::save($new_params);
-                            }
+                        $tag->setCount(count($tagUses) + 1);
+                        $em->persist($tag);    
+                    }
+
+                    $em->flush();
+
+                    foreach ($tags as $tag) {
+                        $fieldRelTag = new Chamilo\CoreBundle\Entity\ExtraFieldRelTag();
+                        $fieldRelTag->setFieldId($extraFieldInfo['id']);
+                        $fieldRelTag->setItemId($params['item_id']);
+                        $fieldRelTag->setTagId($tag->getId());
+
+                        $em->persist($fieldRelTag);
+                    }
+
+                    $em->flush();
+                    break;
+                case ExtraField::FIELD_TYPE_FILE_IMAGE:
+                    $dirPermissions = api_get_permissions_for_new_directories();
+                    switch ($this->type) {
+                        case 'course':
+                            $fileDir = api_get_path(SYS_UPLOAD_PATH)."courses/";
+                            $fileDirStored = "courses/";
                             break;
-                        default:
-                            $newParams = array(
-                                'item_id' => $params['item_id'],
-                                'field_id' => $extraFieldInfo['id'],
-                                'value' => $value,
-                                'comment' => $comment
-                            );
+                        case 'session':
+                            $fileDir = api_get_path(SYS_UPLOAD_PATH)."sessions/";
+                            $fileDirStored = "sessions/";
+                            break;
+                        case 'user':
+                            $fileDir = UserManager::getUserPathById($params['item_id'], 'system');
+                            $fileDirStored = UserManager::getUserPathById($params['item_id'], 'last');
+                            break;
+                    }
 
-                            self::save($newParams);
+                    $fileName = ExtraField::FIELD_TYPE_FILE_IMAGE . "_{$params['item_id']}.png";
+
+                    if (!file_exists($fileDir)) {
+                        mkdir($fileDir, $dirPermissions, true);
                     }
-                }
+
+                    if ($value['error'] == 0) {
+                        $imageExtraField = new Image($value['tmp_name']);
+                        $imageExtraField->send_image($fileDir . $fileName, -1, 'png');
+                        $newParams = array(
+                            'item_id' => $params['item_id'],
+                            'field_id' => $extraFieldInfo['id'],
+                            'value' => $fileDirStored . $fileName,
+                            'comment' => $comment
+                        );
+
+                        self::save($newParams);
+                    }
+                    break;
+                case ExtraField::FIELD_TYPE_FILE:
+                    $dirPermissions = api_get_permissions_for_new_directories();
+
+                    switch ($this->type) {
+                        case 'course':
+                            $fileDir = api_get_path(SYS_UPLOAD_PATH)."courses/";
+                            $fileDirStored = "courses/";
+                            break;
+                        case 'session':
+                            $fileDir = api_get_path(SYS_UPLOAD_PATH)."sessions/";
+                            $fileDirStored = "sessions/";
+                            break;
+                        case 'user':
+                            $fileDir = UserManager::getUserPathById($params['item_id'], 'system');
+                            $fileDirStored = UserManager::getUserPathById($params['item_id'], 'last');
+                            break;
+                    }
+
+                    $cleanedName = api_replace_dangerous_char($value['name']);
+                    $fileName = ExtraField::FIELD_TYPE_FILE . "_{$params['item_id']}_$cleanedName";
+                    if (!file_exists($fileDir)) {
+                        mkdir($fileDir, $dirPermissions, true);
+                    }
+
+                    if ($value['error'] == 0) {
+                        moveUploadedFile($value, $fileDir . $fileName);
+
+                        $new_params = array(
+                            'item_id' => $params['item_id'],
+                            'field_id' => $extraFieldInfo['id'],
+                            'value' => $fileDirStored . $fileName
+                        );
+
+                        if ($this->type !== 'session' && $this->type !== 'course') {
+                            $new_params['comment'] = $comment;
+                        }
+
+                        self::save($new_params);
+                    }
+                    break;
+                default:
+                    $newParams = array(
+                        'item_id' => $params['item_id'],
+                        'field_id' => $extraFieldInfo['id'],
+                        'value' => $value,
+                        'comment' => $comment
+                    );
+
+                    self::save($newParams);
             }
         }
     }

+ 0 - 223
main/inc/lib/log.class.php

@@ -1,223 +0,0 @@
-<?php
-
-use Monolog\Logger;
-
-/**
- * Since static constructors do not exist in php the line below serves as a
- * substitute.
- *
- * Log is used by install which do not use autoload at the moment. If it becomes
- * the case then the line below may/should be moved to the main autoloading
- * function.
- */
-Log::register_autoload();
-
-/**
- * Provides access to the main log - i.e. stderr - and allows to register events.
- * It is a facade to the monolog library:
- *
- * Log::error('message');
- * Log::warning('message');
- * ...
- *
- *
- * Note:
- * This class uses a static approach which has the benefit of being simpler but do
- * no allow as much freedom as using an object approche. Another approach could be
- *
- * Chamilo::log()->error('message');
- * Chamilo::log()->warning('message');
- *
- * To somewhat alleviate this issue the user can register a different logger if hew
- * wants.
- *
- * @license see /license.txt
- * @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Geneva
- */
-class Log
-{
-
-    public static function register_autoload()
-    {
-        static $has_run = false;
-        if ($has_run) {
-            return true;
-        }
-
-        /*$directory = api_get_path(LIBRARY_PATH) . 'symfony';
-        if (!class_exists('Doctrine\Common\ClassLoader', false)) {
-            require_once $directory . '/Doctrine/Common/ClassLoader.php';
-        }
-
-        $loader = new Doctrine\Common\ClassLoader('Monolog', $directory);
-        $loader->register();*/
-
-        $has_run = true;
-    }
-
-    /**
-     *
-     * @return \Monolog\Logger
-     */
-    public static function default_logger()
-    {
-        $name = 'chamilo';
-        $result = new Logger($name);
-        $handler = new Monolog\Handler\StreamHandler('php://stderr');
-        $handler->setFormatter(new Monolog\Formatter\LineFormatter('[%datetime%] [%level_name%] [%channel%] %message%' . PHP_EOL, 'Y-m-d H:i:s')); //%context% %extra%
-        $result->pushHandler($handler);
-        return $result;
-    }
-
-    private static $logger = null;
-
-    /**
-     *
-     * @return \Monolog\Logger
-     */
-    public static function logger()
-    {
-        if (empty(self::$logger)) {
-            self::$logger = self::default_logger();
-        }
-        return self::$logger;
-    }
-
-    public static function set_logger($value)
-    {
-        self::$logger = $value;
-    }
-
-    /**
-     * Returns the
-     * @param type $index
-     * @return type
-     */
-    public static function frame($index)
-    {
-        $result = debug_backtrace();
-        return isset($result[$index]) ? $result[$index] : array();
-    }
-
-    public static function write($level, $message, $context = array())
-    {
-        /*
-         * Note that the same could be done with a monolog processor.
-         */
-        if (!isset($context['file'])) {
-            $trace = debug_backtrace();
-            $trace = $trace[1];
-            $context['file'] = $trace['file'];
-            $context['line'] = $trace['line'];
-        }
-        $file = $context['file'];
-        $root = realpath(api_get_path(SYS_PATH));
-        $file = str_replace($root, '', $file);
-        $file = trim($file, DIRECTORY_SEPARATOR);
-        $line = $context['line'];
-        $line = str_pad($line, 4, ' ', STR_PAD_LEFT);
-        $message = "[$file:$line] " . $message;
-
-        self::logger()->addRecord($level, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the DEBUG level.
-     *
-     * This method allows to have an easy ZF compatibility.
-     *
-     * @param string $message The log message
-     * @param array $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public static function debug($message, array $context = array())
-    {
-        return self::write(Logger::DEBUG, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the INFO level.
-     *
-     * This method allows to have an easy ZF compatibility.
-     *
-     * @param string $message The log message
-     * @param array $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public static function info($message, array $context = array())
-    {
-//        return self::write(Logger::INFO, self::message($message), $context);
-        return self::write(Logger::INFO, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the INFO level.
-     *
-     * This method allows to have an easy ZF compatibility.
-     *
-     * @param string $message The log message
-     * @param array $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public static function notice($message, array $context = array())
-    {
-        return self::write(Logger::INFO, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the WARNING level.
-     *
-     * This method allows to have an easy ZF compatibility.
-     *
-     * @param string $message The log message
-     * @param array $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public static function warning($message, array $context = array())
-    {
-        return self::write(Logger::WARNING, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the ERROR level.
-     *
-     * This method allows to have an easy ZF compatibility.
-     *
-     * @param string $message The log message
-     * @param array $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public static function error($message, array $context = array())
-    {
-        return self::write(Logger::ERROR, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the CRITICAL level.
-     *
-     * This method allows to have an easy ZF compatibility.
-     *
-     * @param string $message The log message
-     * @param array $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public static function crit($message, array $context = array())
-    {
-        return self::write(Logger::CRITICAL, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the ALERT level.
-     *
-     * This method allows to have an easy ZF compatibility.
-     *
-     * @param string $message The log message
-     * @param array $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public static function alert($message, array $context = array())
-    {
-        return self::write(Logger::ALERT, $message, $context);
-    }
-
-}

+ 23 - 2
main/inc/lib/social.lib.php

@@ -756,8 +756,29 @@ class SocialManager extends UserManager
 
             // My friend profile.
             if ($user_id != api_get_user_id()) {
-                $html .= '<li><a href="#" class="btn-to-send-message" data-send-to="' . $user_id . '" title="'.get_lang('SendMessage').'">';
-                $html .= Display::return_icon('compose_message.png', get_lang('SendMessage')).'&nbsp;&nbsp;'.get_lang('SendMessage').'</a></li>';
+                $sendMessageText = get_lang('SendMessage');
+                $sendMessageIcon = Display::return_icon(
+                    'compose_message.png',
+                    $sendMessageText
+                );
+                $sendMesssageUrl = api_get_path(WEB_AJAX_PATH)
+                    . 'user_manager.ajax.php?'
+                    . http_build_query([
+                        'a' => 'get_user_popup',
+                        'user_id' => $user_id
+                    ]);
+
+                $html .= '<li>';
+                $html .= Display::url(
+                    "$sendMessageIcon $sendMessageText",
+                    $sendMesssageUrl,
+                    [
+                        'class' => 'ajax',
+                        'title' => $sendMessageText,
+                        'data-title' => $sendMessageText
+                    ]
+                );
+                $html .= '</li>';
             }
 
             // Check if I already sent an invitation message

+ 1 - 0
main/inc/lib/system/session.class.php

@@ -1,4 +1,5 @@
 <?php
+/* For licensing terms, see /license.txt */
 
 namespace System;
 

+ 2 - 0
main/inc/lib/system/web/header.class.php

@@ -1,10 +1,12 @@
 <?php
+/* For licensing terms, see /license.txt */
 
 /**
  * Header utility functions.
  *
  * @license see /license.txt
  * @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Geneva
+ * @deprecated
  */
 class Header
 {

+ 1 - 0
main/inc/lib/system/web/request.class.php

@@ -4,6 +4,7 @@
  * Provides access to various HTTP request elements: GET, POST, FILE, etc paramaters.
 
  * @license see /license.txt
+ * @deprecated
  * @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Geneva
  */
 class Request

+ 1 - 1
main/install/data.sql

@@ -135,7 +135,7 @@ VALUES
 ('extendedprofile_registrationrequired', 'mydiplomas', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyDiplomas', 0),
 ('extendedprofile_registrationrequired', 'myteach', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyTeach', 0),
 ('extendedprofile_registrationrequired', 'mypersonalopenarea', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyPersonalOpenArea', 0),
-('registration','phone','textfield','User','false','RegistrationRequiredFormsTitle','RegistrationRequiredFormsComment',NULL,'Phone', 0),
+('registration','phone','checkbox','User','false','RegistrationRequiredFormsTitle','RegistrationRequiredFormsComment',NULL,'Phone', 0),
 ('add_users_by_coach',NULL,'radio','Session','false','AddUsersByCoachTitle','AddUsersByCoachComment',NULL,NULL, 0),
 ('extend_rights_for_coach',NULL,'radio','Security','false','ExtendRightsForCoachTitle','ExtendRightsForCoachComment',NULL,NULL, 0),
 ('extend_rights_for_coach_on_survey',NULL,'radio','Security','true','ExtendRightsForCoachOnSurveyTitle','ExtendRightsForCoachOnSurveyComment',NULL,NULL, 0),

+ 1 - 1
main/install/index.php

@@ -690,7 +690,7 @@ if (@$_POST['step2']) {
         $perm = api_get_permissions_for_new_directories();
         $perm_file = api_get_permissions_for_new_files();
 
-        Log::notice('Starting migration process from '.$my_old_version.' ('.time().')');
+        error_log('Starting migration process from '.$my_old_version.' ('.time().')');
 
         switch ($my_old_version) {
             case '1.9.0':

+ 2 - 2
main/install/install.lib.php

@@ -2039,8 +2039,8 @@ function fixIds(EntityManager $em)
     $result = $connection->fetchAll($sql);
     foreach ($result as $item) {
         $courseId = $item['c_id'];
-        $iid = isset($item['iid']) ? $item['iid'] : 0;
-        $ref = isset($item['ref']) ? $item['ref'] : 0;
+        $iid = isset($item['iid']) ? intval($item['iid']) : 0;
+        $ref = isset($item['ref']) ? intval($item['ref']) : 0;
         $sql = null;
 
         $newId = '';

+ 1 - 1
main/install/update-configuration.inc.php

@@ -10,7 +10,7 @@
  */
 if (defined('SYSTEM_INSTALLATION')) {
 
-    Log::notice("Starting " . basename(__FILE__));
+    error_log("Starting " . basename(__FILE__));
     $perm = api_get_permissions_for_new_files();
 
     $oldConfFile = api_get_path(SYS_CODE_PATH) . 'inc/conf/configuration.php';

+ 1 - 1
main/install/update-files-1.9.0-1.10.0.inc.php

@@ -13,7 +13,7 @@ use Symfony\Component\Finder\Finder;
  * current configuration file.
  * @package chamilo.install
  */
-Log::notice('Entering file');
+error_log('Entering file');
 
 if (defined('SYSTEM_INSTALLATION')) {
     // Changes for 1.10.x

+ 12 - 49
main/newscorm/learnpath.class.php

@@ -381,7 +381,7 @@ class learnpath
 
                             if ($this->debug > 2) {
                                 error_log(
-                                    'New LP - learnpath::__construct() '.__LINE__.' - Inserting blank item_view : '.$sql_ins,
+                                    'New LP - learnpath::__construct() '.__LINE__.' - Inserting blank item_view : '.$sql,
                                     0
                                 );
                             }
@@ -732,8 +732,9 @@ class learnpath
         // Session id.
         $session_id = api_get_session_id();
 
-        $check_name = "SELECT * FROM $tbl_lp WHERE c_id = $course_id AND name = '$name'";
-        //if ($this->debug > 2) { error_log('New LP - Checking the name for new LP: '.$check_name, 0); }
+        $check_name = "SELECT * FROM $tbl_lp
+                       WHERE c_id = $course_id AND name = '$name'";
+
         $res_name = Database::query($check_name);
 
         if ($publicated_on == '0000-00-00 00:00:00' || empty($publicated_on)) {
@@ -834,18 +835,6 @@ class learnpath
         }
     }
 
-    /**
-     * Appends a message to the message attribute
-     * @param	string	$string Message to append.
-     */
-    public function append_message($string)
-    {
-        if ($this->debug > 0) {
-            error_log('New LP - In learnpath::append_message()', 0);
-        }
-        $this->message .= $string;
-    }
-
     /**
      * Auto completes the parents of an item in case it's been completed or passed
      * @param	integer	$item Optional ID of the item from which to look for parents
@@ -969,17 +958,6 @@ class learnpath
         // TODO: Add save operations for the learnpath itself.
     }
 
-    /**
-     * Clears the message attribute
-     */
-    public function clear_message()
-    {
-        if ($this->debug > 0) {
-            error_log('New LP - In learnpath::clear_message()', 0);
-        }
-        $this->message = '';
-    }
-
     /**
      * Closes the current resource
      *
@@ -990,7 +968,6 @@ class learnpath
      */
     public function close()
     {
-        $course_id = api_get_course_int_id();
         if ($this->debug > 0) {
             error_log('New LP - In learnpath::close()', 0);
         }
@@ -1031,7 +1008,8 @@ class learnpath
 
         // Delete lp item id.
         foreach ($this->items as $id => $dummy) {
-            $sql = "DELETE FROM $lp_item_view WHERE c_id = $course_id AND lp_item_id = '" . $id . "'";
+            $sql = "DELETE FROM $lp_item_view
+                    WHERE c_id = $course_id AND lp_item_id = '" . $id . "'";
             Database::query($sql);
         }
 
@@ -3260,18 +3238,6 @@ class learnpath
         }
     }
 
-    /**
-     * Gets the user-friendly message stored in $this->message
-     * @return	string	Message
-     */
-    public function get_message()
-    {
-        if ($this->debug > 0) {
-            error_log('New LP - In learnpath::get_message()', 0);
-        }
-        return $this->message;
-    }
-
     /**
      * Gets the learnpath name/title
      * @return	string	Learnpath name/title
@@ -4292,7 +4258,6 @@ class learnpath
             $res = $this->items[$this->current]->save(false, $this->prerequisites_match($this->current));
             $this->autocomplete_parents($this->current);
             $status = $this->items[$this->current]->get_status();
-            $this->append_message('new_item_status: ' . $status);
             $this->update_queue[$this->current] = $status;
             return $res;
         }
@@ -5145,7 +5110,8 @@ class learnpath
             error_log('New LP - In learnpath::update_reinit()', 0);
         }
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
-        $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = " . $this->get_id();
+        $sql = "SELECT * FROM $lp_table
+                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
         $res = Database::query($sql);
         if (Database :: num_rows($res) > 0) {
             $row = Database :: fetch_array($res);
@@ -5438,9 +5404,6 @@ class learnpath
      */
     public function overview()
     {
-        $is_allowed_to_edit = api_is_allowed_to_edit(null,true);
-        $_course = api_get_course_info();
-
         if ($this->debug > 0) {
             error_log('New LP - In learnpath::overview()', 0);
         }
@@ -5886,7 +5849,8 @@ class learnpath
     {
         $course_id = api_get_course_int_id();
         global $charset;
-        $dir = isset ($_GET['dir']) ? $_GET['dir'] : $_POST['dir']; // Please, do not modify this dirname formatting.
+        $dir = isset ($_GET['dir']) ? $_GET['dir'] : $_POST['dir'];
+        // Please, do not modify this dirname formatting.
         if (strstr($dir, '..'))
             $dir = '/';
         if ($dir[0] == '.')
@@ -8141,7 +8105,8 @@ class learnpath
             $return .= 'child_value[0][' . $i++ . '] = "' . $row_zero['id'] . '";' . "\n";
         }
         $return .= "\n";
-        $sql = "SELECT * FROM " . $tbl_lp_item . " WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
+        $sql = "SELECT * FROM " . $tbl_lp_item . "
+                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
         $res = Database::query($sql);
         while ($row = Database :: fetch_array($res)) {
             $sql_parent = "SELECT * FROM " . $tbl_lp_item . "
@@ -8173,8 +8138,6 @@ class learnpath
     public function display_move_item($item_id)
     {
         $course_id = api_get_course_int_id();
-        $_course = api_get_course_info();
-        global $charset;
         $return = '';
 
         if (is_numeric($item_id)) {

+ 1 - 2
main/newscorm/lp_admin_view.php

@@ -294,8 +294,7 @@ switch ($_GET['action']) {
         }
         break;
 }
-if(!empty($_GET['updateaudio']))
-{
+if (!empty($_GET['updateaudio'])) {
     // list of items to add audio files
     echo $_SESSION['oLP']->overview();
 }

+ 0 - 108
main/newscorm/lp_ajax_last_update_status.php

@@ -1,108 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-/**
- * This script contains the server part of the xajax interaction process. The
- * client part is located in lp_api.php or other api's.
- * This script exists exclusively to comply with the SCORM 1.2 rules notes that
- * say that if the SCO doesn't give a status throughout its execution, then the
- * status should be automatically set to 'completed', then the score should be
- * evaluated against mastery_score and, if a raw score and mastery_score value
- * are set, assign the final status based on that.
- * As such, this script will:
- * 1 - check the current status for the given element is still 'not attempted'
- * 2 - check if there is a mastery score
- * 3 - check if there is a raw score
- * 4 - if 2 or 3 are false, change the status to 'completed', else compare
- * whether the raw score is higher than the mastery score. If not, the status
- * will be set to 'failed', if yes, the status will be set to 'passed'
- * 5 - update the status in the table of contents
- * @package chamilo.learnpath
- * @author Yannick Warnier <yannick.warnier@beeznest.com>
- */
-/**
- * Code
- */
-// Flag to allow for anonymous user - needs to be set before global.inc.php'
-$use_anonymous = true;
-require_once '../inc/global.inc.php';
-
-/**
- * Writes an item's new values into the database and returns the operation result
- * @param   integer Learnpath ID
- * @param   integer User ID
- * @param   integer View ID
- * @param   integer Item ID
- * @return  string  JavaScript operations to execute as soon as returned
- */
-function last_update_status($lp_id, $user_id, $view_id, $item_id) {
-    error_log(__LINE__);
-    global $_configuration;
-    $debug = 0;
-    $return = '';
-    if ($debug > 0) { error_log('In last_update_status('.$lp_id.','.$user_id.','.$view_id.','.$item_id.')', 0); }
-    $mylp = learnpath::getLpFromSession(api_get_course_id(), $lp_id, $user_id);
-
-    // This function should only be used for SCORM paths.
-    if ($mylp->get_type() != 2) {
-        return;
-    }
-    $prereq_check = $mylp->prerequisites_match($item_id);
-    $mystatus = '';
-    if ($prereq_check === true) {
-        error_log(__LINE__);
-        // Launch the prerequisites check and set error if needed.
-        $mylpi =& $mylp->items[$item_id];
-
-        $mystatus_in_db = $mylpi->get_status(true);
-        error_log($mystatus_in_db);
-        if ($mystatus_in_db == 'not attempted' or $mystatus_in_db == '') {
-        error_log(__LINE__);
-            $mystatus = 'completed';
-            $mastery_score = $mylpi->get_mastery_score();
-            if ($mastery_score != -1) {
-        error_log(__LINE__);
-                $score = $mylpi->get_score();
-                if ($score != 0 && $score >= $mastery_score) {
-        error_log(__LINE__);
-                    $mystatus = 'passed';
-                } else {
-        error_log(__LINE__);
-                    $mystatus = 'failed';
-                }
-            }
-            error_log(__LINE__);
-            $mylpi->set_status($mystatus);
-            $mylp->save_item($item_id, false);
-        } else {
-            error_log(__LINE__);
-            return $return;
-        }
-    } else {
-        error_log(__LINE__);
-        return $return;
-    }
-    error_log(__LINE__);
-    $mytotal = $mylp->get_total_items_count_without_chapters();
-    $mycomplete = $mylp->get_complete_items_count();
-    $myprogress_mode = $mylp->get_progress_bar_mode();
-    $myprogress_mode = ($myprogress_mode==''?'%':$myprogress_mode);
-    $return .= "update_toc('".$mystatus."','".$item_id."','no');";
-    error_log('Return is now '.$return);
-    $update_list = $mylp->get_update_queue();
-    foreach ($update_list as $my_upd_id => $my_upd_status) {
-        if ($my_upd_id != $item_id) { // Only update the status from other items (i.e. parents and brothers), do not update current as we just did it already.
-            $return .= "update_toc('".$my_upd_status."','".$my_upd_id."','no');";
-        }
-    }
-    $return .= "update_progress_bar('$mycomplete','$mytotal','$myprogress_mode');";
-    $return .="update_stats();";
-    return $return;
-    //return $objResponse;
-}
-error_log(__LINE__);
-echo last_update_status(
-            $_REQUEST['lid'],
-            $_REQUEST['uid'],
-            $_REQUEST['vid'],
-            $_REQUEST['iid']);

+ 0 - 1
main/newscorm/lp_controller.php

@@ -345,7 +345,6 @@ $is_allowed_to_edit = api_is_allowed_to_edit(false, true, false, false);
 
 if (isset($_SESSION['oLP'])) {
     $_SESSION['oLP']->update_queue = array(); // Reinitialises array used by javascript to update items in the TOC.
-    $_SESSION['oLP']->message = ''; // Should use ->clear_message() method but doesn't work.
 }
 
 if (isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'true') {

+ 20 - 9
main/newscorm/lp_impress.php

@@ -19,12 +19,21 @@ api_protect_course_script();
 $lp_id = intval($_GET['lp_id']);
 
 // Check if the learning path is visible for student - (LP requisites)
-if (!api_is_allowed_to_edit(null, true) && !learnpath::is_lp_visible_for_student($lp_id, api_get_user_id())) {
+if (!api_is_allowed_to_edit(null, true) &&
+    !learnpath::is_lp_visible_for_student($lp_id, api_get_user_id())
+) {
     api_not_allowed();
 }
 
 //Checking visibility (eye icon)
-$visibility = api_get_item_visibility(api_get_course_info(), TOOL_LEARNPATH, $lp_id, $action, api_get_user_id(), api_get_session_id());
+$visibility = api_get_item_visibility(
+    api_get_course_info(),
+    TOOL_LEARNPATH,
+    $lp_id,
+    $action,
+    api_get_user_id(),
+    api_get_session_id()
+);
 if (!api_is_allowed_to_edit(null, true) && intval($visibility) == 0 ) {
      api_not_allowed();
 }
@@ -47,8 +56,14 @@ $is_allowed_to_edit = api_is_allowed_to_edit(null, true, false, false);
 if ($is_allowed_to_edit) {
     echo '<div style="position: fixed; top: 0px; left: 0px; pointer-events: auto;width:100%">';
     global $interbreadcrumb;
-    $interbreadcrumb[] = array('url' => 'lp_controller.php?action=list&isStudentView=false', 'name' => get_lang('LearningPaths'));
-    $interbreadcrumb[] = array('url' => api_get_self()."?action=add_item&type=step&lp_id=".$_SESSION['oLP']->lp_id."&isStudentView=false", 'name' => $_SESSION['oLP']->get_name());
+    $interbreadcrumb[] = array(
+        'url' => 'lp_controller.php?action=list&isStudentView=false',
+        'name' => get_lang('LearningPaths'),
+    );
+    $interbreadcrumb[] = array(
+        'url' => api_get_self()."?action=add_item&type=step&lp_id=".$_SESSION['oLP']->lp_id."&isStudentView=false",
+        'name' => $_SESSION['oLP']->get_name(),
+    );
     $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Preview'));
     echo return_breadcrumb($interbreadcrumb, null, null);
     echo '</div>';
@@ -58,10 +73,6 @@ $html = '';
 $step = 1;
 foreach ($list as $toc) {
     $x = 1000*$step;
-    //data-scale="'.$step.'"
-    //data-x="850" data-y="3000" data-rotate="90" data-scale="5"
-
-
     $html .= '<div id="step-'.$step.'" class="step slide" data-x="'.$x.'" data-y="-1500"  >';
     $html .= '<div class="impress-content">';
     $src = $_SESSION['oLP']->get_link('http', $toc['id']);
@@ -84,4 +95,4 @@ $tpl = new Template($tool_name, false, false, true);
 $tpl->assign('html', $html);
 $content = $tpl->fetch('default/learnpath/impress.tpl');
 $tpl->assign('content', $content);
-$tpl->display_one_col_template();
+$tpl->display_one_col_template();

+ 15 - 7
main/newscorm/lp_list_search.php

@@ -6,12 +6,10 @@
  * @package chamilo.learnpath
  * @author Diego Escalante Urrelo <diegoe@gmail.com>
  * @author Marco Antonio Villegas Vega <marvil07@gmail.com>
- * @author Julio Montoya <gugli100@gmail.com> Lots of bug fixing
+ * @author Julio Montoya <gugli100@gmail.com> bug fixing
  *
  */
-/**
- * Code
- */
+
 require api_get_path(LIBRARY_PATH).'search/search_widget.php';
 require api_get_path(LIBRARY_PATH).'search/ChamiloQuery.php';
 require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php';
@@ -82,7 +80,8 @@ foreach ($specific_fields as $specific_field) {
         $sf_terms_for_code = xapian_get_all_terms(1000, $specific_field['code']);
         foreach ($sf_terms_for_code as $term) {
             if (!empty($term)) {
-                $term_array[] = chamilo_get_boolean_query($term['name']); // Here name includes prefix.
+                // Here name includes prefix.
+                $term_array[] = chamilo_get_boolean_query($term['name']);
             }
         }
     }
@@ -100,7 +99,11 @@ if (count($term_array)) {
     $fixed_queries = chamilo_join_queries($term_array, null, $op);
 
     if ($course_filter != null) {
-        $fixed_queries = chamilo_join_queries($fixed_queries, $course_filter, 'and');
+        $fixed_queries = chamilo_join_queries(
+            $fixed_queries,
+            $course_filter,
+            'and'
+        );
     }
 } else {
     if (!empty($query)) {
@@ -108,7 +111,12 @@ if (count($term_array)) {
     }
 }
 
-list($count, $results) = chamilo_query_query(api_convert_encoding($query, 'UTF-8', $charset), 0, 1000, $fixed_queries);
+list($count, $results) = chamilo_query_query(
+    api_convert_encoding($query, 'UTF-8', $charset),
+    0,
+    1000,
+    $fixed_queries
+);
 
 // Prepare blocks to show.
 $blocks = array();

+ 0 - 1
main/newscorm/lp_save.php

@@ -14,7 +14,6 @@
 /**
  * Switching within the field to update
  */
-$msg = $_SESSION['oLP']->get_message();
 
 error_log('New LP - Loaded lp_save : '.$_SERVER['REQUEST_URI'].' from '.$_SERVER['HTTP_REFERER'], 0);
 ?>

+ 36 - 32
main/newscorm/resourcelinker.inc.php

@@ -9,10 +9,6 @@
  *	@todo use the constants for the tools
  *	@todo use Database API instead of creating table names locally.
  */
-/**
- * Code
- */
-/* INIT SECTION */
 
 // Flag to allow for anonymous user - needs to be set before global.inc.php.
 
@@ -176,7 +172,6 @@ function show_documents($folder) {
  */
 function file_or_folder($filefolder) {
     global $_course;
-    global $baseServDir;
     $courseDir   = $_course['path'].'/document';
     $baseWorkDir = api_get_path(SYS_COURSE_PATH).$courseDir;
     return (is_dir($baseWorkDir.$filefolder) ? 1 : 0);
@@ -188,8 +183,8 @@ function file_or_folder($filefolder) {
  * @param $source_type
  * @param $source_id
  */
-function store_resources($source_type, $source_id) {
-    global $_course;
+function store_resources($source_type, $source_id)
+{
     $resource_table = Database::get_course_table(TABLE_LINKED_RESOURCES);
     $course_id = api_get_course_int_id();
 
@@ -218,8 +213,8 @@ function store_resources($source_type, $source_id) {
  * @param $style this is used to style the link (for instance when a resource is hidden => the added resources should also be styled like they are hidden)
  * @todo use the constants for the type definitions.
  */
-function display_addedresource_link($type, $id, $style = '') {
-    global $_course;
+function display_addedresource_link($type, $id, $style = '')
+{
     $course_id = api_get_course_int_id();
 
     // Styling the link of the added resource.
@@ -329,8 +324,8 @@ function display_addedresource_link($type, $id, $style = '') {
  * @todo this function is too long, rewrite
  */
 function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_path, $builder, $icon, $level = 0) {
-    global $_course, $learnpath_id, $tbl_learnpath_item, $items;
-    global $curDirPath, $_configuration, $enableDocumentParsing, $_course, $_user, $_cid;
+    global $learnpath_id, $items;
+    global $enableDocumentParsing, $_course, $_user, $_cid;
 
     $course_id = api_get_course_int_id();
 
@@ -1042,9 +1037,10 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
  * @param id          - that is the correspondent id in the mirror tool (like Agenda item 2)
  * @param id_in_path  - the unique index in the items table
  */
-function get_addedresource_link_in_learnpath($type, $id, $id_in_path) {
-    global $_course, $learnpath_id, $tbl_learnpath_item, $items;
-    global $curDirPath, $_configuration, $enableDocumentParsing, $_user, $_cid;
+function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
+{
+    global $_course, $learnpath_id;
+    global $enableDocumentParsing, $_user, $_cid;
 
     $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
     $course_id = api_get_course_int_id();
@@ -1320,11 +1316,12 @@ function delete_one_added_resource($source_type, $source_id, $resource_type, $re
 /**
  * This function is to delete the resources that were added to a specific item
  */
-function delete_added_resource($type, $id) {
-    global $_course;
+function delete_added_resource($type, $id)
+{
     $course_id = api_get_course_int_id();
     $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES);
-    $sql = "DELETE FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' and source_id='$id'";
+    $sql = "DELETE FROM $TABLERESOURCE
+            WHERE c_id = $course_id AND source_type='$type' and source_id='$id'";
     Database::query($sql);
 }
 
@@ -1332,8 +1329,8 @@ function delete_added_resource($type, $id) {
  * This function is te delete all resources of a specific type (only used in announcements -- delete all)
  * Author : Frederik Vermeire <frederik.vermeire@pandora.be>
  */
-function delete_all_resources_type($type) {
-  global $_course;
+function delete_all_resources_type($type)
+{
   $course_id = api_get_course_int_id();
   $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES);
   $sql = "DELETE FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type'";
@@ -1344,10 +1341,10 @@ function delete_all_resources_type($type) {
  * This function checks wether there are added resources or not
  */
 function check_added_resources($type, $id) {
-    global $_course, $origin;
     $course_id = api_get_course_int_id();
     $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES);
-    $sql = "SELECT * FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' and source_id='$id'";
+    $sql = "SELECT * FROM $TABLERESOURCE
+            WHERE c_id = $course_id AND source_type='$type' and source_id='$id'";
     $result = Database::query($sql);
     $number_added = Database::num_rows($result);
     if ($number_added != 0)
@@ -1360,20 +1357,21 @@ function check_added_resources($type, $id) {
  * this function is to load the resources that were added to a specific item
  * into the session variables
  */
-function edit_added_resources($type, $id) {
-    global $_course;
+function edit_added_resources($type, $id)
+{
     $course_id = api_get_course_int_id();
     $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES);
 
-    $sql="SELECT * FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' and source_id=$id";
+    $sql = "SELECT * FROM $TABLERESOURCE
+            WHERE c_id = $course_id AND source_type='$type' and source_id=$id";
     $result=Database::query($sql);
     while ($row=Database::fetch_array($result))
     {
         $addedresource[]=$row["resource_type"];
         $addedresourceid[]=$row["resource_id"];
     }
-    $_SESSION['addedresource']=$addedresource;
-    $_SESSION['addedresourceid']=$addedresourceid;
+    $_SESSION['addedresource'] = $addedresource;
+    $_SESSION['addedresourceid'] = $addedresourceid;
 }
 
 /**
@@ -1381,12 +1379,13 @@ function edit_added_resources($type, $id) {
  * first we delete all the added resources in the database,
  * then we add all the resources from the session object.
  */
-function update_added_resources($type, $id) {
-    global $_course;
+function update_added_resources($type, $id)
+{
     $course_id = api_get_course_int_id();
     $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES);
     // delete all the added resources for this item in the database;
-    $sql="DELETE FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' AND source_id='$id'";
+    $sql = "DELETE FROM $TABLERESOURCE
+            WHERE c_id = $course_id AND source_type='$type' AND source_id='$id'";
     //echo $sql;
     Database::query($sql);
 
@@ -1403,9 +1402,14 @@ function update_added_resources($type, $id) {
 function display_added_resources($type, $id, $style = '') {
     $course_id = api_get_course_int_id();
     // The array containing the icons
-    $arr_icons = array('Agenda'=>'../img/agenda.gif', 'Ad Valvas'=>'../img/valves.gif', 'Link'=>'../img/links.gif', 'Exercise'=>'../img/quiz.gif' );
-
-    global $_course, $origin;
+    $arr_icons = array(
+        'Agenda' => '../img/agenda.gif',
+        'Ad Valvas' => '../img/valves.gif',
+        'Link' => '../img/links.gif',
+        'Exercise' => '../img/quiz.gif',
+    );
+
+    global $origin;
     $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES);
 
     $sql = "SELECT * FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' and source_id='$id'";

+ 228 - 227
main/newscorm/storageapi.php

@@ -6,102 +6,104 @@
 require_once('../inc/global.inc.php');
 
 // variable cleaning...
-foreach (Array("svkey", "svvalue") as $key)
-	$_REQUEST[$key] = Database::escape_string($_REQUEST[$key]);
+foreach (array("svkey", "svvalue") as $key) {
+    $_REQUEST[$key] = Database::escape_string($_REQUEST[$key]);
+}
 
-foreach (Array("svuser", "svcourse", "svsco", "svlength", "svasc") as $key)
-	$_REQUEST[$key] = intval($_REQUEST[$key]);
+foreach (array("svuser", "svcourse", "svsco", "svlength", "svasc") as $key) {
+    $_REQUEST[$key] = intval($_REQUEST[$key]);
+}
 
 switch ($_REQUEST['action']) {
-	case "get":
-		print storage_get($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
-		break;
-	case "set":
-		if (storage_can_set($_REQUEST['svuser'])) {
-			print storage_set($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svvalue']);
-		}
-		break;
-	case "getall":
-		print storage_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco']);
-		break;
-	case "stackpush":
-		if (storage_can_set($_REQUEST['svuser'])) {
-			print storage_stack_push($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svvalue']);
-		}
-		break;
-	case "stackpop":
-		if (storage_can_set($_REQUEST['svuser'])) {
-			print storage_stack_pop($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
-		}
-		break;
-	case "stacklength":
-		print storage_stack_length($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
-		break;
-	case "stackclear":
-		if (storage_can_set($_REQUEST['svuser'])) {
-			print storage_stack_clear($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
-		}
-		break;
-	case "stackgetall":
-		if (storage_can_set($_REQUEST['svuser']))
-			print storage_stack_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
-		break;
-	case "getposition":
-		print storage_get_position($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc']);
-		break;
-	case "getleaders":
-		print storage_get_leaders($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc'], $_REQUEST['svlength']);
-		break;
-	case "usersgetall":
+    case "get":
+        print storage_get($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
+        break;
+    case "set":
+        if (storage_can_set($_REQUEST['svuser'])) {
+            print storage_set($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svvalue']);
+        }
+        break;
+    case "getall":
+        print storage_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco']);
+        break;
+    case "stackpush":
+        if (storage_can_set($_REQUEST['svuser'])) {
+            print storage_stack_push($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svvalue']);
+        }
+        break;
+    case "stackpop":
+        if (storage_can_set($_REQUEST['svuser'])) {
+            print storage_stack_pop($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
+        }
+        break;
+    case "stacklength":
+        print storage_stack_length($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
+        break;
+    case "stackclear":
+        if (storage_can_set($_REQUEST['svuser'])) {
+            print storage_stack_clear($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
+        }
+        break;
+    case "stackgetall":
+        if (storage_can_set($_REQUEST['svuser']))
+            print storage_stack_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
+        break;
+    case "getposition":
+        print storage_get_position($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc']);
+        break;
+    case "getleaders":
+        print storage_get_leaders($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc'], $_REQUEST['svlength']);
+        break;
+    case "usersgetall":
 // security issue
-		print "NOT allowed, security issue, see sources";
+        print "NOT allowed, security issue, see sources";
 //		print storage_get_all_users();
-		break;
-	default:
-		// Do nothing
+        break;
+    default:
+        // Do nothing
 }
 
 function storage_can_set($sv_user) {
-	// platform admin can change any user's stored values, other users can only change their own values
-	$allowed = ((api_is_platform_admin()) || ($sv_user == api_get_user_id()));
-	if (!$allowed) {
-		print "ERROR : Not allowed";
-	}
-	return $allowed;
+    // platform admin can change any user's stored values, other users can only change their own values
+    $allowed = ((api_is_platform_admin()) || ($sv_user == api_get_user_id()));
+    if (!$allowed) {
+        print "ERROR : Not allowed";
+    }
+    return $allowed;
 }
 
 function storage_get($sv_user, $sv_course, $sv_sco, $sv_key) {
-	$sql = "select sv_value
-		from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)."
-		where user_id= '$sv_user'
-		and sco_id = '$sv_sco'
-		and course_id = '$sv_course'
-		and sv_key = '$sv_key'";
-	$res = Database::query($sql);
-	if (Database::num_rows($res) > 0) {
-		$row = Database::fetch_assoc($res);
-		if (get_magic_quotes_gpc()) {
-			return stripslashes($row['sv_value']);
-		} else {
-			return $row['sv_value'];
-		}
-	}
-	else {
-		return null;
-	}
+    $sql = "select sv_value
+        from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)."
+        where user_id= '$sv_user'
+        and sco_id = '$sv_sco'
+        and course_id = '$sv_course'
+        and sv_key = '$sv_key'";
+    $res = Database::query($sql);
+    if (Database::num_rows($res) > 0) {
+        $row = Database::fetch_assoc($res);
+        if (get_magic_quotes_gpc()) {
+            return stripslashes($row['sv_value']);
+        } else {
+            return $row['sv_value'];
+        }
+    }
+    else {
+        return null;
+    }
 }
 
 function storage_get_leaders($sv_user, $sv_course, $sv_sco, $sv_key, $sv_asc, $sv_length) {
 
-	// get leaders
-	$sql_leaders = "select u.user_id, firstname, lastname, email, username, sv_value as value
-		from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)." sv,
-			".Database::get_main_table(TABLE_MAIN_USER)." u
-		where u.user_id=sv.user_id
-		and sco_id = '$sv_sco'
-		and course_id = '$sv_course'
-		and sv_key = '$sv_key'
-		order by sv_value ".($sv_asc ? "ASC": "DESC")." limit $sv_length";
+    // get leaders
+    $sql_leaders = "select u.user_id, firstname, lastname, email, username, sv_value as value
+        from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)." sv,
+            ".Database::get_main_table(TABLE_MAIN_USER)." u
+        where u.user_id=sv.user_id
+        and sco_id = '$sv_sco'
+        and course_id = '$sv_course'
+        and sv_key = '$sv_key'
+        order by sv_value ".($sv_asc ? "ASC": "DESC")." limit $sv_length";
 //	$sql_data = "select sv.user_id as user_id, sv_key as variable, sv_value as value
 //		from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)." sv
 //		where sv.user_id in (select u2.user_id from ($sql_leaders) u2)
@@ -112,181 +114,180 @@ function storage_get_leaders($sv_user, $sv_course, $sv_sco, $sv_key, $sv_asc, $s
 //	while($row = Database::fetch_assoc($resData))
 //		$data[] = $row; // fetching all data
 //
-	$resLeaders = Database::query($sql_leaders);
-	$result = array();
-	while ($row = Database::fetch_assoc($resLeaders)) {
-		$row["values"] = array();
+    $resLeaders = Database::query($sql_leaders);
+    $result = array();
+    while ($row = Database::fetch_assoc($resLeaders)) {
+        $row["values"] = array();
 //		foreach($data as $dataRow) {
 //			if ($dataRow["user_id"] = $row["user_id"])
 //				$row["values"][$dataRow["variable"]] = $dataRow["value"];
 //		}
-		$result[] = $row;
-	}
-	return json_encode($result);
+        $result[] = $row;
+    }
+    return json_encode($result);
 }
 
 function storage_get_position($sv_user, $sv_course, $sv_sco, $sv_key, $sv_asc, $sv_length) {
-	$sql = "select count(list.user_id) as position
-		from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)." search,
-			".Database::get_main_table(TABLE_TRACK_STORED_VALUES)." list
-		where search.user_id= '$sv_user'
-		and search.sco_id = '$sv_sco'
-		and search.course_id = '$sv_course'
-		and search.sv_key = '$sv_key'
-		and list.sv_value ".($sv_asc ? "<=": ">=")." search.sv_value
-		and list.sco_id = search.sco_id
-		and list.course_id = search.course_id
-		and list.sv_key = search.sv_key
-		order by list.sv_value" ;
-	$res = Database::query($sql);
-	if (Database::num_rows($res) > 0) {
-		$row = Database::fetch_assoc($res);
-		return $row['position'];
-	}
-	else {
-		return null;
-	}
+    $sql = "select count(list.user_id) as position
+        from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)." search,
+            ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)." list
+        where search.user_id= '$sv_user'
+        and search.sco_id = '$sv_sco'
+        and search.course_id = '$sv_course'
+        and search.sv_key = '$sv_key'
+        and list.sv_value ".($sv_asc ? "<=": ">=")." search.sv_value
+        and list.sco_id = search.sco_id
+        and list.course_id = search.course_id
+        and list.sv_key = search.sv_key
+        order by list.sv_value" ;
+    $res = Database::query($sql);
+    if (Database::num_rows($res) > 0) {
+        $row = Database::fetch_assoc($res);
+        return $row['position'];
+    }
+    else {
+        return null;
+    }
 }
 
 function storage_set($sv_user, $sv_course, $sv_sco, $sv_key, $sv_value) {
-	$sv_value = Database::escape_string($sv_value);
-	$sql = "replace into ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)."
-		(user_id, sco_id, course_id, sv_key, sv_value)
-		values
-		('$sv_user','$sv_sco','$sv_course','$sv_key','$sv_value')";
-	$res = Database::query($sql);
-	return Database::affected_rows($res);
+    $sv_value = Database::escape_string($sv_value);
+    $sql = "replace into ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)."
+        (user_id, sco_id, course_id, sv_key, sv_value)
+        values
+        ('$sv_user','$sv_sco','$sv_course','$sv_key','$sv_value')";
+    $res = Database::query($sql);
+    return Database::affected_rows($res);
 }
 
 function storage_getall($sv_user, $sv_course, $sv_sco) {
-	$sql = "select sv_key, sv_value
-		from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)."
-		where user_id= '$sv_user'
-		and sco_id = '$sv_sco'
-		and course_id = '$sv_course'";
-	$res = Database::query($sql);
-	$data = array();
-	while ($row = Database::fetch_assoc($res)) {
-		if (get_magic_quotes_gpc()) {
-			$row['sv_value'] = stripslashes($row['sv_value']);
-		}
-		$data[] = $row;
-	}
-	return json_encode($data);
+    $sql = "select sv_key, sv_value
+        from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)."
+        where user_id= '$sv_user'
+        and sco_id = '$sv_sco'
+        and course_id = '$sv_course'";
+    $res = Database::query($sql);
+    $data = array();
+    while ($row = Database::fetch_assoc($res)) {
+        if (get_magic_quotes_gpc()) {
+            $row['sv_value'] = stripslashes($row['sv_value']);
+        }
+        $data[] = $row;
+    }
+    return json_encode($data);
 }
 
 function storage_stack_push($sv_user, $sv_course, $sv_sco, $sv_key, $sv_value) {
-	$sv_value = Database::escape_string($sv_value);
-	Database::query("start transaction");
-	$sqlorder = "select ifnull((select max(stack_order)
-		from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)."
-		where user_id= '$sv_user'
-		and sco_id='$sv_sco'
-		and course_id='$sv_course'
-		and sv_key='$sv_key'
-		), 0) as stack_order";
-	$resorder = Database::query($sqlorder);
-	$row = Database::fetch_assoc($resorder);
-	$stack_order = (1 + $row['stack_order']);
-	$sqlinsert = "insert into ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)."
-		(user_id, sco_id, course_id, sv_key, stack_order, sv_value)
-		values
-		('$sv_user', '$sv_sco', '$sv_course', '$sv_key', '$stack_order', '$sv_value')";
-	$resinsert = Database::query($sqlinsert);
-	if ($resorder && $resinsert) {
-		Database::query("commit");
-		return 1;
-	}
-	else {
-		Database::query("rollback");
-		return 0;
-	}
+    $sv_value = Database::escape_string($sv_value);
+    Database::query("start transaction");
+    $sqlorder = "select ifnull((select max(stack_order)
+        from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)."
+        where user_id= '$sv_user'
+        and sco_id='$sv_sco'
+        and course_id='$sv_course'
+        and sv_key='$sv_key'
+        ), 0) as stack_order";
+    $resorder = Database::query($sqlorder);
+    $row = Database::fetch_assoc($resorder);
+    $stack_order = (1 + $row['stack_order']);
+    $sqlinsert = "insert into ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)."
+        (user_id, sco_id, course_id, sv_key, stack_order, sv_value)
+        values
+        ('$sv_user', '$sv_sco', '$sv_course', '$sv_key', '$stack_order', '$sv_value')";
+    $resinsert = Database::query($sqlinsert);
+    if ($resorder && $resinsert) {
+        Database::query("commit");
+        return 1;
+    }
+    else {
+        Database::query("rollback");
+        return 0;
+    }
 }
 
 function storage_stack_pop($sv_user, $sv_course, $sv_sco, $sv_key) {
-	Database::query("start transaction");
-	$sqlselect = "select sv_value, stack_order
-		from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)."
-		where user_id= '$sv_user'
-		and sco_id='$sv_sco'
-		and course_id='$sv_course'
-		and sv_key='$sv_key'
-		order by stack_order desc
-		limit 1";
-	$resselect = Database::query($sqlselect);
-	$rowselect = Database::fetch_assoc($resselect);
-	$stack_order = $rowselect['stack_order'];
-	$sqldelete = "delete
-		from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)."
-		where user_id= '$sv_user'
-		and sco_id='$sv_sco'
-		and course_id='$sv_course'
-		and sv_key='$sv_key'
-		and stack_order='$stack_order'";
-	$resdelete = Database::query($sqldelete);
-	if ($resselect && $resdelete) {
-		Database::query("commit");
-		if (get_magic_quotes_gpc()) {
-			return stripslashes($rowselect['sv_value']);
-		} else {
-			return $rowselect['sv_value'];
-		}
-	} else {
-		Database::query("rollback");
-		return null;
-	}
+    Database::query("start transaction");
+    $sqlselect = "select sv_value, stack_order
+        from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)."
+        where user_id= '$sv_user'
+        and sco_id='$sv_sco'
+        and course_id='$sv_course'
+        and sv_key='$sv_key'
+        order by stack_order desc
+        limit 1";
+    $resselect = Database::query($sqlselect);
+    $rowselect = Database::fetch_assoc($resselect);
+    $stack_order = $rowselect['stack_order'];
+    $sqldelete = "delete
+        from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)."
+        where user_id= '$sv_user'
+        and sco_id='$sv_sco'
+        and course_id='$sv_course'
+        and sv_key='$sv_key'
+        and stack_order='$stack_order'";
+    $resdelete = Database::query($sqldelete);
+    if ($resselect && $resdelete) {
+        Database::query("commit");
+        if (get_magic_quotes_gpc()) {
+            return stripslashes($rowselect['sv_value']);
+        } else {
+            return $rowselect['sv_value'];
+        }
+    } else {
+        Database::query("rollback");
+        return null;
+    }
 }
 
 function storage_stack_length($sv_user, $sv_course, $sv_sco, $sv_key) {
-	$sql = "select count(*) as length
-		from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)."
-		where user_id= '$sv_user'
-		and sco_id='$sv_sco'
-		and course_id='$sv_course'
-		and sv_key='$sv_key'";
-	$res = Database::query($sql);
-	$row = Database::fetch_assoc($res);
-	return $row['length'];
+    $sql = "select count(*) as length
+        from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)."
+        where user_id= '$sv_user'
+        and sco_id='$sv_sco'
+        and course_id='$sv_course'
+        and sv_key='$sv_key'";
+    $res = Database::query($sql);
+    $row = Database::fetch_assoc($res);
+    return $row['length'];
 }
 
 function storage_stack_clear($sv_user, $sv_course, $sv_sco, $sv_key) {
-	$sql = "delete
-		from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)."
-		where user_id= '$sv_user'
-		and sco_id='$sv_sco'
-		and course_id='$sv_course'
-		and sv_key='$sv_key'";
-	$res = Database::query($sql);
-	return Database::num_rows($res);
+    $sql = "delete
+        from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)."
+        where user_id= '$sv_user'
+        and sco_id='$sv_sco'
+        and course_id='$sv_course'
+        and sv_key='$sv_key'";
+    $res = Database::query($sql);
+    return Database::num_rows($res);
 }
 
 function storage_stack_getall($sv_user, $sv_course, $sv_sco, $sv_key) {
-	$sql = "select stack_order as stack_order, sv_value as value
-		from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)."
-		where user_id= '$sv_user'
-		and sco_id='$sv_sco'
-		and course_id='$sv_course'
-		and sv_key='$sv_key'";
-	$res = Database::query($sql);
-	$results = array();
-	while ($row = Database::fetch_assoc($res)) {
-		if (get_magic_quotes_gpc()) {
-			$row['value'] = stripslashes($row['value']);
-		}
-		$results[] = $row;
-	}
-	return json_encode($results);
+    $sql = "select stack_order as stack_order, sv_value as value
+        from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)."
+        where user_id= '$sv_user'
+        and sco_id='$sv_sco'
+        and course_id='$sv_course'
+        and sv_key='$sv_key'";
+    $res = Database::query($sql);
+    $results = array();
+    while ($row = Database::fetch_assoc($res)) {
+        if (get_magic_quotes_gpc()) {
+            $row['value'] = stripslashes($row['value']);
+        }
+        $results[] = $row;
+    }
+    return json_encode($results);
 }
 
 function storage_get_all_users() {
-	$sql = "select user_id, username, firstname, lastname
-		from ".Database::get_main_table(TABLE_MAIN_USER)."
-		order by user_id asc";
-	$res = Database::query($sql);
-	$results = array();
-	while ($row = Database::fetch_assoc($res)) {
-		$results[] = $row;
-	}
-	return json_encode($results);
+    $sql = "select user_id, username, firstname, lastname
+        from ".Database::get_main_table(TABLE_MAIN_USER)."
+        order by user_id asc";
+    $res = Database::query($sql);
+    $results = array();
+    while ($row = Database::fetch_assoc($res)) {
+        $results[] = $row;
+    }
+    return json_encode($results);
 }
-?>

+ 21 - 20
main/search/search_suggestions.php

@@ -1,27 +1,28 @@
 <?php
+/* For licensing terms, see /license.txt */
+
 /**
  * Suggest words to search
  * @package chamilo.search
  */
-/**
- * Code
- */
+
 require_once dirname(__FILE__) . '/../inc/global.inc.php';
 
-function get_suggestions_from_search_engine($q) {
+function get_suggestions_from_search_engine($q)
+{
     if (strlen($q)<2) { return null;}
     global $charset;
-	$table_sfv     = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES);
-	$q = Database::escape_string($q);
+    $table_sfv     = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES);
+    $q = Database::escape_string($q);
     $cid = api_get_course_id();
     $sql_add = '';
     if ($cid != -1) {
-    	$sql_add = " AND course_code = '".$cid."' ";
+        $sql_add = " AND course_code = '".$cid."' ";
     }
-	$sql = "SELECT * FROM $table_sfv where value LIKE '%$q%'".$sql_add."
-	        ORDER BY course_code, tool_id, ref_id, field_id";
-	$sql_result = Database::query($sql);
-	$data = array();
+    $sql = "SELECT * FROM $table_sfv where value LIKE '%$q%'".$sql_add."
+            ORDER BY course_code, tool_id, ref_id, field_id";
+    $sql_result = Database::query($sql);
+    $data = array();
     $i = 0;
     while ($row = Database::fetch_array($sql_result)) {
         echo api_convert_encoding($row['value'],'UTF-8',$charset)."| value\n";
@@ -35,9 +36,9 @@ function get_suggestions_from_search_engine($q) {
     // initial value...
     $more_sugg = array();
     foreach ($data as $cc => $course_id) {
-    	foreach ($course_id as $ti => $item_tool_id) {
-    		foreach ($item_tool_id as $ri => $item_ref_id) {
-    			//natsort($item_ref_id);
+        foreach ($course_id as $ti => $item_tool_id) {
+            foreach ($item_tool_id as $ri => $item_ref_id) {
+                //natsort($item_ref_id);
                 $output = array();
                 $field_val = array();
                 $sql2 = "SELECT * FROM $table_sfv
@@ -57,13 +58,13 @@ function get_suggestions_from_search_engine($q) {
                     $field_val[$row2['field_id']] = $row2['value'];
                     $current_field_val = '';
                     foreach ($field_val as $id => $val) {
-                    	$current_field_val .= $val.' - ';
+                        $current_field_val .= $val.' - ';
                     }
                     //Check whether we have a field repetition or not. Results
                     // have been ordered by field_id, so we should catch them
                     // all here
                     if ($field_id == $row2['field_id']) {
-                    	//We found the same field id twice, split the output
+                        //We found the same field id twice, split the output
                         // array to allow for two sets of results (copy all
                         // existing array elements into copies and update the
                         // copies) eg. Yannick - Car - Driving in $output[1]
@@ -71,7 +72,7 @@ function get_suggestions_from_search_engine($q) {
                         // in $output[3]
                         $c = count($output);
                         for ($i=0;$i<$c; $i++) {
-                        	$output[($c+$i)] = $current_field_val;
+                            $output[($c+$i)] = $current_field_val;
                         }
                     } else {
                         //no identical field id, continue as usual
@@ -91,11 +92,11 @@ function get_suggestions_from_search_engine($q) {
                     if (api_stristr($out,$q) === false) {continue;}
                     $s = api_convert_encoding(substr($out,0,-3),'UTF-8',$charset) . "| value\n";
                     if (!in_array($s,$more_sugg)) {
-        			    $more_sugg[] = $s;
+                        $more_sugg[] = $s;
                     }
                 }
-    		}
-    	}
+            }
+        }
     }
     foreach ($more_sugg as $sugg) {
         echo $sugg;

+ 17 - 2
main/social/search.php

@@ -87,8 +87,23 @@ if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2) )
                 $send_inv = '<a href="#" class="'.$buttonClass.' btn-to-send-invitation" data-send-to="' . $user['user_id'] . '">
                              <i class="fa fa-user"></i> '.get_lang('SendInvitation').'</a>';
             }
-            $send_msg = '<a href="#" class="btn-to-send-message '.$buttonClass.'" data-send-to="' . $user['user_id'] . '">
-                        <i class="fa fa-envelope"></i> '.get_lang('SendMessage').'</a>';
+
+            $sendMesssageUrl = api_get_path(WEB_AJAX_PATH)
+                . 'user_manager.ajax.php?'
+                . http_build_query([
+                    'a' => 'get_user_popup',
+                    'user_id' => $user['user_id']
+                ]);
+            $send_msg = Display::toolbarButton(
+                get_lang('SendMessage'),
+                $sendMesssageUrl,
+                'envelope',
+                'default',
+                [
+                    'class' => 'ajax btn-sm',
+                    'data-title' => get_lang('SendMessage')
+                ]
+            );
 
             $img = '<img src="'.$user_info['avatar'].'" width="100" height="100">';
 

+ 1 - 0
main/survey/ch_dropdown.php

@@ -9,6 +9,7 @@ class ch_dropdown extends survey_question
     /**
      * @param array $survey_data
      * @param $formData
+     *
      * @return FormValidator
      */
     public function createForm($survey_data, $formData)

+ 1 - 0
main/survey/ch_multiplechoice.php

@@ -9,6 +9,7 @@ class ch_multiplechoice extends survey_question
     /**
      * @param array $survey_data
      * @param array $formData
+     *
      * @return FormValidator
      */
     public function createForm($survey_data, $formData)

+ 8 - 2
main/survey/generate_link.php

@@ -15,8 +15,14 @@ if (empty($survey_id)) {
 
 $survey_data = SurveyManager::get_survey($survey_id);
 
-$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php', 'name' => get_lang('SurveyList'));
-$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id, 'name' => strip_tags($survey_data['title']));
+$interbreadcrumb[] = array(
+    'url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php',
+    'name' => get_lang('SurveyList'),
+);
+$interbreadcrumb[] = array(
+    'url' => api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id,
+    'name' => strip_tags($survey_data['title']),
+);
 
 Display::display_header(get_lang('Survey'), 'Survey');
 

+ 0 - 9
main/survey/question.php

@@ -27,15 +27,6 @@ if (!api_is_allowed_to_edit(false, true)) {
 
 // Is valid request
 $is_valid_request = isset($_REQUEST['is_executable']) ? $_REQUEST['is_executable'] : null;
-/*if ($request_index != $is_valid_request) {
-	if ($request_index == 'save_question') {
-		unset($_POST[$request_index]);
-	} elseif ($request_index == 'add_answer') {
-		unset($_POST[$request_index]);
-	} elseif($request_index == 'remove_answer') {
-		unset($_POST[$request_index]);
-	}
-}*/
 
 // Database table definitions
 $table_survey = Database:: get_course_table(TABLE_SURVEY);

+ 0 - 1
main/survey/reporting.php

@@ -10,7 +10,6 @@
  * 	@todo The question has to be more clearly indicated (same style as when filling the survey)
  */
 
-// Including the global initialization file
 require_once '../inc/global.inc.php';
 
 $this_section = SECTION_COURSES;

+ 77 - 76
main/survey/survey.download.inc.php

@@ -13,98 +13,99 @@
 
 function check_download_survey($course, $invitation, $doc_url)
 {
-	// Getting all the course information
-	$_course = CourseManager::get_course_information($course);
+    // Getting all the course information
+    $_course = CourseManager::get_course_information($course);
     $course_id = $_course['real_id'];
 
-	// Database table definitions
-	$table_survey 					= Database :: get_course_table(TABLE_SURVEY);
-	$table_survey_question 			= Database :: get_course_table(TABLE_SURVEY_QUESTION);
-	$table_survey_question_option 	= Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
-	$table_survey_invitation 		= Database :: get_course_table(TABLE_SURVEY_INVITATION);
+    // Database table definitions
+    $table_survey = Database:: get_course_table(TABLE_SURVEY);
+    $table_survey_question = Database:: get_course_table(TABLE_SURVEY_QUESTION);
+    $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
+    $table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION);
 
-	// Now we check if the invitationcode is valid
-	$sql = "SELECT * FROM $table_survey_invitation
-	        WHERE
-	            c_id = $course_id AND
-	            invitation_code = '".Database::escape_string($invitation)."'";
-	$result = Database::query($sql);
-	if (Database::num_rows($result) < 1) {
-		Display :: display_error_message(get_lang('WrongInvitationCode'), false);
-		Display :: display_footer();
-		exit;
-	}
-	$survey_invitation = Database::fetch_assoc($result);
+    // Now we check if the invitationcode is valid
+    $sql = "SELECT * FROM $table_survey_invitation
+            WHERE
+                c_id = $course_id AND
+                invitation_code = '".Database::escape_string($invitation)."'";
+    $result = Database::query($sql);
+    if (Database::num_rows($result) < 1) {
+        Display :: display_error_message(get_lang('WrongInvitationCode'), false);
+        Display :: display_footer();
+        exit;
+    }
+    $survey_invitation = Database::fetch_assoc($result);
 
-	// Now we check if the user already filled the survey
-	if ($survey_invitation['answered'] == 1) {
-		Display :: display_error_message(get_lang('YouAlreadyFilledThisSurvey'), false);
-		Display :: display_footer();
-		exit;
-	}
+    // Now we check if the user already filled the survey
+    if ($survey_invitation['answered'] == 1) {
+        Display :: display_error_message(get_lang('YouAlreadyFilledThisSurvey'), false);
+        Display :: display_footer();
+        exit;
+    }
 
-	// Very basic security check: check if a text field from a survey/answer/option contains the name of the document requested
+    // Very basic security check: check if a text field from a survey/answer/option contains the name of the document requested
 
-	// Fetch survey ID
+    // Fetch survey ID
 
-	// If this is the case there will be a language choice
-	$sql = "SELECT * FROM $table_survey
-	        WHERE
-	            c_id = $course_id AND
-	            code='".Database::escape_string($survey_invitation['survey_code'])."'";
-	$result = Database::query($sql);
-	if (Database::num_rows($result) > 1) {
-		if ($_POST['language']) {
-			$survey_invitation['survey_id'] = $_POST['language'];
-		} else {
-			echo '<form id="language" name="language" method="POST" action="'.api_get_self().'?course='.$_GET['course'].'&invitationcode='.$_GET['invitationcode'].'">';
-			echo '  <select name="language">';
-			while ($row = Database::fetch_assoc($result)) {
-				echo '<option value="'.$row['survey_id'].'">'.$row['lang'].'</option>';
-			}
-			echo '</select>';
-			echo '  <input type="submit" name="Submit" value="'.get_lang('Ok').'" />';
-			echo '</form>';
-			display::display_footer();
-			exit;
-		}
-	} else {
-		$row = Database::fetch_assoc($result);
-		$survey_invitation['survey_id'] = $row['survey_id'];
-	}
+    // If this is the case there will be a language choice
+    $sql = "SELECT * FROM $table_survey
+            WHERE
+                c_id = $course_id AND
+                code='".Database::escape_string($survey_invitation['survey_code'])."'";
+    $result = Database::query($sql);
+    if (Database::num_rows($result) > 1) {
+        if ($_POST['language']) {
+            $survey_invitation['survey_id'] = $_POST['language'];
+        } else {
+            echo '<form id="language" name="language" method="POST" action="'.api_get_self().'?course='.Security::remove_XSS($_GET['course']).'&invitationcode='.Security::remove_XSS($_GET['invitationcode']).'">';
+            echo '  <select name="language">';
+            while ($row = Database::fetch_assoc($result)) {
+                echo '<option value="'.$row['survey_id'].'">'.$row['lang'].'</option>';
+            }
+            echo '</select>';
+            echo '  <input type="submit" name="Submit" value="'.get_lang('Ok').'" />';
+            echo '</form>';
+            display::display_footer();
+            exit;
+        }
+    } else {
+        $row = Database::fetch_assoc($result);
+        $survey_invitation['survey_id'] = $row['survey_id'];
+    }
 
-	$sql = "SELECT count(*)
-	        FROM $table_survey
-	        WHERE
-	            c_id = $course_id AND
-	            survey_id = ".$survey_invitation['survey_id']." AND (
+    $sql = "SELECT count(*)
+            FROM $table_survey
+            WHERE
+                c_id = $course_id AND
+                survey_id = ".$survey_invitation['survey_id']." AND (
                     title LIKE '%$doc_url%'
                     or subtitle LIKE '%$doc_url%'
                     or intro LIKE '%$doc_url%'
                     or surveythanks LIKE '%$doc_url%'
                 )
-		    UNION
-		        SELECT count(*)
-		        FROM $table_survey_question
-		        WHERE
-		            c_id = $course_id AND
-		            survey_id = ".$survey_invitation['survey_id']." AND (
+            UNION
+                SELECT count(*)
+                FROM $table_survey_question
+                WHERE
+                    c_id = $course_id AND
+                    survey_id = ".$survey_invitation['survey_id']." AND (
                         survey_question LIKE '%$doc_url%'
                         or survey_question_comment LIKE '%$doc_url%'
                     )
-		    UNION
-		        SELECT count(*)
-		        FROM $table_survey_question_option
-		        WHERE
-		            c_id = $course_id AND
-		            survey_id = ".$survey_invitation['survey_id']." AND (
+            UNION
+                SELECT count(*)
+                FROM $table_survey_question_option
+                WHERE
+                    c_id = $course_id AND
+                    survey_id = ".$survey_invitation['survey_id']." AND (
                         option_text LIKE '%$doc_url%'
                     )";
-	$result = Database::query($sql);
-	if (Database::num_rows($result) == 0) {
-		Display :: display_error_message(get_lang('WrongInvitationCode'), false);
-		Display :: display_footer();
-		exit;
-	}
-	return $_course;
+    $result = Database::query($sql);
+    if (Database::num_rows($result) == 0) {
+        Display :: display_error_message(get_lang('WrongInvitationCode'), false);
+        Display :: display_footer();
+        exit;
+    }
+
+    return $_course;
 }

+ 3 - 3
main/template/default/admin/settings_index.tpl

@@ -13,7 +13,7 @@ $(document).ready(function() {
 
         var extraContentEditor = CKEDITOR.instances.extra_content;
 
-        $('a.edit-block').on('click', function(e) {
+        $('a.admin-edit-block').on('click', function(e) {
             e.preventDefault();
 
             var $self = $(this);
@@ -50,8 +50,8 @@ $(document).ready(function() {
                 <div class="panel-heading">
                     {{ block_item.icon }} {{ block_item.label }}
                     {% if block_item.editable and _u.is_admin %}
-                        <a class="edit-block pull-right" href="#" data-label="{{ block_item.label }}" data-id="{{ block_item.class }}">
-                            <img src="{{ _p.web_img }}icons/22/edit.png" alt="{{ 'Edit' | get_lang }}" title="{{ 'Edit' | get_lang }}">
+                        <a class="admin-edit-block pull-right" href="#" data-label="{{ block_item.label }}" title="{{ 'Edit' | get_lang }}" data-id="{{ block_item.class }}">
+                            <img src="{{ _p.web_img }}icons/22/edit.png" alt="{{ 'Edit' | get_lang }}">
                         </a>
                     {% endif %}
                 </div>

+ 1 - 1
main/template/default/social/add_groups.tpl

@@ -3,7 +3,7 @@
 {% block content %}
 <div class="row">
     <div class="col-md-3">
-        <div class="social-menu">
+        <div class="social-network-menu">
             {{ social_avatar_block }}
             {{ social_menu_block }}
         </div>

+ 1 - 1
main/template/default/social/edit_profile.tpl

@@ -3,7 +3,7 @@
 {% block content %}
 <div class="row">
     <div class="col-md-3">
-        <div class="social-menu">
+        <div class="social-network-menu">
             {{ social_avatar_block }}
             {{ social_menu_block }}
         </div>

+ 1 - 45
main/template/default/social/form_modals.tpl

@@ -1,25 +1,3 @@
-<div class="modal fade" id="send-message-modal" tabindex="-1" role="dialog" aria-labelledby="send-message-modal-title" aria-hidden="true">
-    <div class="modal-dialog">
-        <div class="modal-content">
-            <div class="modal-header">
-                <button type="button" class="close" data-dismiss="modal" aria-label="{{ 'Close' | get_lang }}">
-                    <span aria-hidden="true">&times;</span>
-                </button>
-                <h4 class="modal-title" id="send-message-modal-title">{{ 'SendMessage' | get_lang }}</h4>
-            </div>
-            <div class="modal-body">
-                <div id="send-message-alert"></div>
-                {{ messageForm }}
-            </div>
-            <div class="modal-footer">
-                <button type="button" id="btn-send-message" class="btn btn-primary">
-                    <i class="fa fa-send"></i> {{ 'Send' | get_lang }}
-                </button>
-            </div>
-        </div>
-    </div>
-</div>
-
 <div class="modal fade" id="send-invitation-modal" tabindex="-1" role="dialog" aria-labelledby="send-invitation-modal-title" aria-hidden="true">
     <div class="modal-dialog">
         <div class="modal-content">
@@ -44,32 +22,10 @@
 
 <script>
     $(document).on('ready', function() {
-        var $sendMessageModal = $('#send-message-modal'),
-            $sendInvitationModal = $('#send-invitation-modal');
+        var $sendInvitationModal = $('#send-invitation-modal');
 
         var sendToUser = 0;
 
-        $('.btn-to-send-message').on('click', function(e) {
-            e.preventDefault();
-
-            sendToUser = $(this).data('send-to');
-
-            $sendMessageModal.modal('show');
-        });
-
-        $('#btn-send-message').on('click', function(e) {
-            e.preventDefault();
-
-            var $frmSendMessage = $sendMessageModal.find('.modal-body form'),
-                url = '{{ _p.web_ajax }}message.ajax.php?a=send_message&user_id=' + sendToUser;
-
-            $.get(url, $frmSendMessage.serialize(), function(response) {
-                $('#send-message-alert').html(response);
-
-                $frmSendMessage[0].reset();
-            });
-        });
-
         $('.btn-to-send-invitation').on('click', function(e) {
             e.preventDefault();
 

+ 1 - 1
main/template/default/social/friends.tpl

@@ -3,7 +3,7 @@
 {% block content %}
 <div class="row">
     <div class="col-md-3">
-        <div class="social-menu">
+        <div class="social-network-menu">
             {{ social_avatar_block }}
             {{ social_menu_block }}
         </div>

+ 1 - 1
main/template/default/social/group_waiting_list.tpl

@@ -3,7 +3,7 @@
 {% block content %}
 <div class="row">
     <div class="col-md-3">
-        <div class="social-menu">
+        <div class="social-network-menu">
             {{ social_avatar_block }}
             {{ social_menu_block }}
         </div>

+ 1 - 1
main/template/default/social/groups.tpl

@@ -3,7 +3,7 @@
 {% block content %}
 <div class="row">
     <div class="col-md-3">
-        <div class="social-menu">
+        <div class="social-network-menu">
             {{ social_avatar_block }}
             {{ social_menu_block }}
         </div>

+ 1 - 1
main/template/default/social/home.tpl

@@ -5,7 +5,7 @@
         <div class="col-md-3">
             {{ social_avatar_block }}
 
-            <div class="social-menu">
+            <div class="social-network-menu">
             {{ social_menu_block }}
             </div>
         </div>

+ 1 - 1
main/template/default/social/inbox.tpl

@@ -3,7 +3,7 @@
 {% block content %}
 <div class="row">
     <div class="col-md-3">
-        <div class="social-menu">
+        <div class="social-network-menu">
             {{ social_avatar_block }}
             {{ social_menu_block }}
         </div>

+ 1 - 1
main/template/default/social/invitations.tpl

@@ -3,7 +3,7 @@
 {% block content %}
 <div class="row">
     <div class="col-md-3">
-        <div class="social-menu">
+        <div class="social-network-menu">
             {{ social_avatar_block }}
             {{ social_menu_block }}
         </div>

+ 1 - 1
main/template/default/social/myfiles.tpl

@@ -3,7 +3,7 @@
 {% block content %}
 <div class="row">
     <div class="col-md-3">
-        <div class="social-menu">
+        <div class="social-network-menu">
             {{ social_avatar_block }}
             {{ social_menu_block }}
         </div>

+ 1 - 1
main/template/default/social/profile.tpl

@@ -5,7 +5,7 @@
     <div class="col-md-3">
         {{ social_avatar_block }}
         {{ social_extra_info_block }}        
-        <div class="social-menu">
+        <div class="social-network-menu">
             {{ social_menu_block }}
         </div>
     </div>

+ 1 - 1
main/template/default/social/search.tpl

@@ -3,7 +3,7 @@
 {% block content %}
 <div class="row">
     <div class="col-md-3">
-        <div class="social-menu">
+        <div class="social-network-menu">
             {{ social_avatar_block }}
             {{ social_menu_block }}
         </div>

+ 1 - 1
plugin/skype/src/Skype.php

@@ -50,7 +50,7 @@ class Skype extends Plugin implements HookPluginInterface
         );
 
         if (empty($result)) {
-            $extraField = new Extrafield('user');
+            $extraField = new ExtraField('user');
             $extraField->save(array(
                 'field_type' => ExtraField::FIELD_TYPE_TEXT,
                 'variable' => 'skype',

+ 1 - 1
plugin/ticket/src/assign_tickets.php

@@ -1,10 +1,10 @@
 <?php
 /* For licensing terms, see /license.txt */
-
 /**
  *
  * @package chamilo.plugin.ticket
  */
+
 require_once '../config.php';
 $plugin = TicketPlugin::create();
 

+ 2 - 4
plugin/ticket/src/course_user_list.php

@@ -4,9 +4,7 @@
 /**
  * @package chamilo.plugin.ticket
  */
-/**
- * Init section
- */
+
 require_once '../config.php';
 $plugin = TicketPlugin::create();
 
@@ -27,7 +25,7 @@ $userLabel = Display::tag('label', get_lang('User'), array('class' => 'control-l
 $personName = api_get_person_name($userInfo['firstname'], $userInfo['lastname']);
 $userInput = Display::tag(
     'input',
-    '', 
+    '',
     array(
         'disabled' => 'disabled',
         'type' => 'text',

+ 1 - 3
plugin/ticket/src/index.php

@@ -5,9 +5,7 @@
  * Redirects to "myticket.php"
  * @package chamilo.plugin.ticket
  */
-/**
- * Code
- */
+
 require_once '../config.php';
 header('location:' . api_get_path(WEB_PLUGIN_PATH) . PLUGIN_NAME . '/src/myticket.php?message=success');
 exit;

+ 4 - 3
plugin/ticket/src/myticket.php

@@ -5,8 +5,9 @@
  * This script is the Tickets plugin main entry point
  * @package chamilo.plugin.ticket
  */
+
 $cidReset = true;
-//needed in order to load the plugin lang variables
+// needed in order to load the plugin lang variables
 $course_plugin = 'ticket';
 require_once '../config.php';
 
@@ -30,7 +31,7 @@ function load_history_ticket (div_course,ticket_id) {
             $("div#div_"+ticket_id).html(data);
             $("div#div_"+ticket_id).attr("class","blackboard_show");
             $("div#div_"+ticket_id).attr("style","");
-           }
+        }
     });
 }
 function clear_course_list (div_course) {
@@ -44,7 +45,7 @@ $(function() {
 });
 
 $(document).ready(function() {
-        $("#advanced_search_form").css("display","none");
+    $("#advanced_search_form").css("display","none");
 });
 
 function display_advanced_search_form () {

+ 19 - 16
plugin/ticket/src/new_ticket.php

@@ -4,11 +4,14 @@
 /**
  * @package chamilo.plugin.ticket
  */
+
 $cidReset = true;
 require_once '../config.php';
 $plugin = TicketPlugin::create();
 
-if (!api_is_platform_admin() && $plugin->get('allow_student_add') != 'true') {
+if (!api_is_platform_admin() &&
+    $plugin->get('allow_student_add') != 'true'
+) {
     header('location:' . api_get_path(WEB_PLUGIN_PATH) . PLUGIN_NAME . '/src/myticket.php');
     exit;
 }
@@ -71,23 +74,23 @@ function validate() {
     var selected = document.getElementById("category_id").selectedIndex;
     var id = document.getElementById("category_id").options[selected].value;
     if (document.getElementById("user_id_request").value == "") {
-            alert("' . $plugin->get_lang("ValidUser") . '");
-            return false;
+        alert("' . $plugin->get_lang("ValidUser") . '");
+        return false;
     } else if(id == 0) {
-            alert("' . $plugin->get_lang("ValidType") . '");
-            return false;
+        alert("' . $plugin->get_lang("ValidType") . '");
+        return false;
     } else if(document.getElementById("subject").value == "") {
-            alert("' . $plugin->get_lang("ValidSubject") . '");
-            return false;
+        alert("' . $plugin->get_lang("ValidSubject") . '");
+        return false;
     } else if(parseInt(course_required[id]) == 1 && document.getElementById("course_id").value == 0) {
-            alert("' . $plugin->get_lang("ValidCourse") . '");
-            return false;
+        alert("' . $plugin->get_lang("ValidCourse") . '");
+        return false;
     } else if(id != "CUR" && parseInt(course_required[id]) != 1  && !re.test(document.getElementById("personal_email").value)) {
-            alert("' . $plugin->get_lang("ValidEmail") . '");
-            return false;
+        alert("' . $plugin->get_lang("ValidEmail") . '");
+        return false;
     } else if(fckEditor1val == "") {
-            alert("' . $plugin->get_lang("ValidMessage") . '");
-            return false;
+        alert("' . $plugin->get_lang("ValidMessage") . '");
+        return false;
     }
 }
 
@@ -199,14 +202,13 @@ function show_form_send_ticket()
     global $types, $plugin;
     echo '<div class="divTicket">';
 
-    //Category List
+    // Category List
     $categoryList = array();
     foreach ($types as $type) {
         $categoryList[$type['category_id']] = $type['name'] . ": " . $type['description'];
     }
-    //End Category List
 
-    //Status List
+    // Status List
     $statusList = array();
     $statusAttributes = array(
         'style' => 'display: none;',
@@ -495,6 +497,7 @@ function get_number_of_users()
     }
     $res = Database::query($sql);
     $obj = Database::fetch_object($res);
+
     return $obj->total_number_of_items;
 }
 

+ 7 - 7
plugin/ticket/src/report.php

@@ -186,7 +186,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
     $sql = "SELECT
                  u.user_id AS col0,
                  u.official_code AS col2,
-		 $col34
+		        $col34
                  u.username AS col5,
                  u.email AS col6,
                  u.status AS col7,
@@ -305,12 +305,12 @@ if (isset($_POST['report'])) {
     $table_result->set_header(4, get_lang('Tool'), false);
     while ($row = Database::fetch_assoc($result)) {
         $row = array(
-                $row['username'],
-                $row['fullname'],
-                $row['access_date'],
-                $row['course'],
-                get_lang($tools[$row['tool']]['name'])
-            );
+            $row['username'],
+            $row['fullname'],
+            $row['access_date'],
+            $row['course'],
+            get_lang($tools[$row['tool']]['name'])
+        );
         $table_result->addRow($row);
     }
     $table_result->display();

+ 21 - 10
plugin/ticket/src/ticket.class.php

@@ -48,6 +48,7 @@ class TicketManager
         while ($row = Database::fetch_assoc($result)) {
             $types[] = $row;
         }
+
         return $types;
     }
 
@@ -381,7 +382,10 @@ class TicketManager
             foreach ($file_attachments as $file_attach) {
                 if ($file_attach['error'] == 0) {
                     $data_files[] = self::save_message_attachment_file(
-                                    $file_attach, $ticket_id, $message_id, $message_attch_id
+                        $file_attach,
+                        $ticket_id,
+                        $message_id,
+                        $message_attch_id
                     );
                     $message_attch_id++;
                 } else {
@@ -430,7 +434,7 @@ class TicketManager
             }
             $new_path = $path_message_attach . $new_file_name;
             if (is_uploaded_file($file_attach['tmp_name'])) {
-                $result = @copy($file_attach['tmp_name'], $new_path);
+                @copy($file_attach['tmp_name'], $new_path);
             }
             $safe_file_name = Database::escape_string($file_name);
             $safe_new_file_name = Database::escape_string($new_file_name);
@@ -458,6 +462,7 @@ class TicketManager
                     '$now'
                 )";
             Database::query($sql);
+
             return array(
                 'path' => $path_message_attach . $safe_new_file_name,
                 'filename' => $safe_file_name
@@ -657,7 +662,7 @@ class TicketManager
             }
         }
         $sql .= " ORDER BY col$column $direction";
-        $sql .= " LIMIT $from,$number_of_items";
+        $sql .= " LIMIT $from, $number_of_items";
 
         $result = Database::query($sql);
         $tickets = array();
@@ -1018,7 +1023,9 @@ class TicketManager
                 $row['course_url'] = null;
                 if ($row['course_id'] != 0) {
                     $course = api_get_course_info_by_id($row['course_id']);
-                    $row['course_url'] = '<a href="' . api_get_path(WEB_COURSE_PATH) . $course['path'] . '">' . $course['name'] . '</a>';
+                    if ($course) {
+                        $row['course_url'] = '<a href="'.$course['course_public_url'].'">'.$course['name'].'</a>';
+                    }
                 }
                 $userInfo = api_get_user_info($row['request_user']);
                 $row['user_url'] = '<a href="' . api_get_path(WEB_PATH) . 'main/admin/user_information.php?user_id=' . $row['request_user'] . '">
@@ -1028,8 +1035,9 @@ class TicketManager
             }
             $sql = "SELECT  * FROM  $table_support_messages message,
                     $table_main_user user
-                    WHERE message.ticket_id = '$ticket_id'
-                    AND message.sys_insert_user_id = user.user_id ";
+                    WHERE
+                        message.ticket_id = '$ticket_id' AND
+                        message.sys_insert_user_id = user.user_id ";
             $result = Database::query($sql);
             $ticket['messages'] = array();
             $attach_icon = Display::return_icon('attachment.gif', '');
@@ -1050,10 +1058,12 @@ class TicketManager
                 }
 
                 $message['user_created'] = "<a href='$href'> $completeName </a>";
-                $sql_atachment = "SELECT * FROM $table_support_message_attachments
-                                  WHERE message_id = " . $row['message_id'] . "
-                                  AND ticket_id= '$ticket_id'  ";
-                $result_attach = Database::query($sql_atachment);
+                $sql = "SELECT *
+                        FROM $table_support_message_attachments
+                        WHERE
+                            message_id = " . $row['message_id'] . " AND
+                            ticket_id= '$ticket_id'  ";
+                $result_attach = Database::query($sql);
                 while ($row2 = Database::fetch_assoc($result_attach)) {
                     $archiveURL = $archiveURL = $webPath . "plugin/" . PLUGIN_NAME . '/src/download.php?ticket_id=' . $ticket_id . '&file=';
                     $row2['attachment_link'] = $attach_icon . '&nbsp;<a href="' . $archiveURL . $row2['path'] . '&title=' . $row2['filename'] . '">' . $row2['filename'] . '</a>&nbsp;(' . $row2['size'] . ')';
@@ -1127,6 +1137,7 @@ class TicketManager
                 sys_lastedit_datetime ='" . $now . "'
                 WHERE ticket_id ='$ticket_id'";
         $result = Database::query($sql);
+
         if (Database::affected_rows($result) > 0) {
             return true;
         } else {

+ 2 - 2
plugin/tour/config/tour.json

@@ -72,14 +72,14 @@
         ]
     },
     {
-        "pageClass": ".section-social",
+        "pageClass": ".section-social-network",
         "steps": [
             {
                 "elementSelector": ".breadcrumb",
                 "message": "SocialAllowsYouToGetInTouchWithOtherUsersOfThePlatform"
             },
             {
-                "elementSelector": ".social-menu",
+                "elementSelector": ".social-network-menu",
                 "message": "SocialMenuGivesAccessToDifferentToolsToGetInTouchOrPublishStuff"
             }
         ]

+ 1 - 1
plugin/tour/lang/english.php

@@ -49,7 +49,7 @@ $strings['AgendaButtonsAllowYouToChangePeriod'] = 'You can switch the view to da
 $strings['MySpaceAllowsYouToKeepTrackOfProgress'] = 'This area allows you to check your progress if you\'re a student, or the progress of your students if you are a teacher';
 $strings['MySpaceSectionsGiveYouImportantInsight'] = 'The reports provided on this screen are extensible and can provide you very valuable insight on your learning or teaching';
 
-// if body class = section-social
+// if body class = section-social-network
 $strings['SocialAllowsYouToGetInTouchWithOtherUsersOfThePlatform'] = 'The social area allows you to get in touch with other users on the platform';
 $strings['SocialMenuGivesAccessToDifferentToolsToGetInTouchOrPublishStuff'] = 'The menu gives you access to a series of screens allowing you to participate in private messaging, chat, interest groups, etc';
 

+ 1 - 1
plugin/tour/lang/french.php

@@ -49,7 +49,7 @@ $strings['AgendaButtonsAllowYouToChangePeriod'] = 'You can switch the view to da
 $strings['MySpaceAllowsYouToKeepTrackOfProgress'] = 'This area allows you to check your progress if you\'re a student, or the progress of your students if you are a teacher';
 $strings['MySpaceSectionsGiveYouImportantInsight'] = 'The reports provided on this screen are extensible and can provide you very valuable insight on your learning or teaching';
 
-// if body class = section-social
+// if body class = section-social-network
 $strings['SocialAllowsYouToGetInTouchWithOtherUsersOfThePlatform'] = 'The social area allows you to get in touch with other users on the platform';
 $strings['SocialMenuGivesAccessToDifferentToolsToGetInTouchOrPublishStuff'] = 'The menu gives you access to a series of screens allowing you to participate in private messaging, chat, interest groups, etc';
 

+ 1 - 1
plugin/tour/lang/spanish.php

@@ -49,7 +49,7 @@ $strings['AgendaButtonsAllowYouToChangePeriod'] = 'You can switch the view to da
 $strings['MySpaceAllowsYouToKeepTrackOfProgress'] = 'This area allows you to check your progress if you\'re a student, or the progress of your students if you are a teacher';
 $strings['MySpaceSectionsGiveYouImportantInsight'] = 'The reports provided on this screen are extensible and can provide you very valuable insight on your learning or teaching';
 
-// if body class = section-social
+// if body class = section-social-network
 $strings['SocialAllowsYouToGetInTouchWithOtherUsersOfThePlatform'] = 'The social area allows you to get in touch with other users on the platform';
 $strings['SocialMenuGivesAccessToDifferentToolsToGetInTouchOrPublishStuff'] = 'The menu gives you access to a series of screens allowing you to participate in private messaging, chat, interest groups, etc';
 

+ 1406 - 1429
tests/main/newscorm/learnpath.class.test.php

@@ -3,1465 +3,1442 @@ require_once(api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php');
 
 class TestLearnpath extends UnitTestCase {
 
-	const course = 'COURSETEST';
-
-	public function testAddItem() {
-		//ob_start();
-		$parent = 2;
-		$previous = 1;
-		$type = 'dokeos_chapter';
-		$id = 1;
-		$title = 'Titulo';
-		$description = 'Descripcion';
-		$prerequisites = 0;
-		$max_time_allowed = 0;
-
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath(self::course, $lp_id, $user_id);
-
-		$res = $obj->add_item($parent, $previous, $type, $id, $title, $description, $prerequisites, $max_time_allowed);
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testAddLp() {
-		//ob_start();
-		$name = '';
-		$description = '';
-		$learnpath = 'guess';
-		$origin = 'zip';
-		$zipname = '';
-		$res = learnpath::add_lp(self::course, $name, $description, $learnpath, $origin, $zipname);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testAppendMessage() {
-		//ob_start();
-		$string = '';
-		$res = learnpath::append_message($string);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	/*
-	public function testAutocompleteParents() {
-		//ob_start();
-		$item = 1;
-
-		$course='COURSETEST';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath($course, $lp_id, $user_id);
-		$res = $obj->autocomplete_parents($item);
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	var_dump($res);
-	}
-	*/
-	public function testAutosave() {
-		//ob_start();
-		$res = learnpath::autosave();
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testBuildActionMenu() {
-		ob_start();
-		$res = learnpath::build_action_menu();
-	 	$this->assertTrue(is_null($res));
-		ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testClearMessage() {
-		//ob_start();
-		$res = learnpath::clear_message();
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testClose() {
-		//ob_start();
-		$res = learnpath::close();
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testCreateDocument() {
-		//ob_start();
-		$_course = '';
-		$res = learnpath::create_document($_course);
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    const course = 'COURSETEST';
+
+    public function testAddItem() {
+        //ob_start();
+        $parent = 2;
+        $previous = 1;
+        $type = 'dokeos_chapter';
+        $id = 1;
+        $title = 'Titulo';
+        $description = 'Descripcion';
+        $prerequisites = 0;
+        $max_time_allowed = 0;
+
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath(self::course, $lp_id, $user_id);
+
+        $res = $obj->add_item($parent, $previous, $type, $id, $title, $description, $prerequisites, $max_time_allowed);
+        $this->assertTrue(is_numeric($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testAddLp() {
+        //ob_start();
+        $name = '';
+        $description = '';
+        $learnpath = 'guess';
+        $origin = 'zip';
+        $zipname = '';
+        $res = learnpath::add_lp(self::course, $name, $description, $learnpath, $origin, $zipname);
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    /*
+    public function testAutocompleteParents() {
+        //ob_start();
+        $item = 1;
+
+        $course='COURSETEST';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath($course, $lp_id, $user_id);
+        $res = $obj->autocomplete_parents($item);
+        $this->assertTrue(is_numeric($res));
+        //ob_end_clean();
+        var_dump($res);
+    }
+    */
+    public function testAutosave() {
+        //ob_start();
+        $res = learnpath::autosave();
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testBuildActionMenu() {
+        ob_start();
+        $res = learnpath::build_action_menu();
+        $this->assertTrue(is_null($res));
+        ob_end_clean();
+        //var_dump($res);
+    }
+
+
+    public function testClose() {
+        //ob_start();
+        $res = learnpath::close();
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testCreateDocument() {
+        //ob_start();
+        $_course = '';
+        $res = learnpath::create_document($_course);
+        $this->assertTrue(is_numeric($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 /*
-	public function testCreateJs() {
-		//ob_start();
-		$res = learnpath::create_js();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testCreateJs() {
+        //ob_start();
+        $res = learnpath::create_js();
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 */
-	public function testCreatePath() {
-		//ob_start();
-		$path = '';
-		$res = learnpath::create_path($path);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testCreateTreeArray() {
-		//ob_start();
-		$array = '';
-		$parent = 0;
-		$depth = -1;
-		$tmp = array ();
-		$res = learnpath::create_tree_array($array, $parent, $depth, $tmp);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testDisplayDocument() {
-		//ob_start();
-		$id = 1;
-		$show_title = false;
-		$iframe = true;
-		$edit_link = false;
-		$res = learnpath::display_document($id, $show_title, $iframe, $edit_link);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testCreatePath() {
+        //ob_start();
+        $path = '';
+        $res = learnpath::create_path($path);
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testCreateTreeArray() {
+        //ob_start();
+        $array = '';
+        $parent = 0;
+        $depth = -1;
+        $tmp = array ();
+        $res = learnpath::create_tree_array($array, $parent, $depth, $tmp);
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testDisplayDocument() {
+        //ob_start();
+        $id = 1;
+        $show_title = false;
+        $iframe = true;
+        $edit_link = false;
+        $res = learnpath::display_document($id, $show_title, $iframe, $edit_link);
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 /*
-	public function testDisplayDocumentForm() {
-		//ob_start();
-		$action = 'add';
-		$id = 0;
-		$extra_info = 'new';
-		$course='COURSETEST';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath($course, $lp_id, $user_id);
-
-		$res = $obj->display_document_form($action, $id, $extra_info);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testDisplayDocumentForm() {
+        //ob_start();
+        $action = 'add';
+        $id = 0;
+        $extra_info = 'new';
+        $course='COURSETEST';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath($course, $lp_id, $user_id);
+
+        $res = $obj->display_document_form($action, $id, $extra_info);
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 */
-	public function testDisplayEditItem() {
-		//ob_start();
-		$item_id = '';
-		$res = learnpath::display_edit_item($item_id);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	/*
-	public function testDisplayForumForm() {
-		//ob_start();
-		$action = 'add';
-		$id = 0;
-		$extra_info = '';
-		$course='COURSETEST';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath($course, $lp_id, $user_id);
-
-		$res = $obj->display_forum_form($action, $id, $extra_info);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testDisplayHotpotatoesForm() {
-		//ob_start();
-		$action = 'add';
-		$id = 0;
-		$extra_info = '';
-		$course='COURSETEST';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath($course, $lp_id, $user_id);
-
-		$res = $obj->display_hotpotatoes_form($action, $id, $extra_info);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testDisplayEditItem() {
+        //ob_start();
+        $item_id = '';
+        $res = learnpath::display_edit_item($item_id);
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+    /*
+    public function testDisplayForumForm() {
+        //ob_start();
+        $action = 'add';
+        $id = 0;
+        $extra_info = '';
+        $course='COURSETEST';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath($course, $lp_id, $user_id);
+
+        $res = $obj->display_forum_form($action, $id, $extra_info);
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testDisplayHotpotatoesForm() {
+        //ob_start();
+        $action = 'add';
+        $id = 0;
+        $extra_info = '';
+        $course='COURSETEST';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath($course, $lp_id, $user_id);
+
+        $res = $obj->display_hotpotatoes_form($action, $id, $extra_info);
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 */
-	public function testDisplayItem() {
-		//ob_start();
-		$item_id = '';
-		$iframe = true;
-		$msg = '';
-		$res = learnpath::display_item($item_id, $iframe, $msg);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testDisplayItem() {
+        //ob_start();
+        $item_id = '';
+        $iframe = true;
+        $msg = '';
+        $res = learnpath::display_item($item_id, $iframe, $msg);
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 
 /*	public function testDisplayItemForm() {
-		//ob_start();
-		$item_type = '';
-		$title = '';
-		$action = 'add';
-		$id = 0;
-		$extra_info = 'new';
-		$course='COURSETEST';
-		$lp_id = 1;
-		$user_id = 1;
-		$obj = new learnpath($course, $lp_id, $user_id);
-		$res = $obj->display_item_form($item_type, $title, $action, $id, $extra_info);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testDisplayItemPrerequisitesForm() {
-		//ob_start();
-		$item_id = '';
-		$course='COURSETEST';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath($course, $lp_id, $user_id);
-
-		$res = $obj->display_item_prerequisites_form($item_id);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+        //ob_start();
+        $item_type = '';
+        $title = '';
+        $action = 'add';
+        $id = 0;
+        $extra_info = 'new';
+        $course='COURSETEST';
+        $lp_id = 1;
+        $user_id = 1;
+        $obj = new learnpath($course, $lp_id, $user_id);
+        $res = $obj->display_item_form($item_type, $title, $action, $id, $extra_info);
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testDisplayItemPrerequisitesForm() {
+        //ob_start();
+        $item_id = '';
+        $course='COURSETEST';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath($course, $lp_id, $user_id);
+
+        $res = $obj->display_item_prerequisites_form($item_id);
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 */
-	public function testDisplayItemSmallForm() {
-		//ob_start();
-		$item_type = '';
-		$title = '';
-		$data = '';
-		$res = learnpath::display_item_small_form($item_type, $title, $data);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testDisplayItemSmallForm() {
+        //ob_start();
+        $item_type = '';
+        $title = '';
+        $data = '';
+        $res = learnpath::display_item_small_form($item_type, $title, $data);
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 /*
-	public function testDisplayLinkForm() {
-		//ob_start();
-		$action = 'add';
-		$id = 0;
-		$extra_info = '';
-		$course='COURSETEST';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath($course, $lp_id, $user_id);
-
-		$res = $obj->display_link_form($action, $id, $extra_info);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testDisplayManipulate() {
-		//ob_start();
-		$item_id = '';
-		$item_type = TOOL_DOCUMENT;
-		$res = learnpath::display_manipulate($item_id, $item_type);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testDisplayLinkForm() {
+        //ob_start();
+        $action = 'add';
+        $id = 0;
+        $extra_info = '';
+        $course='COURSETEST';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath($course, $lp_id, $user_id);
+
+        $res = $obj->display_link_form($action, $id, $extra_info);
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testDisplayManipulate() {
+        //ob_start();
+        $item_id = '';
+        $item_type = TOOL_DOCUMENT;
+        $res = learnpath::display_manipulate($item_id, $item_type);
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 */
-	public function testDisplayMoveItem() {
-		//ob_start();
-		$item_id = '';
-		$res = learnpath::display_move_item($item_id);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testDisplayMoveItem() {
+        //ob_start();
+        $item_id = '';
+        $res = learnpath::display_move_item($item_id);
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 /*
-	public function testDisplayQuizForm() {
-		//ob_start();
-		$action = 'add';
-		$id = 0;
-		$extra_info = '';
-		$course='COURSETEST';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath($course, $lp_id, $user_id);
-
-		$res = $obj->display_quiz_form($action, $id, $extra_info);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testDisplayQuizForm() {
+        //ob_start();
+        $action = 'add';
+        $id = 0;
+        $extra_info = '';
+        $course='COURSETEST';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath($course, $lp_id, $user_id);
+
+        $res = $obj->display_quiz_form($action, $id, $extra_info);
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 */
 /*	public function testDisplayResources() {
-		//ob_start();
-		$course='COURSETEST';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath($course, $lp_id, $user_id);
-
-		$res = $obj->display_resources();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testDisplayStudentPublicationForm() {
-		//ob_start();
-		$action = 'add';
-		$id = 0;
-		$extra_info = '';
-		$course='COURSETEST';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath($course, $lp_id, $user_id);
-
-		$res = $obj->display_student_publication_form($action, $id, $extra_info);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testDisplayThreadForm() {
-		//ob_start();
-		$action = 'add';
-		$id = 0;
-		$extra_info = '';
-		$course='COURSETEST';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath($course, $lp_id, $user_id);
-
-		$res = $obj->display_thread_form($action, $id, $extra_info);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+        //ob_start();
+        $course='COURSETEST';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath($course, $lp_id, $user_id);
+
+        $res = $obj->display_resources();
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testDisplayStudentPublicationForm() {
+        //ob_start();
+        $action = 'add';
+        $id = 0;
+        $extra_info = '';
+        $course='COURSETEST';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath($course, $lp_id, $user_id);
+
+        $res = $obj->display_student_publication_form($action, $id, $extra_info);
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testDisplayThreadForm() {
+        //ob_start();
+        $action = 'add';
+        $id = 0;
+        $extra_info = '';
+        $course='COURSETEST';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath($course, $lp_id, $user_id);
+
+        $res = $obj->display_thread_form($action, $id, $extra_info);
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 */
-	public function testEditDocument() {
-		//ob_start();
-		$_course='';
-		$res = learnpath::edit_document($_course);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testEditItem() {
-		//ob_start();
-		$id = '';
-		$parent = '';
-		$previous = '';
-		$title = '';
-		$description = '';
-		$prerequisites = 0;
-		$audio = NULL;
-		$max_time_allowed = 0;
-		$res = learnpath::edit_item($id, $parent, $previous, $title, $description, $prerequisites, $audio, $max_time_allowed);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testEditItemPrereq() {
-		//ob_start();
-		$id = '';
-		$prerequisite_id = '';
-		$mastery_score = 0;
-		$max_score = 100;
-		$res = learnpath::edit_item_prereq($id, $prerequisite_id, $mastery_score, $max_score);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testExportLp() {
-		//ob_start();
-		$type = 'scorm';
-		$id = 1;
-		$zipname = 'FILE';
-		$res = learnpath::export_lp($type, self::course, $id, $zipname);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testFirst() {
-		//ob_start();
-		$res = learnpath::first();
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetAuthor() {
-		//ob_start();
-		$res = learnpath::get_author();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetBrotherChapters() {
-		//ob_start();
-		$id = '';
-		$res = learnpath::get_brother_chapters($id);
-	 	$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetBrotherItems() {
-		//ob_start();
-		$id = '';
-		$res = learnpath::get_brother_items($id);
-	 	$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testEditDocument() {
+        //ob_start();
+        $_course='';
+        $res = learnpath::edit_document($_course);
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testEditItem() {
+        //ob_start();
+        $id = '';
+        $parent = '';
+        $previous = '';
+        $title = '';
+        $description = '';
+        $prerequisites = 0;
+        $audio = NULL;
+        $max_time_allowed = 0;
+        $res = learnpath::edit_item($id, $parent, $previous, $title, $description, $prerequisites, $audio, $max_time_allowed);
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testEditItemPrereq() {
+        //ob_start();
+        $id = '';
+        $prerequisite_id = '';
+        $mastery_score = 0;
+        $max_score = 100;
+        $res = learnpath::edit_item_prereq($id, $prerequisite_id, $mastery_score, $max_score);
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testExportLp() {
+        //ob_start();
+        $type = 'scorm';
+        $id = 1;
+        $zipname = 'FILE';
+        $res = learnpath::export_lp($type, self::course, $id, $zipname);
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testFirst() {
+        //ob_start();
+        $res = learnpath::first();
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetAuthor() {
+        //ob_start();
+        $res = learnpath::get_author();
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetBrotherChapters() {
+        //ob_start();
+        $id = '';
+        $res = learnpath::get_brother_chapters($id);
+        $this->assertTrue(is_array($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetBrotherItems() {
+        //ob_start();
+        $id = '';
+        $res = learnpath::get_brother_items($id);
+        $this->assertTrue(is_array($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 /*
-	public function testGetCommonIndexTermsByPrefix() {
-		//ob_start();
-		$prefix = '';
-		$res = learnpath::get_common_index_terms_by_prefix($prefix);
-	 	$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetCompleteItemsCount() {
-		//ob_start();
-		$res = learnpath::get_complete_items_count();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testGetCommonIndexTermsByPrefix() {
+        //ob_start();
+        $prefix = '';
+        $res = learnpath::get_common_index_terms_by_prefix($prefix);
+        $this->assertTrue(is_array($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetCompleteItemsCount() {
+        //ob_start();
+        $res = learnpath::get_complete_items_count();
+        $this->assertTrue(is_numeric($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 */
-	public function testGetCurrentItemId() {
-		//ob_start();
-		$res = learnpath::get_current_item_id();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetDocuments() {
-		//ob_start();
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath(self::course, $lp_id, $user_id);
-
-		$res = $obj->get_documents();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetExercises() {
-		//ob_start();
-		$res = learnpath::get_exercises();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetExtension() {
-		//ob_start();
-		$filename = 'file';
-		$res = learnpath::get_extension($filename);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetFirstItemId() {
-		//ob_start();
-		$res = learnpath::get_first_item_id();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetFlatOrderedItemsList() {
-		//ob_start();
-		$lp = 1;
-		$parent = 0;
-		$res = learnpath::get_flat_ordered_items_list($lp, $parent);
-	 	$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-		/*
-	public function testGetForums() {
-		//ob_start();
-
-		//require_once api_get_path(WEB_PATH).('forum/forumpublic function.inc.php');
-		//require_once api_get_path(WEB_PATH).('forum/forumconfig.inc.php');
-		$course='COURSETEST';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath($course, $lp_id, $user_id);
-
-		$res = $obj->get_forums();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetHtmlToc() {
-		//ob_start();
-		$course='COURSETEST';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath($course, $lp_id, $user_id);
-
-		$res = $obj->get_html_toc();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testGetCurrentItemId() {
+        //ob_start();
+        $res = learnpath::get_current_item_id();
+        $this->assertTrue(is_numeric($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetDocuments() {
+        //ob_start();
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath(self::course, $lp_id, $user_id);
+
+        $res = $obj->get_documents();
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetExercises() {
+        //ob_start();
+        $res = learnpath::get_exercises();
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetExtension() {
+        //ob_start();
+        $filename = 'file';
+        $res = learnpath::get_extension($filename);
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetFirstItemId() {
+        //ob_start();
+        $res = learnpath::get_first_item_id();
+        $this->assertTrue(is_numeric($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetFlatOrderedItemsList() {
+        //ob_start();
+        $lp = 1;
+        $parent = 0;
+        $res = learnpath::get_flat_ordered_items_list($lp, $parent);
+        $this->assertTrue(is_array($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+        /*
+    public function testGetForums() {
+        //ob_start();
+
+        //require_once api_get_path(WEB_PATH).('forum/forumpublic function.inc.php');
+        //require_once api_get_path(WEB_PATH).('forum/forumconfig.inc.php');
+        $course='COURSETEST';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath($course, $lp_id, $user_id);
+
+        $res = $obj->get_forums();
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetHtmlToc() {
+        //ob_start();
+        $course='COURSETEST';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath($course, $lp_id, $user_id);
+
+        $res = $obj->get_html_toc();
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 */
-	public function testGetId() {
-		//ob_start();
-		$res = learnpath::get_id();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetInteractionsCountFromDb() {
-		//ob_start();
-		$lp_iv_id = 0;
-		$res = learnpath::get_interactions_count_from_db($lp_iv_id);
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testGetId() {
+        //ob_start();
+        $res = learnpath::get_id();
+        $this->assertTrue(is_numeric($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetInteractionsCountFromDb() {
+        //ob_start();
+        $lp_iv_id = 0;
+        $res = learnpath::get_interactions_count_from_db($lp_iv_id);
+        $this->assertTrue(is_numeric($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 /*
-	public function testGetItemsDetailsAsJs() {
-		//ob_start();
-		$varname='olms.lms_item_types';
-		$res = learnpath::get_items_details_as_js($varname);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetItemsStatusList() {
-		//ob_start();
-		$res = learnpath::get_items_status_list();
-	 	$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetIvInteractionsArray() {
-		//ob_start();
-		$lp_iv_id = '';
-		$res = learnpath::get_iv_interactions_array($lp_iv_id);
-	 	$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testGetItemsDetailsAsJs() {
+        //ob_start();
+        $varname='olms.lms_item_types';
+        $res = learnpath::get_items_details_as_js($varname);
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetItemsStatusList() {
+        //ob_start();
+        $res = learnpath::get_items_status_list();
+        $this->assertTrue(is_array($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetIvInteractionsArray() {
+        //ob_start();
+        $lp_iv_id = '';
+        $res = learnpath::get_iv_interactions_array($lp_iv_id);
+        $this->assertTrue(is_array($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 */
-	public function testGetIvObjectivesArray() {
-		//ob_start();
-		$lp_iv_id = 0;
-		$res = learnpath::get_iv_objectives_array($lp_iv_id);
-	 	$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	/*
-	public function testGetJsInfo() {
-		//ob_start();
-		$item_id = '';
-		$course='COURSETEST';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath($course, $lp_id, $user_id);
-
-		$res = $obj->get_js_info($item_id);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}	*/
-
-	public function testGetJsLib() {
-		//ob_start();
-		$res = learnpath::get_js_lib();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetLast() {
-		//ob_start();
-		$res = learnpath::get_last();
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetLink() {
-		//ob_start();
-		$type = 'http';
-		$item_id = null;
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath(self::course, $lp_id, $user_id);
-
-		$res = $obj->get_link($type, $item_id);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetLinks() {
-		//ob_start();
-		$res = learnpath::get_links();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetLpSessionId() {
-		//ob_start();
-		$res = learnpath::get_lp_session_id();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetMaker() {
-		//ob_start();
-		$res = learnpath::get_maker();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetMediaplayer() {
-		//ob_start();
-		$autostart='true';
-		$res = learnpath::get_mediaplayer($autostart);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetMessage() {
-		//ob_start();
-		$res = learnpath::get_message();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetName() {
-		//ob_start();
-		$res = learnpath::get_name();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetNavigationBar() {
-		//ob_start();
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath(self::course, $lp_id, $user_id);
-
-		$res = $obj->get_navigation_bar();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetNextIndex() {
-		//ob_start();
-		$res = learnpath::get_next_index();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetNextItemId() {
-		//ob_start();
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath(self::course, $lp_id, $user_id);
-
-		$res = $obj->get_next_item_id();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetObjectivesCountFromDb() {
-		//ob_start();
-		$lp_iv_id = 0;
-		$res = learnpath::get_objectives_count_from_db($lp_iv_id);
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	/*
-	public function testGetPackageType() {
-		//ob_start();
-		$file_path = '';
-		$file_name = '';
-		$course='COURSETEST';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath($course, $lp_id, $user_id);
-
-		$res = $obj->get_package_type($file_path, $file_name);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}*/
-
-	public function testGetPreviewImage() {
-		//ob_start();
-		$res = learnpath::get_preview_image();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetPreviousIndex() {
-		//ob_start();
-		$res = learnpath::get_previous_index();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetPreviousItemId() {
-		//ob_start();
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath(self::course, $lp_id, $user_id);
-
-		$res = $obj->get_previous_item_id();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetProgress() {
-		//ob_start();
-		$res = learnpath::get_progress();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetProgressBar() {
-		//ob_start();
-		$mode = '';
-		$percentage = -1;
-		$text_add = '';
-		$from_lp = false;
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath(self::course, $lp_id, $user_id);
-
-		$res = $obj->get_progress_bar($mode, $percentage, $text_add, $from_lp);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetProgressBarMode() {
-		//ob_start();
-		$res = learnpath::get_progress_bar_mode();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetProgressBarText() {
-		//ob_start();
-		$mode = '';
-		$add = 0;
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath(self::course, $lp_id, $user_id);
-
-		$res = $obj->get_progress_bar_text($mode, $add);
-	 	$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetProximity() {
-		//ob_start();
-		$res = learnpath::get_proximity();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetScormPrereqString() {
-		//ob_start();
-		$item_id = 1;
-		$res = learnpath::get_scorm_prereq_string($item_id);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetScormXmlNode() {
-		//ob_start();
-		$children = 'children';
-		$id = 1;
-		$res = learnpath::get_scorm_xml_node($children, $id);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetStats() {
-		//ob_start();
-		$res = learnpath::get_stats();
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetStatsCourse() {
-		//ob_start();
-		$course = '';
-		$res = learnpath::get_stats_course($course);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetStatsLp() {
-		//ob_start();
-		$lp = 1;
-		$res = learnpath::get_stats_lp(self::course, $lp);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetStatsLpUser() {
-		//ob_start();
-		$lp = 1;
-		$user = 1;
-		$res = learnpath::get_stats_lp_user(self::course, $lp, $user);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetStatsUser() {
-		//ob_start();
-		$user = 1;
-		$res = learnpath::get_stats_user(self::course, $user);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetStudentPublications() {
-		//ob_start();
-		$res = learnpath::get_student_publications();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetTheme() {
-		//ob_start();
-		$res = learnpath::get_theme();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	/*
-	public function testGetToc() {
-		//ob_start();
-		$res = learnpath::get_toc();
-	 	$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testGetIvObjectivesArray() {
+        //ob_start();
+        $lp_iv_id = 0;
+        $res = learnpath::get_iv_objectives_array($lp_iv_id);
+        $this->assertTrue(is_array($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+    /*
+    public function testGetJsInfo() {
+        //ob_start();
+        $item_id = '';
+        $course='COURSETEST';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath($course, $lp_id, $user_id);
+
+        $res = $obj->get_js_info($item_id);
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }	*/
+
+    public function testGetJsLib() {
+        //ob_start();
+        $res = learnpath::get_js_lib();
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetLast() {
+        //ob_start();
+        $res = learnpath::get_last();
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetLink() {
+        //ob_start();
+        $type = 'http';
+        $item_id = null;
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath(self::course, $lp_id, $user_id);
+
+        $res = $obj->get_link($type, $item_id);
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetLinks() {
+        //ob_start();
+        $res = learnpath::get_links();
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetLpSessionId() {
+        //ob_start();
+        $res = learnpath::get_lp_session_id();
+        $this->assertTrue(is_numeric($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetMaker() {
+        //ob_start();
+        $res = learnpath::get_maker();
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetMediaplayer() {
+        //ob_start();
+        $autostart='true';
+        $res = learnpath::get_mediaplayer($autostart);
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetName() {
+        //ob_start();
+        $res = learnpath::get_name();
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetNavigationBar() {
+        //ob_start();
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath(self::course, $lp_id, $user_id);
+
+        $res = $obj->get_navigation_bar();
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetNextIndex() {
+        //ob_start();
+        $res = learnpath::get_next_index();
+        $this->assertTrue(is_numeric($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetNextItemId() {
+        //ob_start();
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath(self::course, $lp_id, $user_id);
+
+        $res = $obj->get_next_item_id();
+        $this->assertTrue(is_numeric($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetObjectivesCountFromDb() {
+        //ob_start();
+        $lp_iv_id = 0;
+        $res = learnpath::get_objectives_count_from_db($lp_iv_id);
+        $this->assertTrue(is_numeric($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+    /*
+    public function testGetPackageType() {
+        //ob_start();
+        $file_path = '';
+        $file_name = '';
+        $course='COURSETEST';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath($course, $lp_id, $user_id);
+
+        $res = $obj->get_package_type($file_path, $file_name);
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }*/
+
+    public function testGetPreviewImage() {
+        //ob_start();
+        $res = learnpath::get_preview_image();
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetPreviousIndex() {
+        //ob_start();
+        $res = learnpath::get_previous_index();
+        $this->assertTrue(is_numeric($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetPreviousItemId() {
+        //ob_start();
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath(self::course, $lp_id, $user_id);
+
+        $res = $obj->get_previous_item_id();
+        $this->assertTrue(is_numeric($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetProgress() {
+        //ob_start();
+        $res = learnpath::get_progress();
+        $this->assertTrue(is_numeric($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetProgressBar() {
+        //ob_start();
+        $mode = '';
+        $percentage = -1;
+        $text_add = '';
+        $from_lp = false;
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath(self::course, $lp_id, $user_id);
+
+        $res = $obj->get_progress_bar($mode, $percentage, $text_add, $from_lp);
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetProgressBarMode() {
+        //ob_start();
+        $res = learnpath::get_progress_bar_mode();
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetProgressBarText() {
+        //ob_start();
+        $mode = '';
+        $add = 0;
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath(self::course, $lp_id, $user_id);
+
+        $res = $obj->get_progress_bar_text($mode, $add);
+        $this->assertTrue(is_array($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetProximity() {
+        //ob_start();
+        $res = learnpath::get_proximity();
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetScormPrereqString() {
+        //ob_start();
+        $item_id = 1;
+        $res = learnpath::get_scorm_prereq_string($item_id);
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetScormXmlNode() {
+        //ob_start();
+        $children = 'children';
+        $id = 1;
+        $res = learnpath::get_scorm_xml_node($children, $id);
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetStats() {
+        //ob_start();
+        $res = learnpath::get_stats();
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetStatsCourse() {
+        //ob_start();
+        $course = '';
+        $res = learnpath::get_stats_course($course);
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetStatsLp() {
+        //ob_start();
+        $lp = 1;
+        $res = learnpath::get_stats_lp(self::course, $lp);
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetStatsLpUser() {
+        //ob_start();
+        $lp = 1;
+        $user = 1;
+        $res = learnpath::get_stats_lp_user(self::course, $lp, $user);
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetStatsUser() {
+        //ob_start();
+        $user = 1;
+        $res = learnpath::get_stats_user(self::course, $user);
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetStudentPublications() {
+        //ob_start();
+        $res = learnpath::get_student_publications();
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetTheme() {
+        //ob_start();
+        $res = learnpath::get_theme();
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+    /*
+    public function testGetToc() {
+        //ob_start();
+        $res = learnpath::get_toc();
+        $this->assertTrue(is_array($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 */
-	public function testGetTotalItemsCount() {
-		//ob_start();
-		$res = learnpath::get_total_items_count();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testGetTotalItemsCount() {
+        //ob_start();
+        $res = learnpath::get_total_items_count();
+        $this->assertTrue(is_numeric($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 /*
-	public function testGetTotalItemsCountWithoutChapters() {
-		//ob_start();
-		$res = learnpath::get_total_items_count_without_chapters();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	*/
-	public function testGetType() {
-		//ob_start();
-		$get_name = false;
-		$res=learnpath::get_type($get_name) ;
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetTypeStatic() {
-		//ob_start();
-		$lp_id = 0;
-		$res = learnpath::get_type_static($lp_id);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetUpdateQueue() {
-		//ob_start();
-		$res = learnpath::get_update_queue();
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetUserId() {
-		//ob_start();
-		$res = learnpath::get_user_id();
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testGetTotalItemsCountWithoutChapters() {
+        //ob_start();
+        $res = learnpath::get_total_items_count_without_chapters();
+        $this->assertTrue(is_numeric($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+    */
+    public function testGetType() {
+        //ob_start();
+        $get_name = false;
+        $res=learnpath::get_type($get_name) ;
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetTypeStatic() {
+        //ob_start();
+        $lp_id = 0;
+        $res = learnpath::get_type_static($lp_id);
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetUpdateQueue() {
+        //ob_start();
+        $res = learnpath::get_update_queue();
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testGetUserId() {
+        //ob_start();
+        $res = learnpath::get_user_id();
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 /*
-	public function testGetView() {
-		//ob_start();
-		$attempt_num = 0;
-		$course='COURSETEST';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath($course, $lp_id, $user_id);
-
-		$res = $obj->get_view($attempt_num);
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	*/
-	public function testGetViewId() {
-		//ob_start();
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath(self::course, $lp_id, $user_id);
-
-		$res = $obj->get_view_id();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	/*
-	public function testHasAudio() {
-		//ob_start();
-		$res = learnpath::has_audio();
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}*/
-
-	public function testLearnpath() {
-		//ob_start();
-		$course = '';
-		$lp_id = '';
-		$user_id = '';
-		$res = learnpath::__construct($course, $lp_id, $user_id);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testLog() {
-		//ob_start();
-		$msg = '';
-		$res = learnpath::log($msg);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testMoveDown() {
-		//ob_start();
-		$lp_id = 0;
-		$res = learnpath::move_down($lp_id);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testMoveItem() {
-		//ob_start();
-		$id = 1;
-		$direction = '';
-		$res = learnpath::move_item($id, $direction);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testMoveUp() {
-		//ob_start();
-		$lp_id = 0;
-		$res = learnpath::move_up($lp_id);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	/*
-	public function testNext() {
-		//ob_start();
-		$course='COURSETEST';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath($course, $lp_id, $user_id);
-
-		$res = $obj->next();
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}	*/
-
-	public function testOpen() {
-		//ob_start();
-		$id = '';
-		$res = learnpath::open($id);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testGetView() {
+        //ob_start();
+        $attempt_num = 0;
+        $course='COURSETEST';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath($course, $lp_id, $user_id);
+
+        $res = $obj->get_view($attempt_num);
+        $this->assertTrue(is_numeric($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+    */
+    public function testGetViewId() {
+        //ob_start();
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath(self::course, $lp_id, $user_id);
+
+        $res = $obj->get_view_id();
+        $this->assertTrue(is_numeric($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+    /*
+    public function testHasAudio() {
+        //ob_start();
+        $res = learnpath::has_audio();
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }*/
+
+    public function testLearnpath() {
+        //ob_start();
+        $course = '';
+        $lp_id = '';
+        $user_id = '';
+        $res = learnpath::__construct($course, $lp_id, $user_id);
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testLog() {
+        //ob_start();
+        $msg = '';
+        $res = learnpath::log($msg);
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testMoveDown() {
+        //ob_start();
+        $lp_id = 0;
+        $res = learnpath::move_down($lp_id);
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testMoveItem() {
+        //ob_start();
+        $id = 1;
+        $direction = '';
+        $res = learnpath::move_item($id, $direction);
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testMoveUp() {
+        //ob_start();
+        $lp_id = 0;
+        $res = learnpath::move_up($lp_id);
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+    /*
+    public function testNext() {
+        //ob_start();
+        $course='COURSETEST';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath($course, $lp_id, $user_id);
+
+        $res = $obj->next();
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }	*/
+
+    public function testOpen() {
+        //ob_start();
+        $id = '';
+        $res = learnpath::open($id);
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 /*
-	public function testOverview() {
-		//ob_start();
-		$course='COURSETEST';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath($course, $lp_id, $user_id);
-
-		$res = $obj->overview();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	*/
-	public function testPrerequisitesMatch() {
-		//ob_start();
-		$item = null;
-		$res = learnpath::prerequisites_match($item);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testOverview() {
+        //ob_start();
+        $course='COURSETEST';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath($course, $lp_id, $user_id);
+
+        $res = $obj->overview();
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+    */
+    public function testPrerequisitesMatch() {
+        //ob_start();
+        $item = null;
+        $res = learnpath::prerequisites_match($item);
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 /*
-	public function testPrevious() {
-		//ob_start();
-		$course='COURSETEST';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath($course, $lp_id, $user_id);
-
-		$res = $obj->previous();
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testPrevious() {
+        //ob_start();
+        $course='COURSETEST';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath($course, $lp_id, $user_id);
+
+        $res = $obj->previous();
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 */
-	/*public function testRestart() {
-		//ob_start();
-		$course='COURSETEST';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath($course, $lp_id, $user_id);
-
-		$res = $obj->restart();
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}*/
-
-	public function testSaveCurrent() {
-		//ob_start();
-		$res = learnpath::save_current();
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testSaveItem() {
-		//ob_start();
-		$item_id = null;
-		$from_outside = true;
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath(self::course, $lp_id, $user_id);
-
-		$res = $obj->save_item($item_id, $from_outside);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testSaveLast() {
-		//ob_start();
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath(self::course, $lp_id, $user_id);
-
-		$res = $obj->save_last();
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	/*
-	public function testScormExport() {
-		//ob_start();
-		$course='COURSETEST';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath($course, $lp_id, $user_id);
-
-		$res = $obj->scorm_export();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    /*public function testRestart() {
+        //ob_start();
+        $course='COURSETEST';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath($course, $lp_id, $user_id);
+
+        $res = $obj->restart();
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }*/
+
+    public function testSaveCurrent() {
+        //ob_start();
+        $res = learnpath::save_current();
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testSaveItem() {
+        //ob_start();
+        $item_id = null;
+        $from_outside = true;
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath(self::course, $lp_id, $user_id);
+
+        $res = $obj->save_item($item_id, $from_outside);
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testSaveLast() {
+        //ob_start();
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath(self::course, $lp_id, $user_id);
+
+        $res = $obj->save_last();
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+    /*
+    public function testScormExport() {
+        //ob_start();
+        $course='COURSETEST';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath($course, $lp_id, $user_id);
+
+        $res = $obj->scorm_export();
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 */
-	public function testSetAuthor() {
-		//ob_start();
-		$name = '';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath(self::course, $lp_id, $user_id);
-
-		$res = $obj->set_author($name);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testSetCurrentItem() {
-		//ob_start();
-		$item_id = null;
-		$res = learnpath::set_current_item($item_id);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testSetEncoding() {
-		//ob_start();
-		$enc = 'ISO-8859-15';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath(self::course, $lp_id, $user_id);
-
-		$res = $obj->set_encoding($enc);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testSetErrorMsg() {
-		//ob_start();
-		$error = '';
-		$res = learnpath::set_error_msg($error);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testSetJslib() {
-		//ob_start();
-		$lib = '';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath(self::course, $lp_id, $user_id);
-
-		$res = $obj->set_jslib($lib);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testSetMaker() {
-		//ob_start();
-		$name = '';
-		$res = learnpath::set_maker($name);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testSetName() {
-		//ob_start();
-		$name = '';
-		$res = learnpath::set_name($name);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testSetPreviewImage() {
-		//ob_start();
-		$name = '';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath(self::course, $lp_id, $user_id);
-
-		$res = $obj->set_preview_image($name);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testSetPreviousItem() {
-		//ob_start();
-		$id = '';
-		$res = learnpath::set_previous_item($id);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testSetProximity() {
-		//ob_start();
-		$name = '';
-		$res = learnpath::set_proximity($name);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testSetTermsByPrefix() {
-		//ob_start();
-		$terms_string = '';
-		$prefix = '';
-		$res = learnpath::set_terms_by_prefix($terms_string, $prefix);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testSetTheme() {
-		//ob_start();
-		$name = '';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath(self::course, $lp_id, $user_id);
-
-		$res = $obj->set_theme($name);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	/*
-	public function testSortTreeArray() {
-		//ob_start();
-		$array = '';
-		$course='COURSETEST';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath($course, $lp_id, $user_id);
-
-		$res = $obj->sort_tree_array($array);
-	 	$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	*/
-	public function testStartCurrentItem() {
-		//ob_start();
-		$allow_new_attempt = false;
-		$res = learnpath::start_current_item($allow_new_attempt);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testStopPreviousItem() {
-		//ob_start();
-		$res = learnpath::stop_previous_item();
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testSetAuthor() {
+        //ob_start();
+        $name = '';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath(self::course, $lp_id, $user_id);
+
+        $res = $obj->set_author($name);
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testSetCurrentItem() {
+        //ob_start();
+        $item_id = null;
+        $res = learnpath::set_current_item($item_id);
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testSetEncoding() {
+        //ob_start();
+        $enc = 'ISO-8859-15';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath(self::course, $lp_id, $user_id);
+
+        $res = $obj->set_encoding($enc);
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testSetErrorMsg() {
+        //ob_start();
+        $error = '';
+        $res = learnpath::set_error_msg($error);
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testSetJslib() {
+        //ob_start();
+        $lib = '';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath(self::course, $lp_id, $user_id);
+
+        $res = $obj->set_jslib($lib);
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testSetMaker() {
+        //ob_start();
+        $name = '';
+        $res = learnpath::set_maker($name);
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testSetName() {
+        //ob_start();
+        $name = '';
+        $res = learnpath::set_name($name);
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testSetPreviewImage() {
+        //ob_start();
+        $name = '';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath(self::course, $lp_id, $user_id);
+
+        $res = $obj->set_preview_image($name);
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testSetPreviousItem() {
+        //ob_start();
+        $id = '';
+        $res = learnpath::set_previous_item($id);
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testSetProximity() {
+        //ob_start();
+        $name = '';
+        $res = learnpath::set_proximity($name);
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testSetTermsByPrefix() {
+        //ob_start();
+        $terms_string = '';
+        $prefix = '';
+        $res = learnpath::set_terms_by_prefix($terms_string, $prefix);
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testSetTheme() {
+        //ob_start();
+        $name = '';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath(self::course, $lp_id, $user_id);
+
+        $res = $obj->set_theme($name);
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+    /*
+    public function testSortTreeArray() {
+        //ob_start();
+        $array = '';
+        $course='COURSETEST';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath($course, $lp_id, $user_id);
+
+        $res = $obj->sort_tree_array($array);
+        $this->assertTrue(is_array($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+    */
+    public function testStartCurrentItem() {
+        //ob_start();
+        $allow_new_attempt = false;
+        $res = learnpath::start_current_item($allow_new_attempt);
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testStopPreviousItem() {
+        //ob_start();
+        $res = learnpath::stop_previous_item();
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 /*
-	public function testTogglePublish() {
-		//ob_start();
-		$lp_id = '';
-		$set_visibility = 'v';
-		$res = learnpath::toggle_publish($lp_id, $set_visibility);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	*/
-	public function testToggleVisibility() {
-		//ob_start();
-		$lp_id = '';
-		$set_visibility = 1;
-		$res = learnpath::toggle_visibility($lp_id, $set_visibility);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testTogglePublish() {
+        //ob_start();
+        $lp_id = '';
+        $set_visibility = 'v';
+        $res = learnpath::toggle_publish($lp_id, $set_visibility);
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+    */
+    public function testToggleVisibility() {
+        //ob_start();
+        $lp_id = '';
+        $set_visibility = 1;
+        $res = learnpath::toggle_visibility($lp_id, $set_visibility);
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 /*
-	public function testTreeArray() {
-		//ob_start();
-		$array = '';
-		$res = learnpath::tree_array($array);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testTreeArray() {
+        //ob_start();
+        $array = '';
+        $res = learnpath::tree_array($array);
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 */
-	public function testUpdateDefaultScormCommit() {
-		//ob_start();
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath(self::course, $lp_id, $user_id);
-
-		$res = $obj->update_default_scorm_commit();
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testUpdateDefaultViewMode() {
-		//ob_start();
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath(self::course, $lp_id, $user_id);
-
-		$res = $obj->update_default_view_mode();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testUpdateDisplayOrder() {
-		//ob_start();
-		$res = learnpath::update_display_order();
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testUpdateReinit() {
-		//ob_start();
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath(self::course, $lp_id, $user_id);
-
-		$res = $obj->update_reinit();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testUpdateScormDebug() {
-		//ob_start();
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath(self::course, $lp_id, $user_id);
-
-		$res = $obj->update_scorm_debug();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testUploadImage() {
-		//ob_start();
-		$image_array = '';
-		$res = learnpath::upload_image($image_array);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testUpdateDefaultScormCommit() {
+        //ob_start();
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath(self::course, $lp_id, $user_id);
+
+        $res = $obj->update_default_scorm_commit();
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testUpdateDefaultViewMode() {
+        //ob_start();
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath(self::course, $lp_id, $user_id);
+
+        $res = $obj->update_default_view_mode();
+        $this->assertTrue(is_string($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testUpdateDisplayOrder() {
+        //ob_start();
+        $res = learnpath::update_display_order();
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testUpdateReinit() {
+        //ob_start();
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath(self::course, $lp_id, $user_id);
+
+        $res = $obj->update_reinit();
+        $this->assertTrue(is_numeric($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testUpdateScormDebug() {
+        //ob_start();
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath(self::course, $lp_id, $user_id);
+
+        $res = $obj->update_scorm_debug();
+        $this->assertTrue(is_numeric($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testUploadImage() {
+        //ob_start();
+        $image_array = '';
+        $res = learnpath::upload_image($image_array);
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 /*
-	public function testWriteResourcesTree() {
-		//ob_start();
-		$resources_sorted = '';
-		$num = 0;
-		$res = learnpath::write_resources_tree($resources_sorted, $num);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	public function testDelete() {
-		//ob_start();
-		$course = null;
-		$id = null;
-		$delete = 'keep';
-		$course='COURSETEST';
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath($course, $lp_id, $user_id);
-
-		$res = $obj->delete($course, $id, $delete);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}*/
-
-	public function testDeleteChildrenItems() {
-		//ob_start();
-		$id = '';
-		$res = learnpath::delete_children_items($id);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testDeleteItem() {
-		//ob_start();
-		$id = '';
-		$remove = 'keep';
-		$res = learnpath::delete_item($id, $remove);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testDeleteLpImage() {
-		//ob_start();
-		$lp_id=1;
-		$user_id=1;
-		$obj = new learnpath(self::course, $lp_id, $user_id);
-
-		$res = $obj->delete_lp_image();
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
+    public function testWriteResourcesTree() {
+        //ob_start();
+        $resources_sorted = '';
+        $num = 0;
+        $res = learnpath::write_resources_tree($resources_sorted, $num);
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+    public function testDelete() {
+        //ob_start();
+        $course = null;
+        $id = null;
+        $delete = 'keep';
+        $course='COURSETEST';
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath($course, $lp_id, $user_id);
+
+        $res = $obj->delete($course, $id, $delete);
+        $this->assertTrue(is_null($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }*/
+
+    public function testDeleteChildrenItems() {
+        //ob_start();
+        $id = '';
+        $res = learnpath::delete_children_items($id);
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testDeleteItem() {
+        //ob_start();
+        $id = '';
+        $remove = 'keep';
+        $res = learnpath::delete_item($id, $remove);
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
+
+    public function testDeleteLpImage() {
+        //ob_start();
+        $lp_id=1;
+        $user_id=1;
+        $obj = new learnpath(self::course, $lp_id, $user_id);
+
+        $res = $obj->delete_lp_image();
+        $this->assertTrue(is_bool($res));
+        //ob_end_clean();
+        //var_dump($res);
+    }
 
 
 }

+ 64 - 0
tests/video/index.php

@@ -0,0 +1,64 @@
+<?php
+/**
+ * Script to convert videos to several formats
+ * Put a comment before the exit(); line to enable.
+ * Load in your browser with http(s)://[yourcampus]/tests/video/index.php
+ * @todo Add security filtering for filenames
+ * @author Yannick Warnier <yannick.warnier@beeznest.com>
+ */
+exit();
+ini_set('memory_limit',0);
+ini_set('max_execution_time',0);
+ini_set('upload_max_filesize',0);
+ini_set('post_max_size',0);
+?>
+<html>
+<body>
+<p>
+<form method="post" action="" enctype="multipart/form-data">
+<table>
+<tr><td>Video to convert:</td><td><input type="file" name="video"/></td></tr>
+<tr><td>Desired Codec:</td>
+  <td>
+    <select name="codec">
+      <option value="webm" selected>WebM</option>
+      <option value="ogv">OGV</option>
+    </select>
+  </td>
+</tr>
+<tr><td colspan="2"><input type="submit" name="Convert" value="Convert"></tr>
+</table>
+</form>
+</p>
+<p>
+<?php
+if (!empty($_FILES['video'])) {
+  error_log($_FILES['video']['name']);
+  $orig = dirname(__FILE__).'/upload/'.md5(uniqid(rand(),true)).'-'.$_FILES['video']['name'];
+  $dest = dirname(__FILE__).'/upload/'.md5(uniqid(rand(),true)).'-'.substr($_FILES['video']['name'],0,-3).(($_POST['codec']!='ogv')?'webm':'ogv');
+  error_log($dest);
+  $res = @move_uploaded_file($_FILES['video']['tmp_name'],$orig);
+  if ($res === false) { error_log("Error moving video file: ".$php_error_msg); }
+  error_log('Calling '.'ffmpeg -i '.$orig.' -acodec libvorbis -ac 2 -ab 96k -ar 44100 -b 345k -v quiet -s 1080x720 '.$dest);
+  $ffmpeg = @exec('ffmpeg -i '.$orig.' -acodec libvorbis -ac 2 -ab 96k -ar 44100 -b 345k -v quiet -s 1080x720 '.$dest);
+  if ($ffmpeg === false) { error_log('no'); }
+}
+?>
+</p>
+<p>
+<?php
+echo "Files on server:<br />";
+$list = scandir(dirname(__FILE__).'/upload');
+if (is_array($list)) {
+  foreach ($list as $file) {
+    if (substr($file,0,1) == '.') {
+      continue;
+    } else {
+      echo '<a href="upload/'.$file.'">'.$file.'</a><br />'."\n";
+    }
+  }
+}
+?>
+</p>
+</body>
+</html>