Procházet zdrojové kódy

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

Yannick Warnier před 10 roky
rodič
revize
4d23299c5f
60 změnil soubory, kde provedl 2092 přidání a 2426 odebrání
  1. 311 308
      composer.lock
  2. 1 1
      main/admin/class_list.php
  3. 1 1
      main/admin/configure_homepage.php
  4. 1 1
      main/admin/configure_inscription.php
  5. 1 1
      main/admin/course_request_accepted.php
  6. 1 1
      main/admin/course_request_rejected.php
  7. 1 1
      main/admin/course_request_review.php
  8. 1 1
      main/admin/group_list.php
  9. 1 1
      main/admin/special_exports.php
  10. 1 1
      main/admin/specific_fields.php
  11. 2 2
      main/admin/user_fields.php
  12. 1 1
      main/attendance/attendance_sheet.php
  13. 7 1
      main/calendar/agenda_js.php
  14. 1 1
      main/coursecopy/import_backup.php
  15. 1 1
      main/exercice/exercise_show.php
  16. 1 1
      main/exercice/feedback.php
  17. 127 109
      main/exercice/multiple_answer.class.php
  18. 1 1
      main/exercice/question.class.php
  19. 38 75
      main/exercice/unique_answer.class.php
  20. 1 1
      main/forum/forumfunction.inc.php
  21. 7 11
      main/forum/forumsearch.php
  22. 1 1
      main/gradebook/lib/fe/catform.class.php
  23. 1 1
      main/gradebook/lib/fe/dataform.class.php
  24. 2 2
      main/gradebook/lib/fe/evalform.class.php
  25. 1 1
      main/gradebook/lib/fe/linkform.class.php
  26. 1 1
      main/gradebook/lib/fe/userform.class.php
  27. 2 1
      main/group/group_creation.php
  28. 1 1
      main/inc/introductionSection.inc.php
  29. 3 29
      main/inc/lib/AnnouncementManager.php
  30. 0 1732
      main/inc/lib/add_course.lib.inc.php
  31. 8 1
      main/inc/lib/agenda.lib.php
  32. 4 4
      main/inc/lib/api.lib.php
  33. 28 0
      main/inc/lib/course.lib.php
  34. 3 4
      main/inc/lib/formvalidator/FormValidator.class.php
  35. 7 5
      main/inc/lib/message.lib.php
  36. 28 3
      main/inc/lib/pear/HTML/QuickForm/Renderer/Default.php
  37. 16 10
      main/inc/lib/pear/HTML/QuickForm/advmultiselect.php
  38. 1 1
      main/inc/lib/statistics.lib.php
  39. 76 28
      main/inc/lib/usermanager.lib.php
  40. 4 1
      main/install/configuration.dist.php
  41. 1245 0
      main/install/course.sql
  42. 1 1
      main/install/install.lib.php
  43. 1 1
      main/install/install_db.inc.php
  44. 2 2
      main/install/main.sql
  45. 4 2
      main/install/migrate-db-1.9.0-1.10.0-pre.sql
  46. 1 1
      main/install/update-db-1.8.8-1.9.0.inc.php
  47. 2 2
      main/newscorm/lp_view.php
  48. 16 16
      main/social/search.php
  49. 60 12
      main/survey/survey.lib.php
  50. 48 12
      main/survey/survey_invite.php
  51. 2 6
      main/survey/survey_question.php
  52. 0 2
      main/template/default/layout/main.tpl
  53. 0 2
      main/template/default/layout/show_footer.tpl
  54. 9 13
      main/template/default/social/search.tpl
  55. 1 1
      main/tracking/courseLog.php
  56. 1 1
      main/tracking/course_log_resources.php
  57. 1 1
      main/upload/upload_word.php
  58. 1 1
      main/user/subscribe_user.php
  59. 2 2
      plugin/before_login/index.php
  60. 1 1
      plugin/ticket/src/myticket.php

+ 311 - 308
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "hash": "0f2dd6e4c3c50061a455ff5b91160b38",
+    "hash": "9412d5125c2c1b803ab2ae7a9e587a4b",
     "packages": [
         {
             "name": "aferrandini/phpqrcode",
@@ -164,243 +164,6 @@
             "homepage": "http://elfinder.org",
             "time": "2015-02-11 11:10:51"
         },
-        {
-            "name": "behat/behat",
-            "version": "v2.4.6",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/Behat/Behat.git",
-                "reference": "f1d2964667cf4b21bb6c2c1564f26829a6954155"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/Behat/Behat/zipball/f1d2964667cf4b21bb6c2c1564f26829a6954155",
-                "reference": "f1d2964667cf4b21bb6c2c1564f26829a6954155",
-                "shasum": ""
-            },
-            "require": {
-                "behat/gherkin": "~2.2.9",
-                "php": ">=5.3.1",
-                "symfony/config": "~2.0",
-                "symfony/console": "~2.0",
-                "symfony/dependency-injection": "~2.0",
-                "symfony/event-dispatcher": "~2.0",
-                "symfony/finder": "~2.0",
-                "symfony/translation": "~2.0",
-                "symfony/yaml": "~2.0"
-            },
-            "require-dev": {
-                "phpunit/phpunit": "~3.7.19"
-            },
-            "suggest": {
-                "behat/mink-extension": "for integration with Mink testing framework",
-                "behat/symfony2-extension": "for integration with Symfony2 web framework",
-                "behat/yii-extension": "for integration with Yii web framework"
-            },
-            "bin": [
-                "bin/behat"
-            ],
-            "type": "library",
-            "extra": {
-                "branch-alias": {
-                    "dev-develop": "2.4-dev"
-                }
-            },
-            "autoload": {
-                "psr-0": {
-                    "Behat\\Behat": "src/"
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Konstantin Kudryashov",
-                    "email": "ever.zet@gmail.com",
-                    "homepage": "http://everzet.com"
-                }
-            ],
-            "description": "Scenario-oriented BDD framework for PHP 5.3",
-            "homepage": "http://behat.org/",
-            "keywords": [
-                "BDD",
-                "Behat",
-                "Symfony2"
-            ],
-            "time": "2013-06-06 10:46:48"
-        },
-        {
-            "name": "behat/gherkin",
-            "version": "v2.2.9",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/Behat/Gherkin.git",
-                "reference": "cca2c477921ca38578d6e9759ea5e450f29c2d8f"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/Behat/Gherkin/zipball/cca2c477921ca38578d6e9759ea5e450f29c2d8f",
-                "reference": "cca2c477921ca38578d6e9759ea5e450f29c2d8f",
-                "shasum": ""
-            },
-            "require": {
-                "php": ">=5.3.1",
-                "symfony/finder": ">=2.0,<2.4-dev"
-            },
-            "require-dev": {
-                "symfony/config": ">=2.0,<2.4-dev",
-                "symfony/translation": ">=2.0,<2.4-dev",
-                "symfony/yaml": ">=2.0,<2.4-dev"
-            },
-            "suggest": {
-                "symfony/config": "If you want to use Config component to manage resources",
-                "symfony/translation": "If you want to use Symfony2 translations adapter",
-                "symfony/yaml": "If you want to parse features, represented in YAML files"
-            },
-            "type": "library",
-            "extra": {
-                "branch-alias": {
-                    "dev-develop": "2.2-dev"
-                }
-            },
-            "autoload": {
-                "psr-0": {
-                    "Behat\\Gherkin": "src/"
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Konstantin Kudryashov",
-                    "email": "ever.zet@gmail.com",
-                    "homepage": "http://everzet.com"
-                }
-            ],
-            "description": "Gherkin DSL parser for PHP 5.3",
-            "homepage": "http://behat.org/",
-            "keywords": [
-                "BDD",
-                "Behat",
-                "DSL",
-                "Symfony2",
-                "parser"
-            ],
-            "time": "2013-03-02 10:38:40"
-        },
-        {
-            "name": "behat/mink",
-            "version": "v1.5.0",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/minkphp/Mink.git",
-                "reference": "0769e6d9726c140a54dbf827a438c0f9912749fe"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/minkphp/Mink/zipball/0769e6d9726c140a54dbf827a438c0f9912749fe",
-                "reference": "0769e6d9726c140a54dbf827a438c0f9912749fe",
-                "shasum": ""
-            },
-            "require": {
-                "php": ">=5.3.1",
-                "symfony/css-selector": "~2.0"
-            },
-            "suggest": {
-                "behat/mink-browserkit-driver": "extremely fast headless driver for Symfony\\Kernel-based apps (Sf2, Silex)",
-                "behat/mink-goutte-driver": "fast headless driver for any app without JS emulation",
-                "behat/mink-selenium2-driver": "slow, but JS-enabled driver for any app (requires Selenium2)",
-                "behat/mink-zombie-driver": "fast and JS-enabled headless driver for any app (requires node.js)"
-            },
-            "type": "library",
-            "extra": {
-                "branch-alias": {
-                    "dev-develop": "1.5.x-dev"
-                }
-            },
-            "autoload": {
-                "psr-0": {
-                    "Behat\\Mink": "src/"
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Konstantin Kudryashov",
-                    "email": "ever.zet@gmail.com",
-                    "homepage": "http://everzet.com"
-                }
-            ],
-            "description": "Web acceptance testing framework for PHP 5.3",
-            "homepage": "http://mink.behat.org/",
-            "keywords": [
-                "browser",
-                "testing",
-                "web"
-            ],
-            "time": "2013-04-13 23:39:27"
-        },
-        {
-            "name": "behat/mink-extension",
-            "version": "v1.1.4",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/Behat/MinkExtension.git",
-                "reference": "b4522f19fe96d423883f2e3650615e19d3a48c05"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/Behat/MinkExtension/zipball/b4522f19fe96d423883f2e3650615e19d3a48c05",
-                "reference": "b4522f19fe96d423883f2e3650615e19d3a48c05",
-                "shasum": ""
-            },
-            "require": {
-                "behat/behat": "~2.4.5",
-                "behat/mink": ">=1.4.3,<1.6-dev",
-                "php": ">=5.3.2"
-            },
-            "require-dev": {
-                "behat/mink-goutte-driver": "~1.0"
-            },
-            "type": "behat-extension",
-            "extra": {
-                "branch-alias": {
-                    "dev-master": "1.1.x-dev"
-                }
-            },
-            "autoload": {
-                "psr-0": {
-                    "Behat\\MinkExtension": "src/"
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Konstantin Kudryashov",
-                    "email": "ever.zet@gmail.com",
-                    "homepage": "http://everzet.com"
-                }
-            ],
-            "description": "Mink extension for Behat",
-            "homepage": "http://mink.behat.org",
-            "keywords": [
-                "browser",
-                "gui",
-                "test",
-                "web"
-            ],
-            "time": "2013-06-04 12:18:22"
-        },
         {
             "name": "behat/transliterator",
             "version": "v1.0.1",
@@ -852,16 +615,16 @@
         },
         {
             "name": "cocur/slugify",
-            "version": "v1.0",
+            "version": "v1.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/cocur/slugify.git",
-                "reference": "2c929c56997e663747be9bb635e58db918a0134f"
+                "reference": "2b67d4e2b75dbaed2ebefa9eb5683e8940513847"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/cocur/slugify/zipball/2c929c56997e663747be9bb635e58db918a0134f",
-                "reference": "2c929c56997e663747be9bb635e58db918a0134f",
+                "url": "https://api.github.com/repos/cocur/slugify/zipball/2b67d4e2b75dbaed2ebefa9eb5683e8940513847",
+                "reference": "2b67d4e2b75dbaed2ebefa9eb5683e8940513847",
                 "shasum": ""
             },
             "require": {
@@ -870,7 +633,9 @@
             "require-dev": {
                 "codeclimate/php-test-reporter": "dev-master",
                 "laravel/framework": "~4.1",
+                "latte/latte": "~2.2",
                 "mockery/mockery": "~0.9",
+                "nette/di": "~2.2",
                 "phpunit/phpunit": "~3.7",
                 "sami/sami": "~1.3",
                 "satooshi/php-coveralls": "0.6.*",
@@ -908,7 +673,7 @@
                 "slug",
                 "slugify"
             ],
-            "time": "2014-11-26 22:45:14"
+            "time": "2015-03-18 08:21:30"
         },
         {
             "name": "doctrine/annotations",
@@ -3254,80 +3019,26 @@
             "time": "2015-03-13 17:37:22"
         },
         {
-            "name": "symfony/css-selector",
+            "name": "symfony/debug",
             "version": "v2.6.5",
-            "target-dir": "Symfony/Component/CssSelector",
+            "target-dir": "Symfony/Component/Debug",
             "source": {
                 "type": "git",
-                "url": "https://github.com/symfony/CssSelector.git",
-                "reference": "86cf0aa16065ffc4545374e9479dd7878bf1d90f"
+                "url": "https://github.com/symfony/Debug.git",
+                "reference": "5c1570dea188ade0c6c5e874c2f0a6570587aa1c"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/CssSelector/zipball/86cf0aa16065ffc4545374e9479dd7878bf1d90f",
-                "reference": "86cf0aa16065ffc4545374e9479dd7878bf1d90f",
+                "url": "https://api.github.com/repos/symfony/Debug/zipball/5c1570dea188ade0c6c5e874c2f0a6570587aa1c",
+                "reference": "5c1570dea188ade0c6c5e874c2f0a6570587aa1c",
                 "shasum": ""
             },
             "require": {
-                "php": ">=5.3.3"
+                "php": ">=5.3.3",
+                "psr/log": "~1.0"
             },
-            "require-dev": {
-                "symfony/phpunit-bridge": "~2.7"
-            },
-            "type": "library",
-            "extra": {
-                "branch-alias": {
-                    "dev-master": "2.6-dev"
-                }
-            },
-            "autoload": {
-                "psr-0": {
-                    "Symfony\\Component\\CssSelector\\": ""
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Symfony Community",
-                    "homepage": "http://symfony.com/contributors"
-                },
-                {
-                    "name": "Jean-François Simon",
-                    "email": "jeanfrancois.simon@sensiolabs.com"
-                },
-                {
-                    "name": "Fabien Potencier",
-                    "email": "fabien@symfony.com"
-                }
-            ],
-            "description": "Symfony CssSelector Component",
-            "homepage": "http://symfony.com",
-            "time": "2015-02-24 11:52:21"
-        },
-        {
-            "name": "symfony/debug",
-            "version": "v2.6.5",
-            "target-dir": "Symfony/Component/Debug",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/symfony/Debug.git",
-                "reference": "5c1570dea188ade0c6c5e874c2f0a6570587aa1c"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/symfony/Debug/zipball/5c1570dea188ade0c6c5e874c2f0a6570587aa1c",
-                "reference": "5c1570dea188ade0c6c5e874c2f0a6570587aa1c",
-                "shasum": ""
-            },
-            "require": {
-                "php": ">=5.3.3",
-                "psr/log": "~1.0"
-            },
-            "conflict": {
-                "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2"
+            "conflict": {
+                "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2"
             },
             "require-dev": {
                 "symfony/class-loader": "~2.2",
@@ -5333,7 +5044,299 @@
             "time": "2014-09-16 22:58:11"
         }
     ],
-    "packages-dev": [],
+    "packages-dev": [
+        {
+            "name": "behat/behat",
+            "version": "v2.4.6",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/Behat/Behat.git",
+                "reference": "f1d2964667cf4b21bb6c2c1564f26829a6954155"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/Behat/Behat/zipball/f1d2964667cf4b21bb6c2c1564f26829a6954155",
+                "reference": "f1d2964667cf4b21bb6c2c1564f26829a6954155",
+                "shasum": ""
+            },
+            "require": {
+                "behat/gherkin": "~2.2.9",
+                "php": ">=5.3.1",
+                "symfony/config": "~2.0",
+                "symfony/console": "~2.0",
+                "symfony/dependency-injection": "~2.0",
+                "symfony/event-dispatcher": "~2.0",
+                "symfony/finder": "~2.0",
+                "symfony/translation": "~2.0",
+                "symfony/yaml": "~2.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "~3.7.19"
+            },
+            "suggest": {
+                "behat/mink-extension": "for integration with Mink testing framework",
+                "behat/symfony2-extension": "for integration with Symfony2 web framework",
+                "behat/yii-extension": "for integration with Yii web framework"
+            },
+            "bin": [
+                "bin/behat"
+            ],
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-develop": "2.4-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Behat\\Behat": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Konstantin Kudryashov",
+                    "email": "ever.zet@gmail.com",
+                    "homepage": "http://everzet.com"
+                }
+            ],
+            "description": "Scenario-oriented BDD framework for PHP 5.3",
+            "homepage": "http://behat.org/",
+            "keywords": [
+                "BDD",
+                "Behat",
+                "Symfony2"
+            ],
+            "time": "2013-06-06 10:46:48"
+        },
+        {
+            "name": "behat/gherkin",
+            "version": "v2.2.9",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/Behat/Gherkin.git",
+                "reference": "cca2c477921ca38578d6e9759ea5e450f29c2d8f"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/Behat/Gherkin/zipball/cca2c477921ca38578d6e9759ea5e450f29c2d8f",
+                "reference": "cca2c477921ca38578d6e9759ea5e450f29c2d8f",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.1",
+                "symfony/finder": ">=2.0,<2.4-dev"
+            },
+            "require-dev": {
+                "symfony/config": ">=2.0,<2.4-dev",
+                "symfony/translation": ">=2.0,<2.4-dev",
+                "symfony/yaml": ">=2.0,<2.4-dev"
+            },
+            "suggest": {
+                "symfony/config": "If you want to use Config component to manage resources",
+                "symfony/translation": "If you want to use Symfony2 translations adapter",
+                "symfony/yaml": "If you want to parse features, represented in YAML files"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-develop": "2.2-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Behat\\Gherkin": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Konstantin Kudryashov",
+                    "email": "ever.zet@gmail.com",
+                    "homepage": "http://everzet.com"
+                }
+            ],
+            "description": "Gherkin DSL parser for PHP 5.3",
+            "homepage": "http://behat.org/",
+            "keywords": [
+                "BDD",
+                "Behat",
+                "DSL",
+                "Symfony2",
+                "parser"
+            ],
+            "time": "2013-03-02 10:38:40"
+        },
+        {
+            "name": "behat/mink",
+            "version": "v1.5.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/minkphp/Mink.git",
+                "reference": "0769e6d9726c140a54dbf827a438c0f9912749fe"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/minkphp/Mink/zipball/0769e6d9726c140a54dbf827a438c0f9912749fe",
+                "reference": "0769e6d9726c140a54dbf827a438c0f9912749fe",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.1",
+                "symfony/css-selector": "~2.0"
+            },
+            "suggest": {
+                "behat/mink-browserkit-driver": "extremely fast headless driver for Symfony\\Kernel-based apps (Sf2, Silex)",
+                "behat/mink-goutte-driver": "fast headless driver for any app without JS emulation",
+                "behat/mink-selenium2-driver": "slow, but JS-enabled driver for any app (requires Selenium2)",
+                "behat/mink-zombie-driver": "fast and JS-enabled headless driver for any app (requires node.js)"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-develop": "1.5.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Behat\\Mink": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Konstantin Kudryashov",
+                    "email": "ever.zet@gmail.com",
+                    "homepage": "http://everzet.com"
+                }
+            ],
+            "description": "Web acceptance testing framework for PHP 5.3",
+            "homepage": "http://mink.behat.org/",
+            "keywords": [
+                "browser",
+                "testing",
+                "web"
+            ],
+            "time": "2013-04-13 23:39:27"
+        },
+        {
+            "name": "behat/mink-extension",
+            "version": "v1.1.4",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/Behat/MinkExtension.git",
+                "reference": "b4522f19fe96d423883f2e3650615e19d3a48c05"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/Behat/MinkExtension/zipball/b4522f19fe96d423883f2e3650615e19d3a48c05",
+                "reference": "b4522f19fe96d423883f2e3650615e19d3a48c05",
+                "shasum": ""
+            },
+            "require": {
+                "behat/behat": "~2.4.5",
+                "behat/mink": ">=1.4.3,<1.6-dev",
+                "php": ">=5.3.2"
+            },
+            "require-dev": {
+                "behat/mink-goutte-driver": "~1.0"
+            },
+            "type": "behat-extension",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.1.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Behat\\MinkExtension": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Konstantin Kudryashov",
+                    "email": "ever.zet@gmail.com",
+                    "homepage": "http://everzet.com"
+                }
+            ],
+            "description": "Mink extension for Behat",
+            "homepage": "http://mink.behat.org",
+            "keywords": [
+                "browser",
+                "gui",
+                "test",
+                "web"
+            ],
+            "time": "2013-06-04 12:18:22"
+        },
+        {
+            "name": "symfony/css-selector",
+            "version": "v2.6.5",
+            "target-dir": "Symfony/Component/CssSelector",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/CssSelector.git",
+                "reference": "86cf0aa16065ffc4545374e9479dd7878bf1d90f"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/CssSelector/zipball/86cf0aa16065ffc4545374e9479dd7878bf1d90f",
+                "reference": "86cf0aa16065ffc4545374e9479dd7878bf1d90f",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3"
+            },
+            "require-dev": {
+                "symfony/phpunit-bridge": "~2.7"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.6-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Symfony\\Component\\CssSelector\\": ""
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Symfony Community",
+                    "homepage": "http://symfony.com/contributors"
+                },
+                {
+                    "name": "Jean-François Simon",
+                    "email": "jeanfrancois.simon@sensiolabs.com"
+                },
+                {
+                    "name": "Fabien Potencier",
+                    "email": "fabien@symfony.com"
+                }
+            ],
+            "description": "Symfony CssSelector Component",
+            "homepage": "http://symfony.com",
+            "time": "2015-02-24 11:52:21"
+        }
+    ],
     "aliases": [],
     "minimum-stability": "stable",
     "stability-flags": {

+ 1 - 1
main/admin/class_list.php

@@ -102,7 +102,7 @@ if (isset($_GET['action'])) {
 // Create a search-box
 $form = new FormValidator('search_simple', 'get', '', '', null, false);
 $renderer =& $form->defaultRenderer();
-$renderer->setElementTemplate('<span>{element}</span> ');
+$renderer->setCustomElementTemplate('<span>{element}</span> ');
 $form->addElement('text', 'keyword', get_lang('keyword'));
 $form->addElement('button', 'submit', get_lang('Search'));
 $content .= $form->return_form();

+ 1 - 1
main/admin/configure_homepage.php

@@ -923,7 +923,7 @@ switch ($action) {
 		$renderer =& $form->defaultRenderer();
 		$renderer->setHeaderTemplate('');
 		$renderer->setFormTemplate('<form{attributes}><table border="0" cellpadding="5" cellspacing="0" width="100%">{content}</table></form>');
-		$renderer->setElementTemplate('<tr><td>{element}</td></tr>');
+		$renderer->setCustomElementTemplate('<tr><td>{element}</td></tr>');
 		$renderer->setRequiredNoteTemplate('');
 		$form->addElement('hidden', 'formSent', '1');
 

+ 1 - 1
main/admin/configure_inscription.php

@@ -353,7 +353,7 @@ switch ($action){
         $renderer =& $form->defaultRenderer();
         $renderer->setHeaderTemplate('');
         $renderer->setFormTemplate('<form{attributes}><table border="0" cellpadding="5" cellspacing="0" width="100%">{content}</table></form>');
-        $renderer->setElementTemplate('<tr><td>{element}</td></tr>');
+        $renderer->setCustomElementTemplate('<tr><td>{element}</td></tr>');
         $renderer->setRequiredNoteTemplate('');
         $form->addElement('hidden', 'formSent', '1');
         $default[$name] = str_replace('{rel_path}', api_get_path(REL_PATH), $open);

+ 1 - 1
main/admin/course_request_accepted.php

@@ -146,7 +146,7 @@ if (!$course_validation_feature) {
 // Create a simple search-box.
 $form = new FormValidator('search_simple', 'get', '', '', 'width=200px', false);
 $renderer = $form->defaultRenderer();
-$renderer->setElementTemplate('<span>{element}</span> ');
+$renderer->setCustomElementTemplate('<span>{element}</span> ');
 $form->addElement('text', 'keyword', get_lang('keyword'));
 $form->addButtonSearch(get_lang('Search'));
 

+ 1 - 1
main/admin/course_request_rejected.php

@@ -179,7 +179,7 @@ if (!$course_validation_feature) {
 // Create a simple search-box.
 $form = new FormValidator('search_simple', 'get', '', '', 'width=200px', false);
 $renderer = $form->defaultRenderer();
-$renderer->setElementTemplate('<span>{element}</span> ');
+$renderer->setCustomElementTemplate('<span>{element}</span> ');
 $form->addElement('text', 'keyword', get_lang('keyword'));
 $form->addButtonSearch(get_lang('Search'));
 

+ 1 - 1
main/admin/course_request_review.php

@@ -227,7 +227,7 @@ if (!$course_validation_feature) {
 // Create a simple search-box.
 $form = new FormValidator('search_simple', 'get', '', '', 'width=200px', false);
 $renderer = $form->defaultRenderer();
-$renderer->setElementTemplate('<span>{element}</span> ');
+$renderer->setCustomElementTemplate('<span>{element}</span> ');
 $form->addElement('text', 'keyword', get_lang('keyword'));
 $form->addButtonSearch(get_lang('Search'));
 

+ 1 - 1
main/admin/group_list.php

@@ -377,7 +377,7 @@ if (isset($_GET['search']) && $_GET['search'] == 'advanced') {
     // Create a search-box
     $form = new FormValidator('search_simple', 'get', '', '', null, false);
     $renderer = & $form->defaultRenderer();
-    $renderer->setElementTemplate('<span>{element}</span> ');
+    $renderer->setCustomElementTemplate('<span>{element}</span> ');
     $form->addElement('text', 'keyword', get_lang('keyword'));
     $form->addButtonSearch(get_lang('Search'));
     echo '<div class="actions" style="width:100%;">';

+ 1 - 1
main/admin/special_exports.php

@@ -151,7 +151,7 @@ Display::display_footer();
 function form_special_export() {
     $form = new FormValidator('special_exports','post');
     $renderer = $form->defaultRenderer();
-    $renderer->setElementTemplate('<div>{element}</div> ');
+    $renderer->setCustomElementTemplate('<div>{element}</div> ');
     $form->addElement('radio', 'backup_option', '',  get_lang('SpecialCreateFullBackup'), 'full_backup');
     $form->addElement('radio', 'backup_option', '',  get_lang('SpecialLetMeSelectItems'), 'select_items');
     $form->addElement('html','<br />');

+ 1 - 1
main/admin/specific_fields.php

@@ -27,7 +27,7 @@ include_once $libpath.'specific_fields_manager.lib.php';
 // Create an add-field box
 $form = new FormValidator('add_field','post','','',null,false);
 $renderer =& $form->defaultRenderer();
-$renderer->setElementTemplate('<span>{element}</span> ');
+$renderer->setCustomElementTemplate('<span>{element}</span> ');
 $form->addElement('static','search_advanced_link',null,'<a href="specific_fields_add.php">'.Display::return_icon('fieldadd.gif').get_lang('AddSpecificSearchField').'</a>');
 
 // Create a sortable table with specific fields data

+ 2 - 2
main/admin/user_fields.php

@@ -127,7 +127,7 @@ if(1)
 	// Create an add-field box
 	$form = new FormValidator('add_field','post','','',null,false);
 	$renderer =& $form->defaultRenderer();
-	$renderer->setElementTemplate('<span>{element}</span> ');
+	$renderer->setCustomElementTemplate('<span>{element}</span> ');
 	//$form->addElement('text','label',get_lang('FieldLabel'));
 	//$form->addElement('text','type',get_lang('FieldType'));
 	//$form->addElement('text','title',get_lang('FieldTitle'));
@@ -384,4 +384,4 @@ function delete_user_fields($field_id)
 		// the field was not deleted so we return false
 		return false;
 	}
-}
+}

+ 1 - 1
main/attendance/attendance_sheet.php

@@ -96,7 +96,7 @@ if (api_is_allowed_to_edit(null, true) ||
     }
 
     $renderer = $form->defaultRenderer();
-    $renderer->setElementTemplate('{label} {element} ');
+    $renderer->setCustomElementTemplate('{label} {element} ');
 
     $form->setDefaults(
         array(

+ 7 - 1
main/calendar/agenda_js.php

@@ -201,7 +201,13 @@ if (!empty($userId)) {
 $tpl->assign('web_agenda_ajax_url', $agenda_ajax_url);
 $course_code = api_get_course_id();
 
-$form = new FormValidator('form', 'get', null, null, array('id' => 'add_event_form'));
+$form = new FormValidator(
+    'form',
+    'get',
+    null,
+    null,
+    array('id' => 'add_event_form')
+);
 $form->addElement('html', '<div id="visible_to_input">');
 
 $sendTo = $agenda->parseAgendaFilter($userId);

+ 1 - 1
main/coursecopy/import_backup.php

@@ -161,7 +161,7 @@ if (Security::check_token('post') && (
     );
     $form->addElement('header', get_lang('SelectBackupFile'));
     $renderer = $form->defaultRenderer();
-    $renderer->setElementTemplate('<div>{element}</div> ');
+    $renderer->setCustomElementTemplate('<div>{element}</div> ');
 
     $form->addElement('hidden', 'action', 'restore_backup');
 

+ 1 - 1
main/exercice/exercise_show.php

@@ -542,7 +542,7 @@ foreach ($questionList as $questionId) {
 			$feedback_form->addElement('html','<br>');
 			$renderer =& $feedback_form->defaultRenderer();
 			$renderer->setFormTemplate('<form{attributes}><div align="left">{content}</div></form>');
-			$renderer->setElementTemplate('<div align="left">{element}</div>');
+			$renderer->setCustomElementTemplate('<div align="left">{element}</div>');
 			$comnt = Event::get_comments($id, $questionId);
 			$default = array('comments_'.$questionId =>  $comnt);
 

+ 1 - 1
main/exercice/feedback.php

@@ -52,7 +52,7 @@ Display::display_header($nameTools,"Exercise");
 	$form = new FormValidator('feedbackform','post',api_get_self()."?".api_get_cidreq()."&modifyQuestion=".$modifyQuestion."&newQuestion=".$newQuestion);
 	$obj_registration_form = new HTML_QuickForm('frmRegistration', 'POST');
 	$renderer =& $obj_registration_form->defaultRenderer();
-	$renderer->setElementTemplate(
+	$renderer->setCustomElementTemplate(
 '<tr>
 	<td align="left" style="" valign="top" width=30%>{label}
 		<!-- BEGIN required --><span style="color: #ff0000">*</span><!-- END required -->

+ 127 - 109
main/exercice/multiple_answer.class.php

@@ -26,126 +26,144 @@ class MultipleAnswer extends Question
 	}
 
 	/**
-	 * function which redifines Question::createAnswersForm
-	 * @param the formvalidator instance
-	 * @param the answers number to display
-	 */
-	function createAnswersForm ($form)
+     * function which redifines Question::createAnswersForm
+     * @param the formvalidator instance
+     * @param the answers number to display
+     */
+    function createAnswersForm($form)
     {
-
-		$nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 4;  // The previous default value was 2. See task #1759.
-		$nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0));
-
-		$obj_ex = $_SESSION['objExercise'];
-
-		$html='<table class="data_table">
-					<tr>
-						<th width="10px">
-							'.get_lang('Number').'
-						</th>
-						<th width="10px">
-							'.get_lang('True').'
-						</th>
-						<th width="50%">
-							'.get_lang('Answer').'
-						</th>';
-				// show column comment when feedback is enable
-                $html .='<th>
-                            '.get_lang('Comment').'
-                        </th>';
-				$html .= '<th width="50px">
-							'.get_lang('Weighting').'
-						</th>
-					</tr>';
-		$form -> addElement ('label', get_lang('Answers').'<br /> <img src="../img/fill_field.png">', $html);
-
-		$defaults = array();
-		$correct = 0;
+        $editorConfig = array(
+            'ToolbarSet' => 'TestProposedAnswer',
+            'Width' => '100%',
+            'Height' => '125'
+        );
+
+        $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 4;  // The previous default value was 2. See task #1759.
+        $nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0));
+
+        $obj_ex = $_SESSION['objExercise'];
+
+        $form->addHeader(get_lang('Answers'));
+
+        $html = '<table class="table table-striped table-hover">
+            <thead>
+                <tr>
+                    <th width="10">' . get_lang('Number') . '</th>
+                    <th width="10">' . get_lang('True') . '</th>
+                    <th width="50%">' . get_lang('Answer') . '</th>
+                    <th width="50%">' . get_lang('Comment') . '</th>
+                    <th width="10">' . get_lang('Weighting') . '</th>
+                </tr>
+            </thead>
+            <tbody>';
+
+        $form->addHtml($html);
+
+        $defaults = array();
+        $correct = 0;
         $answer = false;
-		if(!empty($this -> id))	{
-			$answer = new Answer($this -> id);
-			$answer -> read();
-			if(count($answer->nbrAnswers)>0 && !$form->isSubmitted()) {
-				$nb_answers = $answer->nbrAnswers;
-			}
-		}
-
-		$form -> addElement('hidden', 'nb_answers');
-		$boxes_names = array();
-
-		if ($nb_answers < 1) {
-			$nb_answers = 1;
-			Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer'));
-		}
-
-		for ($i = 1 ; $i <= $nb_answers ; ++$i) {
-			if(is_object($answer)) {
-				$defaults['answer['.$i.']'] = $answer -> answer[$i];
-				$defaults['comment['.$i.']'] = $answer -> comment[$i];
-				$defaults['weighting['.$i.']'] = float_format($answer -> weighting[$i], 1);
-				$defaults['correct['.$i.']'] = $answer -> correct[$i];
-			} else {
-				$defaults['answer[1]']  = get_lang('DefaultMultipleAnswer2');
-				$defaults['comment[1]'] = get_lang('DefaultMultipleComment2');
-				$defaults['correct[1]'] = true;
-				$defaults['weighting[1]'] = 10;
-
-				$defaults['answer[2]']  = get_lang('DefaultMultipleAnswer1');
-				$defaults['comment[2]'] = get_lang('DefaultMultipleComment1');
-				$defaults['correct[2]'] = false;
-				$defaults['weighting[2]'] = -5;
-			}
-			$renderer = & $form->defaultRenderer();
-
-            $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'correct['.$i.']');
-            $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'counter['.$i.']');
-            $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'answer['.$i.']');
-            $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'comment['.$i.']');
-            $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'weighting['.$i.']');
-
-			$answer_number=$form->addElement('text', 'counter['.$i.']', null, 'value="'.$i.'"');
-			$answer_number->freeze();
+        if (!empty($this->id)) {
+            $answer = new Answer($this->id);
+            $answer->read();
+            if (count($answer->nbrAnswers) > 0 && !$form->isSubmitted()) {
+                $nb_answers = $answer->nbrAnswers;
+            }
+        }
 
-			$form->addElement('checkbox', 'correct['.$i.']', null, null, 'class="checkbox" style="margin-left: 0em;"');
-			$boxes_names[] = 'correct['.$i.']';
+        $form->addElement('hidden', 'nb_answers');
+        $boxes_names = array();
 
-			$form->addElement('html_editor', 'answer['.$i.']',null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
-			$form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required');
+        if ($nb_answers < 1) {
+            $nb_answers = 1;
+            Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer'));
+        }
 
-				$form->addElement('html_editor', 'comment['.$i.']',null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
+        for ($i = 1; $i <= $nb_answers; ++$i) {
+            $form->addHtml('<tr>');
+
+            if (is_object($answer)) {
+                $defaults['answer[' . $i . ']'] = $answer->answer[$i];
+                $defaults['comment[' . $i . ']'] = $answer->comment[$i];
+                $defaults['weighting[' . $i . ']'] = float_format($answer->weighting[$i], 1);
+                $defaults['correct[' . $i . ']'] = $answer->correct[$i];
+            } else {
+                $defaults['answer[1]'] = get_lang('DefaultMultipleAnswer2');
+                $defaults['comment[1]'] = get_lang('DefaultMultipleComment2');
+                $defaults['correct[1]'] = true;
+                $defaults['weighting[1]'] = 10;
+
+                $defaults['answer[2]'] = get_lang('DefaultMultipleAnswer1');
+                $defaults['comment[2]'] = get_lang('DefaultMultipleComment1');
+                $defaults['correct[2]'] = false;
+                $defaults['weighting[2]'] = -5;
+            }
+            $renderer = & $form->defaultRenderer();
+
+            $renderer->setElementTemplate(
+                '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
+                'correct[' . $i . ']'
+            );
+            $renderer->setElementTemplate(
+                '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
+                'counter[' . $i . ']'
+            );
+            $renderer->setElementTemplate(
+                '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
+                'answer[' . $i . ']'
+            );
+            $renderer->setElementTemplate(
+                '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
+                'comment[' . $i . ']'
+            );
+            $renderer->setElementTemplate(
+                '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
+                'weighting[' . $i . ']'
+            );
+
+            $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"');
+            $answer_number->freeze();
+
+            $form->addElement('checkbox', 'correct[' . $i . ']', null, null,
+                'class="checkbox" style="margin-left: 0em;"');
+            $boxes_names[] = 'correct[' . $i . ']';
+
+            $form->addHtmlEditor("answer[$i]", null, null, true, $editorConfig);
+            $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required');
+
+            $form->addHtmlEditor("comment[$i]", null, null, true, $editorConfig);
+
+            $form->addElement('text', 'weighting[' . $i . ']', null, array('class' => "span1", 'value' => '0'));
+            $form->addHtml('</tr>');
+        }
 
-			$form->addElement('text', 'weighting['.$i.']',null, array('class' => "span1", 'value' => '0'));
-			$form -> addElement ('html', '</tr>');
-		}
-		$form -> addElement ('html', '</table>');
-		$form -> addElement ('html', '<br />');
+        $form->addHtml('</tbody>');
+        $form->addHtml('</table>');
 
-		$form -> add_multiple_required_rule ($boxes_names , get_lang('ChooseAtLeastOneCheckbox') , 'multiple_required');
+        $form->add_multiple_required_rule($boxes_names, get_lang('ChooseAtLeastOneCheckbox'), 'multiple_required');
 
-		global $text, $class;
-		if ($obj_ex->edit_exercise_in_lp == true) {
-			// setting the save button here and not in the question class.php
-			$form->addElement('style_submit_button', 'lessAnswers', get_lang('LessAnswer'),'class="btn minus"');
-			$form->addElement('style_submit_button', 'moreAnswers', get_lang('PlusAnswer'),'class="btn plus"');
-			$form->addElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"');
-		}
+        global $text, $class;
+        if ($obj_ex->edit_exercise_in_lp == true) {
+            // setting the save button here and not in the question class.php
+            $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers');
+            $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers');
+            $form->addButtonSave($text, 'submitQuestion');
+        }
 
-		$renderer->setElementTemplate('{element}&nbsp;','lessAnswers');
-		$renderer->setElementTemplate('{element}&nbsp;','submitQuestion');
-		$renderer->setElementTemplate('{element}&nbsp;','moreAnswers');
-		$form -> addElement ('html', '</div></div>');
+        $renderer->setElementTemplate('<div class="form-group"><div class="col-sm-offset-2">{element}', 'lessAnswers');
+        $renderer->setElementTemplate('{element}', 'moreAnswers');
+        $renderer->setElementTemplate('{element}</div></div>', 'submitQuestion');
 
-		$defaults['correct'] = $correct;
+        $defaults['correct'] = $correct;
 
-		if (!empty($this -> id)) {
-			$form -> setDefaults($defaults);
-		} else {
-			if ($this -> isContent == 1) {
-				$form -> setDefaults($defaults);
-			}
-		}
-		$form->setConstants(array('nb_answers' => $nb_answers));
-	}
+        if (!empty($this->id)) {
+            $form->setDefaults($defaults);
+        } else {
+            if ($this->isContent == 1) {
+                $form->setDefaults($defaults);
+            }
+        }
+        $form->setConstants(array('nb_answers' => $nb_answers));
+    }
 
 
 	/**

+ 1 - 1
main/exercice/question.class.php

@@ -1254,7 +1254,7 @@ abstract class Question
 			<a href="javascript://" onclick=" return show_media()"><span id="media_icon"><img style="vertical-align: middle;" src="../img/looknfeel.png" alt="" />&nbsp;'.get_lang('EnrichQuestion').'</span></a>
 		');
 
-        $form->addElement ('html','<div class="HideFCKEditor" id="HiddenFCKquestionDescription" >');
+        $form->addElement ('html','<div class="HideFCKEditor" id="HiddenFCKquestionDescription" style="display: none;" >');
         $form->addHtmlEditor('questionDescription', get_lang('QuestionDescription'), false, false, $editor_config);
         $form->addElement ('html','</div>');
 

+ 38 - 75
main/exercice/unique_answer.class.php

@@ -45,14 +45,14 @@ class UniqueAnswer extends Question
 
         //this line defines how many questions by default appear when creating a choice question
         // The previous default value was 2. See task #1759.
-        $nb_answers = isset($_POST['nb_answers']) ? (int)$_POST['nb_answers'] : 4;
+        $nb_answers = isset($_POST['nb_answers']) ? (int) $_POST['nb_answers'] : 4;
         $nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0));
 
         /*
-             Types of Feedback
-             $feedback_option[0]=get_lang('Feedback');
-            $feedback_option[1]=get_lang('DirectFeedback');
-            $feedback_option[2]=get_lang('NoFeedback');
+          Types of Feedback
+          $feedback_option[0]=get_lang('Feedback');
+          $feedback_option[1]=get_lang('DirectFeedback');
+          $feedback_option[2]=get_lang('NoFeedback');
          */
 
         $feedback_title = '';
@@ -61,34 +61,27 @@ class UniqueAnswer extends Question
             //Scenario
             $editor_config['Width'] = '250';
             $editor_config['Height'] = '110';
-            $comment_title = '<th width="500px" >' . get_lang('Comment') . '</th>';
-            $feedback_title = '<th width="350px" >' . get_lang('Scenario') . '</th>';
+            $comment_title = '<th width="50%" >' . get_lang('Comment') . '</th>';
+            $feedback_title = '<th width="50%" >' . get_lang('Scenario') . '</th>';
         } else {
-            $comment_title = '<th>' . get_lang('Comment') . '</th>';
+            $comment_title = '<th width="50%">' . get_lang('Comment') . '</th>';
         }
 
-        $html = '<table class="data_table">
+        $html = '<table class="table table-striped table-hover">
+            <thead>
                 <tr style="text-align: center;">
-                    <th width="10px">
-                        ' . get_lang('Number') . '
-                    </th>
-                    <th width="10px" >
-                        ' . get_lang('True') . '
-                    </th>
-                    <th width="50%">
-                        ' . get_lang('Answer') . '
-                    </th>
+                    <th width="10">' . get_lang('Number') . '</th>
+                    <th width="10" >' . get_lang('True') . '</th>
+                    <th width="50%">' . get_lang('Answer') . '</th>
                         ' . $comment_title . '
                         ' . $feedback_title . '
-                    <th width="50px">
-                        ' . get_lang('Weighting') . '
-                    </th>
-                </tr>';
-
-        $form->addLabel(
-            get_lang('Answers') . '<br /> <img src="../img/fill_field.png">',
-            $html
-        );
+                    <th width="10">' . get_lang('Weighting') . '</th>
+                </tr>
+            </thead>
+            <tbody>';
+
+        $form->addHeader(get_lang('Answers'));
+        $form->addHtml($html);
 
         $defaults = array();
         $correct = 0;
@@ -113,8 +106,7 @@ class UniqueAnswer extends Question
                 }
                 $question = Question::read($questionid);
                 $select_question[$questionid] = 'Q' . $key . ' :' . cut(
-                    $question->selectTitle(),
-                    20
+                    $question->selectTitle(), 20
                 );
             }
         }
@@ -139,7 +131,7 @@ class UniqueAnswer extends Question
         }
 
         for ($i = 1; $i <= $nb_answers; ++$i) {
-            $form->addElement('html', '<tr>');
+            $form->addHtml('<tr>');
             if (isset($answer) && is_object($answer)) {
                 if ($answer->correct[$i]) {
                     $correct = $i;
@@ -208,33 +200,22 @@ class UniqueAnswer extends Question
             );
 
             $answer_number = $form->addElement(
-                'text',
-                'counter[' . $i . ']',
-                null,
-                ' value = "' . $i . '"'
+                'text', 'counter[' . $i . ']', null, ' value = "' . $i . '"'
             );
             $answer_number->freeze();
             $form->addElement(
-                'radio',
-                'correct',
-                null,
-                null,
-                $i,
-                'class="checkbox"'
+                'radio', 'correct', null, null, $i, 'class="checkbox"'
             );
 
-            $form->addHtmlEditor('answer[' . $i . ']',null,null,true, $editor_config);
+            $form->addHtmlEditor('answer[' . $i . ']', null, null, true, $editor_config);
 
             $form->addRule(
-                'answer[' . $i . ']',
-                get_lang('ThisFieldIsRequired'),
-                'required'
+                'answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required'
             );
 
             if ($obj_ex->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) {
-                $form->addHtmlEditor('comment[' . $i . ']',null,null,false,$editor_config);
+                $form->addHtmlEditor('comment[' . $i . ']', null, null, false, $editor_config);
                 // Direct feedback
-
                 //Adding extra feedback fields
                 $group = array();
                 $group['try' . $i] = $form->createElement(
@@ -270,16 +251,15 @@ class UniqueAnswer extends Question
                     '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}',
                     'scenario'
                 );
-
             } else {
-                $form->addHtmlEditor('comment[' . $i . ']',null,null,false,$editor_config);
+                $form->addHtmlEditor('comment[' . $i . ']', null, null, false, $editor_config);
             }
-            $form->addText('weighting[' . $i . ']', null,null, array('class' => "col-md-1", 'value' => '0'));
-            $form->addElement('html', '</tr>');
+            $form->addText('weighting[' . $i . ']', null, null, array('class' => "col-md-1", 'value' => '0'));
+            $form->addHtml('</tr>');
         }
 
-        $form->addElement('html', '</table>');
-        $form->addElement('html', '<br />');
+        $form->addHtml('</tbody>');
+        $form->addHtml('</table>');
 
         $navigator_info = api_get_navigator();
 
@@ -308,31 +288,15 @@ class UniqueAnswer extends Question
                 );
             } else {
                 //setting the save button here and not in the question class.php
-                $form->addElement(
-                    'style_submit_button',
-                    'lessAnswers',
-                    get_lang('LessAnswer'),
-                    'class="btn btn-primary"'
-                );
-                $form->addElement(
-                    'style_submit_button',
-                    'moreAnswers',
-                    get_lang('PlusAnswer'),
-                    'class="btn btn-primary"'
-                );
-                $form->addElement(
-                    'style_submit_button',
-                    'submitQuestion',
-                    $text,
-                    'class="' . $class . '"'
-                );
+                $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers');
+                $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers');
+                $form->addButtonSave($text, 'submitQuestion');
             }
         }
-        $renderer->setElementTemplate('{element}&nbsp;', 'submitQuestion');
-        $renderer->setElementTemplate('{element}&nbsp;', 'lessAnswers');
-        $renderer->setElementTemplate('{element}&nbsp;', 'moreAnswers');
 
-        $form->addHtml('</div></div>');
+        $renderer->setElementTemplate('<div class="form-group"><div class="col-sm-offset-2">{element}', 'lessAnswers');
+        $renderer->setElementTemplate('{element}', 'moreAnswers');
+        $renderer->setElementTemplate('{element}</div></div>', 'submitQuestion');
 
         // We check the first radio button to be sure a radio button will be check
         if ($correct == 0) {
@@ -350,7 +314,6 @@ class UniqueAnswer extends Question
             } else {
                 $form->setDefaults(array('correct' => 1));
             }
-
         }
         $form->setConstants(array('nb_answers' => $nb_answers));
     }

+ 1 - 1
main/forum/forumfunction.inc.php

@@ -3772,7 +3772,7 @@ function forum_search()
 
     // Setting the form elements.
     $form->addElement('header', '', get_lang('ForumSearch'));
-    $form->addElement('text', 'search_term', get_lang('SearchTerm'), 'class="input_titles" id="search_title"');
+    $form->addElement('text', 'search_term', get_lang('SearchTerm'), array('id' =>'search_title'));
     $form->applyFilter('search_term', 'html_filter');
     $form->addElement('static', 'search_information', '', get_lang('ForumSearchInformation'));
     $form->addButtonSearch(get_lang('Search'));

+ 7 - 11
main/forum/forumsearch.php

@@ -62,20 +62,16 @@ if (!empty($gradebook) && $gradebook == 'view') {
     );
 }
 
-if (!empty ($_GET['gidReq'])) {
-    $toolgroup = Database::escape_string($_GET['gidReq']);
-    Session::write('toolgroup',$toolgroup);
-}
+$groupId = api_get_group_id();
 
 if ($origin == 'group') {
-    $_clean['toolgroup']=(int)$_SESSION['toolgroup'];
-    $group_properties  = GroupManager :: get_group_properties($_clean['toolgroup']);
-    $interbreadcrumb[] = array('url' => '../group/group.php', 'name' => get_lang('Groups'));
-    $interbreadcrumb[] = array('url' => '../group/group_space.php?gidReq='.$_SESSION['toolgroup'], 'name' => get_lang('GroupSpace').' ('.$group_properties['name'].')');
-    $interbreadcrumb[] = array('url' => 'viewforum.php?origin='.$origin.'&amp;gidReq='.$_SESSION['toolgroup'].'&amp;forum='.Security::remove_XSS($_GET['forum']), 'name' => prepare4display($current_forum['forum_title']));
-    $interbreadcrumb[] = array('url' => 'forumsearch.php','name' => get_lang('ForumSearch'));
+    $group_properties  = GroupManager :: get_group_properties($groupId);
+    $interbreadcrumb[] = array('url' => '../group/group.php?'.api_get_cidreq(), 'name' => get_lang('Groups'));
+    $interbreadcrumb[] = array('url' => '../group/group_space.php?'.api_get_cidreq(), 'name' => get_lang('GroupSpace').' ('.$group_properties['name'].')');
+    $interbreadcrumb[] = array('url' => 'viewforum.php?origin='.$origin.'&forum='.Security::remove_XSS($_GET['forum']).'&'.api_get_cidreq(), 'name' => prepare4display($current_forum['forum_title']));
+    $interbreadcrumb[] = array('url' => 'forumsearch.php?'.api_get_cidreq(),'name' => get_lang('ForumSearch'));
 } else {
-    $interbreadcrumb[] = array('url' => 'index.php?gradebook='.$gradebook.'', 'name' => $nameTools);
+    $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq(), 'name' => $nameTools);
     //$interbreadcrumb[] = array('url' => 'forumsearch.php', 'name' => );
     $nameTools = get_lang('ForumSearch');
 }

+ 1 - 1
main/gradebook/lib/fe/catform.class.php

@@ -53,7 +53,7 @@ class CatForm extends FormValidator
     protected function build_move_form()
     {
         $renderer =& $this->defaultRenderer();
-        $renderer->setElementTemplate('<span>{element}</span> ');
+        $renderer->setCustomElementTemplate('<span>{element}</span> ');
         $this->addElement(
             'static',
             null,

+ 1 - 1
main/gradebook/lib/fe/dataform.class.php

@@ -42,7 +42,7 @@ class DataForm extends FormValidator
 	protected function build_pdf_export_form()
 	{
 		$renderer =& $this->defaultRenderer();
-		$renderer->setElementTemplate('<span>{element}</span>');
+		$renderer->setCustomElementTemplate('<span>{element}</span>');
 		$this->addElement('header', get_lang('ChooseOrientation'));
 		$this->addElement('radio', 'orientation', null, get_lang('Portrait'), 'portrait');
 		$this->addElement('radio', 'orientation', null, get_lang('Landscape'), 'landscape');

+ 2 - 2
main/gradebook/lib/fe/evalform.class.php

@@ -214,7 +214,7 @@ class EvalForm extends FormValidator
     protected function build_move_form()
     {
         $renderer = & $this->defaultRenderer();
-        $renderer->setElementTemplate('<span>{element}</span> ');
+        $renderer->setCustomElementTemplate('<span>{element}</span> ');
         $this->addElement('static', null, null, '"' . $this->evaluation_object->get_name() . '" ');
         $this->addElement('static', null, null, get_lang('MoveTo') . ' : ');
         $select = $this->addElement('select', 'move_cat', null, null);
@@ -332,7 +332,7 @@ class EvalForm extends FormValidator
         ));
         $userinfo = api_get_user_info($this->result_object->get_user_id());
         $renderer = & $this->defaultRenderer();
-        $renderer->setElementTemplate('<span>{element}</span> ');
+        $renderer->setCustomElementTemplate('<span>{element}</span> ');
         $this->addElement('label', get_lang('User'), $userinfo['complete_name']);
 
         $this->addText('score', array(get_lang('Score'), null, '/ ' . $this->evaluation_object->get_max()), false, array(

+ 1 - 1
main/gradebook/lib/fe/linkform.class.php

@@ -57,7 +57,7 @@ class LinkForm extends FormValidator
 	protected function build_move()
 	{
 		$renderer =& $this->defaultRenderer();
-		$renderer->setElementTemplate('<span>{element}</span> ');
+		$renderer->setCustomElementTemplate('<span>{element}</span> ');
 		$this->addElement('static',null,null,'"'.$this->link_object->get_name().'" ');
 		$this->addElement('static',null,null,get_lang('MoveTo').' : ');
 		$select = $this->addElement('select','move_cat',null,null);

+ 1 - 1
main/gradebook/lib/fe/userform.class.php

@@ -46,7 +46,7 @@ class UserForm extends FormValidator
 			));
 		}
 		$renderer =& $this->defaultRenderer();
-		$renderer->setElementTemplate('<span>{element}</span> ');
+		$renderer->setCustomElementTemplate('<span>{element}</span> ');
 		$this->addElement('text','keyword','');
 		$this->addElement('style_submit_button','submit',get_lang('Search'),'class="search"');
 	}

+ 2 - 1
main/group/group_creation.php

@@ -155,7 +155,7 @@ elseif (isset($_POST['number_of_groups'])) {
 	</tr>
 
 EOT;
-		$renderer->setElementTemplate($element_template);
+		$renderer->setCustomElementTemplate($element_template);
         $form->addElement('header', $nameTools);
 		$form->addElement('hidden', 'action');
 		$form->addElement('hidden', 'number_of_groups');
@@ -163,6 +163,7 @@ EOT;
 		// Table heading
 		$group_el = array ();
 		$group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupName').'</b>');
+
 		if (api_get_setting('allow_group_categories') == 'true') {
 			$group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupCategory').'</b>');
 		}

+ 1 - 1
main/inc/introductionSection.inc.php

@@ -50,7 +50,7 @@ if (!empty($courseId)) {
 }
 
 $renderer =& $form->defaultRenderer();
-$renderer->setElementTemplate('<div style="width: 80%; margin: 0px auto; padding-bottom: 10px; ">{element}</div>');
+$renderer->setCustomElementTemplate('<div style="width: 80%; margin: 0px auto; padding-bottom: 10px; ">{element}</div>');
 
 $toolbar_set = 'IntroductionTool';
 $width = '100%';

+ 3 - 29
main/inc/lib/AnnouncementManager.php

@@ -374,7 +374,7 @@ class AnnouncementManager
                     '0'
                 );
             } else {
-                $send_to = self::separate_users_groups($sentTo);
+                $send_to = CourseManager::separateUsersGroups($sentTo);
 
                 // Storing the selected groups
                 if (is_array($send_to['groups']) && !empty($send_to['groups'])) {
@@ -460,7 +460,7 @@ class AnnouncementManager
         // store in item_property (first the groups, then the users
 
         if (!isset($to_users)) { // !isset($to): when no user is selected we send it to everyone
-            $send_to = self::separate_users_groups($to);
+            $send_to = CourseManager::separateUsersGroups($to);
             // storing the selected groups
             if (is_array($send_to['groups'])) {
                 foreach ($send_to['groups'] as $group) {
@@ -541,7 +541,7 @@ class AnnouncementManager
         if (!is_null($to)) {
             // !is_null($to): when no user is selected we send it to everyone
 
-            $send_to = self::separate_users_groups($to);
+            $send_to = CourseManager::separateUsersGroups($to);
 
             // storing the selected groups
             if (is_array($send_to['groups'])) {
@@ -1088,33 +1088,7 @@ class AnnouncementManager
         }
     }
 
-    /**
-     * This function separates the users from the groups
-     * users have a value USER:XXX (with XXX the groups id have a value
-     *  GROUP:YYY (with YYY the group id)
-     * @param    array   Array of strings that define the type and id of each destination
-     * @return   array   Array of groups and users (each an array of IDs)
-     */
-    public static function separate_users_groups($to)
-    {
-        $grouplist = array();
-        $userlist = array();
-        foreach ($to as $to_item) {
-            list($type, $id) = explode(':', $to_item);
-            switch ($type) {
-                case 'GROUP':
-                    $grouplist[] = intval($id);
-                    break;
-                case 'USER':
-                    $userlist[] = intval($id);
-                    break;
-            }
-        }
 
-        $send_to['groups'] = $grouplist;
-        $send_to['users'] = $userlist;
-        return $send_to;
-    }
 
     /**
      * Returns all the users and all the groups a specific announcement item

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 1732
main/inc/lib/add_course.lib.inc.php


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

@@ -2232,7 +2232,14 @@ class Agenda
             if ($this->type == 'course') {
                 $form = null;
                 if (!isset($_GET['action'])) {
-                    $form = new FormValidator('form-search');
+
+                    $form = new FormValidator(
+                        'form-search',
+                        'post',
+                        '',
+                        '',
+                        array(),
+                        FormValidator::LAYOUT_INLINE);
                     $attributes = array(
                         'multiple' => false,
                         'id' => 'select_form_id_search'

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

@@ -3326,10 +3326,10 @@ function api_not_allowed($print_headers = false, $message = null)
         // If the user has no user ID, then his session has expired
         $action = api_get_self().'?'.Security::remove_XSS($_SERVER['QUERY_STRING']);
         $action = str_replace('&amp;', '&', $action);
-        $form = new FormValidator('formLogin', 'post', $action, null, array('class'=>'form-stacked'));
-        $form->addElement('text', 'login', null, array('placeholder' => get_lang('UserName'), 'class' => 'span3 autocapitalize_off')); //new
-        $form->addElement('password', 'password', null, array('placeholder' => get_lang('Password'), 'class' => 'span3')); //new
-        $form->addElement('style_submit_button', 'submitAuth', get_lang('LoginEnter'), array('class' => 'btn span3'));
+        $form = new FormValidator('formLogin', 'post', $action, null, array(), FormValidator::LAYOUT_BOX_NO_LABEL);
+        $form->addElement('text', 'login', null, array('placeholder' => get_lang('UserName'), 'class' => 'autocapitalize_off'));
+        $form->addElement('password', 'password', null, array('placeholder' => get_lang('Password')));
+        $form->addButton('submitAuth', get_lang('LoginEnter'), '', 'primary');
 
         // see same text in auth/gotocourse.php and main_api.lib.php function api_not_allowed (above)
         $content = Display::return_message(get_lang('NotAllowed'), 'error', false);

+ 28 - 0
main/inc/lib/course.lib.php

@@ -5330,6 +5330,34 @@ class CourseManager
         );
     }
 
+    /**
+     * This function separates the users from the groups
+     * users have a value USER:XXX (with XXX the groups id have a value
+     *  GROUP:YYY (with YYY the group id)
+     * @param    array   Array of strings that define the type and id of each destination
+     * @return   array   Array of groups and users (each an array of IDs)
+     */
+    public static function separateUsersGroups($to)
+    {
+        $grouplist = array();
+        $userlist = array();
+        foreach ($to as $to_item) {
+            list($type, $id) = explode(':', $to_item);
+            switch ($type) {
+                case 'GROUP':
+                    $grouplist[] = intval($id);
+                    break;
+                case 'USER':
+                    $userlist[] = intval($id);
+                    break;
+            }
+        }
+
+        $send_to['groups'] = $grouplist;
+        $send_to['users'] = $userlist;
+        return $send_to;
+    }
+
     /**
      * this function shows the form for sending a message to a specific group or user.
      */

+ 3 - 4
main/inc/lib/formvalidator/FormValidator.class.php

@@ -118,8 +118,7 @@ class FormValidator extends HTML_QuickForm
         $this->setRequiredNote('<span class="form_required">*</span> <small>' . get_lang('ThisFieldIsRequired') . '</small>');
         $noteTemplate = <<<EOT
 	<div class="form-group">
-	    <div class="col-sm-2"></div>
-		<div class="col-sm-10">{requiredNote}</div>
+		<div class="col-sm-offset-2 col-sm-10">{requiredNote}</div>
 	</div>
 EOT;
         $renderer->setRequiredNoteTemplate($noteTemplate);
@@ -578,12 +577,12 @@ EOT;
     /**
      * @param string $name
      * @param string $label
-     * @param string $options
+     * @param array $options
      * @param array  $attributes
      *
      * @return HTML_QuickForm_select
      */
-    public function addSelect($name, $label, $options = '', $attributes = array())
+    public function addSelect($name, $label, $options = array(), $attributes = array())
     {
         return $this->addElement('select', $name, $label, $options, $attributes);
     }

+ 7 - 5
main/inc/lib/message.lib.php

@@ -1329,8 +1329,8 @@ class MessageManager
 
     /**
      * Get array of links (download) for message attachment files
-     * @param int  		message id
-     * @param string	type message list (inbox/outbox)
+     * @param int  		$message_id
+     * @param string	$type message list (inbox/outbox)
      * @return array
      */
     public static function get_links_message_attachment_files($message_id, $type = '')
@@ -1342,7 +1342,8 @@ class MessageManager
         $links_attach_file = array();
         if (!empty($message_id)) {
 
-            $sql = "SELECT * FROM $tbl_message_attach WHERE message_id = '$message_id'";
+            $sql = "SELECT * FROM $tbl_message_attach
+                    WHERE message_id = '$message_id'";
 
             $rs_file = Database::query($sql);
             if (Database::num_rows($rs_file) > 0) {
@@ -1363,14 +1364,15 @@ class MessageManager
 
     /**
      * Get message list by id
-     * @param int  message id
+     * @param int  $message_id
      * @return array
      */
     public static function get_message_by_id($message_id)
     {
         $tbl_message = Database::get_main_table(TABLE_MESSAGE);
         $message_id = intval($message_id);
-        $sql = "SELECT * FROM $tbl_message WHERE id = '$message_id' AND msg_status <> '".MESSAGE_STATUS_DELETED."' ";
+        $sql = "SELECT * FROM $tbl_message
+                WHERE id = '$message_id' AND msg_status <> '".MESSAGE_STATUS_DELETED."' ";
         $res = Database::query($sql);
         $item = array();
         if (Database::num_rows($res) > 0) {

+ 28 - 3
main/inc/lib/pear/HTML/QuickForm/Renderer/Default.php

@@ -37,6 +37,24 @@
 class HTML_QuickForm_Renderer_Default extends HTML_QuickForm_Renderer
 {
     private $form;
+    private $customElementTemplate;
+
+    /**
+     * @return mixed
+     */
+    public function getCustomElementTemplate()
+    {
+        return $this->customElementTemplate;
+    }
+
+    /**
+     * This template will be taken instead of the default templates by element
+     * @param string $customElementTemplate
+     */
+    public function setCustomElementTemplate($customElementTemplate)
+    {
+        $this->customElementTemplate = $customElementTemplate;
+    }
 
    /**
     * The HTML of the form
@@ -277,10 +295,17 @@ class HTML_QuickForm_Renderer_Default extends HTML_QuickForm_Renderer
             // Custom template
             $html = str_replace('{label}', $nameLabel, $this->_templates[$name]);
         } else {
-            if (method_exists($element, 'getTemplate')) {
-                $template = $element->getTemplate($this->getForm()->getLayout());
+            $customElementTemplate = $this->getCustomElementTemplate();
+            if (empty($customElementTemplate)) {
+                if (method_exists($element, 'getTemplate')) {
+                    $template = $element->getTemplate(
+                        $this->getForm()->getLayout()
+                    );
+                } else {
+                    $template = $this->getForm()->getDefaultElementTemplate();
+                }
             } else {
-                $template = $this->getForm()->getDefaultElementTemplate();
+                $template = $customElementTemplate;
             }
             $html = str_replace('{label}', $nameLabel, $template);
         }

+ 16 - 10
main/inc/lib/pear/HTML/QuickForm/advmultiselect.php

@@ -308,6 +308,7 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
             $attr = array('class' => $this->_tableAttributes);
             $this->_removeAttr('class', $this->_attributes);
         }
+
         $this->_tableAttributes = $this->_getAttrString($attr);
 
         // set default add button attributes
@@ -409,7 +410,8 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
                     $this->_addButtonAttributes = array(
                         'name'  => 'add',
                         'value' => ' ',
-                        'type'  => 'button'
+                        'type'  => 'button',
+                        'class'=> 'btn btn-primary'
                     );
                 } else {
                     $this->_updateAttrArray(
@@ -420,10 +422,12 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
                 break;
             case 'remove':
                 if (is_null($attributes)) {
-                    $this->_removeButtonAttributes
-                        = array('name'  => 'remove',
+                    $this->_removeButtonAttributes = array(
+                        'name'  => 'remove',
                         'value' => '  ',
-                        'type'  => 'button');
+                        'type'  => 'button',
+                        'class'=> 'btn btn-primary'
+                    );
                 } else {
                     $this->_updateAttrArray($this->_removeButtonAttributes,
                         $this->_parseAttributes($attributes));
@@ -431,10 +435,11 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
                 break;
             case 'all':
                 if (is_null($attributes)) {
-                    $this->_allButtonAttributes
-                        = array('name'  => 'all',
+                    $this->_allButtonAttributes = array(
+                        'name'  => 'all',
                         'value' => ' Select All ',
-                        'type'  => 'button');
+                        'type'  => 'button'
+                    );
                 } else {
                     $this->_updateAttrArray($this->_allButtonAttributes,
                         $this->_parseAttributes($attributes));
@@ -533,10 +538,11 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
         } else {
             $this->_elementTemplate = '
 {javascript}
-  <div class="col-sm-3"><!-- BEGIN label_2 -->{label_2}<!-- END label_2 --> {unselected}</div>
+<div class="row">
+  <div class="col-sm-5"><!-- BEGIN label_2 -->{label_2}<!-- END label_2 --> {unselected}</div>
   <div class="col-sm-2"><div class="text-center">{add}{remove}</div></div>
-  <div class="col-sm-3"><!-- BEGIN label_3 -->{label_3}<!-- END label_3 -->{selected}</div>
-
+  <div class="col-sm-5"><!-- BEGIN label_3 -->{label_3}<!-- END label_3 -->{selected}</div>
+</div>
 ';
         }
         if ($js == false) {

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

@@ -566,7 +566,7 @@ class Statistics
         // Create a search-box
         $form = new FormValidator('search_simple','get',api_get_path(WEB_CODE_PATH).'admin/statistics/index.php','','width=200px',false);
         $renderer =& $form->defaultRenderer();
-        $renderer->setElementTemplate('<span>{element}</span> ');
+        $renderer->setCustomElementTemplate('<span>{element}</span> ');
         $form->addElement('hidden','report','activities');
         $form->addElement('hidden','activities_direction','DESC');
         $form->addElement('hidden','activities_column','4');

+ 76 - 28
main/inc/lib/usermanager.lib.php

@@ -1770,7 +1770,16 @@ class UserManager
         $fields = array();
         $t_uf = Database :: get_main_table(TABLE_MAIN_USER_FIELD);
         $t_ufo = Database :: get_main_table(TABLE_MAIN_USER_FIELD_OPTIONS);
-        $columns = array('id', 'field_variable', 'field_type', 'field_display_text', 'field_default_value', 'field_order', 'field_filter', 'tms');
+        $columns = array(
+            'id',
+            'field_variable',
+            'field_type',
+            'field_display_text',
+            'field_default_value',
+            'field_order',
+            'field_filter',
+            'tms'
+        );
         $column = intval($column);
         $sort_direction = '';
         if (in_array(strtoupper($direction), array('ASC', 'DESC'))) {
@@ -1809,7 +1818,9 @@ class UserManager
                     10 => '<a name="'.$rowf['id'].'"></a>',
                 );
 
-                $sqlo = "SELECT * FROM $t_ufo WHERE field_id = ".$rowf['id']." ORDER BY option_order ASC";
+                $sqlo = "SELECT * FROM $t_ufo
+                        WHERE field_id = ".$rowf['id']."
+                        ORDER BY option_order ASC";
                 $reso = Database::query($sqlo);
                 if (Database::num_rows($reso) > 0) {
                     while ($rowo = Database::fetch_array($reso)) {
@@ -3771,16 +3782,17 @@ class UserManager
     }
 
     /**
-      * Get extra filtrable user fields (type select)
+      * Get extra filtrable user fields (only type select)
       * @return array
       */
     public static function get_extra_filtrable_fields()
     {
         $extraFieldList = UserManager::get_extra_fields();
+
         $extraFiltrableFields = array();
         if (is_array($extraFieldList)) {
             foreach ($extraFieldList as $extraField) {
-                //if is enabled to filter and is a "<select>" field type
+                // If is enabled to filter and is a "<select>" field type
                 if ($extraField[8] == 1 && $extraField[2] == 4) {
                     $extraFiltrableFields[] = array(
                         'name' => $extraField[3],
@@ -3791,7 +3803,7 @@ class UserManager
             }
         }
 
-        if (is_array($extraFiltrableFields) && count($extraFiltrableFields) > 0 ) {
+        if (is_array($extraFiltrableFields) && count($extraFiltrableFields) > 0) {
             return $extraFiltrableFields;
         }
     }
@@ -3811,7 +3823,10 @@ class UserManager
                 if (UserManager::is_extra_field_available($extraField['variable'])) {
                     if (isset($_GET[$varName]) && $_GET[$varName]!='0') {
                         $useExtraFields = true;
-                        $extraFieldResult[]= UserManager::get_extra_user_data_by_value($extraField['variable'], $_GET[$varName]);
+                        $extraFieldResult[]= UserManager::get_extra_user_data_by_value(
+                            $extraField['variable'],
+                            $_GET[$varName]
+                        );
                     }
                 }
             }
@@ -3847,35 +3862,74 @@ class UserManager
      */
     public static function get_search_form($query)
     {
-        $extraFiltrableFields = UserManager::get_extra_filtrable_fields();
-        $extraFields = null;
-        if (is_array($extraFiltrableFields) && count($extraFiltrableFields)>0 ) {
-            foreach ($extraFiltrableFields as $extraField) {
-                $extraFields .=  '<label class="extra_field">'.$extraField['name'].'</label>';
+        $searchType = isset($_GET['search_type']) ? $_GET['search_type'] : null;
+        $form = new FormValidator(
+            'search_user',
+            'get',
+            api_get_path(WEB_PATH).'main/social/search.php',
+            '',
+            array(),
+            FormValidator::LAYOUT_INLINE
+        );
+
+        $form->addText('q', get_lang('UsersGroups'));
+        $options = array(
+            0 => get_lang('Select'),
+            1 => get_lang('User'),
+            2 => get_lang('Group'),
+        );
+        $form->addSelect(
+            'search_type',
+            get_lang('Type'),
+            $options,
+            array('onchange' => 'javascript: extra_field_toogle();')
+        );
+
+        // Extra fields
+
+        $extraFields = UserManager::get_extra_filtrable_fields();
+        $defaults = [];
+        if (is_array($extraFields) && count($extraFields) > 0) {
+            foreach ($extraFields as $extraField) {
                 $varName = 'field_'.$extraField['variable'];
-                $extraFields .=  '&nbsp;<select name="'.$varName.'" class="extra_field">';
-                $extraFields .=  '<option value="0">--'.get_lang('Select').'--</option>';
+
+                $options = [
+                    0 => get_lang('Select')
+                ];
                 foreach ($extraField['data'] as $option) {
-                    $checked='';
+                    $checked = '';
                     if (isset($_GET[$varName])) {
-                        if ($_GET[$varName]==$option[1]) {
-                            $checked = 'selected="true"';
+                        if ($_GET[$varName] == $option[1]) {
+                            $defaults[$option[1]] = true;
                         }
                     }
-                    $extraFields .=  '<option value="'.$option[1].'" '.$checked.'>'.$option[1].'</option>';
+
+                    $options[$option[1]] = $option[1];
                 }
-                $extraFields .=  '</select>';
-                $extraFields .=  '&nbsp;&nbsp;';
+                $form->addSelect($varName, $extraField['name'], $options);
             }
         }
 
-        $searchType = isset($_GET['search_type']) ? $_GET['search_type'] : null;
+        $defaults['search_type'] = intval($searchType);
+        $defaults['q'] = api_htmlentities(Security::remove_XSS($query));
+        $form->setDefaults($defaults);
+
+        $form->addButtonSearch(get_lang('Search'));
+
+        $js = '<script>
+        extra_field_toogle();
+        function extra_field_toogle() {
+            if (jQuery("select[name=search_type]").val() != "1") { jQuery(".extra_field").hide(); } else { jQuery(".extra_field").show(); }
+        }
+        </script>';
+
+        return $js.$form->returnForm();
 
         return '
         <form method="GET" class="form-search" action="'.api_get_path(WEB_PATH).'main/social/search.php">
                 <input placeholder="'.get_lang('UsersGroups').'" type="text" value="'.api_htmlentities(Security::remove_XSS($query)).'" name="q"/> &nbsp;
                 ' . get_lang('Type') .'
-                <select name="search_type" onchange="javascript: extra_field_toogle();">
+
                 <option value="0">--'.get_lang('Select').'--</option>
                 <option value="1"' . (($searchType=='1')?'selected="selected"':"") . '>--' . get_lang('User') .'--</option>
                 <option value="2"' . (($searchType=='2')?'selected="selected"':"") . '>--' . get_lang('Group') . '--</option>
@@ -3883,13 +3937,7 @@ class UserManager
                 '.$extraFields.'
                 <button class="btn" type="submit" value="search">'.get_lang('Search').'</button>
         </form>
-        <script>
-        extra_field_toogle();
-        function extra_field_toogle()
-        {
-            if (jQuery("select[name=search_type]").val() != "1") { jQuery(".extra_field").hide(); } else { jQuery(".extra_field").show(); }
-        }
-        </script>
+
         ';
     }
 

+ 4 - 1
main/install/configuration.dist.php

@@ -314,4 +314,7 @@ $_configuration['system_stable']     = NEW_VERSION_STABLE;
 //$_configuration['registration.soap.php.decode_utf8'] = false;
 // Show delete option in attendance
 //$_configuration['allow_delete_attendance'] = false;
-
+// Enable Gravatar profile image if no local image has been given
+//$_configuration['gravatar_enabled'] = true;
+// If Gravatar is enabled, tells which type of picture we want (default is "mm"). Options: mm | identicon | monsterid | wavatar
+//$_configuration['gravatar_type'] = 'mm';

+ 1245 - 0
main/install/course.sql

@@ -0,0 +1,1245 @@
+
+CREATE TABLE c_announcement(
+  id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  title text,
+  content mediumtext,
+  end_date date default NULL,
+  display_order mediumint NOT NULL default 0,
+  email_sent tinyint default 0,
+  session_id int default 0,
+  PRIMARY KEY (id, c_id)
+);
+
+ALTER TABLE c_announcement ADD INDEX ( session_id );
+
+CREATE TABLE c_announcement_attachment (
+    id int NOT NULL auto_increment,
+    c_id INT NOT NULL,
+    path varchar(255) NOT NULL,
+    comment text,
+    size int NOT NULL default 0,
+    announcement_id int NOT NULL,
+    filename varchar(255) NOT NULL,
+    PRIMARY KEY (id, c_id)
+);
+
+CREATE TABLE c_resource (
+    id int unsigned NOT NULL auto_increment,
+    c_id INT NOT NULL,
+    source_type varchar(50) default NULL,
+    source_id int unsigned default NULL,
+    resource_type varchar(50) default NULL,
+    resource_id int unsigned default NULL,
+    PRIMARY KEY (id, c_id)
+);
+
+CREATE TABLE c_userinfo_content (
+  id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  user_id int unsigned NOT NULL,
+  definition_id int unsigned NOT NULL,
+  editor_ip varchar(39) default NULL,
+  edition_time datetime default NULL,
+  content text NOT NULL,
+  PRIMARY KEY (id, c_id),
+  KEY user_id (user_id)
+);
+
+CREATE TABLE c_userinfo_def (
+  id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  title varchar(80) NOT NULL default '',
+  comment text,
+  line_count tinyint unsigned NOT NULL default 5,
+  rank tinyint unsigned NOT NULL default 0,
+  PRIMARY KEY (id, c_id)
+);
+
+CREATE TABLE c_forum_category(
+ cat_id int NOT NULL auto_increment,
+ c_id INT NOT NULL,
+ cat_title varchar(255) NOT NULL default '',
+ cat_comment text,
+ cat_order int NOT NULL default 0,
+ locked int NOT NULL default 0,
+ session_id int unsigned NOT NULL default 0,
+ PRIMARY KEY (cat_id, c_id)
+);
+
+ALTER TABLE c_forum_category ADD INDEX ( session_id );
+
+CREATE TABLE c_forum_forum(
+  forum_id int NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  forum_title varchar(255) NOT NULL default '',
+  forum_comment text,
+  forum_threads int default 0,
+  forum_posts int default 0,
+  forum_last_post int default 0,
+  forum_category int default NULL,
+  allow_anonymous int default NULL,
+  allow_edit int default NULL,
+  approval_direct_post varchar(20) default NULL,
+  allow_attachments int default NULL,
+  allow_new_threads int default NULL,
+  default_view varchar(20) default NULL,
+  forum_of_group varchar(20) default NULL,
+  forum_group_public_private varchar(20) default 'public',
+  forum_order int default NULL,
+  locked int NOT NULL default 0,
+  session_id int NOT NULL default 0,
+  forum_image varchar(255) NOT NULL default '',
+  start_time datetime NOT NULL default '0000-00-00 00:00:00',
+  end_time datetime NOT NULL default '0000-00-00 00:00:00',
+  PRIMARY KEY (forum_id, c_id)
+);
+
+CREATE TABLE c_forum_thread  (
+ thread_id int NOT NULL auto_increment,
+ c_id INT NOT NULL,
+ thread_title varchar(255) default NULL,
+ forum_id int default NULL,
+ thread_replies int default 0,
+ thread_poster_id int default NULL,
+ thread_poster_name varchar(100) default '',
+ thread_views int default 0,
+ thread_last_post int default NULL,
+ thread_date datetime default '0000-00-00 00:00:00',
+ thread_sticky tinyint unsigned default 0,
+ locked int NOT NULL default 0,
+ session_id int unsigned default NULL,
+ thread_title_qualify varchar(255) default '',
+ thread_qualify_max float(6,2) UNSIGNED NOT NULL default 0,
+ thread_close_date datetime default '0000-00-00 00:00:00',
+ thread_weight float(6,2) UNSIGNED NOT NULL default 0,
+ PRIMARY KEY (thread_id, c_id)
+);
+
+ALTER TABLE c_forum_thread ADD INDEX idx_forum_thread_forum_id (forum_id);
+
+CREATE TABLE c_forum_post (
+    post_id int NOT NULL auto_increment,
+    c_id INT NOT NULL,
+    post_title varchar(250) default NULL,
+    post_text text,
+    thread_id int default 0,
+    forum_id int default 0,
+    poster_id int default 0,
+    poster_name varchar(100) default '',
+    post_date datetime default '0000-00-00 00:00:00',
+    post_notification tinyint default 0,
+    post_parent_id int default 0,
+    visible tinyint default 1,
+    PRIMARY KEY (post_id, c_id),
+    KEY poster_id (poster_id),
+    KEY forum_id (forum_id)
+);
+
+ALTER TABLE c_forum_post ADD INDEX idx_forum_post_thread_id (thread_id);
+ALTER TABLE c_forum_post ADD INDEX idx_forum_post_visible (visible);
+
+CREATE TABLE c_forum_mailcue  (
+ id int NOT NULL auto_increment,
+ c_id INT NOT NULL,
+ user_id int default NULL,
+ thread_id int default NULL,
+ post_id int default NULL,
+ PRIMARY KEY (id, c_id, thread_id, user_id, post_id )
+);
+
+CREATE TABLE  c_forum_attachment  (
+  id int NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  path varchar(255) NOT NULL,
+  comment text,
+  size int NOT NULL default 0,
+  post_id int NOT NULL,
+  filename varchar(255) NOT NULL,
+  PRIMARY KEY (id, c_id)
+);
+
+CREATE TABLE c_forum_notification(
+    id int NOT NULL auto_increment,
+    c_id INT NOT NULL,
+    user_id int,
+    forum_id int,
+    thread_id int,
+    post_id int,
+    KEY user_id (user_id),
+    KEY forum_id (forum_id),
+    PRIMARY KEY (id, c_id, user_id, forum_id, thread_id, post_id )
+);
+
+CREATE TABLE c_forum_thread_qualify  (
+  id int unsigned AUTO_INCREMENT,
+  c_id INT NOT NULL,
+  user_id int unsigned NOT NULL,
+  thread_id int NOT NULL,
+  qualify float(6,2) NOT NULL default 0,
+  qualify_user_id int  default NULL,
+  qualify_time datetime default '0000-00-00 00:00:00',
+  session_id int  default NULL,
+  PRIMARY KEY (id, c_id)
+);
+
+ALTER TABLE c_forum_thread_qualify ADD INDEX (user_id, thread_id);
+
+CREATE TABLE c_forum_thread_qualify_log  (
+  id int unsigned AUTO_INCREMENT,
+  c_id INT NOT NULL,
+  user_id int unsigned NOT NULL,
+  thread_id int NOT NULL,
+  qualify float(6,2) NOT NULL default 0,
+  qualify_user_id int default NULL,
+  qualify_time datetime default '0000-00-00 00:00:00',
+  session_id int default NULL,
+  PRIMARY KEY (id, c_id)
+);
+
+ALTER TABLE c_forum_thread_qualify_log  ADD INDEX (user_id, thread_id);
+
+CREATE TABLE c_quiz (
+  id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  title varchar(255) NOT NULL,
+  description text default NULL,
+  sound varchar(255) default NULL,
+  type tinyint unsigned NOT NULL default 1,
+  random int NOT NULL default 0,
+  random_answers tinyint unsigned NOT NULL default 0,
+  active tinyint NOT NULL default 0,
+  results_disabled INT UNSIGNED NOT NULL DEFAULT 0,
+  access_condition TEXT DEFAULT NULL,
+  max_attempt int NOT NULL default 0,
+  start_time datetime NOT NULL default '0000-00-00 00:00:00',
+  end_time datetime NOT NULL default '0000-00-00 00:00:00',
+  feedback_type int NOT NULL default 0,
+  expired_time int NOT NULL default '0',
+  session_id int default 0,
+  propagate_neg INT NOT NULL DEFAULT 0,
+  review_answers INT NOT NULL DEFAULT 0,
+  random_by_category INT NOT NULL DEFAULT 0,
+  text_when_finished TEXT default NULL,
+  display_category_name INT NOT NULL DEFAULT 1,
+  pass_percentage INT DEFAULT NULL,
+  PRIMARY KEY (id, c_id)
+);
+
+ALTER TABLE c_quiz  ADD INDEX ( session_id );
+
+CREATE TABLE c_quiz_question(
+  id int unsigned NOT NULL auto_increment,
+  question TEXT NOT NULL,
+  description text default NULL,
+  ponderation float(6,2) NOT NULL default 0,
+  position mediumint unsigned NOT NULL default 1,
+  type    tinyint unsigned NOT NULL default 2,
+  picture varchar(50) default NULL,
+  level   int unsigned NOT NULL default 0,
+  extra   varchar(255) default NULL,
+  question_code char(10) default '',
+  c_id INT NOT NULL,
+  PRIMARY KEY (id, c_id)
+);
+
+ALTER TABLE c_quiz_question  ADD INDEX (position);
+
+CREATE TABLE c_quiz_answer(
+  id int unsigned NOT NULL,
+  c_id INT NOT NULL,
+  id_auto int NOT NULL AUTO_INCREMENT,
+  question_id int unsigned NOT NULL,
+  answer text NOT NULL,
+  correct mediumint unsigned default NULL,
+  comment text default NULL,
+  ponderation float(6,2) NOT NULL default 0,
+  position mediumint unsigned NOT NULL default 1,
+  hotspot_coordinates text,
+  hotspot_type enum('square','circle','poly','delineation','oar') default NULL,
+  destination text NOT NULL,
+  answer_code char(10) default '',
+  PRIMARY KEY (id_auto, c_id)
+);
+
+CREATE TABLE c_quiz_question_option  (
+  id          int NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  question_id int NOT NULL,
+  name        varchar(255),
+  position    int unsigned NOT NULL,
+  PRIMARY KEY (id, c_id)
+);
+
+CREATE TABLE c_quiz_rel_question  (
+  c_id INT NOT NULL,
+  question_id int unsigned NOT NULL,
+  exercice_id int unsigned NOT NULL,
+  question_order int unsigned NOT NULL default 1,
+  PRIMARY KEY (c_id, question_id, exercice_id)
+);
+
+CREATE TABLE c_quiz_question_category  (
+  id int NOT NULL AUTO_INCREMENT,
+  c_id INT NOT NULL,
+  title varchar(255) NOT NULL,
+  description text NOT NULL,
+  PRIMARY KEY (id, c_id)
+);
+
+CREATE TABLE c_quiz_question_rel_category  (
+  c_id INT NOT NULL,
+  question_id int NOT NULL,
+  category_id int NOT NULL,
+  PRIMARY KEY (c_id,question_id)
+);
+
+CREATE TABLE c_course_description(
+  id int UNSIGNED NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  title VARCHAR(255),
+  content TEXT,
+  session_id int default 0,
+  description_type tinyint unsigned NOT NULL default 0,
+  progress INT NOT NULL default 0,
+  PRIMARY KEY (id, c_id)
+);
+
+ALTER TABLE c_course_description  ADD INDEX ( session_id );
+
+CREATE TABLE c_tool(
+  id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  name varchar(255) NOT NULL,
+  link varchar(255) NOT NULL,
+  image varchar(255) default NULL,
+  visibility tinyint unsigned default 0,
+  admin varchar(255) default NULL,
+  address varchar(255) default NULL,
+  added_tool tinyint unsigned default 1,
+  target enum('_self','_blank') NOT NULL default '_self',
+  category varchar(20) not null default 'authoring',
+  session_id int default 0,
+  PRIMARY KEY (id, c_id)
+);
+
+ALTER TABLE c_tool ADD INDEX ( session_id );
+
+CREATE TABLE c_calendar_event(
+  id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  title varchar(255) NOT NULL,
+  content text,
+  start_date datetime NOT NULL default '0000-00-00 00:00:00',
+  end_date datetime NOT NULL default '0000-00-00 00:00:00',
+  parent_event_id INT NULL,
+  session_id int unsigned NOT NULL default 0,
+  all_day INT NOT NULL DEFAULT 0,
+  PRIMARY KEY (id, c_id)
+);
+
+ALTER TABLE c_calendar_event ADD INDEX ( session_id );
+
+CREATE TABLE c_calendar_event_repeat(
+  c_id INT NOT NULL,
+  cal_id INT DEFAULT 0 NOT NULL,
+  cal_type VARCHAR(20),
+  cal_end INT,
+  cal_frequency INT DEFAULT 1,
+  cal_days CHAR(7),
+  PRIMARY KEY (c_id, cal_id)
+);
+
+CREATE TABLE c_calendar_event_repeat_not  (
+  c_id INT NOT NULL,
+  cal_id INT NOT NULL,
+  cal_date INT NOT NULL,
+  PRIMARY KEY (c_id, cal_id, cal_date )
+);
+
+CREATE TABLE  c_calendar_event_attachment  (
+  id int NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  path varchar(255) NOT NULL,
+  comment text,
+  size int NOT NULL default 0,
+  agenda_id int NOT NULL,
+  filename varchar(255) NOT NULL,
+  PRIMARY KEY (id, c_id)
+);
+
+CREATE TABLE c_document (
+    id int unsigned NOT NULL auto_increment,
+    c_id INT NOT NULL,
+    path varchar(255) NOT NULL default '',
+    comment text,
+    title varchar(255) default NULL,
+    filetype set('file','folder') NOT NULL default 'file',
+    size int NOT NULL default 0,
+    readonly TINYINT UNSIGNED NOT NULL,
+    session_id int UNSIGNED NOT NULL default 0,
+    PRIMARY KEY (id, c_id)
+);
+
+CREATE TABLE c_student_publication  (
+  id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  url varchar(255) default NULL,
+  title varchar(255) default NULL,
+  description text default NULL,
+  author varchar(255) default NULL,
+  active tinyint default NULL,
+  accepted tinyint default 0,
+  post_group_id int DEFAULT 0 NOT NULL,
+  sent_date datetime NOT NULL default '0000-00-00 00:00:00',
+  filetype set('file','folder') NOT NULL default 'file',
+  has_properties int UNSIGNED NOT NULL DEFAULT 0,
+  view_properties tinyint NULL,
+  qualification float(6,2) UNSIGNED NOT NULL DEFAULT 0,
+  date_of_qualification datetime NOT NULL default '0000-00-00 00:00:00',
+  parent_id INT UNSIGNED NOT NULL DEFAULT 0,
+  qualificator_id INT UNSIGNED NOT NULL DEFAULT 0,
+  weight float(6,2) UNSIGNED NOT NULL default 0,
+  session_id INT UNSIGNED NOT NULL default 0,
+  user_id INTEGER  NOT NULL,
+  allow_text_assignment INTEGER NOT NULL DEFAULT 0,
+  contains_file INTEGER NOT NULL DEFAULT 0,
+  PRIMARY KEY (id, c_id)
+);
+
+CREATE TABLE c_student_publication_assignment(
+  id int NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  expires_on datetime NOT NULL default '0000-00-00 00:00:00',
+  ends_on datetime NOT NULL default '0000-00-00 00:00:00',
+  add_to_calendar tinyint NOT NULL,
+  enable_qualification tinyint NOT NULL,
+  publication_id int NOT NULL,
+  PRIMARY KEY (id, c_id)
+);
+
+ALTER TABLE c_student_publication  ADD INDEX ( session_id );
+
+CREATE TABLE c_link(
+  id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  url TEXT NOT NULL,
+  title varchar(150) default NULL,
+  description text,
+  category_id int unsigned default NULL,
+  display_order int unsigned NOT NULL default 0,
+  on_homepage enum('0','1') NOT NULL default '0',
+  target char(10) default '_self',
+  session_id int default 0,
+  PRIMARY KEY (id, c_id)
+);
+
+ALTER TABLE c_link  ADD INDEX ( session_id );
+
+CREATE TABLE c_link_category (
+  id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  category_title varchar(255) NOT NULL,
+  description text,
+  display_order mediumint unsigned NOT NULL default 0,
+  session_id int default 0,
+  PRIMARY KEY (id, c_id)
+);
+
+ALTER TABLE c_link_category  ADD INDEX ( session_id );
+
+CREATE TABLE c_wiki(
+  id int NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  page_id int NOT NULL default 0,
+  reflink varchar(255) NOT NULL default 'index',
+  title varchar(255) NOT NULL,
+  content mediumtext NOT NULL,
+  user_id int NOT NULL default 0,
+  group_id int DEFAULT NULL,
+  dtime datetime NOT NULL default '0000-00-00 00:00:00',
+  addlock int NOT NULL default 1,
+  editlock int NOT NULL default 0,
+  visibility int NOT NULL default 1,
+  addlock_disc int NOT NULL default 1,
+  visibility_disc int NOT NULL default 1,
+  ratinglock_disc int NOT NULL default 1,
+  assignment int NOT NULL default 0,
+  comment text NOT NULL,
+  progress text NOT NULL,
+  score int NULL default 0,
+  version int default NULL,
+  is_editing int NOT NULL default 0,
+  time_edit datetime NOT NULL default '0000-00-00 00:00:00',
+  hits int default 0,
+  linksto text NOT NULL,
+  tag text NOT NULL,
+  user_ip varchar(39) NOT NULL,
+  session_id int default 0,
+  PRIMARY KEY (id, c_id),
+  KEY reflink (reflink),
+  KEY group_id (group_id),
+  KEY page_id (page_id),
+  KEY session_id (session_id)
+);
+
+CREATE TABLE c_wiki_conf  (
+  c_id INT NOT NULL,
+  page_id int NOT NULL default 0,
+  task text NOT NULL,
+  feedback1 text NOT NULL,
+  feedback2 text NOT NULL,
+  feedback3 text NOT NULL,
+  fprogress1 varchar(3) NOT NULL,
+  fprogress2 varchar(3) NOT NULL,
+  fprogress3 varchar(3) NOT NULL,
+  max_size int default NULL,
+  max_text int default NULL,
+  max_version int default NULL,
+  startdate_assig datetime NOT NULL default '0000-00-00 00:00:00',
+  enddate_assig datetime  NOT NULL default '0000-00-00 00:00:00',
+  delayedsubmit int NOT NULL default 0,
+  KEY page_id (page_id),
+  PRIMARY KEY  ( c_id, page_id )
+);
+
+CREATE TABLE c_wiki_discuss  (
+  id int NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  publication_id int NOT NULL default 0,
+  userc_id int NOT NULL default 0,
+  comment text NOT NULL,
+  p_score varchar(255) default NULL,
+  dtime datetime NOT NULL default '0000-00-00 00:00:00',
+  PRIMARY KEY (id, c_id)
+);
+
+CREATE TABLE c_wiki_mailcue  (
+  c_id INT NOT NULL,
+  id int NOT NULL,
+  user_id int NOT NULL,
+  type text NOT NULL,
+  group_id int DEFAULT NULL,
+  session_id int default 0,
+  KEY (c_id, id),
+  PRIMARY KEY  ( c_id, id, user_id )
+);
+
+CREATE TABLE c_online_connected  (
+  c_id INT NOT NULL,
+  user_id int unsigned NOT NULL,
+  last_connection datetime NOT NULL default '0000-00-00 00:00:00',
+  PRIMARY KEY (c_id, user_id)
+);
+
+CREATE TABLE c_online_link (
+  id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  name char(50) NOT NULL default '',
+  url char(100) NOT NULL,
+  PRIMARY KEY (id, c_id)
+);
+
+CREATE TABLE c_chat_connected (
+  id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  user_id int unsigned NOT NULL default '0',
+  last_connection datetime NOT NULL default '0000-00-00 00:00:00',
+  session_id  INT NOT NULL default 0,
+  to_group_id INT NOT NULL default 0,
+  PRIMARY KEY  (id, c_id, user_id, last_connection)
+);
+
+ALTER TABLE c_chat_connected ADD INDEX char_connected_index(user_id, session_id, to_group_id);
+
+CREATE TABLE c_group_info(
+  id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  name varchar(100) default NULL,
+  status tinyint DEFAULT 1,
+  category_id int unsigned NOT NULL default 0,
+  description text,
+  max_student int unsigned NOT NULL default 8,
+  doc_state tinyint unsigned NOT NULL default 1,
+  calendar_state tinyint unsigned NOT NULL default 0,
+  work_state tinyint unsigned NOT NULL default 0,
+  announcements_state tinyint unsigned NOT NULL default 0,
+  forum_state tinyint unsigned NOT NULL default 0,
+  wiki_state tinyint unsigned NOT NULL default 1,
+  chat_state tinyint unsigned NOT NULL default 1,
+  secret_directory varchar(255) default NULL,
+  self_registration_allowed tinyint unsigned NOT NULL default '0',
+  self_unregistration_allowed tinyint unsigned NOT NULL default '0',
+  session_id int unsigned NOT NULL default 0,
+  PRIMARY KEY (id, c_id)
+);
+
+ALTER TABLE c_group_info ADD INDEX ( session_id );
+
+CREATE TABLE c_group_category(
+  id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  title varchar(255) NOT NULL default '',
+  description text NOT NULL,
+  doc_state tinyint unsigned NOT NULL default 1,
+  calendar_state tinyint unsigned NOT NULL default 1,
+  work_state tinyint unsigned NOT NULL default 1,
+  announcements_state tinyint unsigned NOT NULL default 1,
+  forum_state tinyint unsigned NOT NULL default 1,
+  wiki_state tinyint unsigned NOT NULL default 1,
+  chat_state tinyint unsigned NOT NULL default 1,
+  max_student int unsigned NOT NULL default 8,
+  self_reg_allowed tinyint unsigned NOT NULL default 0,
+  self_unreg_allowed tinyint unsigned NOT NULL default 0,
+  groups_per_user int unsigned NOT NULL default 0,
+  display_order int unsigned NOT NULL default 0,
+  PRIMARY KEY (id, c_id)
+);
+
+CREATE TABLE c_group_rel_user(
+  id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  user_id int unsigned NOT NULL,
+  group_id int unsigned NOT NULL default 0,
+  status int NOT NULL default 0,
+  role char(50) NOT NULL,
+  PRIMARY KEY (id, c_id)
+);
+
+CREATE TABLE c_group_rel_tutor(
+  id int NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  user_id int NOT NULL,
+  group_id int NOT NULL default 0,
+  PRIMARY KEY (id, c_id)
+);
+
+CREATE TABLE c_item_property(
+  id int NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  tool varchar(100) NOT NULL default '',
+  insert_user_id int unsigned NOT NULL default '0',
+  insert_date datetime NOT NULL default '0000-00-00 00:00:00',
+  lastedit_date datetime NOT NULL default '0000-00-00 00:00:00',
+  ref int NOT NULL default '0',
+  lastedit_type varchar(100) NOT NULL default '',
+  lastedit_user_id int unsigned NOT NULL default '0',
+  to_group_id int unsigned default NULL,
+  to_user_id int unsigned default NULL,
+  visibility tinyint NOT NULL default '1',
+  start_visible datetime NOT NULL default '0000-00-00 00:00:00',
+  end_visible datetime NOT NULL default '0000-00-00 00:00:00',
+  id_session INT NOT NULL DEFAULT 0,
+  PRIMARY KEY (id, c_id)
+);
+
+ALTER TABLE c_item_property ADD INDEX idx_item_property_toolref (tool,ref);
+
+CREATE TABLE c_tool_intro(
+  id varchar(50) NOT NULL,
+  c_id INT NOT NULL,
+  intro_text MEDIUMTEXT NOT NULL,
+  session_id INT  NOT NULL DEFAULT 0,
+  PRIMARY KEY (id, c_id, session_id)
+);
+
+CREATE TABLE c_dropbox_file  (
+  id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  uploader_id int unsigned NOT NULL default 0,
+  filename varchar(250) NOT NULL default '',
+  filesize int unsigned NOT NULL,
+  title varchar(250) default '',
+  description varchar(250) default '',
+  author varchar(250) default '',
+  upload_date datetime NOT NULL default '0000-00-00 00:00:00',
+  last_upload_date datetime NOT NULL default '0000-00-00 00:00:00',
+  cat_id int NOT NULL default 0,
+  session_id int UNSIGNED NOT NULL,
+  PRIMARY KEY (id, c_id),
+  UNIQUE KEY UN_filename (filename)
+);
+
+ALTER TABLE c_dropbox_file ADD INDEX ( session_id );
+
+CREATE TABLE c_dropbox_post  (
+  c_id INT NOT NULL,
+  file_id int unsigned NOT NULL,
+  dest_user_id int unsigned NOT NULL default 0,
+  feedback_date datetime NOT NULL default '0000-00-00 00:00:00',
+  feedback text default '',
+  cat_id int NOT NULL default 0,
+  session_id int UNSIGNED NOT NULL,
+  PRIMARY KEY (c_id, file_id, dest_user_id)
+);
+
+ALTER TABLE c_dropbox_post ADD INDEX ( session_id );
+
+CREATE TABLE c_dropbox_person  (
+  c_id INT NOT NULL,
+  file_id int unsigned NOT NULL,
+  user_id int unsigned NOT NULL default 0,
+  PRIMARY KEY (c_id, file_id, user_id)
+);
+
+CREATE TABLE c_dropbox_category  (
+  cat_id int NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  cat_name text NOT NULL,
+  received tinyint unsigned NOT NULL default 0,
+  sent tinyint unsigned NOT NULL default 0,
+  user_id int NOT NULL default 0,
+  session_id int NOT NULL default 0,
+  PRIMARY KEY(cat_id, c_id)
+);
+
+ALTER TABLE c_dropbox_category ADD INDEX ( session_id );
+
+CREATE TABLE c_dropbox_feedback (
+  feedback_id int NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  file_id int NOT NULL default 0,
+  author_user_id int NOT NULL default 0,
+  feedback text NOT NULL,
+  feedback_date datetime NOT NULL default '0000-00-00 00:00:00',
+  PRIMARY KEY  (feedback_id, c_id),
+  KEY file_id (file_id),
+  KEY author_user_id (author_user_id)
+);
+
+CREATE TABLE IF NOT EXISTS c_lp (
+  id             int unsigned        auto_increment,
+  c_id INT NOT NULL,
+  lp_type        int unsigned   not null,
+  name           varchar(255)        not null,
+  ref            tinytext            null,
+  description    text                null,
+  path           text                not null,
+  force_commit   tinyint unsigned    not null default 0,
+  default_view_mod   char(32)        not null default 'embedded',
+  default_encoding   char(32)        not null default 'UTF-8',
+  display_order  int unsigned        not null default 0,
+  content_maker  tinytext            not null default '',
+  content_local  varchar(32)         not null default 'local',
+  content_license    text            not null default '',
+  prevent_reinit tinyint unsigned    not null default 1,
+  js_lib         tinytext            not null default '',
+  debug          tinyint unsigned    not null default 0,
+  theme          varchar(255)        not null default '',
+  preview_image  varchar(255)        not null default '',
+  author         varchar(255)        not null default '',
+  session_id     int unsigned        not null default 0,
+  prerequisite   int unsigned        not null default 0,
+  hide_toc_frame tinyint             NOT NULL DEFAULT 0,
+  seriousgame_mode tinyint           NOT NULL DEFAULT 0,
+  use_max_score  int unsigned        not null default 1,
+  autolunch      int unsigned        not null default 0,
+  created_on     DATETIME            NOT NULL DEFAULT '0000-00-00 00:00:00',
+  modified_on    DATETIME            NOT NULL DEFAULT '0000-00-00 00:00:00',
+  publicated_on  DATETIME            NOT NULL DEFAULT '0000-00-00 00:00:00',
+  expired_on     DATETIME            NOT NULL DEFAULT '0000-00-00 00:00:00',
+  PRIMARY KEY  (id, c_id)
+);
+
+CREATE TABLE IF NOT EXISTS c_lp_view (
+  id             int unsigned        auto_increment,
+  c_id INT NOT NULL,
+  lp_id          int unsigned        not null,
+  user_id        int unsigned        not null,
+  view_count     int unsigned   not null default 0,
+  last_item      int unsigned        not null default 0,
+  progress       int unsigned        default 0,
+  session_id     int                 not null default 0,
+  PRIMARY KEY  (id, c_id)
+);
+
+ALTER TABLE c_lp_view ADD INDEX (lp_id);
+ALTER TABLE c_lp_view ADD INDEX (user_id);
+ALTER TABLE c_lp_view ADD INDEX (session_id);
+
+CREATE TABLE IF NOT EXISTS c_lp_item (
+  id              int unsigned       auto_increment,
+  c_id INT NOT NULL,
+  lp_id          int unsigned        not null,
+  item_type      char(32)            not null default 'dokeos_document',
+  ref            tinytext            not null default '',
+  title          varchar(511)        not null,
+  description    varchar(511)        not null default '',
+  path           text                not null,
+  min_score      float unsigned      not null default 0,
+  max_score      float unsigned      default 100,
+  mastery_score  float unsigned      null,
+  parent_item_id     int unsigned    not null default 0,
+  previous_item_id   int unsigned    not null default 0,
+  next_item_id       int unsigned    not null default 0,
+  display_order      int unsigned    not null default 0,
+  prerequisite   text                null default null,
+  parameters     text                null,
+  launch_data    text                not null default '',
+  max_time_allowed   char(13)        NULL default '',
+  terms          TEXT                NULL,
+  search_did     INT                 NULL,
+  audio          VARCHAR(250),
+  prerequisite_min_score float,
+  prerequisite_max_score float,
+  PRIMARY KEY  (id, c_id)
+);
+
+ALTER TABLE c_lp_item ADD INDEX (lp_id);
+ALTER TABLE c_lp_item ADD INDEX idx_c_lp_item_cid_lp_id (c_id, lp_id);
+
+CREATE TABLE IF NOT EXISTS c_lp_item_view (
+  id bigint unsigned auto_increment,
+  c_id INT NOT NULL,
+  lp_item_id     int unsigned    not null,
+  lp_view_id     int unsigned    not null,
+  view_count     int unsigned    not null default 0,
+  start_time     int unsigned    not null,
+  total_time     int unsigned    not null default 0,
+  score          float unsigned  not null default 0,
+  status         char(32)        not null default 'not attempted',
+  suspend_data   longtext null default '',
+  lesson_location    text        null default '',
+  core_exit      varchar(32)     not null default 'none',
+  max_score      varchar(8)      default '',
+  PRIMARY KEY  (id, c_id)
+);
+
+ALTER TABLE c_lp_item_view ADD INDEX (lp_item_id);
+ALTER TABLE c_lp_item_view ADD INDEX (lp_view_id);
+ALTER TABLE c_lp_item_view ADD INDEX idx_c_lp_item_view_cid_lp_view_id_lp_item_id (c_id, lp_view_id, lp_item_id);
+
+CREATE TABLE IF NOT EXISTS c_lp_iv_interaction(
+  id             bigint unsigned     auto_increment,
+  c_id INT NOT NULL,
+  order_id       int unsigned   not null default 0,
+  lp_iv_id       bigint unsigned     not null,
+  interaction_id varchar(255)        not null default '',
+  interaction_type   varchar(255)    not null default '',
+  weighting          double          not null default 0,
+  completion_time    varchar(16)     not null default '',
+  correct_responses  text            not null default '',
+  student_response   text            not null default '',
+  result         varchar(255)        not null default '',
+  latency        varchar(16)         not null default '',
+  PRIMARY KEY (id, c_id)
+);
+
+ALTER TABLE c_lp_iv_interaction ADD INDEX (lp_iv_id);
+
+CREATE TABLE IF NOT EXISTS c_lp_iv_objective(
+  id             bigint unsigned     auto_increment,
+  c_id INT NOT NULL,
+  lp_iv_id       bigint unsigned     not null,
+  order_id       int unsigned   not null default 0,
+  objective_id   varchar(255)        not null default '',
+  score_raw      float unsigned      not null default 0,
+  score_max      float unsigned      not null default 0,
+  score_min      float unsigned      not null default 0,
+  status         char(32)            not null default 'not attempted',
+  PRIMARY KEY (id, c_id)
+);
+
+ALTER TABLE c_lp_iv_objective ADD INDEX (lp_iv_id);
+
+CREATE TABLE c_blog (
+  blog_id int NOT NULL AUTO_INCREMENT ,
+  c_id INT NOT NULL,
+  blog_name varchar( 250 ) NOT NULL default '',
+  blog_subtitle varchar( 250 ) default NULL ,
+  date_creation datetime NOT NULL default '0000-00-00 00:00:00',
+  visibility tinyint unsigned NOT NULL default 0,
+  session_id int default 0,
+  PRIMARY KEY (blog_id, c_id)
+);
+
+ALTER TABLE c_blog  ADD INDEX ( session_id );
+
+CREATE TABLE c_blog_comment (
+    comment_id int NOT NULL AUTO_INCREMENT ,
+    c_id INT NOT NULL,
+    title varchar( 250 ) NOT NULL default '',
+    comment longtext NOT NULL ,
+    author_id int NOT NULL default 0,
+    date_creation datetime NOT NULL default '0000-00-00 00:00:00',
+    blog_id int NOT NULL default 0,
+    post_id int NOT NULL default 0,
+    task_id int default NULL ,
+    parent_comment_id int NOT NULL default 0,
+    PRIMARY KEY (comment_id, c_id)
+);
+
+CREATE TABLE c_blog_post(
+    post_id int NOT NULL AUTO_INCREMENT ,
+    c_id INT NOT NULL,
+    title varchar( 250 ) NOT NULL default '',
+    full_text longtext NOT NULL ,
+    date_creation datetime NOT NULL default '0000-00-00 00:00:00',
+    blog_id int NOT NULL default 0,
+    author_id int NOT NULL default 0,
+    PRIMARY KEY (post_id, c_id)
+);
+
+CREATE TABLE c_blog_rating(
+    rating_id int NOT NULL AUTO_INCREMENT ,
+    c_id INT NOT NULL,
+    blog_id int NOT NULL default 0,
+    rating_type enum( 'post', 'comment' ) NOT NULL default 'post',
+    item_id int NOT NULL default 0,
+    user_id int NOT NULL default 0,
+    rating int NOT NULL default 0,
+    PRIMARY KEY (rating_id, c_id)
+);
+
+CREATE TABLE c_blog_rel_user(
+    c_id INT NOT NULL,
+    blog_id int NOT NULL default 0,
+    user_id int NOT NULL default 0,
+    PRIMARY KEY (c_id, blog_id , user_id )
+);
+
+CREATE TABLE c_blog_task(
+    task_id int NOT NULL AUTO_INCREMENT ,
+    c_id INT NOT NULL,
+    blog_id int NOT NULL default 0,
+    title varchar( 250 ) NOT NULL default '',
+    description text NOT NULL ,
+    color varchar( 10 ) NOT NULL default '',
+    system_task tinyint unsigned NOT NULL default 0,
+    PRIMARY KEY (task_id, c_id)
+);
+
+CREATE TABLE c_blog_task_rel_user  (
+    c_id INT NOT NULL,
+    blog_id int NOT NULL default 0,
+    user_id int NOT NULL default 0,
+    task_id int NOT NULL default 0,
+    target_date date NOT NULL default '0000-00-00',
+    PRIMARY KEY (c_id, blog_id , user_id , task_id )
+);
+
+CREATE TABLE  c_blog_attachment  (
+  id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  path varchar(255) NOT NULL COMMENT 'the real filename',
+  comment text,
+  size int NOT NULL default '0',
+  post_id int NOT NULL,
+  filename varchar(255) NOT NULL COMMENT 'the user s file name',
+  blog_id int NOT NULL,
+  comment_id int NOT NULL default '0',
+  PRIMARY KEY (id, c_id)
+);
+
+CREATE TABLE c_permission_group  (
+    id int NOT NULL AUTO_INCREMENT,
+    c_id INT NOT NULL,
+    group_id int NOT NULL default 0,
+    tool varchar( 250 ) NOT NULL default '',
+    action varchar( 250 ) NOT NULL default '',
+    PRIMARY KEY (id, c_id)
+);
+
+CREATE TABLE c_permission_user  (
+    id int NOT NULL AUTO_INCREMENT ,
+    c_id INT NOT NULL,
+    user_id int NOT NULL default 0,
+    tool varchar( 250 ) NOT NULL default '',
+    action varchar( 250 ) NOT NULL default '',
+    PRIMARY KEY (id, c_id)
+);
+
+CREATE TABLE c_permission_task(
+    id int NOT NULL AUTO_INCREMENT,
+    c_id INT NOT NULL,
+    task_id int NOT NULL default 0,
+    tool varchar( 250 ) NOT NULL default '',
+    action varchar( 250 ) NOT NULL default '',
+    PRIMARY KEY (id, c_id)
+);
+
+CREATE TABLE c_role(
+    role_id int NOT NULL AUTO_INCREMENT,
+    c_id INT NOT NULL,
+    role_name varchar( 250 ) NOT NULL default '',
+    role_comment text,
+    default_role tinyint default 0,
+    PRIMARY KEY (role_id, c_id)
+);
+
+CREATE TABLE c_role_group(
+    id int NOT NULL AUTO_INCREMENT,
+    c_id INT NOT NULL,
+    role_id int NOT NULL default 0,
+    scope varchar( 20 ) NOT NULL default 'course',
+    group_id int NOT NULL default 0,
+    PRIMARY KEY  (id, c_id, group_id )
+);
+
+CREATE TABLE c_role_permissions(
+    id int NOT NULL AUTO_INCREMENT,
+    c_id INT NOT NULL,
+    role_id int NOT NULL default 0,
+    tool varchar( 250 ) NOT NULL default '',
+    action varchar( 50 ) NOT NULL default '',
+    default_perm tinyint NOT NULL default 0,
+    PRIMARY KEY  (id, c_id, role_id, tool, action )
+);
+
+CREATE TABLE c_role_user  (
+    c_id INT NOT NULL,
+    role_id int NOT NULL default 0,
+    scope varchar( 20 ) NOT NULL default 'course',
+    user_id int NOT NULL default 0,
+    PRIMARY KEY  ( c_id, role_id, user_id )
+);
+
+CREATE TABLE c_course_setting  (
+  id          int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  variable    varchar(255) NOT NULL default '',
+  subkey      varchar(255) default NULL,
+  type        varchar(255) default NULL,
+  category    varchar(255) default NULL,
+  value       varchar(255) NOT NULL default '',
+  title       varchar(255) NOT NULL default '',
+  comment     varchar(255) default NULL,
+  subkeytext  varchar(255) default NULL,
+  PRIMARY KEY (id, c_id)
+);
+
+CREATE TABLE c_survey  (
+  survey_id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  code varchar(20) default NULL,
+  title text default NULL,
+  subtitle text default NULL,
+  author varchar(20) default NULL,
+  lang varchar(20) default NULL,
+  avail_from date default NULL,
+  avail_till date default NULL,
+  is_shared char(1) default '1',
+  template varchar(20) default NULL,
+  intro text,
+  surveythanks text,
+  creation_date datetime NOT NULL default '0000-00-00 00:00:00',
+  invited int NOT NULL,
+  answered int NOT NULL,
+  invite_mail text NOT NULL,
+  reminder_mail text NOT NULL,
+  mail_subject VARCHAR( 255 ) NOT NULL,
+  anonymous enum('0','1') NOT NULL default '0',
+  access_condition TEXT DEFAULT NULL,
+  shuffle bool NOT NULL default '0',
+  one_question_per_page bool NOT NULL default '0',
+  survey_version varchar(255) NOT NULL default '',
+  parent_id int unsigned NOT NULL,
+  survey_type int NOT NULL default 0,
+  show_form_profile int NOT NULL default 0,
+  form_fields TEXT NOT NULL,
+  session_id int unsigned NOT NULL default 0,
+  visible_results int unsigned DEFAULT 0,
+  PRIMARY KEY  (survey_id, c_id)
+);
+
+ALTER TABLE c_survey  ADD INDEX ( session_id );
+CREATE TABLE c_survey_invitation(
+  survey_invitation_id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  survey_code varchar(20) NOT NULL,
+  user varchar(250) NOT NULL,
+  invitation_code varchar(250) NOT NULL,
+  invitation_date datetime NOT NULL,
+  reminder_date datetime NOT NULL,
+  answered int NOT NULL default 0,
+  session_id int UNSIGNED NOT NULL default 0,
+  group_id INT NOT NULL,
+  PRIMARY KEY (survey_invitation_id, c_id)
+);
+
+CREATE TABLE c_survey_question  (
+  question_id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  survey_id int unsigned NOT NULL,
+  survey_question text NOT NULL,
+  survey_question_comment text NOT NULL,
+  type varchar(250) NOT NULL,
+  display varchar(10) NOT NULL,
+  sort int NOT NULL,
+  shared_question_id int,
+  max_value int,
+  survey_group_pri int unsigned NOT NULL default '0',
+  survey_group_sec1 int unsigned NOT NULL default '0',
+  survey_group_sec2 int unsigned NOT NULL default '0',
+  PRIMARY KEY (question_id, c_id)
+);
+
+CREATE TABLE c_survey_question_option  (
+  question_option_id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  question_id int unsigned NOT NULL,
+  survey_id int unsigned NOT NULL,
+  option_text text NOT NULL,
+  sort int NOT NULL,
+  value int NOT NULL default '0',
+  PRIMARY KEY  (question_option_id, c_id)
+);
+
+CREATE TABLE c_survey_answer  (
+  answer_id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  survey_id int unsigned NOT NULL,
+  question_id int unsigned NOT NULL,
+  option_id TEXT NOT NULL,
+  value int unsigned NOT NULL,
+  user varchar(250) NOT NULL,
+  PRIMARY KEY  (answer_id, c_id)
+);
+
+CREATE TABLE c_survey_group(
+  id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  name varchar(20) NOT NULL,
+  description varchar(255) NOT NULL,
+  survey_id int unsigned NOT NULL,
+  PRIMARY KEY  (id, c_id)
+);
+
+CREATE TABLE c_glossary(
+  glossary_id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  name varchar(255) NOT NULL,
+  description text not null,
+  display_order int,
+  session_id int default 0,
+  PRIMARY KEY (glossary_id, c_id)
+);
+
+ALTER TABLE c_glossary ADD INDEX ( session_id );
+
+CREATE TABLE c_notebook (
+  notebook_id int unsigned NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  user_id int unsigned NOT NULL,
+  course varchar(40) not null,
+  session_id int NOT NULL default 0,
+  title varchar(255) NOT NULL,
+  description text NOT NULL,
+  creation_date datetime NOT NULL default '0000-00-00 00:00:00',
+  update_date datetime NOT NULL default '0000-00-00 00:00:00',
+  status int,
+  PRIMARY KEY (notebook_id, c_id)
+);
+
+CREATE TABLE c_attendance(
+    id int NOT NULL auto_increment,
+    c_id INT NOT NULL,
+    name text NOT NULL,
+    description TEXT NULL,
+    active tinyint NOT NULL default 1,
+    attendance_qualify_title varchar(255) NULL,
+    attendance_qualify_max int NOT NULL default 0,
+    attendance_weight float(6,2) NOT NULL default '0.0',
+    session_id int NOT NULL default 0,
+    locked int NOT NULL default 0,
+    PRIMARY KEY (id, c_id)
+);
+
+ALTER TABLE c_attendance ADD INDEX (session_id);
+ALTER TABLE c_attendance ADD INDEX (active);
+
+CREATE TABLE c_attendance_sheet  (
+    c_id INT NOT NULL,
+    user_id int NOT NULL,
+    attendance_calendar_id int NOT NULL,
+    presence tinyint NOT NULL DEFAULT 0,
+    PRIMARY KEY(c_id, user_id, attendance_calendar_id)
+);
+
+ALTER TABLE c_attendance_sheet  ADD INDEX (presence);
+
+CREATE TABLE c_attendance_calendar(
+    id int NOT NULL auto_increment,
+    c_id INT NOT NULL,
+    attendance_id int NOT NULL ,
+    date_time datetime NOT NULL default '0000-00-00 00:00:00',
+    done_attendance tinyint NOT NULL default 0,
+    PRIMARY KEY(id, c_id)
+);
+
+ALTER TABLE c_attendance_calendar ADD INDEX (attendance_id);
+ALTER TABLE c_attendance_calendar ADD INDEX (done_attendance);
+
+CREATE TABLE c_attendance_result(
+    id int NOT NULL auto_increment,
+    c_id INT NOT NULL,
+    user_id int NOT NULL,
+    attendance_id int NOT NULL,
+    score int NOT NULL DEFAULT 0,
+    PRIMARY KEY  (id, c_id)
+);
+
+ALTER TABLE c_attendance_result ADD INDEX (attendance_id);
+ALTER TABLE c_attendance_result ADD INDEX (user_id);
+
+CREATE TABLE c_attendance_sheet_log(
+  id int  NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  attendance_id int  NOT NULL DEFAULT 0,
+  lastedit_date datetime  NOT NULL DEFAULT '0000-00-00 00:00:00',
+  lastedit_type varchar(200)  NOT NULL,
+  lastedit_user_id int  NOT NULL DEFAULT 0,
+  calendar_date_value datetime NULL,
+  PRIMARY KEY (id, c_id)
+);
+
+CREATE TABLE c_thematic(
+  id int NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  title varchar(255) NOT NULL,
+  content text NULL,
+  display_order int unsigned NOT NULL DEFAULT 0,
+  active tinyint NOT NULL DEFAULT 0,
+  session_id int NOT NULL DEFAULT 0,
+  PRIMARY KEY (id, c_id)
+);
+
+ALTER TABLE c_thematic ADD INDEX (active, session_id);
+
+CREATE TABLE c_thematic_plan(
+  id int NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  thematic_id int NOT NULL,
+  title varchar(255) NOT NULL,
+  description text NULL,
+  description_type int NOT NULL,
+  PRIMARY KEY (id, c_id)
+);
+
+ALTER TABLE c_thematic_plan ADD INDEX (thematic_id, description_type);
+
+CREATE TABLE c_thematic_advance(
+  id int NOT NULL auto_increment,
+  c_id INT NOT NULL,
+  thematic_id int NOT NULL,
+  attendance_id int NOT NULL DEFAULT 0,
+  content text NULL,
+  start_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  duration int NOT NULL DEFAULT 0,
+  done_advance tinyint NOT NULL DEFAULT 0,
+  PRIMARY KEY (id, c_id)
+);
+
+ALTER TABLE c_thematic_advance ADD INDEX (thematic_id);
+
+CREATE TABLE IF NOT EXISTS c_metadata (
+  c_id INT NOT NULL,
+  eid VARCHAR(250) NOT NULL,
+  mdxmltext TEXT default '',
+  md5 CHAR(32) default '',
+  htmlcache1 TEXT default '',
+  htmlcache2 TEXT default '',
+  indexabletext TEXT default '',
+  PRIMARY KEY (c_id, eid)
+);
+

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

@@ -12,7 +12,7 @@
 
 /*      CONSTANTS */
 
-define('SYSTEM_MAIN_DATABASE_FILE', 'db_main.sql');
+define('SYSTEM_MAIN_DATABASE_FILE', 'main.sql');
 define('COUNTRY_DATA_FILENAME', 'country_data.csv');
 define('COURSES_HTACCESS_FILENAME', 'htaccess.dist');
 define('SYSTEM_CONFIG_FILENAME', 'configuration.dist.php');

+ 1 - 1
main/install/install_db.inc.php

@@ -118,7 +118,7 @@ load_main_database($installation_settings);
 
 AddCourse::drop_course_tables();
 
-AddCourse::create_course_tables();
+load_database_script('course.sql');
 
 $track_countries_table = "track_c_countries";
 fill_track_countries_table($track_countries_table);

+ 2 - 2
main/install/db_main.sql → main/install/main.sql

@@ -3320,7 +3320,7 @@ CREATE TABLE track_e_links (
   links_link_id int NOT NULL default 0,
   links_session_id INT NOT NULL DEFAULT 0,
   PRIMARY KEY  (links_id),
-  KEY idx_tel_c_id (links_cours_id),
+  KEY idx_tel_c_id (c_id),
   KEY idx_tel_user_id (links_user_id)
 );
 
@@ -3483,5 +3483,5 @@ CREATE TABLE c_attendance_calendar_rel_group (
 
 -- Version
 LOCK TABLES settings_current WRITE;
-UPDATE settings_current SET selected_value = '1.10.0.21' WHERE variable = 'chamilo_database_version';
+UPDATE settings_current SET selected_value = '1.10.0.22' WHERE variable = 'chamilo_database_version';
 UNLOCK TABLES;

+ 4 - 2
main/install/migrate-db-1.9.0-1.10.0-pre.sql

@@ -91,7 +91,9 @@ INSERT INTO settings_options (variable, value, display_text) VALUES ('documents_
 
 -- xxCOURSExx
 
-ALTER TABLE c_survey ADD visible_results INT UNSIGNED DEFAULT 0;
+ALTER TABLE c_survey ADD COLUMN visible_results INT UNSIGNED DEFAULT 0;
+ALTER TABLE c_survey_invitation ADD COLUMN group_id INT NOT NULL;
+,
 ALTER TABLE c_lp_item ADD COLUMN prerequisite_min_score float;
 ALTER TABLE c_lp_item ADD COLUMN prerequisite_max_score float;
 ALTER TABLE c_student_publication ADD COLUMN document_id int DEFAULT 0;
@@ -103,4 +105,4 @@ CREATE TABLE IF NOT EXISTS c_student_publication_comment (id INT PRIMARY KEY NOT
 CREATE TABLE IF NOT EXISTS c_attendance_calendar_rel_group (id int NOT NULL auto_increment PRIMARY KEY, c_id INT NOT NULL, group_id INT NOT NULL, calendar_id INT NOT NULL);
 
 -- Do not move this query
-UPDATE settings_current SET selected_value = '1.10.0.21' WHERE variable = 'chamilo_database_version';
+UPDATE settings_current SET selected_value = '1.10.0.22' WHERE variable = 'chamilo_database_version';

+ 1 - 1
main/install/update-db-1.8.8-1.9.0.inc.php

@@ -297,7 +297,7 @@ if (defined('SYSTEM_INSTALLATION')) {
     global $_configuration;
 
     AddCourse::drop_course_tables();
-    AddCourse::create_course_tables();
+    load_database_script('course.sql');
 
     $prefix = '';
     if ($singleDbForm) {

+ 2 - 2
main/newscorm/lp_view.php

@@ -532,8 +532,8 @@ if ($is_allowed_to_edit) {
       {
       load: [
           { type:"script", id:"_fr1", src:"<?php echo api_get_jquery_web_path(); ?>"},
-          { type:"script", id:"_fr4", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.min.js"},
-          { type:"stylesheet", id:"_fr5", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css"},
+          { type:"script", id:"_fr4", src:"<?php echo api_get_jquery_ui_js_web_path(); ?>"},
+          { type:"stylesheet", id:"_fr5", src:"<?php echo api_get_jquery_ui_css_web_path(); ?>"},
           { type:"script", id:"_fr2", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.highlight.js"}
       ]}
       );

+ 16 - 16
main/social/search.php

@@ -34,15 +34,18 @@ if (!empty($extra_fields)) {
         }
     }
 }
-$user_info    = UserManager::get_user_info_by_id($user_id);
+$user_info = UserManager::get_user_info_by_id($user_id);
 //Block Social Avatar
 $social_avatar_block = SocialManager::getSocialUserBlock($user_id, 'search');
 //Block Social Menu
 $social_menu_block = SocialManager::show_social_menu('search');
-$social_right_content = '<div class="span9">'.UserManager::get_search_form($query).'</div>';
+$social_right_content = '';
+$searchForm = UserManager::get_search_form($query);
 
 $groups = array();
 $totalGroups = array();
+$users = array();
+$totalUsers = array();
 
 // I'm searching something
 if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2) ) {
@@ -54,7 +57,7 @@ if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2) )
 
         $from = intval(($page - 1) * $itemPerPage);
         // Get users from tags
-        $users  = UserManager::get_all_user_tags($_GET['q'], 0, $from, $itemPerPage);
+        $users = UserManager::get_all_user_tags($_GET['q'], 0, $from, $itemPerPage);
     }
 
     if ($_GET['search_type']=='0' || $_GET['search_type']=='2') {
@@ -89,7 +92,7 @@ if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2) )
                         <button class="btn btn-mini"><i class="fa fa-envelope"></i> '.get_lang('SendMessage').'</button></a>';
             if (empty($user['picture_uri'])) {
                 $picture['file'] = api_get_path(WEB_CODE_PATH).'img/unknown.jpg';
-                $img             = '<img src="'.$picture['file'].'">';
+                $img = '<img src="'.$picture['file'].'">';
             } else {
                 $picture = UserManager::get_picture_user(
                     $user['user_id'],
@@ -110,10 +113,9 @@ if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2) )
             $user_info['complete_name'] = Display::url($status_icon.$user_info['complete_name'], $url);
             $invitations = $user['tag'].$send_inv.$send_msg;
 
-            $results .= '<li class="span3">
-                            <div class="">
-                            <div class="row-fluid">
-                                <div class="span12">
+            $results .= '<li class="col-md-3">
+                            <div class="row">
+                                <div class="col-md-12">
                                     '.$user_info['complete_name'].'
                                 </div>
                                 <div class="col-md-4">
@@ -126,7 +128,6 @@ if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2) )
                                     '.$invitations.'
                                     </div>
                                 </div>
-                                </div>
                             </div>
                         </li>';
         }
@@ -148,10 +149,9 @@ if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2) )
         $totalUsers
     );
 
-
     $grid_groups = array();
     if (is_array($groups) && count($groups) > 0) {
-        $social_right_content .= '<div class="span9">';
+        $social_right_content .= '<div class="col-md-9">';
         $social_right_content .= Display::page_subheader(get_lang('Groups'));
 
         $social_right_content .= '<ul class="thumbnails">';
@@ -178,14 +178,14 @@ if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2) )
             $item_1  = Display::tag('h3', $url_open.$name.$url_close).$members;
 
             $social_right_content .= '
-                <li class="span8">
-                    <div class="row-fluid">
-                        <div class="span1">
+                <li class="col-md-8">
+                    <div class="row">
+                        <div class="col-md-1">
                             <div class="media">
                                 '.$item_0.'
                             </div>
                         </div>
-                        <div class="span6">
+                        <div class="col-md-6">
                             '.$item_1.'
                             <p>'.$group['description'].'</p>
                             <p>'.$tags.'</p>
@@ -213,11 +213,11 @@ if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2) )
     );
 }
 
-
 $tpl = new Template($tool_name);
 $tpl->assign('social_avatar_block', $social_avatar_block);
 $tpl->assign('social_menu_block', $social_menu_block);
 $tpl->assign('social_right_content', $social_right_content);
+$tpl->assign('search_form', $searchForm);
 
 $formModalTpl =  new Template();
 $formModalTpl->assign('messageForm', MessageManager::generate_message_form('send_message'));

+ 60 - 12
main/survey/survey.lib.php

@@ -3368,9 +3368,19 @@ class SurveyUtil
      * @version January 2007
      *
      */
-    static function save_invitations($users_array, $invitation_title, $invitation_text, $reminder = 0, $sendmail = 0, $remindUnAnswered = 0)
-    {
-        if (!is_array($users_array)) return 0; // Should not happen
+    public static function save_invitations(
+        $users_array,
+        $invitation_title,
+        $invitation_text,
+        $reminder = 0,
+        $sendmail = 0,
+        $remindUnAnswered = 0
+    ) {
+        if (!is_array($users_array)) {
+            // Should not happen
+
+            return 0;
+        }
 
         // Getting the survey information
         $survey_data = survey_manager::get_survey($_GET['survey_id']);
@@ -3386,13 +3396,38 @@ class SurveyUtil
 
         $counter = 0;  // Nr of invitations "sent" (if sendmail option)
         $course_id = api_get_course_int_id();
-
         $session_id = api_get_session_id();
 
-        foreach ($users_array as $key=>$value) {
-            if (!isset($value) || $value == '') continue;
+        $result = CourseManager::separateUsersGroups($users_array);
+
+        $groupList = $result['groups'];
+        $users_array = $result['users'];
+
+        foreach ($groupList as $groupId) {
+            $userGroupList = GroupManager::getStudents($groupId);
+            $userGroupIdList = array_column($userGroupList, 'user_id');
+            $users_array = array_merge($users_array, $userGroupIdList);
+
+            $params = array(
+                'c_id' => $course_id,
+                'session_id' => $session_id,
+                'group_id' => $groupId,
+                'survey_code' => $survey_data['code']
+            );
+            self::save_invitation($params);
+        }
+
+        $users_array = array_unique($users_array);
+
+        foreach ($users_array as $key => $value) {
+            if (!isset($value) || $value == '') {
+                continue;
+            }
+
             // Skip user if reminding only unanswered people
-            if (in_array($value, $exclude_users)) continue;
+            if (in_array($value, $exclude_users)) {
+                continue;
+            }
             // Get the unique invitation code if we already have it
             if ($reminder == 1 && array_key_exists($value, $survey_invitations)) {
                 $invitation_code = $survey_invitations[$value]['invitation_code'];
@@ -3403,8 +3438,10 @@ class SurveyUtil
             // Store the invitation if user_id not in $already_invited['course_users'] OR email is not in $already_invited['additional_users']
             $addit_users_array = isset($already_invited['additional_users']) && !empty($already_invited['additional_users']) ? explode(';', $already_invited['additional_users']) : array();
 
-            $my_alredy_invited = ($already_invited['course_users'] == null) ? array() : $already_invited['course_users'];
-            if ((is_numeric($value) && !in_array($value, $my_alredy_invited)) || (!is_numeric($value) && !in_array($value, $addit_users_array))) {
+            $my_alredy_invited = $already_invited['course_users'] == null ? array() : $already_invited['course_users'];
+            if ((is_numeric($value) && !in_array($value, $my_alredy_invited)) ||
+                (!is_numeric($value) && !in_array($value, $addit_users_array))
+            ) {
                 $new_user = true;
                 if (!array_key_exists($value, $survey_invitations)) {
                     $params = array(
@@ -3418,6 +3455,7 @@ class SurveyUtil
                     self::save_invitation($params);
                 }
             }
+
             // Send the email if checkboxed
             if (($new_user || $reminder == 1) && $sendmail != 0) {
                 // Make a change for absolute url
@@ -3430,14 +3468,19 @@ class SurveyUtil
                 $counter++;
             }
         }
+
         return $counter; // Number of invitations sent
     }
 
+    /**
+     * @param $params
+     * @return bool|int
+     */
     static function save_invitation($params)
     {
         // Database table to store the invitations data
         $table_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION);
-        if (!empty($params['c_id']) && !empty($params['user']) && !empty($params['survey_code'])) {
+        if (!empty($params['c_id']) && (!empty($params['user']) || !empty($params['group_id'])) && !empty($params['survey_code'])) {
             return Database::insert($table_survey_invitation, $params);
         }
         return false;
@@ -3580,7 +3623,7 @@ class SurveyUtil
 
         // Selecting all the invitations of this survey AND the additional emailaddresses (the left join)
         $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname';
-        $sql = "SELECT user
+        $sql = "SELECT user, group_id
 				FROM $table_survey_invitation as table_invitation
 				WHERE
 				    table_invitation.c_id = $course_id AND
@@ -3590,17 +3633,22 @@ class SurveyUtil
 
         $defaults = array();
         $defaults['course_users'] = array();
-        $defaults['additional_users'] = array();
+        $defaults['additional_users'] = array(); // Textarea
+        $defaults['users'] = array(); // user and groups
 
         $result = Database::query($sql);
         while ($row = Database::fetch_array($result)) {
             if (is_numeric($row['user'])) {
                 $defaults['course_users'][] = $row['user'];
+                $defaults['users'][] = 'USER:'.$row['user'];
             } else {
                 if (!empty($row['user'])) {
                     $defaults['additional_users'][] = $row['user'];
                 }
             }
+            if (isset($row['group_id'])) {
+                $defaults['users'][] = 'GROUP:'.$row['group_id'];
+            }
         }
 
         if (!empty($defaults['course_users'])) {

+ 48 - 12
main/survey/survey_invite.php

@@ -67,7 +67,7 @@ Display::display_header($tool_name,'Survey');
 echo '<script>
 $(function() {
     $("#check_mail").change(function() {
-        $("#mail_text").toggle();
+        $("#mail_text_wrapper").toggle();
     });
 });
 </script>';
@@ -91,7 +91,11 @@ if ($survey_data['invited'] > 0 && !isset($_POST['submit'])) {
 }
 
 // Building the form for publishing the survey
-$form = new FormValidator('publish_form', 'post', api_get_self().'?survey_id='.$survey_id.'&'.api_get_cidReq());
+$form = new FormValidator(
+	'publish_form',
+	'post',
+	api_get_self().'?survey_id='.$survey_id.'&'.api_get_cidReq()
+);
 $form->addElement('header', '', $tool_name);
 
 // Course users
@@ -105,21 +109,41 @@ $possible_users = array();
 foreach ($complete_user_list as & $user) {
 	$possible_users[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']);
 }
-$users = $form->addElement('advmultiselect', 'course_users', get_lang('CourseUsers'), $possible_users, 'style="width: 250px; height: 200px;"');
+
+
+CourseManager::addUserGroupMultiSelect($form, array());
+
+/*$form->addElement(
+	'advmultiselect',
+	'course_users',
+	get_lang('CourseUsers'),
+	$possible_users,
+	'style="width: 250px; height: 200px;"'
+);*/
 
 // Additional users
-$form->addElement('textarea', 'additional_users', array(get_lang('AdditonalUsers'), get_lang('AdditonalUsersComment')), array('class' => 'span6', 'rows' => 5));
+$form->addElement(
+	'textarea',
+	'additional_users',
+	array(get_lang('AdditonalUsers'), get_lang('AdditonalUsersComment')),
+	array('rows' => 5)
+);
 
 $form->addElement('html', '<div id="check_mail">');
 $form->addElement('checkbox', 'send_mail','', get_lang('SendMail'));
 $form->addElement('html', '</div>');
 
-$form->addElement('html', '<div id="mail_text">');
+$form->addElement('html', '<div id="mail_text_wrapper">');
 
 // The title of the mail
-$form->addElement('text', 'mail_title', get_lang('MailTitle'), array('class' => 'span6'));
+$form->addText('mail_title', get_lang('MailTitle'), false);
 // The text of the mail
-$form->addElement('html_editor', 'mail_text', array(get_lang('MailText'), get_lang('UseLinkSyntax')), null, array('ToolbarSet' => 'Survey', 'Width' => '100%', 'Height' => '150'));
+$form->addHtmlEditor(
+	'mail_text',
+	array(get_lang('MailText'), get_lang('UseLinkSyntax')),
+	false,
+	array('ToolbarSet' => 'Survey', 'Height' => '150')
+);
 $form->addElement('html', '</div>');
 // You cab send a reminder to unanswered people if the survey is not anonymous
 if ($survey_data['anonymous'] != 1) {
@@ -129,7 +153,7 @@ if ($survey_data['anonymous'] != 1) {
 $form->addElement('checkbox', 'resend_to_all', '', get_lang('ReminderResendToAllUsers'));
 
 // Submit button
-$form->addElement('style_submit_button', 'submit', get_lang('PublishSurvey'), 'class="save"');
+$form->addButtonSave(get_lang('PublishSurvey'));
 // The rules (required fields)
 /*if ($survey_data['send_mail'] == 0) {
     $form->addRule('mail_title', get_lang('ThisFieldIsRequired'), 'required');
@@ -152,7 +176,7 @@ $form->addElement('label', null, $auto_survey_link);
 
 if ($form->validate()) {
    	$values = $form->exportValues();
-    if ($values['send_mail'] == 1) {
+    if (isset($values['send_mail']) && $values['send_mail'] == 1) {
         if (empty($values['mail_title']) || empty($values['mail_text'])) {
             Display :: display_error_message(get_lang('FormHasErrorsPleaseComplete'));
             // Getting the invited users
@@ -172,10 +196,22 @@ if ($form->validate()) {
         }
     }
     // Save the invitation mail
-	SurveyUtil::save_invite_mail($values['mail_text'], $values['mail_title'], !empty($survey_data['invite_mail']));
+	SurveyUtil::save_invite_mail(
+		$values['mail_text'],
+		$values['mail_title'],
+		!empty($survey_data['invite_mail'])
+	);
+
 	// Saving the invitations for the course users
-	$count_course_users = SurveyUtil::save_invitations($values['course_users'], $values['mail_title'],
-    $values['mail_text'], $values['resend_to_all'], $values['send_mail'], $values['remindUnAnswered']);
+	$count_course_users = SurveyUtil::save_invitations(
+		$values['users'],
+		$values['mail_title'],
+		$values['mail_text'],
+		$values['resend_to_all'],
+		$values['send_mail'],
+		$values['remindUnAnswered']
+	);
+
 	// Saving the invitations for the additional users
 	$values['additional_users'] = $values['additional_users'].';'; 	// This is for the case when you enter only one email
 	$temp = str_replace(',', ';', $values['additional_users']);		// This is to allow , and ; as email separators

+ 2 - 6
main/survey/survey_question.php

@@ -116,15 +116,11 @@ class survey_question
     public function renderForm()
     {
         if (isset($_GET['question_id']) and !empty($_GET['question_id'])) {
-            $icon = 'pencil';
-            $text = get_lang('ModifyQuestionSurvey');
+            $this->buttonList[] = $this->getForm()->addButtonUpdate(get_lang('ModifyQuestionSurvey'), 'save', true);
         } else {
-            $icon = 'check';
-            $text = get_lang('CreateQuestionSurvey');
+            $this->buttonList[] = $this->getForm()->addButtonSave(get_lang('CreateQuestionSurvey'), 'save', true);
         }
 
-        $this->buttonList[] = $this->getForm()->createElement('button', 'save', $text, $icon);
-
         $this->getForm()->addGroup($this->buttonList, 'buttons');
     }
 

+ 0 - 2
main/template/default/layout/main.tpl

@@ -13,8 +13,6 @@
     {% if show_footer == true %}
         </div> <!-- end of #row" -->
         </div> <!-- end of #main" -->
-        </div> <!-- end of #page section -->
-        </div> <!-- end of #wrapper section -->
     {% endif %}
     {% include template ~ "/layout/main_footer.tpl" %}
 {% endblock %}

+ 0 - 2
main/template/default/layout/show_footer.tpl

@@ -19,8 +19,6 @@
 {% if show_footer == true %}
         </div> <!-- end of #row" -->
     </div> <!-- end of #main" -->
-    </div> <!-- end of #page section -->
-</div> <!-- end of #wrapper section -->
 
 {% endif %}
 

+ 9 - 13
main/template/default/social/search.tpl

@@ -8,26 +8,22 @@
             {{ social_menu_block }}
         </div>
     </div>
-    <div id="wallMessages" class="col-md-5" style="min-height:1px">
+    <div class="col-md-9" style="min-height:1px">
         <div class="row">
             <div class="col-md-12">
                 <div id="message_ajax_reponse" class=""></div>
             </div>
         </div>
         <div class="row">
-            {{ social_right_content}}
-        </div>
-        <div id="display_response_id" class="col-md-12"></div>
-        {{ socialAutoExtendLink }}
-    </div>
-    <div class="col-md-4">
-        <div class="row">
-            {{ socialRightInformation}}
+            <div class="col-md-12">
+                {{ search_form }}
+            </div>
+            {{ social_right_content }}
         </div>
     </div>
 </div>
 
-    {% if formModals is defined %}
-        {{ formModals }}
-    {% endif %}
-{% endblock %}
+{% if formModals is defined %}
+    {{ formModals }}
+{% endif %}
+{% endblock %}

+ 1 - 1
main/tracking/courseLog.php

@@ -263,7 +263,7 @@ $form_search = new FormValidator(
     FormValidator::LAYOUT_INLINE
 );
 $renderer = $form_search->defaultRenderer();
-$renderer->setElementTemplate('<span>{element}</span>');
+$renderer->setCustomElementTemplate('<span>{element}</span>');
 $form_search->addElement('hidden', 'from', Security::remove_XSS($from));
 $form_search->addElement('hidden', 'session_id', $sessionId);
 $form_search->addElement('hidden', 'id_session', $sessionId);

+ 1 - 1
main/tracking/course_log_resources.php

@@ -106,7 +106,7 @@ $form = new FormValidator(
     false
 );
 $renderer = $form->defaultRenderer();
-$renderer->setElementTemplate('<span>{element}</span>');
+$renderer->setCustomElementTemplate('<span>{element}</span>');
 $form->addElement('text', 'keyword', get_lang('keyword'));
 $form->addElement('hidden', 'cidReq', api_get_course_id());
 $form->addElement('hidden', 'id_session', $session_id);

+ 1 - 1
main/upload/upload_word.php

@@ -153,7 +153,7 @@ $user_file_template =
         <!-- BEGIN error --><br /><span class="form_error">{error}</span><!-- END error -->
 </div>
 EOT;
-$renderer->setElementTemplate($user_file_template);
+$renderer->setCustomElementTemplate($user_file_template);
 
 $form -> addElement ('file', 'user_file','<img src="../img/word_big.gif" align="absbottom" />');
 if (api_get_setting('search_enabled')=='true') {

+ 1 - 1
main/user/subscribe_user.php

@@ -61,7 +61,7 @@ if (api_get_setting('ProfilingFilterAddingUsers') == 'true') {
 // Build search-form
 $form = new FormValidator('search_user', 'get', '', '', null, false);
 $renderer = $form->defaultRenderer();
-$renderer->setElementTemplate('<span>{element}</span> ');
+$renderer->setCustomElementTemplate('<span>{element}</span> ');
 $form->addText('keyword', '', false);
 $form->addElement('hidden', 'type', $type);
 $form->addButtonSearch(get_lang('Search'));

+ 2 - 2
plugin/before_login/index.php

@@ -36,7 +36,7 @@ if (api_is_anonymous()) {
 
     $renderer =& $form->defaultRenderer();
     $renderer->setFormTemplate('<form{attributes}><table border="0" cellpadding="5" cellspacing="0" width="100%">{content}</table></form>');
-    $renderer->setElementTemplate('<tr><td>{element}</td></tr>');
+    $renderersetCustomElementTemplate->setCustomElementTemplate('<tr><td>{element}</td></tr>');
 
     $form->addElement('html', $option1);
     $form->addElement('checkbox', 'left', null, get_lang('Yes'));
@@ -57,7 +57,7 @@ if (api_is_anonymous()) {
         $renderer =& $form2->defaultRenderer();
         $renderer->setHeaderTemplate('');
         $renderer->setFormTemplate('<form{attributes}><table border="0" cellpadding="5" cellspacing="0" width="100%">{content}</table></form>');
-        $renderer->setElementTemplate('<tr><td>{element}</td></tr>');
+        $renderer->setCustomElementTemplate('<tr><td>{element}</td></tr>');
 
         $form2->addElement('html', $option2);
         $form2->addElement('checkbox', 'right', null, get_lang('Yes'));

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

@@ -252,7 +252,7 @@ if ($isAdmin) {
     // Create a search-box
     $form = new FormValidator('search_simple', 'get', '', '', null, false);
     $renderer = & $form->defaultRenderer();
-    $renderer->setElementTemplate('<span>{element}</span> ');
+    $renderer->setCustomElementTemplate('<span>{element}</span> ');
     $form->addElement('text', 'keyword', get_lang('keyword'), 'size="25"');
     $form->addElement('style_submit_button', 'submit_simple', get_lang('Search'), 'class="search"');
     $form->addElement('static', 'search_advanced_link', null,

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů