Browse Source

Updating vendors with chash.

Julio Montoya 11 years ago
parent
commit
ec4a10e984
78 changed files with 33795 additions and 4 deletions
  1. 1 1
      vendor/autoload.php
  2. 8 0
      vendor/chamilo/chash/.travis.yml
  3. 120 0
      vendor/chamilo/chash/README.md
  4. 94 0
      vendor/chamilo/chash/chash.php
  5. 30 0
      vendor/chamilo/chash/composer.json
  6. 1301 0
      vendor/chamilo/chash/composer.lock
  7. 21 0
      vendor/chamilo/chash/createPhar.php
  8. 708 0
      vendor/chamilo/chash/license.html
  9. 24 0
      vendor/chamilo/chash/phpunit.xml
  10. 62 0
      vendor/chamilo/chash/src/Chash/Command/Database/CommonChamiloDatabaseCommand.php
  11. 79 0
      vendor/chamilo/chash/src/Chash/Command/Database/DropDatabaseCommand.php
  12. 47 0
      vendor/chamilo/chash/src/Chash/Command/Database/DumpCommand.php
  13. 114 0
      vendor/chamilo/chash/src/Chash/Command/Database/FullBackupCommand.php
  14. 57 0
      vendor/chamilo/chash/src/Chash/Command/Database/RestoreCommand.php
  15. 71 0
      vendor/chamilo/chash/src/Chash/Command/Database/RunSQLCommand.php
  16. 61 0
      vendor/chamilo/chash/src/Chash/Command/Database/SQLCountCommand.php
  17. 59 0
      vendor/chamilo/chash/src/Chash/Command/Database/ShowConnInfoCommand.php
  18. 54 0
      vendor/chamilo/chash/src/Chash/Command/Files/CleanConfigFilesCommand.php
  19. 55 0
      vendor/chamilo/chash/src/Chash/Command/Files/CleanDataFilesCommand.php
  20. 58 0
      vendor/chamilo/chash/src/Chash/Command/Files/CleanTempFolderCommand.php
  21. 89 0
      vendor/chamilo/chash/src/Chash/Command/Files/GenerateTempFileStructureCommand.php
  22. 63 0
      vendor/chamilo/chash/src/Chash/Command/Files/MailConfCommand.php
  23. 139 0
      vendor/chamilo/chash/src/Chash/Command/Files/SetPermissionsAfterInstallCommand.php
  24. 1143 0
      vendor/chamilo/chash/src/Chash/Command/Installation/CommonCommand.php
  25. 551 0
      vendor/chamilo/chash/src/Chash/Command/Installation/InstallCommand.php
  26. 109 0
      vendor/chamilo/chash/src/Chash/Command/Installation/StatusCommand.php
  27. 876 0
      vendor/chamilo/chash/src/Chash/Command/Installation/UpgradeCommand.php
  28. 111 0
      vendor/chamilo/chash/src/Chash/Command/Installation/WipeCommand.php
  29. 99 0
      vendor/chamilo/chash/src/Chash/Command/Translation/AddSubLanguageCommand.php
  30. 77 0
      vendor/chamilo/chash/src/Chash/Command/Translation/DisableLanguageCommand.php
  31. 80 0
      vendor/chamilo/chash/src/Chash/Command/Translation/EnableLanguageCommand.php
  32. 119 0
      vendor/chamilo/chash/src/Chash/Command/Translation/ExportLanguageCommand.php
  33. 147 0
      vendor/chamilo/chash/src/Chash/Command/Translation/ImportLanguageCommand.php
  34. 86 0
      vendor/chamilo/chash/src/Chash/Command/Translation/ListLanguagesCommand.php
  35. 90 0
      vendor/chamilo/chash/src/Chash/Command/Translation/PlatformLanguageCommand.php
  36. 79 0
      vendor/chamilo/chash/src/Chash/Command/User/ChangePassCommand.php
  37. 43 0
      vendor/chamilo/chash/src/Chash/Command/User/CommonChamiloUserCommand.php
  38. 59 0
      vendor/chamilo/chash/src/Chash/Command/User/DisableAdminsCommand.php
  39. 66 0
      vendor/chamilo/chash/src/Chash/Command/User/MakeAdminCommand.php
  40. 62 0
      vendor/chamilo/chash/src/Chash/Command/User/ResetLoginCommand.php
  41. 89 0
      vendor/chamilo/chash/src/Chash/Command/User/SetLanguageCommand.php
  42. 29 0
      vendor/chamilo/chash/src/Chash/DoctrineExtensions/TablePrefix.php
  43. 545 0
      vendor/chamilo/chash/src/Chash/Helpers/ConfigurationHelper.php
  44. 41 0
      vendor/chamilo/chash/src/Chash/Migrations/Version10.php
  45. 23 0
      vendor/chamilo/chash/src/Chash/Migrations/Version11.php
  46. 24 0
      vendor/chamilo/chash/src/Chash/Migrations/Version8.php
  47. 23 0
      vendor/chamilo/chash/src/Chash/Migrations/Version9.php
  48. 4 0
      vendor/chamilo/chash/src/Chash/Migrations/migrations.yml
  49. 2011 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/db_course.sql
  50. 3613 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/db_main.sql
  51. 38 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/migrate-db-1.9.0-1.10.0-post.sql
  52. 374 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/migrate-db-1.9.0-1.10.0-pre.sql
  53. 220 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/update-db-1.9.0-1.10.0.inc.php
  54. 1736 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.8.7/db_course1.sql
  55. 1736 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.8.7/db_course2.sql
  56. 2420 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.8.7/db_main.sql
  57. 267 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.8.7/db_stats.sql
  58. 41 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.8.7/db_user.sql
  59. 1782 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.8.8/db_course1.sql
  60. 1782 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.8.8/db_course2.sql
  61. 2648 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.8.8/db_main.sql
  62. 268 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.8.8/db_stats.sql
  63. 44 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.8.8/db_user.sql
  64. 231 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.8.8/migrate-db-1.8.7-1.8.8-pre.sql
  65. 183 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.8.8/update-db-1.8.7-1.8.8.inc.php
  66. 1947 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.9.0/db_course.sql
  67. 3028 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.9.0/db_main.sql
  68. 329 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.9.0/db_stats.sql
  69. 53 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.9.0/db_user.sql
  70. 326 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.9.0/migrate-db-1.8.8-1.9.0-pre.sql
  71. 557 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.9.0/update-db-1.8.8-1.9.0.inc.php
  72. 8 0
      vendor/chamilo/chash/src/Chash/Resources/Database/1.9.0/update-files-1.8.8-1.9.0.inc.php
  73. 157 0
      vendor/chamilo/chash/tests/Chash/Resources/configuration.php
  74. 13 0
      vendor/chamilo/chash/tests/Chash/Tests/Command/Database/DropDatabaseCommandTest.php
  75. 60 0
      vendor/chamilo/chash/tests/Chash/Tests/ConsoleTest.php
  76. 26 0
      vendor/chamilo/chash/tests/Chash/Tests/Helpers/ConfigurationHelperTest.php
  77. 4 0
      vendor/chamilo/chash/tests/bootstrap.php
  78. 3 3
      vendor/composer/autoload_real.php

+ 1 - 1
vendor/autoload.php

@@ -4,4 +4,4 @@
 
 require_once __DIR__ . '/composer' . '/autoload_real.php';
 
-return ComposerAutoloaderInit04054f5771fc86b66811cd02790585bf::getLoader();
+return ComposerAutoloaderInit3e8478efc6b09559648c9a999e20ca67::getLoader();

+ 8 - 0
vendor/chamilo/chash/.travis.yml

@@ -0,0 +1,8 @@
+language: php
+php:
+  - 5.3
+  - 5.4
+  - 5.5
+before_script:
+    - composer install --dev
+script: vendor/bin/phpunit

+ 120 - 0
vendor/chamilo/chash/README.md

@@ -0,0 +1,120 @@
+Chamilo Shell script
+====================
+
+The Chamilo Shell (or "Chash", as inspired by Drupal's "Drush") is a 
+command-line PHP tool meant to speed up the management of (multiple) 
+Chamilo portals under Linux.
+
+To get the most out of Chash, you should move the chash.phar file to your
+/usr/local/bin directory. You can do this getting inside the directory where
+you put chash.phar and doing:
+
+    chmod +x chash.phar
+    sudo ln -s /path/to/chash.phar /usr/local/bin/chash
+
+Then you can launch chash by moving into any Chamilo installation directory and
+typing
+
+    chash
+
+It will give you the details of what command you can use to run it properly.
+
+The most useful command to us until now has been the "chash database:sql" command,
+which puts you directly into a MySQL client session.
+
+Building the chash.phar file
+====================
+
+In order to generate the executable chash.phar file. You have to set first this php setting (in your cli php configuration file).
+
+    phar.readonly = Off
+
+You need to download the third parties libraries via composer:
+
+    composer update --no-dev --prefer-dist
+
+If you don't have composer installed on your computer, you can just do the following to download and install it and run the command above (make sure you have PHP5 enabled on the command line):
+
+    curl -sS https://getcomposer.org/installer | php
+    php5 composer.phar update --no-dev --prefer-dist
+
+Then you can call the php createPhar.php file. A new chash.phar file will be created.
+
+Remember to add execution permissions to the phar file.
+
+You need to have curl (in order to download packages)
+
+    apt-get install php5-curl
+
+Example:
+
+    cd chash
+    composer update --no-dev
+    php -d phar.readonly=0 createPhar.php
+    chmod +x chash.phar
+    sudo ln -s /path/to/chash.phar /usr/local/bin/chash
+    Then you can call the chash.phar file in your Chamilo installation
+
+    cd /var/www/chamilo
+    chash
+
+If you're using php 5.3 with suhosin the phar will not be executed you can try this:
+
+    php -d suhosin.executor.include.whitelist="phar" chash.phar
+
+or you can change this setting in your /etc/php5/cli/conf.d/suhosin.ini file (look for "executor"), although this might increase the vulnerability of your system.
+
+Available commands:
+====================
+
+    db
+        db:drop_databases       Drops all databases from the current Chamilo install
+        db:dump                 Outputs a dump of the database
+        db:full_backup          Generates a .tgz from the Chamilo files and database
+        db:restore              Allows you to restore an SQL dump right into the active database of a given Chamilo installation (which will also erase all previous data in that database)
+        db:show_conn_info       Shows database connection credentials for the current Chamilo install
+        db:sql_cli              Enters to the SQL command line
+        db:sql_count            Count the number of rows in a specific table
+
+    files
+        files:clean_archives          Cleans the archives directory
+        files:clean_config_files      Cleans the config files to help you re-install
+        files:show_mail_conf          Returns the current mail config
+
+    translation
+        translation:export_language   Exports a Chamilo language package
+        translation:import_language   Import a Chamilo language package
+        translation:platform_language Gets or sets the platform language
+
+    user
+        user:change_pass              Updates the user password to the one given
+        user:disable_admins           Makes the given user admin on the main portal
+        user:make_admin               Makes the given user admin on the main portal
+        user:reset_login              Outputs login link for given username
+        user:set_language             Sets the users language to the one given
+
+Usage
+====================
+
+Inside a chamilo folder execute db:sql_cli in order to enter to the SQL client of the Chamilo database:
+
+    chash.phar db:sql_cli
+
+
+Licensing
+=========
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+Mail: info@chamilo.org

+ 94 - 0
vendor/chamilo/chash/chash.php

@@ -0,0 +1,94 @@
+<?php
+/**
+ * Command-line tool to do things more swiftly in Chamilo.
+ * To add support for a new command see the Console Component read:
+ *
+ * https://speakerdeck.com/hhamon/symfony-extending-the-console-component
+ * http://symfony.com/doc/2.0/components/console/introduction.html
+ *
+ * @author Yannick Warnier <yannick.warnier@beeznest.com>
+ * @author Julio Montoya <gugli100@gmail.com>
+ * @version 2.0
+ * @license This script is provided under the terms of the GNU/GPLv3+ license
+ */
+
+/**
+ * Security check: do not allow any other calling method than command-line
+ */
+
+if (PHP_SAPI != 'cli') {
+    die("Chash cannot be called by any other method than the command line.");
+}
+
+require __DIR__.'/vendor/autoload.php';
+
+use Symfony\Component\Console\Application;
+
+$helpers = array(
+    'configuration' => new Chash\Helpers\ConfigurationHelper()
+);
+
+$application = new Application('Chamilo Command Line Interface', '1.0');
+
+$helperSet = $application->getHelperSet();
+foreach ($helpers as $name => $helper) {
+    $helperSet->set($helper, $name);
+}
+
+$application->addCommands(
+    array(
+        // DBAL Commands.
+        new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(),
+        new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(),
+
+        // Migrations Commands.
+        new \Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand(),
+        new \Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand(),
+        new \Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand(),
+        new \Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand(),
+        new \Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand(),
+        new \Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand(),
+
+        // Chash commands
+        new Chash\Command\Database\RunSQLCommand(),
+        new Chash\Command\Database\DumpCommand(),
+        new Chash\Command\Database\RestoreCommand(),
+        new Chash\Command\Database\SQLCountCommand(),
+        new Chash\Command\Database\FullBackupCommand(),
+        new Chash\Command\Database\DropDatabaseCommand(),
+        new Chash\Command\Database\ShowConnInfoCommand(),
+
+        new Chash\Command\Files\CleanDataFilesCommand(),
+        new Chash\Command\Files\CleanTempFolderCommand(),
+        new Chash\Command\Files\CleanConfigFilesCommand(),
+        new Chash\Command\Files\MailConfCommand(),
+        new Chash\Command\Files\SetPermissionsAfterInstallCommand(),
+        new Chash\Command\Files\GenerateTempFileStructureCommand(),
+
+
+        new Chash\Command\Installation\InstallCommand(),
+        new Chash\Command\Installation\WipeCommand(),
+        new Chash\Command\Installation\StatusCommand(),
+        new Chash\Command\Installation\UpgradeCommand(),
+
+        new Chash\Command\Translation\AddSubLanguageCommand(),
+        new Chash\Command\Translation\DisableLanguageCommand(),
+        new Chash\Command\Translation\EnableLanguageCommand(),
+        new Chash\Command\Translation\ExportLanguageCommand(),
+        new Chash\Command\Translation\ImportLanguageCommand(),
+        new Chash\Command\Translation\ListLanguagesCommand(),
+        new Chash\Command\Translation\PlatformLanguageCommand(),
+
+        new Chash\Command\User\ChangePassCommand(),
+        new Chash\Command\User\DisableAdminsCommand(),
+        new Chash\Command\User\MakeAdminCommand(),
+        new Chash\Command\User\ResetLoginCommand(),
+        new Chash\Command\User\SetLanguageCommand(),
+    )
+);
+$application->run();
+
+//Interactive shell
+//$shell = new Console\Shell($application);
+//$shell->run();
+

+ 30 - 0
vendor/chamilo/chash/composer.json

@@ -0,0 +1,30 @@
+{
+    "name": "chamilo/chash",
+    "type": "library",
+    "homepage": "http://www.chamilo.org",
+    "support": {
+        "forum": "http://www.chamilo.org/forum",
+        "irc": "irc://irc.freenode.org/chamilo"
+    },
+    "autoload": {
+        "psr-0": {
+            "Chash": "src/"
+        }
+    },
+    "require": {
+        "php": ">=5.3.2",
+        "symfony/console": "~2.3",
+        "symfony/yaml": "~2.3",
+        "symfony/filesystem": "~2.3",
+        "symfony/finder": "~2.3",
+        "doctrine/dbal": "~2.3",
+        "doctrine/orm": "~2.3",
+        "doctrine/migrations": "dev-master",
+        "zendframework/zend-config": "2.2.*@dev",
+        "zendframework/zend-stdlib": "2.2.*@dev",
+        "alchemy/zippy": "0.1.*@dev"
+    },
+    "require-dev": {
+        "phpunit/phpunit": "3.7.*"
+    }
+}

+ 1301 - 0
vendor/chamilo/chash/composer.lock

@@ -0,0 +1,1301 @@
+{
+    "_readme": [
+        "This file locks the dependencies of your project to a known state",
+        "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
+    ],
+    "hash": "7faed08c8e834115f820a2aef04071c5",
+    "packages": [
+        {
+            "name": "alchemy/zippy",
+            "version": "dev-master",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/alchemy-fr/Zippy.git",
+                "reference": "624e5d4945d6a89d3acbe3db4cbe628bce258f14"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/alchemy-fr/Zippy/zipball/624e5d4945d6a89d3acbe3db4cbe628bce258f14",
+                "reference": "624e5d4945d6a89d3acbe3db4cbe628bce258f14",
+                "shasum": ""
+            },
+            "require": {
+                "doctrine/collections": "~1.0",
+                "guzzle/guzzle": "~3.0",
+                "php": ">=5.3.3",
+                "pimple/pimple": "~1.0",
+                "symfony/filesystem": "~2.0",
+                "symfony/process": "~2.0"
+            },
+            "require-dev": {
+                "ext-zip": "*",
+                "sami/sami": "dev-master@dev",
+                "symfony/finder": "~2.0"
+            },
+            "suggest": {
+                "ext-zip": "To use the ZipExtensionAdapter"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "0.1.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Alchemy": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Alchemy",
+                    "email": "dev.team@alchemy.fr",
+                    "homepage": "http://www.alchemy.fr/"
+                }
+            ],
+            "description": "Zippy, the archive manager companion",
+            "keywords": [
+                "bzip",
+                "compression",
+                "tar",
+                "zip"
+            ],
+            "time": "2013-04-12 17:34:28"
+        },
+        {
+            "name": "doctrine/collections",
+            "version": "v1.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/doctrine/collections.git",
+                "reference": "v1.1"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/doctrine/collections/zipball/v1.1",
+                "reference": "v1.1",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.2"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.1.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Doctrine\\Common\\Collections\\": "lib/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Jonathan Wage",
+                    "email": "jonwage@gmail.com",
+                    "homepage": "http://www.jwage.com/"
+                },
+                {
+                    "name": "Guilherme Blanco",
+                    "email": "guilhermeblanco@gmail.com",
+                    "homepage": "http://www.instaclick.com"
+                },
+                {
+                    "name": "Roman Borschel",
+                    "email": "roman@code-factory.org"
+                },
+                {
+                    "name": "Benjamin Eberlei",
+                    "email": "kontakt@beberlei.de"
+                },
+                {
+                    "name": "Johannes Schmitt",
+                    "email": "schmittjoh@gmail.com",
+                    "homepage": "http://jmsyst.com",
+                    "role": "Developer of wrapped JMSSerializerBundle"
+                }
+            ],
+            "description": "Collections Abstraction library",
+            "homepage": "http://www.doctrine-project.org",
+            "keywords": [
+                "array",
+                "collections",
+                "iterator"
+            ],
+            "time": "2013-03-07 12:15:54"
+        },
+        {
+            "name": "doctrine/common",
+            "version": "2.3.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/doctrine/common",
+                "reference": "2.3.0"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://github.com/doctrine/common/zipball/2.3.0",
+                "reference": "2.3.0",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.2"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.3.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Doctrine\\Common": "lib/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Jonathan Wage",
+                    "email": "jonwage@gmail.com",
+                    "homepage": "http://www.jwage.com/"
+                },
+                {
+                    "name": "Guilherme Blanco",
+                    "email": "guilhermeblanco@gmail.com",
+                    "homepage": "http://www.instaclick.com"
+                },
+                {
+                    "name": "Roman Borschel",
+                    "email": "roman@code-factory.org"
+                },
+                {
+                    "name": "Benjamin Eberlei",
+                    "email": "kontakt@beberlei.de"
+                },
+                {
+                    "name": "Johannes Schmitt",
+                    "email": "schmittjoh@gmail.com",
+                    "homepage": "http://jmsyst.com",
+                    "role": "Developer of wrapped JMSSerializerBundle"
+                }
+            ],
+            "description": "Common Library for Doctrine projects",
+            "homepage": "http://www.doctrine-project.org",
+            "keywords": [
+                "annotations",
+                "collections",
+                "eventmanager",
+                "persistence",
+                "spl"
+            ],
+            "time": "2012-09-19 22:55:18"
+        },
+        {
+            "name": "doctrine/dbal",
+            "version": "2.3.4",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/doctrine/dbal.git",
+                "reference": "2.3.4"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/doctrine/dbal/zipball/2.3.4",
+                "reference": "2.3.4",
+                "shasum": ""
+            },
+            "require": {
+                "doctrine/common": ">=2.3.0,<2.5-dev",
+                "php": ">=5.3.2"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.3.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Doctrine\\DBAL": "lib/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Jonathan Wage",
+                    "email": "jonwage@gmail.com",
+                    "homepage": "http://www.jwage.com/"
+                },
+                {
+                    "name": "Guilherme Blanco",
+                    "email": "guilhermeblanco@gmail.com",
+                    "homepage": "http://www.instaclick.com"
+                },
+                {
+                    "name": "Roman Borschel",
+                    "email": "roman@code-factory.org"
+                },
+                {
+                    "name": "Benjamin Eberlei",
+                    "email": "kontakt@beberlei.de"
+                }
+            ],
+            "description": "Database Abstraction Layer",
+            "homepage": "http://www.doctrine-project.org",
+            "keywords": [
+                "database",
+                "dbal",
+                "persistence",
+                "queryobject"
+            ],
+            "time": "2013-05-11 07:45:37"
+        },
+        {
+            "name": "doctrine/migrations",
+            "version": "dev-master",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/doctrine/migrations.git",
+                "reference": "ced3b419252af47f29d6680f9ec74df00ee0c58e"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/doctrine/migrations/zipball/ced3b419252af47f29d6680f9ec74df00ee0c58e",
+                "reference": "ced3b419252af47f29d6680f9ec74df00ee0c58e",
+                "shasum": ""
+            },
+            "require": {
+                "doctrine/dbal": ">=2.0,<2.5.x-dev",
+                "php": ">=5.3.2"
+            },
+            "require-dev": {
+                "symfony/console": "2.*",
+                "symfony/yaml": "2.*"
+            },
+            "suggest": {
+                "symfony/console": "to run the migration from the console"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-0": {
+                    "Doctrine\\DBAL\\Migrations": "lib"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "LGPL"
+            ],
+            "authors": [
+                {
+                    "name": "Jonathan Wage",
+                    "email": "jonwage@gmail.com",
+                    "homepage": "http://www.jwage.com/"
+                },
+                {
+                    "name": "Benjamin Eberlei",
+                    "email": "kontakt@beberlei.de"
+                }
+            ],
+            "description": "Database Schema migrations using Doctrine DBAL",
+            "homepage": "http://www.doctrine-project.org",
+            "keywords": [
+                "database",
+                "migrations"
+            ],
+            "time": "2013-06-27 19:46:00"
+        },
+        {
+            "name": "doctrine/orm",
+            "version": "2.3.4",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/doctrine/doctrine2.git",
+                "reference": "2.3.4"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/2.3.4",
+                "reference": "2.3.4",
+                "shasum": ""
+            },
+            "require": {
+                "doctrine/dbal": "2.3.*",
+                "ext-pdo": "*",
+                "php": ">=5.3.2",
+                "symfony/console": "2.*"
+            },
+            "suggest": {
+                "symfony/yaml": "If you want to use YAML Metadata Mapping Driver"
+            },
+            "bin": [
+                "bin/doctrine",
+                "bin/doctrine.php"
+            ],
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.3.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Doctrine\\ORM": "lib/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Jonathan Wage",
+                    "email": "jonwage@gmail.com",
+                    "homepage": "http://www.jwage.com/"
+                },
+                {
+                    "name": "Guilherme Blanco",
+                    "email": "guilhermeblanco@gmail.com",
+                    "homepage": "http://www.instaclick.com"
+                },
+                {
+                    "name": "Roman Borschel",
+                    "email": "roman@code-factory.org"
+                },
+                {
+                    "name": "Benjamin Eberlei",
+                    "email": "kontakt@beberlei.de"
+                }
+            ],
+            "description": "Object-Relational-Mapper for PHP",
+            "homepage": "http://www.doctrine-project.org",
+            "keywords": [
+                "database",
+                "orm"
+            ],
+            "time": "2013-05-11 07:51:12"
+        },
+        {
+            "name": "guzzle/guzzle",
+            "version": "v3.7.2",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/guzzle/guzzle.git",
+                "reference": "eaef90d27bb1d682e1f6ab2d77606dc0159049e6"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/guzzle/guzzle/zipball/eaef90d27bb1d682e1f6ab2d77606dc0159049e6",
+                "reference": "eaef90d27bb1d682e1f6ab2d77606dc0159049e6",
+                "shasum": ""
+            },
+            "require": {
+                "ext-curl": "*",
+                "php": ">=5.3.2",
+                "symfony/event-dispatcher": ">=2.1"
+            },
+            "replace": {
+                "guzzle/batch": "self.version",
+                "guzzle/cache": "self.version",
+                "guzzle/common": "self.version",
+                "guzzle/http": "self.version",
+                "guzzle/inflection": "self.version",
+                "guzzle/iterator": "self.version",
+                "guzzle/log": "self.version",
+                "guzzle/parser": "self.version",
+                "guzzle/plugin": "self.version",
+                "guzzle/plugin-async": "self.version",
+                "guzzle/plugin-backoff": "self.version",
+                "guzzle/plugin-cache": "self.version",
+                "guzzle/plugin-cookie": "self.version",
+                "guzzle/plugin-curlauth": "self.version",
+                "guzzle/plugin-error-response": "self.version",
+                "guzzle/plugin-history": "self.version",
+                "guzzle/plugin-log": "self.version",
+                "guzzle/plugin-md5": "self.version",
+                "guzzle/plugin-mock": "self.version",
+                "guzzle/plugin-oauth": "self.version",
+                "guzzle/service": "self.version",
+                "guzzle/stream": "self.version"
+            },
+            "require-dev": {
+                "doctrine/cache": "*",
+                "monolog/monolog": "1.*",
+                "phpunit/phpunit": "3.7.*",
+                "psr/log": "1.0.*",
+                "symfony/class-loader": "*",
+                "zendframework/zend-cache": "2.0.*",
+                "zendframework/zend-log": "2.0.*"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "3.7-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Guzzle\\Tests": "tests/",
+                    "Guzzle": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Michael Dowling",
+                    "email": "mtdowling@gmail.com",
+                    "homepage": "https://github.com/mtdowling"
+                },
+                {
+                    "name": "Guzzle Community",
+                    "homepage": "https://github.com/guzzle/guzzle/contributors"
+                }
+            ],
+            "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
+            "homepage": "http://guzzlephp.org/",
+            "keywords": [
+                "client",
+                "curl",
+                "framework",
+                "http",
+                "http client",
+                "rest",
+                "web service"
+            ],
+            "time": "2013-08-02 18:31:05"
+        },
+        {
+            "name": "pimple/pimple",
+            "version": "v1.0.2",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/fabpot/Pimple.git",
+                "reference": "v1.0.2"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/fabpot/Pimple/zipball/v1.0.2",
+                "reference": "v1.0.2",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.0"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.0.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Pimple": "lib/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Fabien Potencier",
+                    "email": "fabien@symfony.com"
+                }
+            ],
+            "description": "Pimple is a simple Dependency Injection Container for PHP 5.3",
+            "homepage": "http://pimple.sensiolabs.org",
+            "keywords": [
+                "container",
+                "dependency injection"
+            ],
+            "time": "2013-03-08 08:21:40"
+        },
+        {
+            "name": "symfony/console",
+            "version": "v2.3.3",
+            "target-dir": "Symfony/Component/Console",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/Console.git",
+                "reference": "290fe87d3618ce49c2caf7c456402affbd9917ac"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/Console/zipball/290fe87d3618ce49c2caf7c456402affbd9917ac",
+                "reference": "290fe87d3618ce49c2caf7c456402affbd9917ac",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3"
+            },
+            "require-dev": {
+                "symfony/event-dispatcher": "~2.1"
+            },
+            "suggest": {
+                "symfony/event-dispatcher": ""
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.3-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Symfony\\Component\\Console\\": ""
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Fabien Potencier",
+                    "email": "fabien@symfony.com"
+                },
+                {
+                    "name": "Symfony Community",
+                    "homepage": "http://symfony.com/contributors"
+                }
+            ],
+            "description": "Symfony Console Component",
+            "homepage": "http://symfony.com",
+            "time": "2013-07-21 12:12:18"
+        },
+        {
+            "name": "symfony/event-dispatcher",
+            "version": "v2.3.3",
+            "target-dir": "Symfony/Component/EventDispatcher",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/EventDispatcher.git",
+                "reference": "41c9826457c65fa3cf746f214985b7ca9cba42f8"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/41c9826457c65fa3cf746f214985b7ca9cba42f8",
+                "reference": "41c9826457c65fa3cf746f214985b7ca9cba42f8",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3"
+            },
+            "require-dev": {
+                "symfony/dependency-injection": "~2.0"
+            },
+            "suggest": {
+                "symfony/dependency-injection": "",
+                "symfony/http-kernel": ""
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.3-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Symfony\\Component\\EventDispatcher\\": ""
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Fabien Potencier",
+                    "email": "fabien@symfony.com"
+                },
+                {
+                    "name": "Symfony Community",
+                    "homepage": "http://symfony.com/contributors"
+                }
+            ],
+            "description": "Symfony EventDispatcher Component",
+            "homepage": "http://symfony.com",
+            "time": "2013-07-21 12:12:18"
+        },
+        {
+            "name": "symfony/filesystem",
+            "version": "v2.3.3",
+            "target-dir": "Symfony/Component/Filesystem",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/Filesystem.git",
+                "reference": "87acbbef6d35ba649f96f09cc572c45119b360c3"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/Filesystem/zipball/87acbbef6d35ba649f96f09cc572c45119b360c3",
+                "reference": "87acbbef6d35ba649f96f09cc572c45119b360c3",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.3-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Symfony\\Component\\Filesystem\\": ""
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Fabien Potencier",
+                    "email": "fabien@symfony.com"
+                },
+                {
+                    "name": "Symfony Community",
+                    "homepage": "http://symfony.com/contributors"
+                }
+            ],
+            "description": "Symfony Filesystem Component",
+            "homepage": "http://symfony.com",
+            "time": "2013-07-21 12:12:18"
+        },
+        {
+            "name": "symfony/finder",
+            "version": "v2.3.3",
+            "target-dir": "Symfony/Component/Finder",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/Finder.git",
+                "reference": "b251476db261edb54bb1d7c6b8be6ae49ff9a371"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/Finder/zipball/b251476db261edb54bb1d7c6b8be6ae49ff9a371",
+                "reference": "b251476db261edb54bb1d7c6b8be6ae49ff9a371",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.3-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Symfony\\Component\\Finder\\": ""
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Fabien Potencier",
+                    "email": "fabien@symfony.com"
+                },
+                {
+                    "name": "Symfony Community",
+                    "homepage": "http://symfony.com/contributors"
+                }
+            ],
+            "description": "Symfony Finder Component",
+            "homepage": "http://symfony.com",
+            "time": "2013-07-21 12:12:18"
+        },
+        {
+            "name": "symfony/process",
+            "version": "v2.3.3",
+            "target-dir": "Symfony/Component/Process",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/Process.git",
+                "reference": "dd780ac1fa0452567c261237798c4ec64f1337cf"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/Process/zipball/dd780ac1fa0452567c261237798c4ec64f1337cf",
+                "reference": "dd780ac1fa0452567c261237798c4ec64f1337cf",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.3-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Symfony\\Component\\Process\\": ""
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Fabien Potencier",
+                    "email": "fabien@symfony.com"
+                },
+                {
+                    "name": "Symfony Community",
+                    "homepage": "http://symfony.com/contributors"
+                }
+            ],
+            "description": "Symfony Process Component",
+            "homepage": "http://symfony.com",
+            "time": "2013-08-02 21:51:01"
+        },
+        {
+            "name": "symfony/yaml",
+            "version": "v2.3.3",
+            "target-dir": "Symfony/Component/Yaml",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/Yaml.git",
+                "reference": "3837ccd0830ef44ed5c5844403bf6f69f7998758"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/Yaml/zipball/3837ccd0830ef44ed5c5844403bf6f69f7998758",
+                "reference": "3837ccd0830ef44ed5c5844403bf6f69f7998758",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.3-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Symfony\\Component\\Yaml\\": ""
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Fabien Potencier",
+                    "email": "fabien@symfony.com"
+                },
+                {
+                    "name": "Symfony Community",
+                    "homepage": "http://symfony.com/contributors"
+                }
+            ],
+            "description": "Symfony Yaml Component",
+            "homepage": "http://symfony.com",
+            "time": "2013-07-21 12:12:18"
+        },
+        {
+            "name": "zendframework/zend-config",
+            "version": "dev-master",
+            "target-dir": "Zend/Config",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/zendframework/Component_ZendConfig.git",
+                "reference": "66c41423c7e461f58e33e241cdc6fe6dc4d6cee7"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/zendframework/Component_ZendConfig/zipball/66c41423c7e461f58e33e241cdc6fe6dc4d6cee7",
+                "reference": "66c41423c7e461f58e33e241cdc6fe6dc4d6cee7",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3",
+                "zendframework/zend-stdlib": "self.version"
+            },
+            "suggest": {
+                "zendframework/zend-json": "Zend\\Json to use the Json reader or writer classes",
+                "zendframework/zend-servicemanager": "Zend\\ServiceManager for use with the Config Factory to retrieve reader and writer instances"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.2-dev",
+                    "dev-develop": "2.3-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Zend\\Config\\": ""
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "description": "provides a nested object property based user interface for accessing this configuration data within application code",
+            "keywords": [
+                "config",
+                "zf2"
+            ],
+            "time": "2013-08-21 17:06:49"
+        },
+        {
+            "name": "zendframework/zend-stdlib",
+            "version": "dev-master",
+            "target-dir": "Zend/Stdlib",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/zendframework/Component_ZendStdlib.git",
+                "reference": "7c87ce4e840957596bf3401fa4ae4fb0355682e2"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/zendframework/Component_ZendStdlib/zipball/7c87ce4e840957596bf3401fa4ae4fb0355682e2",
+                "reference": "7c87ce4e840957596bf3401fa4ae4fb0355682e2",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3"
+            },
+            "suggest": {
+                "zendframework/zend-eventmanager": "To support aggregate hydrator usage",
+                "zendframework/zend-servicemanager": "To support hydrator plugin manager usage"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.2-dev",
+                    "dev-develop": "2.3-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Zend\\Stdlib\\": ""
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "keywords": [
+                "stdlib",
+                "zf2"
+            ],
+            "time": "2013-08-21 17:08:07"
+        }
+    ],
+    "packages-dev": [
+        {
+            "name": "phpunit/php-code-coverage",
+            "version": "1.2.12",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
+                "reference": "0e9958c459d675fb497d8dc5001c91d335734e48"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/0e9958c459d675fb497d8dc5001c91d335734e48",
+                "reference": "0e9958c459d675fb497d8dc5001c91d335734e48",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3",
+                "phpunit/php-file-iterator": ">=1.3.0@stable",
+                "phpunit/php-text-template": ">=1.1.1@stable",
+                "phpunit/php-token-stream": ">=1.1.3@stable"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "3.7.*@dev"
+            },
+            "suggest": {
+                "ext-dom": "*",
+                "ext-xdebug": ">=2.0.5"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.2.x-dev"
+                }
+            },
+            "autoload": {
+                "classmap": [
+                    "PHP/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "include-path": [
+                ""
+            ],
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sb@sebastian-bergmann.de",
+                    "role": "lead"
+                }
+            ],
+            "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
+            "homepage": "https://github.com/sebastianbergmann/php-code-coverage",
+            "keywords": [
+                "coverage",
+                "testing",
+                "xunit"
+            ],
+            "time": "2013-07-06 06:26:16"
+        },
+        {
+            "name": "phpunit/php-file-iterator",
+            "version": "1.3.3",
+            "source": {
+                "type": "git",
+                "url": "git://github.com/sebastianbergmann/php-file-iterator.git",
+                "reference": "1.3.3"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://github.com/sebastianbergmann/php-file-iterator/zipball/1.3.3",
+                "reference": "1.3.3",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3"
+            },
+            "type": "library",
+            "autoload": {
+                "classmap": [
+                    "File/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "include-path": [
+                ""
+            ],
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sb@sebastian-bergmann.de",
+                    "role": "lead"
+                }
+            ],
+            "description": "FilterIterator implementation that filters files based on a list of suffixes.",
+            "homepage": "http://www.phpunit.de/",
+            "keywords": [
+                "filesystem",
+                "iterator"
+            ],
+            "time": "2012-10-11 04:44:38"
+        },
+        {
+            "name": "phpunit/php-text-template",
+            "version": "1.1.4",
+            "source": {
+                "type": "git",
+                "url": "git://github.com/sebastianbergmann/php-text-template.git",
+                "reference": "1.1.4"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://github.com/sebastianbergmann/php-text-template/zipball/1.1.4",
+                "reference": "1.1.4",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3"
+            },
+            "type": "library",
+            "autoload": {
+                "classmap": [
+                    "Text/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "include-path": [
+                ""
+            ],
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sb@sebastian-bergmann.de",
+                    "role": "lead"
+                }
+            ],
+            "description": "Simple template engine.",
+            "homepage": "https://github.com/sebastianbergmann/php-text-template/",
+            "keywords": [
+                "template"
+            ],
+            "time": "2012-10-31 11:15:28"
+        },
+        {
+            "name": "phpunit/php-timer",
+            "version": "1.0.5",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/sebastianbergmann/php-timer.git",
+                "reference": "1.0.5"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1.0.5",
+                "reference": "1.0.5",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3"
+            },
+            "type": "library",
+            "autoload": {
+                "classmap": [
+                    "PHP/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "include-path": [
+                ""
+            ],
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sb@sebastian-bergmann.de",
+                    "role": "lead"
+                }
+            ],
+            "description": "Utility class for timing",
+            "homepage": "https://github.com/sebastianbergmann/php-timer/",
+            "keywords": [
+                "timer"
+            ],
+            "time": "2013-08-02 07:42:54"
+        },
+        {
+            "name": "phpunit/php-token-stream",
+            "version": "1.2.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/sebastianbergmann/php-token-stream.git",
+                "reference": "1.2.0"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1.2.0",
+                "reference": "1.2.0",
+                "shasum": ""
+            },
+            "require": {
+                "ext-tokenizer": "*",
+                "php": ">=5.3.3"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.2-dev"
+                }
+            },
+            "autoload": {
+                "classmap": [
+                    "PHP/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "include-path": [
+                ""
+            ],
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sb@sebastian-bergmann.de",
+                    "role": "lead"
+                }
+            ],
+            "description": "Wrapper around PHP's tokenizer extension.",
+            "homepage": "https://github.com/sebastianbergmann/php-token-stream/",
+            "keywords": [
+                "tokenizer"
+            ],
+            "time": "2013-08-04 05:57:48"
+        },
+        {
+            "name": "phpunit/phpunit",
+            "version": "3.7.24",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/sebastianbergmann/phpunit.git",
+                "reference": "3.7.24"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3.7.24",
+                "reference": "3.7.24",
+                "shasum": ""
+            },
+            "require": {
+                "ext-dom": "*",
+                "ext-pcre": "*",
+                "ext-reflection": "*",
+                "ext-spl": "*",
+                "php": ">=5.3.3",
+                "phpunit/php-code-coverage": "~1.2.1",
+                "phpunit/php-file-iterator": ">=1.3.1",
+                "phpunit/php-text-template": ">=1.1.1",
+                "phpunit/php-timer": ">=1.0.4",
+                "phpunit/phpunit-mock-objects": "~1.2.0",
+                "symfony/yaml": "~2.0"
+            },
+            "require-dev": {
+                "pear-pear/pear": "1.9.4"
+            },
+            "suggest": {
+                "ext-json": "*",
+                "ext-simplexml": "*",
+                "ext-tokenizer": "*",
+                "phpunit/php-invoker": ">=1.1.0,<1.2.0"
+            },
+            "bin": [
+                "composer/bin/phpunit"
+            ],
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "3.7.x-dev"
+                }
+            },
+            "autoload": {
+                "classmap": [
+                    "PHPUnit/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "include-path": [
+                "",
+                "../../symfony/yaml/"
+            ],
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sebastian@phpunit.de",
+                    "role": "lead"
+                }
+            ],
+            "description": "The PHP Unit Testing framework.",
+            "homepage": "http://www.phpunit.de/",
+            "keywords": [
+                "phpunit",
+                "testing",
+                "xunit"
+            ],
+            "time": "2013-08-09 06:58:24"
+        },
+        {
+            "name": "phpunit/phpunit-mock-objects",
+            "version": "1.2.3",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
+                "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5794e3c5c5ba0fb037b11d8151add2a07fa82875",
+                "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3",
+                "phpunit/php-text-template": ">=1.1.1@stable"
+            },
+            "suggest": {
+                "ext-soap": "*"
+            },
+            "type": "library",
+            "autoload": {
+                "classmap": [
+                    "PHPUnit/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "include-path": [
+                ""
+            ],
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sb@sebastian-bergmann.de",
+                    "role": "lead"
+                }
+            ],
+            "description": "Mock Object library for PHPUnit",
+            "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
+            "keywords": [
+                "mock",
+                "xunit"
+            ],
+            "time": "2013-01-13 10:24:48"
+        }
+    ],
+    "aliases": [
+
+    ],
+    "minimum-stability": "stable",
+    "stability-flags": {
+        "doctrine/migrations": 20,
+        "zendframework/zend-config": 20,
+        "zendframework/zend-stdlib": 20,
+        "alchemy/zippy": 20
+    },
+    "platform": {
+        "php": ">=5.3.2"
+    },
+    "platform-dev": [
+
+    ]
+}

+ 21 - 0
vendor/chamilo/chash/createPhar.php

@@ -0,0 +1,21 @@
+<?php
+/**
+ * Make sure you have this setting in your php.ini (cli)
+ * phar.readonly = Off
+ */
+error_reporting(-1);
+$phar = new Phar('chash.phar');
+$phar->setSignatureAlgorithm(\Phar::SHA1);
+$phar->startBuffering();
+
+$phar->buildFromDirectory(__DIR__, '/\.php$/');
+
+$defaultStub = $phar->createDefaultStub('chash.php');
+
+// Create a custom stub to add the shebang
+$stub = "#!/usr/bin/env php \n".$defaultStub;
+
+// Add the stub
+$phar->setStub($stub);
+
+$phar->stopBuffering();

+ 708 - 0
vendor/chamilo/chash/license.html

@@ -0,0 +1,708 @@
+<html lang="en">
+<head>
+    <meta charset="utf-8" />  
+    <title>Chamilo License</title>
+</head>
+<body>
+<div class="container">    
+
+<h1 style="text-align: left;">GNU GENERAL PUBLIC LICENSE</h1>
+<p style="text-align: left;">Version 3, 29 June 2007</p>
+
+<p>Copyright &copy; 2007 Free Software Foundation, Inc.
+ &lt;<a href="http://fsf.org/">http://fsf.org/</a>&gt;</p><p>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.</p>
+
+<h3><a name="preamble"></a>Preamble</h3>
+
+<p>The GNU General Public License is a free, copyleft license for
+software and other kinds of works.</p>
+
+<p>The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.</p>
+
+<p>When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.</p>
+
+<p>To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.</p>
+
+<p>For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.</p>
+
+<p>Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.</p>
+
+<p>For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.</p>
+
+<p>Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.</p>
+
+<p>Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.</p>
+
+<p>The precise terms and conditions for copying, distribution and
+modification follow.</p>
+
+<h3><a name="terms"></a>TERMS AND CONDITIONS</h3>
+
+<h4><a name="section0"></a>0. Definitions.</h4>
+
+<p>&ldquo;This License&rdquo; refers to version 3 of the GNU General Public License.</p>
+
+<p>&ldquo;Copyright&rdquo; also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.</p>
+ 
+<p>&ldquo;The Program&rdquo; refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as &ldquo;you&rdquo;.  &ldquo;Licensees&rdquo; and
+
+&ldquo;recipients&rdquo; may be individuals or organizations.</p>
+
+<p>To &ldquo;modify&rdquo; a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a &ldquo;modified version&rdquo; of the
+earlier work or a work &ldquo;based on&rdquo; the earlier work.</p>
+
+<p>A &ldquo;covered work&rdquo; means either the unmodified Program or a work based
+on the Program.</p>
+
+<p>To &ldquo;propagate&rdquo; a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.</p>
+
+<p>To &ldquo;convey&rdquo; a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.</p>
+
+<p>An interactive user interface displays &ldquo;Appropriate Legal Notices&rdquo;
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.</p>
+
+<h4><a name="section1"></a>1. Source Code.</h4>
+
+<p>The &ldquo;source code&rdquo; for a work means the preferred form of the work
+for making modifications to it.  &ldquo;Object code&rdquo; means any non-source
+form of a work.</p>
+
+<p>A &ldquo;Standard Interface&rdquo; means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.</p>
+
+<p>The &ldquo;System Libraries&rdquo; of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+&ldquo;Major Component&rdquo;, in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.</p>
+
+<p>The &ldquo;Corresponding Source&rdquo; for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.</p>
+
+<p>The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.</p>
+
+<p>The Corresponding Source for a work in source code form is that
+same work.</p>
+
+<h4><a name="section2"></a>2. Basic Permissions.</h4>
+
+<p>All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.</p>
+
+<p>You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.</p>
+
+<p>Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.</p>
+
+<h4><a name="section3"></a>3. Protecting Users' Legal Rights From Anti-Circumvention Law.</h4>
+
+<p>No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.</p>
+
+<p>When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.</p>
+
+<h4><a name="section4"></a>4. Conveying Verbatim Copies.</h4>
+
+<p>You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.</p>
+
+<p>You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.</p>
+
+<h4><a name="section5"></a>5. Conveying Modified Source Versions.</h4>
+
+<p>You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:</p>
+
+<ul>
+<li>a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.</li>
+
+<li>b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    &ldquo;keep intact all notices&rdquo;.</li>
+
+<li>c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.</li>
+
+<li>d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.</li>
+</ul>
+
+<p>A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+&ldquo;aggregate&rdquo; if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.</p>
+
+<h4><a name="section6"></a>6. Conveying Non-Source Forms.</h4>
+
+<p>You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:</p>
+
+<ul>
+<li>a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.</li>
+
+<li>b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.</li>
+
+<li>c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.</li>
+
+<li>d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.</li>
+
+<li>e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.</li>
+</ul>
+
+<p>A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.</p>
+
+<p>A &ldquo;User Product&rdquo; is either (1) a &ldquo;consumer product&rdquo;, which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, &ldquo;normally used&rdquo; refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.</p>
+
+<p>&ldquo;Installation Information&rdquo; for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.</p>
+
+<p>If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).</p>
+
+<p>The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.</p>
+
+<p>Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.</p>
+
+<h4><a name="section7"></a>7. Additional Terms.</h4>
+
+<p>&ldquo;Additional permissions&rdquo; are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.</p>
+
+<p>When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.</p>
+
+<p>Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:</p>
+
+<ul>
+<li>a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or</li>
+
+<li>b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or</li>
+
+<li>c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or</li>
+
+<li>d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or</li>
+
+<li>e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or</li>
+
+<li>f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.</li>
+</ul>
+
+<p>All other non-permissive additional terms are considered &ldquo;further
+restrictions&rdquo; within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.</p>
+
+<p>If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.</p>
+
+<p>Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.</p>
+
+<h4><a name="section8"></a>8. Termination.</h4>
+
+<p>You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).</p>
+
+<p>However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.</p>
+
+<p>Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.</p>
+
+<p>Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.</p>
+
+<h4><a name="section9"></a>9. Acceptance Not Required for Having Copies.</h4>
+
+<p>You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.</p>
+
+<h4><a name="section10"></a>10. Automatic Licensing of Downstream Recipients.</h4>
+
+<p>Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.</p>
+
+<p>An &ldquo;entity transaction&rdquo; is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.</p>
+
+<p>You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.</p>
+
+<h4><a name="section11"></a>11. Patents.</h4>
+
+<p>A &ldquo;contributor&rdquo; is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's &ldquo;contributor version&rdquo;.</p>
+
+<p>A contributor's &ldquo;essential patent claims&rdquo; are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, &ldquo;control&rdquo; includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.</p>
+
+<p>Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.</p>
+
+<p>In the following three paragraphs, a &ldquo;patent license&rdquo; is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To &ldquo;grant&rdquo; such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.</p>
+
+<p>If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  &ldquo;Knowingly relying&rdquo; means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.</p>
+
+  
+<p>If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.</p>
+
+<p>A patent license is &ldquo;discriminatory&rdquo; if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.</p>
+
+<p>Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.</p>
+
+<h4><a name="section12"></a>12. No Surrender of Others' Freedom.</h4>
+
+<p>If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.</p>
+
+<h4><a name="section13"></a>13. Use with the GNU Affero General Public License.</h4>
+
+<p>Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.</p>
+
+<h4><a name="section14"></a>14. Revised Versions of this License.</h4>
+
+<p>The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.</p>
+
+<p>Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License &ldquo;or any later version&rdquo; applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.</p>
+
+<p>If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.</p>
+
+<p>Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.</p>
+
+<h4><a name="section15"></a>15. Disclaimer of Warranty.</h4>
+
+<p>THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM &ldquo;AS IS&rdquo; WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</p>
+
+<h4><a name="section16"></a>16. Limitation of Liability.</h4>
+
+<p>IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.</p>
+
+<h4><a name="section17"></a>17. Interpretation of Sections 15 and 16.</h4>
+
+<p>If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.</p>
+
+<p>END OF TERMS AND CONDITIONS</p>
+
+<h3><a name="howto"></a>How to Apply These Terms to Your New Programs</h3>
+
+<p>If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.</p>
+
+<p>To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the &ldquo;copyright&rdquo; line and a pointer to where the full notice is found.</p>
+
+<pre>    &lt;one line to give the program's name and a brief idea of what it does.&gt;
+    Copyright (C) &lt;year&gt;  &lt;name of author&gt;
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.
+</pre>
+
+<p>Also add information on how to contact you by electronic and paper mail.</p>
+
+<p>If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:</p>
+
+<pre>    &lt;program&gt;  Copyright (C) &lt;year&gt;  &lt;name of author&gt;
+
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+</pre>
+
+<p>The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an &ldquo;about box&rdquo;.</p>
+
+<p>You should also get your employer (if you work as a programmer) or school,
+if any, to sign a &ldquo;copyright disclaimer&rdquo; for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+&lt;<a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>&gt;.</p>
+
+<p>The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+&lt;<a href="http://www.gnu.org/philosophy/why-not-lgpl.html">http://www.gnu.org/philosophy/why-not-lgpl.html</a>&gt;.</p>
+
+
+  </div>
+</div
+<hr/>
+    <a href="http://validator.w3.org/check?uri=referer"><img
+        src="http://www.w3.org/Icons/valid-xhtml10-blue"
+        alt="Valid XHTML 1.0 Transitional" height="31" width="88" style="float: right; margin: 1em;" /></a>
+	<a href="http://jigsaw.w3.org/css-validator/">
+		<img src="http://jigsaw.w3.org/css-validator/images/vcss-blue"  style="float: right; margin: 1em;"
+        alt="Valid CSS" />
+	</a>
+</body>
+</html>

+ 24 - 0
vendor/chamilo/chash/phpunit.xml

@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<phpunit backupGlobals="false"
+         backupStaticAttributes="false"
+         colors="true"
+         convertErrorsToExceptions="true"
+         convertNoticesToExceptions="true"
+         convertWarningsToExceptions="true"
+         processIsolation="false"
+         stopOnFailure="false"
+         syntaxCheck="false"
+         bootstrap="tests/bootstrap.php"
+>
+    <testsuites>
+        <testsuite name="Chash Test Suite">
+            <directory>./tests/Chash/</directory>
+        </testsuite>
+    </testsuites>
+    <filter>
+        <whitelist>
+            <directory>./src</directory>
+        </whitelist>
+    </filter>
+</phpunit>

+ 62 - 0
vendor/chamilo/chash/src/Chash/Command/Database/CommonChamiloDatabaseCommand.php

@@ -0,0 +1,62 @@
+<?php
+
+namespace Chash\Command\Database;
+
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+use Chash\Command\Installation\CommonCommand;
+
+use Symfony\Component\Console\Formatter\OutputFormatterStyle;
+
+/**
+ * Class CommonChamiloDatabaseCommand
+ * @package Chash\Command\Database
+ */
+class CommonChamiloDatabaseCommand extends CommonCommand
+{
+    /**
+     *
+     */
+    protected function configure()
+    {
+        $this
+            ->addOption(
+                'conf',
+                null,
+                InputOption::VALUE_OPTIONAL,
+                'The configuration.php file path. Example /var/www/chamilo/config/configuration.php'
+            )
+            ->addOption(
+                'dry-run',
+                null,
+                InputOption::VALUE_NONE,
+                'For tests'
+            );
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        $configurationFile = $input->getOption('conf');
+        $this->getConfigurationHelper()->setDryRun($input->getOption('dry-run'));
+        $configuration = $this->getConfigurationHelper()->readConfigurationFile($configurationFile);
+
+        if (empty($configuration)) {
+            $output->writeln('<error>The configuration file was not found.</error>');
+            $output->writeln('<comment>Try</comment> <info>prefix:command --conf=/var/www/chamilo/config/configuration.php</info>');
+            exit;
+        }
+
+        $this->setConfigurationArray($configuration);
+        $this->getConfigurationHelper()->setConfiguration($configuration);
+        $sysPath = $this->getConfigurationHelper()->getSysPathFromConfigurationFile($configurationFile);
+        $this->getConfigurationHelper()->setSysPath($sysPath);
+    }
+}

+ 79 - 0
vendor/chamilo/chash/src/Chash/Command/Database/DropDatabaseCommand.php

@@ -0,0 +1,79 @@
+<?php
+
+namespace Chash\Command\Database;
+
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Class DropDatabaseCommand
+ * @package Chash\Command\Database
+ */
+class DropDatabaseCommand extends CommonChamiloDatabaseCommand
+{
+    /**
+     *
+     */
+    protected function configure()
+    {
+        parent::configure();
+        $this
+            ->setName('db:drop_databases')
+            ->setDescription('Drops all databases from the current Chamilo install');
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+
+        $dialog = $this->getHelperSet()->get('dialog');
+
+        if (!$dialog->askConfirmation(
+            $output,
+            '<question>Are you sure you want to drop all database in this portal? (y/N)</question>',
+            false
+        )
+        ) {
+            return;
+        }
+
+        if (!$dialog->askConfirmation(
+            $output,
+            '<question>Are you really sure? (y/N)</question>',
+            false
+        )
+        ) {
+            return;
+        }
+
+        $_configuration = $this->getConfigurationArray();
+
+        $connection = $this->getConfigurationHelper()->getConnection();
+        // $configurationFilePath = $this->getConfigurationHelper()->getConfigurationFilePath();
+        // $output->writeln("<comment>Reading configuration file:</comment> <info>$configurationFilePath</info>");
+
+        if ($connection) {
+            $cmd  = 'mysql -h '.$_configuration['db_host'].' -u '.$_configuration['db_user'].' -p'.$_configuration['db_password'].' -e "DROP DATABASE %s"';
+            $list = $_configuration = $this->getHelper('configuration')->getAllDatabases();
+            if (is_array($list)) {
+                $output->writeln('<comment>Starting Chamilo drop database process.</comment>');
+                foreach ($list as $db) {
+                    $c = sprintf($cmd, $db);
+                    $output->writeln("Dropping DB: $db");
+                    $err = @system($c);
+                }
+                $output->writeln('<comment>End drop database process.</comment>');
+            }
+        } else {
+            $output->writeln("<comment>Can't established connection with the database. Probably it was already deleted.</comment>");
+        }
+    }
+}

+ 47 - 0
vendor/chamilo/chash/src/Chash/Command/Database/DumpCommand.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace Chash\Command\Database;
+
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+
+/**
+ * Command functions meant to deal with what the user of this script is calling
+ * it for.
+ */
+/**
+ * Returns a dump of the database (caller should use an output redirect of some kind to store
+ * to a file)
+ */
+class DumpCommand extends CommonChamiloDatabaseCommand
+{
+    /**
+     *
+     */
+    protected function configure()
+    {
+        parent::configure();
+
+        $this
+            ->setName('db:dump')
+            ->setDescription('Outputs a dump of the database');
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+        $_configuration = $this->getConfigurationArray();
+        $dump = 'mysqldump -h '.$_configuration['db_host'].' -u '.$_configuration['db_user'].' -p'.$_configuration['db_password'].' '.$_configuration['main_database'];
+        system($dump);
+        return null;
+    }
+}

+ 114 - 0
vendor/chamilo/chash/src/Chash/Command/Database/FullBackupCommand.php

@@ -0,0 +1,114 @@
+<?php
+
+namespace Chash\Command\Database;
+
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Input\ArrayInput;
+
+/**
+ * Make a full backup of the given/current install and put the results (files and db) into the given file. Store the temporary data into the /tmp/ directory
+ * @param array $params The params received
+ */
+class FullBackupCommand extends CommonChamiloDatabaseCommand
+{
+    /**
+     *
+     */
+    protected function configure()
+    {
+        parent::configure();
+
+        $this->setHelp(
+            'The full_backup command allows you to do a full backup of the files and database of a given Chamilo installation'
+        );
+
+        $this
+            ->setName('db:full_backup')
+            ->setDescription('Generates a .tgz from the Chamilo files and database')
+            ->addArgument(
+                'result',
+                InputArgument::REQUIRED,
+                'Allows you to specify a destination file, e.g. database:full_backup /home/user/backup.tgz or backup.tgz'
+            )
+            ->addOption(
+                'tmp',
+                null,
+                InputOption::VALUE_OPTIONAL,
+                'Allows you to specify in which temporary directory the backup files should be placed (optional, defaults to /tmp)'
+            )
+            ->addOption(
+                'del-archive',
+                null,
+                InputOption::VALUE_NONE,
+                'Deletes the contents of the archive/ directory before the backup is executed'
+            );
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+
+        $_configuration = $this->getHelper('configuration')->getConfiguration();
+        $resultPath     = $input->getArgument('result');
+        $tmpFolder      = $input->getOption('tmp');
+
+        if (empty($tmpFolder)) {
+            $output->writeln(
+                '<info>No temporary directory defined. Assuming /tmp/. Please make sure you have *enough space* left on that device</info>'
+            );
+            $tmpFolder = '/tmp';
+        }
+
+        $deleteTemp = $input->getOption('del-archive');
+
+        if ($deleteTemp) {
+            //Calling command
+            $command = $this->getApplication()->find('files:clean_temp_folder');
+
+            $arguments = array(
+                'command' => 'files:clean_temp_folder'
+            );
+            $input     = new ArrayInput($arguments);
+            $command->run($input, $output);
+        } else {
+            $output->writeln('<comment>Temp archives are not removed</comment>');
+        }
+
+        $cha_dir = realpath($_configuration['root_sys']);
+
+        $output->writeln('<comment>Starting full backup</comment>');
+
+        $f = $_configuration['db_user'];
+        //backup the files (this requires root permissions)
+        $bkp_dir = $tmpFolder.'/'.$f.'-'.date('Ymdhis');
+        $err     = @mkdir($bkp_dir);
+        $tgz     = $bkp_dir.'/'.$f.'.tgz';
+        $sql     = $bkp_dir.'/'.$f.'-db.sql';
+        $err     = @system('tar zcf '.$tgz.' '.$cha_dir);
+
+        $output->writeln('<comment>Generating mysqldump</comment>');
+
+        $err = @system(
+            'mysqldump -h '.$_configuration['db_host'].' -u '.$_configuration['db_user'].' -p'.$_configuration['db_password'].' '.$_configuration['main_database'].' --result-file='.$sql
+        );
+
+        $output->writeln('<comment>Generating tarball </comment>');
+
+        $err = @system('tar zcf '.$resultPath.' '.$bkp_dir);
+        $err = @system('rm -rf '.$bkp_dir);
+
+        $output->writeln(
+            '<comment>End Chamilo backup. File can be found here: '.realpath($resultPath).' </comment>'
+        );
+
+    }
+}

+ 57 - 0
vendor/chamilo/chash/src/Chash/Command/Database/RestoreCommand.php

@@ -0,0 +1,57 @@
+<?php
+
+namespace Chash\Command\Database;
+
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Imports an SQL dump of the database (caller should use an output redirect of some kind
+ * to store to a file)
+ * @param array $params params received
+ */
+class RestoreCommand extends CommonChamiloDatabaseCommand
+{
+    /**
+     *
+     */
+    protected function configure()
+    {
+        parent::configure();
+
+        $this
+            ->setName('db:restore')
+            ->setDescription(
+                'Allows you to restore an SQL dump right into the active database of a given Chamilo installation (which will also erase all previous data in that database)'
+            )
+            ->addArgument(
+                'file',
+                InputArgument::REQUIRED,
+                'Specify the dump\'s full path, e.g. database:restore /tmp/dump.sql'
+            );
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+        $dumpPath = $input->getArgument('file');
+        if (!is_dir($dumpPath) && file_exists($dumpPath)) {
+            $_configuration = $this->getConfigurationArray();
+
+            $output->writeln('<comment>Starting restoring database</comment>');
+            $action = 'mysql -h '.$_configuration['db_host'].' -u '.$_configuration['db_user'].' -p'.$_configuration['db_password'].' '.$_configuration['main_database'].' < '.$dumpPath;
+            system($action);
+            $output->writeln('<info>Process ended succesfully</info>');
+        } else {
+            $output->writeln('<comment>File is not a valid SQL file: '.$dumpPath.' </comment>');
+        }
+    }
+}

+ 71 - 0
vendor/chamilo/chash/src/Chash/Command/Database/RunSQLCommand.php

@@ -0,0 +1,71 @@
+<?php
+
+namespace Chash\Command\Database;
+
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+use Symfony\Component\Console\Formatter\OutputFormatterStyle;
+
+/**
+ * Connects to the MySQL client without the need to introduce a password
+ * @return int Exit code returned by mysql command
+ */
+class RunSQLCommand extends CommonChamiloDatabaseCommand
+{
+    /**
+     *
+     */
+    protected function configure()
+    {
+        parent::configure();
+
+        $this
+            ->setName('db:sql_cli')
+            ->setDescription('Enters to the SQL command line');
+        $this->setHelp('Prompts a SQL cli');
+
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+        $output->writeln('Starting Chamilo SQL cli');
+
+        $_configuration = $this->getConfigurationArray();
+
+        $cmd         = 'mysql -h '.$_configuration['db_host'].' -u '.$_configuration['db_user'].' -p'.$_configuration['db_password'].' '.$_configuration['main_database'];
+        $process     = proc_open($cmd, array(0 => STDIN, 1 => STDOUT, 2 => STDERR), $pipes);
+        $proc_status = proc_get_status($process);
+        $exit_code   = proc_close($process);
+        return ($proc_status["running"] ? $exit_code : $proc_status["exitcode"]);
+
+        /*$output->writeln('<comment>Starting Chamilo process</comment>');
+        $output->writeln('<info>Chamilo process ended succesfully</info>');
+        */
+        /*
+        $progress = $this->getHelperSet()->get('progress');
+
+        $progress->start($output, 50);
+        $i = 0;
+        while ($i++ < 50) {
+            // ... do some work
+
+            // advance the progress bar 1 unit
+            $progress->advance();
+        }
+        $progress->finish();*/
+
+        // Inside execute function
+        //$output->getFormatter()->setStyle('fcbarcelona', new OutputFormatterStyle('red', 'blue', array('blink', 'bold', 'underscore')));
+        //$output->writeln('<fcbarcelona>Messi for the win</fcbarcelona>');
+    }
+}

+ 61 - 0
vendor/chamilo/chash/src/Chash/Command/Database/SQLCountCommand.php

@@ -0,0 +1,61 @@
+<?php
+
+namespace Chash\Command\Database;
+
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Count the number of rows in a specific table
+ * @return mixed Integer number of rows, or null on error
+ */
+class SQLCountCommand extends CommonChamiloDatabaseCommand
+{
+    /**
+     *
+     */
+    protected function configure()
+    {
+        parent::configure();
+        $this
+            ->setName('db:sql_count')
+            ->setDescription('Count the number of rows in a specific table')
+            ->addArgument(
+                'table',
+                InputArgument::REQUIRED,
+                'Name of the table'
+            );
+    }
+
+    /**
+     * @todo use doctrine
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+        $table = $input->getArgument('table');
+
+        $_configuration = $this->getConfigurationArray();
+        $connection = $this->getConfigurationHelper()->getConnection();
+
+        $t = mysql_real_escape_string($table);
+        $q = mysql_query('SELECT COUNT(*) FROM '.$t);
+        if ($q !== false) {
+            $r = mysql_fetch_row($q);
+            $n = $r[0];
+            $output->writeln(
+                '<comment>Database/table/number of rows: </comment><info>'.$_configuration['main_database'].'/'.$t.'/'.$n.'</info>'
+            );
+        } else {
+            $output->writeln(
+                "<comment>Table '$table' does not exists in the database: ".$_configuration['main_database']
+            );
+        }
+    }
+}

+ 59 - 0
vendor/chamilo/chash/src/Chash/Command/Database/ShowConnInfoCommand.php

@@ -0,0 +1,59 @@
+<?php
+
+namespace Chash\Command\Database;
+
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Class ShowConnInfoCommand
+ * @package Chash\Command\Database
+ */
+class ShowConnInfoCommand extends CommonChamiloDatabaseCommand
+{
+    /**
+     *
+     */
+    protected function configure()
+    {
+        parent::configure();
+
+        $this
+            ->setName('db:show_conn_info')
+            ->setDescription('Shows database connection credentials for the current Chamilo install');
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+
+        $dialog = $this->getHelperSet()->get('dialog');
+
+        if (!$dialog->askConfirmation(
+            $output,
+            '<question>Are you sure you want to show the database connection info here? (y/N)</question>',
+            false
+        )
+        ) {
+            return;
+        }
+
+        $_configuration = $this->getConfigurationArray();
+
+        $output->writeln("Database connection details:");
+        $output->writeln("Host:\t".$_configuration['db_host']);
+        $output->writeln("User:\t".$_configuration['db_user']);
+        $output->writeln("Pass:\t".$_configuration['db_password']);
+        $output->writeln("DB:\t".$_configuration['main_database']);
+        $output->writeln("Connection string (add password manually for increased security:");
+        $output->writeln("mysql -h ".$_configuration['db_host']." -u ".$_configuration['db_user']." -p ".$_configuration['main_database']."\n");
+    }
+}

+ 54 - 0
vendor/chamilo/chash/src/Chash/Command/Files/CleanConfigFilesCommand.php

@@ -0,0 +1,54 @@
+<?php
+
+namespace Chash\Command\Files;
+
+use Chash\Command\Database\CommonChamiloDatabaseCommand;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Clean the archives directory, leaving only index.html, twig and Serializer
+ * @return bool True on success, false on error
+ */
+class CleanConfigFilesCommand extends CommonChamiloDatabaseCommand
+{
+    /**
+     *
+     */
+    protected function configure()
+    {
+        parent::configure();
+        $this
+            ->setName('files:clean_config_files')
+            ->setDescription('Cleans the config files to help you re-install');
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+        $this->writeCommandHeader($output, "Cleaning config files.");
+
+        $dialog = $this->getHelperSet()->get('dialog');
+
+        if (!$dialog->askConfirmation(
+            $output,
+            '<question>Are you sure you want to clean your config files? (y/N)</question>',
+            false
+        )
+        ) {
+            return;
+        }
+
+        $files = $this->getConfigurationHelper()->getConfigFiles();
+        $this->removeFiles($files, $output);
+
+    }
+}

+ 55 - 0
vendor/chamilo/chash/src/Chash/Command/Files/CleanDataFilesCommand.php

@@ -0,0 +1,55 @@
+<?php
+
+namespace Chash\Command\Files;
+
+use Chash\Command\Database\CommonChamiloDatabaseCommand;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Clean the archives directory, leaving only index.html, twig and Serializer
+ * @return bool True on success, false on error
+ */
+
+class CleanDataFilesCommand extends CommonChamiloDatabaseCommand
+{
+    /**
+     *
+     */
+    protected function configure()
+    {
+        parent::configure();
+        $this
+            ->setName('files:clean_data_files')
+            ->setDescription('Cleans the data directory');
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return bool|int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+
+        $this->writeCommandHeader($output, 'Cleaning data folders.');
+
+        $dialog = $this->getHelperSet()->get('dialog');
+
+        if (!$dialog->askConfirmation(
+            $output,
+            '<question>Are you sure you want to clean the Chamilo data files? (y/N)</question>',
+            false
+        )
+        ) {
+            return;
+        }
+
+        $files = $this->getConfigurationHelper()->getDataFiles();
+        $this->removeFiles($files, $output);
+    }
+}

+ 58 - 0
vendor/chamilo/chash/src/Chash/Command/Files/CleanTempFolderCommand.php

@@ -0,0 +1,58 @@
+<?php
+
+namespace Chash\Command\Files;
+
+use Chash\Command\Database\CommonChamiloDatabaseCommand;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Clean the archives directory, leaving only index.html, twig and Serializer
+ * @return bool True on success, false on error
+ */
+
+class CleanTempFolderCommand extends CommonChamiloDatabaseCommand
+{
+    /**
+     *
+     */
+    protected function configure()
+    {
+        parent::configure();
+        $this
+            ->setName('files:clean_temp_folder')
+            ->setDescription('Cleans the temp directory');
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return bool|int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+        $this->writeCommandHeader($output, "Cleaning temp files.");
+
+        $dialog = $this->getHelperSet()->get('dialog');
+
+        if (!$dialog->askConfirmation(
+            $output,
+            '<question>Are you sure you want to clean the Chamilo temp files? (y/N)</question>',
+            false
+        )
+        ) {
+            return;
+        }
+
+        $files = $this->getConfigurationHelper()->getTempFiles();
+        $this->removeFiles($files, $output);
+    }
+
+    public function detectTempFolders()
+    {
+    }
+}

+ 89 - 0
vendor/chamilo/chash/src/Chash/Command/Files/GenerateTempFileStructureCommand.php

@@ -0,0 +1,89 @@
+<?php
+
+namespace Chash\Command\Files;
+
+use Chash\Command\Database\CommonChamiloDatabaseCommand;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Filesystem\Filesystem;
+
+
+class GenerateTempFileStructureCommand extends CommonChamiloDatabaseCommand
+{
+    /**
+     *
+     */
+    protected function configure()
+    {
+        parent::configure();
+        $this
+            ->setName('files:generate_temp_folders')
+            ->setDescription('Generate temp folder structure: twig');
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+        $this->writeCommandHeader($output, 'Generating temp folders.');
+
+        /*$dialog = $this->getHelperSet()->get('dialog');
+
+        if (!$dialog->askConfirmation(
+            $output,
+            '<question>Are you sure you want to clean your config files? (y/N)</question>',
+            false
+        )
+        ) {
+            return;
+        }*/
+
+        // $configuration = $this->getConfigurationArray();
+
+        // Data folders
+        $files = $this->getConfigurationHelper()->getTempFolderList();
+        $this->createFolders($output, $files, 0777);
+
+    }
+
+    /**
+     * @param $files
+     * @param \Symfony\Component\Console\Output\OutputInterface $output
+     * @return int
+     */
+    public function createFolders(\Symfony\Component\Console\Output\OutputInterface $output, $files, $permission)
+    {
+        $dryRun = $this->getConfigurationHelper()->getDryRun();
+
+        if (empty($files)) {
+            $output->writeln('<comment>No files found.</comment>');
+            return 0;
+        }
+
+        $fs = new Filesystem();
+        try {
+            if ($dryRun) {
+                $output->writeln("<comment>Folders to be created with permission ".decoct($permission).":</comment>");
+                foreach ($files as $file) {
+                    $output->writeln($file);
+                }
+            } else {
+                $output->writeln("<comment>Creating folders with permission ".decoct($permission).":</comment>");
+                foreach ($files as $file) {
+                    $output->writeln($file);
+                }
+                $fs->mkdir($files, $permission);
+            }
+
+        } catch (IOException $e) {
+            echo "\n An error occurred while removing the directory: ".$e->getMessage()."\n ";
+        }
+    }
+}

+ 63 - 0
vendor/chamilo/chash/src/Chash/Command/Files/MailConfCommand.php

@@ -0,0 +1,63 @@
+<?php
+
+namespace Chash\Command\Files;
+
+use Chash\Command\Database\CommonChamiloDatabaseCommand;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Returns the current mail configuration
+ */
+class MailConfCommand extends CommonChamiloDatabaseCommand
+{
+    /**
+     *
+     */
+    protected function configure()
+    {
+        parent::configure();
+        $this
+            ->setName('files:show_mail_conf')
+            ->setDescription('Returns the current mail config');
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+        $this->writeCommandHeader($output, 'Current mail configuration.');
+
+        $path = $this->getHelper('configuration')->getConfigurationPath();
+        $path .= 'mail.conf.php';
+        define('IS_WINDOWS_OS', strtolower(substr(php_uname(), 0, 3 )) == 'win'?true:false);
+        if (isset($path) && is_file($path)) {
+            $output->writeln('File: '.$path);
+            $lines = file($path);
+            $list = array('SMTP_HOST','SMTP_PORT','SMTP_MAILER','SMTP_AUTH','SMTP_USER','SMTP_PASS');
+            foreach ($lines as $line) {
+                $match = array();
+                if (preg_match("/platform_email\['(.*)'\]/",$line,$match)) {
+                    if (in_array($match[1],$list)) {
+                        eval($line);
+                    }
+                }
+            }
+            $output->writeln('Host:     '.$platform_email['SMTP_HOST']);
+            $output->writeln('Port:     '.$platform_email['SMTP_PORT']);
+            $output->writeln('Mailer:   '.$platform_email['SMTP_MAILER']);
+            $output->writeln('Auth SMTP:'.$platform_email['SMTP_AUTH']);
+            $output->writeln('User:     '.$platform_email['SMTP_USER']);
+            $output->writeln('Pass:     '.$platform_email['SMTP_PASS']);
+        } else {
+            $output->writeln("<comment>Nothing to print</comment>");
+        }
+    }
+}

+ 139 - 0
vendor/chamilo/chash/src/Chash/Command/Files/SetPermissionsAfterInstallCommand.php

@@ -0,0 +1,139 @@
+<?php
+
+namespace Chash\Command\Files;
+
+use Chash\Command\Database\CommonChamiloDatabaseCommand;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Filesystem\Filesystem;
+
+
+class SetPermissionsAfterInstallCommand extends CommonChamiloDatabaseCommand
+{
+    /**
+     *
+     */
+    protected function configure()
+    {
+        parent::configure();
+        $this
+            ->setName('files:set_permissions_after_install')
+            ->setDescription('Set permissions')
+            ->addOption('linux-user', null, InputOption::VALUE_OPTIONAL, 'user', 'www-data')
+            ->addOption('linux-group', null, InputOption::VALUE_OPTIONAL, 'group', 'www-data');
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+        $this->writeCommandHeader($output, 'Setting permissions.');
+
+        $linuxUser = $input->getOption('linux-user');
+        $linuxGroup = $input->getOption('linux-group');
+
+
+        /*$dialog = $this->getHelperSet()->get('dialog');
+
+        if (!$dialog->askConfirmation(
+            $output,
+            '<question>Are you sure you want to clean your config files? (y/N)</question>',
+            false
+        )
+        ) {
+            return;
+        }*/
+
+        // $configuration = $this->getConfigurationArray();
+
+        // All files
+        $files = $this->getConfigurationHelper()->getSysFolders();
+        $this->setPermissions($output, $files, 0777, $linuxUser, $linuxGroup, false);
+
+        $files = $this->getConfigurationHelper()->getSysFiles();
+        $this->setPermissions($output, $files, null, $linuxUser, $linuxGroup, false);
+
+        // Data folders
+        $files = $this->getConfigurationHelper()->getDataFolders();
+        $this->setPermissions($output, $files, 0777, $linuxUser, $linuxGroup);
+
+        // Config folders
+        $files = $this->getConfigurationHelper()->getConfigFolders();
+        $this->setPermissions($output, $files, 0555, $linuxUser, $linuxGroup);
+        $files = $this->getConfigurationHelper()->getConfigFiles();
+        $this->setPermissions($output, $files, 0555, $linuxUser, $linuxGroup);
+
+        // Temp folders
+        $files = $this->getConfigurationHelper()->getTempFolders();
+        $this->setPermissions($output, $files, 0777, $linuxUser, $linuxGroup);
+    }
+
+    /**
+     * @param $files
+     * @param \Symfony\Component\Console\Output\OutputInterface $output
+     * @return int
+     */
+    public function setPermissions(\Symfony\Component\Console\Output\OutputInterface $output, $files, $permission, $user, $group, $listFiles = true)
+    {
+        $dryRun = $this->getConfigurationHelper()->getDryRun();
+
+        if (empty($files)) {
+            $output->writeln('<comment>No files found.</comment>');
+            return 0;
+        }
+
+        $fs = new Filesystem();
+        try {
+            if ($dryRun) {
+
+                $output->writeln("<comment>Files to be changed to permission ".decoct($permission).":</comment>");
+                $output->writeln("<comment>user: ".$user.":</comment>");
+                $output->writeln("<comment>group ".$group.":</comment>");
+                if ($listFiles) {
+                    foreach ($files as $file) {
+                        $output->writeln($file->getPathName());
+                    }
+                }
+            } else {
+
+                if (!empty($permission)) {
+                    $output->writeln("<comment>Modifying files permission: ".decoct($permission).":</comment>");
+                }
+                if (!empty($user)) {
+                    $output->writeln("<comment>user: ".$user.":</comment>");
+                }
+                if (!empty($group)) {
+                    $output->writeln("<comment>group: ".$group.":</comment>");
+                }
+
+                if ($listFiles) {
+                    foreach ($files as $file) {
+                        $output->writeln($file->getPathName());
+                    }
+                }
+                if (!empty($permission)) {
+                    $fs->chmod($files, $permission, 0000, true);
+                }
+
+                if (!empty($user)) {
+                    $fs->chown($files, $user, true);
+                }
+
+                if (!empty($group)) {
+                    $fs->chgrp($files, $group, true);
+                }
+
+            }
+
+        } catch (IOException $e) {
+            echo "\n An error occurred while removing the directory: ".$e->getMessage()."\n ";
+        }
+    }
+}

+ 1143 - 0
vendor/chamilo/chash/src/Chash/Command/Installation/CommonCommand.php

@@ -0,0 +1,1143 @@
+<?php
+
+namespace Chash\Command\Installation;
+
+use Doctrine\Common\Annotations\AnnotationReader;
+use Symfony\Component\Yaml\Dumper;
+use Symfony\Component\Yaml\Parser;
+use Doctrine\DBAL\Migrations\Tools\Console\Command\AbstractCommand;
+use Symfony\Component\Filesystem\Filesystem;
+use Symfony\Component\Filesystem\Exception\IOException;
+use Alchemy\Zippy\Zippy;
+
+class CommonCommand extends AbstractCommand
+{
+    public $portalSettings;
+    public $databaseSettings;
+    public $adminSettings;
+    public $rootSys;
+    public $configurationPath = null;
+    public $configuration = array();
+    public $extraDatabaseSettings;
+
+    /**
+     * @param array $configuration
+     */
+    public function setConfigurationArray(array $configuration)
+    {
+        $this->configuration = $configuration;
+    }
+
+    /**
+     * @return array
+     */
+    public function getConfigurationArray()
+    {
+        return $this->configuration;
+    }
+
+    /**
+     * @param string $path
+     */
+    public function setConfigurationPath($path)
+    {
+        $this->configurationPath = $path;
+    }
+
+    /**
+     * @return null
+     */
+    public function getConfigurationPath()
+    {
+        return $this->configurationPath;
+    }
+
+    /**
+     * @param array $portalSettings
+     */
+    public function setPortalSettings(array $portalSettings)
+    {
+        $this->portalSettings = $portalSettings;
+    }
+
+    /**
+     * @return array
+     */
+    public function getPortalSettings()
+    {
+        return $this->portalSettings;
+    }
+
+    /**
+     * @param array $databaseSettings
+     */
+    public function setDatabaseSettings(array $databaseSettings)
+    {
+        $this->databaseSettings = $databaseSettings;
+    }
+
+    /**
+     * @return array
+     */
+    public function getDatabaseSettings()
+    {
+        return $this->databaseSettings;
+    }
+
+        /**
+     * @param array $databaseSettings
+     */
+    public function setExtraDatabaseSettings(array $databaseSettings)
+    {
+        $this->extraDatabaseSettings = $databaseSettings;
+    }
+
+    /**
+     * @return array
+     */
+    public function getExtraDatabaseSettings()
+    {
+        return $this->extraDatabaseSettings;
+    }
+
+
+    /**
+     * @param array $adminSettings
+     */
+    public function setAdminSettings(array $adminSettings)
+    {
+        $this->adminSettings = $adminSettings;
+    }
+
+    public function getAdminSettings()
+    {
+        return $this->adminSettings;
+    }
+
+    /**
+     * @param string $path
+     */
+    public function setRootSys($path)
+    {
+        $this->rootSys = $path;
+    }
+
+    /**
+     * @return string
+     */
+    public function getRootSys()
+    {
+        return $this->rootSys;
+    }
+
+    /**
+     * @return string
+     */
+    public function getCourseSysPath()
+    {
+        if (is_dir($this->getRootSys().'courses')) {
+            return $this->getRootSys().'courses';
+        }
+
+        if (is_dir($this->getRootSys().'data/courses')) {
+            return $this->getRootSys().'data/courses';
+        }
+
+        return null;
+    }
+
+    /**
+     * @return string
+     */
+    public function getInstallationFolder()
+    {
+        return realpath(__DIR__.'/../../Resources/Database').'/';
+    }
+
+    /**
+     * Gets the version name folders located in main/install
+     *
+     * @return array
+     */
+    public function getAvailableVersions()
+    {
+        $installPath = $this->getInstallationFolder();
+        $dir = new \DirectoryIterator($installPath);
+        $dirList = array();
+        foreach ($dir as $fileInfo) {
+            if ($fileInfo->isDir() && !$fileInfo->isDot()) {
+                $dirList[$fileInfo->getFilename()] = $fileInfo->getFilename();
+            }
+        }
+        natsort($dirList);
+        return $dirList;
+    }
+
+    /**
+     * @return array
+     */
+    public function getAdminSettingsParams()
+    {
+        return array(
+            'firstname' => array(
+                'attributes' => array(
+                    'label' => 'Firstname',
+                    'data' =>  'John'
+                ),
+                'type' => 'text'
+            ),
+            'lastname' =>  array(
+                'attributes' => array(
+                    'label' => 'Lastname',
+                    'data' =>  'Doe'
+                ),
+                'type' => 'text'
+            ),
+            'username' => array(
+                'attributes' => array(
+                    'label' => 'Username',
+                    'data' =>  'admin'
+                ),
+                'type' => 'text'
+            ),
+            'password' => array(
+                'attributes' => array(
+                    'label' => 'Password',
+                    'data' =>  'admin'
+                ),
+                'type' => 'password'
+            ),
+            'email' => array(
+                'attributes' => array(
+                    'label' => 'Email',
+                    'data' =>  'admin@example.org'
+                ),
+                'type' => 'email'
+            ),
+            'language' => array(
+                'attributes' => array(
+                    'label' => 'Language',
+                    'data' =>  'english'
+                ),
+                'type' => 'text'
+            ),
+            'phone' => array(
+                'attributes' => array(
+                    'label' => 'Phone',
+                    'data' =>  '123456'
+                ),
+                'type' => 'text'
+            )
+        );
+    }
+
+    /**
+     * @return array
+     */
+    public function getPortalSettingsParams()
+    {
+        return array(
+            'sitename' => array(
+                'attributes' => array(
+                    'label' => 'Site name',
+                    'data' => 'Campus Chamilo',
+                ),
+                'type' => 'text'
+            ),
+            'institution' => array(
+                'attributes' => array(
+                    'data' => 'Chamilo',
+                ),
+                'type' => 'text'
+            ),
+            'institution_url' => array(
+                'attributes' => array(
+                    'label' => 'URL',
+                    'data' => 'http://localhost/',
+                ),
+                'type' => 'text'
+            ),
+            'encrypt_method' => array(
+                'attributes' => array(
+                    'choices' => array(
+                        'sha1' => 'sha1',
+                        'md5' => 'md5',
+                        'none' => 'none'
+                    ),
+                    'data' => 'sha1'
+                ),
+
+                'type' => 'choice'
+            ),
+            'permissions_for_new_directories' => array(
+                'attributes' => array(
+                    'data' => '0777',
+                ),
+                'type' => 'text'
+            ),
+            'permissions_for_new_files' => array(
+                'attributes' => array(
+                    'data' => '0666',
+                ),
+                'type' => 'text'
+            ),
+
+        );
+    }
+
+    /**
+     * Database parameters that are going to be parsed during the console/browser installation
+     * @return array
+     */
+    public function getDatabaseSettingsParams()
+    {
+        return array(
+            'driver' => array(
+                'attributes' => array(
+                    'choices' =>
+                        array(
+                            'pdo_mysql' => 'pdo_mysql',
+                            'pdo_sqlite' => 'pdo_sqlite',
+                            'pdo_pgsql' => 'pdo_pgsql',
+                            'pdo_oci' => 'pdo_oci',
+                            'ibm_db2' => 'ibm_db2',
+                            'pdo_ibm' => 'pdo_ibm',
+                            'pdo_sqlsrv' => 'pdo_sqlsrv'
+                        ),
+                    'data' => 'pdo_mysql'
+                ),
+                'type' => 'choice'
+            ),
+            'host' => array(
+                'attributes' => array(
+                    'label' => 'Host',
+                    'data' => 'localhost',
+                ),
+                'type' => 'text'
+            ),
+            'dbname' => array(
+                'attributes' => array(
+                    'label' => 'Database name',
+                    'data' => 'chamilo',
+                ),
+                'type' => 'text'
+            ),
+            'user' => array(
+                'attributes' => array(
+                    'label' => 'User',
+                    'data' => 'root',
+                ),
+                'type' => 'text'
+            ),
+            'password' => array(
+                'attributes' => array(
+                    'label' => 'Password',
+                    'data' => 'root',
+                ),
+                'type' => 'password'
+            )
+        );
+    }
+    /**
+     * Gets the installation version path
+     *
+     * @param string $version
+     *
+     * @return string
+     */
+    public function getInstallationPath($version)
+    {
+        return __DIR__.'/../../Resources/Database/'.$version.'/';
+    }
+
+    /**
+     * Gets the content of a version from the available versions
+     *
+     * @param string $version
+     *
+     * @return bool
+     */
+    public function getAvailableVersionInfo($version)
+    {
+        $versionList = $this->availableVersions();
+        foreach ($versionList as $versionName => $versionInfo) {
+            if ($version == $versionName) {
+                return $versionInfo;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * Gets the min version available to migrate with this command
+     * @return mixed
+     */
+    public function getMinVersionSupportedByInstall()
+    {
+        return key($this->availableVersions());
+    }
+
+    /**
+     * Gets an array with the supported versions to migrate
+     * @return array
+     */
+    public function getVersionNumberList()
+    {
+        $versionList = $this->availableVersions();
+        $versionNumberList = array();
+        foreach ($versionList as $version => $info) {
+            $versionNumberList[] = $version;
+        }
+
+        return $versionNumberList;
+    }
+
+    /**
+     * Gets an array with the settings for every supported version
+     *
+     * @return array
+     */
+    public function availableVersions()
+    {
+        $versionList = array(
+            '1.8.7' => array(
+                'require_update' => false,
+            ),
+            '1.8.8' => array(
+                'require_update' => true,
+                'pre' => 'migrate-db-1.8.7-1.8.8-pre.sql',
+                'post' => null,
+                'update_db' => 'update-db-1.8.7-1.8.8.inc.php',
+                //'update_files' => 'update-files-1.8.7-1.8.8.inc.php',
+                'hook_to_doctrine_version' => '8' //see ChamiloLMS\Migrations\Version8.php file
+            ),
+            '1.8.8.2' => array(
+                'require_update' => false,
+                'parent' => '1.8.8'
+            ),
+            '1.8.8.4' => array(
+                'require_update' => false,
+                'parent' => '1.8.8'
+            ),
+            '1.8.8.6' => array(
+                'require_update' => false,
+                'parent' => '1.8.8'
+            ),
+            '1.9.0' => array(
+                'require_update' => true,
+                'pre' => 'migrate-db-1.8.8-1.9.0-pre.sql',
+                'post' => null,
+                'update_db' => 'update-db-1.8.8-1.9.0.inc.php',
+                'update_files' => 'update-files-1.8.8-1.9.0.inc.php',
+                'hook_to_doctrine_version' => '9'
+            ),
+            '1.9.2' => array(
+                'require_update' => false,
+                'parent' => '1.9.0'
+            ),
+            '1.9.4' => array(
+                'require_update' => false,
+                'parent' => '1.9.0'
+            ),
+            '1.9.6' => array(
+                'require_update' => false,
+                'parent' => '1.9.0'
+            ),
+            '1.9.8' => array(
+                'require_update' => false,
+                'parent' => '1.9.0'
+            ),
+            '1.10.0'  => array(
+                'require_update' => true,
+                'pre' => 'migrate-db-1.9.0-1.10.0-pre.sql',
+                'post' => 'migrate-db-1.9.0-1.10.0-post.sql',
+                'update_db' => 'update-db-1.9.0-1.10.0.inc.php',
+                'update_files' => null,
+                'hook_to_doctrine_version' => '10'
+            )
+        );
+
+        return $versionList;
+    }
+
+
+    /**
+     * Gets the Doctrine configuration file path
+     * @return string
+     */
+    public function getMigrationConfigurationFile()
+    {
+        return realpath(__DIR__.'/../../Migrations/migrations.yml');
+    }
+
+    /**
+     *
+     * @return \Chash\Helpers\ConfigurationHelper
+     */
+    public function getConfigurationHelper()
+    {
+        return $this->getHelper('configuration');
+    }
+
+    /**
+     * @todo move to configurationhelper
+     * @param string $path
+     */
+    public function setRootSysDependingConfigurationPath($path)
+    {
+        $configurationPath = $this->getConfigurationHelper()->getNewConfigurationPath($path);
+
+        if ($configurationPath == false) {
+            //  Seems an old installation!
+            $configurationPath = $this->getConfigurationHelper()->getConfigurationPath($path);
+            $this->setRootSys(realpath($configurationPath.'/../../../').'/');
+        } else {
+            // Chamilo installations > 1.10
+            $this->setRootSys(realpath($configurationPath.'/../').'/');
+        }
+    }
+
+    /**
+     * Writes the configuration file for the first time (install command)
+     * @param string $version
+     * @param string $path
+     * @return bool
+     *
+     */
+    public function writeConfiguration($version, $path)
+    {
+        $portalSettings = $this->getPortalSettings();
+        $databaseSettings = $this->getDatabaseSettings();
+        $configurationPath = $this->getConfigurationHelper()->getConfigurationPath($path);
+
+        // Creates a YML File
+
+        $configuration = array();
+
+        $configuration['db_host'] = $databaseSettings['host'];
+        $configuration['db_user'] = $databaseSettings['user'];
+        $configuration['db_password'] = $databaseSettings['password'];
+        $configuration['main_database'] = $databaseSettings['dbname'];
+        $configuration['driver'] = $databaseSettings['driver'];
+
+        $configuration['root_web'] = $portalSettings['institution_url'];
+        $configuration['root_sys'] = $this->getRootSys();
+
+        $configuration['security_key'] = md5(uniqid(rand().time()));
+
+        // Hash function method
+        $configuration['password_encryption']      = $portalSettings['encrypt_method'];
+        // You may have to restart your web server if you change this
+        $configuration['session_stored_in_db']     = false;
+        // Session lifetime
+        $configuration['session_lifetime']         = 3600;
+        // Activation for multi-url access
+        $_configuration['multiple_access_urls']   = false;
+        //Deny the elimination of users
+        $configuration['deny_delete_users']        = false;
+        //Prevent all admins from using the "login_as" feature
+        $configuration['login_as_forbidden_globally'] = false;
+
+        // Version settings
+        $configuration['system_version']           = $version;
+
+        if (file_exists($this->getRootSys().'config/configuration.dist.php')) {
+            $contents = file_get_contents($this->getRootSys().'config/configuration.dist.php');
+        } else {
+            // Try the old one
+            //$contents = file_get_contents($this->getRootSys().'main/inc/conf/configuration.dist.php');
+            $contents = file_get_contents($this->getRootSys().'main/install/configuration.dist.php');
+        }
+
+        $config['{DATE_GENERATED}'] = date('r');
+        $config['{DATABASE_HOST}'] = $configuration['db_host'];
+        $config['{DATABASE_USER}'] = $configuration['db_user'];
+        $config['{DATABASE_PASSWORD}'] = $configuration['db_password'];
+        $config['{DATABASE_MAIN}'] = $configuration['main_database'];
+        $config['{DATABASE_DRIVER}'] = $configuration['driver'];
+
+        $config['{COURSE_TABLE_PREFIX}'] = "";
+        $config['{DATABASE_GLUE}'] = "";
+        $config['{DATABASE_PREFIX}'] = "";
+        $config['{DATABASE_STATS}'] = $configuration['main_database'];
+        $config['{DATABASE_SCORM}'] = $configuration['main_database'];
+        $config['{DATABASE_PERSONAL}'] = $configuration['main_database'];
+        $config['TRACKING_ENABLED'] = "'true'";
+        $config['SINGLE_DATABASE'] = "false";
+
+        $config['{ROOT_WEB}'] = $portalSettings['institution_url'];
+        $config['{ROOT_SYS}'] = $this->getRootSys();
+
+        $config['{URL_APPEND_PATH}'] = "";
+        $config['{SECURITY_KEY}'] = $configuration['security_key'];
+        $config['{ENCRYPT_PASSWORD}'] = $configuration['password_encryption'];
+
+        $config['SESSION_LIFETIME'] = 3600;
+        $config['{NEW_VERSION}'] = $version;
+        $config['NEW_VERSION_STABLE'] = 'true';
+
+        foreach ($config as $key => $value) {
+            $contents = str_replace($key, $value, $contents);
+        }
+        $newConfigurationFile = $configurationPath.'configuration.php';
+
+        $result = file_put_contents($newConfigurationFile, $contents);
+
+        return $result;
+
+
+    }
+
+    /**
+     * Updates the configuration.yml file
+     * @param string $version
+     *
+     * @return bool
+     */
+    public function updateConfiguration($output, $dryRun, $newValues)
+    {
+        $this->getConfigurationPath();
+
+        $_configuration = $this->getConfigurationArray();
+
+        // Merging changes
+        if (!empty($newValues)) {
+            $_configuration = array_merge($_configuration, $newValues);
+        }
+
+        $paramsToRemove = array(
+            'tracking_enabled',
+            //'single_database', // still needed fro version 1.9.8
+            //'table_prefix',
+            //'db_glue',
+            'db_prefix',
+            //'url_append',
+            'statistics_database',
+            'user_personal_database',
+            'scorm_database'
+        );
+
+
+        foreach ($_configuration as $key => $value) {
+            if (in_array($key, $paramsToRemove)) {
+                unset($_configuration[$key]);
+            }
+        }
+
+        // See http://zf2.readthedocs.org/en/latest/modules/zend.config.introduction.html
+        $config = new \Zend\Config\Config($_configuration, true);
+        $writer = new \Zend\Config\Writer\PhpArray();
+        $content = $writer->toString($config);
+
+        $content = str_replace('return', '$_configuration = ', $content);
+        $configurationPath = $this->getConfigurationPath();
+        $newConfigurationFile = $configurationPath.'configuration.php';
+
+        if ($dryRun == false) {
+            file_put_contents($newConfigurationFile, $content);
+            $output->writeln("<comment>File updated: $newConfigurationFile</comment>");
+        } else {
+            $output->writeln("<comment>File to be updated (dry-run is on): $newConfigurationFile</comment>");
+            $output->writeln($content);
+        }
+        return file_exists($newConfigurationFile);
+    }
+
+    /**
+     * Gets the SQL files relation with versions
+     * @return array
+     */
+    public function getDatabaseMap()
+    {
+
+        $defaultCourseData = array(
+            array(
+                'name' => 'course1',
+                'sql' => array(
+                    'db_course1.sql',
+                ),
+            ),
+            array(
+                'name' => 'course2',
+                'sql' => array(
+                    'db_course2.sql'
+                )
+            ),
+        );
+
+        return array(
+            '1.8.7' => array(
+                'section' => array(
+                    'main' => array(
+                        array(
+                            'name' => 'chamilo',
+                            'sql' => array(
+                                'db_main.sql',
+                                'db_stats.sql',
+                                'db_user.sql'
+                            ),
+                        ),
+                    ),
+                    'course' => $defaultCourseData
+                ),
+            ),
+            '1.8.8' => array(
+                'section' => array(
+                    'main' => array(
+                        array(
+                            'name' => 'chamilo',
+                            'sql' => array(
+                                'db_main.sql',
+                                'db_stats.sql',
+                                'db_user.sql'
+                            ),
+                        ),
+                    ),
+                    'course' => $defaultCourseData
+                ),
+            ),
+            '1.9.0' => array(
+                'section' => array(
+                    'main' => array(
+                        array(
+                            'name' => 'chamilo',
+                            'sql' => array(
+                                'db_course.sql',
+                                'db_main.sql',
+                                'db_stats.sql',
+                                'db_user.sql'
+                            ),
+                        ),
+                    ),
+                )
+            ),
+            '1.10.0' => array(
+                'section' => array(
+                    'main' => array(
+                        array(
+                            'name' => 'chamilo',
+                            'sql' => array(
+                                'db_course.sql',
+                                'db_main.sql'
+                            ),
+                        ),
+                    ),
+                )
+            )
+        );
+    }
+
+    /**
+     * Set Doctrine settings
+     */
+    protected function setDoctrineSettings()
+    {
+        $config = new \Doctrine\ORM\Configuration();
+        $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
+        $reader = new AnnotationReader();
+
+        $driverImpl = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader, array());
+        $config->setMetadataDriverImpl($driverImpl);
+        $config->setProxyDir(__DIR__ . '/Proxies');
+        $config->setProxyNamespace('Proxies');
+
+        $em = \Doctrine\ORM\EntityManager::create($this->getDatabaseSettings(), $config);
+
+        // Fixes some errors
+        $platform = $em->getConnection()->getDatabasePlatform();
+        $platform->registerDoctrineTypeMapping('enum', 'string');
+        $platform->registerDoctrineTypeMapping('set', 'string');
+
+        $helpers = array(
+            'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()),
+            'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em),
+            'configuration' => new \Chash\Helpers\ConfigurationHelper()
+        );
+
+        foreach ($helpers as $name => $helper) {
+            $this->getApplication()->getHelperSet()->set($helper, $name);
+        }
+    }
+
+    /**
+     * @param string $version
+     * @param string $path
+     * @param array $databaseList
+     */
+    protected function setConnections($version, $path, $databaseList)
+    {
+        $_configuration = $this->getHelper('configuration')->getConfiguration($path);
+
+        $config = new \Doctrine\ORM\Configuration();
+        $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
+        $reader = new AnnotationReader();
+
+        $driverImpl = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader, array());
+        $config->setMetadataDriverImpl($driverImpl);
+        $config->setProxyDir(__DIR__ . '/Proxies');
+        $config->setProxyNamespace('Proxies');
+
+        foreach ($databaseList as $section => &$dbList) {
+            foreach ($dbList as &$dbInfo) {
+                $params = $this->getDatabaseSettings();
+
+                if (isset($_configuration['single_database']) && $_configuration['single_database'] == true) {
+                    $em = \Doctrine\ORM\EntityManager::create($params, $config);
+                } else {
+
+                    if ($section == 'course') {
+                        /*$evm = new \Doctrine\Common\EventManager;
+                        $tablePrefix = new \Chash\DoctrineExtensions\TablePrefix($_configuration['table_prefix']);
+                        $evm->addEventListener(\Doctrine\ORM\Events::loadClassMetadata, $tablePrefix);*/
+
+                        if (version_compare($version, '1.10.0', '<=')) {
+                            if (strpos($dbInfo['database'], '_chamilo_course_') === false) {
+                                //$params['dbname'] = $params['dbname'];
+                            } else {
+                                $params['dbname'] = str_replace('_chamilo_course_', '', $dbInfo['database']);
+                            }
+                        }
+                        $em = \Doctrine\ORM\EntityManager::create($params, $config);
+                    } else {
+                        $em = \Doctrine\ORM\EntityManager::create($params, $config);
+                    }
+                }
+                $helper = new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection());
+                $this->getApplication()->getHelperSet()->set($helper, $dbInfo['database']);
+            }
+        }
+    }
+
+    /**
+     * @param $files
+     * @param \Symfony\Component\Console\Output\OutputInterface $output
+     * @return int
+     */
+    public function removeFiles($files, \Symfony\Component\Console\Output\OutputInterface $output)
+    {
+        $dryRun = $this->getConfigurationHelper()->getDryRun();
+
+        if (empty($files)) {
+            $output->writeln('<comment>No files found.</comment>');
+            return 0;
+        }
+
+        $fs = new Filesystem();
+        try {
+            if ($dryRun) {
+                $output->writeln('<comment>Files to be removed (--dry-run is on).</comment>');
+                foreach ($files as $file) {
+                    $output->writeln($file->getPathName());
+                }
+            } else {
+                $output->writeln('<comment>Removing files:</comment>');
+                foreach ($files as $file) {
+                    $output->writeln($file->getPathName());
+                }
+                $fs->remove($files);
+            }
+
+        } catch (IOException $e) {
+            echo "\n An error occurred while removing the directory: ".$e->getMessage()."\n ";
+        }
+    }
+
+    /**
+     * @param \Symfony\Component\Console\Input\InputInterface $input
+     * @param array $params
+     * @return array
+     */
+    public function getParamsFromOptions(\Symfony\Component\Console\Input\InputInterface $input, array $params)
+    {
+        $filledParams = array();
+
+        foreach ($params as $key => $value) {
+            $newValue = $input->getOption($key);
+            $filledParams[$key] = $newValue;
+        }
+
+        return $filledParams;
+    }
+
+    /**
+     * @param \Symfony\Component\Console\Output\OutputInterface $output
+     * @param string $version
+     * @param string $updateInstallation
+     * @param string $defaultTempFolder
+     * @return int|null|String
+     */
+    public function getPackage(\Symfony\Component\Console\Output\OutputInterface $output, $version, $updateInstallation, $defaultTempFolder)
+    {
+        $fs = new Filesystem();
+        // Download the chamilo package from from github:
+        if (empty($updateInstallation)) {
+            $versionTag = str_replace('.', '_', $version);
+            $updateInstallation = "https://github.com/chamilo/chamilo-lms/archive/CHAMILO_".$versionTag."_STABLE.zip";
+        }
+
+        $updateInstallationOriginal = $updateInstallation;
+
+        if (!empty($updateInstallation)) {
+
+            // Check temp folder
+            if (!is_writable($defaultTempFolder)) {
+                $output->writeln("<comment>We don't have permissions to write in the temp folder: $defaultTempFolder</comment>");
+                return 0;
+            }
+
+            // Download file?
+            if (strpos($updateInstallation, 'http') === false) {
+                if (!file_exists($updateInstallation)) {
+                    $output->writeln("<comment>File does not exists: $updateInstallation</comment>");
+                    return 0;
+                }
+            } else {
+                $urlInfo = parse_url($updateInstallation);
+
+                $updateInstallationLocalName = $defaultTempFolder.'/'.basename($urlInfo['path']);
+                if (!file_exists($updateInstallationLocalName)) {
+
+                    $output->writeln("<comment>Executing</comment> <info>wget -O $updateInstallationLocalName '$updateInstallation'</info>");
+                    $output->writeln('');
+
+                    $execute = "wget -O ".$updateInstallationLocalName." '$updateInstallation'\n";
+
+                    $systemOutput = shell_exec($execute);
+
+                    $systemOutput = str_replace("\n", "\n\t", $systemOutput);
+                    $output->writeln($systemOutput);
+                    //$result = file_put_contents($updateInstallationLocalName, file_get_contents($updateInstallation));
+                } else {
+                    $output->writeln("<comment>Seems that the chamilo v".$version." has been already downloaded. File location:</comment> <info>$updateInstallationLocalName</info>");
+                }
+
+                $updateInstallation = $updateInstallationLocalName;
+
+                if (!file_exists($updateInstallationLocalName)) {
+                    $output->writeln("<error>Can't download the file!</error>");
+                    $output->writeln("<comment>Check if you can download this file in your browser first:</comment> <info>$updateInstallation</info>");
+                    return 0;
+                }
+            }
+
+            if (file_exists($updateInstallation)) {
+                $zippy = Zippy::load();
+                $archive = $zippy->open($updateInstallation);
+
+                $folderPath = $defaultTempFolder.'/chamilo-v'.$version.'-'.date('y-m-d');
+
+                if (!is_dir($folderPath)) {
+                    $fs->mkdir($folderPath);
+                } else {
+                    // Load from cache
+                    $chamiloPath = $folderPath.'/chamilo-lms-CHAMILO_'.$versionTag.'_STABLE/main/inc/global.inc.php';
+                    if (file_exists($chamiloPath)) {
+                        $output->writeln("<comment>Files have been already extracted here: </comment><info>".$folderPath.'/chamilo-lms-CHAMILO_'.$versionTag.'_STABLE/'."</info>");
+                        return $folderPath.'/chamilo-lms-CHAMILO_'.$versionTag.'_STABLE/';
+                    }
+                }
+
+                $location = null;
+                if (is_dir($folderPath)) {
+                    $output->writeln("<comment>Extracting files here:</comment> <info>$folderPath</info>");
+
+                    try {
+                        $archive->extract($folderPath);
+                        /** @var \Alchemy\Zippy\Archive\Member $member */
+                        foreach ($archive as $member) {
+                            if ($member->isDir()) {
+                                $location = $member->getLocation();
+
+                                //$output->writeln($folderPath.'/'.$location.'main/inc/lib/global.inc.php');
+                                if (file_exists($folderPath.'/'.$location.'global.inc.php')) {
+                                    $location = realpath($folderPath.'/'.$location.'../../').'/';
+                                    $output->writeln('<comment>Chamilo file detected:</comment> <info>'.$location.'main/inc/lib/global.inc.php</info>');
+                                    break;
+                                }
+                            }
+                        }
+                    } catch (\Alchemy\Zippy\Exception\RunTimeException $e) {
+                        $output->writeln("<comment>It seems that this file doesn't contain a Chamilo package:</comment> <info>$updateInstallationOriginal</info>");
+                        $output->writeln("Error:");
+                        $output->writeln($e->getMessage());
+                        return 0;
+                    }
+                }
+
+                $chamiloLocationPath = $location;
+
+                if (empty($chamiloLocationPath)) {
+                    $output->writeln("<error>Chamilo folder structure not found in package.</error>");
+                    return 0;
+                }
+
+                return $chamiloLocationPath;
+            } else {
+                $output->writeln("<comment>File doesn't exists.</comment>");
+                return 0;
+            }
+        }
+    }
+
+    /**
+     * @param array $_configuration
+     * @param string $courseDatabase
+     * @return null|string
+     */
+    public function getTablePrefix($_configuration, $courseDatabase = null)
+    {
+        $singleDatabase = isset($_configuration['single_database']) ? $_configuration['single_database'] : false;
+        $tablePrefix = isset($_configuration['table_prefix']) ? $_configuration['table_prefix'] : null;
+        $db_prefix = isset($_configuration['db_prefix']) ? $_configuration['db_prefix'] : null;
+
+        if ($singleDatabase) {
+            // the $courseDatabase already contains the $db_prefix;
+            $prefix = $tablePrefix.$courseDatabase.'_';
+        } else {
+            $prefix = $tablePrefix;
+        }
+
+        return $prefix;
+    }
+
+    /**
+     * @param $output
+     * @param string $chamiloLocationPath
+     * @param string $destinationPath
+     */
+    public function copyPackageIntoSystem($output, $chamiloLocationPath, $destinationPath)
+    {
+        $fileSystem = new Filesystem();
+
+        if (empty($destinationPath)) {
+            $destinationPath = $this->getRootSys();
+        }
+
+        $output->writeln("<comment>Copying files from </comment><info>$chamiloLocationPath</info><comment> to </comment><info>".$destinationPath."</info>");
+
+        if (empty($destinationPath)) {
+            $output->writeln("<error>The root path was not set.<error>");
+            return 0;
+        } else {
+            $fileSystem->mirror($chamiloLocationPath, $destinationPath, null, array('override' => true));
+            $output->writeln("<comment>Copy finished.<comment>");
+            return 1;
+        }
+    }
+
+    /**
+     * @param $output
+     * @param string $title
+     */
+    public function writeCommandHeader($output, $title)
+    {
+        $output->writeln('<comment>-----------------------------------------------</comment>');
+        $output->writeln('<comment>'.$title.'</comment>');
+        $output->writeln('<comment>-----------------------------------------------</comment>');
+    }
+
+    /**
+     * @param \Symfony\Component\Console\Output\OutputInterface $output
+     */
+    public function generateConfFiles(\Symfony\Component\Console\Output\OutputInterface $output)
+    {
+        $configList = array(
+            'portfolio.conf.dist.php',
+            'events.conf.dist.php',
+            'add_course.conf.dist.php',
+            'mail.conf.dist.php',
+            'auth.conf.dist.php',
+            'profile.conf.dist.php',
+        );
+
+        $confDir = $this->getConfigurationPath();
+
+        $fs = new Filesystem();
+
+        foreach ($configList as $file) {
+            if (file_exists($confDir.$file)) {
+                $newConfFile = $confDir.str_replace('dist.', '', $file);
+                if (!file_exists($newConfFile)) {
+                    $fs->copy($confDir.$file, $newConfFile);
+                    $output->writeln("<comment>File generated:</comment> <info>$newConfFile</info>");
+                }
+            }
+        }
+    }
+
+    /**
+     * @param \Symfony\Component\Console\Output\OutputInterface $output
+     * @param \Doctrine\DBAL\Connection $connection
+     */
+    public function setPortalSettingsInChamilo(\Symfony\Component\Console\Output\OutputInterface $output, \Doctrine\DBAL\Connection $connection)
+    {
+        $adminSettings = $this->getAdminSettings();
+
+        $connection->update('settings_current', array('selected_value' => $adminSettings['email']), array('variable' => 'emailAdministrator'));
+        $connection->update('settings_current', array('selected_value' => $adminSettings['lastname']), array('variable' => 'administratorSurname'));
+        $connection->update('settings_current', array('selected_value' => $adminSettings['firstname']), array('variable' => 'administratorName'));
+        $connection->update('settings_current', array('selected_value' => $adminSettings['language']), array('variable' => 'platformLanguage'));
+
+        $settings = $this->getPortalSettings();
+
+        $connection->update('settings_current', array('selected_value' => 1), array('variable' => 'allow_registration'));
+        $connection->update('settings_current', array('selected_value' => 1), array('variable' => 'allow_registration_as_teacher'));
+
+        $connection->update('settings_current', array('selected_value' => $settings['permissions_for_new_directories']), array('variable' => 'permissions_for_new_directories'));
+        $connection->update('settings_current', array('selected_value' => $settings['permissions_for_new_files']), array('variable' => 'permissions_for_new_files'));
+        $connection->update('settings_current', array('selected_value' => $settings['institution']), array('variable' => 'Institution'));
+        $connection->update('settings_current', array('selected_value' => $settings['institution_url']), array('variable' => 'InstitutionUrl'));
+        $connection->update('settings_current', array('selected_value' => $settings['sitename']), array('variable' => 'siteName'));
+    }
+
+    /**
+     * @param \Symfony\Component\Console\Output\OutputInterface $output
+     * @param \Doctrine\DBAL\Connection $connection
+     */
+    public function setAdminSettingsInChamilo(\Symfony\Component\Console\Output\OutputInterface $output, \Doctrine\DBAL\Connection $connection)
+    {
+        $settings = $this->getAdminSettings();
+
+        $settings['password'] = $this->getEncryptedPassword($settings['password']);
+
+        $connection->update('user', array('auth_source' => 'platform'), array('user_id' => '1'));
+
+        $connection->update('user', array('username' => $settings['username']), array('user_id' => '1'));
+        $connection->update('user', array('firstname' => $settings['firstname']), array('user_id' => '1'));
+        $connection->update('user', array('lastname' => $settings['lastname']), array('user_id' => '1'));
+        $connection->update('user', array('phone' => $settings['phone']), array('user_id' => '1'));
+
+        $connection->update('user', array('password' => $settings['password']), array('user_id' => '1'));
+        $connection->update('user', array('email' => $settings['email']), array('user_id' => '1'));
+        $connection->update('user', array('language' => $settings['language']), array('user_id' => '1'));
+
+        // Already updated by the script
+        //$connection->insert('admin', array('user_id' => 1));
+
+        $connection->update('user', array('language' => $settings['language']), array('user_id' => '2'));
+    }
+
+    /**
+     * Generates password.
+     *
+     * @param string $password
+     * @param string $salt
+     * @return string
+     */
+    public function getEncryptedPassword($password, $salt = null)
+    {
+        $configuration = $this->getConfigurationArray();
+        $encryptionMethod = $configuration['password_encryption'];
+
+        switch ($encryptionMethod) {
+            case 'sha1':
+                return empty($salt) ? sha1($password) : sha1($password.$salt);
+            case 'none':
+                return $password;
+            case 'md5':
+            default:
+                return empty($salt) ? md5($password)  : md5($password.$salt);
+        }
+    }
+}

+ 551 - 0
vendor/chamilo/chash/src/Chash/Command/Installation/InstallCommand.php

@@ -0,0 +1,551 @@
+<?php
+
+namespace Chash\Command\Installation;
+
+use Doctrine\Common\Annotations\AnnotationReader;
+use Doctrine\Common\Annotations\AnnotationRegistry;
+use Doctrine\DBAL\Migrations\Tools\Console\Command\AbstractCommand;
+use Symfony\Component\Console\Input\ArrayInput;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console;
+use Symfony\Component\Yaml\Dumper;
+
+/**
+ * Class InstallCommand
+ */
+class InstallCommand extends CommonCommand
+{
+    public $commandLine = true;
+    public $oldConfigLocation = false;
+
+    /**
+     * @return string
+     */
+    public function getLatestVersion()
+    {
+        return '1.10.0';
+    }
+
+    protected function configure()
+    {
+        $this
+            ->setName('chamilo:install')
+            ->setDescription('Execute a Chamilo installation to a specified version')
+            ->addArgument('version', InputArgument::REQUIRED, 'The version to migrate to.', null)
+            ->addArgument('path', InputArgument::OPTIONAL, 'The path to the chamilo folder')
+            ->addOption('download-package', null, InputOption::VALUE_NONE, 'Downloads the chamilo package')
+            ->addOption('temp-folder', null, InputOption::VALUE_OPTIONAL, 'The temp folder.', '/tmp')
+            ->addOption('linux-user', null, InputOption::VALUE_OPTIONAL, 'user', 'www-data')
+            ->addOption('linux-group', null, InputOption::VALUE_OPTIONAL, 'group', 'www-data')
+            ->addOption('silent', null, InputOption::VALUE_NONE, 'Execute the migration with out asking questions.');
+
+        $params = $this->getPortalSettingsParams();
+
+        foreach ($params as $key => $value) {
+            $this->addOption($key, null, InputOption::VALUE_OPTIONAL);
+        }
+
+        $params = $this->getAdminSettingsParams();
+        foreach ($params as $key => $value) {
+            $this->addOption($key, null, InputOption::VALUE_OPTIONAL);
+        }
+
+        $params = $this->getDatabaseSettingsParams();
+        foreach ($params as $key => $value) {
+            $this->addOption($key, null, InputOption::VALUE_OPTIONAL);
+        }
+
+    }
+
+    /**
+     * Executes a command via CLI
+     *
+     * @param Console\Input\InputInterface $input
+     * @param Console\Output\OutputInterface $output
+     *
+     * @return int|null|void
+     */
+    protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
+    {
+        if (PHP_SAPI != 'cli') {
+            $this->commandLine = false;
+        }
+
+        // Arguments
+        $path = $input->getArgument('path');
+        $version = $input->getArgument('version');
+
+        $silent = $input->getOption('silent') == true;
+        $download = $input->getOption('download-package');
+        $tempFolder = $input->getOption('temp-folder');
+
+        $linuxUser = $input->getOption('linux-user');
+        $linuxGroup = $input->getOption('linux-group');
+
+        $sqlFolder = $this->getInstallationPath($version);
+
+        if (!is_dir($sqlFolder)) {
+            $output->writeln("<comment>Sorry you can't install version '$version' of Chamilo :(</comment>");
+            $output->writeln("<comment>Supported versions:</comment> <info>".implode(', ', $this->getAvailableVersions()));
+            return 0;
+        }
+
+
+        if ($download) {
+            $chamiloLocationPath = $this->getPackage($output, $version, null, $tempFolder);
+            if (empty($chamiloLocationPath)) {
+                return 0;
+            }
+
+            $result = $this->copyPackageIntoSystem($output, $chamiloLocationPath, $path);
+            if ($result == 0) {
+                return 0;
+            }
+        }
+
+        // Setting configuration helper
+        $this->getApplication()->getHelperSet()->set(new \Chash\Helpers\ConfigurationHelper(), 'configuration');
+
+        // Getting the new config folder
+        $configurationPath = $this->getConfigurationHelper()->getNewConfigurationPath($path);
+
+        // @todo move this in the helper
+
+        if ($configurationPath == false) {
+            //  Seems an old installation!
+            $configurationPath = $this->getConfigurationHelper()->getConfigurationPath($path);
+            $this->setRootSys(realpath($configurationPath.'/../../../').'/');
+            $this->oldConfigLocation = true;
+        } else {
+            // Chamilo installations > 1.10
+            $this->oldConfigLocation = false;
+            $this->setRootSys(realpath($configurationPath.'/../').'/');
+        }
+
+        $this->setConfigurationPath($configurationPath);
+
+        $dialog = $this->getHelperSet()->get('dialog');
+
+        if ($this->commandLine) {
+            $title = "Welcome to the Chamilo installation process.";
+        } else {
+            $title = "Chamilo installation process.";
+        }
+
+        $this->writeCommandHeader($output, $title);
+
+        if (empty($configurationPath)) {
+            $output->writeln("<error>There's an error while loading the configuration path. Are you sure this is a Chamilo path?</error>");
+            $output->writeln("<comment>Try setting up a Chamilo path for example: </comment><info>chamilo:install 1.9.0 /var/www/chamilo</info>");
+
+            $output->writeln("<comment>You can also *download* a Chamilo package adding the --download-package option</comment><info>chamilo:install 1.9.0 /var/www/chamilo</info>");
+            return 0;
+        }
+
+        if (!is_writable($configurationPath)) {
+            $output->writeln("<error>Folder ".$configurationPath." must be writable</error>");
+            return 0;
+        } else {
+            $output->writeln("<comment>Configuration file will be saved here: </comment><info>".$configurationPath." </info>");
+        }
+
+        $configurationDistExists = false;
+
+        if (file_exists($this->getRootSys().'config/configuration.dist.php')) {
+            $configurationDistExists = true;
+        } else {
+            // Try the old one
+            if (file_exists($this->getRootSys().'main/install/configuration.dist.php')) {
+                $configurationDistExists = true;
+            }
+        }
+
+        if ($configurationDistExists == false) {
+            $output->writeln("<error>configuration.dist.php file nof found</error> <comment>The file must exists in install/configuration.dist.php or config/configuration.dist.php");
+            return 0;
+        }
+
+
+        if (file_exists($configurationPath.'configuration.php') || file_exists($configurationPath.'configuration.yml')) {
+            if ($this->commandLine) {
+                $output->writeln("<comment>There's a Chamilo portal here:</comment> <info>".$configurationPath."</info>");
+                $output->writeln("<comment>You should run <info>chamilo:wipe $path </info><comment>if you want to start with a fresh install.</comment>");
+                $output->writeln("<comment>You could also manually delete this file:</comment><info> sudo rm ".$configurationPath."configuration.php</info>");
+
+            } else {
+                $output->writeln("<comment>There's a Chamilo portal here:</comment> <info>".$configurationPath." </info>");
+            }
+            return 0;
+            /*
+            if (!$dialog->askConfirmation(
+                $output,
+                '<question>There is a Chamilo installation located here:</question> '.$configurationPath.' <question>Are you sure you want to continue?</question>(y/N)',
+                false
+            )
+            ) {
+                return 0;
+            }
+
+            if (!$dialog->askConfirmation(
+                $output,
+                '<comment>This will be a fresh installation. Old databases and config files will be deleted. </comment></info> <question>Are you sure?</question>(y/N)',
+                false
+            )
+            ) {
+                return 0;
+            }
+            $this->cleanInstallation($output);*/
+        }
+
+        $avoidVariables = array(
+            //'main_database', //default is chamilo
+            'db_glue',
+            'table_prefix',
+            'course_folder',
+            'db_admin_path',
+            'cdn_enable',
+            'verbose_backup',
+            'session_stored_in_db',
+            'session_lifetime',
+            'deny_delete_users',
+            'system_version',
+        );
+
+        if ($this->commandLine) {
+
+            // Ask for portal settings
+            $filledParams = $this->getParamsFromOptions($input, $this->getPortalSettingsParams());
+
+            $params = $this->getPortalSettingsParams();
+            $total = count($params);
+            $portalSettings = array();
+
+            $output->writeln("<comment>Portal settings (".$total.") </comment>");
+
+            $counter = 1;
+            foreach ($params as $key => $value) {
+                // If not in array ASK!
+                if (!isset($filledParams[$key])) {
+                    $data = $dialog->ask(
+                        $output,
+                        "($counter/$total) Please enter the value of the $key (".$value['attributes']['data']."): ",
+                        $value['attributes']['data']
+                    );
+                    $counter++;
+                    $portalSettings[$key] = $data;
+                } else {
+                    $output->writeln("($counter/$total) <comment>Option: $key = '".$filledParams[$key]."' was added as an option. </comment>");
+
+                    $portalSettings[$key] = $filledParams[$key];
+                    $counter++;
+                }
+            }
+            $this->setPortalSettings($portalSettings);
+
+            $filledParams = $this->getParamsFromOptions($input, $this->getAdminSettingsParams());
+
+            // Ask for admin settings
+            $params = $this->getAdminSettingsParams();
+            $total = count($params);
+            $output->writeln("<comment>Admin settings: (".$total.")</comment>");
+            $adminSettings = array();
+            $counter = 1;
+            foreach ($params as $key => $value) {
+                if (!isset($filledParams[$key])) {
+                    $data = $dialog->ask(
+                        $output,
+                        "($counter/$total) Please enter the value of the $key (".$value['attributes']['data']."): ",
+                        $value['attributes']['data']
+                    );
+                    $counter++;
+                    $adminSettings[$key] = $data;
+                } else {
+                    $output->writeln("($counter/$total) <comment>Option: $key = '".$filledParams[$key]."' was added as an option. </comment>");
+                    $counter++;
+                    $adminSettings[$key] = $filledParams[$key];
+                }
+            }
+            $this->setAdminSettings($adminSettings);
+
+            // Ask for db settings
+            $filledParams = $this->getParamsFromOptions($input, $this->getDatabaseSettingsParams());
+            $params = $this->getDatabaseSettingsParams();
+            $total = count($params);
+            $output->writeln("<comment>Database settings: (".$total.")</comment>");
+            $databaseSettings = array();
+            $counter = 1;
+            foreach ($params as $key => $value) {
+                if (!isset($filledParams[$key])) {
+                    $data = $dialog->ask(
+                        $output,
+                        "($counter/$total) Please enter the value of the $key (".$value['attributes']['data']."): ",
+                        $value['attributes']['data']
+                    );
+                    $counter++;
+                    $databaseSettings[$key] = $data;
+                } else {
+                    $output->writeln("($counter/$total) <comment>Option: $key = '".$filledParams[$key]."' was added as an option. </comment>");
+                    $counter++;
+                    $databaseSettings[$key] = $filledParams[$key];
+                }
+            }
+            $this->setDatabaseSettings($databaseSettings);
+        }
+
+        $databaseSettings = $this->getDatabaseSettings();
+        $connectionToHost = $this->getUserAccessConnectionToHost();
+
+        $connectionToHostConnect = $connectionToHost->connect();
+
+        if ($connectionToHostConnect) {
+            $output->writeln("<comment>Connection enabled for user: </comment><info>".$databaseSettings['user']);
+        } else {
+            $output->writeln("<error>No access to the database for user:</error><info>".$databaseSettings['user']."</info>");
+            return 0;
+        }
+
+        if ($this->commandLine) {
+            $eventManager = $connectionToHost->getSchemaManager();
+            $databases = $eventManager->listDatabases();
+            if (in_array($databaseSettings['dbname'], $databases)) {
+                if ($silent == false) {
+                    $dialog = $this->getHelperSet()->get('dialog');
+
+                    if (!$dialog->askConfirmation(
+                        $output,
+                        '<comment>The database <info>'.$databaseSettings['dbname'].'</info> exists and is going to be dropped!</comment> <question>Are you sure?</question>(y/N)',
+                        false
+                    )
+                    ) {
+                        return 0;
+                    }
+                }
+            }
+        }
+
+        // When installing always drop the current database
+        try {
+            $sm = $connectionToHost->getSchemaManager();
+            $sm->dropAndCreateDatabase($databaseSettings['dbname']);
+            $connectionToDatabase = $this->getUserAccessConnectionToDatabase();
+            $connect = $connectionToDatabase->connect();
+        } catch (\Exception $e) {
+            $output->writeln(sprintf('<error>Could not create database for connection named <comment>%s</comment></error>', $databaseSettings['dbname']));
+            $output->writeln(sprintf('<error>%s</error>', $e->getMessage()));
+            return 0;
+        }
+
+        if ($connect) {
+
+            $output->writeln("<comment>Connection to database '".$databaseSettings['dbname']."' established.</comment>");
+
+            $configurationWasSaved = $this->writeConfiguration($version, $path);
+
+            if ($configurationWasSaved) {
+
+                // $app['chamilo.log'] = $app['log.path'].'/chamilo_install.log';
+
+                // Installing database
+                $result = $this->install($version, $output);
+
+                if ($result) {
+                    // Injecting the chamilo application (because the configuration.php is now set)
+                    /*if (version_compare($version, '1.10.0', '>=')) {
+                        // This code is already manager by commands
+                        $app = require_once $this->getRootSys().'main/inc/global.inc.php';
+
+                        $app['session.test'] = true;
+
+                        if (isset($app['chamilo.filesystem'])) {
+                            $filesystem = $app['chamilo.filesystem'];
+
+                            // Creating temp folders
+                            //$filesystem->createFolders($app['temp.paths']->folders, null, octdec(trim($portalSettings['permissions_for_new_directories'])));
+                            //$output->writeln("<comment>Temp folders were created.</comment>");
+
+                            $app['installer']->setSettingsAfterInstallation($this->getAdminSettings(), $this->getPortalSettings());
+                        } else {
+                            // This is an old chamilo
+                            require_once $this->getRootSys().'main/inc/global.inc.php';
+                        }
+                    }*/
+
+                    // Read configuration file
+
+                    $configurationFile = $this->getConfigurationHelper()->getConfigurationFilePath($this->getRootSys());
+                    $configuration = $this->getConfigurationHelper()->readConfigurationFile($configurationFile);
+                    $this->setConfigurationArray($configuration);
+
+                    $this->setPortalSettingsInChamilo($output, $this->getHelper('db')->getConnection());
+                    $this->setAdminSettingsInChamilo($output, $this->getHelper('db')->getConnection());
+
+                    // Generating temp folders.
+                    $command = $this->getApplication()->find('files:generate_temp_folders');
+                    $arguments = array(
+                        'command' => 'files:generate_temp_folders',
+                        '--conf' => $this->getConfigurationHelper()->getConfigurationFilePath($path),
+                        //'--dry-run' => false
+                    );
+
+                    $input = new ArrayInput($arguments);
+                    $command->run($input, $output);
+
+                    // Fixing permissions.
+
+                    if (PHP_SAPI == 'cli') {
+                        $command = $this->getApplication()->find('files:set_permissions_after_install');
+                        $arguments = array(
+                            'command' => 'files:set_permissions_after_install',
+                            '--conf' => $this->getConfigurationHelper()->getConfigurationFilePath($path),
+                            '--linux-user' => $linuxUser,
+                            '--linux-group' => $linuxGroup
+                            //'--dry-run' => $dryRun
+                        );
+
+                        $input = new ArrayInput($arguments);
+                        $command->run($input, $output);
+                    }
+
+                    // Generating config files (auth, profile, etc)
+                    $this->generateConfFiles($output);
+
+                    $output->writeln("<comment>Chamilo was successfully installed here: ".$this->getRootSys()." </comment>");
+                    return 1;
+                } else {
+                    $output->writeln("<comment>There was an error during installation.</comment>");
+                    return 0;
+                }
+            } else {
+                $output->writeln("<comment>Configuration file was not saved</comment>");
+                return 0;
+            }
+        } else {
+            $output->writeln("<comment>Can't create database '".$databaseSettings['dbname']."' </comment>");
+            return 0;
+        }
+    }
+
+
+    /**
+     * Installation command
+     *
+     * @param string $version
+     * @param $output
+     * @return bool
+     */
+    public function install($version, $output)
+    {
+        $this->setDoctrineSettings();
+        $sqlFolder = $this->getInstallationPath($version);
+
+        $databaseMap = $this->getDatabaseMap();
+
+        if (isset($databaseMap[$version])) {
+            $dbInfo = $databaseMap[$version];
+            $sections = $dbInfo['section'];
+
+            foreach ($sections as $sectionData) {
+                foreach ($sectionData as $dbInfo) {
+                    $databaseName = $dbInfo['name'];
+                    $dbList = $dbInfo['sql'];
+
+                    $output->writeln("<comment>Creating database</comment> <info>$databaseName ... </info>");
+
+                    // Fixing db list
+                    foreach ($dbList as &$db) {
+                        $db = $sqlFolder.$db;
+                    }
+
+                    $command = $this->getApplication()->find('dbal:import');
+
+                    // Importing sql files.
+                    $arguments = array(
+                        'command' => 'dbal:import',
+                        'file' =>  $dbList
+                    );
+                    $input = new ArrayInput($arguments);
+                    $command->run($input, $output);
+
+                    // Getting extra information about the installation.
+                    $output->writeln("<comment>Database </comment><info>$databaseName </info><comment>process ended!</comment>");
+                }
+            }
+
+            if (isset($sections) && isset($sections['course'])) {
+                //@todo fix this
+                foreach ($sections['course'] as $courseInfo) {
+                    $databaseName = $courseInfo['name'];
+                    $output->writeln("Inserting course database in Chamilo: <info>$databaseName</info>");
+                    $this->createCourse($this->getHelper('db')->getConnection(), $databaseName);
+                }
+            }
+
+            if ($this->commandLine) {
+                $output->writeln("<comment>Check your installation status with </comment><info>chamilo:status</info>");
+            }
+
+            return true;
+        }
+
+        return false;
+    }
+
+     /**
+     *
+     * In step 3. Tests establishing connection to the database server.
+     * If it's a single database environment the function checks if the database exist.
+     * If the database doesn't exist we check the creation permissions.
+     *
+     * @return int      1 when there is no problem;
+     *                  0 when a new database is impossible to be created, then the single/multiple database configuration is impossible too
+     *                 -1 when there is no connection established.
+     */
+    public function testDatabaseConnection()
+    {
+        $conn = $this->testUserAccessConnection();
+        $connect = $conn->connect();
+        return $connect;
+    }
+
+    /**
+     * @return \Doctrine\DBAL\Connection
+     */
+    public function getUserAccessConnectionToHost()
+    {
+        $config = new \Doctrine\DBAL\Configuration();
+        $databaseConnection = $this->getDatabaseSettings();
+        $databaseConnection['dbname'] = null;
+        $conn = \Doctrine\DBAL\DriverManager::getConnection($databaseConnection, $config);
+        return $conn;
+    }
+
+    /**
+     * @return \Doctrine\DBAL\Connection
+     */
+    public function getUserAccessConnectionToDatabase()
+    {
+        $config = new \Doctrine\DBAL\Configuration();
+        $databaseConnection = $this->getDatabaseSettings();
+        $conn = \Doctrine\DBAL\DriverManager::getConnection($databaseConnection, $config);
+        return $conn;
+    }
+
+    /**
+     * Creates a course (only an insert in the DB)
+     *
+     * @param \Doctrine\DBAL\Connection
+     * @param string $databaseName
+     */
+    public function createCourse($connection, $databaseName)
+    {
+        $params = array(
+            'code' => $databaseName,
+            'db_name' => $databaseName,
+            'course_language' => 'english',
+            'title' => $databaseName,
+            'visual_code' => $databaseName
+        );
+        $connection->insert('course', $params);
+    }
+}

+ 109 - 0
vendor/chamilo/chash/src/Chash/Command/Installation/StatusCommand.php

@@ -0,0 +1,109 @@
+<?php
+
+namespace Chash\Command\Installation;
+
+use Doctrine\DBAL\Migrations\Tools\Console\Command\AbstractCommand;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console;
+
+/**
+ * Class StatusCommand
+ */
+class StatusCommand extends CommonCommand
+{
+    protected function configure()
+    {
+        $this
+            ->setName('chamilo:status')
+            ->setDescription('Show the information of the current Chamilo installation')
+            ->addOption('path', null, InputOption::VALUE_OPTIONAL, 'The path to the Chamilo folder');
+    }
+
+    /**
+     * Executes a command via CLI
+     *
+     * @param Console\Input\InputInterface $input
+     * @param Console\Output\OutputInterface $output
+     *
+     * @return int|null|void
+     */
+    protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
+    {
+        $path = $input->getOption('path');
+
+        $_configuration = $this->getConfigurationHelper()->getConfiguration($path);
+
+        if (empty($_configuration)) {
+            $output->writeln("<comment>Chamilo is not installed here! You may add a path as an option:</comment>");
+            $output->writeln("<comment>For example: </comment><info>chamilo:status --path=/var/www/chamilo</info>");
+            return 0;
+        }
+
+        $databaseSettings = array(
+            'driver' => 'pdo_mysql',
+            'host' => $_configuration['db_host'],
+            'dbname' => $_configuration['main_database'],
+            'user' => $_configuration['db_user'],
+            'password' => $_configuration['db_password'],
+        );
+
+        // single_database
+
+        $this->setDatabaseSettings($databaseSettings);
+        $this->setDoctrineSettings();
+
+        /** @var \Doctrine\DBAL\Connection $conn */
+        $conn = $this->getHelper('db')->getConnection();
+
+        $query = "SELECT selected_value FROM settings_current WHERE variable = 'chamilo_database_version'";
+        $data = $conn->executeQuery($query);
+        $data = $data->fetch();
+        $chamiloVersion = $data['selected_value'];
+        $databaseSetting = 'chamilo_database_version';
+
+        if (empty($chamiloVersion)) {
+            $query = "SELECT selected_value FROM settings_current WHERE variable = 'dokeos_database_version'";
+            $data = $conn->executeQuery($query);
+            $data = $data->fetch();
+            $chamiloVersion = $data['selected_value'];
+            $databaseSetting = 'dokeos_database_version';
+        }
+
+        $output->writeln('<comment>Chamilo $_configuration info:</comment>');
+        $output->writeln('');
+
+        $output->writeln('<comment>Chamilo $_configuration[root_web]:</comment> <info>'.$_configuration['root_web'].'</info>');
+        $output->writeln('<comment>Chamilo $_configuration[root_sys]:</comment> <info>'.$_configuration['root_sys'].'</info>');
+
+        //$output->writeln('<comment>Chamilo $_configuration[db_driver]:</comment> <info>'.$_configuration['db_driver'].'</info>');
+        $output->writeln('<comment>Chamilo $_configuration[main_database]:</comment> <info>'.$_configuration['main_database'].'</info>');
+        $output->writeln('<comment>Chamilo $_configuration[db_host]:</comment> <info>'.$_configuration['db_host'].'</info>');
+        $output->writeln('<comment>Chamilo $_configuration[db_user]:</comment> <info>'.$_configuration['db_user'].'</info>');
+        $output->writeln('<comment>Chamilo $_configuration[db_password]:</comment> <info>'.$_configuration['db_password'].'</info>');
+
+        $output->writeln('<comment>Chamilo $_configuration[single_database]:</comment> <info>'.$_configuration['single_database'].'</info>');
+        $output->writeln('<comment>Chamilo $_configuration[db_prefix]:</comment> <info>'.$_configuration['db_prefix'].'</info>');
+
+        $output->writeln('<comment>Chamilo $_configuration[db_glue]:</comment> <info>'.$_configuration['db_glue'].'</info>');
+        $output->writeln('<comment>Chamilo $_configuration[table_prefix]:</comment> <info>'.$_configuration['table_prefix'].'</info>');
+        $output->writeln('');
+
+        if (empty($chamiloVersion)) {
+            $output->writeln("<comment>Please check your Chamilo installation carefully the <info>'chamilo_database_version'</info> admin does not exists.</comment>");
+        } else {
+            $output->writeln('<comment>Chamilo database settings:</comment>');
+            $output->writeln("<comment>Chamilo setting_current['".$databaseSetting."']:</comment> <info>".$chamiloVersion."</info>");
+        }
+
+        if (!version_compare(substr($chamiloVersion, 0, 5), substr($_configuration['system_version'],0, 5), '==' )) {
+            $output->writeln("<error>Please check carefully your Chamilo installation. </error>");
+            $output->writeln("<comment>The configuration.php file and the 'chamilo_database_version' setting are not synced.</comment>");
+        } else {
+            //$output->writeln("<comment>You're ready for an upgrade.</comment>");
+        }
+
+        //$this->getConfigurationHelper()->
+    }
+
+}

+ 876 - 0
vendor/chamilo/chash/src/Chash/Command/Installation/UpgradeCommand.php

@@ -0,0 +1,876 @@
+<?php
+
+namespace Chash\Command\Installation;
+
+use Symfony\Component\Console\Input\ArrayInput;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console;
+use Symfony\Component\Filesystem\Filesystem;
+use Symfony\Component\Yaml\Dumper;
+use Symfony\Component\Yaml\Parser;
+
+// Constant needed in order to call migrate-db-* and update-files-*
+define('SYSTEM_INSTALLATION', 1);
+
+/**
+ * Class UpgradeCommand
+ */
+class UpgradeCommand extends CommonCommand
+{
+    public $queryList;
+    public $databaseList;
+
+    /**
+     * Get connection
+     * @return\Doctrine\DBAL\Connection
+     */
+    private function getConnection()
+    {
+        return $this->getHelper('db')->getConnection();
+    }
+
+    protected function configure()
+    {
+        $this
+            ->setName('chamilo:upgrade')
+            ->setDescription('Execute a chamilo migration to a specified version or the latest available version.')
+            ->addArgument('version', InputArgument::REQUIRED, 'The version to migrate to.', null)
+            ->addOption('path', null, InputOption::VALUE_OPTIONAL, 'The path to the chamilo folder')
+            ->addOption('dry-run', null, InputOption::VALUE_NONE, 'Execute the migration as a dry run.')
+            ->addOption('update-installation', null, InputOption::VALUE_OPTIONAL, 'Updates the portal with the current zip file. http:// or /var/www/file.zip')
+            ->addOption('temp-folder', null, InputOption::VALUE_OPTIONAL, 'The temp folder.', '/tmp')
+            ->addOption('silent', null, InputOption::VALUE_NONE, 'Execute the migration with out asking questions.');
+            //->addOption('force', null, InputOption::VALUE_NONE, 'Force the update. Only for tests');
+    }
+
+    /**
+     * Executes a command via CLI
+     *
+     * @param   Console\Input\InputInterface $input
+     * @param   Console\Output\OutputInterface $output
+     *
+     * @return int|null|void
+     */
+    protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
+    {
+        // Arguments and options
+        $version = $input->getArgument('version');
+        $path = $input->getOption('path');
+        $dryRun = $input->getOption('dry-run');
+        $silent = $input->getOption('silent') == true;
+        $tempFolder = $input->getOption('temp-folder');
+        $updateInstallation = $input->getOption('update-installation');
+
+        // Setting the configuration path and configuration array
+        $_configuration = $this->getConfigurationHelper()->getConfiguration($path);
+        $this->setConfigurationArray($_configuration);
+        $this->getConfigurationHelper()->setConfiguration($_configuration);
+        $this->setRootSysDependingConfigurationPath($path);
+
+        if (empty($_configuration)) {
+            $output->writeln("<comment>Chamilo is not installed here! You may add a path as an option:</comment>");
+            $output->writeln("<comment>For example: </comment><info>chamilo:upgrade 1.9.0 --path=/var/www/chamilo</info>");
+            return 0;
+        }
+
+        $configurationPath = $this->getHelper('configuration')->getConfigurationPath($path);
+
+        // Checking configuration file.
+        if (!is_writable($configurationPath)) {
+            $output->writeln("<comment>Folder ".$configurationPath." must have writable permissions</comment>");
+            return 0;
+        }
+
+        $this->setConfigurationPath($configurationPath);
+
+        // In order to use Doctrine migrations
+
+        // Setting configuration variable in order to get the doctrine version:
+        //$input->setOption('configuration', $this->getMigrationConfigurationFile());
+        //$configuration = $this->getMigrationConfiguration($input, $output);
+
+        // Doctrine migrations version
+        //$doctrineVersion = $configuration->getCurrentVersion();
+
+        $doctrineVersion = null;
+
+        // Getting supported version number list
+        $versionNameList = $this->getVersionNumberList();
+        $minVersion = $this->getMinVersionSupportedByInstall();
+        $versionList = $this->availableVersions();
+
+        // Checking version.
+        if (!in_array($version, $versionNameList)) {
+            $output->writeln("<comment>Version '$version' is not available.</comment>");
+            $output->writeln("<comment>Available versions: </comment><info>".implode(', ', $versionNameList)."</info>");
+            return 0;
+        }
+
+        $currentVersion = null;
+
+        // Checking system_version.
+
+        if (!isset($_configuration['system_version']) || empty($_configuration['system_version'])) {
+            $output->writeln("<comment>You have something wrong in your Chamilo installation. Check it with the chamilo:status command</comment>");
+            return 0;
+        }
+
+        if (version_compare($_configuration['system_version'], $minVersion, '<')) {
+            $output->writeln("<comment>Your Chamilo version is not supported! The minimun version is: </comment><info>$minVersion</info> <comment>You want to upgrade from <info>".$_configuration['system_version']."</info> <comment>to</comment> <info>$minVersion</info>");
+            return 0;
+        }
+
+        if (version_compare($version, $_configuration['system_version'], '>')) {
+            $currentVersion = $_configuration['system_version'];
+        } else {
+            $output->writeln("<comment>Please provide a version greater than </comment><info>".$_configuration['system_version']."</info> <comment>you selected version: </comment><info>$version</info>");
+            $output->writeln("<comment>You can also check your installation health with </comment><info>chamilo:status");
+            return 0;
+        }
+
+        $versionInfo = $this->getAvailableVersionInfo($version);
+
+        if (isset($versionInfo['hook_to_doctrine_version']) && isset($doctrineVersion)) {
+            if ($doctrineVersion == $versionInfo['hook_to_doctrine_version']) {
+                $output->writeln("<comment>You already have the latest version. Nothing to update! Doctrine version $doctrineVersion</comment>");
+                return 0;
+            }
+        }
+
+        if (isset($versionInfo['parent']) && !empty($versionInfo['parent'])) {
+            $versionInfoParent = $this->getAvailableVersionInfo($versionInfo['parent']);
+            if ($doctrineVersion == $versionInfoParent['hook_to_doctrine_version']) {
+                $output->writeln("<comment>You already have the latest version. Nothing to update! Doctrine version $doctrineVersion</comment>");
+                return 0;
+            }
+        }
+
+        //$updateInstallation = '/home/jmontoya/Downloads/chamilo-lms-CHAMILO_1_9_6_STABLE.zip';
+        //$updateInstallation = 'https://github.com/chamilo/chamilo-lms/archive/CHAMILO_1_9_6_STABLE.zip';
+
+        if ($dryRun == false) {
+            $chamiloLocationPath = $this->getPackage($output, $version, $updateInstallation, $tempFolder);
+            if (empty($chamiloLocationPath)) {
+                return;
+            }
+        }
+
+        $this->writeCommandHeader($output, 'Welcome to the Chamilo upgrade process!');
+
+        if ($dryRun == false) {
+            $output->writeln("<comment>When the installation process finished the files located here:</comment> <info>$chamiloLocationPath</info> <comment>will be copied in your portal here: </comment> <info>".$this->getRootSys()."</info>");
+        } else {
+            $output->writeln("<comment>When the installation process finished PHP files are not going to be updated (--dry-run is on).</comment>");
+        }
+
+        if ($silent == false) {
+            $dialog = $this->getHelperSet()->get('dialog');
+            if (!$dialog->askConfirmation(
+                $output,
+                '<question>Are you sure you want to upgrade the Chamilo located here?</question> <info>'.$_configuration['root_sys'].'</info> (y/N)',
+                false
+            )
+            ) {
+                return;
+            }
+
+            $dialog = $this->getHelperSet()->get('dialog');
+            if (!$dialog->askConfirmation(
+                $output,
+                '<question>Are you sure you want to upgrade from version</question> <info>'.$_configuration['system_version'].'</info> <comment>to version </comment><info>'.$version.'</info> (y/N)',
+                false
+            )
+            ) {
+                return;
+            }
+        }
+
+        $output->writeln('<comment>Migrating from Chamilo version: </comment><info>'.$_configuration['system_version'].'</info><comment> to version <info>'.$version);
+        $output->writeln('<comment>Starting upgrade for Chamilo, reading configuration file located here: </comment><info>'.$configurationPath.'configuration.php</info>');
+
+         // Getting configuration file.
+        $_configuration = $this->getHelper('configuration')->getConfiguration($path);
+
+        $databaseSettings = array(
+            'driver' => 'pdo_mysql',
+            'host' => $_configuration['db_host'],
+            'dbname' => $_configuration['main_database'],
+            'user' => $_configuration['db_user'],
+            'password' => $_configuration['db_password'],
+        );
+
+        // Setting DB access.
+        $this->setDatabaseSettings($databaseSettings);
+
+        $extraDatabaseSettings = array(
+            'single_database'=> isset($_configuration['single_database']) ? $_configuration['single_database'] : false,
+            'table_prefix'=> isset($_configuration['table_prefix']) ? $_configuration['table_prefix'] : null,
+            'db_glue' => isset($_configuration['db_glue']) ? $_configuration['db_glue'] : null,
+            'db_prefix' => isset($_configuration['db_prefix']) ? $_configuration['db_prefix'] : null,
+        );
+
+        $this->setExtraDatabaseSettings($extraDatabaseSettings);
+        $this->setDoctrineSettings();
+
+        $conn = $this->getConnection();
+
+        if ($conn) {
+            $output->writeln("<comment>Connection to the database established.</comment>");
+        } else {
+            $output->writeln("<comment>Can't connect to the DB with user:</comment><info>".$_configuration['db_user'])."</info>";
+            return 0;
+        }
+
+        $query = "SELECT * FROM course";
+        $result = $conn->executeQuery($query);
+        $courseList = $result->fetchAll();
+
+        $oldVersion = $currentVersion;
+        foreach ($versionList as $versionItem => $versionInfo) {
+            if (version_compare($versionItem, $currentVersion, '>') && version_compare($versionItem, $version, '<=')) {
+                $output->writeln("----------------------------------------------------------------");
+                $output->writeln("<comment>Starting migration from version: </comment><info>$oldVersion</info><comment> to </comment><info>$versionItem ");
+                $output->writeln("");
+
+                if (isset($versionInfo['require_update']) && $versionInfo['require_update'] == true) {
+                    // Greater than my current version.
+                    $this->startMigration($courseList, $path, $versionItem, $dryRun, $output);
+                    $oldVersion = $versionItem;
+                    $output->writeln("----------------------------------------------------------------");
+                } else {
+                    $output->writeln("<comment>Version <info>'$versionItem'</info> does not need a DB migration</comment>");
+                }
+            }
+        }
+
+        if ($dryRun == false) {
+            $this->copyPackageIntoSystem($output, $chamiloLocationPath, null);
+        }
+
+        $this->updateConfiguration($output, $dryRun, array('system_version' => $version));
+
+        //
+
+        $output->writeln("<comment>Wow! You just finish to migrate. Too check the current status of your platform. Run </comment><info>chamilo:status</info>");
+    }
+
+    /**
+     * Starts a migration
+     *
+     * @param array $courseList
+     * @param string $path
+     * @param string $toVersion
+     * @param bool $dryRun
+     * @param Console\Output\OutputInterface $output
+     *
+     * @return bool
+     */
+    public function startMigration($courseList, $path, $toVersion, $dryRun, Console\Output\OutputInterface $output)
+    {
+        // Cleaning query list.
+        $this->queryList = array();
+
+        // Main DB connection.
+        $conn = $this->getConnection();
+
+        $_configuration = $this->getHelper('configuration')->getConfiguration($path);
+
+        $versionInfo = $this->getAvailableVersionInfo($toVersion);
+        $installPath = $this->getInstallationFolder().$toVersion.'/';
+
+        // Filling sqlList array with "pre" db changes.
+        if (isset($versionInfo['pre']) && !empty($versionInfo['pre'])) {
+            $sqlToInstall = $installPath.$versionInfo['pre'];
+            $this->fillQueryList($sqlToInstall, $output, 'pre');
+
+            // Processing sql query list depending of the section (course, main, user).
+            $this->processQueryList($courseList, $output, $path, $toVersion, $dryRun, 'pre');
+        }
+
+        // Filling sqlList array with "post" db changes.
+        if (isset($versionInfo['post']) && !empty($versionInfo['post'])) {
+            $sqlToInstall = $installPath.$versionInfo['post'];
+            $this->fillQueryList($sqlToInstall, $output, 'post');
+            // Processing sql query list depending of the section.
+            $this->processQueryList($courseList, $output, $path, $toVersion, $dryRun, 'post');
+        }
+
+        // Processing "db" changes.
+        if (isset($versionInfo['update_db']) && !empty($versionInfo['update_db'])) {
+            $sqlToInstall = $installPath.$versionInfo['update_db'];
+            if (is_file($sqlToInstall) && file_exists($sqlToInstall)) {
+                if ($dryRun) {
+                    $output->writeln("<comment>File to be executed but not fired because of dry-run option: <info>'$sqlToInstall'</info>");
+                } else {
+                    $output->writeln("<comment>Executing update db: <info>'$sqlToInstall'</info>");
+                }
+                require $sqlToInstall;
+                $update($_configuration, $conn, $courseList, $dryRun, $output);
+            }
+        }
+
+        // Processing "update file" changes.
+        if (isset($versionInfo['update_files']) && !empty($versionInfo['update_files'])) {
+            $sqlToInstall = $installPath.$versionInfo['update_files'];
+            if (is_file($sqlToInstall) && file_exists($sqlToInstall)) {
+                if ($dryRun) {
+                    $output->writeln("<comment>Files to be executed but dry-run is on: <info>'$sqlToInstall'</info>");
+                } else {
+                    $output->writeln("<comment>Executing update files: <info>'$sqlToInstall'</info>");
+                    require $sqlToInstall;
+                    $updateFiles($_configuration, $conn, $courseList, $dryRun, $output);
+                }
+            }
+        }
+
+        if (1) {
+
+            $output->writeln('');
+            $output->writeln("<comment>You have to select yes for the 'Chamilo Migrations'<comment>");
+
+            $command = $this->getApplication()->find('migrations:migrate');
+            $arguments = array(
+                'command' => 'migrations:migrate',
+                'version' => $versionInfo['hook_to_doctrine_version'],
+                '--configuration' => $this->getMigrationConfigurationFile(),
+                '--dry-run' => $dryRun
+            );
+
+            $output->writeln("<comment>Executing migrations:migrate ".$versionInfo['hook_to_doctrine_version']." --configuration=".$this->getMigrationConfigurationFile()."<comment>");
+            $input = new ArrayInput($arguments);
+            $command->run($input, $output);
+            $output->writeln("<comment>Migration ended successfully</comment>");
+
+            // Generating temp folders.
+            $command = $this->getApplication()->find('files:generate_temp_folders');
+            $arguments = array(
+                'command' => 'files:generate_temp_folders',
+                '--conf' => $this->getConfigurationHelper()->getConfigurationFilePath($path),
+                '--dry-run' => $dryRun
+            );
+
+            $input = new ArrayInput($arguments);
+            $command->run($input, $output);
+
+            // Fixing permissions.
+            $command = $this->getApplication()->find('files:set_permissions_after_install');
+            $arguments = array(
+                'command' => 'files:set_permissions_after_install',
+                '--conf' => $this->getConfigurationHelper()->getConfigurationFilePath($path),
+                '--dry-run' => $dryRun
+            );
+
+            $input = new ArrayInput($arguments);
+            $command->run($input, $output);
+
+        }
+
+        return false;
+    }
+
+    /**
+     * @return array
+     */
+    public function getMigrationTypes()
+    {
+        return array(
+            'pre',
+            'post'
+        );
+    }
+
+    /**
+     *
+     * Process the queryList array and executes queries to the correct section (main, user, course, etc)
+     *
+     * @param $output
+     * @param $version
+     * @param $dryRun
+     * @return bool
+     * @throws \Exception
+     */
+    public function processQueryList($courseList, $output, $path, $version, $dryRun, $type)
+    {
+        $databases = $this->getDatabaseList($output, $courseList, $path, $version, $type);
+        $this->setConnections($version, $path, $databases);
+
+        foreach ($databases as $section => &$dbList) {
+            foreach ($dbList as &$dbInfo) {
+
+                $output->writeln("");
+                $output->writeln("<comment>Loading section:</comment> <info>$section</info> <comment>using database key </comment><info>".$dbInfo['database']."</info>");
+                $output->writeln("--------------------------");
+
+                if ($dbInfo['status'] == 'complete') {
+                    $output->writeln("<comment>Database already updated.</comment>");
+                    continue;
+                }
+
+                if (isset($this->queryList[$type]) &&
+                    isset($this->queryList[$type][$section]) &&
+                    !empty($this->queryList[$type][$section])
+                ) {
+                    $queryList = $this->queryList[$type][$section];
+
+                    try {
+                        $lines = 0;
+
+                        /** @var \Doctrine\DBAL\Connection $conn */
+                        $conn = $this->getHelper($dbInfo['database'])->getConnection();
+                        $output->writeln("<comment>Executing queries in DB:</comment> <info>".$conn->getDatabase()."</info>");
+                        $conn->beginTransaction();
+
+                        foreach ($queryList as $query) {
+                            // Add a prefix.
+
+                            if ($section == 'course') {
+                                var_dump($dbInfo);
+
+                                $query = str_replace('{prefix}', $dbInfo['prefix'], $query);
+                                var_dump($query);
+                                var_dump($conn->getParams());
+                            }
+
+                            if ($dryRun) {
+                                $output->writeln($query);
+                            } else {
+                                $output->writeln('     <comment>-></comment> ' . $query);
+                                $conn->executeQuery($query);
+                            }
+                            $lines++;
+                        }
+
+                        if (!$dryRun) {
+                            $conn->commit();
+                            $output->writeln(sprintf('%d statements executed!', $lines) . PHP_EOL);
+                            $dbInfo['status'] = 'complete';
+                            $this->saveDatabaseList($path, $databases, $version, $type);
+                        }
+                    } catch (\Exception $e) {
+                        if (!$dryRun) {
+                           $conn->rollback();
+                        }
+                        $output->write(sprintf('<error>Migration failed. Error %s</error>', $e->getMessage()));
+                        throw $e;
+                    }
+                } else {
+                    $output->writeln(sprintf("<comment>Nothing to execute for section $section!</comment>"));
+
+                    return false;
+                }
+            }
+
+        }
+        $this->queryList = array();
+
+        return true;
+    }
+
+    /**
+     *
+     * Reads a sql file and adds queries  in the queryList array.
+     *
+     * @param string $sqlFilePath
+     * @param $output
+     * @param string type
+     */
+    public function fillQueryList($sqlFilePath, $output, $type)
+    {
+        if (is_file($sqlFilePath) && file_exists($sqlFilePath)) {
+            $output->writeln(sprintf("Processing file type: $type '<info>%s</info>'... ", $sqlFilePath));
+            $sections = $this->getSections();
+
+            foreach ($sections as $section) {
+                $sqlList = $this->getSQLContents($sqlFilePath, $section);
+                $this->setQueryList($sqlList, $section, $type);
+            }
+        } else {
+            $output->writeln(sprintf("File does not exists: '<info>%s</info>'... ", $sqlFilePath));
+        }
+    }
+
+    /**
+     * Setting the queryList array
+     *
+     * @param array $queryList
+     * @param string $section
+     * @param string $type
+     */
+    public function setQueryList($queryList, $section, $type)
+    {
+        if (!isset($this->queryList[$type][$section])) {
+            $this->queryList[$type][$section] = $queryList;
+        } else {
+            $this->queryList[$type][$section] = array_merge($this->queryList[$type][$section], $queryList);
+        }
+    }
+
+    /**
+     * Returns sections
+     * @return array
+     */
+    public function getSections()
+    {
+        return array(
+            'main',
+            'user',
+            'stats',
+            'scorm',
+            'course'
+        );
+    }
+
+    /**
+     * Generates database array info
+     *
+     * @param array $courseList
+     * @return array
+     */
+    public function generateDatabaseList($courseList)
+    {
+        $courseDbList = array();
+
+        $_configuration = $this->getConfigurationArray();
+
+        if (!empty($courseList)) {
+            foreach ($courseList as $course) {
+                if (!empty($course['db_name'])) {
+                    $courseDbList[] = array(
+                        'database' => '_chamilo_course_'.$course['db_name'],
+                        'prefix' => $this->getTablePrefix($_configuration, $course['db_name']),
+                        'status' => 'waiting'
+                    );
+                }
+            }
+        } else {
+            $courseDbList = array(
+                array(
+                    'database'=> 'main_database',
+                    'status' => 'waiting',
+                    'prefix' => null
+                )
+            );
+
+        }
+
+        $databaseSection = array(
+            'main'  => array(
+                array(
+                    'database' => 'main_database',
+                    'status' => 'waiting'
+                )
+            ),
+            'user'  => array(
+                array(
+                    'database' => 'user_personal_database',
+                    'status' => 'waiting'
+                )
+            ),
+            'stats' => array(
+                array(
+                    'database' => 'statistics_database',
+                    'status' => 'waiting'
+                )
+            ),
+            'course'=> $courseDbList
+        );
+
+        $this->setDatabaseList($databaseSection);
+        return $this->databaseList;
+    }
+
+    /**
+     * Sets the database list
+     * @param $list
+     */
+    public function setDatabaseList($list)
+    {
+        $this->databaseList = $list;
+    }
+
+    /**
+     *
+     * @param string $path
+     * @param string $version
+     * @param string $type
+     *
+     * @return mixed|void
+     */
+    public function getDatabaseList($output, $courseList, $path, $version, $type)
+    {
+        $configurationPath = $this->getHelper('configuration')->getConfigurationPath($path);
+        $newConfigurationFile = $configurationPath.'db_migration_status_'.$version.'_'.$type.'.yml';
+
+        return $this->generateDatabaseList($courseList);
+
+        if (file_exists($newConfigurationFile)) {
+            $yaml = new Parser();
+            $output->writeln("<comment>Loading database list status from file:</comment> <info>$newConfigurationFile</info>");
+
+            return $yaml->parse(file_get_contents($newConfigurationFile));
+        } else {
+
+            return $this->generateDatabaseList($courseList);
+        }
+    }
+
+    /**
+     * @param string $path
+     * @param string $databaseSection
+     * @param string $version
+     * @param string $type
+     *
+     * @return bool
+     */
+    public function saveDatabaseList($path, $databaseSection, $version, $type)
+    {
+        $configurationPath = $this->getHelper('configuration')->getConfigurationPath($path);
+        $dumper = new Dumper();
+        $yaml = $dumper->dump($databaseSection, 2); //inline
+        $newConfigurationFile = $configurationPath.'db_migration_status_'.$version.'_'.$type.'.yml';
+        file_put_contents($newConfigurationFile, $yaml);
+
+        return file_exists($newConfigurationFile);
+    }
+
+    /**
+     *
+     * @param array $courseList
+     * @param string $path
+     * @param string $section
+     * @param string $version
+     * @param string $type
+     *
+     * @return mixed
+     */
+    public function getDatabasesPerSection($output, $courseList, $path, $section, $version, $type)
+    {
+        $databases = $this->getDatabaseList($output, $courseList, $path, $version, $type);
+        if (isset($databases[$section])) {
+            return $databases[$section];
+        }
+    }
+
+    /**
+     * Function originally wrote in install.lib.php
+     *
+     * @param string $file
+     * @param string $section
+     * @param bool $printErrors
+     *
+     * @return array|bool
+     */
+    public function getSQLContents($file, $section, $printErrors = true)
+    {
+        //check given parameters
+        if (empty($file)) {
+            $error = "Missing name of file to parse in get_sql_file_contents()";
+            if ($printErrors) {
+                echo $error;
+            }
+
+            return false;
+        }
+        if (!in_array($section, array('main', 'user', 'stats', 'scorm', 'course'))) {
+            $error = "Section '$section' is not authorized in getSQLContents()";
+            if ($printErrors) {
+                echo $error;
+            }
+
+            return false;
+        }
+        $filepath = $file;
+        if (!is_file($filepath) or !is_readable($filepath)) {
+            $error = "File $filepath not found or not readable in getSQLContents()";
+            if ($printErrors) {
+                echo $error;
+            }
+
+            return false;
+        }
+        //read the file in an array
+        // Empty lines should not be executed as SQL statements, because errors occur, see Task #2167.
+        $file_contents = file($filepath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
+        if (!is_array($file_contents) or count($file_contents) < 1) {
+            $error = "File $filepath looks empty in getSQLContents()";
+            if ($printErrors) {
+                echo $error;
+            }
+
+            return false;
+        }
+
+        //prepare the resulting array
+        $section_contents = array();
+        $record = false;
+        foreach ($file_contents as $index => $line) {
+            if (substr($line, 0, 2) == '--') {
+                //This is a comment. Check if section name, otherwise ignore
+                $result = array();
+                if (preg_match('/^-- xx([A-Z]*)xx/', $line, $result)) { //we got a section name here
+                    if ($result[1] == strtoupper($section)) {
+                        //we have the section we are looking for, start recording
+                        $record = true;
+                    } else {
+                        //we have another section's header. If we were recording, stop now and exit loop
+                        if ($record) {
+                            break;
+                        }
+                        $record = false;
+                    }
+                }
+            } else {
+                if ($record) {
+                    if (!empty($line)) {
+                        $section_contents[] = $line;
+                    }
+                }
+            }
+        }
+
+        // Now we have our section's SQL statements group ready, return
+
+        return $section_contents;
+    }
+
+
+    /**
+     * Executed only before createCourseTables()
+     */
+    public function dropCourseTables()
+    {
+        $list = $this->getCourseTables();
+        foreach ($list as $table) {
+            $sql = "DROP TABLE IF EXISTS ".DB_COURSE_PREFIX.$table;
+            //\Database::query($sql);
+        }
+    }
+
+    /**
+     * Creates the course tables with the prefix c_
+     * @param $output
+     * @param string $dryRun
+     */
+    public function createCourseTables($output, $dryRun)
+    {
+
+        if ($dryRun) {
+            $output->writeln("<comment>Creating c_* tables but dry-run is on. 0 tables created.</comment>");
+            return 0;
+        }
+
+        $output->writeln('<comment>Creating course tables (c_*)</comment>');
+
+        $command = $this->getApplication()->find('dbal:import');
+        $sqlFolder = $this->getInstallationPath('1.9.0');
+
+        //Importing sql files
+        $arguments = array(
+            'command' => 'dbal:import',
+            'file' =>  $sqlFolder.'db_course.sql'
+        );
+        $input = new ArrayInput($arguments);
+        $command->run($input, $output);
+    }
+
+    /**
+     * @return array
+     */
+    private function getCourseTables()
+    {
+        $tables = array();
+
+        $tables[]= 'tool';
+        $tables[]= 'tool_intro';
+        $tables[]= 'group_info';
+        $tables[]= 'group_category';
+        $tables[]= 'group_rel_user';
+        $tables[]= 'group_rel_tutor';
+        $tables[]= 'item_property';
+        $tables[]= 'userinfo_content';
+        $tables[]= 'userinfo_def';
+        $tables[]= 'course_description';
+        $tables[]= 'calendar_event';
+        $tables[]= 'calendar_event_repeat';
+        $tables[]= 'calendar_event_repeat_not';
+        $tables[]= 'calendar_event_attachment';
+        $tables[]= 'announcement';
+        $tables[]= 'announcement_attachment';
+        $tables[]= 'resource';
+        $tables[]= 'student_publication';
+        $tables[]= 'student_publication_assignment';
+        $tables[]= 'document';
+        $tables[]= 'forum_category';
+        $tables[]= 'forum_forum';
+        $tables[]= 'forum_thread';
+        $tables[]= 'forum_post';
+        $tables[]= 'forum_mailcue';
+        $tables[]= 'forum_attachment';
+        $tables[]= 'forum_notification';
+        $tables[]= 'forum_thread_qualify';
+        $tables[]= 'forum_thread_qualify_log';
+        $tables[]= 'link';
+        $tables[]= 'link_category';
+        $tables[]= 'online_connected';
+        $tables[]= 'online_link';
+        $tables[]= 'chat_connected';
+        $tables[]= 'quiz';
+        $tables[]= 'quiz_rel_question';
+        $tables[]= 'quiz_question';
+        $tables[]= 'quiz_answer';
+        $tables[]= 'quiz_question_option';
+        $tables[]= 'quiz_category';
+        $tables[]= 'quiz_question_rel_category';
+        $tables[]= 'dropbox_post';
+        $tables[]= 'dropbox_file';
+        $tables[]= 'dropbox_person';
+        $tables[]= 'dropbox_category';
+        $tables[]= 'dropbox_feedback';
+        $tables[]= 'lp';
+        $tables[]= 'lp_item';
+        $tables[]= 'lp_view';
+        $tables[]= 'lp_item_view';
+        $tables[]= 'lp_iv_interaction';
+        $tables[]= 'lp_iv_objective';
+        $tables[]= 'blog';
+        $tables[]= 'blog_comment';
+        $tables[]= 'blog_post';
+        $tables[]= 'blog_rating';
+        $tables[]= 'blog_rel_user';
+        $tables[]= 'blog_task';
+        $tables[]= 'blog_task_rel_user';
+        $tables[]= 'blog_attachment';
+        $tables[]= 'permission_group';
+        $tables[]= 'permission_user';
+        $tables[]= 'permission_task';
+        $tables[]= 'role';
+        $tables[]= 'role_group';
+        $tables[]= 'role_permissions';
+        $tables[]= 'role_user';
+        $tables[]= 'survey';
+        $tables[]= 'survey_question';
+        $tables[]= 'survey_question_option';
+        $tables[]= 'survey_invitation';
+        $tables[]= 'survey_answer';
+        $tables[]= 'survey_group';
+        $tables[]= 'wiki';
+        $tables[]= 'wiki_conf';
+        $tables[]= 'wiki_discuss';
+        $tables[]= 'wiki_mailcue';
+        $tables[]= 'course_setting';
+        $tables[]= 'glossary';
+        $tables[]= 'notebook';
+        $tables[]= 'attendance';
+        $tables[]= 'attendance_sheet';
+        $tables[]= 'attendance_calendar';
+        $tables[]= 'attendance_result';
+        $tables[]= 'attendance_sheet_log';
+        $tables[]= 'thematic';
+        $tables[]= 'thematic_plan';
+        $tables[]= 'thematic_advance';
+        $tables[]= 'metadata';
+        return $tables;
+    }
+}
+

+ 111 - 0
vendor/chamilo/chash/src/Chash/Command/Installation/WipeCommand.php

@@ -0,0 +1,111 @@
+<?php
+
+namespace Chash\Command\Installation;
+
+use Doctrine\DBAL\Migrations\Tools\Console\Command\AbstractCommand;
+use Symfony\Component\Console\Input\ArrayInput;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console;
+
+/**
+ * Class MigrationCommand
+ */
+class WipeCommand extends CommonCommand
+{
+    protected function configure()
+    {
+        $this
+            ->setName('chamilo:wipe')
+            ->setDescription('Prepares a portal for a new installation')
+            ->addArgument('path', InputArgument::OPTIONAL, 'The path to the Chamilo folder');
+    }
+
+
+    /**
+     * Executes a command via CLI
+     *
+     * @param Console\Input\InputInterface $input
+     * @param Console\Output\OutputInterface $output
+     *
+     * @return int|null|void
+     */
+    protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
+    {
+        // Arguments
+        $path = $input->getArgument('path');
+        $dialog = $this->getHelperSet()->get('dialog');
+
+        $configurationPath = $this->getConfigurationHelper()->getConfigurationPath($path);
+        $configurationFilePath = $this->getConfigurationHelper()->getConfigurationFilePath($path);
+
+        $this->writeCommandHeader($output, 'Wipe command.');
+
+        $output->writeln("<comment>This command will clean your Chamilo installation. Removing the database and courses.</comment>");
+
+        if ($configurationPath == false) {
+            $output->writeln("<comment>A Chamilo installation was not detected. You can add a path: </comment><info>chamilo:wipe /var/www/chamilo </info>");
+            return 0;
+        } else {
+
+            if (!$dialog->askConfirmation(
+                $output,
+                '<comment>A Chamilo configuration file was found here:</comment><info> '.$configurationPath.' </info> <question>Are you sure you want to continue?</question>(y/N)',
+                false
+            )
+            ) {
+                return 0;
+            }
+        }
+
+        // $this->setConfigurationPath($configurationPath);
+
+        $output->writeln("<comment>This command will clean your installation: drop db, removes config files, cache files.</comment>");
+
+        // Drop database Chash command.
+        $command = $this->getApplication()->find('db:drop_databases');
+
+        $arguments = array(
+            'command' => 'files:drop_databases',
+            '--conf' => $configurationFilePath
+        );
+
+        $inputDrop = new ArrayInput($arguments);
+        $command->run($inputDrop, $output);
+
+        // Clean temp Chash command
+        $command = $this->getApplication()->find('files:clean_temp_folder');
+
+        $arguments = array(
+            'command' => 'files:clean_temp_folder',
+            '--conf' => $configurationFilePath
+        );
+        $input = new ArrayInput($arguments);
+        $command->run($input, $output);
+
+        // Cleaning data files
+        $command = $this->getApplication()->find('files:clean_data_files');
+
+        $arguments = array(
+            'command' => 'files:clean_data_files',
+            '--conf' => $configurationFilePath
+        );
+        $input = new ArrayInput($arguments);
+        $command->run($input, $output);
+
+        // Cleaning config files (last one)
+
+        $command = $this->getApplication()->find('files:clean_config_files');
+        $arguments = array(
+            'command' => 'files:clean_config_files',
+            '--conf' => $configurationFilePath
+        );
+        $input = new ArrayInput($arguments);
+        $command->run($input, $output);
+
+
+
+
+    }
+}
+

+ 99 - 0
vendor/chamilo/chash/src/Chash/Command/Translation/AddSubLanguageCommand.php

@@ -0,0 +1,99 @@
+<?php
+/**
+ * Definition of command to
+ * add sub language
+ * Does not support multi-url yet
+ */
+/**
+ * Necessary namespaces definitions and usage
+ */
+namespace Chash\Command\Translation;
+
+use Chash\Command\Database\CommonChamiloDatabaseCommand;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Class AddSubLanguageCommand
+ * Definition of the translation:add_sub_language command
+ * @package Chash\Command\Translation
+ */
+class AddSubLanguageCommand extends CommonChamiloDatabaseCommand
+{
+    protected function configure()
+    {
+        parent::configure();
+        $this
+            ->setName('translation:add_sub_language')
+            ->setAliases(array('tasl'))
+            ->setDescription('Creates a sub-language')
+            ->addArgument(
+                'parent',
+                InputArgument::REQUIRED,
+                'The parent language (English name) for the new sub-language.'
+            )
+            ->addArgument(
+                'sublanguage',
+                InputArgument::REQUIRED,
+                'The English name for the new sub-language.'
+            );
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+        $_configuration = $this->getHelper('configuration')->getConfiguration();
+        $dbh = $this->getHelper('configuration')->getConnection();
+        $parent = mysql_real_escape_string($input->getArgument('parent'));
+        $lang = mysql_real_escape_string($input->getArgument('sublanguage'));
+        $ls = "SELECT english_name FROM language WHERE english_name = '$lang'";
+        $lq = mysql_query($ls);
+        if ($lq === false) {
+            $output->writeln('Error in query: '.mysql_error());
+            return null;
+        }
+        $num = mysql_num_rows($lq);
+        if ($num>0) {
+            $output->writeln($lang.' already exists in the database. Pick another English name.');
+            return null;
+        }
+        $ls = "SELECT id, original_name, english_name, isocode, dokeos_folder FROM language WHERE english_name = '$parent'";
+        $lq = mysql_query($ls);
+        if ($lq === false) {
+            $output->writeln('Error in query: '.mysql_error());
+            return null;
+        }
+        $num = mysql_num_rows($lq);
+        if ($num<1) {
+            $output->writeln('The parent language '.$parent.' does not exist. Please choose a valid parent.');
+            return null;
+        }
+        if (is_dir($_configuration['root_sys'].'main/lang/'.$lang)) {
+            $output->writeln('The destination directory ('.$_configuration['root_sys'].'main/lang/'.$lang.') already exists. Please choose another sub-language name.');
+            return null;
+        }
+        // Everything is OK so far, insert the sub-language
+        $lr = mysql_fetch_assoc($lq);
+        $is = "INSERT INTO language (original_name, english_name, isocode, dokeos_folder, available, parent_id) VALUES ('{$lr['original_name']}-2','$lang','{$lr['isocode']}','$lang',0,{$lr['id']})";
+        $iq = mysql_query($is);
+        if ($iq === false) {
+            $output->writeln('Error in query: '.mysql_error());
+        } else {
+            //permissions gathering, copied from main_api.lib.php::api_get_permissions_for_new_directories()
+            //require_once $_configuration['root_sys'].'main/inc/lib/main_api.lib.php';
+            //$perm = api_get_permissions_for_new_directories();
+            // @todo Improve permissions to force creating as user www-data
+            $r = @mkdir($_configuration['root_sys'].'main/lang/'.$lang, 0777);
+            $output->writeln('Sub-language '.$lang.' of language '.$parent.' has been created but is disabled. Fill it, then enable to make available to users. Make sure you check the permissions for the newly created directory as well ('.$_configuration['root_sys'].'main/lang/'.$lang.')');
+        }
+        return null;
+    }
+}

+ 77 - 0
vendor/chamilo/chash/src/Chash/Command/Translation/DisableLanguageCommand.php

@@ -0,0 +1,77 @@
+<?php
+/**
+ * Definition of command to
+ * disable a language
+ * Does not support multi-url yet
+ */
+/**
+ * Necessary namespaces definitions and usage
+ */
+namespace Chash\Command\Translation;
+
+use Chash\Command\Database\CommonChamiloDatabaseCommand;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Class DisableLanguageCommand
+ * Definition of the translation:disable command
+ * @package Chash\Command\Translation
+ */
+class DisableLanguageCommand extends CommonChamiloDatabaseCommand
+{
+    protected function configure()
+    {
+        parent::configure();
+        $this
+            ->setName('translation:disable')
+            ->setAliases(array('tdl'))
+            ->setDescription('Disables a (enabled) language')
+            ->addArgument(
+                'language',
+                InputArgument::REQUIRED,
+                'The English name for the language to disable.'
+            );
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+        $_configuration = $this->getHelper('configuration')->getConfiguration();
+        $dbh = $this->getHelper('configuration')->getConnection();
+        $lang = mysql_real_escape_string($input->getArgument('language'));
+        $ls = "SELECT id, english_name, available FROM language WHERE english_name = '$lang'";
+        $lq = mysql_query($ls);
+        if ($lq === false) {
+            $output->writeln('Error in query: '.mysql_error());
+            return null;
+        }
+        $num = mysql_num_rows($lq);
+        if ($num<1) {
+            $output->writeln($lang.' language not found in the database. Please make sure you use an existing language name.');
+            return null;
+        }
+        $lr = mysql_fetch_assoc($lq);
+        if ($lr['available'] == 0) {
+            $output->writeln($lang.' language is already disabled. Nothing to do.');
+            return null;
+        }
+        // Everything is OK so far, enable the language
+        $us = "UPDATE language SET available = 0 WHERE id = {$lr['id']}";
+        $uq = mysql_query($us);
+        if ($uq === false) {
+            $output->writeln('Error in query: '.mysql_error());
+        } else {
+            $output->writeln($lang . ' language has been disabled.');
+        }
+        return null;
+    }
+}

+ 80 - 0
vendor/chamilo/chash/src/Chash/Command/Translation/EnableLanguageCommand.php

@@ -0,0 +1,80 @@
+<?php
+/**
+ * Definition of command to
+ * enable a language
+ * Does not support multi-url yet
+ */
+/**
+ * Necessary namespaces definitions and usage
+ */
+namespace Chash\Command\Translation;
+
+use Chash\Command\Database\CommonChamiloDatabaseCommand;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Class EnableLanguageCommand
+ * Definition of the translation:enable command
+ * @package Chash\Command\Translation
+ */
+class EnableLanguageCommand extends CommonChamiloDatabaseCommand
+{
+    /**
+     *
+     */
+    protected function configure()
+    {
+        parent::configure();
+        $this
+            ->setName('translation:enable')
+            ->setAliases(array('tel'))
+            ->setDescription('Enables a (disabled) language')
+            ->addArgument(
+                'language',
+                InputArgument::REQUIRED,
+                'The English name for the language to enable.'
+            );
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+        $_configuration = $this->getHelper('configuration')->getConfiguration();
+        $dbh = $this->getHelper('configuration')->getConnection();
+        $lang = mysql_real_escape_string($input->getArgument('language'));
+        $ls = "SELECT id, english_name, available FROM language WHERE english_name = '$lang'";
+        $lq = mysql_query($ls);
+        if ($lq === false) {
+            $output->writeln('Error in query: '.mysql_error());
+            return null;
+        }
+        $num = mysql_num_rows($lq);
+        if ($num<1) {
+            $output->writeln($lang.' language not found in the database. Please make sure you use an existing language name.');
+            return null;
+        }
+        $lr = mysql_fetch_assoc($lq);
+        if ($lr['available'] == 1) {
+            $output->writeln($lang.' language is already enabled. Nothing to do.');
+            return null;
+        }
+        // Everything is OK so far, enable the language
+        $us = "UPDATE language SET available = 1 WHERE id = {$lr['id']}";
+        $uq = mysql_query($us);
+        if ($uq === false) {
+            $output->writeln('Error in query: '.mysql_error());
+        } else {
+            $output->writeln($lang . ' language has been enabled.');
+        }
+        return null;
+    }
+}

+ 119 - 0
vendor/chamilo/chash/src/Chash/Command/Translation/ExportLanguageCommand.php

@@ -0,0 +1,119 @@
+<?php
+
+namespace Chash\Command\Translation;
+
+use Chash\Command\Database\CommonChamiloDatabaseCommand;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Class ExportLanguageCommand
+ * @package Chash\Command\Translation
+ */
+class ExportLanguageCommand extends CommonChamiloDatabaseCommand
+{
+    /**
+     *
+     */
+    protected function configure()
+    {
+        parent::configure();
+        $this
+            ->setName('translation:export_language')
+            ->setDescription('Exports a Chamilo language package')
+            ->addArgument(
+                'language',
+                InputArgument::REQUIRED,
+                'Which language you want to export'
+            )
+            ->addOption(
+                'tmp',
+                null,
+                InputOption::VALUE_OPTIONAL,
+                'Allows you to specify in which temporary directory the backup files should be placed (optional, defaults to /tmp)'
+            );
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+
+        $language  = $input->getArgument('language');
+        $tmpFolder = $input->getOption('tmp');
+
+        $_configuration = $this->getHelper('configuration')->getConfiguration();
+
+        $connection = $this->getHelper('configuration')->getConnection();
+
+        if ($connection) {
+            $lang = isset($language) ? $language : null;
+
+            $lang = mysql_real_escape_string($lang);
+
+            $q        = mysql_query("SELECT * FROM language WHERE english_name = '$lang' ");
+            $langInfo = mysql_fetch_array($q, MYSQL_ASSOC);
+
+            if (!$langInfo) {
+
+                $output->writeln("<comment>Language '$lang' is not registered in the Chamilo Database</comment>");
+
+                $q = mysql_query("SELECT * FROM language WHERE parent_id IS NULL or parent_id = 0");
+                $output->writeln("<comment>Available languages are: </comment>");
+                while ($langRow = mysql_fetch_array($q, MYSQL_ASSOC)) {
+                    $output->write($langRow['english_name'].", ");
+                }
+                $output->writeln(' ');
+
+                $q = mysql_query("SELECT * FROM language WHERE parent_id <> 0");
+                $output->writeln("<comment>Available sub languages are: </comment>");
+                while ($langRow = mysql_fetch_array($q, MYSQL_ASSOC)) {
+                    $output->write($langRow['english_name'].", ");
+                }
+                $output->writeln(' ');
+                exit;
+            } else {
+                $output->writeln(
+                    "<comment>Language</comment> <info>'$lang'</info> <comment>is registered in the Chamilo installation with iso code: </comment><info>{$langInfo['isocode']} </info>"
+                );
+            }
+
+            $langFolder = $_configuration['root_sys'].'main/lang/'.$lang;
+
+            if (!is_dir($langFolder)) {
+                $output->writeln("<comment>Language '$lang' does not exist in the path: $langFolder</comment>");
+            }
+
+            if (empty($tmpFolder)) {
+                $tmpFolder = '/tmp/';
+                $output->writeln(
+                    "<comment>No temporary directory defined. Assuming /tmp/. Please make sure you have *enough space* left on that device"
+                );
+            }
+
+            if (!is_dir($tmpFolder)) {
+                $output->writeln(
+                    "<comment>Temporary directory: $tmpFolder is not a valid dir path, using /tmp/ </comment>"
+                );
+                $tmpFolder = '/tmp/';
+            }
+
+            if ($langInfo) {
+                $output->writeln("<comment>Creating translation package</comment>");
+                $fileName = $tmpFolder.$langInfo['english_name'].'.tar';
+                $phar     = new \PharData($fileName);
+                $phar->buildFromDirectory($langFolder);
+
+                $phar->setMetadata($langInfo);
+                $output->writeln("<comment>File created:</comment> <info>{$fileName}</info>");
+            }
+        }
+    }
+}

+ 147 - 0
vendor/chamilo/chash/src/Chash/Command/Translation/ImportLanguageCommand.php

@@ -0,0 +1,147 @@
+<?php
+
+namespace Chash\Command\Translation;
+
+use Chash\Command\Database\CommonChamiloDatabaseCommand;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Class ImportLanguageCommand
+ * @package Chash\Command\Translation
+ */
+class ImportLanguageCommand extends CommonChamiloDatabaseCommand
+{
+    /**
+     *
+     */
+    protected function configure()
+    {
+        parent::configure();
+        $this
+            ->setName('translation:import_language')
+            ->setDescription('Import a Chamilo language package')
+            ->addArgument(
+                'file',
+                InputArgument::REQUIRED,
+                'Path of the language package'
+            );
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+
+        $dialog = $this->getHelperSet()->get('dialog');
+
+        $_configuration = $this->getHelper('configuration')->getConfiguration();
+
+        $file = $input->getArgument('file');
+
+        $connection = $this->getHelper('configuration')->getConnection();
+
+        if (is_file($file) && is_readable($file)) {
+            $phar = new \PharData($file);
+            if ($phar->hasMetadata()) {
+                $langInfo = $phar->getMetadata();
+
+                $connection = $this->getHelper('configuration')->getConnection();
+                if ($connection) {
+                    $q              = mysql_query(
+                        "SELECT * FROM language WHERE dokeos_folder = '{$langInfo['dokeos_folder']}' "
+                    );
+                    $langInfoFromDB = mysql_fetch_array($q, MYSQL_ASSOC);
+                    $langFolderPath = $_configuration['root_sys'].'main/lang/'.$langInfoFromDB['dokeos_folder'];
+                    if ($langInfoFromDB && $langFolderPath) {
+                        //Overwrite lang files
+                        if (!$dialog->askConfirmation(
+                            $output,
+                            '<question>The '.$langInfo['original_name'].' language already exists in Chamilo. Did you want to overwrite the contents? (y/N)</question>',
+                            false
+                        )
+                        ) {
+                            return;
+                        }
+                        if (is_writable($langFolderPath)) {
+                            $output->writeln("Trying to save files here: $langFolderPath");
+                            $phar->extractTo($langFolderPath, null, true); // extract all files
+                            $output->writeln("Files were copied.");
+                        } else {
+                            $output->writeln(
+                                "<error>Make sure that this folder $langFolderPath has writable permissions or execute the script with sudo </error>"
+                            );
+                        }
+                    } else {
+                        //Check if parent_id exists
+                        $parentId = '';
+                        if (!empty($langInfo['parent_id'])) {
+                            $sql                = "select selected_value from settings_current where variable = 'allow_use_sub_language'";
+                            $result             = mysql_query($sql);
+                            $subLanguageSetting = mysql_fetch_array($result, MYSQL_ASSOC);
+                            $subLanguageSetting = $subLanguageSetting['selected_value'];
+                            if ($subLanguageSetting == 'true') {
+
+                                $q                    = mysql_query(
+                                    "SELECT * FROM language WHERE id = '{$langInfo['parent_id']}' "
+                                );
+                                $parentLangInfoFromDB = mysql_fetch_array($q, MYSQL_ASSOC);
+                                if ($parentLangInfoFromDB) {
+                                    $output->writeln(
+                                        "Setting parent language: ".$parentLangInfoFromDB['original_name']
+                                    );
+                                    $parentId = $langInfo['parent_id'];
+                                } else {
+                                    $output->writeln(
+                                        "The lang parent_id = {$langInfo['parent_id']} does not exist in Chamilo. Try to import first the parent language."
+                                    );
+                                    exit;
+                                }
+                            } else {
+                                $output->writeln(
+                                    "<comment>Please turn ON the sublanguage feature in this portal</comment>"
+                                );
+                                exit;
+                            }
+                        } else {
+                            $output->writeln("Parent language was not provided");
+                        }
+
+                        $q = mysql_query(
+                            "INSERT INTO language (original_name, english_name, isocode, dokeos_folder, available, parent_id) VALUES (
+                                '".$langInfo['original_name']."',
+                                '".$langInfo['english_name']."',
+                                '".$langInfo['isocode']."',
+                                '".$langInfo['dokeos_folder']."',
+                                '1',
+                                '".$parentId."')"
+                        );
+
+                        if ($q) {
+                            $output->writeln("Language inserted in the DB");
+                            $langFolderPath = $_configuration['root_sys'].'main/lang/'.$langInfo['dokeos_folder'];
+                            $phar->extractTo($langFolderPath, null, true); // extract all files
+                            $output->writeln("<comment>Files were copied here $langFolderPath </comment>");
+                        } else {
+                            $output->writeln("An error ocurred while tring to create the language");
+                        }
+
+                    }
+                }
+
+            } else {
+                $output->writeln("<comment>The file is not a valid Chamilo language package<comment>");
+            }
+        } else {
+            $output->writeln("<comment>The file located in '$file' is not accessible<comment>");
+        }
+
+    }
+}

+ 86 - 0
vendor/chamilo/chash/src/Chash/Command/Translation/ListLanguagesCommand.php

@@ -0,0 +1,86 @@
+<?php
+/**
+ * Definition of command to
+ * list platform languages
+ * Does not support multi-url yet
+ */
+/**
+ * Necessary namespaces definitions and usage
+ */
+namespace Chash\Command\Translation;
+
+use Chash\Command\Database\CommonChamiloDatabaseCommand;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Class ListLanguagesCommand
+ * Definition of the translation:list command
+ * @package Chash\Command\Translation
+ */
+class ListLanguagesCommand extends CommonChamiloDatabaseCommand
+{
+    protected function configure()
+    {
+        parent::configure();
+        $this
+            ->setName('translation:list')
+            ->setAliases(array('tl'))
+            ->setDescription('Gets all languages as a list')
+            ->addArgument(
+                'availability',
+                InputArgument::OPTIONAL,
+                'Filter the availability we want (0 for disabled, 1 for enabled, empty for all).'
+            );
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+        $_configuration = $this->getHelper('configuration')->getConfiguration();
+        $dbh = $this->getHelper('configuration')->getConnection();
+        $av = mysql_real_escape_string($input->getArgument('availability'));
+        $current = 'english';
+        $ls = "SELECT selected_value FROM settings_current WHERE variable='platformLanguage'";
+        $lq = mysql_query($ls);
+        if ($lq === false) {
+            $output->writeln('Error in query: '.mysql_error());
+            return null;
+        } else {
+            $lr = mysql_fetch_assoc($lq);
+            //$output->writeln('Current default language is: '.$lr['selected_value']);
+            $current = $lr['selected_value'];
+        }
+        $where = '';
+        if ($av === '0') {
+            $where = 'WHERE available = 0';
+        } elseif ($av === '1') {
+            $where = 'WHERE available = 1';
+        }
+        $ls = "SELECT english_name, available FROM language ".$where." ORDER BY english_name";
+        $lq = mysql_query($ls);
+        if ($lq === false) {
+            $output->writeln('Error in query: '.mysql_error());
+            return null;
+        } else {
+            $languages = array();
+            $output->writeln("Language          | Enabled | Platform language");
+            $output->writeln("-----------------------------------------------");
+            while ($lr = mysql_fetch_assoc($lq)) {
+                $pl = '';
+                $l = strlen($lr['english_name']);
+                if ($lr['english_name'] == $current) { $pl = '*'; }
+                $output->writeln($lr['english_name'].str_repeat(' ',18-$l)."| ".$lr['available']."       | ".$pl);
+            }
+        }
+        return null;
+    }
+}

+ 90 - 0
vendor/chamilo/chash/src/Chash/Command/Translation/PlatformLanguageCommand.php

@@ -0,0 +1,90 @@
+<?php
+/**
+ * Definition of command to
+ * change platform language
+ * Does not support multi-url yet
+ */
+/**
+ * Necessary namespaces definitions and usage
+ */
+namespace Chash\Command\Translation;
+
+use Chash\Command\Database\CommonChamiloDatabaseCommand;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Class PlatformLanguageCommand
+ * Definition of the translation:platform_language command
+ * @package Chash\Command\Translation
+ */
+class PlatformLanguageCommand extends CommonChamiloDatabaseCommand
+{
+    /**
+     *
+     */
+    protected function configure()
+    {
+        parent::configure();
+        $this
+            ->setName('translation:platform_language')
+            ->setAliases(array('tpl'))
+            ->setDescription('Gets or sets the platform language')
+            ->addArgument(
+                'language',
+                InputArgument::OPTIONAL,
+                'Which language you want to set (English name). Leave empty to get current language.'
+            );
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+        $_configuration = $this->getHelper('configuration')->getConfiguration();
+        $dbh = $this->getHelper('configuration')->getConnection();
+        $lang = mysql_real_escape_string($input->getArgument('language'));
+        if (empty($lang)) {
+            $ls = "SELECT selected_value FROM settings_current WHERE variable='platformLanguage'";
+            $lq = mysql_query($ls);
+            if ($lq === false) {
+                $output->writeln('Error in query: '.mysql_error());
+                return null;
+            } else {
+                $lr = mysql_fetch_assoc($lq);
+                $output->writeln('Current default language is: '.$lr['selected_value']);
+            }
+        } else {
+            $ls = "SELECT english_name FROM language ORDER BY english_name";
+            $lq = mysql_query($ls);
+            if ($lq === false) {
+                $output->writeln('Error in query: '.mysql_error());
+                return null;
+            } else {
+                $languages = array();
+                while ($lr = mysql_fetch_assoc($lq)) {
+                    $languages[] = $lr['english_name'];
+                }
+                if (!in_array($lang,$languages)) {
+                    $output->writeln($lang.' must be available on your platform before you can set it as default');
+                    return null;
+                }
+                $lu = "UPDATE settings_current set selected_value = '$lang' WHERE variable = 'platformLanguage'";
+                $lq = mysql_query($lu);
+                if ($lq === false) {
+                    $output->writeln('Error in query: '.mysql_error());
+                } else {
+                    $output->writeln('Language set to '.$lang);
+                }
+            }
+        }
+        return null;
+    }
+}

+ 79 - 0
vendor/chamilo/chash/src/Chash/Command/User/ChangePassCommand.php

@@ -0,0 +1,79 @@
+<?php
+
+namespace Chash\Command\User;
+
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+
+/**
+ * Command functions meant to deal with what the user of this script is calling
+ * it for.
+ */
+/**
+ * Class ChangePassCommand
+ * Changes a user password to the one given
+ * @package Chash\Command\User
+ */
+class ChangePassCommand extends CommonChamiloUserCommand
+{
+    protected function configure()
+    {
+        parent::configure();
+
+        $this
+            ->setName('user:change_pass')
+            ->setDescription('Updates the user password to the one given')
+            ->addArgument(
+                'username',
+                InputArgument::REQUIRED,
+                'Allows you to specify the username'
+            )
+            ->addArgument(
+                'password',
+                InputArgument::REQUIRED,
+                'The new password to give this user'
+            );
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+        $_configuration = $this->getHelper('configuration')->getConfiguration();
+        $dbh = $this->getHelper('configuration')->getConnection();
+        $username = $input->getArgument('username');
+        $password = $input->getArgument('password');
+        $us = "SELECT * FROM user WHERE username = '".mysql_real_escape_string($username)."'";
+        $uq = mysql_query($us);
+        $un = mysql_num_rows($uq);
+        if ($un >= 1) {
+            $enc = $_configuration['password_encryption'];
+            switch ($enc) {
+                case 'sha1':
+                    $password = sha1($password);
+                    break;
+                case 'md5':
+                    $password = md5($password);
+                    break;
+                default:
+                    $password = mysql_real_escape_string($password);
+                    break;
+            }
+            $user = mysql_fetch_assoc($uq);
+            $ups = "UPDATE user SET password = '$password' WHERE user_id = ".$user['user_id'];
+            $upq = mysql_query($ups);
+            $output->writeln('User '.$username.' has new password.');
+        } else {
+            $output->writeln('Could not find user '.$username);
+        }
+        return null;
+    }
+}

+ 43 - 0
vendor/chamilo/chash/src/Chash/Command/User/CommonChamiloUserCommand.php

@@ -0,0 +1,43 @@
+<?php
+
+namespace Chash\Command\User;
+
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+use Symfony\Component\Console\Formatter\OutputFormatterStyle;
+
+/**
+ * Class CommonChamiloUserCommand
+ * @package Chash\Command\User
+ */
+class CommonChamiloUserCommand extends Command
+{
+    /**
+     *
+     */
+    protected function configure()
+    {
+        $this
+            ->addOption(
+                'conf',
+                null,
+                InputOption::VALUE_NONE,
+                'Set a configuration file'
+            );
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        $configuration = $input->getOption('conf');
+        $this->getHelper('configuration')->readConfigurationFile($configuration);
+    }
+}

+ 59 - 0
vendor/chamilo/chash/src/Chash/Command/User/DisableAdminsCommand.php

@@ -0,0 +1,59 @@
+<?php
+
+namespace Chash\Command\User;
+
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Class DisableAdminsCommand
+ * Remove the "admin" role from *ALL* users on all portals of this instance
+ * @package Chash\Command\User
+ */
+class DisableAdminsCommand extends CommonChamiloUserCommand
+{
+    /**
+     *
+     */
+    protected function configure()
+    {
+        parent::configure();
+
+        $this
+            ->setName('user:disable_admins')
+            ->setDescription('Makes the given user admin on the main portal');
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+        $_configuration = $this->getHelper('configuration')->getConfiguration();
+        $dbh = $this->getHelper('configuration')->getConnection();
+        $dialog = $this->getHelperSet()->get('dialog');
+        if (!$dialog->askConfirmation(
+            $output,
+            '<question>This action will make all admins normal teachers. Are you sure? (y/N)</question>',
+            false
+        )
+        ) {
+            return;
+        }
+
+        $us = "DELETE FROM admin";
+        $uq = mysql_query($us);
+        if ($uq === false) {
+            $output->writeln('Could not delete admins.');
+        } else {
+            $output->writeln('All admins disabled.');
+        }
+        return null;
+    }
+}

+ 66 - 0
vendor/chamilo/chash/src/Chash/Command/User/MakeAdminCommand.php

@@ -0,0 +1,66 @@
+<?php
+
+namespace Chash\Command\User;
+
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+
+/**
+ * Command functions meant to deal with what the user of this script is calling
+ * it for.
+ */
+/**
+ * Makes the given user an admin on the main portal
+ */
+class MakeAdminCommand extends CommonChamiloUserCommand
+{
+    protected function configure()
+    {
+        parent::configure();
+
+        $this
+            ->setName('user:make_admin')
+            ->setDescription('Makes the given user admin on the main portal')
+            ->addArgument(
+                'username', 
+                InputArgument::REQUIRED,
+                'Allows you to specify a username to make admin'
+            );
+    }
+
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+        $_configuration = $this->getHelper('configuration')->getConfiguration();
+        $dbh = $this->getHelper('configuration')->getConnection();
+        $username = $input->getArgument('username');
+        $us = "SELECT * FROM user WHERE username = '".mysql_real_escape_string($username)."'";
+        $uq = mysql_query($us);
+        $un = mysql_num_rows($uq);
+        if ($un >= 1) {
+            $user = mysql_fetch_assoc($uq);
+            $as = "SELECT * FROM admin WHERE user_id = ".$user['user_id'];
+            $aq = mysql_query($as);
+            $an = mysql_num_rows($aq);
+            if ($an < 1) {
+                //$output->writeln('User '.$username.' is not an admin. Making him one.');
+                $ms = "INSERT INTO admin (user_id) VALUES (".$user['user_id'].")";
+                $mq = mysql_query($ms);
+                if ($mq === false) {
+                    $output->writeln('Error making '.$username.' an admin.');
+                } else {
+                    $output->writeln('User '.$username.' is now an admin.');
+                }
+            } else {
+                $output->writeln('User '.$username.' is alreay an admin.');
+            }
+        } else {
+            $output->writeln('Could not find user '.$username);
+        }
+        return null;
+    }
+}

+ 62 - 0
vendor/chamilo/chash/src/Chash/Command/User/ResetLoginCommand.php

@@ -0,0 +1,62 @@
+<?php
+
+namespace Chash\Command\User;
+
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+
+/**
+ * Command functions meant to deal with what the user of this script is calling
+ * it for.
+ */
+/**
+ * Class ResetLoginCommand
+ * Returns a password reset link for the given username (user will receive
+ * an e-mail with new login + password)
+ * @package Chash\Command\User
+ */
+class ResetLoginCommand extends CommonChamiloUserCommand
+{
+    protected function configure()
+    {
+        parent::configure();
+
+        $this
+            ->setName('user:reset_login')
+            ->setDescription('Outputs login link for given username')
+            ->addArgument(
+                'username',
+                InputArgument::REQUIRED,
+                'Allows you to specify a username to login as'
+            );
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+        $_configuration = $this->getHelper('configuration')->getConfiguration();
+        $dbh = $this->getHelper('configuration')->getConnection();
+        $username = $input->getArgument('username');
+        $us = "SELECT * FROM user WHERE username = '".mysql_real_escape_string($username)."'";
+        $uq = mysql_query($us);
+        $un = mysql_num_rows($uq);
+        if ($un >= 1) {
+            $user = mysql_fetch_assoc($uq);
+            $link = $_configuration['root_web'].'main/auth/lostPassword.php?reset='.md5($_configuration['security_key'].$user['email']).'&id='.$user['user_id'];
+            $output->writeln('Follow this link to login as '.$username);
+            $output->writeln($link);
+        } else {
+            $output->writeln('Could not find user '.$username);
+        }
+        return null;
+    }
+}

+ 89 - 0
vendor/chamilo/chash/src/Chash/Command/User/SetLanguageCommand.php

@@ -0,0 +1,89 @@
+<?php
+/**
+ * Command functions meant to deal with what the user of this script is calling
+ * it for.
+ */
+/**
+ * Namespaces
+ */
+namespace Chash\Command\User;
+
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Class SetLanguageCommand
+ * Changes the language for all platform users
+ * @package Chash\Command\User
+ */
+class SetLanguageCommand extends CommonChamiloUserCommand
+{
+    protected function configure()
+    {
+        parent::configure();
+
+        $this
+            ->setName('user:set_language')
+            ->setAliases(array('usl'))
+            ->setDescription('Sets the users language to the one given')
+            ->addArgument(
+                'language',
+                InputArgument::OPTIONAL,
+                'The English name for the new language to set all users to'
+            );
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int|null|void
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        parent::execute($input, $output);
+        $_configuration = $this->getHelper('configuration')->getConfiguration();
+        $dbh = $this->getHelper('configuration')->getConnection();
+        $lang = mysql_real_escape_string($input->getArgument('language'));
+        if (empty($lang)) {
+            $ls = "SELECT DISTINCT language, count(*) as num FROM user GROUP BY 1 ORDER BY language";
+            $lq = mysql_query($ls);
+            if ($lq === false) {
+                $output->writeln('Error in query: '.mysql_error());
+                return null;
+            } else {
+                $output->writeln("Language\t| Number of users");
+                while ($lr = mysql_fetch_assoc($lq)) {
+                    $output->writeln($lr['language']."\t\t| ".$lr['num']);
+                }
+            }
+        } else {
+            // Check available languages
+            $ls = "SELECT english_name FROM language ORDER BY english_name";
+            $lq = mysql_query($ls);
+            if ($lq === false) {
+                $output->writeln('Error in query: '.mysql_error());
+                return null;
+            } else {
+                $languages = array();
+                while ($lr = mysql_fetch_assoc($lq)) {
+                    $languages[] = $lr['english_name'];
+                }
+                if (!in_array($lang,$languages)) {
+                    $output->writeln($lang.' must be available on your platform before you can use it');
+                    return null;
+                }
+                $lu = "UPDATE user SET language = '$lang'";
+                $lq = mysql_query($lu);
+                if ($lq === false) {
+                    $output->writeln('Error in query: '.mysql_error());
+                } else {
+                    $output->writeln('Language set to '.$lang.' for all users');
+                }
+            }
+        }
+        return null;
+    }
+}

+ 29 - 0
vendor/chamilo/chash/src/Chash/DoctrineExtensions/TablePrefix.php

@@ -0,0 +1,29 @@
+<?php
+
+namespace Chash\DoctrineExtensions;
+
+use \Doctrine\ORM\Event\LoadClassMetadataEventArgs;
+
+class TablePrefix
+{
+    protected $prefix = '';
+
+    public function __construct($prefix)
+    {
+        $this->prefix = (string) $prefix;
+    }
+
+    public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
+    {
+        $classMetadata = $eventArgs->getClassMetadata();
+        $classMetadata->setTableName($this->prefix.$classMetadata->getTableName());
+
+        foreach ($classMetadata->getAssociationMappings() as $fieldName => $mapping) {
+            if ($mapping['type'] == \Doctrine\ORM\Mapping\ClassMetadataInfo::MANY_TO_MANY) {
+                $mappedTableName = $classMetadata->associationMappings[$fieldName]['joinTable']['name'];
+                $classMetadata->associationMappings[$fieldName]['joinTable']['name'] = $this->prefix.$mappedTableName;
+            }
+        }
+    }
+
+}

+ 545 - 0
vendor/chamilo/chash/src/Chash/Helpers/ConfigurationHelper.php

@@ -0,0 +1,545 @@
+<?php
+
+namespace Chash\Helpers;
+
+use Symfony\Component\Console\Helper\Helper;
+use Symfony\Component\Yaml\Parser;
+use Symfony\Component\Finder\Finder;
+
+/**
+ * Class ConfigurationHelper
+ * @package Chash\Helpers
+ */
+class ConfigurationHelper extends Helper
+{
+    protected $configuration;
+    protected $sysPath;
+    protected $dryRun = false;
+
+    /**
+     *
+     */
+    public function __construct()
+    {
+
+    }
+
+    public function getDryRun()
+    {
+        return $this->dryRun;
+    }
+
+    public function setDryRun($dryRun)
+    {
+        $this->dryRun = $dryRun;
+    }
+
+    /**
+     * Get chamilo versions
+     * @return array
+     */
+    public function chamiloVersions()
+    {
+        $versionList = array(
+            '1.8.7',
+            '1.8.8',
+            '1.8.8.2',
+            '1.8.8.4',
+            '1.8.8.6',
+            '1.9.0',
+            '1.9.2',
+            '1.9.4',
+            '1.9.6',
+            '1.9.8',
+            '1.10.0'
+        );
+
+        return $versionList;
+    }
+
+    /**
+     * Gets the configuration file path from the Chamilo installation
+     * <code>
+     * $configurationPath = $this->getConfigurationPath('/var/www/chamilo');
+     * // $configurationPath value is '/var/www/chamilo/config/'; or
+     * // $configurationPath value is '/var/www/chamilo/inc/conf/'; or
+     * </code>
+     * @param string $path the path of the Chamilo installation
+     * @return bool|string @example /var/www/chamilo/config/configuration.php
+     */
+    public function getConfigurationPath($path = null)
+    {
+        if (empty($path)) {
+            $chamiloPath = getcwd();
+        } else {
+            $chamiloPath = $path;
+        }
+        if (is_dir($chamiloPath.'/main/inc/conf')) {
+            return realpath($chamiloPath.'/main/inc/conf/').'/';
+        }
+
+        if (is_dir($chamiloPath.'/config')) {
+            return realpath($chamiloPath.'/config/').'/';
+        }
+
+        return false;
+    }
+
+    /**
+     * Get the new configuration file from the Chamilo installation
+     * <code>
+     * $newConfigurationPath = $this->getNewConfigurationPath('/var/www/chamilo');
+     * // $newConfigurationPath value is '/var/www/chamilo/config/configuration.php';
+     * </code>
+     * @param string $path the path of the Chamilo installation
+     * @return bool|string  @example /var/www/chamilo/config/configuration.php
+     */
+    public function getNewConfigurationPath($path = null)
+    {
+        if (empty($path)) {
+            $chamiloPath = getcwd();
+        } else {
+            $chamiloPath = $path;
+        }
+
+        if (is_dir($chamiloPath.'/config/')) {
+            return $dir = realpath($chamiloPath.'/config/').'/';
+        }
+
+        return false;
+    }
+
+    /**
+     * Gets the configuration file path
+     * <code>
+     * $configurationPath = $this->getConfigurationFilePath('/var/www/chamilo')
+     * // $configurationPath value is '/var/www/chamilo/config/configuration.php'; or
+     * // $configurationPath value is '/var/www/chamilo/main/inc/conf/configuration.php';
+     * </code>
+     * @param string $path the path of the Chamilo installation
+     * @return bool|string returns
+     *
+     */
+    public function getConfigurationFilePath($path = null)
+    {
+        $confPath = $this->getConfigurationPath($path);
+
+        if (!empty($confPath)) {
+
+            if (file_exists($confPath.'configuration.php')) {
+                return $confPath.'configuration.php';
+            }
+
+            if (file_exists($confPath.'configuration.yml')) {
+                return $confPath.'configuration.yml';
+            }
+        }
+
+        return false;
+    }
+
+
+    /**
+     * Returns the $configuration array
+     * <code>
+     * $configuration = $this->getConfiguration('/var/www/chamilo');
+     * // $configuration contains the $_configuration array
+     * </code>
+     * @param string $path
+     *
+     * @return array|bool|mixed
+     */
+    public function getConfiguration($path = null)
+    {
+        if (empty($this->configuration)) {
+            $configurationFile = $this->getConfigurationFilePath($path);
+            if ($configurationFile) {
+                $this->configuration = $this->readConfigurationFile($configurationFile);
+            }
+        }
+        return $this->configuration;
+    }
+
+    /**
+     *
+     * <code>
+     * $sysPath = $this->getSysPathFromConfigurationFile('/var/www/chamilo/config/configuration.php');
+     * // $sysPath is '/var/www/chamilo/'
+     * </code>
+     * @param string $configurationFile
+     * @return string
+     */
+    public function getSysPathFromConfigurationFile($configurationFile)
+    {
+        if (empty($configurationFile)) {
+            return false;
+        }
+
+        $configurationPath = dirname($configurationFile);
+
+        // New structure
+        if (file_exists($configurationPath.'/../main/inc/global.inc.php')) {
+            return realpath($configurationPath.'/../').'/';
+        }
+
+        // Old structure
+        if (file_exists($configurationPath.'/../../inc/global.inc.php')) {
+            return realpath($configurationPath.'/../../../').'/';
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Reads the Chamilo configuration file and returns the $_configuration array
+     * Merges the configuration.php with the configuration.yml if it exists
+     *
+     * @param string $configurationFile
+     * @return array|bool|mixed
+     */
+    public function readConfigurationFile($configurationFile = null)
+    {
+        if (!empty($configurationFile)) {
+
+            if (file_exists($configurationFile)) {
+                $confInfo = pathinfo($configurationFile);
+                switch ($confInfo['extension']) {
+                    case 'php':
+                        require $configurationFile;
+                        if (isset($_configuration)) {
+                            if (isset($userPasswordCrypted)) {
+                                $_configuration['password_encryption'] = $userPasswordCrypted;
+                            }
+                            return $_configuration;
+                        }
+                        break;
+                    case 'yml':
+                        $yaml = new Parser();
+                        $_configurationYML = $yaml->parse(file_get_contents($configurationFile));
+                        if (isset($configurationFile) && !empty($configurationFile)) {
+                            if (isset($_configuration) && !empty($_configuration)) {
+                                $_configuration = array_merge($_configuration, $_configurationYML);
+                            } else {
+                                $_configuration = $_configurationYML;
+                            }
+                        }
+                        return $_configuration;
+                        break;
+                }
+            }
+        }
+        return array();
+    }
+
+    /**
+     * Sets the configuration variable
+     * @param $configuration
+     */
+    public function setConfiguration($configuration)
+    {
+        $this->configuration = $configuration;
+    }
+
+    /**
+     * Get chamilo config files
+     * @return array
+     */
+    public function getConfigFiles()
+    {
+        $finder = new Finder();
+        $sysPath = $this->getSysPath();
+
+        $configFiles = array(
+            'auth.conf.php',
+            'configuration.php',
+            'configuration.yml',
+            'events.conf.php',
+            'mail.conf.php',
+            'portfolio.conf.php',
+            'profile.conf.php'
+        );
+
+        if (is_dir($sysPath.'main/inc/conf')) {
+            $finder->files()->in($sysPath.'main/inc/conf');
+            foreach ($configFiles as $config) {
+                if (file_exists($sysPath.'main/inc/conf/'.$config)) {
+                    $finder->files()->name($config);
+                }
+            }
+            $finder->files()->name('db_migration_status_*');
+        }
+
+        if (is_dir($sysPath.'config')) {
+            $finder->files()->in($sysPath.'config');
+            foreach ($configFiles as $config) {
+                if (file_exists($sysPath.'config/'.$config)) {
+                    $finder->files()->name($config);
+                }
+            }
+            $finder->files()->name('db_migration_status_*');
+        }
+
+        /*
+        $versions = $this->chamiloVersions();
+        foreach ($versions as $version) {
+            $migrationFile = $sysPath."main/inc/conf/db_migration_status_".$version."_pre.yml";
+            if (file_exists($migrationFile)) {
+                $configFiles[] = $migrationFile;
+            }
+            $migrationFile = $sysPath."main/inc/conf/db_migration_status_".$version."_post.yml";
+            if (file_exists($migrationFile)) {
+                $configFiles[] = $migrationFile;
+            }
+        }
+        */
+        return $finder;
+    }
+
+
+     /**
+     * @return array
+     */
+    public function getDataFiles()
+    {
+        $finder = new Finder();
+        $sysPath = $this->getSysPath();
+
+        if (is_dir($sysPath.'courses')) {
+            $finder->files()->in($sysPath.'courses/');
+            $finder->directories()->in($sysPath.'courses/');
+        }
+
+        if (is_dir($sysPath.'data/courses')) {
+            $finder->files()->in($sysPath.'data/courses/');
+            $finder->directories()->in($sysPath.'data/courses/');
+        }
+
+        return $finder;
+    }
+
+     /**
+     * @return array
+     */
+    public function getTempFiles()
+    {
+        $finder = new Finder();
+        $sysPath = $this->getSysPath();
+
+        if (is_dir($sysPath.'temp')) {
+            $finder->files()->in($sysPath.'temp');
+            $finder->directories()->in($sysPath.'temp');
+        }
+
+        if (is_dir($sysPath.'archive')) {
+            $finder->files()->in($sysPath.'archive');
+            $finder->directories()->in($sysPath.'archive');
+        }
+        return $finder;
+    }
+
+    public function getSysFolders()
+    {
+        $finder = new Finder();
+        $sysPath = $this->getSysPath();
+        $finder->directories()->in($sysPath);
+        return $finder;
+    }
+
+    public function getSysFiles()
+    {
+        $finder = new Finder();
+        $sysPath = $this->getSysPath();
+        $finder->files()->in($sysPath);
+        return $finder;
+    }
+
+
+    public function getDataFolders()
+    {
+        $finder = new Finder();
+        $sysPath = $this->getSysPath();
+        $finder->directories()->in($sysPath);
+        $finder->path('courses');
+        $finder->path('data/courses');
+        return $finder;
+
+    }
+
+    public function getConfigFolders()
+    {
+        $finder = new Finder();
+        $sysPath = $this->getSysPath();
+        $finder->directories()->in($sysPath);
+        $finder->path('main/inc/conf');
+        $finder->path('data/config');
+        return $finder;
+    }
+
+    public function getTempFolders()
+    {
+        $finder = new Finder();
+        $sysPath = $this->getSysPath();
+        $finder->directories()->in($sysPath);
+        $finder->path('archive');
+        $finder->path('data/temp');
+        return $finder;
+    }
+
+    public function setSysPath($sysPath)
+    {
+        $this->sysPath = $sysPath;
+    }
+
+    public function getTempFolderList()
+    {
+        // Copied from the resources/prod.php file in Chamilo
+
+        $sysPath = $this->getSysPath();
+
+        $tempPath = 'archive/';
+        if (is_dir($sysPath.'config')) {
+            $tempPath = 'data/temp/';
+        }
+
+        $app['temp.paths'] = new \stdClass();
+
+        //$app['temp.paths']->folders[] = $app['sys_data_path'];
+
+        // Monolog.
+        //$app['temp.paths']->folders[] = $app['sys_log_path'];
+        $app['temp.path'] = $this->getSysPath().$tempPath;
+        // Twig cache.
+        $app['temp.paths']->folders[] = $app['twig.cache.path'] = $app['temp.path'].'twig';
+
+        // Http cache
+        $app['temp.paths']->folders[] = $app['http_cache.cache_dir'] = $app['temp.path'].'http';
+
+        // Doctrine ORM.
+        $app['temp.paths']->folders[] = $app['db.orm.proxies_dir'] = $app['temp.path'].'Proxies';
+
+        // Symfony2 Web profiler.
+        $app['temp.paths']->folders[] = $app['profiler.cache_dir'] = $app['temp.path'].'profiler';
+
+        // HTMLPurifier.
+        $app['temp.paths']->folders[] = $app['htmlpurifier.serializer'] = $app['temp.path'].'serializer';
+
+        // PCLZIP temp dir.
+        //define('PCLZIP_TEMPORARY_DIR', $app['temp.path'].'pclzip');
+        $app['temp.paths']->folders[] = $app['temp.path'].'pclzip';
+
+        // MPDF temp libs.
+        //define("_MPDF_TEMP_PATH", $app['temp.path'].'mpdf');
+        //define("_JPGRAPH_PATH", $app['temp.path'].'mpdf');
+        //define("_MPDF_TTFONTDATAPATH", $app['temp.path'].'mpdf');
+
+        $app['temp.paths']->folders[] = $app['temp.path'].'mpdf';
+
+        // QR code.
+        //define('QR_LOG_DIR', $app['temp.path'].'qr');
+        //define('QR_CACHE_DIR', $app['temp.path'].'qr');
+
+        $app['temp.paths']->folders[] = $app['temp.path'].'qr';
+
+        // Chamilo Temp class @todo fix this
+        $app['temp.paths']->folders[] = $app['temp.path'].'temp';
+
+        return $app['temp.paths']->folders;
+    }
+
+    public function getSysPath()
+    {
+        return $this->sysPath;
+    }
+
+    /**
+     * Connect to the database
+     * @return object Database handler
+     */
+    public function getConnection($path = null)
+    {
+        $conf = $this->getConfiguration($path);
+        $dbh = false;
+
+        if (isset($conf['db_host']) && isset($conf['db_host']) && isset($conf['db_password'])) {
+            $dbh  = mysql_connect($conf['db_host'], $conf['db_user'], $conf['db_password']);
+
+            if (!$dbh) {
+
+                return false;
+                //die('Could not connect to server: '.mysql_error());
+            }
+            $db = mysql_select_db($conf['main_database'], $dbh);
+            if (!$db) {
+
+                return false;
+            }
+        }
+        return $dbh;
+    }
+
+    /**
+     * Gets an array with all the databases (particularly useful for Chamilo <1.9)
+     * @return mixed Array of databases
+     */
+    public function getAllDatabases()
+    {
+        $_configuration = $this->getConfiguration();
+        $dbs            = array();
+
+        $dbs[] = $_configuration['main_database'];
+
+        if (isset($_configuration['statistics_database']) && !in_array(
+            $_configuration['statistics_database'],
+            $dbs
+        ) && !empty($_configuration['statistics_database'])
+        ) {
+            $dbs[] = $_configuration['statistics_database'];
+        }
+
+        if (isset($_configuration['scorm_database']) && !in_array(
+            $_configuration['scorm_database'],
+            $dbs
+        ) && !empty($_configuration['scorm_database'])
+        ) {
+            $dbs[] = $_configuration['scorm_database'];
+        }
+
+        if (isset($_configuration['user_personal_database']) && !in_array(
+            $_configuration['user_personal_database'],
+            $dbs
+        ) && !empty($_configuration['user_personal_database'])
+        ) {
+            $dbs[] = $_configuration['user_personal_database'];
+        }
+
+        $courseTable = $_configuration['main_database'].'.course';
+
+        $singleDatabase = isset($_configuration['single_database']) ? $_configuration['single_database'] : false;
+
+        if ($singleDatabase == false) {
+            $sql = 'SELECT db_name from '.$courseTable;
+            $res = mysql_query($sql);
+            if (mysql_num_rows($res) > 0) {
+                while ($row = mysql_fetch_array($res)) {
+                    if (!empty($row['db_name'])) {
+                        $dbs[] = $row['db_name'];
+                    }
+                }
+            }
+        }
+
+        return $dbs;
+    }
+
+
+    /**
+     * @return string
+     */
+    public function getName()
+    {
+        return 'configuration';
+    }
+
+
+}

+ 41 - 0
vendor/chamilo/chash/src/Chash/Migrations/Version10.php

@@ -0,0 +1,41 @@
+<?php
+
+namespace Chash\Migrations;
+
+use Doctrine\DBAL\Migrations\AbstractMigration,
+    Doctrine\DBAL\Schema\Schema;
+
+/**
+ * Manages the migration to Chamilo 1.10
+ * @package ChamiloLMS\Controller\Migrations
+ */
+class Version10 extends AbstractMigration
+{
+    /**
+     * Chamilo upgrade
+     * @param Schema $schema
+     */
+    public function up(Schema $schema)
+    {
+        $this->addSql("UPDATE settings_current SET selected_value = '1.10.0.001' WHERE variable = 'chamilo_database_version'");
+
+        //@todo change this into a function
+        // Web profiler
+        /*$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_web_profiler', NULL,'radio','Portal','false','AllowWebProfilerTitle','AllowWebProfilerComment', NULL, NULL, 0)");
+        $this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_web_profiler', 'true', 'Yes')");
+        $this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_web_profiler', 'false', 'No')");*/
+
+    }
+
+    /**
+     * Chamilo downgrade
+     * @param Schema $schema
+     */
+    public function down(Schema $schema)
+    {
+        $this->addSql("UPDATE settings_current SET selected_value = '1.9.0' WHERE variable = 'chamilo_database_version'");
+        // Web profiler
+        /* $this->addSql("DELETE FROM settings_current WHERE variable = 'allow_web_profiler'");
+        $this->addSql("DELETE FROM settings_options WHERE variable = 'allow_web_profiler'");*/
+    }
+}

+ 23 - 0
vendor/chamilo/chash/src/Chash/Migrations/Version11.php

@@ -0,0 +1,23 @@
+<?php
+
+namespace Chash\Migrations;
+
+use Doctrine\DBAL\Migrations\AbstractMigration,
+    Doctrine\DBAL\Schema\Schema;
+
+/**
+ * Manages the migration to Chamilo 1.11
+ * @package ChamiloLMS\Controller\Migrations
+ */
+class Version11 extends AbstractMigration
+{
+    public function up(Schema $schema)
+    {
+        $this->addSql('UPDATE settings_current SET selected_value = "1.11" WHERE variable = "chamilo_database_version"');
+    }
+
+    public function down(Schema $schema)
+    {
+        $this->addSql('UPDATE settings_current SET selected_value = "1.10" WHERE variable = "chamilo_database_version"');
+    }
+}

+ 24 - 0
vendor/chamilo/chash/src/Chash/Migrations/Version8.php

@@ -0,0 +1,24 @@
+<?php
+
+namespace Chash\Migrations;
+
+use Doctrine\DBAL\Migrations\AbstractMigration,
+    Doctrine\DBAL\Schema\Schema;
+
+
+/**
+ * Manages the migration to version 1.8.0
+ * @package ChamiloLMS\Controller\Migrations
+ */
+class Version8 extends AbstractMigration
+{
+    public function up(Schema $schema)
+    {
+        $this->addSql('UPDATE settings_current SET selected_value = "1.8.8.14911.doc" WHERE variable = "chamilo_database_version"');
+    }
+
+    public function down(Schema $schema)
+    {
+        $this->addSql('UPDATE settings_current SET selected_value = "1.8.7.doc" WHERE variable = "chamilo_database_version"');
+    }
+}

+ 23 - 0
vendor/chamilo/chash/src/Chash/Migrations/Version9.php

@@ -0,0 +1,23 @@
+<?php
+
+namespace Chash\Migrations;
+
+use Doctrine\DBAL\Migrations\AbstractMigration,
+    Doctrine\DBAL\Schema\Schema;
+
+/**
+ * Manages the migration to version 1.9.0
+ * @package ChamiloLMS\Controller\Migrations
+ */
+class Version9 extends AbstractMigration
+{
+    public function up(Schema $schema)
+    {
+        $this->addSql('UPDATE settings_current SET selected_value = "1.9.0.18715.doc" WHERE variable = "chamilo_database_version"');
+    }
+
+    public function down(Schema $schema)
+    {
+        $this->addSql('UPDATE settings_current SET selected_value = "1.8.8.14911.doc" WHERE variable = "chamilo_database_version"');
+    }
+}

+ 4 - 0
vendor/chamilo/chash/src/Chash/Migrations/migrations.yml

@@ -0,0 +1,4 @@
+name: Chamilo Migrations
+migrations_namespace: Chash\Migrations
+table_name: chamilo_migration_versions
+migrations_directory: src/Chash/Migrations/

+ 2011 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/db_course.sql

@@ -0,0 +1,2011 @@
+-- MySQL dump 10.13  Distrib 5.1.66, for debian-linux-gnu (i486)
+--
+-- Host: localhost    Database: chamilo
+-- ------------------------------------------------------
+-- Server version	5.1.66-0+squeeze1
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table c_announcement
+--
+
+DROP TABLE IF EXISTS c_announcement;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_announcement (
+  iid int unsigned NOT NULL AUTO_INCREMENT,
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL,
+  title text,
+  content mediumtext,
+  end_date date DEFAULT NULL,
+  display_order mediumint(9) NOT NULL DEFAULT '0',
+  email_sent tinyint(4) DEFAULT '0',
+  session_id int(11) DEFAULT '0',
+  PRIMARY KEY (iid),
+  UNIQUE KEY (c_id,id),
+  KEY session_id (session_id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_announcement_attachment
+--
+
+DROP TABLE IF EXISTS c_announcement_attachment;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_announcement_attachment (
+  iid int unsigned NOT NULL AUTO_INCREMENT,
+  c_id int(11) NOT NULL,
+  id int(11) unsigned NOT NULL,
+  path varchar(255) NOT NULL,
+  comment text,
+  size int(11) NOT NULL DEFAULT '0',
+  announcement_id int(11) NOT NULL,
+  filename varchar(255) NOT NULL,
+  PRIMARY KEY (iid),
+  UNIQUE KEY (c_id,id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_attendance
+--
+
+DROP TABLE IF EXISTS c_attendance;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_attendance (
+  iid int unsigned not null AUTO_INCREMENT,
+  c_id int NOT NULL,
+  id int unsigned NOT NULL,
+  name text NOT NULL,
+  description text,
+  active tinyint NOT NULL DEFAULT '1',
+  attendance_qualify_title varchar(255) DEFAULT NULL,
+  attendance_qualify_max int NOT NULL DEFAULT '0',
+  attendance_weight float(6,2) NOT NULL DEFAULT '0.00',
+  session_id int NOT NULL DEFAULT '0',
+  locked int NOT NULL DEFAULT '0',
+  PRIMARY KEY (iid),
+  UNIQUE KEY (c_id,id),
+  KEY session_id (session_id),
+  KEY active (active)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_attendance_calendar
+--
+
+DROP TABLE IF EXISTS c_attendance_calendar;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_attendance_calendar (
+  iid int unsigned NOT NULL AUTO_INCREMENT,
+  c_id int NOT NULL,
+  id int unsigned 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 (iid),
+  UNIQUE KEY (c_id,id),
+  KEY attendance_id (attendance_id),
+  KEY done_attendance (done_attendance)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_attendance_result
+--
+
+DROP TABLE IF EXISTS c_attendance_result;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_attendance_result (
+  iid int unsigned NOT NULL AUTO_INCREMENT,
+  c_id int NOT NULL,
+  id int unsigned NOT NULL,
+  user_id int NOT NULL,
+  attendance_id int NOT NULL,
+  score int NOT NULL DEFAULT '0',
+  PRIMARY KEY (iid),
+  UNIQUE KEY (c_id,id),
+  KEY attendance_id (attendance_id),
+  KEY user_id (user_id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_attendance_sheet
+--
+
+DROP TABLE IF EXISTS c_attendance_sheet;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_attendance_sheet (
+  iid int unsigned NOT NULL AUTO_INCREMENT,
+  c_id int NOT NULL,
+  user_id int NOT NULL,
+  attendance_calendar_id int NOT NULL,
+  presence tinyint NOT NULL DEFAULT '0',
+  PRIMARY KEY (iid),
+  UNIQUE KEY (c_id,user_id,attendance_calendar_id),
+  KEY presence (presence)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_attendance_sheet_log
+--
+
+DROP TABLE IF EXISTS c_attendance_sheet_log;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_attendance_sheet_log (
+  iid int unsigned NOT NULL AUTO_INCREMENT,
+  c_id int NOT NULL,
+  id int unsigned 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 DEFAULT NULL,
+  PRIMARY KEY (iid),
+  UNIQUE KEY (c_id,id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_blog
+--
+
+DROP TABLE IF EXISTS c_blog;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_blog (
+  c_id int(11) NOT NULL,
+  blog_id int(11) NOT NULL AUTO_INCREMENT,
+  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(3) unsigned NOT NULL DEFAULT '0',
+  session_id int(11) DEFAULT '0',
+  PRIMARY KEY (c_id,blog_id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table with blogs in this course';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_blog_attachment
+--
+
+DROP TABLE IF EXISTS c_blog_attachment;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_blog_attachment (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  path varchar(255) NOT NULL COMMENT 'the real filename',
+  comment text,
+  size int(11) NOT NULL DEFAULT '0',
+  post_id int(11) NOT NULL,
+  filename varchar(255) NOT NULL COMMENT 'the user s file name',
+  blog_id int(11) NOT NULL,
+  comment_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_blog_comment
+--
+
+DROP TABLE IF EXISTS c_blog_comment;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_blog_comment (
+  c_id int(11) NOT NULL,
+  comment_id int(11) NOT NULL AUTO_INCREMENT,
+  title varchar(250) NOT NULL DEFAULT '',
+  comment longtext NOT NULL,
+  author_id int(11) NOT NULL DEFAULT '0',
+  date_creation datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  blog_id int(11) NOT NULL DEFAULT '0',
+  post_id int(11) NOT NULL DEFAULT '0',
+  task_id int(11) DEFAULT NULL,
+  parent_comment_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,comment_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table with comments on posts in a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_blog_post
+--
+
+DROP TABLE IF EXISTS c_blog_post;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_blog_post (
+  c_id int(11) NOT NULL,
+  post_id int(11) NOT NULL AUTO_INCREMENT,
+  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(11) NOT NULL DEFAULT '0',
+  author_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,post_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table with posts / blog.';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_blog_rating
+--
+
+DROP TABLE IF EXISTS c_blog_rating;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_blog_rating (
+  c_id int(11) NOT NULL,
+  rating_id int(11) NOT NULL AUTO_INCREMENT,
+  blog_id int(11) NOT NULL DEFAULT '0',
+  rating_type enum('post','comment') NOT NULL DEFAULT 'post',
+  item_id int(11) NOT NULL DEFAULT '0',
+  user_id int(11) NOT NULL DEFAULT '0',
+  rating int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,rating_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table with ratings for post/comments in a certain blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_blog_rel_user
+--
+
+DROP TABLE IF EXISTS c_blog_rel_user;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_blog_rel_user (
+  c_id int(11) NOT NULL,
+  blog_id int(11) NOT NULL DEFAULT '0',
+  user_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,blog_id,user_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table representing users subscribed to a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_blog_task
+--
+
+DROP TABLE IF EXISTS c_blog_task;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_blog_task (
+  c_id int(11) NOT NULL,
+  task_id int(11) NOT NULL AUTO_INCREMENT,
+  blog_id int(11) NOT NULL DEFAULT '0',
+  title varchar(250) NOT NULL DEFAULT '',
+  description text NOT NULL,
+  color varchar(10) NOT NULL DEFAULT '',
+  system_task tinyint(3) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,task_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table with tasks for a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_blog_task_rel_user
+--
+
+DROP TABLE IF EXISTS c_blog_task_rel_user;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_blog_task_rel_user (
+  c_id int(11) NOT NULL,
+  blog_id int(11) NOT NULL DEFAULT '0',
+  user_id int(11) NOT NULL DEFAULT '0',
+  task_id int(11) NOT NULL DEFAULT '0',
+  target_date date NOT NULL DEFAULT '0000-00-00',
+  PRIMARY KEY (c_id,blog_id,user_id,task_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table with tasks assigned to a user in a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_calendar_event
+--
+
+DROP TABLE IF EXISTS c_calendar_event;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_calendar_event (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  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(11) DEFAULT NULL,
+  session_id int(10) unsigned NOT NULL DEFAULT '0',
+  all_day int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_calendar_event_attachment
+--
+
+DROP TABLE IF EXISTS c_calendar_event_attachment;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_calendar_event_attachment (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  path varchar(255) NOT NULL,
+  comment text,
+  size int(11) NOT NULL DEFAULT '0',
+  agenda_id int(11) NOT NULL,
+  filename varchar(255) NOT NULL,
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_calendar_event_repeat
+--
+
+DROP TABLE IF EXISTS c_calendar_event_repeat;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_calendar_event_repeat (
+  c_id int(11) NOT NULL,
+  cal_id int(11) NOT NULL DEFAULT '0',
+  cal_type varchar(20) DEFAULT NULL,
+  cal_end int(11) DEFAULT NULL,
+  cal_frequency int(11) DEFAULT '1',
+  cal_days char(7) DEFAULT NULL,
+  PRIMARY KEY (c_id,cal_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_calendar_event_repeat_not
+--
+
+DROP TABLE IF EXISTS c_calendar_event_repeat_not;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_calendar_event_repeat_not (
+  c_id int(11) NOT NULL,
+  cal_id int(11) NOT NULL,
+  cal_date int(11) NOT NULL,
+  PRIMARY KEY (c_id,cal_id,cal_date)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_chat_connected
+--
+
+DROP TABLE IF EXISTS c_chat_connected;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_chat_connected (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  user_id int(10) unsigned NOT NULL DEFAULT '0',
+  last_connection datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  session_id int(11) NOT NULL DEFAULT '0',
+  to_group_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id,user_id,last_connection),
+  KEY char_connected_index (user_id,session_id,to_group_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_course_description
+--
+
+DROP TABLE IF EXISTS c_course_description;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_course_description (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  title varchar(255) DEFAULT NULL,
+  content text,
+  session_id int(11) DEFAULT '0',
+  description_type tinyint(3) unsigned NOT NULL DEFAULT '0',
+  progress int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_course_setting
+--
+
+DROP TABLE IF EXISTS c_course_setting;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_course_setting (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  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 (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_document
+--
+
+DROP TABLE IF EXISTS c_document;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_document (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  path varchar(255) NOT NULL DEFAULT '',
+  comment text,
+  title varchar(255) DEFAULT NULL,
+  filetype set('file','folder') NOT NULL DEFAULT 'file',
+  size int(11) NOT NULL DEFAULT '0',
+  readonly tinyint(3) unsigned NOT NULL,
+  session_id int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_dropbox_category
+--
+
+DROP TABLE IF EXISTS c_dropbox_category;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_dropbox_category (
+  c_id int(11) NOT NULL,
+  cat_id int(11) NOT NULL AUTO_INCREMENT,
+  cat_name text NOT NULL,
+  received tinyint(3) unsigned NOT NULL DEFAULT '0',
+  sent tinyint(3) unsigned NOT NULL DEFAULT '0',
+  user_id int(11) NOT NULL DEFAULT '0',
+  session_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,cat_id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_dropbox_feedback
+--
+
+DROP TABLE IF EXISTS c_dropbox_feedback;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_dropbox_feedback (
+  c_id int(11) NOT NULL,
+  feedback_id int(11) NOT NULL AUTO_INCREMENT,
+  file_id int(11) NOT NULL DEFAULT '0',
+  author_user_id int(11) NOT NULL DEFAULT '0',
+  feedback text NOT NULL,
+  feedback_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  PRIMARY KEY (c_id,feedback_id),
+  KEY file_id (file_id),
+  KEY author_user_id (author_user_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_dropbox_file
+--
+
+DROP TABLE IF EXISTS c_dropbox_file;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_dropbox_file (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  uploader_id int(10) unsigned NOT NULL DEFAULT '0',
+  filename varchar(250) NOT NULL DEFAULT '',
+  filesize int(10) 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(11) NOT NULL DEFAULT '0',
+  session_id int(10) unsigned NOT NULL,
+  PRIMARY KEY (c_id,id),
+  UNIQUE KEY UN_filename (filename),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_dropbox_person
+--
+
+DROP TABLE IF EXISTS c_dropbox_person;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_dropbox_person (
+  c_id int(11) NOT NULL,
+  file_id int(10) unsigned NOT NULL,
+  user_id int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,file_id,user_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_dropbox_post
+--
+
+DROP TABLE IF EXISTS c_dropbox_post;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_dropbox_post (
+  c_id int(11) NOT NULL,
+  file_id int(10) unsigned NOT NULL,
+  dest_user_id int(10) unsigned NOT NULL DEFAULT '0',
+  feedback_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  feedback text,
+  cat_id int(11) NOT NULL DEFAULT '0',
+  session_id int(10) unsigned NOT NULL,
+  PRIMARY KEY (c_id,file_id,dest_user_id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_forum_attachment
+--
+
+DROP TABLE IF EXISTS c_forum_attachment;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_forum_attachment (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  path varchar(255) NOT NULL,
+  comment text,
+  size int(11) NOT NULL DEFAULT '0',
+  post_id int(11) NOT NULL,
+  filename varchar(255) NOT NULL,
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_forum_category
+--
+
+DROP TABLE IF EXISTS c_forum_category;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_forum_category (
+  c_id int(11) NOT NULL,
+  cat_id int(11) NOT NULL AUTO_INCREMENT,
+  cat_title varchar(255) NOT NULL DEFAULT '',
+  cat_comment text,
+  cat_order int(11) NOT NULL DEFAULT '0',
+  locked int(11) NOT NULL DEFAULT '0',
+  session_id int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,cat_id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_forum_forum
+--
+
+DROP TABLE IF EXISTS c_forum_forum;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_forum_forum (
+  c_id int(11) NOT NULL,
+  forum_id int(11) NOT NULL AUTO_INCREMENT,
+  forum_title varchar(255) NOT NULL DEFAULT '',
+  forum_comment text,
+  forum_threads int(11) DEFAULT '0',
+  forum_posts int(11) DEFAULT '0',
+  forum_last_post int(11) DEFAULT '0',
+  forum_category int(11) DEFAULT NULL,
+  allow_anonymous int(11) DEFAULT NULL,
+  allow_edit int(11) DEFAULT NULL,
+  approval_direct_post varchar(20) DEFAULT NULL,
+  allow_attachments int(11) DEFAULT NULL,
+  allow_new_threads int(11) 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(11) DEFAULT NULL,
+  locked int(11) NOT NULL DEFAULT '0',
+  session_id int(11) 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 (c_id,forum_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_forum_mailcue
+--
+
+DROP TABLE IF EXISTS c_forum_mailcue;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_forum_mailcue (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  user_id int(11) NOT NULL DEFAULT '0',
+  thread_id int(11) NOT NULL DEFAULT '0',
+  post_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (id,c_id,thread_id,user_id,post_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_forum_notification
+--
+
+DROP TABLE IF EXISTS c_forum_notification;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_forum_notification (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  user_id int(11) NOT NULL DEFAULT '0',
+  forum_id int(11) NOT NULL DEFAULT '0',
+  thread_id int(11) NOT NULL DEFAULT '0',
+  post_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (id,c_id,user_id,forum_id,thread_id,post_id),
+  KEY user_id (user_id),
+  KEY forum_id (forum_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_forum_post
+--
+
+DROP TABLE IF EXISTS c_forum_post;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_forum_post (
+  c_id int(11) NOT NULL,
+  post_id int(11) NOT NULL AUTO_INCREMENT,
+  post_title varchar(250) DEFAULT NULL,
+  post_text text,
+  thread_id int(11) DEFAULT '0',
+  forum_id int(11) DEFAULT '0',
+  poster_id int(11) DEFAULT '0',
+  poster_name varchar(100) DEFAULT '',
+  post_date datetime DEFAULT '0000-00-00 00:00:00',
+  post_notification tinyint(4) DEFAULT '0',
+  post_parent_id int(11) DEFAULT '0',
+  visible tinyint(4) DEFAULT '1',
+  PRIMARY KEY (c_id,post_id),
+  KEY poster_id (poster_id),
+  KEY forum_id (forum_id),
+  KEY idx_forum_post_thread_id (thread_id),
+  KEY idx_forum_post_visible (visible)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_forum_thread
+--
+
+DROP TABLE IF EXISTS c_forum_thread;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_forum_thread (
+  c_id int(11) NOT NULL,
+  thread_id int(11) NOT NULL AUTO_INCREMENT,
+  thread_title varchar(255) DEFAULT NULL,
+  forum_id int(11) DEFAULT NULL,
+  thread_replies int(11) DEFAULT '0',
+  thread_poster_id int(11) DEFAULT NULL,
+  thread_poster_name varchar(100) DEFAULT '',
+  thread_views int(11) DEFAULT '0',
+  thread_last_post int(11) DEFAULT NULL,
+  thread_date datetime DEFAULT '0000-00-00 00:00:00',
+  thread_sticky tinyint(3) unsigned DEFAULT '0',
+  locked int(11) NOT NULL DEFAULT '0',
+  session_id int(10) unsigned DEFAULT NULL,
+  thread_title_qualify varchar(255) DEFAULT '',
+  thread_qualify_max float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  thread_close_date datetime DEFAULT '0000-00-00 00:00:00',
+  thread_weight float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  PRIMARY KEY (c_id,thread_id),
+  KEY idx_forum_thread_forum_id (forum_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_forum_thread_qualify
+--
+
+DROP TABLE IF EXISTS c_forum_thread_qualify;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_forum_thread_qualify (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  user_id int(10) unsigned NOT NULL,
+  thread_id int(11) NOT NULL,
+  qualify float(6,2) NOT NULL DEFAULT '0.00',
+  qualify_user_id int(11) DEFAULT NULL,
+  qualify_time datetime DEFAULT '0000-00-00 00:00:00',
+  session_id int(11) DEFAULT NULL,
+  PRIMARY KEY (c_id,id),
+  KEY user_id (user_id,thread_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_forum_thread_qualify_log
+--
+
+DROP TABLE IF EXISTS c_forum_thread_qualify_log;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_forum_thread_qualify_log (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  user_id int(10) unsigned NOT NULL,
+  thread_id int(11) NOT NULL,
+  qualify float(6,2) NOT NULL DEFAULT '0.00',
+  qualify_user_id int(11) DEFAULT NULL,
+  qualify_time datetime DEFAULT '0000-00-00 00:00:00',
+  session_id int(11) DEFAULT NULL,
+  PRIMARY KEY (c_id,id),
+  KEY user_id (user_id,thread_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_glossary
+--
+
+DROP TABLE IF EXISTS c_glossary;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_glossary (
+  c_id int(11) NOT NULL,
+  glossary_id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  name varchar(255) NOT NULL,
+  description text NOT NULL,
+  display_order int(11) DEFAULT NULL,
+  session_id int(11) DEFAULT '0',
+  PRIMARY KEY (c_id,glossary_id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_group_category
+--
+
+DROP TABLE IF EXISTS c_group_category;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_group_category (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  title varchar(255) NOT NULL DEFAULT '',
+  description text NOT NULL,
+  doc_state tinyint(3) unsigned NOT NULL DEFAULT '1',
+  calendar_state tinyint(3) unsigned NOT NULL DEFAULT '1',
+  work_state tinyint(3) unsigned NOT NULL DEFAULT '1',
+  announcements_state tinyint(3) unsigned NOT NULL DEFAULT '1',
+  forum_state tinyint(3) unsigned NOT NULL DEFAULT '1',
+  wiki_state tinyint(3) unsigned NOT NULL DEFAULT '1',
+  chat_state tinyint(3) unsigned NOT NULL DEFAULT '1',
+  max_student int(10) unsigned NOT NULL DEFAULT '8',
+  self_reg_allowed tinyint(3) unsigned NOT NULL DEFAULT '0',
+  self_unreg_allowed tinyint(3) unsigned NOT NULL DEFAULT '0',
+  groups_per_user int(10) unsigned NOT NULL DEFAULT '0',
+  display_order int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_group_info
+--
+
+DROP TABLE IF EXISTS c_group_info;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_group_info (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL,
+  name varchar(100) DEFAULT NULL,
+  category_id int(10) unsigned NOT NULL DEFAULT '0',
+  description text,
+  max_student int(10) unsigned NOT NULL DEFAULT '8',
+  doc_state tinyint(3) unsigned NOT NULL DEFAULT '1',
+  calendar_state tinyint(3) unsigned NOT NULL DEFAULT '0',
+  work_state tinyint(3) unsigned NOT NULL DEFAULT '0',
+  announcements_state tinyint(3) unsigned NOT NULL DEFAULT '0',
+  forum_state tinyint(3) unsigned NOT NULL DEFAULT '0',
+  wiki_state tinyint(3) unsigned NOT NULL DEFAULT '1',
+  chat_state tinyint(3) unsigned NOT NULL DEFAULT '1',
+  secret_directory varchar(255) DEFAULT NULL,
+  self_registration_allowed tinyint(3) unsigned NOT NULL DEFAULT '0',
+  self_unregistration_allowed tinyint(3) unsigned NOT NULL DEFAULT '0',
+  session_id int(11) NOT NULL,
+  iid int(10) unsigned NOT NULL AUTO_INCREMENT,
+  PRIMARY KEY (iid),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_group_rel_tutor
+--
+
+DROP TABLE IF EXISTS c_group_rel_tutor;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_group_rel_tutor (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  user_id int(11) NOT NULL,
+  group_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_group_rel_user
+--
+
+DROP TABLE IF EXISTS c_group_rel_user;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_group_rel_user (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  user_id int(10) unsigned NOT NULL,
+  group_id int(10) unsigned NOT NULL DEFAULT '0',
+  status int(11) NOT NULL DEFAULT '0',
+  role char(50) NOT NULL,
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_item_property
+--
+
+DROP TABLE IF EXISTS c_item_property;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_item_property (
+  c_id int(11) NOT NULL,
+  tool varchar(100) NOT NULL DEFAULT '',
+  insert_user_id int(10) 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(11) NOT NULL DEFAULT '0',
+  lastedit_type varchar(100) NOT NULL DEFAULT '',
+  lastedit_user_id int(10) unsigned NOT NULL DEFAULT '0',
+  to_group_id int(10) unsigned DEFAULT NULL,
+  to_user_id int(10) unsigned DEFAULT NULL,
+  visibility tinyint(4) NOT NULL DEFAULT '1',
+  start_visible datetime DEFAULT NULL,
+  end_visible datetime DEFAULT NULL,
+  id_session int(11) DEFAULT NULL,
+  id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+  PRIMARY KEY (id),
+  KEY idx_item_property_toolref (tool,ref)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_link
+--
+
+DROP TABLE IF EXISTS c_link;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_link (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  url text NOT NULL,
+  title varchar(150) DEFAULT NULL,
+  description text,
+  category_id int(10) unsigned DEFAULT NULL,
+  display_order int(10) unsigned NOT NULL DEFAULT '0',
+  on_homepage enum('0','1') NOT NULL DEFAULT '0',
+  target char(10) DEFAULT '_self',
+  session_id int(11) DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_link_category
+--
+
+DROP TABLE IF EXISTS c_link_category;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_link_category (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  category_title varchar(255) NOT NULL,
+  description text,
+  display_order mediumint(8) unsigned NOT NULL DEFAULT '0',
+  session_id int(11) DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_lp
+--
+
+DROP TABLE IF EXISTS c_lp;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_lp (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  lp_type int(10) unsigned NOT NULL,
+  name varchar(255) NOT NULL,
+  ref tinytext,
+  description text,
+  path text NOT NULL,
+  force_commit tinyint(3) 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(10) unsigned NOT NULL DEFAULT '0',
+  content_maker tinytext NOT NULL,
+  content_local varchar(32) NOT NULL DEFAULT 'local',
+  content_license text NOT NULL,
+  prevent_reinit tinyint(3) unsigned NOT NULL DEFAULT '1',
+  js_lib tinytext NOT NULL,
+  debug tinyint(3) 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(10) unsigned NOT NULL DEFAULT '0',
+  prerequisite int(10) unsigned NOT NULL DEFAULT '0',
+  hide_toc_frame tinyint(4) NOT NULL DEFAULT '0',
+  seriousgame_mode tinyint(4) NOT NULL DEFAULT '0',
+  use_max_score int(10) unsigned NOT NULL DEFAULT '1',
+  autolunch int(10) 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',
+  max_attempts int(11) NOT NULL DEFAULT '0',
+  category_id int(10) unsigned NOT NULL DEFAULT '0',
+  subscribe_users int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_lp_category
+--
+
+DROP TABLE IF EXISTS c_lp_category;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_lp_category (
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  c_id int(10) unsigned NOT NULL,
+  name varchar(255) DEFAULT NULL,
+  position int(11) DEFAULT NULL,
+  PRIMARY KEY (id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_lp_item
+--
+
+DROP TABLE IF EXISTS c_lp_item;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_lp_item (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  lp_id int(10) unsigned NOT NULL,
+  item_type char(32) NOT NULL DEFAULT 'dokeos_document',
+  ref tinytext NOT NULL,
+  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 DEFAULT NULL,
+  parent_item_id int(10) unsigned NOT NULL DEFAULT '0',
+  previous_item_id int(10) unsigned NOT NULL DEFAULT '0',
+  next_item_id int(10) unsigned NOT NULL DEFAULT '0',
+  display_order int(10) unsigned NOT NULL DEFAULT '0',
+  prerequisite text,
+  parameters text,
+  launch_data text NOT NULL,
+  max_time_allowed char(13) DEFAULT '',
+  terms text,
+  search_did int(11) DEFAULT NULL,
+  audio varchar(250) DEFAULT NULL,
+  PRIMARY KEY (c_id,id),
+  KEY lp_id (lp_id),
+  KEY idx_c_lp_item_cid_lp_id (c_id,lp_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_lp_item_view
+--
+
+DROP TABLE IF EXISTS c_lp_item_view;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_lp_item_view (
+  c_id int(11) NOT NULL,
+  id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+  lp_item_id int(10) unsigned NOT NULL,
+  lp_view_id int(10) unsigned NOT NULL,
+  view_count int(10) unsigned NOT NULL DEFAULT '0',
+  start_time int(10) unsigned NOT NULL,
+  total_time int(10) unsigned NOT NULL DEFAULT '0',
+  score float unsigned NOT NULL DEFAULT '0',
+  status char(32) NOT NULL DEFAULT 'not attempted',
+  suspend_data longtext,
+  lesson_location text,
+  core_exit varchar(32) NOT NULL DEFAULT 'none',
+  max_score varchar(8) DEFAULT '',
+  PRIMARY KEY (c_id,id),
+  KEY lp_item_id (lp_item_id),
+  KEY lp_view_id (lp_view_id),
+  KEY idx_c_lp_item_view_cid_lp_view_id_lp_item_id (c_id,lp_view_id,lp_item_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_lp_iv_interaction
+--
+
+DROP TABLE IF EXISTS c_lp_iv_interaction;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_lp_iv_interaction (
+  c_id int(11) NOT NULL,
+  id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+  order_id int(10) unsigned NOT NULL DEFAULT '0',
+  lp_iv_id bigint(20) 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,
+  student_response text NOT NULL,
+  result varchar(255) NOT NULL DEFAULT '',
+  latency varchar(16) NOT NULL DEFAULT '',
+  PRIMARY KEY (c_id,id),
+  KEY lp_iv_id (lp_iv_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_lp_iv_objective
+--
+
+DROP TABLE IF EXISTS c_lp_iv_objective;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_lp_iv_objective (
+  c_id int(11) NOT NULL,
+  id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+  lp_iv_id bigint(20) unsigned NOT NULL,
+  order_id int(10) 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 (c_id,id),
+  KEY lp_iv_id (lp_iv_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_lp_view
+--
+
+DROP TABLE IF EXISTS c_lp_view;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_lp_view (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  lp_id int(10) unsigned NOT NULL,
+  user_id int(10) unsigned NOT NULL,
+  view_count int(10) unsigned NOT NULL DEFAULT '0',
+  last_item int(10) unsigned NOT NULL DEFAULT '0',
+  progress int(10) unsigned DEFAULT '0',
+  session_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY lp_id (lp_id),
+  KEY user_id (user_id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_metadata
+--
+
+DROP TABLE IF EXISTS c_metadata;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_metadata (
+  c_id int(11) NOT NULL,
+  eid varchar(250) NOT NULL,
+  mdxmltext text,
+  md5 char(32) DEFAULT '',
+  htmlcache1 text,
+  htmlcache2 text,
+  indexabletext text,
+  PRIMARY KEY (c_id,eid)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_notebook
+--
+
+DROP TABLE IF EXISTS c_notebook;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_notebook (
+  c_id int(11) NOT NULL,
+  notebook_id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  user_id int(10) unsigned NOT NULL,
+  course varchar(40) NOT NULL,
+  session_id int(11) 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(11) DEFAULT NULL,
+  PRIMARY KEY (c_id,notebook_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_online_connected
+--
+
+DROP TABLE IF EXISTS c_online_connected;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_online_connected (
+  c_id int(11) NOT NULL,
+  user_id int(10) unsigned NOT NULL,
+  last_connection datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  PRIMARY KEY (c_id,user_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_online_link
+--
+
+DROP TABLE IF EXISTS c_online_link;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_online_link (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  name char(50) NOT NULL DEFAULT '',
+  url char(100) NOT NULL,
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_permission_group
+--
+
+DROP TABLE IF EXISTS c_permission_group;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_permission_group (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  group_id int(11) NOT NULL DEFAULT '0',
+  tool varchar(250) NOT NULL DEFAULT '',
+  action varchar(250) NOT NULL DEFAULT '',
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_permission_task
+--
+
+DROP TABLE IF EXISTS c_permission_task;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_permission_task (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  task_id int(11) NOT NULL DEFAULT '0',
+  tool varchar(250) NOT NULL DEFAULT '',
+  action varchar(250) NOT NULL DEFAULT '',
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_permission_user
+--
+
+DROP TABLE IF EXISTS c_permission_user;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_permission_user (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  user_id int(11) NOT NULL DEFAULT '0',
+  tool varchar(250) NOT NULL DEFAULT '',
+  action varchar(250) NOT NULL DEFAULT '',
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_quiz
+--
+
+DROP TABLE IF EXISTS c_quiz;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_quiz (
+  iid int unsigned NOT NULL auto_increment,
+  c_id int(11) NOT NULL,
+  title varchar(255) NOT NULL,
+  description text,
+  sound varchar(255) DEFAULT NULL,
+  type tinyint(3) unsigned NOT NULL DEFAULT '1',
+  random int(11) NOT NULL DEFAULT '0',
+  random_answers tinyint(3) unsigned NOT NULL DEFAULT '0',
+  active tinyint(4) NOT NULL DEFAULT '0',
+  results_disabled int(10) unsigned NOT NULL DEFAULT '0',
+  access_condition text,
+  max_attempt int(11) 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(11) NOT NULL DEFAULT '0',
+  expired_time int(11) NOT NULL DEFAULT '0',
+  session_id int(11) DEFAULT '0',
+  propagate_neg int(11) NOT NULL DEFAULT '0',
+  review_answers int(11) NOT NULL DEFAULT '0',
+  random_by_category int(11) NOT NULL DEFAULT '0',
+  text_when_finished text,
+  display_category_name int(11) NOT NULL DEFAULT '1',
+  pass_percentage int(11) DEFAULT NULL,
+  autolaunch INT DEFAULT 0,
+  end_button int NOT NULL DEFAULT 0,
+  email_notification_template text default '',
+  model_type INT default 1,
+  question_selection_type INT default 1,
+  hide_question_title INT default 0,
+  PRIMARY KEY (iid)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_quiz_answer
+--
+
+DROP TABLE IF EXISTS c_quiz_answer;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_quiz_answer (
+  iid bigint unsigned NOT NULL AUTO_INCREMENT,
+  c_id int(11) NOT NULL,
+  question_id int(10) unsigned NOT NULL,
+  answer text NOT NULL,
+  correct mediumint(8) unsigned DEFAULT NULL,
+  comment text,
+  ponderation float(6,2) NOT NULL DEFAULT '0.00',
+  position mediumint(8) 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 (iid)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+ALTER TABLE c_quiz_answer ADD INDEX idx_cqa_qid (question_id);
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_quiz_order
+--
+
+DROP TABLE IF EXISTS c_quiz_order;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_quiz_order (
+  iid bigint unsigned NOT NULL auto_increment,
+  c_id int(10) unsigned NOT NULL,
+  session_id int(10) unsigned NOT NULL,
+  exercise_id int(11) NOT NULL,
+  exercise_order int(11) NOT NULL,
+  PRIMARY KEY (iid)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_quiz_question
+--
+
+DROP TABLE IF EXISTS c_quiz_question;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_quiz_question (
+  iid bigint unsigned NOT NULL auto_increment,
+  c_id int(11) NOT NULL,
+  question text NOT NULL,
+  description text,
+  ponderation float(6,2) NOT NULL DEFAULT '0.00',
+  position mediumint(8) unsigned NOT NULL DEFAULT '1',
+  type tinyint(3) unsigned NOT NULL DEFAULT '2',
+  picture varchar(50) DEFAULT NULL,
+  level int(10) unsigned NOT NULL DEFAULT '0',
+  extra varchar(255) DEFAULT NULL,
+  question_code char(10) DEFAULT '',
+  parent_id int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (iid)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_quiz_category
+--
+
+DROP TABLE IF EXISTS c_quiz_category;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_quiz_category (
+  iid bigint unsigned NOT NULL AUTO_INCREMENT,
+  parent_id int unsigned DEFAULT NULL,
+  c_id int(11) NOT NULL,
+  title varchar(255) NOT NULL,
+  description text NOT NULL,
+  lvl int default NULL,
+  lft int default NULL,
+  rgt int default NULL,
+  root int default NULL,
+  visibility INT default 1,
+  PRIMARY KEY (iid)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_quiz_question_option
+--
+
+DROP TABLE IF EXISTS c_quiz_question_option;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_quiz_question_option (
+  iid bigint unsigned NOT NULL auto_increment,
+  c_id int(11) NOT NULL,
+  question_id int(11) NOT NULL,
+  name varchar(255) DEFAULT NULL,
+  position int(10) unsigned NOT NULL,
+  PRIMARY KEY (iid)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_quiz_question_rel_category
+--
+
+DROP TABLE IF EXISTS c_quiz_question_rel_category;
+CREATE TABLE c_quiz_question_rel_category (
+  iid int unsigned NOT NULL AUTO_INCREMENT,
+  c_id int NOT NULL,
+  question_id int NOT NULL,
+	category_id int NOT NULL,
+  PRIMARY KEY (iid)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+
+DROP TABLE IF EXISTS c_quiz_rel_category;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_quiz_rel_category (
+  iid bigint unsigned NOT NULL AUTO_INCREMENT,
+  c_id int(11) NOT NULL,
+  category_id int(11) NOT NULL,
+  exercise_id int unsigned NOT NULL,
+  count_questions int NOT NULL default 0,
+  PRIMARY KEY (iid)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_quiz_rel_question
+--
+
+DROP TABLE IF EXISTS c_quiz_rel_question;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_quiz_rel_question (
+  iid bigint unsigned NOT NULL AUTO_INCREMENT,
+  c_id int(11) NOT NULL,
+  question_id int(10) unsigned NOT NULL,
+  exercice_id int(10) unsigned NOT NULL,
+  question_order int(10) unsigned NOT NULL DEFAULT '1',
+  PRIMARY KEY (iid)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+ALTER TABLE c_quiz_rel_question ADD INDEX idx_cqrq_id (question_id);
+ALTER TABLE c_quiz_rel_question ADD INDEX idx_cqrq_cidexid (c_id, exercice_id);
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_resource
+--
+
+DROP TABLE IF EXISTS c_resource;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_resource (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  source_type varchar(50) DEFAULT NULL,
+  source_id int(10) unsigned DEFAULT NULL,
+  resource_type varchar(50) DEFAULT NULL,
+  resource_id int(10) unsigned DEFAULT NULL,
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_role
+--
+
+DROP TABLE IF EXISTS c_role;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_role (
+  c_id int(11) NOT NULL,
+  role_id int(11) NOT NULL AUTO_INCREMENT,
+  role_name varchar(250) NOT NULL DEFAULT '',
+  role_comment text,
+  default_role tinyint(4) DEFAULT '0',
+  PRIMARY KEY (c_id,role_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_role_group
+--
+
+DROP TABLE IF EXISTS c_role_group;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_role_group (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  role_id int(11) NOT NULL DEFAULT '0',
+  scope varchar(20) NOT NULL DEFAULT 'course',
+  group_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (id,c_id,group_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_role_permissions
+--
+
+DROP TABLE IF EXISTS c_role_permissions;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_role_permissions (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  role_id int(11) NOT NULL DEFAULT '0',
+  tool varchar(250) NOT NULL DEFAULT '',
+  action varchar(50) NOT NULL DEFAULT '',
+  default_perm tinyint(4) NOT NULL DEFAULT '0',
+  PRIMARY KEY (id,c_id,role_id,tool,action)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_role_user
+--
+
+DROP TABLE IF EXISTS c_role_user;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_role_user (
+  c_id int(11) NOT NULL,
+  role_id int(11) NOT NULL DEFAULT '0',
+  scope varchar(20) NOT NULL DEFAULT 'course',
+  user_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,role_id,user_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_student_publication
+--
+
+DROP TABLE IF EXISTS c_student_publication;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_student_publication (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  url varchar(255) DEFAULT NULL,
+  title varchar(255) DEFAULT NULL,
+  description text,
+  author varchar(255) DEFAULT NULL,
+  active tinyint(4) DEFAULT NULL,
+  accepted tinyint(4) DEFAULT '0',
+  post_group_id int(11) NOT NULL DEFAULT '0',
+  sent_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  filetype set('file','folder') NOT NULL DEFAULT 'file',
+  has_properties int(10) unsigned NOT NULL DEFAULT '0',
+  view_properties tinyint(4) DEFAULT NULL,
+  qualification float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  date_of_qualification datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  parent_id int(10) unsigned NOT NULL DEFAULT '0',
+  qualificator_id int(10) unsigned NOT NULL DEFAULT '0',
+  weight float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  session_id int(10) unsigned NOT NULL DEFAULT '0',
+  user_id int(11) NOT NULL,
+  allow_text_assignment int(11) NOT NULL DEFAULT '0',
+  contains_file int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_student_publication_assignment
+--
+
+DROP TABLE IF EXISTS c_student_publication_assignment;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_student_publication_assignment (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  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(4) NOT NULL,
+  enable_qualification tinyint(4) NOT NULL,
+  publication_id int(11) NOT NULL,
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_survey
+--
+
+DROP TABLE IF EXISTS c_survey;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_survey (
+  c_id int(11) NOT NULL,
+  survey_id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  code varchar(20) DEFAULT NULL,
+  title text,
+  subtitle text,
+  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(11) NOT NULL,
+  answered int(11) 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,
+  shuffle tinyint(1) NOT NULL DEFAULT '0',
+  one_question_per_page tinyint(1) NOT NULL DEFAULT '0',
+  survey_version varchar(255) NOT NULL DEFAULT '',
+  parent_id int(10) unsigned NOT NULL,
+  survey_type int(11) NOT NULL DEFAULT '0',
+  show_form_profile int(11) NOT NULL DEFAULT '0',
+  form_fields text NOT NULL,
+  session_id int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,survey_id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_survey_answer
+--
+
+DROP TABLE IF EXISTS c_survey_answer;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_survey_answer (
+  c_id int(11) NOT NULL,
+  answer_id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  survey_id int(10) unsigned NOT NULL,
+  question_id int(10) unsigned NOT NULL,
+  option_id text NOT NULL,
+  value int(10) unsigned NOT NULL,
+  user varchar(250) NOT NULL,
+  PRIMARY KEY (c_id,answer_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_survey_group
+--
+
+DROP TABLE IF EXISTS c_survey_group;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_survey_group (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  name varchar(20) NOT NULL,
+  description varchar(255) NOT NULL,
+  survey_id int(10) unsigned NOT NULL,
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_survey_invitation
+--
+
+DROP TABLE IF EXISTS c_survey_invitation;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_survey_invitation (
+  c_id int(11) NOT NULL,
+  survey_invitation_id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  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(11) NOT NULL DEFAULT '0',
+  session_id int(10) unsigned NOT NULL DEFAULT '0',
+  group_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,survey_invitation_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_survey_question
+--
+
+DROP TABLE IF EXISTS c_survey_question;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_survey_question (
+  c_id int(11) NOT NULL,
+  question_id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  survey_id int(10) 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(11) NOT NULL,
+  shared_question_id int(11) DEFAULT NULL,
+  max_value int(11) DEFAULT NULL,
+  survey_group_pri int(10) unsigned NOT NULL DEFAULT '0',
+  survey_group_sec1 int(10) unsigned NOT NULL DEFAULT '0',
+  survey_group_sec2 int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,question_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_survey_question_option
+--
+
+DROP TABLE IF EXISTS c_survey_question_option;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_survey_question_option (
+  c_id int(11) NOT NULL,
+  question_option_id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  question_id int(10) unsigned NOT NULL,
+  survey_id int(10) unsigned NOT NULL,
+  option_text text NOT NULL,
+  sort int(11) NOT NULL,
+  value int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,question_option_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_thematic
+--
+
+DROP TABLE IF EXISTS c_thematic;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_thematic (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  title varchar(255) NOT NULL,
+  content text,
+  display_order int(10) unsigned NOT NULL DEFAULT '0',
+  active tinyint(4) NOT NULL DEFAULT '0',
+  session_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY active (active,session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_thematic_advance
+--
+
+DROP TABLE IF EXISTS c_thematic_advance;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_thematic_advance (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  thematic_id int(11) NOT NULL,
+  attendance_id int(11) NOT NULL DEFAULT '0',
+  content text,
+  start_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  duration int(11) NOT NULL DEFAULT '0',
+  done_advance tinyint(4) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY thematic_id (thematic_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_thematic_plan
+--
+
+DROP TABLE IF EXISTS c_thematic_plan;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_thematic_plan (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  thematic_id int(11) NOT NULL,
+  title varchar(255) NOT NULL,
+  description text,
+  description_type int(11) NOT NULL,
+  PRIMARY KEY (c_id,id),
+  KEY thematic_id (thematic_id,description_type)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_tool
+--
+
+DROP TABLE IF EXISTS c_tool;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_tool (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  name varchar(255) NOT NULL,
+  link varchar(255) NOT NULL,
+  image varchar(255) DEFAULT NULL,
+  visibility tinyint(3) unsigned DEFAULT '0',
+  admin varchar(255) DEFAULT NULL,
+  address varchar(255) DEFAULT NULL,
+  added_tool tinyint(3) unsigned DEFAULT '1',
+  target enum('_self','_blank') NOT NULL DEFAULT '_self',
+  category varchar(20) NOT NULL DEFAULT 'authoring',
+  session_id int(11) DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_tool_intro
+--
+
+DROP TABLE IF EXISTS c_tool_intro;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_tool_intro (
+  c_id int(11) NOT NULL,
+  id varchar(50) NOT NULL,
+  intro_text mediumtext NOT NULL,
+  session_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id,session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_userinfo_content
+--
+
+DROP TABLE IF EXISTS c_userinfo_content;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_userinfo_content (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  user_id int(10) unsigned NOT NULL,
+  definition_id int(10) unsigned NOT NULL,
+  editor_ip varchar(39) DEFAULT NULL,
+  edition_time datetime DEFAULT NULL,
+  content text NOT NULL,
+  PRIMARY KEY (c_id,id),
+  KEY user_id (user_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_userinfo_def
+--
+
+DROP TABLE IF EXISTS c_userinfo_def;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_userinfo_def (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  title varchar(80) NOT NULL DEFAULT '',
+  comment text,
+  line_count tinyint(3) unsigned NOT NULL DEFAULT '5',
+  rank tinyint(3) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_wiki
+--
+
+DROP TABLE IF EXISTS c_wiki;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_wiki (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  page_id int(11) NOT NULL DEFAULT '0',
+  reflink varchar(255) NOT NULL DEFAULT 'index',
+  title varchar(255) NOT NULL,
+  content mediumtext NOT NULL,
+  user_id int(11) NOT NULL DEFAULT '0',
+  group_id int(11) DEFAULT NULL,
+  dtime datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  addlock int(11) NOT NULL DEFAULT '1',
+  editlock int(11) NOT NULL DEFAULT '0',
+  visibility int(11) NOT NULL DEFAULT '1',
+  addlock_disc int(11) NOT NULL DEFAULT '1',
+  visibility_disc int(11) NOT NULL DEFAULT '1',
+  ratinglock_disc int(11) NOT NULL DEFAULT '1',
+  assignment int(11) NOT NULL DEFAULT '0',
+  comment text NOT NULL,
+  progress text NOT NULL,
+  score int(11) DEFAULT '0',
+  version int(11) DEFAULT NULL,
+  is_editing int(11) NOT NULL DEFAULT '0',
+  time_edit datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  hits int(11) DEFAULT '0',
+  linksto text NOT NULL,
+  tag text NOT NULL,
+  user_ip varchar(39) NOT NULL,
+  session_id int(11) DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY reflink (reflink),
+  KEY group_id (group_id),
+  KEY page_id (page_id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_wiki_conf
+--
+
+DROP TABLE IF EXISTS c_wiki_conf;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_wiki_conf (
+  c_id int(11) NOT NULL,
+  page_id int(11) 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(11) DEFAULT NULL,
+  max_text int(11) DEFAULT NULL,
+  max_version int(11) 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(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,page_id),
+  KEY page_id (page_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_wiki_discuss
+--
+
+DROP TABLE IF EXISTS c_wiki_discuss;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_wiki_discuss (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  publication_id int(11) NOT NULL DEFAULT '0',
+  userc_id int(11) 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 (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_wiki_mailcue
+--
+
+DROP TABLE IF EXISTS c_wiki_mailcue;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_wiki_mailcue (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL,
+  user_id int(11) NOT NULL,
+  type text NOT NULL,
+  group_id int(11) DEFAULT NULL,
+  session_id int(11) DEFAULT '0',
+  PRIMARY KEY (c_id,id,user_id),
+  KEY c_id (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;

+ 3613 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/db_main.sql

@@ -0,0 +1,3613 @@
+-- MySQL dump 10.9
+--
+-- Host: localhost    Database: chamilo_main
+-- ------------------------------------------------------
+-- Server version	4.1.14
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+DROP TABLE IF EXISTS user;
+CREATE TABLE IF NOT EXISTS user (
+  user_id int unsigned NOT NULL auto_increment,
+  lastname varchar(60) default NULL,
+  firstname varchar(60) default NULL,
+  username varchar(100) NOT NULL default '',
+  password varchar(50) NOT NULL default '',
+  auth_source varchar(50) default 'platform',
+  email varchar(100) default NULL,
+  status tinyint NOT NULL default '5',
+  official_code varchar(40) default NULL,
+  phone varchar(30) default NULL,
+  picture_uri varchar(250) default NULL,
+  creator_id int unsigned default NULL,
+  competences text,
+  diplomas text,
+  openarea text,
+  teach text,
+  productions varchar(250) default NULL,
+  chatcall_user_id int unsigned NOT NULL default '0',
+  chatcall_date datetime NOT NULL default '0000-00-00 00:00:00',
+  chatcall_text varchar(50) NOT NULL default '',
+  language varchar(40) default NULL,
+  registration_date datetime NOT NULL default '0000-00-00 00:00:00',
+  expiration_date datetime NOT NULL default '0000-00-00 00:00:00',
+  active tinyint unsigned NOT NULL default 1,
+  openid varchar(255) DEFAULT NULL,
+  theme varchar(255) DEFAULT NULL,
+  hr_dept_id int unsigned NOT NULL default 0,
+  salt VARCHAR(255) DEFAULT NULL,
+  PRIMARY KEY (user_id),
+  UNIQUE KEY username (username)
+);
+ALTER TABLE user ADD INDEX (status);
+
+
+/*!40000 ALTER TABLE user DISABLE KEYS */;
+LOCK TABLES user WRITE;
+INSERT INTO user (lastname, firstname, username, password, auth_source, email, status, official_code,phone, creator_id, registration_date, expiration_date,active,openid,language) VALUES ('{ADMINLASTNAME}','{ADMINFIRSTNAME}','{ADMINLOGIN}','{ADMINPASSWORD}','{PLATFORM_AUTH_SOURCE}','{ADMINEMAIL}',1,'ADMIN','{ADMINPHONE}',1,NOW(),'0000-00-00 00:00:00','1',NULL,'{ADMINLANGUAGE}');
+-- Insert anonymous user
+INSERT INTO user (lastname, firstname, username, password, auth_source, email, status, official_code, creator_id, registration_date, expiration_date,active,openid,language) VALUES ('Anonymous', 'Joe', '', '', 'platform', 'anonymous@localhost', 6, 'anonymous', 1, NOW(), '0000-00-00 00:00:00', 1,NULL,'{ADMINLANGUAGE}');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE user ENABLE KEYS */;
+
+
+CREATE TABLE roles (
+  id INT auto_increment,
+  name VARCHAR(255),
+  role VARCHAR(255) UNIQUE,
+  PRIMARY KEY(id)
+);
+
+CREATE TABLE users_roles (
+  user_id INT NOT NULL,
+  role_id INT NOT NULL,
+  PRIMARY KEY(user_id, role_id)
+);
+
+
+INSERT INTO roles (id, name, role) VALUES('1', 'Teacher', 'ROLE_TEACHER');
+INSERT INTO roles (id, name, role) VALUES('4', 'RRHH', 'ROLE_RRHH');
+INSERT INTO roles (id, name, role) VALUES('3', 'Session Manager', 'ROLE_SESSION_MANAGER');
+INSERT INTO roles (id ,name, role) VALUES('5', 'Student', 'ROLE_STUDENT');
+INSERT INTO roles (id, name, role) VALUES('6', 'Anonymous', 'ROLE_ANONYMOUS');
+INSERT INTO roles (id, name, role) VALUES('11', 'Admin', 'ROLE_ADMIN');
+INSERT INTO roles (id, name, role) VALUES('17', 'Question Manager', 'ROLE_QUESTION_MANAGER');
+
+-- Admin
+INSERT INTO users_roles VALUES (1, 11);
+
+
+--
+-- Table structure for table admin
+--
+
+DROP TABLE IF EXISTS admin;
+CREATE TABLE IF NOT EXISTS admin (
+  id  INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
+  user_id int unsigned NOT NULL default '0',
+  UNIQUE KEY user_id (user_id)
+);
+
+--
+-- Dumping data for table admin
+--
+
+
+/*!40000 ALTER TABLE admin DISABLE KEYS */;
+LOCK TABLES admin WRITE;
+INSERT INTO admin VALUES (1, 1);
+UNLOCK TABLES;
+/*!40000 ALTER TABLE admin ENABLE KEYS */;
+
+--
+-- Table structure for table class
+--
+
+DROP TABLE IF EXISTS class;
+CREATE TABLE IF NOT EXISTS class (
+  id mediumint unsigned NOT NULL auto_increment,
+  code varchar(40) default '',
+  name text NOT NULL,
+  PRIMARY KEY  (id)
+);
+
+--
+-- Dumping data for table class
+--
+
+
+/*!40000 ALTER TABLE class DISABLE KEYS */;
+LOCK TABLES class WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE class ENABLE KEYS */;
+
+--
+-- Table structure for table class_user
+--
+
+DROP TABLE IF EXISTS class_user;
+CREATE TABLE IF NOT EXISTS class_user (
+  class_id mediumint unsigned NOT NULL default '0',
+  user_id int unsigned NOT NULL default '0',
+  PRIMARY KEY  (class_id,user_id)
+);
+
+--
+-- Dumping data for table class_user
+--
+
+
+/*!40000 ALTER TABLE class_user DISABLE KEYS */;
+LOCK TABLES class_user WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE class_user ENABLE KEYS */;
+
+--
+-- Table structure for table course
+--
+
+DROP TABLE IF EXISTS course;
+CREATE TABLE IF NOT EXISTS course (
+  id int auto_increment,
+  code varchar(40) NOT NULL,
+  directory varchar(40) default NULL,
+  db_name varchar(40) default NULL,
+  course_language varchar(20) default NULL,
+  title varchar(250) default NULL,
+  description text,
+  category_code varchar(40) default NULL,
+  visibility tinyint default '0',
+  show_score int NOT NULL default '1',
+  tutor_name varchar(200) default NULL,
+  visual_code varchar(40) default NULL,
+  department_name varchar(30) default NULL,
+  department_url varchar(180) default NULL,
+  disk_quota bigint unsigned default NULL,
+  last_visit datetime default NULL,
+  last_edit datetime default NULL,
+  creation_date datetime default NULL,
+  expiration_date datetime default NULL,
+  target_course_code varchar(40) default NULL,
+  subscribe tinyint NOT NULL default '1',
+  unsubscribe tinyint NOT NULL default '1',
+  registration_code varchar(255) NOT NULL default '',
+  legal TEXT  NOT NULL,
+  activate_legal INT NOT NULL DEFAULT 0,
+  PRIMARY KEY (id),
+  UNIQUE KEY code (code)
+);
+ALTER TABLE course ADD INDEX idx_course_category_code (category_code);
+ALTER TABLE course ADD INDEX idx_course_directory (directory(10));
+
+--
+-- Dumping data for table course
+--
+
+/*!40000 ALTER TABLE course DISABLE KEYS */;
+LOCK TABLES course WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE course ENABLE KEYS */;
+
+--
+-- Table structure for table course_category
+--
+
+DROP TABLE IF EXISTS course_category;
+CREATE TABLE IF NOT EXISTS course_category (
+  id int unsigned NOT NULL auto_increment,
+  name varchar(100) NOT NULL default '',
+  code varchar(40) NOT NULL default '',
+  parent_id varchar(40) default NULL,
+  tree_pos int unsigned default NULL,
+  children_count smallint default NULL,
+  auth_course_child enum('TRUE','FALSE') default 'TRUE',
+  auth_cat_child enum('TRUE','FALSE') default 'TRUE',
+  PRIMARY KEY  (id),
+  UNIQUE KEY code (code),
+  KEY parent_id (parent_id),
+  KEY tree_pos (tree_pos)
+);
+
+--
+-- Dumping data for table course_category
+--
+
+
+/*!40000 ALTER TABLE course_category DISABLE KEYS */;
+LOCK TABLES course_category WRITE;
+INSERT INTO course_category VALUES (1,'Language skills','LANG',NULL,1,0,'TRUE','TRUE'),(2,'PC Skills','PC',NULL,2,0,'TRUE','TRUE'),(3,'Projects','PROJ',NULL,3,0,'TRUE','TRUE');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE course_category ENABLE KEYS */;
+
+--
+-- Table structure for table course_field
+--
+
+DROP TABLE IF EXISTS course_field;
+CREATE TABLE IF NOT EXISTS course_field (
+    id  int NOT NULL auto_increment,
+    field_type int NOT NULL default 1,
+    field_variable  varchar(64) NOT NULL,
+    field_display_text  varchar(64),
+    field_default_value text,
+    field_order int,
+    field_visible tinyint default 0,
+    field_changeable tinyint default 0,
+    field_filter tinyint default 0,
+    field_loggeable int default 0,
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+-- Special course
+INSERT INTO course_field (field_type, field_variable, field_display_text, field_default_value, field_visible, field_changeable) VALUES (13, 'special_course','Special course', 'Yes', 1 , 1);
+
+--
+-- Table structure for table course_field_options
+--
+
+DROP TABLE IF EXISTS course_field_options;
+CREATE TABLE IF NOT EXISTS course_field_options (
+    id	int NOT NULL auto_increment,
+    field_id int NOT NULL,
+    option_value text,
+    option_display_text varchar(255),
+    option_order int,
+    priority int default NULL,
+    priority_message varchar(255) default NULL,
+    tms	DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY (id)
+);
+
+--
+-- Table structure for table course_field_values
+--
+
+DROP TABLE IF EXISTS course_field_values;
+CREATE TABLE IF NOT EXISTS course_field_values(
+    id bigint NOT NULL auto_increment,
+    course_code varchar(40) NOT NULL,
+    field_id int NOT NULL,
+    field_value text,
+    user_id INT unsigned NOT NULL default 0,
+    comment VARCHAR(100) default '',
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+
+--
+-- Table structure for table course_module
+--
+
+DROP TABLE IF EXISTS course_module;
+CREATE TABLE IF NOT EXISTS course_module (
+  id int unsigned NOT NULL auto_increment,
+  name varchar(255) NOT NULL,
+  link varchar(255) NOT NULL,
+  image varchar(100) default NULL,
+  row_module int unsigned NOT NULL default '0',
+  column_module int unsigned NOT NULL default '0',
+  position varchar(20) NOT NULL default 'basic',
+  PRIMARY KEY  (id)
+);
+
+--
+-- Dumping data for table course_module
+--
+
+
+/*!40000 ALTER TABLE course_module DISABLE KEYS */;
+LOCK TABLES course_module WRITE;
+INSERT INTO course_module VALUES
+(1,'calendar_event','calendar/agenda.php','agenda.gif',1,1,'basic'),
+(2,'link','link/link.php','links.gif',4,1,'basic'),
+(3,'document','document/document.php','documents.gif',3,1,'basic'),
+(4,'student_publication','work/work.php','works.gif',3,2,'basic'),
+(5,'announcement','announcements/announcements.php','valves.gif',2,1,'basic'),
+(6,'user','user/user.php','members.gif',2,3,'basic'),
+(7,'forum','forum/index.php','forum.gif',1,2,'basic'),
+(8,'quiz','exercice/exercice.php','quiz.gif',2,2,'basic'),
+(9,'group','group/group.php','group.gif',3,3,'basic'),
+(10,'course_description','course_description/','info.gif',1,3,'basic'),
+(11,'chat','chat/chat.php','chat.gif',0,0,'external'),
+(12,'dropbox','dropbox/index.php','dropbox.gif',4,2,'basic'),
+(13,'tracking','tracking/courseLog.php','statistics.gif',1,3,'courseadmin'),
+(14,'homepage_link','link/link.php?action=addlink','npage.gif',1,1,'courseadmin'),
+(15,'course_setting','course_info/infocours.php','reference.gif',1,1,'courseadmin'),
+(16,'External','','external.gif',0,0,'external'),
+(17,'AddedLearnpath','','scormbuilder.gif',0,0,'external'),
+(18,'conference','conference/index.php?type=conference','conf.gif',0,0,'external'),
+(19,'conference','conference/index.php?type=classroom','conf.gif',0,0,'external'),
+(20,'learnpath','newscorm/lp_controller.php','scorms.gif',5,1,'basic'),
+(21,'blog','blog/blog.php','blog.gif',1,2,'basic'),
+(22,'blog_management','blog/blog_admin.php','blog_admin.gif',1,2,'courseadmin'),
+(23,'course_maintenance','course_info/maintenance.php','backup.gif',2,3,'courseadmin'),
+(24,'survey','survey/survey_list.php','survey.gif',2,1,'basic'),
+(25,'wiki','wiki/index.php','wiki.gif',2,3,'basic'),
+(26,'gradebook','gradebook/index.php','gradebook.gif',2,2,'basic'),
+(27,'glossary','glossary/index.php','glossary.gif',2,1,'basic'),
+(28,'notebook','notebook/index.php','notebook.gif',2,1,'basic'),
+(29,'attendance','attendance/index.php','attendance.gif',2,1,'basic'),
+(30,'course_progress','course_progress/index.php','course_progress.gif',2,1,'basic');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE course_module ENABLE KEYS */;
+
+--
+-- Table structure for table course_rel_class
+--
+
+DROP TABLE IF EXISTS course_rel_class;
+CREATE TABLE IF NOT EXISTS course_rel_class (
+  course_code char(40) NOT NULL,
+  class_id mediumint unsigned NOT NULL,
+  PRIMARY KEY  (course_code,class_id)
+);
+
+--
+-- Dumping data for table course_rel_class
+--
+
+
+/*!40000 ALTER TABLE course_rel_class DISABLE KEYS */;
+LOCK TABLES course_rel_class WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE course_rel_class ENABLE KEYS */;
+
+--
+-- Table structure for table course_rel_user
+--
+
+DROP TABLE IF EXISTS course_rel_user;
+CREATE TABLE IF NOT EXISTS course_rel_user (
+  id int unsigned AUTO_INCREMENT,
+  c_id INT unsigned NOT NULL,
+  course_code varchar(40) NOT NULL,
+  user_id int unsigned NOT NULL default '0',
+  status tinyint NOT NULL default '5',
+  role varchar(60) default NULL,
+  group_id int NOT NULL default '0',
+  tutor_id int unsigned NOT NULL default '0',
+  sort int default NULL,
+  user_course_cat int default '0',
+  relation_type int default 0,
+  legal_agreement INTEGER DEFAULT 0,
+  PRIMARY KEY(id)
+);
+ALTER TABLE course_rel_user ADD INDEX (user_id);
+ALTER TABLE course_rel_user ADD INDEX (c_id, user_id);
+
+--
+-- Dumping data for table course_rel_user
+--
+
+
+/*!40000 ALTER TABLE course_rel_user DISABLE KEYS */;
+LOCK TABLES course_rel_user WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE course_rel_user ENABLE KEYS */;
+
+--
+-- Table structure for table language
+--
+
+DROP TABLE IF EXISTS language;
+CREATE TABLE IF NOT EXISTS language (
+  id tinyint unsigned NOT NULL auto_increment,
+  original_name varchar(255) default NULL,
+  english_name varchar(255) default NULL,
+  isocode varchar(10) default NULL,
+  dokeos_folder varchar(250) default NULL,
+  available tinyint NOT NULL default 1,
+  parent_id tinyint unsigned,
+  PRIMARY KEY  (id)
+);
+ALTER TABLE language ADD INDEX idx_language_dokeos_folder(dokeos_folder);
+
+--
+-- Dumping data for table language
+--
+
+
+/*!40000 ALTER TABLE language DISABLE KEYS */;
+LOCK TABLES language WRITE;
+INSERT INTO language (original_name, english_name, isocode, dokeos_folder, available) VALUES
+('&#1575;&#1604;&#1593;&#1585;&#1576;&#1610;&#1577;','arabic','ar','arabic',0),
+('Asturianu','asturian','ast','asturian',0),
+('&#2476;&#2494;&#2434;&#2482;&#2494;','bengali','bn','bengali',0),
+('&#1041;&#1098;&#1083;&#1075;&#1072;&#1088;&#1089;&#1082;&#1080;','bulgarian','bg','bulgarian',1),
+('Bosanski','bosnian','bs','bosnian',1),
+('Catal&agrave;','catalan','ca','catalan',0),
+('&#20013;&#25991;&#65288;&#31616;&#20307;&#65289;','simpl_chinese','zh','simpl_chinese',0),
+('&#32321;&#39636;&#20013;&#25991;','trad_chinese','zh-TW','trad_chinese',0),
+('&#268;esky','czech','cs','czech',0),
+('Dansk','danish','da','danish',0),
+('&#1583;&#1585;&#1740;','dari','prs','dari',0),
+('Deutsch','german','de','german',1),
+('&Epsilon;&lambda;&lambda;&eta;&nu;&iota;&kappa;&#940;','greek','el','greek',0),
+('English','english','en','english',1),
+('Espa&ntilde;ol','spanish','es','spanish',1),
+('Esperanto','esperanto','eo','esperanto',0),
+('Euskara','basque','eu','basque',0),
+('&#1601;&#1575;&#1585;&#1587;&#1740;','persian','fa','persian',0),
+('Fran&ccedil;ais','french','fr','french',1),
+('Furlan','friulian','fur','friulian',0),
+('Galego','galician','gl','galician',0),
+('&#4325;&#4304;&#4320;&#4311;&#4323;&#4314;&#4312;','georgian','ka','georgian',0),
+('Hrvatski','croatian','hr','croatian',0),
+('&#1506;&#1489;&#1512;&#1497;&#1514;','hebrew','he','hebrew',0),
+('&#2361;&#2367;&#2344;&#2381;&#2342;&#2368;','hindi','hi','hindi',0),
+('Bahasa Indonesia','indonesian','id','indonesian',1),
+('Italiano','italian','it','italian',1),
+('&#54620;&#44397;&#50612;','korean','ko','korean',0),
+('Latvie&scaron;u','latvian','lv','latvian',0),
+('Lietuvi&#371;','lithuanian','lt','lithuanian',0),
+('&#1052;&#1072;&#1082;&#1077;&#1076;&#1086;&#1085;&#1089;&#1082;&#1080;','macedonian','mk','macedonian',0),
+('Magyar','hungarian','hu','hungarian',1),
+('Bahasa Melayu','malay','ms','malay',0),
+('Nederlands','dutch','nl','dutch',1),
+('&#26085;&#26412;&#35486;','japanese','ja','japanese',0),
+('Norsk','norwegian','no','norwegian',0),
+('Occitan','occitan','oc','occitan',0),
+('&#1662;&#1690;&#1578;&#1608;','pashto','ps','pashto',0),
+('Polski','polish','pl','polish',0),
+('Portugu&ecirc;s europeu','portuguese','pt','portuguese',1),
+('Portugu&ecirc;s do Brasil','brazilian','pt-BR','brazilian',1),
+('Rom&acirc;n&#259;','romanian','ro','romanian',0),
+('Runasimi','quechua_cusco','qu','quechua_cusco',0),
+('&#1056;&#1091;&#1089;&#1089;&#1082;&#1080;&#1081;','russian','ru','russian',0),
+('Sloven&#269;ina','slovak','sk','slovak',0),
+('Sloven&scaron;&#269;ina','slovenian','sl','slovenian',1),
+('&#1575;&#1604;&#1589;&#1608;&#1605;&#1575;&#1604;&#1610;&#1577;','somali','so','somali',0),
+('Srpski','serbian','sr','serbian',0),
+('Suomi','finnish','fi','finnish',0),
+('Svenska','swedish','sv','swedish',0),
+('&#3652;&#3607;&#3618;','thai','th','thai',0),
+('T&uuml;rk&ccedil;e','turkish','tr','turkish',0),
+('&#1059;&#1082;&#1088;&#1072;&#1111;&#1085;&#1089;&#1100;&#1082;&#1072;','ukrainian','uk','ukrainian',0),
+('Ti&#7871;ng Vi&#7879;t','vietnamese','vi','vietnamese',0),
+('Kiswahili','swahili','sw','swahili',0),
+('Yor&ugrave;b&aacute;','yoruba','yo','yoruba',0);
+
+-- The chosen during the installation platform language should be enabled.
+UPDATE language SET available=1 WHERE dokeos_folder = '{PLATFORMLANGUAGE}';
+
+UNLOCK TABLES;
+/*!40000 ALTER TABLE language ENABLE KEYS */;
+
+--
+-- Table structure for table php_session
+--
+
+DROP TABLE IF EXISTS php_session;
+CREATE TABLE IF NOT EXISTS php_session (
+  session_id varchar(32) NOT NULL default '',
+  session_name varchar(10) NOT NULL default '',
+  session_time int NOT NULL default '0',
+  session_start int NOT NULL default '0',
+  session_value mediumtext NOT NULL,
+  PRIMARY KEY (session_id)
+);
+
+--
+-- Table structure for table session
+--
+DROP TABLE IF EXISTS session;
+CREATE TABLE IF NOT EXISTS session (
+  id INT unsigned NOT NULL auto_increment,
+  id_coach int unsigned NOT NULL default '0',
+  name char(150) NOT NULL default '',
+  nbr_courses int unsigned NOT NULL default '0',
+  nbr_users int unsigned NOT NULL default '0',
+  nbr_classes int unsigned NOT NULL default '0',
+  session_admin_id INT UNSIGNED NOT NULL,
+  visibility int NOT NULL default 1,
+  session_category_id int NOT NULL,
+  promotion_id INT NOT NULL,
+  display_start_date datetime default '0000-00-00 00:00:00',
+  display_end_date datetime default '0000-00-00 00:00:00',
+  access_start_date datetime default '0000-00-00 00:00:00',
+  access_end_date datetime default '0000-00-00 00:00:00',
+  coach_access_start_date datetime default '0000-00-00 00:00:00',
+  coach_access_end_date datetime default '0000-00-00 00:00:00',
+  PRIMARY KEY (id),
+  UNIQUE KEY name (name)
+);
+
+ALTER TABLE session ADD INDEX idx_id_coach (id_coach);
+ALTER TABLE session ADD INDEX idx_id_session_admin_id (session_admin_id);
+
+--
+-- Table structure for table session_rel_course
+--
+DROP TABLE IF EXISTS session_rel_course;
+CREATE TABLE IF NOT EXISTS session_rel_course (
+    id INT unsigned NOT NULL auto_increment,
+    id_session INT unsigned NOT NULL default '0',
+    c_id INT NOT NULL default '0',
+    nbr_users int unsigned NOT NULL default '0',
+    PRIMARY KEY(id)
+);
+ALTER TABLE session_rel_course ADD INDEX idx_session_rel_course_course_id (c_id);
+
+--
+-- Table structure for table session_rel_course_rel_user
+--
+DROP TABLE IF EXISTS session_rel_course_rel_user;
+CREATE TABLE IF NOT EXISTS session_rel_course_rel_user (
+  id INT unsigned NOT NULL auto_increment,
+  id_session INT unsigned NOT NULL default '0',
+  c_id INT NOT NULL default '0',
+  id_user int unsigned NOT NULL default '0',
+  visibility int NOT NULL default 1,
+  status int NOT NULL default 0,
+  legal_agreement INTEGER DEFAULT 0,
+  PRIMARY KEY (id)
+);
+
+ALTER TABLE session_rel_course_rel_user ADD INDEX idx_session_rel_course_rel_user_id_user (id_user);
+ALTER TABLE session_rel_course_rel_user ADD INDEX idx_session_rel_course_rel_user_course_id (c_id);
+
+
+
+--
+-- Table structure for table session_rel_user
+--
+DROP TABLE IF EXISTS session_rel_user;
+CREATE TABLE IF NOT EXISTS session_rel_user (
+  id_session mediumint unsigned NOT NULL default '0',
+  id_user int unsigned NOT NULL default '0',
+  relation_type int default 0,
+  moved_to int default 0,
+  moved_status int default 0,
+  moved_at datetime NOT NULL default '0000-00-00 00:00:00',
+  PRIMARY KEY (id_session, id_user, relation_type)
+);
+
+ALTER TABLE session_rel_user ADD INDEX idx_session_rel_user_id_user_moved (id_user, moved_to);
+
+DROP TABLE IF EXISTS session_field;
+CREATE TABLE IF NOT EXISTS session_field (
+    id  int NOT NULL auto_increment,
+    field_type int NOT NULL default 1,
+    field_variable  varchar(64) NOT NULL,
+    field_display_text  varchar(64),
+    field_default_value text,
+    field_order int,
+    field_visible tinyint default 0,
+    field_changeable tinyint default 0,
+    field_filter tinyint default 0,
+    field_loggeable int default 0,
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+DROP TABLE IF EXISTS session_field_options;
+CREATE TABLE IF NOT EXISTS session_field_options(
+    id	int NOT NULL auto_increment,
+    field_id int NOT NULL,
+    option_value text,
+    option_display_text varchar(255),
+    option_order int,
+    priority int default NULL,
+    priority_message varchar(255) default NULL,
+    tms	DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY (id)
+);
+
+DROP TABLE IF EXISTS session_field_values;
+CREATE TABLE IF NOT EXISTS session_field_values(
+    id bigint NOT NULL auto_increment,
+    session_id int NOT NULL,
+    field_id int NOT NULL,
+    field_value text,
+    user_id INT unsigned NOT NULL default 0,
+    comment VARCHAR(100) default '',
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+ALTER TABLE session_field_options ADD INDEX idx_session_field_options_field_id(field_id);
+ALTER TABLE session_field_values ADD INDEX idx_session_field_values_session_id(session_id);
+ALTER TABLE session_field_values ADD INDEX idx_session_field_values_field_id(field_id);
+
+--
+-- Table structure for table settings_current
+--
+
+DROP TABLE IF EXISTS settings_current;
+CREATE TABLE IF NOT EXISTS settings_current (
+  id int unsigned NOT NULL auto_increment,
+  variable varchar(255) default NULL,
+  subkey varchar(255) default NULL,
+  type varchar(255) default NULL,
+  category varchar(255) default NULL,
+  selected_value varchar(255) default NULL,
+  title varchar(255) NOT NULL default '',
+  comment varchar(255) default NULL,
+  scope varchar(50) default NULL,
+  subkeytext varchar(255) default NULL,
+  access_url int unsigned not null default 1,
+  access_url_changeable int unsigned not null default 0,
+  access_url_locked int not null default 0,
+  PRIMARY KEY id (id),
+  INDEX (access_url)
+);
+
+ALTER TABLE settings_current ADD UNIQUE unique_setting (variable(110), subkey(110), category(110), access_url);
+ALTER TABLE settings_current ADD INDEX idx_settings_current_au_cat (access_url, category(5));
+
+--
+-- Dumping data for table settings_current
+--
+
+/*!40000 ALTER TABLE settings_current DISABLE KEYS */;
+LOCK TABLES settings_current WRITE;
+INSERT INTO settings_current
+(variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable)
+VALUES
+('Institution',NULL,'textfield','Platform','{ORGANISATIONNAME}','InstitutionTitle','InstitutionComment','platform',NULL, 1),
+('InstitutionUrl',NULL,'textfield','Platform','{ORGANISATIONURL}','InstitutionUrlTitle','InstitutionUrlComment',NULL,NULL, 1),
+('siteName',NULL,'textfield','Platform','{CAMPUSNAME}','SiteNameTitle','SiteNameComment',NULL,NULL, 1),
+('emailAdministrator',NULL,'textfield','Platform','{ADMINEMAIL}','emailAdministratorTitle','emailAdministratorComment',NULL,NULL, 1),
+('administratorSurname',NULL,'textfield','Platform','{ADMINLASTNAME}','administratorSurnameTitle','administratorSurnameComment',NULL,NULL, 1),
+('administratorName',NULL,'textfield','Platform','{ADMINFIRSTNAME}','administratorNameTitle','administratorNameComment',NULL,NULL, 1),
+('show_administrator_data',NULL,'radio','Platform','true','ShowAdministratorDataTitle','ShowAdministratorDataComment',NULL,NULL, 1),
+('show_tutor_data',NULL,'radio','Session','true','ShowTutorDataTitle','ShowTutorDataComment',NULL,NULL, 1),
+('show_teacher_data',NULL,'radio','Platform','true','ShowTeacherDataTitle','ShowTeacherDataComment',NULL,NULL, 1),
+('homepage_view',NULL,'radio','Course','activity_big','HomepageViewTitle','HomepageViewComment',NULL,NULL, 1),
+('show_toolshortcuts',NULL,'radio','Course','false','ShowToolShortcutsTitle','ShowToolShortcutsComment',NULL,NULL, 0),
+('allow_group_categories',NULL,'radio','Course','false','AllowGroupCategories','AllowGroupCategoriesComment',NULL,NULL, 0),
+('platformLanguage',NULL,'link','Languages','{PLATFORMLANGUAGE}','PlatformLanguageTitle','PlatformLanguageComment',NULL,NULL, 0),
+('showonline','world','checkbox','Platform','true','ShowOnlineTitle','ShowOnlineComment',NULL,'ShowOnlineWorld', 0),
+('showonline','users','checkbox','Platform','true','ShowOnlineTitle','ShowOnlineComment',NULL,'ShowOnlineUsers', 0),
+('showonline','course','checkbox','Platform','true','ShowOnlineTitle','ShowOnlineComment',NULL,'ShowOnlineCourse', 0),
+('showonline','session','checkbox','Platform','true','ShowOnlineTitle','ShowOnlineComment',NULL,'ShowOnlineSession', 0),
+('profile','name','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'name', 0),
+('profile','officialcode','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'officialcode', 0),
+('profile','email','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'Email', 0),
+('profile','picture','checkbox','User','true','ProfileChangesTitle','ProfileChangesComment',NULL,'UserPicture', 0),
+('profile','login','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'Login', 0),
+('profile','password','checkbox','User','true','ProfileChangesTitle','ProfileChangesComment',NULL,'UserPassword', 0),
+('profile','language','checkbox','User','true','ProfileChangesTitle','ProfileChangesComment',NULL,'Language', 0),
+('default_document_quotum',NULL,'textfield','Course','100000000','DefaultDocumentQuotumTitle','DefaultDocumentQuotumComment',NULL,NULL, 0),
+('registration','officialcode','checkbox','User','false','RegistrationRequiredFormsTitle','RegistrationRequiredFormsComment',NULL,'OfficialCode', 0),
+('registration','email','checkbox','User','true','RegistrationRequiredFormsTitle','RegistrationRequiredFormsComment',NULL,'Email', 0),
+('registration','language','checkbox','User','true','RegistrationRequiredFormsTitle','RegistrationRequiredFormsComment',NULL,'Language', 0),
+('default_group_quotum',NULL,'textfield','Course','5000000','DefaultGroupQuotumTitle','DefaultGroupQuotumComment',NULL,NULL, 0),
+('allow_registration',NULL,'radio','Platform','{ALLOWSELFREGISTRATION}','AllowRegistrationTitle','AllowRegistrationComment',NULL,NULL, 0),
+('allow_registration_as_teacher',NULL,'radio','Platform','{ALLOWTEACHERSELFREGISTRATION}','AllowRegistrationAsTeacherTitle','AllowRegistrationAsTeacherComment',NULL,NULL, 0),
+('allow_lostpassword',NULL,'radio','Platform','true','AllowLostPasswordTitle','AllowLostPasswordComment',NULL,NULL, 0),
+('allow_user_headings',NULL,'radio','Course','false','AllowUserHeadings','AllowUserHeadingsComment',NULL,NULL, 0),
+('course_create_active_tools','course_description','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'CourseDescription', 0),
+('course_create_active_tools','agenda','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Agenda', 0),
+('course_create_active_tools','documents','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Documents', 0),
+('course_create_active_tools','learning_path','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'LearningPath', 0),
+('course_create_active_tools','links','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Links', 0),
+('course_create_active_tools','announcements','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Announcements', 0),
+('course_create_active_tools','forums','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Forums', 0),
+('course_create_active_tools','dropbox','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Dropbox', 0),
+('course_create_active_tools','quiz','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Quiz', 0),
+('course_create_active_tools','users','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Users', 0),
+('course_create_active_tools','groups','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Groups', 0),
+('course_create_active_tools','chat','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Chat', 0),
+('course_create_active_tools','online_conference','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'OnlineConference', 0),
+('course_create_active_tools','student_publications','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'StudentPublications', 0),
+('allow_personal_agenda',NULL,'radio','User','true','AllowPersonalAgendaTitle','AllowPersonalAgendaComment',NULL,NULL, 0),
+('display_coursecode_in_courselist',NULL,'radio','Platform','false','DisplayCourseCodeInCourselistTitle','DisplayCourseCodeInCourselistComment',NULL,NULL, 0),
+('display_teacher_in_courselist',NULL,'radio','Platform','true','DisplayTeacherInCourselistTitle','DisplayTeacherInCourselistComment',NULL,NULL, 0),
+('permanently_remove_deleted_files',NULL,'radio','Tools','false','PermanentlyRemoveFilesTitle','PermanentlyRemoveFilesComment',NULL,NULL, 0),
+('dropbox_allow_overwrite',NULL,'radio','Tools','true','DropboxAllowOverwriteTitle','DropboxAllowOverwriteComment',NULL,NULL, 0),
+('dropbox_max_filesize',NULL,'textfield','Tools','100000000','DropboxMaxFilesizeTitle','DropboxMaxFilesizeComment',NULL,NULL, 0),
+('dropbox_allow_just_upload',NULL,'radio','Tools','true','DropboxAllowJustUploadTitle','DropboxAllowJustUploadComment',NULL,NULL, 0),
+('dropbox_allow_student_to_student',NULL,'radio','Tools','true','DropboxAllowStudentToStudentTitle','DropboxAllowStudentToStudentComment',NULL,NULL, 0),
+('dropbox_allow_group',NULL,'radio','Tools','true','DropboxAllowGroupTitle','DropboxAllowGroupComment',NULL,NULL, 0),
+('dropbox_allow_mailing',NULL,'radio','Tools','false','DropboxAllowMailingTitle','DropboxAllowMailingComment',NULL,NULL, 0),
+('administratorTelephone',NULL,'textfield','Platform','(000) 001 02 03','administratorTelephoneTitle','administratorTelephoneComment',NULL,NULL, 1),
+('extended_profile',NULL,'radio','User','false','ExtendedProfileTitle','ExtendedProfileComment',NULL,NULL, 0),
+('student_view_enabled',NULL,'radio','Platform','true','StudentViewEnabledTitle','StudentViewEnabledComment',NULL,NULL, 0),
+('show_navigation_menu',NULL,'radio','Course','false','ShowNavigationMenuTitle','ShowNavigationMenuComment',NULL,NULL, 0),
+('enable_tool_introduction',NULL,'radio','course','false','EnableToolIntroductionTitle','EnableToolIntroductionComment',NULL,NULL, 0),
+('page_after_login', NULL, 'radio','Platform','user_portal.php', 'PageAfterLoginTitle','PageAfterLoginComment', NULL, NULL, 0),
+('time_limit_whosonline', NULL, 'textfield','Platform','30', 'TimeLimitWhosonlineTitle','TimeLimitWhosonlineComment', NULL, NULL, 0),
+('breadcrumbs_course_homepage', NULL, 'radio','Course','course_title', 'BreadCrumbsCourseHomepageTitle','BreadCrumbsCourseHomepageComment', NULL, NULL, 0),
+('example_material_course_creation', NULL, 'radio','Platform','true', 'ExampleMaterialCourseCreationTitle','ExampleMaterialCourseCreationComment', NULL, NULL, 0),
+('account_valid_duration',NULL, 'textfield','Platform','3660', 'AccountValidDurationTitle','AccountValidDurationComment', NULL, NULL, 0),
+('use_session_mode', NULL, 'radio','Session','true', 'UseSessionModeTitle','UseSessionModeComment', NULL, NULL, 0),
+('allow_email_editor', NULL, 'radio', 'Tools', 'false', 'AllowEmailEditorTitle', 'AllowEmailEditorComment', NULL, NULL, 0),
+('registered', NULL, 'textfield', NULL, 'false', NULL, NULL, NULL, NULL, 0),
+('donotlistcampus', NULL, 'textfield', NULL, 'false', NULL, NULL, NULL, NULL,0 ),
+('show_email_addresses', NULL,'radio','Platform','false','ShowEmailAddresses','ShowEmailAddressesComment',NULL,NULL, 1),
+('profile','phone','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'phone', 0),
+('service_visio', 'active', 'radio',NULL,'false', 'VisioEnable','', NULL, NULL, 0),
+('service_visio', 'visio_host', 'textfield',NULL,'', 'VisioHost','', NULL, NULL, 0),
+('service_visio', 'visio_port', 'textfield',NULL,'1935', 'VisioPort','', NULL, NULL, 0),
+('service_visio', 'visio_pass', 'textfield',NULL,'', 'VisioPassword','', NULL, NULL, 0),
+('service_ppt2lp', 'active', 'radio',NULL,'false', 'ppt2lp_actived','', NULL, NULL, 0),
+('service_ppt2lp', 'host', 'textfield', NULL, NULL, 'Host', NULL, NULL, NULL, 0),
+('service_ppt2lp', 'port', 'textfield', NULL, 2002, 'Port', NULL, NULL, NULL, 0),
+('service_ppt2lp', 'user', 'textfield', NULL, NULL, 'UserOnHost', NULL, NULL, NULL, 0),
+('service_ppt2lp', 'ftp_password', 'textfield', NULL, NULL, 'FtpPassword', NULL, NULL, NULL, 0),
+('service_ppt2lp', 'path_to_lzx', 'textfield', NULL, NULL, '', NULL, NULL, NULL, 0),
+('service_ppt2lp', 'size', 'radio', NULL, '720x540', '', NULL, NULL, NULL, 0),
+('wcag_anysurfer_public_pages', NULL, 'radio','Editor','false','PublicPagesComplyToWAITitle','PublicPagesComplyToWAIComment', NULL, NULL, 0),
+('stylesheets', NULL, 'textfield','stylesheets','chamilo','',NULL, NULL, NULL, 1),
+('upload_extensions_list_type', NULL, 'radio', 'Security', 'blacklist', 'UploadExtensionsListType', 'UploadExtensionsListTypeComment', NULL, NULL, 0),
+('upload_extensions_blacklist', NULL, 'textfield', 'Security', '', 'UploadExtensionsBlacklist', 'UploadExtensionsBlacklistComment', NULL, NULL, 0),
+('upload_extensions_whitelist', NULL, 'textfield', 'Security', 'htm;html;jpg;jpeg;gif;png;swf;avi;mpg;mpeg;mov;flv;doc;docx;xls;xlsx;ppt;pptx;odt;odp;ods;pdf', 'UploadExtensionsWhitelist', 'UploadExtensionsWhitelistComment', NULL, NULL, 0),
+('upload_extensions_skip', NULL, 'radio', 'Security', 'true', 'UploadExtensionsSkip', 'UploadExtensionsSkipComment', NULL, NULL, 0),
+('upload_extensions_replace_by', NULL, 'textfield', 'Security', 'dangerous', 'UploadExtensionsReplaceBy', 'UploadExtensionsReplaceByComment', NULL, NULL, 0),
+('show_number_of_courses', NULL, 'radio','Platform','false', 'ShowNumberOfCourses','ShowNumberOfCoursesComment', NULL, NULL, 0),
+('show_empty_course_categories', NULL, 'radio','Platform','true', 'ShowEmptyCourseCategories','ShowEmptyCourseCategoriesComment', NULL, NULL, 0),
+('show_back_link_on_top_of_tree', NULL, 'radio','Platform','false', 'ShowBackLinkOnTopOfCourseTree','ShowBackLinkOnTopOfCourseTreeComment', NULL, NULL, 0),
+('show_different_course_language', NULL, 'radio','Platform','true', 'ShowDifferentCourseLanguage','ShowDifferentCourseLanguageComment', NULL, NULL, 1),
+('split_users_upload_directory', NULL, 'radio','Tuning','true', 'SplitUsersUploadDirectory','SplitUsersUploadDirectoryComment', NULL, NULL, 0),
+('hide_dltt_markup', NULL, 'radio','Languages','true', 'HideDLTTMarkup','HideDLTTMarkupComment', NULL, NULL, 0),
+('display_categories_on_homepage',NULL,'radio','Platform','false','DisplayCategoriesOnHomepageTitle','DisplayCategoriesOnHomepageComment',NULL,NULL, 1),
+('permissions_for_new_directories', NULL, 'textfield', 'Security', '0777', 'PermissionsForNewDirs', 'PermissionsForNewDirsComment', NULL, NULL, 0),
+('permissions_for_new_files', NULL, 'textfield', 'Security', '0666', 'PermissionsForNewFiles', 'PermissionsForNewFilesComment', NULL, NULL, 0),
+('show_tabs', 'campus_homepage', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsCampusHomepage', 1),
+('show_tabs', 'my_courses', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsMyCourses', 1),
+('show_tabs', 'reporting', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsReporting', 1),
+('show_tabs', 'platform_administration', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsPlatformAdministration', 1),
+('show_tabs', 'my_agenda', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsMyAgenda', 1),
+('show_tabs', 'my_profile', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsMyProfile', 1),
+('default_forum_view', NULL, 'radio', 'Course', 'flat', 'DefaultForumViewTitle','DefaultForumViewComment',NULL,NULL, 0),
+('platform_charset',NULL,'textfield','Languages','UTF-8','PlatformCharsetTitle','PlatformCharsetComment','platform',NULL, 0),
+('noreply_email_address', '', 'textfield', 'Platform', '', 'NoReplyEmailAddress', 'NoReplyEmailAddressComment', NULL, NULL, 0),
+('survey_email_sender_noreply', '', 'radio', 'Course', 'coach', 'SurveyEmailSenderNoReply', 'SurveyEmailSenderNoReplyComment', NULL, NULL, 0),
+('openid_authentication',NULL,'radio','Security','false','OpenIdAuthentication','OpenIdAuthenticationComment',NULL,NULL, 0),
+('profile','openid','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'OpenIDURL', 0),
+('gradebook_enable',NULL,'radio','Gradebook','false','GradebookActivation','GradebookActivationComment',NULL,NULL, 0),
+('show_tabs','my_gradebook','checkbox','Platform','true','ShowTabsTitle','ShowTabsComment',NULL,'TabsMyGradebook', 1),
+('gradebook_score_display_coloring','my_display_coloring','checkbox','Gradebook','false','GradebookScoreDisplayColoring','GradebookScoreDisplayColoringComment',NULL,'TabsGradebookEnableColoring', 0),
+('gradebook_score_display_custom','my_display_custom','checkbox','Gradebook','false','GradebookScoreDisplayCustom','GradebookScoreDisplayCustomComment',NULL,'TabsGradebookEnableCustom', 0),
+('gradebook_score_display_colorsplit',NULL,'textfield','Gradebook','50','GradebookScoreDisplayColorSplit','GradebookScoreDisplayColorSplitComment',NULL,NULL, 0),
+('gradebook_score_display_upperlimit','my_display_upperlimit','checkbox','Gradebook','false','GradebookScoreDisplayUpperLimit','GradebookScoreDisplayUpperLimitComment',NULL,'TabsGradebookEnableUpperLimit', 0),
+('gradebook_number_decimals', NULL, 'select', 'Gradebook', '0', 'GradebookNumberDecimals', 'GradebookNumberDecimalsComment', NULL, NULL, 0),
+('user_selected_theme',NULL,'radio','Platform','false','UserThemeSelection','UserThemeSelectionComment',NULL,NULL, 0),
+('profile','theme','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'UserTheme', 0),
+('allow_course_theme',NULL,'radio','Course','true','AllowCourseThemeTitle','AllowCourseThemeComment',NULL,NULL, 0),
+('display_mini_month_calendar',NULL,'radio','Tools', 'true', 'DisplayMiniMonthCalendarTitle', 'DisplayMiniMonthCalendarComment', NULL, NULL, 0),
+('display_upcoming_events',NULL,'radio','Tools','true','DisplayUpcomingEventsTitle','DisplayUpcomingEventsComment',NULL,NULL, 0),
+('number_of_upcoming_events',NULL,'textfield','Tools','1','NumberOfUpcomingEventsTitle','NumberOfUpcomingEventsComment',NULL,NULL, 0),
+('show_closed_courses',NULL,'radio','Platform','false','ShowClosedCoursesTitle','ShowClosedCoursesComment',NULL,NULL, 0),
+('service_visio', 'visio_use_rtmpt', 'radio',null,'false', 'VisioUseRtmptTitle','VisioUseRtmptComment', NULL, NULL, 0),
+('extendedprofile_registration', 'mycomptetences', 'checkbox','User','false', 'ExtendedProfileRegistrationTitle','ExtendedProfileRegistrationComment', NULL, 'MyCompetences', 0),
+('extendedprofile_registration', 'mydiplomas', 'checkbox','User','false', 'ExtendedProfileRegistrationTitle','ExtendedProfileRegistrationComment', NULL, 'MyDiplomas', 0),
+('extendedprofile_registration', 'myteach', 'checkbox','User','false', 'ExtendedProfileRegistrationTitle','ExtendedProfileRegistrationComment', NULL, 'MyTeach', 0),
+('extendedprofile_registration', 'mypersonalopenarea', 'checkbox','User','false', 'ExtendedProfileRegistrationTitle','ExtendedProfileRegistrationComment', NULL, 'MyPersonalOpenArea', 0),
+('extendedprofile_registrationrequired', 'mycomptetences', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyCompetences', 0),
+('extendedprofile_registrationrequired', 'mydiplomas', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyDiplomas', 0),
+('extendedprofile_registrationrequired', 'myteach', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyTeach', 0),
+('extendedprofile_registrationrequired', 'mypersonalopenarea', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyPersonalOpenArea', 0),
+('registration','phone','textfield','User','false','RegistrationRequiredFormsTitle','RegistrationRequiredFormsComment',NULL,'Phone', 0),
+('add_users_by_coach',NULL,'radio','Session','false','AddUsersByCoachTitle','AddUsersByCoachComment',NULL,NULL, 0),
+('extend_rights_for_coach',NULL,'radio','Security','false','ExtendRightsForCoachTitle','ExtendRightsForCoachComment',NULL,NULL, 0),
+('extend_rights_for_coach_on_survey',NULL,'radio','Security','true','ExtendRightsForCoachOnSurveyTitle','ExtendRightsForCoachOnSurveyComment',NULL,NULL, 0),
+('course_create_active_tools','wiki','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Wiki', 0),
+('show_session_coach', NULL, 'radio','Session','false', 'ShowSessionCoachTitle','ShowSessionCoachComment', NULL, NULL, 0),
+('course_create_active_tools','gradebook','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Gradebook', 0),
+('allow_users_to_create_courses',NULL,'radio','Platform','true','AllowUsersToCreateCoursesTitle','AllowUsersToCreateCoursesComment',NULL,NULL, 0),
+('course_create_active_tools','survey','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Survey', 0),
+('course_create_active_tools','glossary','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Glossary', 0),
+('course_create_active_tools','notebook','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Notebook', 0),
+('course_create_active_tools','attendances','checkbox','Tools','false','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Attendances', 0),
+('course_create_active_tools','course_progress','checkbox','Tools','false','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'CourseProgress', 0),
+('advanced_filemanager',NULL,'radio','Editor','true','AdvancedFileManagerTitle','AdvancedFileManagerComment',NULL,NULL, 1),
+('allow_reservation', NULL, 'radio', 'Tools', 'false', 'AllowReservationTitle', 'AllowReservationComment', NULL, NULL, 0),
+('profile','apikeys','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'ApiKeys', 0),
+('allow_message_tool', NULL, 'radio', 'Tools', 'true', 'AllowMessageToolTitle', 'AllowMessageToolComment', NULL, NULL,1),
+('allow_social_tool', NULL, 'radio', 'Tools', 'true', 'AllowSocialToolTitle', 'AllowSocialToolComment', NULL, NULL,1),
+('allow_students_to_browse_courses',NULL,'radio','Platform','true','AllowStudentsToBrowseCoursesTitle','AllowStudentsToBrowseCoursesComment',NULL,NULL, 1),
+('show_session_data', NULL, 'radio', 'Session', 'false', 'ShowSessionDataTitle', 'ShowSessionDataComment', NULL, NULL, 1),
+('allow_use_sub_language', NULL, 'radio', 'Languages', 'false', 'AllowUseSubLanguageTitle', 'AllowUseSubLanguageComment', NULL, NULL,0),
+('show_glossary_in_documents', NULL, 'radio', 'Course', 'none', 'ShowGlossaryInDocumentsTitle', 'ShowGlossaryInDocumentsComment', NULL, NULL,1),
+('allow_terms_conditions', NULL, 'radio', 'Platform', 'false', 'AllowTermsAndConditionsTitle', 'AllowTermsAndConditionsComment', NULL, NULL,0),
+('course_create_active_tools','enable_search','checkbox','Tools','false','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Search',0),
+('search_enabled',NULL,'radio','Search','false','EnableSearchTitle','EnableSearchComment',NULL,NULL,1),
+('search_prefilter_prefix',NULL, NULL,'Search','','SearchPrefilterPrefix','SearchPrefilterPrefixComment',NULL,NULL,0),
+('search_show_unlinked_results',NULL,'radio','Search','true','SearchShowUnlinkedResultsTitle','SearchShowUnlinkedResultsComment',NULL,NULL,1),
+('show_courses_descriptions_in_catalog', NULL, 'radio', 'Course', 'true', 'ShowCoursesDescriptionsInCatalogTitle', 'ShowCoursesDescriptionsInCatalogComment', NULL, NULL, 1),
+('allow_coach_to_edit_course_session',NULL,'radio','Session','true','AllowCoachsToEditInsideTrainingSessions','AllowCoachsToEditInsideTrainingSessionsComment',NULL,NULL, 0),
+('show_glossary_in_extra_tools', NULL, 'radio', 'Course', 'false', 'ShowGlossaryInExtraToolsTitle', 'ShowGlossaryInExtraToolsComment', NULL, NULL,1),
+('send_email_to_admin_when_create_course',NULL,'radio','Platform','false','SendEmailToAdminTitle','SendEmailToAdminComment',NULL,NULL, 1),
+('go_to_course_after_login',NULL,'radio','Course','false','GoToCourseAfterLoginTitle','GoToCourseAfterLoginComment',NULL,NULL, 0),
+('math_mimetex',NULL,'radio','Editor','false','MathMimetexTitle','MathMimetexComment',NULL,NULL, 0),
+('math_asciimathML',NULL,'radio','Editor','false','MathASCIImathMLTitle','MathASCIImathMLComment',NULL,NULL, 0),
+('enabled_asciisvg',NULL,'radio','Editor','false','AsciiSvgTitle','AsciiSvgComment',NULL,NULL, 0),
+('include_asciimathml_script',NULL,'radio','Editor','false','IncludeAsciiMathMlTitle','IncludeAsciiMathMlComment',NULL,NULL, 0),
+('youtube_for_students',NULL,'radio','Editor','true','YoutubeForStudentsTitle','YoutubeForStudentsComment',NULL,NULL, 0),
+('block_copy_paste_for_students',NULL,'radio','Editor','false','BlockCopyPasteForStudentsTitle','BlockCopyPasteForStudentsComment',NULL,NULL, 0),
+('more_buttons_maximized_mode',NULL,'radio','Editor','true','MoreButtonsForMaximizedModeTitle','MoreButtonsForMaximizedModeComment',NULL,NULL, 0),
+('students_download_folders',NULL,'radio','Tools','true','AllowStudentsDownloadFoldersTitle','AllowStudentsDownloadFoldersComment',NULL,NULL, 0),
+('users_copy_files',NULL,'radio','Tools','true','AllowUsersCopyFilesTitle','AllowUsersCopyFilesComment',NULL,NULL, 1),
+('show_tabs', 'social', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsSocial', 0),
+('allow_students_to_create_groups_in_social',NULL,'radio','Tools','false','AllowStudentsToCreateGroupsInSocialTitle','AllowStudentsToCreateGroupsInSocialComment',NULL,NULL, 0),
+('allow_send_message_to_all_platform_users',NULL,'radio','Tools','true','AllowSendMessageToAllPlatformUsersTitle','AllowSendMessageToAllPlatformUsersComment',NULL,NULL, 0),
+('message_max_upload_filesize',NULL,'textfield','Tools','20971520','MessageMaxUploadFilesizeTitle','MessageMaxUploadFilesizeComment',NULL,NULL, 0),
+('show_tabs', 'dashboard', 'checkbox', 'Platform', 'true', 'ShowTabsTitle', 'ShowTabsComment', NULL, 'TabsDashboard', 1),
+('use_users_timezone', 'timezones', 'radio', 'Timezones', 'true', 'UseUsersTimezoneTitle','UseUsersTimezoneComment',NULL,'Timezones', 1),
+('timezone_value', 'timezones', 'select', 'Timezones', '', 'TimezoneValueTitle','TimezoneValueComment',NULL,'Timezones', 1),
+('allow_user_course_subscription_by_course_admin', NULL, 'radio', 'Security', 'true', 'AllowUserCourseSubscriptionByCourseAdminTitle', 'AllowUserCourseSubscriptionByCourseAdminComment', NULL, NULL, 1),
+('show_link_bug_notification', NULL, 'radio', 'Platform', 'true', 'ShowLinkBugNotificationTitle', 'ShowLinkBugNotificationComment', NULL, NULL, 0),
+('course_validation', NULL, 'radio', 'Platform', 'false', 'EnableCourseValidation', 'EnableCourseValidationComment', NULL, NULL, 1),
+('course_validation_terms_and_conditions_url', NULL, 'textfield', 'Platform', '', 'CourseValidationTermsAndConditionsLink', 'CourseValidationTermsAndConditionsLinkComment', NULL, NULL, 1),
+('sso_authentication',NULL,'radio','Security','false','EnableSSOTitle','EnableSSOComment',NULL,NULL,1),
+('sso_authentication_domain',NULL,'textfield','Security','','SSOServerDomainTitle','SSOServerDomainComment',NULL,NULL,1),
+('sso_authentication_auth_uri',NULL,'textfield','Security','/?q=user','SSOServerAuthURITitle','SSOServerAuthURIComment',NULL,NULL,1),
+('sso_authentication_unauth_uri',NULL,'textfield','Security','/?q=logout','SSOServerUnAuthURITitle','SSOServerUnAuthURIComment',NULL,NULL,1),
+('sso_authentication_protocol',NULL,'radio','Security','http://','SSOServerProtocolTitle','SSOServerProtocolComment',NULL,NULL,1),
+('enabled_wiris',NULL,'radio','Editor','false','EnabledWirisTitle','EnabledWirisComment',NULL,NULL, 0),
+('allow_spellcheck',NULL,'radio','Editor','false','AllowSpellCheckTitle','AllowSpellCheckComment',NULL,NULL, 0),
+('force_wiki_paste_as_plain_text',NULL,'radio','Editor','false','ForceWikiPasteAsPlainTextTitle','ForceWikiPasteAsPlainTextComment',NULL,NULL, 0),
+('enabled_googlemaps',NULL,'radio','Editor','false','EnabledGooglemapsTitle','EnabledGooglemapsComment',NULL,NULL, 0),
+('enabled_imgmap',NULL,'radio','Editor','true','EnabledImageMapsTitle','EnabledImageMapsComment',NULL,NULL, 0),
+('enabled_support_svg',				NULL,'radio',		'Tools',	'true',	'EnabledSVGTitle','EnabledSVGComment',NULL,NULL, 0),
+('pdf_export_watermark_enable',		NULL,'radio',		'Platform',	'false','PDFExportWatermarkEnableTitle',	'PDFExportWatermarkEnableComment',	'platform',NULL, 1),
+('pdf_export_watermark_by_course',	NULL,'radio',		'Platform',	'false','PDFExportWatermarkByCourseTitle',	'PDFExportWatermarkByCourseComment','platform',NULL, 1),
+('pdf_export_watermark_text',		NULL,'textfield',	'Platform',	'',		'PDFExportWatermarkTextTitle',		'PDFExportWatermarkTextComment',	'platform',NULL, 1),
+('enabled_insertHtml',				NULL,'radio',		'Editor',	'true','EnabledInsertHtmlTitle',			'EnabledInsertHtmlComment',NULL,NULL, 0),
+('students_export2pdf',				NULL,'radio',		'Tools',	'true',	'EnabledStudentExport2PDFTitle',	'EnabledStudentExport2PDFComment',NULL,NULL, 0),
+('exercise_min_score', 				NULL,'textfield',	'Course',	'',		'ExerciseMinScoreTitle',			'ExerciseMinScoreComment','platform',NULL, 	1),
+('exercise_max_score', 				NULL,'textfield',	'Course',	'',		'ExerciseMaxScoreTitle',			'ExerciseMaxScoreComment','platform',NULL, 	1),
+('show_users_folders',				NULL,'radio',		'Tools',	'true',	'ShowUsersFoldersTitle','ShowUsersFoldersComment',NULL,NULL, 0),
+('show_default_folders',			NULL,'radio',		'Tools',	'true',	'ShowDefaultFoldersTitle','ShowDefaultFoldersComment',NULL,NULL, 0),
+('show_chat_folder',				NULL,'radio',		'Tools',	'true',	'ShowChatFolderTitle','ShowChatFolderComment',NULL,NULL, 0),
+('enabled_text2audio',				NULL,'radio',		'Tools',	'false',	'Text2AudioTitle','Text2AudioComment',NULL,NULL, 0),
+('course_hide_tools','course_description','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'CourseDescription', 1),
+('course_hide_tools','calendar_event','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Agenda', 1),
+('course_hide_tools','document','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Documents', 1),
+('course_hide_tools','learnpath','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'LearningPath', 1),
+('course_hide_tools','link','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Links', 1),
+('course_hide_tools','announcement','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Announcements', 1),
+('course_hide_tools','forum','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Forums', 1),
+('course_hide_tools','dropbox','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Dropbox', 1),
+('course_hide_tools','quiz','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Quiz', 1),
+('course_hide_tools','user','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Users', 1),
+('course_hide_tools','group','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Groups', 1),
+('course_hide_tools','chat','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Chat', 1),
+('course_hide_tools','student_publication','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'StudentPublications', 1),
+('course_hide_tools','wiki','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Wiki', 1),
+('course_hide_tools','gradebook','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Gradebook', 1),
+('course_hide_tools','survey','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Survey', 1),
+('course_hide_tools','glossary','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Glossary', 1),
+('course_hide_tools','notebook','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Notebook', 1),
+('course_hide_tools','attendance','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Attendances', 1),
+('course_hide_tools','course_progress','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'CourseProgress', 1),
+('course_hide_tools','blog_management','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Blog',1),
+('course_hide_tools','tracking','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Stats',1),
+('course_hide_tools','course_maintenance','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Maintenance',1),
+('course_hide_tools','course_setting','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'CourseSettings',1),
+('enabled_support_pixlr',NULL,'radio','Tools','false','EnabledPixlrTitle','EnabledPixlrComment',NULL,NULL, 0),
+('show_groups_to_users',NULL,'radio','Session','false','ShowGroupsToUsersTitle','ShowGroupsToUsersComment',NULL,NULL, 0),
+('accessibility_font_resize',NULL,'radio','Platform','false','EnableAccessibilityFontResizeTitle','EnableAccessibilityFontResizeComment',NULL,NULL, 1),
+('hide_courses_in_sessions',NULL,'radio', 'Session','false','HideCoursesInSessionsTitle',	'HideCoursesInSessionsComment','platform',NULL, 1),
+('enable_quiz_scenario',  NULL,'radio','Course','false','EnableQuizScenarioTitle','EnableQuizScenarioComment',NULL,NULL, 1),
+('enable_nanogong',NULL,'radio','Tools','false','EnableNanogongTitle','EnableNanogongComment',NULL,NULL, 0),
+('filter_terms',NULL,'textarea','Security','','FilterTermsTitle','FilterTermsComment',NULL,NULL, 0),
+('header_extra_content', NULL, 'textarea', 'Tracking', '', 'HeaderExtraContentTitle', 'HeaderExtraContentComment', NULL, NULL, 1),
+('footer_extra_content', NULL, 'textarea', 'Tracking', '', 'FooterExtraContentTitle', 'FooterExtraContentComment', NULL, NULL, 1),
+('show_documents_preview', NULL, 'radio', 'Tools', 'false', 'ShowDocumentPreviewTitle', 'ShowDocumentPreviewComment', NULL, NULL, 1),
+('htmlpurifier_wiki', NULL, 'radio', 'Editor', 'false', 'HtmlPurifierWikiTitle', 'HtmlPurifierWikiComment', NULL, NULL, 0),
+('cas_activate', NULL, 'radio', 'CAS', 'false', 'CasMainActivateTitle', 'CasMainActivateComment', NULL, NULL, 0),
+('cas_server', NULL, 'textfield', 'CAS', '', 'CasMainServerTitle', 'CasMainServerComment', NULL, NULL, 0),
+('cas_server_uri', NULL, 'textfield', 'CAS', '', 'CasMainServerURITitle', 'CasMainServerURIComment', NULL, NULL, 0),
+('cas_port', NULL, 'textfield', 'CAS', '', 'CasMainPortTitle', 'CasMainPortComment', NULL, NULL, 0),
+('cas_protocol', NULL, 'radio', 'CAS', '', 'CasMainProtocolTitle', 'CasMainProtocolComment', NULL, NULL, 0),
+('cas_add_user_activate', NULL, 'radio', 'CAS', 'false', 'CasUserAddActivateTitle', 'CasUserAddActivateComment', NULL, NULL, 0),
+('update_user_info_cas_with_ldap', NULL, 'radio', 'CAS', 'true', 'UpdateUserInfoCasWithLdapTitle', 'UpdateUserInfoCasWithLdapComment', NULL, NULL, 0),
+('student_page_after_login', NULL, 'textfield', 'Platform', '', 'StudentPageAfterLoginTitle', 'StudentPageAfterLoginComment', NULL, NULL, 0),
+('teacher_page_after_login', NULL, 'textfield', 'Platform', '', 'TeacherPageAfterLoginTitle', 'TeacherPageAfterLoginComment', NULL, NULL, 0),
+('drh_page_after_login', NULL, 'textfield', 'Platform', '', 'DRHPageAfterLoginTitle', 'DRHPageAfterLoginComment', NULL, NULL, 0),
+('sessionadmin_page_after_login', NULL, 'textfield', 'Session', '', 'SessionAdminPageAfterLoginTitle', 'SessionAdminPageAfterLoginComment', NULL, NULL, 0),
+('student_autosubscribe', NULL, 'textfield', 'Platform', '', 'StudentAutosubscribeTitle', 'StudentAutosubscribeComment', NULL, NULL, 0),
+('teacher_autosubscribe', NULL, 'textfield', 'Platform', '', 'TeacherAutosubscribeTitle', 'TeacherAutosubscribeComment', NULL, NULL, 0),
+('drh_autosubscribe', NULL, 'textfield', 'Platform', '', 'DRHAutosubscribeTitle', 'DRHAutosubscribeComment', NULL, NULL, 0),
+('sessionadmin_autosubscribe', NULL, 'textfield', 'Session', '', 'SessionadminAutosubscribeTitle', 'SessionadminAutosubscribeComment', NULL, NULL, 0),
+('scorm_cumulative_session_time', NULL, 'radio', 'Course', 'true', 'ScormCumulativeSessionTimeTitle', 'ScormCumulativeSessionTimeComment', NULL, NULL, 0),
+('allow_hr_skills_management', NULL, 'radio', 'Gradebook', 'true', 'AllowHRSkillsManagementTitle', 'AllowHRSkillsManagementComment', NULL, NULL, 1),
+('enable_help_link', NULL, 'radio', 'Platform', 'true', 'EnableHelpLinkTitle', 'EnableHelpLinkComment', NULL, NULL, 0),
+('teachers_can_change_score_settings', NULL, 'radio', 'Gradebook', 'true', 'TeachersCanChangeScoreSettingsTitle', 'TeachersCanChangeScoreSettingsComment', NULL, NULL, 1),
+('allow_users_to_change_email_with_no_password', NULL, 'radio', 'User', 'false', 'AllowUsersToChangeEmailWithNoPasswordTitle', 'AllowUsersToChangeEmailWithNoPasswordComment', NULL, NULL, 0),
+('show_admin_toolbar', NULL, 'radio', 'Platform', 'show_to_admin', 'ShowAdminToolbarTitle', 'ShowAdminToolbarComment', NULL, NULL, 1),
+('allow_global_chat', NULL, 'radio', 'Platform', 'true', 'AllowGlobalChatTitle', 'AllowGlobalChatComment', NULL, NULL, 1),
+('languagePriority1', NULL, 'radio', 'Languages', 'course_lang', 'LanguagePriority1Title', 'LanguagePriority1Comment', NULL, NULL, 0),
+('languagePriority2', NULL, 'radio', 'Languages','user_profil_lang', 'LanguagePriority2Title', 'LanguagePriority2Comment', NULL, NULL, 0),
+('languagePriority3', NULL, 'radio', 'Languages','user_selected_lang', 'LanguagePriority3Title', 'LanguagePriority3Comment', NULL, NULL, 0),
+('languagePriority4', NULL, 'radio', 'Languages', 'platform_lang','LanguagePriority4Title', 'LanguagePriority4Comment', NULL, NULL, 0),
+('login_is_email', NULL, 'radio', 'Platform', 'false', 'LoginIsEmailTitle', 'LoginIsEmailComment', NULL, NULL, 0),
+('courses_default_creation_visibility', NULL, 'radio', 'Course', '2', 'CoursesDefaultCreationVisibilityTitle', 'CoursesDefaultCreationVisibilityComment', NULL, NULL, 1),
+('allow_browser_sniffer', NULL, 'radio', 'Tuning', 'false', 'AllowBrowserSnifferTitle', 'AllowBrowserSnifferComment', NULL, NULL, 0),
+('enable_wami_record',NULL,'radio','Tools','false','EnableWamiRecordTitle','EnableWamiRecordComment',NULL,NULL, 0),
+('gradebook_enable_grade_model', NULL, 'radio', 'Gradebook', 'false', 'GradebookEnableGradeModelTitle', 'GradebookEnableGradeModelComment', NULL, NULL, 1),
+('teachers_can_change_grade_model_settings', NULL, 'radio', 'Gradebook', 'true', 'TeachersCanChangeGradeModelSettingsTitle', 'TeachersCanChangeGradeModelSettingsComment', NULL, NULL, 1),
+('gradebook_default_weight', NULL, 'textfield', 'Gradebook', '100', 'GradebookDefaultWeightTitle', 'GradebookDefaultWeightComment', NULL, NULL, 0),
+('ldap_description', NULL, 'radio', 'LDAP', NULL, 'LdapDescriptionTitle', 'LdapDescriptionComment', NULL, NULL, 0),
+('shibboleth_description', NULL, 'radio', 'Shibboleth', 'false', 'ShibbolethMainActivateTitle', 'ShibbolethMainActivateComment', NULL, NULL, 0),
+('facebook_description', NULL, 'radio', 'Facebook', 'false', 'FacebookMainActivateTitle', 'FacebookMainActivateComment', NULL, NULL, 0),
+('gradebook_locking_enabled', NULL, 'radio', 'Gradebook', 'false', 'GradebookEnableLockingTitle', 'GradebookEnableLockingComment', NULL, NULL, 0),
+('gradebook_default_grade_model_id', NULL, 'select', 'Gradebook', '', 'GradebookDefaultGradeModelTitle', 'GradebookDefaultGradeModelComment', NULL, NULL, 1),
+('allow_session_admins_to_manage_all_sessions', NULL, 'radio', 'Session', 'false', 'AllowSessionAdminsToSeeAllSessionsTitle', 'AllowSessionAdminsToSeeAllSessionsComment', NULL, NULL, 1),
+('allow_skills_tool', NULL, 'radio', 'Platform', 'false', 'AllowSkillsToolTitle', 'AllowSkillsToolComment', NULL, NULL, 1),
+('allow_public_certificates', NULL, 'radio', 'Course', 'false', 'AllowPublicCertificatesTitle', 'AllowPublicCertificatesComment', NULL, NULL, 1),
+('platform_unsubscribe_allowed', NULL, 'radio', 'Platform', 'false', 'PlatformUnsubscribeTitle', 'PlatformUnsubscribeComment', NULL, NULL, 1),
+('activate_email_template', NULL, 'radio', 'Platform', 'false', 'ActivateEmailTemplateTitle', 'ActivateEmailTemplateComment', NULL, NULL, 0),
+('enable_iframe_inclusion', NULL, 'radio', 'Editor', 'false', 'EnableIframeInclusionTitle', 'EnableIframeInclusionComment', NULL, NULL, 1),
+('show_hot_courses', NULL, 'radio', 'Platform', 'true', 'ShowHotCoursesTitle', 'ShowHotCoursesComment', NULL, NULL, 1),
+('enable_webcam_clip',NULL,'radio','Tools','false','EnableWebCamClipTitle','EnableWebCamClipComment',NULL,NULL, 0),
+('use_custom_pages', NULL, 'radio','Platform','false','UseCustomPagesTitle','UseCustomPagesComment', NULL, NULL, 1),
+('tool_visible_by_default_at_creation','documents','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Documents', 1),
+('tool_visible_by_default_at_creation','learning_path','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'LearningPath', 1),
+('tool_visible_by_default_at_creation','links','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Links', 1),
+('tool_visible_by_default_at_creation','announcements','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Announcements', 1),
+('tool_visible_by_default_at_creation','forums','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Forums', 1),
+('tool_visible_by_default_at_creation','quiz','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Quiz', 1),
+('tool_visible_by_default_at_creation','gradebook','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Gradebook', 1),
+('session_tutor_reports_visibility', NULL, 'radio', 'Session', 'true', 'SessionTutorsCanSeeExpiredSessionsResultsTitle', 'SessionTutorsCanSeeExpiredSessionsResultsComment', NULL, NULL, 1),
+('gradebook_show_percentage_in_reports',NULL,'radio','Gradebook','true','GradebookShowPercentageInReportsTitle','GradebookShowPercentageInReportsComment',NULL,NULL, 0),
+('session_page_enabled', NULL, 'radio', 'Session', 'true', 'SessionPageEnabledTitle', 'SessionPageEnabledComment', NULL, NULL, 1),
+('settings_latest_update', NULL, NULL, NULL, '', '','', NULL, NULL, 0),
+('user_name_order', NULL, 'textfield', 'Platform', '', 'UserNameOrderTitle', 'UserNameOrderComment', NULL, NULL, 1),
+('allow_teachers_to_create_sessions', NULL,'radio','Session','false','AllowTeachersToCreateSessionsTitle','AllowTeachersToCreateSessionsComment', NULL, NULL, 0),
+('login_as_allowed', NULL, 'radio', 'Security', 'true', 'AdminLoginAsAllowedTitle', 'AdminLoginAsAllowedComment', 1, 0, 1),
+('admins_can_set_users_pass', NULL, 'radio', 'security', 'true', 'AdminsCanChangeUsersPassTitle', 'AdminsCanChangeUsersPassComment', 1, 0, 1),
+('template', NULL, 'text', 'stylesheets', 'default', 'DefaultTemplateTitle', 'DefaultTemplateComment', NULL, NULL, 1),
+('breadcrumb_navigation_display', NULL, 'radio', 'Platform','true','BreadcrumbNavigationDisplayTitle', 'BreadcrumbNavigationDisplayComment', NULL, NULL, 1),
+('chamilo_database_version', NULL, 'textfield', NULL, '1.10.0.001', 'DatabaseVersion', '', NULL, NULL, 0); -- base value, updated at end of file. Don't change here
+
+UNLOCK TABLES;
+/*!40000 ALTER TABLE settings_current ENABLE KEYS */;
+
+--
+-- Table structure for table settings_options
+--
+
+DROP TABLE IF EXISTS settings_options;
+CREATE TABLE IF NOT EXISTS settings_options (
+  id int unsigned NOT NULL auto_increment,
+  variable varchar(255) default NULL,
+  value varchar(255) default NULL,
+  display_text varchar(255) NOT NULL default '',
+  PRIMARY KEY (id),
+  UNIQUE KEY id (id)
+);
+
+ALTER TABLE settings_options ADD UNIQUE unique_setting_option (variable(165), value(165));
+
+--
+-- Dumping data for table settings_options
+--
+
+/*!40000 ALTER TABLE settings_options DISABLE KEYS */;
+LOCK TABLES settings_options WRITE;
+INSERT INTO settings_options (variable, value, display_text)
+VALUES
+('show_administrator_data','true','Yes'),
+('show_administrator_data','false','No'),
+('show_tutor_data','true','Yes'),
+('show_tutor_data','false','No'),
+('show_teacher_data','true','Yes'),
+('show_teacher_data','false','No'),
+('homepage_view','activity','HomepageViewActivity'),
+('homepage_view','2column','HomepageView2column'),
+('homepage_view','3column','HomepageView3column'),
+('homepage_view','vertical_activity','HomepageViewVerticalActivity'),
+('homepage_view','activity_big','HomepageViewActivityBig'),
+('show_toolshortcuts','true','Yes'),
+('show_toolshortcuts','false','No'),
+('allow_group_categories','true','Yes'),
+('allow_group_categories','false','No'),
+('allow_name_change','true','Yes'),
+('allow_name_change','false','No'),
+('allow_officialcode_change','true','Yes'),
+('allow_officialcode_change','false','No'),
+('allow_registration','true','Yes'),
+('allow_registration','false','No'),
+('allow_registration','approval','AfterApproval'),
+('allow_registration_as_teacher','true','Yes'),
+('allow_registration_as_teacher','false','No'),
+('allow_lostpassword','true','Yes'),
+('allow_lostpassword','false','No'),
+('allow_user_headings','true','Yes'),
+('allow_user_headings','false','No'),
+('allow_personal_agenda','true','Yes'),
+('allow_personal_agenda','false','No'),
+('display_coursecode_in_courselist','true','Yes'),
+('display_coursecode_in_courselist','false','No'),
+('display_teacher_in_courselist','true','Yes'),
+('display_teacher_in_courselist','false','No'),
+('permanently_remove_deleted_files','true','YesWillDeletePermanently'),
+('permanently_remove_deleted_files','false','NoWillDeletePermanently'),
+('dropbox_allow_overwrite','true','Yes'),
+('dropbox_allow_overwrite','false','No'),
+('dropbox_allow_just_upload','true','Yes'),
+('dropbox_allow_just_upload','false','No'),
+('dropbox_allow_student_to_student','true','Yes'),
+('dropbox_allow_student_to_student','false','No'),
+('dropbox_allow_group','true','Yes'),
+('dropbox_allow_group','false','No'),
+('dropbox_allow_mailing','true','Yes'),
+('dropbox_allow_mailing','false','No'),
+('extended_profile','true','Yes'),
+('extended_profile','false','No'),
+('student_view_enabled','true','Yes'),
+('student_view_enabled','false','No'),
+('show_navigation_menu','false','No'),
+('show_navigation_menu','icons','IconsOnly'),
+('show_navigation_menu','text','TextOnly'),
+('show_navigation_menu','iconstext','IconsText'),
+('enable_tool_introduction','true','Yes'),
+('enable_tool_introduction','false','No'),
+('page_after_login', 'index.php', 'CampusHomepage'),
+('page_after_login', 'user_portal.php', 'MyCourses'),
+('page_after_login', 'main/auth/courses.php', 'CourseCatalog'),
+('breadcrumbs_course_homepage', 'get_lang', 'CourseHomepage'),
+('breadcrumbs_course_homepage', 'course_code', 'CourseCode'),
+('breadcrumbs_course_homepage', 'course_title', 'CourseTitle'),
+('example_material_course_creation', 'true', 'Yes'),
+('example_material_course_creation', 'false', 'No'),
+('use_session_mode', 'true', 'Yes'),
+('use_session_mode', 'false', 'No'),
+('allow_email_editor', 'true' ,'Yes'),
+('allow_email_editor', 'false', 'No'),
+('show_email_addresses','true','Yes'),
+('show_email_addresses','false','No'),
+('wcag_anysurfer_public_pages', 'true', 'Yes'),
+('wcag_anysurfer_public_pages', 'false', 'No'),
+('upload_extensions_list_type', 'blacklist', 'Blacklist'),
+('upload_extensions_list_type', 'whitelist', 'Whitelist'),
+('upload_extensions_skip', 'true', 'Remove'),
+('upload_extensions_skip', 'false', 'Rename'),
+('show_number_of_courses', 'true', 'Yes'),
+('show_number_of_courses', 'false', 'No'),
+('show_empty_course_categories', 'true', 'Yes'),
+('show_empty_course_categories', 'false', 'No'),
+('show_back_link_on_top_of_tree', 'true', 'Yes'),
+('show_back_link_on_top_of_tree', 'false', 'No'),
+('show_different_course_language', 'true', 'Yes'),
+('show_different_course_language', 'false', 'No'),
+('split_users_upload_directory', 'true', 'Yes'),
+('split_users_upload_directory', 'false', 'No'),
+('hide_dltt_markup', 'false', 'No'),
+('hide_dltt_markup', 'true', 'Yes'),
+('display_categories_on_homepage','true','Yes'),
+('display_categories_on_homepage','false','No'),
+('default_forum_view', 'flat', 'Flat'),
+('default_forum_view', 'threaded', 'Threaded'),
+('default_forum_view', 'nested', 'Nested'),
+('survey_email_sender_noreply', 'coach', 'CourseCoachEmailSender'),
+('survey_email_sender_noreply', 'noreply', 'NoReplyEmailSender'),
+('openid_authentication','true','Yes'),
+('openid_authentication','false','No'),
+('gradebook_enable','true','Yes'),
+('gradebook_enable','false','No'),
+('user_selected_theme','true','Yes'),
+('user_selected_theme','false','No'),
+('allow_course_theme','true','Yes'),
+('allow_course_theme','false','No'),
+('display_mini_month_calendar', 'true', 'Yes'),
+('display_mini_month_calendar', 'false', 'No'),
+('display_upcoming_events', 'true', 'Yes'),
+('display_upcoming_events', 'false', 'No'),
+('show_closed_courses', 'true', 'Yes'),
+('show_closed_courses', 'false', 'No'),
+('ldap_version', '2', 'LDAPVersion2'),
+('ldap_version', '3', 'LDAPVersion3'),
+('visio_use_rtmpt','true','Yes'),
+('visio_use_rtmpt','false','No'),
+('add_users_by_coach', 'true', 'Yes'),
+('add_users_by_coach', 'false', 'No'),
+('extend_rights_for_coach', 'true', 'Yes'),
+('extend_rights_for_coach', 'false', 'No'),
+('extend_rights_for_coach_on_survey', 'true', 'Yes'),
+('extend_rights_for_coach_on_survey', 'false', 'No'),
+('show_session_coach', 'true', 'Yes'),
+('show_session_coach', 'false', 'No'),
+('allow_users_to_create_courses','true','Yes'),
+('allow_users_to_create_courses','false','No'),
+('breadcrumbs_course_homepage', 'session_name_and_course_title', 'SessionNameAndCourseTitle'),
+('advanced_filemanager','true','Yes'),
+('advanced_filemanager','false','No'),
+('allow_reservation', 'true', 'Yes'),
+('allow_reservation', 'false', 'No'),
+('allow_message_tool', 'true', 'Yes'),
+('allow_message_tool', 'false', 'No'),
+('allow_social_tool', 'true', 'Yes'),
+('allow_social_tool', 'false', 'No'),
+('allow_students_to_browse_courses','true','Yes'),
+('allow_students_to_browse_courses','false','No'),
+('show_email_of_teacher_or_tutor ', 'true', 'Yes'),
+('show_email_of_teacher_or_tutor ', 'false', 'No'),
+('show_session_data ', 'true', 'Yes'),
+('show_session_data ', 'false', 'No'),
+('allow_use_sub_language', 'true', 'Yes'),
+('allow_use_sub_language', 'false', 'No'),
+('show_glossary_in_documents', 'none', 'ShowGlossaryInDocumentsIsNone'),
+('show_glossary_in_documents', 'ismanual', 'ShowGlossaryInDocumentsIsManual'),
+('show_glossary_in_documents', 'isautomatic', 'ShowGlossaryInDocumentsIsAutomatic'),
+('allow_terms_conditions', 'true', 'Yes'),
+('allow_terms_conditions', 'false', 'No'),
+('search_enabled', 'true', 'Yes'),
+('search_enabled', 'false', 'No'),
+('search_show_unlinked_results', 'true', 'SearchShowUnlinkedResults'),
+('search_show_unlinked_results', 'false', 'SearchHideUnlinkedResults'),
+('show_courses_descriptions_in_catalog', 'true', 'Yes'),
+('show_courses_descriptions_in_catalog', 'false', 'No'),
+('allow_coach_to_edit_course_session','true','Yes'),
+('allow_coach_to_edit_course_session','false','No'),
+('show_glossary_in_extra_tools', 'true', 'Yes'),
+('show_glossary_in_extra_tools', 'false', 'No'),
+('send_email_to_admin_when_create_course','true','Yes'),
+('send_email_to_admin_when_create_course','false','No'),
+('go_to_course_after_login','true','Yes'),
+('go_to_course_after_login','false','No'),
+('math_mimetex','true','Yes'),
+('math_mimetex','false','No'),
+('math_asciimathML','true','Yes'),
+('math_asciimathML','false','No'),
+('enabled_asciisvg','true','Yes'),
+('enabled_asciisvg','false','No'),
+('include_asciimathml_script','true','Yes'),
+('include_asciimathml_script','false','No'),
+('youtube_for_students','true','Yes'),
+('youtube_for_students','false','No'),
+('block_copy_paste_for_students','true','Yes'),
+('block_copy_paste_for_students','false','No'),
+('more_buttons_maximized_mode','true','Yes'),
+('more_buttons_maximized_mode','false','No'),
+('students_download_folders','true','Yes'),
+('students_download_folders','false','No'),
+('users_copy_files','true','Yes'),
+('users_copy_files','false','No'),
+('allow_students_to_create_groups_in_social','true','Yes'),
+('allow_students_to_create_groups_in_social','false','No'),
+('allow_send_message_to_all_platform_users','true','Yes'),
+('allow_send_message_to_all_platform_users','false','No'),
+('use_users_timezone', 'true', 'Yes'),
+('use_users_timezone', 'false', 'No'),
+('allow_user_course_subscription_by_course_admin', 'true', 'Yes'),
+('allow_user_course_subscription_by_course_admin', 'false', 'No'),
+('show_link_bug_notification', 'true', 'Yes'),
+('show_link_bug_notification', 'false', 'No'),
+('course_validation', 'true', 'Yes'),
+('course_validation', 'false', 'No'),
+('sso_authentication', 'true', 'Yes'),
+('sso_authentication', 'false', 'No'),
+('sso_authentication_protocol', 'http://', 'http://'),
+('sso_authentication_protocol', 'https://', 'https://'),
+('enabled_wiris','true','Yes'),
+('enabled_wiris','false','No'),
+('allow_spellcheck','true','Yes'),
+('allow_spellcheck','false','No'),
+('force_wiki_paste_as_plain_text','true','Yes'),
+('force_wiki_paste_as_plain_text','false','No'),
+('enabled_googlemaps','true','Yes'),
+('enabled_googlemaps','false','No'),
+('enabled_imgmap','true','Yes'),
+('enabled_imgmap','false','No'),
+('enabled_support_svg','true','Yes'),
+('enabled_support_svg','false','No'),
+('pdf_export_watermark_enable','true','Yes'),
+('pdf_export_watermark_enable','false','No'),
+('pdf_export_watermark_by_course','true','Yes'),
+('pdf_export_watermark_by_course','false','No'),
+('enabled_insertHtml','true','Yes'),
+('enabled_insertHtml','false','No'),
+('students_export2pdf','true','Yes'),
+('students_export2pdf','false','No'),
+('show_users_folders','true','Yes'),
+('show_users_folders','false','No'),
+('show_default_folders','true','Yes'),
+('show_default_folders','false','No'),
+('show_chat_folder','true','Yes'),
+('show_chat_folder','false','No'),
+('enabled_text2audio','true','Yes'),
+('enabled_text2audio','false','No'),
+('enabled_support_pixlr','true','Yes'),
+('enabled_support_pixlr','false','No'),
+('show_groups_to_users','true','Yes'),
+('show_groups_to_users','false','No'),
+('accessibility_font_resize', 'true', 'Yes'),
+('accessibility_font_resize', 'false', 'No'),
+('hide_courses_in_sessions','true','Yes'),
+('hide_courses_in_sessions','false','No'),
+('enable_quiz_scenario', 'true', 'Yes'),
+('enable_quiz_scenario', 'false', 'No'),
+('enable_nanogong','true','Yes'),
+('enable_nanogong','false','No'),
+('show_documents_preview', 'true', 'Yes'),
+('show_documents_preview', 'false', 'No'),
+('htmlpurifier_wiki', 'true', 'Yes'),
+('htmlpurifier_wiki', 'false', 'No'),
+('cas_activate', 'true', 'Yes'),
+('cas_activate', 'false', 'No'),
+('cas_protocol', 'CAS1', 'CAS1Text'),
+('cas_protocol', 'CAS2', 'CAS2Text'),
+('cas_protocol', 'SAML', 'SAMLText'),
+('cas_add_user_activate', 'false', 'No'),
+('cas_add_user_activate', 'platform', 'casAddUserActivatePlatform'),
+('cas_add_user_activate', 'extldap', 'casAddUserActivateLDAP'),
+('update_user_info_cas_with_ldap', 'true', 'Yes'),
+('update_user_info_cas_with_ldap', 'false', 'No'),
+('scorm_cumulative_session_time','true','Yes'),
+('scorm_cumulative_session_time','false','No'),
+('allow_hr_skills_management', 'true', 'Yes'),
+('allow_hr_skills_management', 'false', 'No'),
+('enable_help_link', 'true', 'Yes'),
+('enable_help_link', 'false', 'No'),
+('allow_users_to_change_email_with_no_password', 'true', 'Yes'),
+('allow_users_to_change_email_with_no_password', 'false', 'No'),
+('show_admin_toolbar', 'do_not_show', 'DoNotShow'),
+('show_admin_toolbar', 'show_to_admin', 'ShowToAdminsOnly'),
+('show_admin_toolbar', 'show_to_admin_and_teachers', 'ShowToAdminsAndTeachers'),
+('show_admin_toolbar', 'show_to_all', 'ShowToAllUsers'),
+('use_custom_pages','true','Yes'),
+('use_custom_pages','false','No'),
+('languagePriority1','platform_lang','PlatformLanguage'),
+('languagePriority1','user_profil_lang','UserLanguage'),
+('languagePriority1','user_selected_lang','UserSelectedLanguage'),
+('languagePriority1','course_lang','CourseLanguage'),
+('languagePriority2','platform_lang','PlatformLanguage'),
+('languagePriority2','user_profil_lang','UserLanguage'),
+('languagePriority2','user_selected_lang','UserSelectedLanguage'),
+('languagePriority2','course_lang','CourseLanguage'),
+('languagePriority3','platform_lang','PlatformLanguage'),
+('languagePriority3','user_profil_lang','UserLanguage'),
+('languagePriority3','user_selected_lang','UserSelectedLanguage'),
+('languagePriority3','course_lang','CourseLanguage'),
+('languagePriority4','platform_lang','PlatformLanguage'),
+('languagePriority4','user_profil_lang','UserLanguage'),
+('languagePriority4','user_selected_lang','UserSelectedLanguage'),
+('languagePriority4','course_lang','CourseLanguage'),
+('allow_global_chat', 'true', 'Yes'),
+('allow_global_chat', 'false', 'No'),
+('login_is_email','true','Yes'),
+('login_is_email','false','No'),
+('courses_default_creation_visibility', '3', 'OpenToTheWorld'),
+('courses_default_creation_visibility', '2', 'OpenToThePlatform'),
+('courses_default_creation_visibility', '1', 'Private'),
+('courses_default_creation_visibility', '0', 'CourseVisibilityClosed'),
+('allow_browser_sniffer', 'true', 'Yes'),
+('allow_browser_sniffer', 'false', 'No'),
+('enable_wami_record', 'true', 'Yes'),
+('enable_wami_record', 'false', 'No'),
+('teachers_can_change_score_settings', 'true', 'Yes'),
+('teachers_can_change_score_settings', 'false', 'No'),
+('teachers_can_change_grade_model_settings', 'true', 'Yes'),
+('teachers_can_change_grade_model_settings', 'false', 'No'),
+('gradebook_locking_enabled', 'true', 'Yes'),
+('gradebook_locking_enabled', 'false', 'No'),
+('gradebook_enable_grade_model', 'true', 'Yes'),
+('gradebook_enable_grade_model', 'false', 'No'),
+('allow_session_admins_to_manage_all_sessions', 'true', 'Yes'),
+('allow_session_admins_to_manage_all_sessions', 'false', 'No'),
+('allow_skills_tool', 'true', 'Yes'),
+('allow_skills_tool', 'false', 'No'),
+('allow_public_certificates', 'true', 'Yes'),
+('allow_public_certificates', 'false', 'No'),
+('platform_unsubscribe_allowed', 'true', 'Yes'),
+('platform_unsubscribe_allowed', 'false', 'No'),
+('activate_email_template', 'true', 'Yes'),
+('activate_email_template', 'false', 'No'),
+ ('enable_iframe_inclusion', 'true', 'Yes'),
+('enable_iframe_inclusion', 'false', 'No'),
+('show_hot_courses', 'true', 'Yes'),
+('show_hot_courses', 'false', 'No'),
+('enable_webcam_clip', 'true', 'Yes'),
+('enable_webcam_clip', 'false', 'No'),
+('session_tutor_reports_visibility', 'true', 'Yes'),
+('session_tutor_reports_visibility', 'false', 'No'),
+('gradebook_show_percentage_in_reports', 'true', 'Yes'),
+('gradebook_show_percentage_in_reports', 'false', 'No'),
+('session_page_enabled', 'true', 'Yes'),
+('session_page_enabled', 'false', 'No'),
+('allow_teachers_to_create_sessions', 'true', 'Yes'),
+('allow_teachers_to_create_sessions', 'false', 'No'),
+('login_as_allowed','true','Yes'),
+('login_as_allowed','false','No'),
+('admins_can_set_users_pass','true','Yes'),
+('admins_can_set_users_pass','false','No'),
+('breadcrumb_navigation_display', 'true', 'Show'),
+('breadcrumb_navigation_display', 'false', 'Hide');
+
+UNLOCK TABLES;
+
+/*!40000 ALTER TABLE settings_options ENABLE KEYS */;
+
+
+--
+-- Table structure for table sys_announcement
+--
+
+DROP TABLE IF EXISTS sys_announcement;
+CREATE TABLE IF NOT EXISTS sys_announcement (
+  id int unsigned NOT NULL auto_increment,
+  date_start datetime NOT NULL default '0000-00-00 00:00:00',
+  date_end datetime NOT NULL default '0000-00-00 00:00:00',
+  visible_teacher tinyint NOT NULL default 0,
+  visible_student tinyint NOT NULL default 0,
+  visible_guest tinyint NOT NULL default 0,
+  title varchar(250) NOT NULL default '',
+  content text NOT NULL,
+  lang varchar(70) NULL default NULL,
+  access_url_id INT NOT NULL default 1,
+  PRIMARY KEY  (id)
+);
+
+--
+-- Table structure for shared_survey
+--
+
+DROP TABLE IF EXISTS shared_survey;
+CREATE TABLE IF NOT EXISTS shared_survey (
+  survey_id int unsigned NOT NULL auto_increment,
+  code varchar(20) default NULL,
+  title text default NULL,
+  subtitle text default NULL,
+  author varchar(250) default NULL,
+  lang varchar(20) default NULL,
+  template varchar(20) default NULL,
+  intro text,
+  surveythanks text,
+  creation_date datetime NOT NULL default '0000-00-00 00:00:00',
+  course_code varchar(40) NOT NULL default '',
+  PRIMARY KEY  (survey_id),
+  UNIQUE KEY id (survey_id)
+);
+
+
+DROP TABLE IF EXISTS shared_survey_question;
+CREATE TABLE IF NOT EXISTS shared_survey_question (
+  question_id int NOT NULL auto_increment,
+  survey_id int NOT NULL default '0',
+  survey_question text NOT NULL,
+  survey_question_comment text NOT NULL,
+  type varchar(250) NOT NULL default '',
+  display varchar(10) NOT NULL default '',
+  sort int NOT NULL default '0',
+  code varchar(40) NOT NULL default '',
+  max_value int NOT NULL,
+  PRIMARY KEY  (question_id)
+);
+
+
+DROP TABLE IF EXISTS shared_survey_question_option;
+CREATE TABLE IF NOT EXISTS shared_survey_question_option (
+  question_option_id int NOT NULL auto_increment,
+  question_id int NOT NULL default '0',
+  survey_id int NOT NULL default '0',
+  option_text text NOT NULL,
+  sort int NOT NULL default '0',
+  PRIMARY KEY  (question_option_id)
+);
+
+
+DROP TABLE IF EXISTS templates;
+CREATE TABLE IF NOT EXISTS templates (
+  id int NOT NULL auto_increment,
+  title varchar(100) NOT NULL,
+  description varchar(250) NOT NULL,
+  course_code varchar(40) NOT NULL,
+  user_id int NOT NULL,
+  ref_doc int NOT NULL,
+  image varchar(250) NOT NULL,
+  PRIMARY KEY  (id)
+);
+
+DROP TABLE IF EXISTS openid_association;
+CREATE TABLE IF NOT EXISTS openid_association (
+  id int NOT NULL auto_increment,
+  idp_endpoint_uri text NOT NULL,
+  session_type varchar(30) NOT NULL,
+  assoc_handle text NOT NULL,
+  assoc_type text NOT NULL,
+  expires_in bigint NOT NULL,
+  mac_key text NOT NULL,
+  created bigint NOT NULL,
+  PRIMARY KEY  (id)
+);
+
+
+DROP TABLE IF EXISTS gradebook_category;
+CREATE TABLE IF NOT EXISTS gradebook_category (
+    id int NOT NULL auto_increment,
+    name text NOT NULL,
+    description text,
+    user_id int NOT NULL,
+    course_code varchar(40) default NULL,
+    parent_id int default NULL,
+    weight float NOT NULL,
+    visible tinyint NOT NULL,
+    certif_min_score int DEFAULT NULL,
+    session_id int DEFAULT NULL,
+    document_id int unsigned DEFAULT NULL,
+    locked int NOT NULL DEFAULT 0,
+    default_lowest_eval_exclude TINYINT default null,
+  PRIMARY KEY  (id)
+);
+
+DROP TABLE IF EXISTS gradebook_evaluation;
+CREATE TABLE IF NOT EXISTS gradebook_evaluation (
+    id int unsigned NOT NULL auto_increment,
+    name text NOT NULL,
+    description text,
+    user_id int NOT NULL,
+    course_code varchar(40) default NULL,
+    category_id int default NULL,
+    created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+    weight FLOAT NOT NULL,
+    max float unsigned NOT NULL,
+    visible int NOT NULL,
+    type varchar(40) NOT NULL default 'evaluation',
+    locked int NOT NULL DEFAULT 0,
+    evaluation_type_id INT NOT NULL DEFAULT 0,
+    PRIMARY KEY  (id)
+);
+
+DROP TABLE IF EXISTS gradebook_link;
+CREATE TABLE IF NOT EXISTS gradebook_link (
+    id int NOT NULL auto_increment,
+    type int NOT NULL,
+    ref_id int NOT NULL,
+    user_id int NOT NULL,
+    course_code varchar(40) NOT NULL,
+    category_id int NOT NULL,
+    created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+    weight float NOT NULL,
+    visible int NOT NULL,
+    locked int NOT NULL DEFAULT 0,
+    evaluation_type_id INT NOT NULL DEFAULT 0,
+    PRIMARY KEY(id)
+);
+
+DROP TABLE IF EXISTS gradebook_result;
+CREATE TABLE IF NOT EXISTS gradebook_result (
+  id int NOT NULL auto_increment,
+  user_id int NOT NULL,
+  evaluation_id int NOT NULL,
+  created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+  score float unsigned default NULL,
+  PRIMARY KEY  (id)
+);
+
+DROP TABLE IF EXISTS gradebook_score_display;
+CREATE TABLE IF NOT EXISTS gradebook_score_display (
+  id int NOT NULL auto_increment,
+  score float unsigned NOT NULL,
+  display varchar(40) NOT NULL,
+  category_id int NOT NULL default 0,
+  score_color_percent float unsigned NOT NULL default 0,
+  PRIMARY KEY (id)
+);
+
+ALTER TABLE gradebook_score_display ADD INDEX(category_id);
+
+DROP TABLE IF EXISTS gradebook_evaluation_type;
+CREATE TABLE IF NOT EXISTS gradebook_evaluation_type (
+    id  INT unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT,
+    name varchar(255),
+    external_id INT unsigned NOT NULL DEFAULT 0
+);
+
+DROP TABLE IF EXISTS user_field;
+CREATE TABLE IF NOT EXISTS user_field (
+    id	INT NOT NULL auto_increment,
+    field_type int NOT NULL DEFAULT 1,
+    field_variable	varchar(64) NOT NULL,
+    field_display_text	varchar(64),
+    field_default_value text,
+    field_order int,
+    field_visible tinyint default 0,
+    field_changeable tinyint default 0,
+    field_filter tinyint default 0,
+    field_loggeable int default 0,
+    tms	DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+DROP TABLE IF EXISTS user_field_options;
+CREATE TABLE IF NOT EXISTS user_field_options (
+    id	int NOT NULL auto_increment,
+    field_id int	NOT NULL,
+    option_value	text,
+    option_display_text varchar(64),
+    option_order int,
+    priority int default NULL,
+    priority_message varchar(255) default NULL,
+    tms	DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY (id)
+);
+
+DROP TABLE IF EXISTS user_field_values;
+CREATE TABLE IF NOT EXISTS user_field_values(
+    id	bigint	NOT NULL auto_increment,
+    user_id	int	unsigned NOT NULL,
+    field_id int NOT NULL,
+    field_value	text,
+    author_id INT unsigned NOT NULL default 0,
+    comment VARCHAR(100) default '',
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+ALTER TABLE user_field_values ADD INDEX (user_id, field_id);
+
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES (1, 'legal_accept','Legal',0,0);
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES (1, 'already_logged_in','Already logged in',0,0);
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES (1, 'update_type','Update script type',0,0);
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES (10, 'tags','tags',0,0);
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES (1, 'rssfeeds','RSS',0,0);
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES (1, 'dashboard', 'Dashboard', 0, 0);
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES (11, 'timezone', 'Timezone', 0, 0);
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable, field_default_value) values (4, 'mail_notify_invitation',   'MailNotifyInvitation',1,1,'1');
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable, field_default_value) values (4, 'mail_notify_message',      'MailNotifyMessage',1,1,'1');
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable, field_default_value) values (4, 'mail_notify_group_message','MailNotifyGroupMessage',1,1,'1');
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES (1, 'user_chat_status','User chat status',0,0);
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES (1, 'google_calendar_url','Google Calendar URL',0,0);
+
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (8, '1', 'AtOnce',1);
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (8, '8', 'Daily',2);
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (8, '0', 'No',3);
+
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (9, '1', 'AtOnce',1);
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (9, '8', 'Daily',2);
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (9, '0', 'No',3);
+
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (10, '1', 'AtOnce',1);
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (10, '8', 'Daily',2);
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (10, '0', 'No',3);
+
+DROP TABLE IF EXISTS gradebook_result_log;
+CREATE TABLE IF NOT EXISTS gradebook_result_log (
+    id int NOT NULL auto_increment,
+    id_result int NOT NULL,
+    user_id int NOT NULL,
+    evaluation_id int NOT NULL,
+    created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+    score float unsigned default NULL,
+    PRIMARY KEY(id)
+);
+
+DROP TABLE IF EXISTS gradebook_linkeval_log;
+CREATE TABLE IF NOT EXISTS gradebook_linkeval_log (
+    id int NOT NULL auto_increment,
+    id_linkeval_log int NOT NULL,
+    name text,
+    description text,
+    created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+    weight smallint default NULL,
+    visible tinyint default NULL,
+    type varchar(20) NOT NULL,
+    user_id_log int NOT NULL,
+    PRIMARY KEY  (id)
+);
+
+DROP TABLE IF EXISTS access_url;
+CREATE TABLE IF NOT EXISTS access_url(
+    id	int	unsigned NOT NULL auto_increment,
+    url	varchar(255) NOT NULL,
+    description text,
+    active	int unsigned not null default 0,
+    created_by	int	not null,
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    url_type tinyint unsigned default 1,
+    PRIMARY KEY (id)
+);
+
+INSERT INTO access_url(url, description, active, created_by) VALUES ('http://localhost/',' ',1,1);
+
+DROP TABLE IF EXISTS access_url_rel_user;
+CREATE TABLE IF NOT EXISTS access_url_rel_user (
+  access_url_id int unsigned NOT NULL,
+  user_id int unsigned NOT NULL,
+  PRIMARY KEY (access_url_id, user_id)
+);
+
+ALTER TABLE access_url_rel_user ADD INDEX idx_access_url_rel_user_user (user_id);
+ALTER TABLE access_url_rel_user ADD INDEX idx_access_url_rel_user_access_url(access_url_id);
+ALTER TABLE access_url_rel_user ADD INDEX idx_access_url_rel_user_access_url_user (user_id,access_url_id);
+
+-- Adding admin to the first portal
+INSERT INTO access_url_rel_user VALUES(1, 1);
+
+DROP TABLE IF EXISTS access_url_rel_course;
+CREATE TABLE IF NOT EXISTS access_url_rel_course (
+  id int unsigned NOT NULL auto_increment,
+  access_url_id int unsigned NOT NULL,
+  c_id int unsigned NOT NULL default 0,
+  PRIMARY KEY (id)
+);
+
+DROP TABLE IF EXISTS access_url_rel_session;
+CREATE TABLE IF NOT EXISTS access_url_rel_session (
+  access_url_id int unsigned NOT NULL,
+  session_id int unsigned NOT NULL,
+  PRIMARY KEY (access_url_id, session_id)
+);
+
+--
+-- Table structure for table sys_calendar
+--
+DROP TABLE IF EXISTS sys_calendar;
+CREATE TABLE IF NOT EXISTS sys_calendar (
+  id int unsigned NOT NULL auto_increment,
+  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',
+  access_url_id INT NOT NULL default 1,
+  all_day INT NOT NULL DEFAULT 0,
+  PRIMARY KEY (id)
+);
+
+DROP TABLE IF EXISTS system_template;
+CREATE TABLE IF NOT EXISTS system_template (
+  id int UNSIGNED NOT NULL auto_increment,
+  title varchar(250) NOT NULL,
+  comment text NOT NULL,
+  image varchar(250) NOT NULL,
+  content text NOT NULL,
+  PRIMARY KEY  (id)
+);
+
+-- Adding the platform templates
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleCourseTitle', 'TemplateTitleCourseTitleDescription', 'coursetitle.gif', '
+<head>
+                {CSS}
+                <style type="text/css">
+                .gris_title         	{
+                    color: silver;
+                }
+                h1
+                {
+                    text-align: right;
+                }
+                </style>
+
+            </head>
+            <body>
+            <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+            <tbody>
+            <tr>
+            <td style="vertical-align: middle; width: 50%;" colspan="1" rowspan="1">
+                <h1>TITULUS 1<br>
+                <span class="gris_title">TITULUS 2</span><br>
+                </h1>
+            </td>
+            <td style="width: 50%;">
+                <img style="width: 100px; height: 100px;" alt="dokeos logo" src="{COURSE_DIR}images/logo_dokeos.png"></td>
+            </tr>
+            </tbody>
+            </table>
+            <p><br>
+            <br>
+            </p>
+            </body>
+');
+
+/*
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleCheckList', 'TemplateTitleCheckListDescription', 'checklist.gif', '
+      <head>
+                   {CSS}
+                </head>
+                <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                <tbody>
+                <tr>
+                <td style="vertical-align: top; width: 66%;">
+                <h3>Lorem ipsum dolor sit amet</h3>
+                <ul>
+                    <li>consectetur adipisicing elit</li>
+                    <li>sed do eiusmod tempor incididunt</li>
+                    <li>ut labore et dolore magna aliqua</li>
+                </ul>
+
+                <h3>Ut enim ad minim veniam</h3>
+                <ul>
+                    <li>quis nostrud exercitation ullamco</li>
+                    <li>laboris nisi ut aliquip ex ea commodo consequat</li>
+                    <li>Excepteur sint occaecat cupidatat non proident</li>
+                </ul>
+
+                <h3>Sed ut perspiciatis unde omnis</h3>
+                <ul>
+                    <li>iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam</li>
+                    <li>eaque ipsa quae ab illo inventore veritatis</li>
+                    <li>et quasi architecto beatae vitae dicta sunt explicabo.&nbsp;</li>
+                </ul>
+
+                </td>
+                <td style="background: transparent url({IMG_DIR}postit.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; width: 33%; text-align: center; vertical-align: bottom;">
+                <h3>Ut enim ad minima</h3>
+                Veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur.<br>
+                <h3>
+                <img style="width: 180px; height: 144px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_smile.png "><br></h3>
+                </td>
+                </tr>
+                </tbody>
+                </table>
+                <p><br>
+                <br>
+                </p>
+                </body>
+');
+*/
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleTeacher', 'TemplateTitleTeacherDescription', 'yourinstructor.gif', '
+<head>
+                   {CSS}
+                   <style type="text/css">
+                    .text
+                    {
+                        font-weight: normal;
+                    }
+                    </style>
+                </head>
+                <body>
+                    <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                    <tbody>
+                    <tr>
+                    <td></td>
+                    <td style="height: 33%;"></td>
+                    <td></td>
+                    </tr>
+                    <tr>
+                    <td style="width: 25%;"></td>
+                    <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right; font-weight: bold;" colspan="1" rowspan="1">
+                    <span class="text">
+                    <br>
+                    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis pellentesque.</span>
+                    </td>
+                    <td style="width: 25%; font-weight: bold;">
+                    <img style="width: 180px; height: 241px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_case.png "></td>
+                    </tr>
+                    </tbody>
+                    </table>
+                    <p><br>
+                    <br>
+                    </p>
+                </body>
+');
+
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleLeftList', 'TemplateTitleListLeftListDescription', 'leftlist.gif', '
+<head>
+               {CSS}
+           </head>
+            <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                <tbody>
+                <tr>
+                <td style="width: 66%;"></td>
+                <td style="vertical-align: bottom; width: 33%;" colspan="1" rowspan="4">&nbsp;<img style="width: 180px; height: 248px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_reads.png "><br>
+                </td>
+                </tr>
+                <tr align="right">
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">Lorem
+                ipsum dolor sit amet.
+                </td>
+                </tr>
+                <tr align="right">
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
+                Vivamus
+                a quam.&nbsp;<br>
+                </td>
+                </tr>
+                <tr align="right">
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
+                Proin
+                a est stibulum ante ipsum.</td>
+                </tr>
+                </tbody>
+                </table>
+            <p><br>
+            <br>
+            </p>
+            </body>
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleLeftRightList', 'TemplateTitleLeftRightListDescription', 'leftrightlist.gif', '
+
+<head>
+               {CSS}
+            </head>
+            <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; height: 400px; width: 720px;" border="0" cellpadding="15" cellspacing="6">
+                <tbody>
+                <tr>
+                <td></td>
+                <td style="vertical-align: top;" colspan="1" rowspan="4">&nbsp;<img style="width: 180px; height: 294px;" alt="Trainer" src="{COURSE_DIR}images/trainer/trainer_join_hands.png "><br>
+                </td>
+                <td></td>
+                </tr>
+                <tr>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right;">Lorem
+                ipsum dolor sit amet.
+                </td>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: left;">
+                Convallis
+                ut.&nbsp;Cras dui magna.</td>
+                </tr>
+                <tr>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right;">
+                Vivamus
+                a quam.&nbsp;<br>
+                </td>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: left;">
+                Etiam
+                lacinia stibulum ante.<br>
+                </td>
+                </tr>
+                <tr>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right;">
+                Proin
+                a est stibulum ante ipsum.</td>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: left;">
+                Consectetuer
+                adipiscing elit. <br>
+                </td>
+                </tr>
+                </tbody>
+                </table>
+            <p><br>
+            <br>
+            </p>
+            </body>
+
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleRightList', 'TemplateTitleRightListDescription', 'rightlist.gif', '
+    <head>
+               {CSS}
+            </head>
+            <body style="direction: ltr;">
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                <tbody>
+                <tr>
+                <td style="vertical-align: bottom; width: 50%;" colspan="1" rowspan="4"><img style="width: 300px; height: 199px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_points_right.png"><br>
+                </td>
+                <td style="width: 50%;"></td>
+                </tr>
+                <tr>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 50%;">
+                Convallis
+                ut.&nbsp;Cras dui magna.</td>
+                </tr>
+                <tr>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 50%;">
+                Etiam
+                lacinia.<br>
+                </td>
+                </tr>
+                <tr>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 50%;">
+                Consectetuer
+                adipiscing elit. <br>
+                </td>
+                </tr>
+                </tbody>
+                </table>
+            <p><br>
+            <br>
+            </p>
+            </body>
+');
+
+/*
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleComparison', 'TemplateTitleComparisonDescription', 'compare.gif', '
+<head>
+            {CSS}
+            </head>
+
+            <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                <tr>
+                    <td style="height: 10%; width: 33%;"></td>
+                    <td style="vertical-align: top; width: 33%;" colspan="1" rowspan="2">&nbsp;<img style="width: 180px; height: 271px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_standing.png "><br>
+                    </td>
+                    <td style="height: 10%; width: 33%;"></td>
+                </tr>
+            <tr>
+            <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right;">
+            Lorem ipsum dolor sit amet.
+            </td>
+            <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 33%;">
+            Convallis
+            ut.&nbsp;Cras dui magna.</td>
+            </tr>
+            </body>
+');
+*/
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleDiagram', 'TemplateTitleDiagramDescription', 'diagram.gif', '
+    <head>
+                       {CSS}
+                    </head>
+
+                    <body>
+                    <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                    <tbody>
+                    <tr>
+                    <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; height: 33%; width: 33%;">
+                    <br>
+                    Etiam
+                    lacinia stibulum ante.
+                    Convallis
+                    ut.&nbsp;Cras dui magna.</td>
+                    <td colspan="1" rowspan="3">
+                        <img style="width: 350px; height: 267px;" alt="Alaska chart" src="{COURSE_DIR}images/diagrams/alaska_chart.png "></td>
+                    </tr>
+                    <tr>
+                    <td colspan="1" rowspan="1">
+                    <img style="width: 300px; height: 199px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_points_right.png "></td>
+                    </tr>
+                    <tr>
+                    </tr>
+                    </tbody>
+                    </table>
+                    <p><br>
+                    <br>
+                    </p>
+                    </body>
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleDesc', 'TemplateTitleCheckListDescription', 'description.gif', '
+<head>
+                       {CSS}
+                    </head>
+                    <body>
+                        <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                        <tbody>
+                        <tr>
+                        <td style="width: 50%; vertical-align: top;">
+                            <img style="width: 48px; height: 49px; float: left;" alt="01" src="{COURSE_DIR}images/small/01.png " hspace="5"><br>Lorem ipsum dolor sit amet<br><br><br>
+                            <img style="width: 48px; height: 49px; float: left;" alt="02" src="{COURSE_DIR}images/small/02.png " hspace="5">
+                            <br>Ut enim ad minim veniam<br><br><br>
+                            <img style="width: 48px; height: 49px; float: left;" alt="03" src="{COURSE_DIR}images/small/03.png " hspace="5">Duis aute irure dolor in reprehenderit<br><br><br>
+                            <img style="width: 48px; height: 49px; float: left;" alt="04" src="{COURSE_DIR}images/small/04.png " hspace="5">Neque porro quisquam est</td>
+
+                        <td style="vertical-align: top; width: 50%; text-align: right;" colspan="1" rowspan="1">
+                            <img style="width: 300px; height: 291px;" alt="Gearbox" src="{COURSE_DIR}images/diagrams/gearbox.jpg "><br></td>
+                        </tr><tr></tr>
+                        </tbody>
+                        </table>
+                        <p><br>
+                        <br>
+                        </p>
+                    </body>
+');
+
+/*
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleObjectives', 'TemplateTitleObjectivesDescription', 'courseobjectives.gif', '
+<head>
+                   {CSS}
+                </head>
+
+                <body>
+                    <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                    <tbody>
+                    <tr>
+                    <td style="vertical-align: bottom; width: 33%;" colspan="1" rowspan="2">
+                    <img style="width: 180px; height: 271px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_chair.png "><br>
+                    </td>
+                    <td style="height: 10%; width: 66%;"></td>
+                    </tr>
+                    <tr>
+                    <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 66%;">
+                    <h3>Lorem ipsum dolor sit amet</h3>
+                    <ul>
+                    <li>consectetur adipisicing elit</li>
+                    <li>sed do eiusmod tempor incididunt</li>
+                    <li>ut labore et dolore magna aliqua</li>
+                    </ul>
+                    <h3>Ut enim ad minim veniam</h3>
+                    <ul>
+                    <li>quis nostrud exercitation ullamco</li>
+                    <li>laboris nisi ut aliquip ex ea commodo consequat</li>
+                    <li>Excepteur sint occaecat cupidatat non proident</li>
+                    </ul>
+                    </td>
+                    </tr>
+                    </tbody>
+                    </table>
+                <p><br>
+                <br>
+                </p>
+                </body>
+');
+*/
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleCycle', 'TemplateTitleCycleDescription', 'cyclechart.gif', '
+<head>
+                   {CSS}
+                   <style>
+                   .title
+                   {
+                       color: white; font-weight: bold;
+                   }
+                   </style>
+                </head>
+
+
+                <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="8" cellspacing="6">
+                <tbody>
+                <tr>
+                    <td style="text-align: center; vertical-align: bottom; height: 10%;" colspan="3" rowspan="1">
+                        <img style="width: 250px; height: 76px;" alt="arrow" src="{COURSE_DIR}images/diagrams/top_arrow.png ">
+                    </td>
+                </tr>
+                <tr>
+                    <td style="height: 5%; width: 45%; vertical-align: top; background-color: rgb(153, 153, 153); text-align: center;">
+                        <span class="title">Lorem ipsum</span>
+                    </td>
+
+                    <td style="height: 5%; width: 10%;"></td>
+                    <td style="height: 5%; vertical-align: top; background-color: rgb(153, 153, 153); text-align: center;">
+                        <span class="title">Sed ut perspiciatis</span>
+                    </td>
+                </tr>
+                    <tr>
+                        <td style="background-color: rgb(204, 204, 255); width: 45%; vertical-align: top;">
+                            <ul>
+                                <li>dolor sit amet</li>
+                                <li>consectetur adipisicing elit</li>
+                                <li>sed do eiusmod tempor&nbsp;</li>
+                                <li>adipisci velit, sed quia non numquam</li>
+                                <li>eius modi tempora incidunt ut labore et dolore magnam</li>
+                            </ul>
+                </td>
+                <td style="width: 10%;"></td>
+                <td style="background-color: rgb(204, 204, 255); width: 45%; vertical-align: top;">
+                    <ul>
+                    <li>ut enim ad minim veniam</li>
+                    <li>quis nostrud exercitation</li><li>ullamco laboris nisi ut</li>
+                    <li> Quis autem vel eum iure reprehenderit qui in ea</li>
+                    <li>voluptate velit esse quam nihil molestiae consequatur,</li>
+                    </ul>
+                    </td>
+                    </tr>
+                    <tr align="center">
+                    <td style="height: 10%; vertical-align: top;" colspan="3" rowspan="1">
+                    <img style="width: 250px; height: 76px;" alt="arrow" src="{COURSE_DIR}images/diagrams/bottom_arrow.png ">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
+                </td>
+                </tr>
+                </tbody>
+                </table>
+                <p><br>
+                <br>
+                </p>
+                </body>
+');
+
+/*
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleLearnerWonder', 'TemplateTitleLearnerWonderDescription', 'learnerwonder.gif', '
+<head>
+               {CSS}
+            </head>
+
+            <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                <tbody>
+                <tr>
+                <td style="width: 33%;" colspan="1" rowspan="4">
+                    <img style="width: 120px; height: 348px;" alt="learner wonders" src="{COURSE_DIR}images/silhouette.png "><br>
+                </td>
+                <td style="width: 66%;"></td>
+                </tr>
+                <tr align="center">
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
+                Convallis
+                ut.&nbsp;Cras dui magna.</td>
+                </tr>
+                <tr align="center">
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
+                Etiam
+                lacinia stibulum ante.<br>
+                </td>
+                </tr>
+                <tr align="center">
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
+                Consectetuer
+                adipiscing elit. <br>
+                </td>
+                </tr>
+                </tbody>
+                </table>
+            <p><br>
+            <br>
+            </p>
+            </body>
+');
+*/
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleTimeline', 'TemplateTitleTimelineDescription', 'phasetimeline.gif', '
+<head>
+               {CSS}
+                <style>
+                .title
+                {
+                    font-weight: bold; text-align: center;
+                }
+                </style>
+            </head>
+
+            <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="8" cellspacing="5">
+                <tbody>
+                <tr class="title">
+                    <td style="vertical-align: top; height: 3%; background-color: rgb(224, 224, 224);">Lorem ipsum</td>
+                    <td style="height: 3%;"></td>
+                    <td style="vertical-align: top; height: 3%; background-color: rgb(237, 237, 237);">Perspiciatis</td>
+                    <td style="height: 3%;"></td>
+                    <td style="vertical-align: top; height: 3%; background-color: rgb(245, 245, 245);">Nemo enim</td>
+                </tr>
+
+                <tr>
+                    <td style="vertical-align: top; width: 30%; background-color: rgb(224, 224, 224);">
+                        <ul>
+                        <li>dolor sit amet</li>
+                        <li>consectetur</li>
+                        <li>adipisicing elit</li>
+                    </ul>
+                    <br>
+                    </td>
+                    <td>
+                        <img style="width: 32px; height: 32px;" alt="arrow" src="{COURSE_DIR}images/small/arrow.png ">
+                    </td>
+
+                    <td style="vertical-align: top; width: 30%; background-color: rgb(237, 237, 237);">
+                        <ul>
+                            <li>ut labore</li>
+                            <li>et dolore</li>
+                            <li>magni dolores</li>
+                        </ul>
+                    </td>
+                    <td>
+                        <img style="width: 32px; height: 32px;" alt="arrow" src="{COURSE_DIR}images/small/arrow.png ">
+                    </td>
+
+                    <td style="vertical-align: top; background-color: rgb(245, 245, 245); width: 30%;">
+                        <ul>
+                            <li>neque porro</li>
+                            <li>quisquam est</li>
+                            <li>qui dolorem&nbsp;&nbsp;</li>
+                        </ul>
+                        <br><br>
+                    </td>
+                </tr>
+                </tbody>
+                </table>
+            <p><br>
+            <br>
+            </p>
+            </body>
+');
+
+/*
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleStopAndThink', 'TemplateTitleStopAndThinkDescription', 'stopthink.gif', '
+<head>
+               {CSS}
+            </head>
+            <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                <tbody>
+                <tr>
+                <td style="vertical-align: bottom; width: 33%;" colspan="1" rowspan="2">
+                    <img style="width: 180px; height: 169px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_staring.png ">
+                <br>
+                </td>
+                <td style="height: 10%; width: 66%;"></td>
+                </tr>
+                <tr>
+                <td style="background: transparent url({IMG_DIR}postit.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; width: 66%; vertical-align: middle; text-align: center;">
+                    <h3>Attentio sectetur adipisicing elit</h3>
+                    <ul>
+                        <li>sed do eiusmod tempor incididunt</li>
+                        <li>ut labore et dolore magna aliqua</li>
+                        <li>quis nostrud exercitation ullamco</li>
+                    </ul><br></td>
+                </tr>
+                </tbody>
+                </table>
+            <p><br>
+            <br>
+            </p>
+            </body>
+');
+*/
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleTable', 'TemplateTitleCheckListDescription', 'table.gif', '
+<head>
+                   {CSS}
+                   <style type="text/css">
+                .title
+                {
+                    font-weight: bold; text-align: center;
+                }
+
+                .items
+                {
+                    text-align: right;
+                }
+
+
+                    </style>
+
+                </head>
+                <body>
+                <br />
+               <h2>A table</h2>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px;" border="1" cellpadding="5" cellspacing="0">
+                <tbody>
+                <tr class="title">
+                    <td>City</td>
+                    <td>2005</td>
+                    <td>2006</td>
+                    <td>2007</td>
+                    <td>2008</td>
+                </tr>
+                <tr class="items">
+                    <td>Lima</td>
+                    <td>10,40</td>
+                    <td>8,95</td>
+                    <td>9,19</td>
+                    <td>9,76</td>
+                </tr>
+                <tr class="items">
+                <td>New York</td>
+                    <td>18,39</td>
+                    <td>17,52</td>
+                    <td>16,57</td>
+                    <td>16,60</td>
+                </tr>
+                <tr class="items">
+                <td>Barcelona</td>
+                    <td>0,10</td>
+                    <td>0,10</td>
+                    <td>0,05</td>
+                    <td>0,05</td>
+                </tr>
+                <tr class="items">
+                <td>Paris</td>
+                    <td>3,38</td>
+                    <td >3,63</td>
+                    <td>3,63</td>
+                    <td>3,54</td>
+                </tr>
+                </tbody>
+                </table>
+                <br>
+                </body>
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleAudio', 'TemplateTitleAudioDescription', 'audiocomment.gif', '
+<head>
+               {CSS}
+            </head>
+                   <body>
+                    <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                    <tbody>
+                    <tr>
+                    <td>
+                    <div align="center">
+                    <span style="text-align: center;">
+                        <embed  type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="300" height="20" bgcolor="#FFFFFF" src="{REL_PATH}main/inc/lib/mediaplayer/player.swf" allowfullscreen="false" allowscriptaccess="always" flashvars="file={COURSE_DIR}audio/ListeningComprehension.mp3&amp;autostart=true"></embed>
+                    </span></div>
+
+                    <br>
+                    </td>
+                    <td colspan="1" rowspan="3"><br>
+                        <img style="width: 300px; height: 341px; float: right;" alt="image" src="{COURSE_DIR}images/diagrams/head_olfactory_nerve.png "><br></td>
+                    </tr>
+                    <tr>
+                    <td colspan="1" rowspan="1">
+                        <img style="width: 180px; height: 271px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_glasses.png"><br></td>
+                    </tr>
+                    <tr>
+                    </tr>
+                    </tbody>
+                    </table>
+                    <p><br>
+                    <br>
+                    </p>
+                    </body>
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleVideo', 'TemplateTitleVideoDescription', 'video.gif', '
+<head>
+                {CSS}
+            </head>
+
+            <body>
+            <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+            <tbody>
+            <tr>
+            <td style="width: 50%; vertical-align: top;">
+
+                 <div style="text-align: center;" id="player810625-parent">
+                    <div style="border-style: none; overflow: hidden; width: 320px; height: 240px; background-color: rgb(220, 220, 220);">
+
+                        <div id="player810625">
+                            <div id="player810625-config" style="overflow: hidden; display: none; visibility: hidden; width: 0px; height: 0px;">url={REL_PATH}main/default_course_document/video/flv/example.flv width=320 height=240 loop=false play=false downloadable=false fullscreen=true displayNavigation=true displayDigits=true align=left dispPlaylist=none playlistThumbs=false</div>
+                        </div>
+
+                        <embed
+                            type="application/x-shockwave-flash"
+                            src="{REL_PATH}main/inc/lib/mediaplayer/player.swf"
+                            width="320"
+                            height="240"
+                            id="single"
+                            name="single"
+                            quality="high"
+                            allowfullscreen="true"
+                            flashvars="width=320&height=240&autostart=false&file={REL_PATH}main/default_course_document/video/flv/example.flv&repeat=false&image=&showdownload=false&link={REL_PATH}main/default_course_document/video/flv/example.flv&showdigits=true&shownavigation=true&logo="
+                        />
+
+                    </div>
+                </div>
+
+            </td>
+            <td style="background: transparent url({IMG_DIR}faded_grey.png) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 50%;">
+            <h3><br>
+            </h3>
+            <h3>Lorem ipsum dolor sit amet</h3>
+                <ul>
+                <li>consectetur adipisicing elit</li>
+                <li>sed do eiusmod tempor incididunt</li>
+                <li>ut labore et dolore magna aliqua</li>
+                </ul>
+            <h3>Ut enim ad minim veniam</h3>
+                <ul>
+                <li>quis nostrud exercitation ullamco</li>
+                <li>laboris nisi ut aliquip ex ea commodo consequat</li>
+                <li>Excepteur sint occaecat cupidatat non proident</li>
+                </ul>
+            </td>
+            </tr>
+            </tbody>
+            </table>
+            <p><br>
+            <br>
+            </p>
+             <style type="text/css">body{}</style><!-- to fix a strange bug appearing with firefox when editing this template -->
+            </body>
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleFlash', 'TemplateTitleFlashDescription', 'flash.gif', '
+<head>
+               {CSS}
+            </head>
+            <body>
+            <center>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 100%; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                <tbody>
+                    <tr>
+                    <td align="center">
+                    <embed width="700" height="300" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="{COURSE_DIR}flash/SpinEchoSequence.swf" play="true" loop="true" menu="true"></embed></span><br />
+                    </td>
+                    </tr>
+                </tbody>
+                </table>
+                <p><br>
+                <br>
+                </p>
+            </center>
+            </body>
+');
+
+DROP TABLE IF EXISTS reservation_category;
+CREATE TABLE IF NOT EXISTS reservation_category (
+   id  int unsigned NOT NULL auto_increment,
+   parent_id  int NOT NULL default 0,
+   name  varchar(128) NOT NULL default '',
+  PRIMARY KEY  ( id )
+);
+
+DROP TABLE IF EXISTS reservation_category_rights;
+CREATE TABLE IF NOT EXISTS reservation_category_rights  (
+    id  int unsigned NOT NULL auto_increment,
+    category_id  int NOT NULL default 0,
+    class_id  int NOT NULL default 0,
+    m_items  tinyint NOT NULL default 0,
+    PRIMARY KEY  ( id )
+);
+
+DROP TABLE IF EXISTS reservation_item;
+CREATE TABLE IF NOT EXISTS  reservation_item  (
+   id  int unsigned NOT NULL auto_increment,
+   category_id  int unsigned NOT NULL default 0,
+   course_code  varchar(40) NOT NULL default '',
+   name  varchar(128) NOT NULL default '',
+   description  text NOT NULL,
+   blackout  tinyint NOT NULL default 0,
+   creator  int unsigned NOT NULL default 0,
+   always_available TINYINT NOT NULL default 0,
+  PRIMARY KEY  ( id )
+);
+
+
+
+--
+-- Table structure for table reservation item_rights
+--
+
+DROP TABLE IF EXISTS reservation_item_rights;
+CREATE TABLE IF NOT EXISTS  reservation_item_rights  (
+   item_id  int unsigned NOT NULL default 0,
+   class_id  int unsigned NOT NULL default 0,
+   edit_right  tinyint unsigned NOT NULL default 0,
+   delete_right  tinyint unsigned NOT NULL default 0,
+   m_reservation  tinyint unsigned NOT NULL default 0,
+   view_right  tinyint NOT NULL default 0,
+  PRIMARY KEY  ( item_id , class_id )
+);
+
+
+
+--
+-- Table structure for main reservation table
+--
+
+DROP TABLE IF EXISTS reservation_main;
+CREATE TABLE IF NOT EXISTS  reservation_main  (
+   id  int unsigned NOT NULL auto_increment,
+   subid  int unsigned NOT NULL default 0,
+   item_id  int unsigned NOT NULL default 0,
+   auto_accept  tinyint unsigned NOT NULL default 0,
+   max_users  int unsigned NOT NULL default 1,
+   start_at  datetime NOT NULL default '0000-00-00 00:00:00',
+   end_at  datetime NOT NULL default '0000-00-00 00:00:00',
+   subscribe_from  datetime NOT NULL default '0000-00-00 00:00:00',
+   subscribe_until  datetime NOT NULL default '0000-00-00 00:00:00',
+   subscribers  int unsigned NOT NULL default 0,
+   notes  text NOT NULL,
+   timepicker  tinyint NOT NULL default 0,
+   timepicker_min  int NOT NULL default 0,
+   timepicker_max  int NOT NULL default 0,
+  PRIMARY KEY  ( id )
+);
+
+--
+-- Table structure for reservation subscription table
+--
+
+DROP TABLE IF EXISTS reservation_subscription;
+CREATE TABLE IF NOT EXISTS  reservation_subscription  (
+   dummy  int unsigned NOT NULL auto_increment,
+   user_id  int unsigned NOT NULL default 0,
+   reservation_id  int unsigned NOT NULL default 0,
+   accepted  tinyint unsigned NOT NULL default 0,
+   start_at  datetime NOT NULL default '0000-00-00 00:00:00',
+   end_at  datetime NOT NULL default '0000-00-00 00:00:00',
+  PRIMARY KEY  ( dummy )
+);
+
+--
+-- Table structure for table user_rel_user
+--
+DROP TABLE IF EXISTS user_rel_user;
+CREATE TABLE IF NOT EXISTS user_rel_user (
+  id bigint unsigned not null auto_increment,
+  user_id int unsigned not null,
+  friend_user_id int unsigned not null,
+  relation_type int not null default 0,
+  last_edit DATETIME,
+  PRIMARY KEY(id)
+);
+
+ALTER TABLE user_rel_user ADD INDEX idx_user_rel_user__user (user_id);
+ALTER TABLE user_rel_user ADD INDEX idx_user_rel_user__friend_user(friend_user_id);
+ALTER TABLE user_rel_user ADD INDEX idx_user_rel_user__user_friend_user(user_id,friend_user_id);
+
+--
+-- Table structure for table user_friend_relation_type
+--
+DROP TABLE IF EXISTS user_friend_relation_type;
+CREATE TABLE IF NOT EXISTS user_friend_relation_type(
+  id int unsigned not null auto_increment,
+  title char(20),
+  PRIMARY KEY(id)
+);
+
+
+--
+-- Table structure for MD5 API keys for users
+--
+
+DROP TABLE IF EXISTS user_api_key;
+CREATE TABLE IF NOT EXISTS user_api_key (
+    id int unsigned NOT NULL auto_increment,
+    user_id int unsigned NOT NULL,
+    api_key char(32) NOT NULL,
+    api_service char(10) NOT NULL default 'dokeos',
+    api_end_point text DEFAULT NULL,
+    created_date datetime DEFAULT NULL,
+    validity_start_date datetime DEFAULT NULL,
+    validity_end_date datetime DEFAULT NULL,
+    description text DEFAULT NULL,
+    PRIMARY KEY (id)
+);
+ALTER TABLE user_api_key ADD INDEX idx_user_api_keys_user (user_id);
+
+-- Table structure for table message
+-- status: 0 read, 1 unread, 3 deleted, 5 pending invitation, 6 accepted invitation, 7 invitation denied
+
+DROP TABLE IF EXISTS message;
+CREATE TABLE IF NOT EXISTS message(
+    id bigint unsigned not null auto_increment,
+    user_sender_id int unsigned not null,
+    user_receiver_id int unsigned not null,
+    msg_status tinyint unsigned not null default 0,
+    send_date datetime not null default '0000-00-00 00:00:00',
+    title varchar(255) not null,
+    content text not null,
+    group_id int unsigned not null default 0,
+    parent_id int unsigned not null default 0,
+    update_date datetime not null default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+ALTER TABLE message ADD INDEX idx_message_user_sender(user_sender_id);
+ALTER TABLE message ADD INDEX idx_message_user_receiver(user_receiver_id);
+ALTER TABLE message ADD INDEX idx_message_user_sender_user_receiver(user_sender_id,user_receiver_id);
+ALTER TABLE message ADD INDEX idx_message_group(group_id);
+ALTER TABLE message ADD INDEX idx_message_parent(parent_id);
+
+INSERT INTO user_friend_relation_type (id,title)
+VALUES
+(1,'SocialUnknow'),
+(2,'SocialParent'),
+(3,'SocialFriend'),
+(4,'SocialGoodFriend'),
+(5,'SocialEnemy'),
+(6,'SocialDeleted');
+
+--
+-- Table structure for table legal (Terms & Conditions)
+--
+
+DROP TABLE IF EXISTS legal;
+CREATE TABLE IF NOT EXISTS legal (
+  legal_id int NOT NULL auto_increment,
+  language_id int NOT NULL,
+  date int NOT NULL default 0,
+  content text,
+  type int NOT NULL,
+  changes text NOT NULL,
+  version int,
+  PRIMARY KEY (legal_id,language_id)
+);
+
+--
+-- Table structure for certificate with gradebook
+--
+
+DROP TABLE IF EXISTS gradebook_certificate;
+CREATE TABLE IF NOT EXISTS gradebook_certificate (
+    id bigint unsigned not null auto_increment,
+    cat_id int unsigned not null,
+    user_id int unsigned not null,
+    score_certificate float unsigned not null default 0,
+    created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+    path_certificate text null,
+    PRIMARY KEY(id)
+);
+ALTER TABLE gradebook_certificate ADD INDEX idx_gradebook_certificate_category_id(cat_id);
+ALTER TABLE gradebook_certificate ADD INDEX idx_gradebook_certificate_user_id(user_id);
+ALTER TABLE gradebook_certificate ADD INDEX idx_gradebook_certificate_category_id_user_id(cat_id,user_id);
+
+--
+-- Tables structure for search tool
+--
+
+-- specific fields tables
+DROP TABLE IF EXISTS specific_field;
+CREATE TABLE IF NOT EXISTS specific_field (
+    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+    code char(1) NOT NULL,
+    name VARCHAR(200) NOT NULL
+);
+
+DROP TABLE IF EXISTS specific_field_values;
+CREATE TABLE IF NOT EXISTS specific_field_values (
+    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+    course_code VARCHAR(40) NOT NULL,
+    tool_id VARCHAR(100) NOT NULL,
+    ref_id INT NOT NULL,
+    field_id INT NOT NULL,
+    value VARCHAR(200) NOT NULL
+);
+ALTER TABLE specific_field ADD CONSTRAINT unique_specific_field__code UNIQUE (code);
+
+-- search engine references to map dokeos resources
+
+DROP TABLE IF EXISTS search_engine_ref;
+CREATE TABLE IF NOT EXISTS search_engine_ref (
+    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+    course_code VARCHAR( 40 ) NOT NULL,
+    tool_id VARCHAR( 100 ) NOT NULL,
+    ref_id_high_level INT NOT NULL,
+    ref_id_second_level INT NULL,
+    search_did INT NOT NULL
+);
+
+--
+-- Table structure for table sessions categories
+--
+
+DROP TABLE IF EXISTS session_category;
+CREATE TABLE IF NOT EXISTS session_category (
+    id int NOT NULL auto_increment,
+    name varchar(100) default NULL,
+    date_start date default NULL,
+    date_end date default NULL,
+	access_url_id INT NOT NULL default 1,
+  PRIMARY KEY  (id)
+);
+
+
+--
+-- Table structure for table user tag
+--
+
+DROP TABLE IF EXISTS tag;
+CREATE TABLE IF NOT EXISTS tag (
+    id int NOT NULL auto_increment,
+    tag char(255) NOT NULL,
+    field_id int NOT NULL,
+    count int NOT NULL,
+    PRIMARY KEY  (id)
+);
+
+DROP TABLE IF EXISTS user_rel_tag;
+CREATE TABLE IF NOT EXISTS user_rel_tag (
+    id int NOT NULL auto_increment,
+    user_id int NOT NULL,
+    tag_id int NOT NULL,
+    PRIMARY KEY  (id)
+);
+
+DROP TABLE IF EXISTS announcement_rel_group;
+CREATE TABLE IF NOT EXISTS announcement_rel_group (
+  id INT unsigned NOT NULL auto_increment,
+	group_id int NOT NULL,
+	announcement_id int NOT NULL,
+	PRIMARY KEY (id)
+);
+
+--
+-- Table structure for table message attachment
+--
+
+DROP TABLE IF EXISTS message_attachment;
+CREATE TABLE IF NOT EXISTS message_attachment (
+    id int NOT NULL AUTO_INCREMENT,
+    path varchar(255) NOT NULL,
+    comment text,
+    size int NOT NULL default 0,
+    message_id int NOT NULL,
+    filename varchar(255) NOT NULL,
+    PRIMARY KEY  (id)
+);
+
+--
+-- Table structure for table block
+--
+
+DROP TABLE IF EXISTS block;
+CREATE TABLE IF NOT EXISTS block (
+    id INT NOT NULL AUTO_INCREMENT,
+    name VARCHAR(255) NULL,
+    description TEXT NULL,
+    path VARCHAR(255) NOT NULL,
+    controller VARCHAR(100) NOT NULL,
+    active TINYINT NOT NULL DEFAULT 1,
+    PRIMARY KEY(id)
+);
+ALTER TABLE block ADD UNIQUE(path);
+
+--
+-- Structure for table 'course_request' ("Course validation" feature)
+--
+
+DROP TABLE IF EXISTS course_request;
+CREATE TABLE IF NOT EXISTS course_request (
+  id int NOT NULL AUTO_INCREMENT,
+  code varchar(40) NOT NULL,
+  user_id int unsigned NOT NULL default '0',
+  directory varchar(40) DEFAULT NULL,
+  db_name varchar(40) DEFAULT NULL,
+  course_language varchar(20) DEFAULT NULL,
+  title varchar(250) DEFAULT NULL,
+  description text,
+  category_code varchar(40) DEFAULT NULL,
+  tutor_name varchar(200) DEFAULT NULL,
+  visual_code varchar(40) DEFAULT NULL,
+  request_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  objetives text,
+  target_audience text,
+  status int unsigned NOT NULL default '0',
+  info int unsigned NOT NULL default '0',
+  exemplary_content int unsigned NOT NULL default '0',
+  PRIMARY KEY (id),
+  UNIQUE KEY code (code)
+);
+
+--
+-- Structure for Careers, Promotions and Usergroups
+--
+
+DROP TABLE IF EXISTS career;
+CREATE TABLE IF NOT EXISTS career (
+    id INT NOT NULL AUTO_INCREMENT,
+    name VARCHAR(255) NOT NULL ,
+    description TEXT NOT NULL,
+    status INT NOT NULL default '0',
+    created_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+    updated_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+    PRIMARY KEY (id)
+);
+
+DROP TABLE IF EXISTS promotion;
+CREATE TABLE IF NOT EXISTS promotion (
+    id INT NOT NULL AUTO_INCREMENT,
+    name VARCHAR(255) NOT NULL ,
+    description TEXT NOT NULL,
+    career_id INT NOT NULL,
+    status INT NOT NULL default '0',
+    created_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+    updated_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+DROP TABLE IF EXISTS usergroup;
+CREATE TABLE IF NOT EXISTS usergroup (
+    id INT NOT NULL AUTO_INCREMENT,
+    name VARCHAR(255) NOT NULL,
+    group_type INT unsigned NOT NULL default 0,
+    description TEXT NOT NULL,
+    picture varchar(255) NOT NULL,
+    url varchar(255) NOT NULL,
+    visibility int NOT NULL,
+    updated_on varchar(255) NOT NULL,
+    created_on varchar(255) NOT NULL,
+    PRIMARY KEY (id)
+);
+
+DROP TABLE IF EXISTS usergroup_rel_user;
+CREATE TABLE IF NOT EXISTS usergroup_rel_user(
+    id INT NOT NULL AUTO_INCREMENT,
+    usergroup_id INT NOT NULL,
+    user_id 	INT NOT NULL,
+    relation_type INT DEFAULT 0,
+    PRIMARY KEY (id)
+);
+
+ALTER TABLE usergroup_rel_user ADD INDEX ( usergroup_id );
+ALTER TABLE usergroup_rel_user ADD INDEX ( user_id );
+ALTER TABLE usergroup_rel_user ADD INDEX ( relation_type );
+
+DROP TABLE IF EXISTS usergroup_rel_course;
+CREATE TABLE IF NOT EXISTS usergroup_rel_course  (
+    id 			INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
+    usergroup_id INT NOT NULL,
+    course_id 	INT NOT NULL
+);
+
+DROP TABLE IF EXISTS usergroup_rel_session;
+CREATE TABLE IF NOT EXISTS usergroup_rel_session (
+    id 			INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
+    usergroup_id INT NOT NULL,
+    session_id  INT NOT NULL
+);
+
+DROP TABLE IF EXISTS usergroup_rel_tag;
+CREATE TABLE IF NOT EXISTS usergroup_rel_tag(
+    id int NOT NULL AUTO_INCREMENT,
+    tag_id int NOT NULL,
+    usergroup_id int NOT NULL,
+    PRIMARY KEY (id)
+);
+
+ALTER TABLE usergroup_rel_tag ADD INDEX ( usergroup_id );
+ALTER TABLE usergroup_rel_tag ADD INDEX ( tag_id );
+
+DROP TABLE IF EXISTS usergroup_rel_usergroup;
+CREATE TABLE IF NOT EXISTS usergroup_rel_usergroup (
+	id int NOT NULL AUTO_INCREMENT,
+	group_id int NOT NULL,
+	subgroup_id int NOT NULL,
+	relation_type int NOT NULL,
+	PRIMARY KEY (id)
+);
+
+ALTER TABLE usergroup_rel_usergroup ADD INDEX ( group_id );
+ALTER TABLE usergroup_rel_usergroup ADD INDEX ( subgroup_id );
+ALTER TABLE usergroup_rel_usergroup ADD INDEX ( relation_type );
+
+--
+-- Structure for Mail notifications
+--
+
+DROP TABLE IF EXISTS notification;
+CREATE TABLE IF NOT EXISTS notification (
+	id 			BIGINT PRIMARY KEY NOT NULL AUTO_INCREMENT,
+	dest_user_id INT NOT NULL,
+ 	dest_mail 	CHAR(255),
+ 	title 		CHAR(255),
+  sender_id   INT NOT NULL DEFAULT 0,
+ 	content 	CHAR(255),
+ 	send_freq 	SMALLINT DEFAULT 1,
+ 	created_at 	DATETIME NOT NULL,
+ 	sent_at 	DATETIME NULL
+);
+
+ALTER TABLE notification ADD index mail_notify_sent_index (sent_at);
+ALTER TABLE notification ADD index mail_notify_freq_index (sent_at, send_freq, created_at);
+
+-- Skills management
+
+DROP TABLE IF EXISTS skill;
+CREATE TABLE IF NOT EXISTS skill (
+  id int NOT NULL AUTO_INCREMENT,
+  name varchar(255) NOT NULL,
+  short_code varchar(100) NOT NULL,
+  description TEXT NOT NULL,
+  access_url_id int NOT NULL,
+  icon varchar(255) NOT NULL,
+  PRIMARY KEY (id)
+);
+
+INSERT INTO skill (name) VALUES ('Root');
+
+DROP TABLE IF EXISTS skill_rel_gradebook;
+CREATE TABLE IF NOT EXISTS skill_rel_gradebook (
+  id int NOT NULL AUTO_INCREMENT,
+  gradebook_id int NOT NULL,
+  skill_id int NOT NULL,
+  type varchar(10) NOT NULL,
+  PRIMARY KEY (id)
+);
+
+DROP TABLE IF EXISTS skill_rel_skill;
+CREATE TABLE IF NOT EXISTS skill_rel_skill (
+  id int NOT NULL AUTO_INCREMENT,
+  skill_id int NOT NULL,
+  parent_id int NOT NULL,
+  relation_type int NOT NULL,
+  level int NOT NULL,
+  PRIMARY KEY (id)
+);
+
+INSERT INTO skill_rel_skill VALUES(1, 1, 0, 0, 0);
+
+DROP TABLE IF EXISTS skill_rel_user;
+CREATE TABLE IF NOT EXISTS skill_rel_user (
+  id int NOT NULL AUTO_INCREMENT,
+  user_id int NOT NULL,
+  skill_id int NOT NULL,
+  acquired_skill_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  assigned_by int NOT NULL,
+  PRIMARY KEY (id)
+);
+
+DROP TABLE IF EXISTS skill_profile;
+CREATE TABLE IF NOT EXISTS skill_profile (
+  id INTEGER  NOT NULL AUTO_INCREMENT,
+  name VARCHAR(255)  NOT NULL,
+  description TEXT  NOT NULL,
+  PRIMARY KEY (id)
+);
+
+DROP TABLE IF EXISTS skill_rel_profile;
+CREATE TABLE IF NOT EXISTS skill_rel_profile (
+  id INTEGER  NOT NULL AUTO_INCREMENT,
+  skill_id INTEGER  NOT NULL,
+  profile_id INTEGER  NOT NULL,
+  PRIMARY KEY (id)
+);
+
+--
+-- Table structure for event email sending
+--
+DROP TABLE IF EXISTS event_email_template;
+CREATE TABLE event_email_template (
+  id int NOT NULL AUTO_INCREMENT,
+  message text,
+  subject varchar(255) DEFAULT NULL,
+  event_type_name varchar(255) DEFAULT NULL,
+  activated tinyint NOT NULL DEFAULT '0',
+  language_id int DEFAULT NULL,
+  PRIMARY KEY (id)
+);
+ALTER TABLE event_email_template ADD INDEX event_name_index (event_type_name);
+
+DROP TABLE IF EXISTS event_sent;
+CREATE TABLE event_sent (
+  id int NOT NULL AUTO_INCREMENT,
+  user_from int NOT NULL,
+  user_to int DEFAULT NULL,
+  event_type_name varchar(100) DEFAULT NULL,
+  PRIMARY KEY (id)
+);
+ALTER TABLE event_sent ADD INDEX event_name_index (event_type_name);
+
+DROP TABLE IF EXISTS user_rel_event_type;
+CREATE TABLE user_rel_event_type (
+  id int NOT NULL AUTO_INCREMENT,
+  user_id int NOT NULL,
+  event_type_name varchar(255) NOT NULL,
+  PRIMARY KEY (id)
+);
+ALTER TABLE user_rel_event_type ADD INDEX event_name_index (event_type_name);
+
+-- Course ranking
+
+DROP TABLE IF EXISTS track_course_ranking;
+CREATE TABLE IF NOT EXISTS track_course_ranking (
+    id   int unsigned not null PRIMARY KEY AUTO_INCREMENT,
+    c_id  int unsigned not null,
+    session_id  int unsigned not null default 0,
+    url_id  int unsigned not null default 0,
+    accesses int unsigned not null default 0,
+    total_score int unsigned not null default 0,
+    users int unsigned not null default 0,
+    creation_date datetime not null
+);
+
+ALTER TABLE track_course_ranking ADD INDEX idx_tcc_cid (c_id);
+ALTER TABLE track_course_ranking ADD INDEX idx_tcc_sid (session_id);
+ALTER TABLE track_course_ranking ADD INDEX idx_tcc_urlid (url_id);
+ALTER TABLE track_course_ranking ADD INDEX idx_tcc_creation_date (creation_date);
+
+DROP TABLE IF EXISTS user_rel_course_vote;
+CREATE TABLE IF NOT EXISTS user_rel_course_vote (
+    id int unsigned not null AUTO_INCREMENT PRIMARY KEY,
+    c_id int unsigned not null,
+    user_id int unsigned not null,
+    session_id int unsigned not null default 0,
+    url_id int unsigned not null default 0,
+    vote int unsigned not null default 0
+);
+
+ALTER TABLE user_rel_course_vote ADD INDEX idx_ucv_cid (c_id);
+ALTER TABLE user_rel_course_vote ADD INDEX idx_ucv_uid (user_id);
+ALTER TABLE user_rel_course_vote ADD INDEX idx_ucv_cuid (user_id, c_id);
+
+-- Global chat
+DROP TABLE IF EXISTS chat;
+CREATE TABLE IF NOT EXISTS chat (
+	id			INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
+	from_user	INTEGER,
+	to_user		INTEGER,
+	message		TEXT NOT NULL,
+	sent		DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+	recd		INTEGER UNSIGNED NOT NULL DEFAULT 0,
+	PRIMARY KEY (id)
+);
+
+ALTER TABLE chat ADD INDEX idx_chat_to_user (to_user);
+ALTER TABLE chat ADD INDEX idx_chat_from_user (from_user);
+
+-- Grade Model
+DROP TABLE IF EXISTS grade_model;
+CREATE TABLE grade_model (
+    id INTEGER NOT NULL AUTO_INCREMENT,
+    name VARCHAR(255) NOT NULL,
+    description TEXT,
+    default_lowest_eval_exclude TINYINT default null,
+    default_external_eval TINYINT default null,
+    default_external_eval_prefix VARCHAR(140) default null,
+    PRIMARY KEY (id)
+);
+
+DROP TABLE IF EXISTS grade_components;
+CREATE TABLE grade_components (
+    id INTEGER NOT NULL AUTO_INCREMENT,
+    percentage VARCHAR(255)  NOT NULL,
+    title VARCHAR(255) NOT NULL,
+    acronym VARCHAR(255) NOT NULL,
+    prefix VARCHAR(255) DEFAULT NULL,
+    count_elements INT DEFAULT 0,
+    exclusions INT DEFAULT 0,
+    grade_model_id INT NOT NULL,
+    PRIMARY KEY (id)
+);
+
+ALTER TABLE gradebook_category ADD COLUMN grade_model_id INT DEFAULT 0;
+
+DROP TABLE IF EXISTS course_type;
+CREATE TABLE course_type (
+    id int unsigned not null auto_increment primary key,
+    name varchar(50) not null,
+    translation_var char(40) default 'UndefinedCourseTypeLabel',
+    description TEXT default '',
+    props text default ''
+);
+
+INSERT INTO course_type (id, name) VALUES (1, 'All tools');
+INSERT INTO course_type (id, name) VALUES (2, 'Entry exam');
+
+ALTER TABLE course add course_type_id int unsigned default 1;
+
+DROP TABLE IF EXISTS usergroup_rel_question;
+CREATE TABLE usergroup_rel_question (
+    id int unsigned not null auto_increment primary key,
+    c_id int unsigned not null,
+    question_id int unsigned not null,
+    usergroup_id int unsigned not null,
+    coefficient float(6,2)
+);
+
+DROP TABLE IF EXISTS branch_sync;
+CREATE TABLE branch_sync(
+  id int unsigned not null AUTO_INCREMENT PRIMARY KEY,
+  access_url_id int unsigned not null,
+  branch_name varchar(250) default '',
+  branch_ip varchar(40) default '',
+  latitude decimal(15,7),
+  longitude decimal(15,7),
+  dwn_speed int unsigned default null,
+  up_speed int unsigned default null,
+  delay int unsigned default null,
+  admin_mail varchar(250) default '',
+  admin_name varchar(250) default '',
+  admin_phone varchar(250) default '',
+  last_sync_trans_id bigint unsigned default 0,
+  last_sync_trans_date datetime,
+  last_sync_type char(20) default 'full'
+);
+
+DROP TABLE IF EXISTS branch_sync_log;
+CREATE TABLE branch_sync_log(
+  id bigint unsigned not null AUTO_INCREMENT PRIMARY KEY,
+  branch_sync_id int unsigned not null,
+  sync_trans_id bigint unsigned default 0,
+  sync_trans_date datetime,
+  sync_type char(20)
+);
+
+
+DROP TABLE IF EXISTS branch_transaction_status;
+CREATE TABLE branch_transaction_status (
+    id tinyint not null PRIMARY KEY AUTO_INCREMENT,
+    title char(20)
+);
+
+INSERT INTO branch_transaction_status VALUES (1, 'To be executed'), (2, 'Executed successfully'), (3, 'Execution deprecated'), (4, 'Execution failed');
+
+DROP TABLE IF EXISTS branch_transaction;
+CREATE TABLE branch_transaction (
+    id bigint unsigned not null AUTO_INCREMENT,
+    transaction_id bigint unsigned,
+    branch_id int not null default 0,
+    action char(20),
+    item_id char(36),
+    orig_id char(36),
+    dest_id char(36),
+    info char(20),
+    status_id tinyint not null default 0,
+    time_insert datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+    time_update datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+    PRIMARY KEY (id, transaction_id, branch_id)
+);
+
+-- Stats database
+
+
+
+DROP TABLE IF EXISTS track_c_browsers;
+CREATE TABLE track_c_browsers (
+  id int NOT NULL auto_increment,
+  browser varchar(255) NOT NULL default '',
+  counter int NOT NULL default 0,
+  PRIMARY KEY  (id)
+);
+
+DROP TABLE IF EXISTS track_c_countries;
+CREATE TABLE track_c_countries (
+  id int NOT NULL auto_increment,
+  code varchar(40) NOT NULL default '',
+  country varchar(50) NOT NULL default '',
+  counter int NOT NULL default 0,
+  PRIMARY KEY  (id)
+);
+
+DROP TABLE IF EXISTS track_c_os;
+CREATE TABLE track_c_os (
+  id int NOT NULL auto_increment,
+  os varchar(255) NOT NULL default '',
+  counter int NOT NULL default 0,
+  PRIMARY KEY  (id)
+);
+
+DROP TABLE IF EXISTS track_c_providers;
+CREATE TABLE track_c_providers (
+  id int NOT NULL auto_increment,
+  provider varchar(255) NOT NULL default '',
+  counter int NOT NULL default 0,
+  PRIMARY KEY  (id)
+);
+
+DROP TABLE IF EXISTS track_c_referers;
+CREATE TABLE track_c_referers (
+  id int NOT NULL auto_increment,
+  referer varchar(255) NOT NULL default '',
+  counter int NOT NULL default 0,
+  PRIMARY KEY (id)
+);
+
+DROP TABLE IF EXISTS track_e_access;
+CREATE TABLE track_e_access (
+  access_id int NOT NULL auto_increment,
+  access_user_id int unsigned default NULL,
+  access_date datetime NOT NULL default '0000-00-00 00:00:00',
+  c_id INT NOT NULL DEFAULT 0,
+  access_tool varchar(30) default NULL,
+  access_session_id int NOT NULL default 0,
+  PRIMARY KEY  (access_id),
+  KEY access_user_id (access_user_id),
+  KEY access_cid_user (c_id, access_user_id)
+);
+
+DROP TABLE IF EXISTS track_e_lastaccess;
+CREATE TABLE track_e_lastaccess (
+  access_id bigint NOT NULL auto_increment,
+  access_user_id int unsigned default NULL,
+  access_date datetime NOT NULL default '0000-00-00 00:00:00',
+  c_id INT NOT NULL DEFAULT 0,
+  access_tool varchar(30) default NULL,
+  access_session_id int unsigned default NULL,
+  PRIMARY KEY  (access_id),
+  KEY access_c_id_user_id (c_id, access_user_id),
+  KEY access_user_id (access_user_id),
+  KEY access_cours_code (c_id),
+  KEY access_session_id (access_session_id)
+);
+
+DROP TABLE IF EXISTS track_e_default;
+CREATE TABLE track_e_default (
+  default_id int NOT NULL auto_increment,
+  default_user_id int unsigned NOT NULL default 0,
+  default_cours_code varchar(40) NOT NULL default '',
+  default_date datetime NOT NULL default '0000-00-00 00:00:00',
+  default_event_type varchar(20) NOT NULL default '',
+  default_value_type varchar(20) NOT NULL default '',
+  default_value text NOT NULL,
+  c_id int unsigned default NULL,
+  session_id int unsigned default 0,
+  PRIMARY KEY (default_id)
+);
+
+DROP TABLE IF EXISTS track_e_downloads;
+CREATE TABLE track_e_downloads (
+  down_id int NOT NULL auto_increment,
+  down_user_id int unsigned default NULL,
+  down_date datetime NOT NULL default '0000-00-00 00:00:00',
+  c_id int NOT NULL default 0,
+  down_doc_path varchar(255) NOT NULL default '',
+  down_session_id INT NOT NULL DEFAULT 0,
+  PRIMARY KEY  (down_id)
+);
+
+DROP TABLE IF EXISTS track_e_exercices;
+CREATE TABLE track_e_exercices (
+  exe_id int NOT NULL auto_increment,
+  exe_user_id int unsigned default NULL,
+  exe_date datetime NOT NULL default '0000-00-00 00:00:00',
+  exe_exo_id int unsigned NOT NULL default 0,
+  exe_result float(6,2) NOT NULL default 0,
+  exe_weighting float(6,2) NOT NULL default 0,
+  c_id INT unsigned NOT NULL default 0,
+  PRIMARY KEY  (exe_id)
+);
+
+ALTER TABLE track_e_exercices ADD status varchar(20) NOT NULL default '';
+ALTER TABLE track_e_exercices ADD data_tracking text NOT NULL default '';
+ALTER TABLE track_e_exercices ADD start_date datetime NOT NULL default '0000-00-00 00:00:00';
+ALTER TABLE track_e_exercices ADD steps_counter SMALLINT UNSIGNED NOT NULL default 0;
+ALTER TABLE track_e_exercices ADD session_id INT UNSIGNED NOT NULL default 0;
+ALTER TABLE track_e_exercices ADD INDEX ( session_id ) ;
+ALTER TABLE track_e_exercices ADD orig_lp_id int  NOT NULL default 0;
+ALTER TABLE track_e_exercices ADD orig_lp_item_id int  NOT NULL default 0;
+ALTER TABLE track_e_exercices ADD exe_duration int UNSIGNED NOT NULL default 0;
+ALTER TABLE track_e_exercices ADD COLUMN expired_time_control datetime NOT NULL DEFAULT '0000-00-00 00:00:00';
+ALTER TABLE track_e_exercices ADD COLUMN orig_lp_item_view_id INT NOT NULL DEFAULT 0;
+ALTER TABLE track_e_exercices ADD COLUMN questions_to_check TEXT  NOT NULL DEFAULT '';
+
+DROP TABLE IF EXISTS track_e_attempt;
+CREATE TABLE track_e_attempt (
+    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+    exe_id int default NULL,
+    user_id int NOT NULL default 0,
+    question_id int NOT NULL default 0,
+    answer text NOT NULL,
+    teacher_comment text NOT NULL,
+    marks float(6,2) NOT NULL default 0,
+    position int default 0,
+    tms datetime NOT NULL default '0000-00-00 00:00:00',
+    session_id INT NOT NULL DEFAULT 0,
+    c_id INT unsigned NOT NULL default 0,
+    filename VARCHAR(255) DEFAULT NULL
+);
+
+ALTER TABLE track_e_attempt ADD INDEX (exe_id);
+ALTER TABLE track_e_attempt ADD INDEX (user_id);
+ALTER TABLE track_e_attempt ADD INDEX (question_id);
+ALTER TABLE track_e_attempt ADD INDEX (session_id);
+
+DROP TABLE IF EXISTS track_e_attempt_recording;
+CREATE TABLE track_e_attempt_recording (
+    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+    exe_id int unsigned NOT NULL,
+    question_id int unsigned NOT NULL,
+    marks int NOT NULL,
+    insert_date datetime NOT NULL default '0000-00-00 00:00:00',
+    author int unsigned NOT NULL,
+    teacher_comment text NOT NULL,
+    session_id INT NOT NULL DEFAULT 0
+);
+ALTER TABLE track_e_attempt_recording ADD INDEX (exe_id);
+ALTER TABLE track_e_attempt_recording ADD INDEX (question_id);
+ALTER TABLE track_e_attempt_recording ADD INDEX (session_id);
+
+DROP TABLE IF EXISTS track_e_hotpotatoes;
+CREATE TABLE track_e_hotpotatoes (
+    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+    exe_name VARCHAR( 255 ) NOT NULL ,
+    exe_user_id int unsigned DEFAULT NULL ,
+    exe_date DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL ,
+    c_id INT unsigned NOT NULL default 0,
+    exe_result smallint default 0 NOT NULL ,
+    exe_weighting smallint default 0 NOT NULL
+);
+
+DROP TABLE IF EXISTS track_e_links;
+CREATE TABLE track_e_links (
+  links_id int NOT NULL auto_increment,
+  links_user_id int unsigned default NULL,
+  links_date datetime NOT NULL default '0000-00-00 00:00:00',
+  c_id INT NOT NULL DEFAULT 0,
+  links_link_id int NOT NULL default 0,
+  links_session_id INT NOT NULL DEFAULT 0,
+  PRIMARY KEY (links_id),
+  KEY links_user_id (links_user_id)
+);
+
+DROP TABLE IF EXISTS track_e_login;
+CREATE TABLE track_e_login (
+  login_id int NOT NULL auto_increment,
+  login_user_id int unsigned NOT NULL default 0,
+  login_date datetime NOT NULL default '0000-00-00 00:00:00',
+  login_ip varchar(39) NOT NULL default '',
+  logout_date datetime NULL default NULL,
+  PRIMARY KEY (login_id),
+  KEY login_user_id (login_user_id)
+);
+
+DROP TABLE IF EXISTS track_e_online;
+CREATE TABLE track_e_online (
+  login_id int NOT NULL auto_increment,
+  login_user_id int unsigned NOT NULL default 0,
+  login_date datetime NOT NULL default '0000-00-00 00:00:00',
+  login_ip varchar(39) NOT NULL default '',
+  course varchar(40) default NULL,
+  session_id INT NOT NULL DEFAULT 0,
+  access_url_id INT NOT NULL DEFAULT 1,
+  PRIMARY KEY  (login_id),
+  KEY login_user_id (login_user_id)
+);
+DROP TABLE IF EXISTS track_e_open;
+CREATE TABLE track_e_open (
+  open_id int NOT NULL auto_increment,
+  open_remote_host tinytext NOT NULL,
+  open_agent tinytext NOT NULL,
+  open_referer tinytext NOT NULL,
+  open_date datetime NOT NULL default '0000-00-00 00:00:00',
+  PRIMARY KEY  (open_id)
+);
+
+DROP TABLE IF EXISTS track_e_uploads;
+CREATE TABLE track_e_uploads (
+  upload_id int NOT NULL auto_increment,
+  upload_user_id int unsigned default NULL,
+  upload_date datetime NOT NULL default '0000-00-00 00:00:00',
+  upload_cours_id varchar(40) NOT NULL default '',
+  upload_work_id int NOT NULL default 0,
+  upload_session_id INT NOT NULL DEFAULT 0,
+  PRIMARY KEY  (upload_id),
+  KEY upload_user_id (upload_user_id),
+  KEY upload_cours_id (upload_cours_id)
+);
+
+DROP TABLE IF EXISTS track_e_course_access;
+CREATE TABLE track_e_course_access (
+  course_access_id bigint unsigned NOT NULL auto_increment,
+  user_id int NOT NULL,
+  login_course_date datetime NOT NULL default '0000-00-00 00:00:00',
+  logout_course_date datetime default NULL,
+  counter int NOT NULL,
+  session_id int NOT NULL default 0,
+  c_id int NOT NULL default 0,
+  PRIMARY KEY(course_access_id)
+);
+
+DROP TABLE IF EXISTS track_e_hotspot;
+CREATE TABLE track_e_hotspot (
+  hotspot_id int NOT NULL auto_increment,
+  hotspot_user_id int NOT NULL,
+  hotspot_exe_id int NOT NULL,
+  hotspot_question_id int NOT NULL,
+  hotspot_answer_id int NOT NULL,
+  hotspot_correct tinyint(3) unsigned NOT NULL,
+  hotspot_coordinate text NOT NULL,
+  c_id int NOT NULL default 0,
+  PRIMARY KEY (hotspot_id),
+  KEY hotspot_user_id (hotspot_user_id),
+  KEY hotspot_exe_id (hotspot_exe_id),
+  KEY hotspot_question_id (hotspot_question_id)
+);
+
+DROP TABLE IF EXISTS track_e_item_property;
+
+CREATE TABLE track_e_item_property (
+  id int NOT NULL auto_increment PRIMARY KEY,
+  course_id int NOT NULL,
+  item_property_id int NOT NULL,
+  title varchar(255),
+  content text,
+  progress int NOT NULL default 0,
+  lastedit_date datetime NOT NULL default '0000-00-00 00:00:00',
+  lastedit_user_id int  NOT NULL,
+  session_id int NOT NULL default 0
+);
+
+ALTER TABLE track_e_course_access ADD INDEX (user_id);
+ALTER TABLE track_e_course_access ADD INDEX (login_course_date);
+ALTER TABLE track_e_course_access ADD INDEX (c_id);
+ALTER TABLE track_e_course_access ADD INDEX (session_id);
+ALTER TABLE track_e_access ADD INDEX (access_session_id);
+
+ALTER TABLE track_e_online ADD INDEX (course);
+ALTER TABLE track_e_online ADD INDEX (session_id);
+ALTER TABLE track_e_online ADD INDEX idx_trackonline_uat (login_user_id, access_url_id, login_date);
+
+ALTER TABLE track_e_item_property ADD INDEX (course_id, item_property_id, session_id);
+ALTER TABLE track_e_downloads ADD INDEX (down_session_id);
+ALTER TABLE track_e_links ADD INDEX (links_session_id);
+ALTER TABLE track_e_uploads ADD INDEX (upload_session_id);
+
+--
+-- Table structure for LP custom storage API
+--
+DROP TABLE IF EXISTS track_stored_values;
+CREATE TABLE IF NOT EXISTS track_stored_values (
+    id int unsigned not null AUTO_INCREMENT PRIMARY KEY,
+	user_id INT NOT NULL,
+	sco_id INT NOT NULL,
+	course_id CHAR(40) NOT NULL,
+	sv_key CHAR(64) NOT NULL,
+	sv_value TEXT NOT NULL
+);
+ALTER TABLE track_stored_values ADD KEY (user_id, sco_id, course_id, sv_key);
+ALTER TABLE track_stored_values ADD UNIQUE (user_id, sco_id, course_id, sv_key);
+
+DROP TABLE IF EXISTS track_stored_value_stack;
+CREATE TABLE IF NOT EXISTS track_stored_values_stack (
+    id int unsigned not null AUTO_INCREMENT PRIMARY KEY,
+	user_id INT NOT NULL,
+	sco_id INT NOT NULL,
+	stack_order INT NOT NULL,
+	course_id CHAR(40) NOT NULL,
+	sv_key CHAR(64) NOT NULL,
+	sv_value TEXT NOT NULL
+);
+ALTER TABLE track_stored_values_stack ADD KEY (user_id, sco_id, course_id, sv_key, stack_order);
+ALTER TABLE track_stored_values_stack ADD UNIQUE (user_id, sco_id, course_id, sv_key, stack_order);
+
+DROP TABLE IF EXISTS track_e_attempt_coeff;
+CREATE TABLE track_e_attempt_coeff (
+    id int unsigned not null auto_increment primary key,
+    attempt_id INT NOT NULL,
+    marks_coeff float(6,2)
+);
+
+
+-- User database
+
+
+DROP TABLE IF EXISTS personal_agenda;
+CREATE TABLE personal_agenda (
+  id int NOT NULL auto_increment,
+  user int unsigned,
+  title text,
+  `text` text,
+  `date` datetime DEFAULT NULL,
+  enddate datetime DEFAULT NULL,
+  course varchar(255),
+  parent_event_id int NULL,
+  all_day int NOT NULL DEFAULT 0,
+  PRIMARY KEY id (id)
+);
+
+DROP TABLE IF EXISTS personal_agenda_repeat;
+CREATE TABLE personal_agenda_repeat (
+  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 (cal_id)
+);
+
+DROP TABLE IF EXISTS personal_agenda_repeat_not;
+CREATE TABLE personal_agenda_repeat_not (
+  cal_id INT NOT NULL,
+  cal_date INT NOT NULL,
+  PRIMARY KEY ( cal_id, cal_date )
+);
+
+DROP TABLE IF EXISTS user_course_category;
+CREATE TABLE user_course_category (
+  id int unsigned NOT NULL auto_increment,
+  user_id int unsigned NOT NULL default 0,
+  title text NOT NULL,
+  sort int,
+  PRIMARY KEY(id)
+);
+
+ALTER TABLE personal_agenda ADD INDEX idx_personal_agenda_user (user);
+ALTER TABLE personal_agenda ADD INDEX idx_personal_agenda_parent (parent_event_id);
+ALTER TABLE user_course_category ADD INDEX idx_user_c_cat_uid (user_id);
+
+-- Question extra fields
+DROP TABLE IF EXISTS question_field;
+CREATE TABLE IF NOT EXISTS question_field (
+    id  int NOT NULL auto_increment,
+    field_type int NOT NULL default 1,
+    field_variable  varchar(64) NOT NULL,
+    field_display_text  varchar(64),
+    field_default_value text,
+    field_order int,
+    field_visible tinyint default 0,
+    field_changeable tinyint default 0,
+    field_filter tinyint default 0,
+    field_loggeable int default 0,
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+DROP TABLE IF EXISTS question_field_options;
+CREATE TABLE IF NOT EXISTS question_field_options(
+    id int NOT NULL auto_increment,
+    field_id int NOT NULL,
+    option_value text,
+    option_display_text varchar(255),
+    option_order int,
+    priority int default NULL,
+    priority_message varchar(255) default NULL,
+    tms	DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY (id)
+);
+
+DROP TABLE IF EXISTS question_field_values;
+CREATE TABLE IF NOT EXISTS question_field_values(
+    id bigint NOT NULL auto_increment,
+    question_id int NOT NULL,
+    field_id int NOT NULL,
+    field_value text,
+    user_id INT unsigned NOT NULL default 0,
+    comment VARCHAR(100) default '',
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+ALTER TABLE question_field_options ADD INDEX idx_question_field_options_field_id(field_id);
+ALTER TABLE question_field_values ADD INDEX idx_question_field_values_question_id(question_id);
+ALTER TABLE question_field_values ADD INDEX idx_question_field_values_field_id(field_id);
+
+DROP TABLE IF EXISTS extra_field_option_rel_field_option;
+CREATE TABLE extra_field_option_rel_field_option(id INT auto_increment, role_id INT, field_id INT, field_option_id INT, related_field_option_id INT, PRIMARY KEY(id));
+
+DROP TABLE IF EXISTS ext_log_entries;
+CREATE TABLE ext_log_entries (
+  id int(11) NOT NULL AUTO_INCREMENT,
+  action varchar(255) DEFAULT NULL,
+  logged_at datetime DEFAULT NULL,
+  object_id varchar(64) DEFAULT NULL,
+  object_class varchar(255) DEFAULT NULL,
+  version int(11) DEFAULT NULL,
+  data varchar(255) DEFAULT NULL,
+  username varchar(255) DEFAULT NULL,
+  PRIMARY KEY (id)
+) DEFAULT CHARSET=utf8;
+
+DROP TABLE IF EXISTS question_score_name;
+CREATE TABLE question_score_name (
+  id int NOT NULL AUTO_INCREMENT,
+  score varchar(255) DEFAULT NULL,
+  name varchar(255) DEFAULT NULL,
+  description TEXT DEFAULT NULL,
+  question_score_id INT NOT NULL,
+  PRIMARY KEY (id)
+) DEFAULT CHARSET=utf8;
+
+DROP TABLE IF EXISTS question_score;
+CREATE TABLE question_score (
+  id int NOT NULL AUTO_INCREMENT,
+  name varchar(255) DEFAULT NULL,
+  PRIMARY KEY (id)
+) DEFAULT CHARSET=utf8;
+
+
+DROP TABLE IF EXISTS curriculum_category;
+CREATE TABLE curriculum_category (
+    id int unsigned not null primary key AUTO_INCREMENT,
+    c_id int unsigned, -- the course ID (not setting as "not null" because at some point in the future it might be considered course-agnostic). This is only necessary for the item with parent_id = 0
+    session_id int unsigned, -- the session ID (not setting as "not null" because at some point in the future it might be considered session-agnostic). This is only necessary for the item with parent_id = 0
+    title varchar(255),
+    max_score int unsigned not null default 1,
+    min_chars tinyint unsigned not null default 0, -- the minimum number of characters an item field in this category requires to be considered a valid submission (and generate score),
+    parent_id int unsigned DEFAULT NULL,
+    lvl int default NULL,
+    lft int default NULL,
+    rgt int default NULL,
+    root int default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+DROP TABLE IF EXISTS curriculum_item;
+CREATE TABLE curriculum_item (
+    id int unsigned not null primary key AUTO_INCREMENT,
+    category_id int unsigned not null, -- references the curriculum category's id
+    title varchar(255),
+    score int unsigned not null default 1, -- how much points are assigned for filling this item
+    max_repeat tinyint unsigned not null default 1 -- how many items of this type are allowed
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+DROP TABLE IF EXISTS curriculum_item_rel_user;
+CREATE TABLE curriculum_item_rel_user (
+    id int unsigned not null primary key AUTO_INCREMENT,
+    item_id int unsigned not null, -- the id of the item
+    user_id int unsigned not null,
+    order_id tinyint unsigned not null default 0, -- given there is a item_max_repeat field, this allows us to store more than one answer per item.id per user
+    description varchar(255) not null default '' -- the text given as "answer" by the student
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+DROP TABLE IF EXISTS curriculum_rel_user;
+CREATE TABLE curriculum_rel_user (
+    id int unsigned not null primary key AUTO_INCREMENT,
+    category_id int unsigned not null, -- references c_curriculum_category.id where parent_id = 0 (one root curriculum)
+    user_id int unsigned not null,
+    score int unsigned not null default 0 -- the temporary total score given to the user for the information he completed
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+
+-- Do not move this
+UPDATE settings_current SET selected_value = '1.10.0.033' WHERE variable = 'chamilo_database_version';

+ 38 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/migrate-db-1.9.0-1.10.0-post.sql

@@ -0,0 +1,38 @@
+-- This script updates the databases structure before migrating the data from
+-- version 1.8.6.2 to version 1.8.7
+-- it is intended as a standalone script, however, because of the multiple
+-- databases related difficulties, it should be parsed by a PHP script in
+-- order to connect to and update the right databases.
+-- There is one line per query, allowing the PHP function file() to read
+-- all lines separately into an array. The xxMAINxx-type markers are there
+-- to tell the PHP script which database we're talking about.
+-- By always using the keyword "TABLE" in the queries, we should be able
+-- to retrieve and modify the table name from the PHP script if needed, which
+-- will allow us to deal with the unique-database-type installations
+--
+
+-- xxMAINxx
+
+-- ALTER TABLE session_rel_course DROP COLUMN course_code;
+-- ALTER TABLE session_rel_course_rel_user DROP COLUMN course_code;
+
+-- ALTER TABLE track_e_hotpotatoes DROP COLUMN course_code;
+-- ALTER TABLE track_e_exercices DROP COLUMN course_code;
+-- ALTER TABLE track_e_attempt DROP COLUMN course_code;
+-- ALTER TABLE track_e_hotspot DROP COLUMN course_code;
+-- ALTER TABLE track_e_course_access DROP COLUMN course_code;
+-- ALTER TABLE access_url_rel_course DROP COLUMN course_code;
+-- ALTER TABLE course_rel_user DROP COLUMN course_code;
+
+-- ALTER TABLE track_e_lastaccess DROP COLUMN access_cours_code;
+
+ALTER TABLE track_e_lastaccess DROP COLUMN access_cours_code;
+ALTER TABLE track_e_access    DROP COLUMN access_cours_code ;
+ALTER TABLE track_e_course_access DROP COLUMN  course_code;
+ALTER TABLE track_e_downloads DROP COLUMN  down_cours_id;
+
+ALTER TABLE track_e_links DROP COLUMN  links_cours_id;
+
+ALTER TABLE session DROP COLUMN date_start;
+ALTER TABLE session DROP COLUMN date_end;
+

+ 374 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/migrate-db-1.9.0-1.10.0-pre.sql

@@ -0,0 +1,374 @@
+-- This script updates the databases structure before migrating the data from
+-- version 1.9.0 (or version 1.9.2, .4, .6 or .8) to version 1.10.0
+-- It is intended as a standalone script. Because of the relatively recent
+-- migration to a single-database structure, it is still recommended to let
+-- it be parsed by Chamilo installation scripts. We will modify this message
+-- once we have ensured it works properly through direct SQL execution.
+-- There is one line per query now, allowing the PHP function file() to read
+-- all lines separately into an array. The xxMAINxx-type markers are there
+-- to tell the PHP script which database we're talking about.
+-- For version tracking easiness, we recommend you define all new queries
+-- at the end of the corresponding section. We will re-order them previous
+-- to the stable release in order to optimize the migration.
+
+-- xxMAINxx
+
+-- Optimize tracking query very often queried on busy campuses
+ALTER TABLE track_e_online ADD INDEX idx_trackonline_uat (login_user_id, access_url_id, login_date);
+ALTER TABLE track_e_default ADD COLUMN session_id INT NOT NULL DEFAULT 0;
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('session_tutor_reports_visibility', NULL, 'radio', 'Session', 'true', 'SessionTutorsCanSeeExpiredSessionsResultsTitle', 'SessionTutorsCanSeeExpiredSessionsResultsComment', NULL, NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('session_tutor_reports_visibility', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('session_tutor_reports_visibility', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('gradebook_show_percentage_in_reports', NULL,'radio','Gradebook','true','GradebookShowPercentageInReportsTitle','GradebookShowPercentageInReportsComment', NULL, NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('gradebook_show_percentage_in_reports', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('gradebook_show_percentage_in_reports', 'false', 'No');
+
+ALTER TABLE notification ADD COLUMN sender_id INT NOT NULL DEFAULT 0;
+
+ALTER TABLE session_rel_user ADD COLUMN moved_to INT NOT NULL DEFAULT 0;
+ALTER TABLE session_rel_user ADD COLUMN moved_status INT NOT NULL DEFAULT 0;
+ALTER TABLE session_rel_user ADD COLUMN moved_at datetime NOT NULL default '0000-00-00 00:00:00';
+
+ALTER TABLE session ADD COLUMN display_start_date datetime default '0000-00-00 00:00:00';
+ALTER TABLE session ADD COLUMN display_end_date datetime default '0000-00-00 00:00:00';
+ALTER TABLE session ADD COLUMN access_start_date datetime default '0000-00-00 00:00:00';
+ALTER TABLE session ADD COLUMN access_end_date datetime default '0000-00-00 00:00:00';
+ALTER TABLE session ADD COLUMN coach_access_start_date datetime default '0000-00-00 00:00:00';
+ALTER TABLE session ADD COLUMN coach_access_end_date datetime default '0000-00-00 00:00:00';
+
+ALTER TABLE grade_components ADD COLUMN prefix VARCHAR(255) DEFAULT NULL;
+ALTER TABLE grade_components ADD COLUMN exclusions INT DEFAULT 0;
+ALTER TABLE grade_components ADD COLUMN count_elements INT DEFAULT 0;
+
+CREATE TABLE IF NOT EXISTS session_field_options (id int NOT NULL auto_increment, field_id int NOT NULL, option_value text, option_display_text varchar(255), option_order int, tms DATETIME NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (id));
+CREATE TABLE IF NOT EXISTS course_field_options (id int NOT NULL auto_increment, field_id int NOT NULL, option_value text, option_display_text varchar(255), option_order int, tms DATETIME NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (id));
+
+ALTER TABLE session_field_options ADD INDEX idx_session_field_options_field_id(field_id);
+ALTER TABLE session_field_values ADD INDEX idx_session_field_values_session_id(session_id);
+ALTER TABLE session_field_values ADD INDEX idx_session_field_values_field_id(field_id);
+
+ALTER TABLE session MODIFY COLUMN name CHAR(150) NOT NULL DEFAULT '';
+ALTER TABLE session MODIFY COLUMN id INT unsigned NOT NULL;
+
+ALTER TABLE session_rel_course MODIFY COLUMN id_session INT unsigned NOT NULL;
+ALTER TABLE session_rel_course ADD COLUMN c_id INT NOT NULL DEFAULT '0';
+ALTER TABLE session_rel_course DROP PRIMARY KEY;
+-- remove course_code
+ALTER TABLE session_rel_course ADD COLUMN id INT NOT NULL;
+ALTER TABLE session_rel_course MODIFY COLUMN id int unsigned AUTO_INCREMENT;
+ALTER TABLE session_rel_course ADD INDEX idx_session_rel_course_course_id (c_id);
+ALTER TABLE session_rel_course ADD PRIMARY KEY (id);
+
+ALTER TABLE session_rel_course_rel_user MODIFY COLUMN id_session INT unsigned NOT NULL;
+ALTER TABLE session_rel_course_rel_user ADD COLUMN c_id INT NOT NULL DEFAULT '0';
+ALTER TABLE session_rel_course_rel_user ADD COLUMN id INT NOT NULL;
+ALTER TABLE session_rel_course_rel_user DROP PRIMARY KEY;
+ALTER TABLE session_rel_course_rel_user ADD PRIMARY KEY (id);
+
+
+ALTER TABLE session_rel_course_rel_user ADD INDEX idx_session_rel_course_rel_user_id_user (id_user);
+ALTER TABLE session_rel_course_rel_user ADD INDEX idx_session_rel_course_rel_user_course_id (c_id);
+
+ALTER TABLE session_rel_user ADD INDEX idx_session_rel_user_id_user_moved (id_user, moved_to);
+
+INSERT INTO settings_current(variable, type, subkey, category, selected_value, title, comment, access_url, access_url_changeable, access_url_locked) VALUES ('login_as_allowed', NULL, 'radio', 'security', 'true','AdminLoginAsAllowedTitle', 'AdminLoginAsAllowedComment', 1, 0, 1);
+INSERT INTO settings_options(variable, value, display_text) VALUES ('login_as_allowed','true','Yes'),('login_as_allowed','false','No');
+INSERT into settings_current(variable, type, subkey, category, selected_value, title, comment, access_url, access_url_changeable, access_url_locked) VALUES ('admins_can_set_users_pass', NULL, 'radio', 'security', 'true', 'AdminsCanChangeUsersPassTitle', 'AdminsCanChangeUsersPassComment', 1, 0, 1);
+INSERT into settings_options(variable, value, display_text) VALUES('admins_can_set_users_pass','true','Yes'),('admins_can_set_users_pass','false','No');
+
+-- Courses changes c_XXX
+
+-- ALTER TABLE c_lp_item ADD INDEX idx_c_lp_item_cid_lp_id (c_id, lp_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);
+
+ALTER TABLE c_item_property ADD INDEX idx_itemprop_id_tool (c_id, tool(8));
+ALTER TABLE c_tool_intro MODIFY COLUMN intro_text MEDIUMTEXT NOT NULL;
+
+ALTER TABLE c_quiz_answer ADD INDEX idx_quiz_answer_c_q (c_id, question_id);
+CREATE TABLE c_quiz_order( iid bigint unsigned NOT NULL auto_increment, c_id int unsigned NOT NULL, session_id int unsigned NOT NULL, exercise_id int NOT NULL, exercise_order INT NOT NULL, PRIMARY KEY (iid));
+
+CREATE TABLE c_quiz_question_rel_category ( iid int unsigned NOT NULL AUTO_INCREMENT, c_id int NOT NULL, question_id int NOT NULL, category_id int NOT NULL,  PRIMARY KEY (iid));
+
+ALTER TABLE session ADD INDEX idx_id_coach (id_coach);
+ALTER TABLE session ADD INDEX idx_id_session_admin_id (session_admin_id);
+
+ALTER TABLE c_quiz_question ADD COLUMN parent_id INT unsigned NOT NULL DEFAULT 0;
+ALTER TABLE c_quiz ADD COLUMN email_notification_template TEXT DEFAULT '';
+ALTER TABLE c_quiz ADD COLUMN model_type INT DEFAULT 1;
+
+CREATE TABLE IF NOT EXISTS gradebook_evaluation_type(id INT unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT, name varchar(255), external_id INT unsigned NOT NULL DEFAULT 0);
+
+ALTER TABLE gradebook_evaluation ADD COLUMN evaluation_type_id INT NOT NULL DEFAULT 0;
+ALTER TABLE gradebook_link ADD COLUMN evaluation_type_id INT NOT NULL DEFAULT 0;
+
+INSERT INTO settings_options(variable, value) VALUES ('last_transaction_id','0');
+
+ALTER TABLE access_url ADD COLUMN url_type tinyint unsigned default 1;
+
+CREATE TABLE branch_sync( id int unsigned not null AUTO_INCREMENT PRIMARY KEY, access_url_id int unsigned not null, branch_name varchar(250) default '', branch_ip varchar(40) default '', latitude decimal(15,7), longitude decimal(15,7), dwn_speed int unsigned default null, up_speed int unsigned default null, delay int unsigned default null, admin_mail varchar(250) default '', admin_name varchar(250) default '', admin_phone varchar(250) default '', last_sync_trans_id bigint unsigned default 0, last_sync_trans_date datetime, last_sync_type char(20) default 'full');
+
+CREATE TABLE branch_sync_log( id bigint unsigned not null AUTO_INCREMENT PRIMARY KEY, branch_sync_id int unsigned not null, sync_trans_id bigint unsigned default 0, sync_trans_date datetime, sync_type char(20));
+
+CREATE TABLE branch_transaction_status (id tinyint not null PRIMARY KEY AUTO_INCREMENT,  title char(20));
+INSERT INTO branch_transaction_status VALUES (1, 'To be executed'), (2, 'Executed successfully'), (3, 'Execution deprecated'), (4, 'Execution failed');
+
+CREATE TABLE branch_transaction (id bigint unsigned not null AUTO_INCREMENT, transaction_id bigint unsigned, branch_id int unsigned not null default 0,  action char(20),  item_id char(36),  orig_id char(36),  dest_id char(36),  info char(20), status_id tinyint not null default 0,  time_insert datetime NOT NULL DEFAULT '0000-00-00 00:00:00',  time_update datetime NOT NULL DEFAULT '0000-00-00 00:00:00', message VARCHAR(255) default '' , PRIMARY KEY (id, transaction_id, branch_id));
+
+ALTER TABLE settings_current ADD INDEX idx_settings_current_au_cat (access_url, category(5));
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('session_page_enabled', NULL, 'radio', 'Session', 'true', 'SessionPageEnabledTitle', 'SessionPageEnabledComment', NULL, NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('session_page_enabled', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('session_page_enabled', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('settings_latest_update', NULL, NULL, NULL, '', '','', NULL, NULL, 0);
+
+ALTER TABLE course_module change `row` row_module int unsigned NOT NULL default '0';
+ALTER TABLE course_module change `column` column_module int unsigned NOT NULL default '0';
+
+ALTER TABLE c_survey_invitation ADD COLUMN group_id INT NOT NULL DEFAULT 0;
+
+ALTER TABLE c_lp ADD COLUMN category_id INT unsigned NOT NULL default 0;
+ALTER TABLE c_lp ADD COLUMN max_attempts INT NOT NULL default 0;
+ALTER TABLE c_lp ADD COLUMN subscribe_users INT NOT NULL default 0;
+
+CREATE TABLE c_lp_category (id int unsigned NOT NULL auto_increment, c_id INT unsigned NOT NULL, name VARCHAR(255), position INT, PRIMARY KEY (id));
+
+ALTER TABLE user MODIFY COLUMN hr_dept_id int unsigned NOT NULL default 0;
+
+ALTER TABLE session MODIFY COLUMN id INT unsigned NOT NULL auto_increment;
+ALTER TABLE session MODIFY COLUMN nbr_courses int unsigned NOT NULL default 0;
+ALTER TABLE session MODIFY COLUMN nbr_users int unsigned NOT NULL default 0;
+ALTER TABLE session MODIFY COLUMN nbr_classes int unsigned NOT NULL default 0;
+
+ALTER TABLE session_rel_course MODIFY COLUMN nbr_users int unsigned NOT NULL default 0;
+ALTER TABLE track_e_exercices MODIFY COLUMN session_id int unsigned NOT NULL default 0;
+ALTER TABLE track_e_exercices MODIFY COLUMN exe_exo_id int unsigned NOT NULL default 0;
+
+ALTER TABLE course_rel_user ADD COLUMN c_id int unsigned NOT NULL default 0;
+ALTER TABLE course_rel_user DROP PRIMARY KEY;
+ALTER TABLE course_rel_user ADD COLUMN id int unsigned AUTO_INCREMENT, ADD PRIMARY KEY (id);
+ALTER TABLE course_rel_user ADD INDEX (c_id, user_id);
+
+ALTER TABLE c_item_property MODIFY id INT NOT NULL;
+ALTER TABLE c_item_property DROP PRIMARY KEY;
+ALTER TABLE c_item_property DROP COLUMN id;
+ALTER TABLE c_item_property ADD COLUMN id bigint unsigned NOT NULL auto_increment, ADD PRIMARY KEY (id);
+
+ALTER TABLE c_item_property MODIFY id_session INT default NULL;
+ALTER TABLE c_item_property MODIFY COLUMN start_visible datetime default NULL;
+ALTER TABLE c_item_property MODIFY COLUMN end_visible datetime default NULL;
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('user_name_order', NULL, 'textfield', 'Platform', '', 'UserNameOrderTitle', 'UserNameOrderComment', NULL, NULL, 1);
+
+ALTER TABLE c_group_info MODIFY id INT NOT NULL;
+ALTER TABLE c_group_info MODIFY c_id INT NOT NULL;
+ALTER TABLE c_group_info MODIFY session_id INT NOT NULL;
+ALTER TABLE c_group_info DROP PRIMARY KEY;
+ALTER TABLE c_group_info ADD COLUMN iid INT unsigned NOT NULL auto_increment PRIMARY KEY;
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_teachers_to_create_sessions', NULL,'radio','Session','false','AllowTeachersToCreateSessionsTitle','AllowTeachersToCreateSessionsComment', NULL, NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_teachers_to_create_sessions', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_teachers_to_create_sessions', 'false', 'No');
+
+UPDATE course_field SET field_type = 3 WHERE field_variable = 'special_course';
+
+ALTER TABLE usergroup ADD COLUMN group_type INT unsigned NOT NULL default 0;
+ALTER TABLE usergroup ADD COLUMN picture varchar(255) NOT NULL;
+ALTER TABLE usergroup ADD COLUMN url varchar(255) NOT NULL;
+ALTER TABLE usergroup ADD COLUMN visibility varchar(255) NOT NULL;
+ALTER TABLE usergroup ADD COLUMN updated_on varchar(255) NOT NULL;
+ALTER TABLE usergroup ADD COLUMN created_on varchar(255) NOT NULL;
+
+CREATE TABLE IF NOT EXISTS usergroup_rel_tag( id int NOT NULL AUTO_INCREMENT, tag_id int NOT NULL, usergroup_id int NOT NULL, PRIMARY KEY (id));
+ALTER TABLE usergroup_rel_tag ADD INDEX ( usergroup_id );
+ALTER TABLE usergroup_rel_tag ADD INDEX ( tag_id );
+
+ALTER TABLE usergroup_rel_user ADD relation_type int NOT NULL default 0;
+
+ALTER TABLE usergroup_rel_user ADD INDEX ( usergroup_id );
+ALTER TABLE usergroup_rel_user ADD INDEX ( user_id );
+ALTER TABLE usergroup_rel_user ADD INDEX ( relation_type );
+
+CREATE TABLE IF NOT EXISTS usergroup_rel_usergroup (id int NOT NULL AUTO_INCREMENT, group_id int NOT NULL, subgroup_id int NOT NULL, relation_type int NOT NULL, PRIMARY KEY (id));
+
+ALTER TABLE usergroup_rel_usergroup ADD INDEX ( group_id );
+ALTER TABLE usergroup_rel_usergroup ADD INDEX ( subgroup_id );
+ALTER TABLE usergroup_rel_usergroup ADD INDEX ( relation_type );
+
+ALTER TABLE announcement_rel_group DROP PRIMARY KEY;
+ALTER TABLE announcement_rel_group ADD COLUMN id INT unsigned NOT NULL auto_increment PRIMARY KEY;
+ALTER TABLE track_e_hotpotatoes ADD COLUMN c_id int unsigned NOT NULL default 0;
+ALTER TABLE track_e_exercices ADD COLUMN c_id int unsigned NOT NULL default 0;
+ALTER TABLE track_e_attempt ADD COLUMN c_id int unsigned NOT NULL default 0;
+ALTER TABLE track_e_hotspot ADD COLUMN c_id int unsigned NOT NULL default 0;
+ALTER TABLE track_e_course_access ADD COLUMN c_id INT NOT NULL DEFAULT 0;
+ALTER TABLE access_url_rel_course ADD COLUMN c_id int unsigned NOT NULL default 0;
+ALTER TABLE track_e_lastaccess ADD COLUMN c_id int unsigned NOT NULL default 0;
+ALTER TABLE track_e_access ADD COLUMN c_id int unsigned NOT NULL default 0;
+ALTER TABLE track_e_downloads ADD COLUMN c_id int unsigned NOT NULL default 0;
+ALTER TABLE track_e_links ADD COLUMN c_id int unsigned NOT NULL default 0;
+ALTER TABLE track_e_lastaccess ADD INDEX (c_id, access_user_id);
+
+ALTER TABLE access_url_rel_course DROP PRIMARY KEY;
+ALTER TABLE access_url_rel_course ADD COLUMN id int unsigned NOT NULL auto_increment PRIMARY KEY;
+
+ALTER TABLE c_quiz ADD COLUMN autolaunch int DEFAULT 0;
+RENAME TABLE c_quiz_question_category TO c_quiz_category;
+ALTER TABLE c_quiz_category ADD COLUMN parent_id int unsigned default NULL;
+
+CREATE TABLE c_quiz_rel_category (iid bigint unsigned NOT NULL auto_increment, c_id INT unsigned default 0, category_id int unsigned NOT NULL, exercise_id int unsigned NOT NULL, count_questions int NOT NULL default 0, PRIMARY KEY(iid));
+
+ALTER TABLE c_quiz DROP INDEX session_id;
+ALTER TABLE c_quiz MODIFY id INT NOT NULL;
+ALTER TABLE c_quiz MODIFY c_id INT NOT NULL;
+ALTER TABLE c_quiz DROP PRIMARY KEY;
+ALTER TABLE c_quiz ADD COLUMN iid INT unsigned NOT NULL auto_increment PRIMARY KEY;
+
+ALTER TABLE c_quiz_question MODIFY id INT NOT NULL;
+ALTER TABLE c_quiz_question MODIFY c_id INT NOT NULL;
+ALTER TABLE c_quiz_question DROP PRIMARY KEY;
+ALTER TABLE c_quiz_question ADD COLUMN iid INT unsigned NOT NULL auto_increment PRIMARY KEY;
+
+ALTER TABLE c_quiz_answer MODIFY id INT NOT NULL;
+ALTER TABLE c_quiz_answer MODIFY c_id INT NOT NULL;
+ALTER TABLE c_quiz_answer MODIFY id_auto INT NOT NULL;
+ALTER TABLE c_quiz_answer DROP PRIMARY KEY;
+ALTER TABLE c_quiz_answer ADD COLUMN iid INT unsigned NOT NULL auto_increment PRIMARY KEY;
+ALTER TABLE c_quiz_answer ADD INDEX idx_cqa_qid (question_id);
+
+ALTER TABLE c_quiz_question_option MODIFY id INT NOT NULL;
+ALTER TABLE c_quiz_question_option MODIFY c_id INT NOT NULL;
+ALTER TABLE c_quiz_question_option DROP PRIMARY KEY;
+ALTER TABLE c_quiz_question_option ADD COLUMN iid INT unsigned NOT NULL auto_increment PRIMARY KEY;
+
+ALTER TABLE c_quiz_rel_question MODIFY id INT NOT NULL;
+ALTER TABLE c_quiz_rel_question MODIFY question_id INT NOT NULL;
+ALTER TABLE c_quiz_rel_question MODIFY exercice_id INT NOT NULL;
+ALTER TABLE c_quiz_rel_question DROP PRIMARY KEY;
+ALTER TABLE c_quiz_rel_question ADD COLUMN iid INT unsigned NOT NULL auto_increment PRIMARY KEY;
+ALTER TABLE c_quiz_rel_question ADD INDEX idx_cqrq_id (question_id);
+ALTER TABLE c_quiz_rel_question ADD INDEX idx_cqrq_cidexid (c_id, exercice_id);
+
+ALTER TABLE c_quiz_category MODIFY id INT NOT NULL;
+ALTER TABLE c_quiz_category MODIFY c_id INT NOT NULL;
+ALTER TABLE c_quiz_category DROP PRIMARY KEY;
+ALTER TABLE c_quiz_category ADD COLUMN iid INT unsigned NOT NULL auto_increment PRIMARY KEY;
+
+CREATE TABLE IF NOT EXISTS question_field (id  int NOT NULL auto_increment, field_type int NOT NULL default 1, field_variable varchar(64) NOT NULL, field_display_text  varchar(64), field_default_value text, field_order int, field_visible tinyint default 0, field_changeable tinyint default 0, field_filter tinyint default 0, tms DATETIME NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY(id));
+CREATE TABLE IF NOT EXISTS question_field_options(id int NOT NULL auto_increment, field_id int NOT NULL, option_value text, option_display_text varchar(255), option_order int, tms	DATETIME NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (id));
+CREATE TABLE IF NOT EXISTS question_field_values( id  int NOT NULL auto_increment, question_id int NOT NULL, field_id int NOT NULL, field_value text, tms DATETIME NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY(id));
+
+ALTER TABLE question_field_options ADD INDEX idx_question_field_options_field_id(field_id);
+ALTER TABLE question_field_values ADD INDEX idx_question_field_values_question_id(question_id);
+ALTER TABLE question_field_values ADD INDEX idx_question_field_values_field_id(field_id);
+
+ALTER TABLE question_field_values ADD COLUMN user_id INT unsigned NOT NULL default 0;
+ALTER TABLE session_field_values ADD COLUMN user_id INT unsigned NOT NULL default 0;
+ALTER TABLE course_field_values ADD COLUMN user_id INT unsigned NOT NULL default 0;
+ALTER TABLE user_field_values ADD COLUMN author_id INT unsigned NOT NULL default 0;
+
+ALTER TABLE c_quiz_category ADD COLUMN lvl int;
+ALTER TABLE c_quiz_category ADD COLUMN lft int;
+ALTER TABLE c_quiz_category ADD COLUMN rgt int;
+ALTER TABLE c_quiz_category ADD COLUMN root int;
+ALTER TABLE c_quiz_category MODIFY COLUMN parent_id int default null;
+
+ALTER TABLE track_e_course_access MODIFY COLUMN course_access_id bigint unsigned auto_increment;
+
+CREATE TABLE extra_field_option_rel_field_option(id INT auto_increment, role_id INT, field_id INT, field_option_id INT, related_field_option_id INT, PRIMARY KEY(id));
+
+CREATE TABLE ext_log_entries (id int(11) NOT NULL AUTO_INCREMENT, action varchar(255) DEFAULT NULL, logged_at datetime DEFAULT NULL, object_id varchar(64) DEFAULT NULL, object_class varchar(255) DEFAULT NULL, version int(11) DEFAULT NULL, data varchar(255) DEFAULT NULL, username varchar(255) DEFAULT NULL, PRIMARY KEY (id)) DEFAULT CHARSET=utf8;
+
+ALTER TABLE user_field ADD COLUMN field_loggeable int default 0;
+ALTER TABLE session_field ADD COLUMN field_loggeable int default 0;
+ALTER TABLE course_field ADD COLUMN field_loggeable int default 0;
+ALTER TABLE question_field ADD COLUMN field_loggeable int default 0;
+
+ALTER TABLE user_field_values ADD COLUMN comment VARCHAR(100) default '';
+ALTER TABLE session_field_values ADD COLUMN comment VARCHAR(100) default '';
+ALTER TABLE course_field_values ADD COLUMN comment VARCHAR(100) default '';
+ALTER TABLE question_field_values ADD COLUMN comment VARCHAR(100) default '';
+ALTER TABLE c_quiz ADD COLUMN end_button int NOT NULL default 0;
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('template', NULL, 'text', 'stylesheets', 'default', 'DefaultTemplateTitle', 'DefaultTemplateComment', NULL, NULL, 1);
+
+ALTER TABLE user ADD COLUMN salt VARCHAR(255) DEFAULT NULL;
+CREATE TABLE roles (id INT auto_increment, name VARCHAR(255), role VARCHAR(255) unique, PRIMARY KEY(id));
+CREATE TABLE users_roles (user_id INT NOT NULL, role_id INT NOT NULL, PRIMARY KEY(user_id, role_id));
+
+INSERT INTO roles (id, name, role) VALUES('1', 'Teacher', 'ROLE_TEACHER');
+INSERT INTO roles (id, name, role) VALUES('4', 'RRHH', 'ROLE_RRHH');
+INSERT INTO roles (id, name, role) VALUES('3', 'Session Manager', 'ROLE_SESSION_MANAGER');
+INSERT INTO roles (id ,name, role) VALUES('5', 'Student', 'ROLE_STUDENT');
+INSERT INTO roles (id, name, role) VALUES('6', 'Anonymous', 'ROLE_ANONYMOUS');
+INSERT INTO roles (id, name, role) VALUES('11', 'Admin', 'ROLE_ADMIN');
+INSERT INTO roles (id, name, role) VALUES('17', 'Question Manager', 'ROLE_QUESTION_MANAGER');
+
+ALTER TABLE c_quiz ADD COLUMN question_selection_type INT DEFAULT 1;
+ALTER TABLE c_quiz ADD COLUMN hide_question_title INT DEFAULT 0;
+
+-- Admin
+INSERT INTO users_roles VALUES (1, 11);
+
+CREATE TABLE question_score_name (id int NOT NULL AUTO_INCREMENT,  score varchar(255) DEFAULT NULL,  name varchar(255) DEFAULT NULL,  description TEXT DEFAULT NULL,  question_score_id INT NOT NULL,  PRIMARY KEY (id)) DEFAULT CHARSET=utf8;
+CREATE TABLE question_score (  id int NOT NULL AUTO_INCREMENT,  name varchar(255) DEFAULT NULL,  PRIMARY KEY (id)) DEFAULT CHARSET=utf8;
+
+ALTER TABLE question_field_options ADD COLUMN priority INT default NULL;
+ALTER TABLE course_field_options ADD COLUMN priority INT default NULL;
+ALTER TABLE user_field_options ADD COLUMN priority INT default NULL;
+ALTER TABLE session_field_options ADD COLUMN priority INT default NULL;
+
+
+ALTER TABLE question_field_options ADD COLUMN priority_message varchar(255) default NULL;
+ALTER TABLE course_field_options ADD COLUMN priority_message varchar(255) default NULL;
+ALTER TABLE user_field_options ADD COLUMN priority_message varchar(255) default NULL;
+ALTER TABLE session_field_options ADD COLUMN priority_message varchar(255) default NULL;
+
+-- update tables to add iid field
+ALTER TABLE c_announcement CHANGE id id int unsigned not null;
+ALTER TABLE c_announcement DROP PRIMARY KEY;
+ALTER TABLE c_announcement add COLUMN iid int unsigned not null AUTO_INCREMENT PRIMARY KEY FIRST;
+ALTER TABLE c_announcement add UNIQUE KEY(c_id,id);
+ALTER TABLE c_announcement ENGINE = InnoDB;
+ALTER TABLE c_announcement_attachment CHANGE id id int unsigned not null;
+ALTER TABLE c_announcement_attachment DROP PRIMARY KEY;
+ALTER TABLE c_announcement_attachment add COLUMN iid int unsigned not null AUTO_INCREMENT PRIMARY KEY FIRST;
+ALTER TABLE c_announcement_attachment add UNIQUE KEY(c_id,id);
+ALTER TABLE c_announcement_attachment ENGINE = InnoDB;
+ALTER TABLE c_attendance CHANGE id id int unsigned not null;
+ALTER TABLE c_attendance DROP PRIMARY KEY;
+ALTER TABLE c_attendance add COLUMN iid int unsigned not null AUTO_INCREMENT PRIMARY KEY FIRST;
+ALTER TABLE c_attendance add UNIQUE KEY(c_id,id);
+ALTER TABLE c_attendance ENGINE = InnoDB;
+ALTER TABLE c_attendance_calendar CHANGE id id int unsigned not null;
+ALTER TABLE c_attendance_calendar DROP PRIMARY KEY;
+ALTER TABLE c_attendance_calendar add COLUMN iid int unsigned not null AUTO_INCREMENT PRIMARY KEY FIRST;
+ALTER TABLE c_attendance_calendar add UNIQUE KEY(c_id,id);
+ALTER TABLE c_attendance_calendar ENGINE = InnoDB;
+ALTER TABLE c_attendance_result CHANGE id id int unsigned not null;
+ALTER TABLE c_attendance_result DROP PRIMARY KEY;
+ALTER TABLE c_attendance_result add COLUMN iid int unsigned not null AUTO_INCREMENT PRIMARY KEY FIRST;
+ALTER TABLE c_attendance_result add UNIQUE KEY(c_id,id);
+ALTER TABLE c_attendance_result ENGINE = InnoDB;
+ALTER TABLE c_attendance_sheet DROP PRIMARY KEY;
+ALTER TABLE c_attendance_sheet add COLUMN iid int unsigned not null AUTO_INCREMENT PRIMARY KEY FIRST;
+ALTER TABLE c_attendance_sheet add UNIQUE KEY(c_id,user_id,attendance_calendar_id);
+ALTER TABLE c_attendance_sheet ENGINE = InnoDB;
+ALTER TABLE c_attendance_sheet_log CHANGE id id int unsigned not null;
+ALTER TABLE c_attendance_sheet_log DROP PRIMARY KEY;
+ALTER TABLE c_attendance_sheet_log add COLUMN iid int unsigned not null AUTO_INCREMENT PRIMARY KEY FIRST;
+ALTER TABLE c_attendance_sheet_log add UNIQUE KEY(c_id,id);
+ALTER TABLE c_attendance_sheet_log ENGINE = InnoDB;
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('breadcrumb_navigation_display', NULL, 'radio', 'Platform','true','BreadcrumbNavigationDisplayTitle', 'BreadcrumbNavigationDisplayComment', NULL, NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('breadcrumb_navigation_display', 'true', 'Show');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('breadcrumb_navigation_display', 'false', 'Hide');
+
+INSERT INTO settings_current(variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable)  VALUES ('showonline','session','checkbox','Platform','true','ShowOnlineTitle','ShowOnlineComment',NULL,'ShowOnlineSession', 0);
+
+ALTER TABLE c_quiz_category ADD COLUMN visibility INT default 1;
+
+-- Do not move this
+UPDATE settings_current SET selected_value = '1.10.0.033' WHERE variable = 'chamilo_database_version';

+ 220 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/update-db-1.9.0-1.10.0.inc.php

@@ -0,0 +1,220 @@
+<?php
+/* For licensing terms, see /license.txt */
+
+$update = function($_configuration, \Doctrine\DBAL\Connection $mainConnection, $dryRun, $output, $app) {
+
+    $mainConnection->beginTransaction();
+
+    $dbNameForm = $_configuration['main_database'];
+
+    $session_table = "$dbNameForm.session";
+    $session_rel_course_table = "$dbNameForm.session_rel_course";
+    $session_rel_course_rel_user_table = "$dbNameForm.session_rel_course_rel_user";
+    $course_table = "$dbNameForm.course";
+
+    //Fixes new changes in sessions
+    $sql = "SELECT id, date_start, date_end, nb_days_access_before_beginning, nb_days_access_after_end FROM $session_table ";
+    $result = $mainConnection->executeQuery($sql);
+    $sessions = $result->fetchAll();
+
+    foreach ($sessions as $session) {
+        $session_id = $session['id'];
+
+        //Fixing date_start
+        if (isset($session['date_start']) && !empty($session['date_start']) && $session['date_start'] != '0000-00-00') {
+            $datetime = $session['date_start'].' 00:00:00';
+            $update_sql = "UPDATE $session_table SET display_start_date = '$datetime' , access_start_date = '$datetime' WHERE id = $session_id";
+            $mainConnection->executeQuery($update_sql);
+
+            //Fixing nb_days_access_before_beginning
+            if (!empty($session['nb_days_access_before_beginning'])) {
+                $datetime = api_strtotime($datetime, 'UTC') - (86400 * $session['nb_days_access_before_beginning']);
+                $datetime = api_get_utc_datetime($datetime);
+                $update_sql = "UPDATE $session_table SET coach_access_start_date = '$datetime' WHERE id = $session_id";
+                $mainConnection->executeQuery($update_sql);
+            }
+        }
+
+        //Fixing end_date
+        if (isset($session['date_end']) && !empty($session['date_end']) && $session['date_end'] != '0000-00-00') {
+            $datetime = $session['date_end'].' 00:00:00';
+            $update_sql = "UPDATE $session_table SET display_end_date = '$datetime', access_end_date = '$datetime' WHERE id = $session_id";
+            $mainConnection->executeQuery($update_sql);
+
+            //Fixing nb_days_access_before_beginning
+            if (!empty($session['nb_days_access_after_end'])) {
+                $datetime = api_strtotime($datetime, 'UTC') + (86400 * $session['nb_days_access_after_end']);
+                $datetime = api_get_utc_datetime($datetime);
+                $update_sql = "UPDATE $session_table SET coach_access_end_date = '$datetime' WHERE id = $session_id";
+                $mainConnection->executeQuery($update_sql);
+            }
+        }
+    }
+
+    //Fixes new changes session_rel_course
+    $sql = "SELECT id_session, sc.course_code, c.id FROM $course_table c INNER JOIN $session_rel_course_table sc ON sc.course_code = c.code";
+    $result = $mainConnection->executeQuery($sql);
+    $rows = $result->fetchAll();
+    foreach ($rows as $row) {
+        $sql = "UPDATE $session_rel_course_table SET c_id = {$row['id']}
+                WHERE course_code = '{$row['course_code']}' AND id_session = {$row['id_session']} ";
+        $mainConnection->executeQuery($sql);
+    }
+
+    //Fixes new changes in session_rel_course_rel_user
+    $sql = "SELECT id_session, sc.course_code, c.id FROM $course_table c INNER JOIN $session_rel_course_rel_user_table sc ON sc.course_code = c.code";
+    $result = $mainConnection->executeQuery($sql);
+    $rows = $result->fetchAll();
+    foreach ($rows as $row) {
+        $sql = "UPDATE $session_rel_course_rel_user_table SET c_id = {$row['id']}
+                WHERE course_code = '{$row['course_code']}' AND id_session = {$row['id_session']} ";
+        $mainConnection->executeQuery($sql);
+    }
+
+    //Updating c_quiz_order
+    $teq = "$dbNameForm.c_quiz";
+    $sql = "SELECT c_id, session_id, id FROM $teq ORDER BY c_id, session_id, id";
+    $result = $mainConnection->executeQuery($sql);
+    $req = $result->fetchAll();
+
+    $to = "$dbNameForm.c_quiz_order";
+    $do = "DELETE FROM $to";
+    $mainConnection->executeQuery($do);
+
+    $cid = 0;
+    $temp_session_id = 0;
+    $order = 1;
+    foreach ($req as $row) {
+        if ($row['c_id'] != $cid) {
+            $cid = $row['c_id'];
+            $temp_session_id = $row['session_id'];
+            $order = 1;
+        } elseif ($row['session_id'] != $temp_session_id) {
+            $temp_session_id = $row['session_id'];
+            $order = 1;
+        }
+        $ins = "INSERT INTO $to (c_id, session_id, exercise_id, exercise_order)".
+               " VALUES ($cid, $temp_session_id, {$row['id']}, $order)";
+        $mainConnection->executeQuery($ins);
+        $order++;
+    }
+
+    //Fixing special course
+    $output->writeln('Fixing special course');
+    $sql = "SELECT id FROM $dbNameForm.course_field WHERE field_variable = 'special_course'";
+    $result = $mainConnection->executeQuery($sql);
+    $fieldData = $result->fetch();
+    $id = $fieldData['id'];
+
+    $sql = "INSERT INTO $dbNameForm.course_field_options (field_id, option_value, option_display_text, option_order)
+            VALUES ('$id', '1', '".get_lang('Yes')."', '1')";
+    $mainConnection->executeQuery($sql);
+
+    $sql = "INSERT INTO $dbNameForm.course_field_options (field_id, option_value, option_display_text, option_order)
+            VALUES ('$id', '0', '".get_lang('No')."', '2')";
+    $mainConnection->executeQuery($sql);
+
+    //Moving social group to class
+    $output->writeln('<comment>Fixing social groups.</comment>');
+
+    $sql = "SELECT * FROM $dbNameForm.groups";
+    $result = $mainConnection->executeQuery($sql);
+    $groups = $result->fetchAll();
+
+    $oldGroups = array();
+
+    if (!empty($groups )) {
+        foreach ($groups as $group) {
+            $sql = "INSERT INTO $dbNameForm.usergroup (name, group_type, description, picture, url, visibility, updated_on, created_on)
+                    VALUES ('{$group['name']}', '1', '{$group['description']}', '{$group['picture_uri']}', '{$group['url']}', '{$group['visibility']}', '{$group['updated_on']}', '{$group['created_on']}')";
+
+            $mainConnection->executeQuery($sql);
+            $id = $mainConnection->lastInsertId('id');
+            $oldGroups[$group['id']] = $id;
+        }
+    }
+
+    if (!empty($oldGroups)) {
+        $output->writeln('Moving group files');
+
+        foreach ($oldGroups as $oldId => $newId) {
+            $path = GroupPortalManager::get_group_picture_path_by_id($oldId, 'system');
+            if (!empty($path)) {
+
+                $newPath = str_replace("groups/$oldId/", "groups/$newId/", $path['dir']);
+                $command = "mv {$path['dir']} $newPath ";
+                system($command);
+                $output->writeln("Moving files: $command");
+            }
+        }
+
+        $sql = "SELECT * FROM $dbNameForm.group_rel_user";
+        $result = $mainConnection->executeQuery($sql);
+        $dataList = $result->fetchAll();
+
+        if (!empty($dataList)) {
+            foreach ($dataList as $data) {
+                if (isset($oldGroups[$data['group_id']])) {
+                    $data['group_id'] = $oldGroups[$data['group_id']];
+                    $sql = "INSERT INTO $dbNameForm.usergroup_rel_user (usergroup_id, user_id, relation_type)
+                            VALUES ('{$data['group_id']}', '{$data['user_id']}', '{$data['relation_type']}')";
+                    $mainConnection->executeQuery($sql);
+                }
+            }
+        }
+
+        $sql = "SELECT * FROM $dbNameForm.group_rel_group";
+        $result = $mainConnection->executeQuery($sql);
+        $dataList = $result->fetchAll();
+
+        if (!empty($dataList)) {
+            foreach ($dataList as $data) {
+                if (isset($oldGroups[$data['group_id']]) && isset($oldGroups[$data['subgroup_id']])) {
+                    $data['group_id'] = $oldGroups[$data['group_id']];
+                    $data['subgroup_id'] = $oldGroups[$data['subgroup_id']];
+                    $sql = "INSERT INTO $dbNameForm.usergroup_rel_usergroup (group_id, subgroup_id, relation_type)
+                            VALUES ('{$data['group_id']}', '{$data['subgroup_id']}', '{$data['relation_type']}')";
+                    $mainConnection->executeQuery($sql);
+                }
+            }
+        }
+
+        $sql = "SELECT * FROM $dbNameForm.announcement_rel_group";
+        $result = $mainConnection->executeQuery($sql);
+        $dataList = $result->fetchAll();
+
+        if (!empty($dataList)) {
+            foreach ($dataList as $data) {
+                if (isset($oldGroups[$data['group_id']])) {
+                    //Deleting relation
+                    $sql = "DELETE FROM announcement_rel_group WHERE id = {$data['id']}";
+                    $mainConnection->executeQuery($sql);
+
+                    //Add new relation
+                    $data['group_id'] = $oldGroups[$data['group_id']];
+                    $sql = "INSERT INTO $dbNameForm.announcement_rel_group(group_id, announcement_id)
+                            VALUES ('{$data['group_id']}', '{$data['announcement_id']}')";
+                    $mainConnection->executeQuery($sql);
+                }
+            }
+        }
+
+        $sql = "SELECT * FROM $dbNameForm.group_rel_tag";
+        $result = $mainConnection->executeQuery($sql);
+        $dataList = $result->fetchAll();
+        if (!empty($dataList)) {
+            foreach ($dataList as $data) {
+                if (isset($oldGroups[$data['group_id']])) {
+                    $data['group_id'] = $oldGroups[$data['group_id']];
+                    $sql = "INSERT INTO $dbNameForm.usergroup_rel_tag (tag_id, usergroup_id)
+                            VALUES ('{$data['tag_id']}', '{$data['group_id']}')";
+                    $mainConnection->executeQuery($sql);
+                }
+            }
+        }
+    }
+
+    if (!$dryRun) {
+        $mainConnection->commit();
+    }
+};

+ 1736 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.8.7/db_course1.sql

@@ -0,0 +1,1736 @@
+-- MySQL dump 10.13  Distrib 5.5.29, for debian-linux-gnu (i686)
+--
+-- Host: localhost    Database: chamilo187_1111
+-- ------------------------------------------------------
+-- Server version	5.5.29-0ubuntu0.12.10.1
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `announcement`
+--
+
+DROP TABLE IF EXISTS `announcement`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `announcement` (
+  `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+  `title` text,
+  `content` mediumtext,
+  `end_date` date DEFAULT NULL,
+  `display_order` mediumint(9) NOT NULL DEFAULT '0',
+  `email_sent` tinyint(4) DEFAULT '0',
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `announcement_attachment`
+--
+
+DROP TABLE IF EXISTS `announcement_attachment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `announcement_attachment` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `path` varchar(255) NOT NULL,
+  `comment` text,
+  `size` int(11) NOT NULL DEFAULT '0',
+  `announcement_id` int(11) NOT NULL,
+  `filename` varchar(255) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `attendance`
+--
+
+DROP TABLE IF EXISTS `attendance`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `attendance` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `name` text NOT NULL,
+  `description` text,
+  `active` tinyint(4) NOT NULL DEFAULT '1',
+  `attendance_qualify_title` varchar(255) DEFAULT NULL,
+  `attendance_qualify_max` int(11) NOT NULL DEFAULT '0',
+  `attendance_weight` float(6,2) NOT NULL DEFAULT '0.00',
+  `session_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`),
+  KEY `active` (`active`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `attendance_calendar`
+--
+
+DROP TABLE IF EXISTS `attendance_calendar`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `attendance_calendar` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `attendance_id` int(11) NOT NULL,
+  `date_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `done_attendance` tinyint(4) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `attendance_id` (`attendance_id`),
+  KEY `done_attendance` (`done_attendance`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `attendance_result`
+--
+
+DROP TABLE IF EXISTS `attendance_result`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `attendance_result` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `user_id` int(11) NOT NULL,
+  `attendance_id` int(11) NOT NULL,
+  `score` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `attendance_id` (`attendance_id`),
+  KEY `user_id` (`user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `attendance_sheet`
+--
+
+DROP TABLE IF EXISTS `attendance_sheet`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `attendance_sheet` (
+  `user_id` int(11) NOT NULL,
+  `attendance_calendar_id` int(11) NOT NULL,
+  `presence` tinyint(4) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`user_id`,`attendance_calendar_id`),
+  KEY `presence` (`presence`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog`
+--
+
+DROP TABLE IF EXISTS `blog`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog` (
+  `blog_id` smallint(6) NOT NULL AUTO_INCREMENT,
+  `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(3) unsigned NOT NULL DEFAULT '0',
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`blog_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with blogs in this course';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_attachment`
+--
+
+DROP TABLE IF EXISTS `blog_attachment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_attachment` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `path` varchar(255) NOT NULL COMMENT 'the real filename',
+  `comment` text,
+  `size` int(11) NOT NULL DEFAULT '0',
+  `post_id` int(11) NOT NULL,
+  `filename` varchar(255) NOT NULL COMMENT 'the user s file name',
+  `blog_id` int(11) NOT NULL,
+  `comment_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_comment`
+--
+
+DROP TABLE IF EXISTS `blog_comment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_comment` (
+  `comment_id` int(11) NOT NULL AUTO_INCREMENT,
+  `title` varchar(250) NOT NULL DEFAULT '',
+  `comment` longtext NOT NULL,
+  `author_id` int(11) NOT NULL DEFAULT '0',
+  `date_creation` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `blog_id` mediumint(9) NOT NULL DEFAULT '0',
+  `post_id` int(11) NOT NULL DEFAULT '0',
+  `task_id` int(11) DEFAULT NULL,
+  `parent_comment_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`comment_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with comments on posts in a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_post`
+--
+
+DROP TABLE IF EXISTS `blog_post`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_post` (
+  `post_id` int(11) NOT NULL AUTO_INCREMENT,
+  `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` mediumint(9) NOT NULL DEFAULT '0',
+  `author_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`post_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with posts / blog.';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_rating`
+--
+
+DROP TABLE IF EXISTS `blog_rating`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_rating` (
+  `rating_id` int(11) NOT NULL AUTO_INCREMENT,
+  `blog_id` int(11) NOT NULL DEFAULT '0',
+  `rating_type` enum('post','comment') NOT NULL DEFAULT 'post',
+  `item_id` int(11) NOT NULL DEFAULT '0',
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  `rating` mediumint(9) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`rating_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with ratings for post/comments in a certain blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_rel_user`
+--
+
+DROP TABLE IF EXISTS `blog_rel_user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_rel_user` (
+  `blog_id` int(11) NOT NULL DEFAULT '0',
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`blog_id`,`user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table representing users subscribed to a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_task`
+--
+
+DROP TABLE IF EXISTS `blog_task`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_task` (
+  `task_id` mediumint(9) NOT NULL AUTO_INCREMENT,
+  `blog_id` mediumint(9) NOT NULL DEFAULT '0',
+  `title` varchar(250) NOT NULL DEFAULT '',
+  `description` text NOT NULL,
+  `color` varchar(10) NOT NULL DEFAULT '',
+  `system_task` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`task_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with tasks for a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_task_rel_user`
+--
+
+DROP TABLE IF EXISTS `blog_task_rel_user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_task_rel_user` (
+  `blog_id` mediumint(9) NOT NULL DEFAULT '0',
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  `task_id` mediumint(9) NOT NULL DEFAULT '0',
+  `target_date` date NOT NULL DEFAULT '0000-00-00',
+  PRIMARY KEY (`blog_id`,`user_id`,`task_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with tasks assigned to a user in a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `calendar_event`
+--
+
+DROP TABLE IF EXISTS `calendar_event`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `calendar_event` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `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(11) DEFAULT NULL,
+  `session_id` int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `calendar_event_attachment`
+--
+
+DROP TABLE IF EXISTS `calendar_event_attachment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `calendar_event_attachment` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `path` varchar(255) NOT NULL,
+  `comment` text,
+  `size` int(11) NOT NULL DEFAULT '0',
+  `agenda_id` int(11) NOT NULL,
+  `filename` varchar(255) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `calendar_event_repeat`
+--
+
+DROP TABLE IF EXISTS `calendar_event_repeat`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `calendar_event_repeat` (
+  `cal_id` int(11) NOT NULL DEFAULT '0',
+  `cal_type` varchar(20) DEFAULT NULL,
+  `cal_end` int(11) DEFAULT NULL,
+  `cal_frequency` int(11) DEFAULT '1',
+  `cal_days` char(7) DEFAULT NULL,
+  PRIMARY KEY (`cal_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `calendar_event_repeat_not`
+--
+
+DROP TABLE IF EXISTS `calendar_event_repeat_not`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `calendar_event_repeat_not` (
+  `cal_id` int(11) NOT NULL,
+  `cal_date` int(11) NOT NULL,
+  PRIMARY KEY (`cal_id`,`cal_date`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `chat_connected`
+--
+
+DROP TABLE IF EXISTS `chat_connected`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `chat_connected` (
+  `user_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `last_connection` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `session_id` int(11) NOT NULL DEFAULT '0',
+  `to_group_id` int(11) NOT NULL DEFAULT '0',
+  KEY `char_connected_index` (`user_id`,`session_id`,`to_group_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `course_description`
+--
+
+DROP TABLE IF EXISTS `course_description`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `course_description` (
+  `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
+  `title` varchar(255) DEFAULT NULL,
+  `content` text,
+  `session_id` smallint(6) DEFAULT '0',
+  `description_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `progress` int(11) NOT NULL DEFAULT '0',
+  UNIQUE KEY `id` (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `course_setting`
+--
+
+DROP TABLE IF EXISTS `course_setting`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `course_setting` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `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`)
+) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `document`
+--
+
+DROP TABLE IF EXISTS `document`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `document` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `path` varchar(255) NOT NULL DEFAULT '',
+  `comment` text,
+  `title` varchar(255) DEFAULT NULL,
+  `filetype` set('file','folder') NOT NULL DEFAULT 'file',
+  `size` int(11) NOT NULL DEFAULT '0',
+  `readonly` tinyint(3) unsigned NOT NULL,
+  `session_id` int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=198 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `dropbox_category`
+--
+
+DROP TABLE IF EXISTS `dropbox_category`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `dropbox_category` (
+  `cat_id` int(11) NOT NULL AUTO_INCREMENT,
+  `cat_name` text NOT NULL,
+  `received` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `sent` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(6) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`cat_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `dropbox_feedback`
+--
+
+DROP TABLE IF EXISTS `dropbox_feedback`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `dropbox_feedback` (
+  `feedback_id` int(11) NOT NULL AUTO_INCREMENT,
+  `file_id` int(11) NOT NULL DEFAULT '0',
+  `author_user_id` int(11) NOT NULL DEFAULT '0',
+  `feedback` text NOT NULL,
+  `feedback_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  PRIMARY KEY (`feedback_id`),
+  KEY `file_id` (`file_id`),
+  KEY `author_user_id` (`author_user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `dropbox_file`
+--
+
+DROP TABLE IF EXISTS `dropbox_file`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `dropbox_file` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `uploader_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `filename` varchar(250) NOT NULL DEFAULT '',
+  `filesize` int(10) 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(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(5) unsigned NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `UN_filename` (`filename`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `dropbox_person`
+--
+
+DROP TABLE IF EXISTS `dropbox_person`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `dropbox_person` (
+  `file_id` int(10) unsigned NOT NULL,
+  `user_id` int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`file_id`,`user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `dropbox_post`
+--
+
+DROP TABLE IF EXISTS `dropbox_post`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `dropbox_post` (
+  `file_id` int(10) unsigned NOT NULL,
+  `dest_user_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `feedback_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `feedback` text,
+  `cat_id` int(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(5) unsigned NOT NULL,
+  PRIMARY KEY (`file_id`,`dest_user_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_attachment`
+--
+
+DROP TABLE IF EXISTS `forum_attachment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_attachment` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `path` varchar(255) NOT NULL,
+  `comment` text,
+  `size` int(11) NOT NULL DEFAULT '0',
+  `post_id` int(11) NOT NULL,
+  `filename` varchar(255) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_category`
+--
+
+DROP TABLE IF EXISTS `forum_category`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_category` (
+  `cat_id` int(11) NOT NULL AUTO_INCREMENT,
+  `cat_title` varchar(255) NOT NULL DEFAULT '',
+  `cat_comment` text,
+  `cat_order` int(11) NOT NULL DEFAULT '0',
+  `locked` int(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`cat_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_forum`
+--
+
+DROP TABLE IF EXISTS `forum_forum`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_forum` (
+  `forum_id` int(11) NOT NULL AUTO_INCREMENT,
+  `forum_title` varchar(255) NOT NULL DEFAULT '',
+  `forum_comment` text,
+  `forum_threads` int(11) DEFAULT '0',
+  `forum_posts` int(11) DEFAULT '0',
+  `forum_last_post` int(11) DEFAULT '0',
+  `forum_category` int(11) DEFAULT NULL,
+  `allow_anonymous` int(11) DEFAULT NULL,
+  `allow_edit` int(11) DEFAULT NULL,
+  `approval_direct_post` varchar(20) DEFAULT NULL,
+  `allow_attachments` int(11) DEFAULT NULL,
+  `allow_new_threads` int(11) 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(11) DEFAULT NULL,
+  `locked` int(11) NOT NULL DEFAULT '0',
+  `session_id` int(11) NOT NULL DEFAULT '0',
+  `forum_image` varchar(255) NOT NULL DEFAULT '',
+  PRIMARY KEY (`forum_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_mailcue`
+--
+
+DROP TABLE IF EXISTS `forum_mailcue`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_mailcue` (
+  `thread_id` int(11) DEFAULT NULL,
+  `user_id` int(11) DEFAULT NULL,
+  `post_id` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_notification`
+--
+
+DROP TABLE IF EXISTS `forum_notification`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_notification` (
+  `user_id` int(11) DEFAULT NULL,
+  `forum_id` int(11) DEFAULT NULL,
+  `thread_id` int(11) DEFAULT NULL,
+  `post_id` int(11) DEFAULT NULL,
+  KEY `user_id` (`user_id`),
+  KEY `forum_id` (`forum_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_post`
+--
+
+DROP TABLE IF EXISTS `forum_post`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_post` (
+  `post_id` int(11) NOT NULL AUTO_INCREMENT,
+  `post_title` varchar(250) DEFAULT NULL,
+  `post_text` text,
+  `thread_id` int(11) DEFAULT '0',
+  `forum_id` int(11) DEFAULT '0',
+  `poster_id` int(11) DEFAULT '0',
+  `poster_name` varchar(100) DEFAULT '',
+  `post_date` datetime DEFAULT '0000-00-00 00:00:00',
+  `post_notification` tinyint(4) DEFAULT '0',
+  `post_parent_id` int(11) DEFAULT '0',
+  `visible` tinyint(4) DEFAULT '1',
+  PRIMARY KEY (`post_id`),
+  KEY `poster_id` (`poster_id`),
+  KEY `forum_id` (`forum_id`),
+  KEY `idx_forum_post_thread_id` (`thread_id`),
+  KEY `idx_forum_post_visible` (`visible`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_thread`
+--
+
+DROP TABLE IF EXISTS `forum_thread`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_thread` (
+  `thread_id` int(11) NOT NULL AUTO_INCREMENT,
+  `thread_title` varchar(255) DEFAULT NULL,
+  `forum_id` int(11) DEFAULT NULL,
+  `thread_replies` int(11) DEFAULT '0',
+  `thread_poster_id` int(11) DEFAULT NULL,
+  `thread_poster_name` varchar(100) DEFAULT '',
+  `thread_views` int(11) DEFAULT '0',
+  `thread_last_post` int(11) DEFAULT NULL,
+  `thread_date` datetime DEFAULT '0000-00-00 00:00:00',
+  `thread_sticky` tinyint(3) unsigned DEFAULT '0',
+  `locked` int(11) NOT NULL DEFAULT '0',
+  `session_id` int(10) unsigned DEFAULT NULL,
+  `thread_title_qualify` varchar(255) DEFAULT '',
+  `thread_qualify_max` float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  `thread_close_date` datetime DEFAULT '0000-00-00 00:00:00',
+  `thread_weight` float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  PRIMARY KEY (`thread_id`),
+  KEY `idx_forum_thread_forum_id` (`forum_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_thread_qualify`
+--
+
+DROP TABLE IF EXISTS `forum_thread_qualify`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_thread_qualify` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `user_id` int(10) unsigned NOT NULL,
+  `thread_id` int(11) NOT NULL,
+  `qualify` float(6,2) NOT NULL DEFAULT '0.00',
+  `qualify_user_id` int(11) DEFAULT NULL,
+  `qualify_time` datetime DEFAULT '0000-00-00 00:00:00',
+  `session_id` int(11) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `user_id` (`user_id`,`thread_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_thread_qualify_log`
+--
+
+DROP TABLE IF EXISTS `forum_thread_qualify_log`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_thread_qualify_log` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `user_id` int(10) unsigned NOT NULL,
+  `thread_id` int(11) NOT NULL,
+  `qualify` float(6,2) NOT NULL DEFAULT '0.00',
+  `qualify_user_id` int(11) DEFAULT NULL,
+  `qualify_time` datetime DEFAULT '0000-00-00 00:00:00',
+  `session_id` int(11) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `user_id` (`user_id`,`thread_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `glossary`
+--
+
+DROP TABLE IF EXISTS `glossary`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `glossary` (
+  `glossary_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `name` varchar(255) NOT NULL,
+  `description` text NOT NULL,
+  `display_order` int(11) DEFAULT NULL,
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`glossary_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `group_category`
+--
+
+DROP TABLE IF EXISTS `group_category`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `group_category` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `title` varchar(255) NOT NULL DEFAULT '',
+  `description` text NOT NULL,
+  `doc_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `calendar_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `work_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `announcements_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `forum_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `wiki_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `chat_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `max_student` smallint(5) unsigned NOT NULL DEFAULT '8',
+  `self_reg_allowed` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `self_unreg_allowed` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `groups_per_user` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `display_order` smallint(5) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `group_info`
+--
+
+DROP TABLE IF EXISTS `group_info`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `group_info` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `name` varchar(100) DEFAULT NULL,
+  `category_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `description` text,
+  `max_student` smallint(5) unsigned NOT NULL DEFAULT '8',
+  `doc_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `calendar_state` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `work_state` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `announcements_state` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `forum_state` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `wiki_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `chat_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `secret_directory` varchar(255) DEFAULT NULL,
+  `self_registration_allowed` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `self_unregistration_allowed` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `session_id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `group_rel_tutor`
+--
+
+DROP TABLE IF EXISTS `group_rel_tutor`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `group_rel_tutor` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `user_id` int(11) NOT NULL,
+  `group_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `group_rel_user`
+--
+
+DROP TABLE IF EXISTS `group_rel_user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `group_rel_user` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `user_id` int(10) unsigned NOT NULL,
+  `group_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `status` int(11) NOT NULL DEFAULT '0',
+  `role` char(50) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `item_property`
+--
+
+DROP TABLE IF EXISTS `item_property`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `item_property` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `tool` varchar(100) NOT NULL DEFAULT '',
+  `insert_user_id` int(10) 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(11) NOT NULL DEFAULT '0',
+  `lastedit_type` varchar(100) NOT NULL DEFAULT '',
+  `lastedit_user_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `to_group_id` int(10) unsigned DEFAULT NULL,
+  `to_user_id` int(10) unsigned DEFAULT NULL,
+  `visibility` tinyint(4) 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(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `idx_item_property_toolref` (`tool`,`ref`)
+) ENGINE=InnoDB AUTO_INCREMENT=205 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `link`
+--
+
+DROP TABLE IF EXISTS `link`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `link` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `url` text NOT NULL,
+  `title` varchar(150) DEFAULT NULL,
+  `description` text,
+  `category_id` smallint(5) unsigned DEFAULT NULL,
+  `display_order` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `on_homepage` enum('0','1') NOT NULL DEFAULT '0',
+  `target` char(10) DEFAULT '_self',
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `link_category`
+--
+
+DROP TABLE IF EXISTS `link_category`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `link_category` (
+  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
+  `category_title` varchar(255) NOT NULL,
+  `description` text,
+  `display_order` mediumint(8) unsigned NOT NULL DEFAULT '0',
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp`
+--
+
+DROP TABLE IF EXISTS `lp`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `lp_type` smallint(5) unsigned NOT NULL,
+  `name` varchar(255) NOT NULL,
+  `ref` tinytext,
+  `description` text,
+  `path` text NOT NULL,
+  `force_commit` tinyint(3) 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(10) unsigned NOT NULL DEFAULT '0',
+  `content_maker` tinytext NOT NULL,
+  `content_local` varchar(32) NOT NULL DEFAULT 'local',
+  `content_license` text NOT NULL,
+  `prevent_reinit` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `js_lib` tinytext NOT NULL,
+  `debug` tinyint(3) 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(10) unsigned NOT NULL DEFAULT '0',
+  `prerequisite` int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp_item`
+--
+
+DROP TABLE IF EXISTS `lp_item`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp_item` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `lp_id` int(10) unsigned NOT NULL,
+  `item_type` char(32) NOT NULL DEFAULT 'dokeos_document',
+  `ref` tinytext NOT NULL,
+  `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 NOT NULL DEFAULT '100',
+  `mastery_score` float unsigned DEFAULT NULL,
+  `parent_item_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `previous_item_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `next_item_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `display_order` int(10) unsigned NOT NULL DEFAULT '0',
+  `prerequisite` text,
+  `parameters` text,
+  `launch_data` text NOT NULL,
+  `max_time_allowed` char(13) DEFAULT '',
+  `terms` text,
+  `search_did` int(11) DEFAULT NULL,
+  `audio` varchar(250) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `lp_id` (`lp_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp_item_view`
+--
+
+DROP TABLE IF EXISTS `lp_item_view`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp_item_view` (
+  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+  `lp_item_id` int(10) unsigned NOT NULL,
+  `lp_view_id` int(10) unsigned NOT NULL,
+  `view_count` int(10) unsigned NOT NULL DEFAULT '0',
+  `start_time` int(10) unsigned NOT NULL,
+  `total_time` int(10) unsigned NOT NULL DEFAULT '0',
+  `score` float unsigned NOT NULL DEFAULT '0',
+  `status` char(32) NOT NULL DEFAULT 'not attempted',
+  `suspend_data` text,
+  `lesson_location` text,
+  `core_exit` varchar(32) NOT NULL DEFAULT 'none',
+  `max_score` varchar(8) DEFAULT '',
+  PRIMARY KEY (`id`),
+  KEY `lp_item_id` (`lp_item_id`),
+  KEY `lp_view_id` (`lp_view_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp_iv_interaction`
+--
+
+DROP TABLE IF EXISTS `lp_iv_interaction`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp_iv_interaction` (
+  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+  `order_id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `lp_iv_id` bigint(20) 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,
+  `student_response` text NOT NULL,
+  `result` varchar(255) NOT NULL DEFAULT '',
+  `latency` varchar(16) NOT NULL DEFAULT '',
+  PRIMARY KEY (`id`),
+  KEY `lp_iv_id` (`lp_iv_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp_iv_objective`
+--
+
+DROP TABLE IF EXISTS `lp_iv_objective`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp_iv_objective` (
+  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+  `lp_iv_id` bigint(20) unsigned NOT NULL,
+  `order_id` smallint(5) 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`),
+  KEY `lp_iv_id` (`lp_iv_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp_view`
+--
+
+DROP TABLE IF EXISTS `lp_view`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp_view` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `lp_id` int(10) unsigned NOT NULL,
+  `user_id` int(10) unsigned NOT NULL,
+  `view_count` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `last_item` int(10) unsigned NOT NULL DEFAULT '0',
+  `progress` int(10) unsigned DEFAULT '0',
+  `session_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `lp_id` (`lp_id`),
+  KEY `user_id` (`user_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `notebook`
+--
+
+DROP TABLE IF EXISTS `notebook`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `notebook` (
+  `notebook_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `user_id` int(10) unsigned NOT NULL,
+  `course` varchar(40) NOT NULL,
+  `session_id` int(11) 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(11) DEFAULT NULL,
+  PRIMARY KEY (`notebook_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `online_connected`
+--
+
+DROP TABLE IF EXISTS `online_connected`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `online_connected` (
+  `user_id` int(10) unsigned NOT NULL,
+  `last_connection` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  PRIMARY KEY (`user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `online_link`
+--
+
+DROP TABLE IF EXISTS `online_link`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `online_link` (
+  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
+  `name` char(50) NOT NULL DEFAULT '',
+  `url` char(100) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `permission_group`
+--
+
+DROP TABLE IF EXISTS `permission_group`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `permission_group` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `group_id` int(11) NOT NULL DEFAULT '0',
+  `tool` varchar(250) NOT NULL DEFAULT '',
+  `action` varchar(250) NOT NULL DEFAULT '',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `permission_task`
+--
+
+DROP TABLE IF EXISTS `permission_task`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `permission_task` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `task_id` int(11) NOT NULL DEFAULT '0',
+  `tool` varchar(250) NOT NULL DEFAULT '',
+  `action` varchar(250) NOT NULL DEFAULT '',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `permission_user`
+--
+
+DROP TABLE IF EXISTS `permission_user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `permission_user` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  `tool` varchar(250) NOT NULL DEFAULT '',
+  `action` varchar(250) NOT NULL DEFAULT '',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `quiz`
+--
+
+DROP TABLE IF EXISTS `quiz`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `quiz` (
+  `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+  `title` varchar(255) NOT NULL,
+  `description` text,
+  `sound` varchar(255) DEFAULT NULL,
+  `type` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `random` smallint(6) NOT NULL DEFAULT '0',
+  `random_answers` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `active` tinyint(4) NOT NULL DEFAULT '0',
+  `results_disabled` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `access_condition` text,
+  `max_attempt` int(11) 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(11) NOT NULL DEFAULT '0',
+  `expired_time` int(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `quiz_answer`
+--
+
+DROP TABLE IF EXISTS `quiz_answer`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `quiz_answer` (
+  `id` mediumint(8) unsigned NOT NULL,
+  `question_id` mediumint(8) unsigned NOT NULL,
+  `answer` text NOT NULL,
+  `correct` mediumint(8) unsigned DEFAULT NULL,
+  `comment` text,
+  `ponderation` float(6,2) NOT NULL DEFAULT '0.00',
+  `position` mediumint(8) unsigned NOT NULL DEFAULT '1',
+  `hotspot_coordinates` text,
+  `hotspot_type` enum('square','circle','poly','delineation') DEFAULT NULL,
+  `destination` text NOT NULL,
+  `id_auto` int(11) NOT NULL AUTO_INCREMENT,
+  PRIMARY KEY (`id`,`question_id`),
+  UNIQUE KEY `id_auto` (`id_auto`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `quiz_question`
+--
+
+DROP TABLE IF EXISTS `quiz_question`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `quiz_question` (
+  `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+  `question` varchar(511) NOT NULL,
+  `description` text,
+  `ponderation` float(6,2) NOT NULL DEFAULT '0.00',
+  `position` mediumint(8) unsigned NOT NULL DEFAULT '1',
+  `type` tinyint(3) unsigned NOT NULL DEFAULT '2',
+  `picture` varchar(50) DEFAULT NULL,
+  `level` int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `position` (`position`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `quiz_rel_question`
+--
+
+DROP TABLE IF EXISTS `quiz_rel_question`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `quiz_rel_question` (
+  `question_id` mediumint(8) unsigned NOT NULL,
+  `exercice_id` mediumint(8) unsigned NOT NULL,
+  `question_order` mediumint(8) unsigned NOT NULL DEFAULT '1',
+  PRIMARY KEY (`question_id`,`exercice_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `resource`
+--
+
+DROP TABLE IF EXISTS `resource`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `resource` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `source_type` varchar(50) DEFAULT NULL,
+  `source_id` int(10) unsigned DEFAULT NULL,
+  `resource_type` varchar(50) DEFAULT NULL,
+  `resource_id` int(10) unsigned DEFAULT NULL,
+  UNIQUE KEY `id` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `role`
+--
+
+DROP TABLE IF EXISTS `role`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `role` (
+  `role_id` int(11) NOT NULL AUTO_INCREMENT,
+  `role_name` varchar(250) NOT NULL DEFAULT '',
+  `role_comment` text,
+  `default_role` tinyint(4) DEFAULT '0',
+  PRIMARY KEY (`role_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `role_group`
+--
+
+DROP TABLE IF EXISTS `role_group`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `role_group` (
+  `role_id` int(11) NOT NULL DEFAULT '0',
+  `scope` varchar(20) NOT NULL DEFAULT 'course',
+  `group_id` int(11) NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `role_permissions`
+--
+
+DROP TABLE IF EXISTS `role_permissions`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `role_permissions` (
+  `role_id` int(11) NOT NULL DEFAULT '0',
+  `tool` varchar(250) NOT NULL DEFAULT '',
+  `action` varchar(50) NOT NULL DEFAULT '',
+  `default_perm` tinyint(4) NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `role_user`
+--
+
+DROP TABLE IF EXISTS `role_user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `role_user` (
+  `role_id` int(11) NOT NULL DEFAULT '0',
+  `scope` varchar(20) NOT NULL DEFAULT 'course',
+  `user_id` int(11) NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `student_publication`
+--
+
+DROP TABLE IF EXISTS `student_publication`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `student_publication` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `url` varchar(255) DEFAULT NULL,
+  `title` varchar(255) DEFAULT NULL,
+  `description` text,
+  `author` varchar(255) DEFAULT NULL,
+  `active` tinyint(4) DEFAULT NULL,
+  `accepted` tinyint(4) DEFAULT '0',
+  `post_group_id` int(11) NOT NULL DEFAULT '0',
+  `sent_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `filetype` set('file','folder') NOT NULL DEFAULT 'file',
+  `has_properties` int(10) unsigned NOT NULL DEFAULT '0',
+  `view_properties` tinyint(4) DEFAULT NULL,
+  `qualification` float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  `date_of_qualification` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `parent_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `qualificator_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `weight` float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  `session_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `user_id` int(11) NOT NULL,
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `student_publication_assignment`
+--
+
+DROP TABLE IF EXISTS `student_publication_assignment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `student_publication_assignment` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `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(4) NOT NULL,
+  `enable_qualification` tinyint(4) NOT NULL,
+  `publication_id` int(11) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey`
+--
+
+DROP TABLE IF EXISTS `survey`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey` (
+  `survey_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `code` varchar(20) DEFAULT NULL,
+  `title` text,
+  `subtitle` text,
+  `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(11) NOT NULL,
+  `answered` int(11) 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,
+  `shuffle` tinyint(1) NOT NULL DEFAULT '0',
+  `one_question_per_page` tinyint(1) NOT NULL DEFAULT '0',
+  `survey_version` varchar(255) NOT NULL DEFAULT '',
+  `parent_id` int(10) unsigned NOT NULL,
+  `survey_type` int(11) NOT NULL DEFAULT '0',
+  `show_form_profile` int(11) NOT NULL DEFAULT '0',
+  `form_fields` text NOT NULL,
+  `session_id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`survey_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey_answer`
+--
+
+DROP TABLE IF EXISTS `survey_answer`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey_answer` (
+  `answer_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `survey_id` int(10) unsigned NOT NULL,
+  `question_id` int(10) unsigned NOT NULL,
+  `option_id` text NOT NULL,
+  `value` int(10) unsigned NOT NULL,
+  `user` varchar(250) NOT NULL,
+  PRIMARY KEY (`answer_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey_group`
+--
+
+DROP TABLE IF EXISTS `survey_group`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey_group` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `name` varchar(20) NOT NULL,
+  `description` varchar(255) NOT NULL,
+  `survey_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey_invitation`
+--
+
+DROP TABLE IF EXISTS `survey_invitation`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey_invitation` (
+  `survey_invitation_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `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(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`survey_invitation_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey_question`
+--
+
+DROP TABLE IF EXISTS `survey_question`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey_question` (
+  `question_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `survey_id` int(10) 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(11) NOT NULL,
+  `shared_question_id` int(11) DEFAULT NULL,
+  `max_value` int(11) DEFAULT NULL,
+  `survey_group_pri` int(10) unsigned NOT NULL DEFAULT '0',
+  `survey_group_sec1` int(10) unsigned NOT NULL DEFAULT '0',
+  `survey_group_sec2` int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`question_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey_question_option`
+--
+
+DROP TABLE IF EXISTS `survey_question_option`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey_question_option` (
+  `question_option_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `question_id` int(10) unsigned NOT NULL,
+  `survey_id` int(10) unsigned NOT NULL,
+  `option_text` text NOT NULL,
+  `sort` int(11) NOT NULL,
+  `value` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`question_option_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `thematic`
+--
+
+DROP TABLE IF EXISTS `thematic`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `thematic` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `title` varchar(255) NOT NULL,
+  `content` text,
+  `display_order` int(10) unsigned NOT NULL DEFAULT '0',
+  `active` tinyint(4) NOT NULL DEFAULT '0',
+  `session_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `active` (`active`,`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `thematic_advance`
+--
+
+DROP TABLE IF EXISTS `thematic_advance`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `thematic_advance` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `thematic_id` int(11) NOT NULL,
+  `attendance_id` int(11) NOT NULL DEFAULT '0',
+  `content` text,
+  `start_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `duration` int(11) NOT NULL DEFAULT '0',
+  `done_advance` tinyint(4) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `thematic_id` (`thematic_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `thematic_plan`
+--
+
+DROP TABLE IF EXISTS `thematic_plan`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `thematic_plan` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `thematic_id` int(11) NOT NULL,
+  `title` varchar(255) NOT NULL,
+  `description` text,
+  `description_type` int(11) NOT NULL,
+  PRIMARY KEY (`id`),
+  KEY `thematic_id` (`thematic_id`,`description_type`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `tool`
+--
+
+DROP TABLE IF EXISTS `tool`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `tool` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `name` varchar(255) NOT NULL,
+  `link` varchar(255) NOT NULL,
+  `image` varchar(255) DEFAULT NULL,
+  `visibility` tinyint(3) unsigned DEFAULT '0',
+  `admin` varchar(255) DEFAULT NULL,
+  `address` varchar(255) DEFAULT NULL,
+  `added_tool` tinyint(3) unsigned DEFAULT '1',
+  `target` enum('_self','_blank') NOT NULL DEFAULT '_self',
+  `category` enum('authoring','interaction','admin') NOT NULL DEFAULT 'authoring',
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `tool_intro`
+--
+
+DROP TABLE IF EXISTS `tool_intro`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `tool_intro` (
+  `id` varchar(50) NOT NULL,
+  `intro_text` text NOT NULL,
+  `session_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`,`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `userinfo_content`
+--
+
+DROP TABLE IF EXISTS `userinfo_content`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `userinfo_content` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `user_id` int(10) unsigned NOT NULL,
+  `definition_id` int(10) unsigned NOT NULL,
+  `editor_ip` varchar(39) DEFAULT NULL,
+  `edition_time` datetime DEFAULT NULL,
+  `content` text NOT NULL,
+  PRIMARY KEY (`id`),
+  KEY `user_id` (`user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `userinfo_def`
+--
+
+DROP TABLE IF EXISTS `userinfo_def`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `userinfo_def` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `title` varchar(80) NOT NULL DEFAULT '',
+  `comment` text,
+  `line_count` tinyint(3) unsigned NOT NULL DEFAULT '5',
+  `rank` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `wiki`
+--
+
+DROP TABLE IF EXISTS `wiki`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `wiki` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `page_id` int(11) NOT NULL DEFAULT '0',
+  `reflink` varchar(255) NOT NULL DEFAULT 'index',
+  `title` varchar(255) NOT NULL,
+  `content` mediumtext NOT NULL,
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  `group_id` int(11) DEFAULT NULL,
+  `dtime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `addlock` int(11) NOT NULL DEFAULT '1',
+  `editlock` int(11) NOT NULL DEFAULT '0',
+  `visibility` int(11) NOT NULL DEFAULT '1',
+  `addlock_disc` int(11) NOT NULL DEFAULT '1',
+  `visibility_disc` int(11) NOT NULL DEFAULT '1',
+  `ratinglock_disc` int(11) NOT NULL DEFAULT '1',
+  `assignment` int(11) NOT NULL DEFAULT '0',
+  `comment` text NOT NULL,
+  `progress` text NOT NULL,
+  `score` int(11) DEFAULT '0',
+  `version` int(11) DEFAULT NULL,
+  `is_editing` int(11) NOT NULL DEFAULT '0',
+  `time_edit` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `hits` int(11) DEFAULT '0',
+  `linksto` text NOT NULL,
+  `tag` text NOT NULL,
+  `user_ip` varchar(39) NOT NULL,
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `reflink` (`reflink`),
+  KEY `group_id` (`group_id`),
+  KEY `page_id` (`page_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `wiki_conf`
+--
+
+DROP TABLE IF EXISTS `wiki_conf`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `wiki_conf` (
+  `page_id` int(11) 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(11) DEFAULT NULL,
+  `max_text` int(11) DEFAULT NULL,
+  `max_version` int(11) 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(11) NOT NULL DEFAULT '0',
+  KEY `page_id` (`page_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `wiki_discuss`
+--
+
+DROP TABLE IF EXISTS `wiki_discuss`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `wiki_discuss` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `publication_id` int(11) NOT NULL DEFAULT '0',
+  `userc_id` int(11) 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`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `wiki_mailcue`
+--
+
+DROP TABLE IF EXISTS `wiki_mailcue`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `wiki_mailcue` (
+  `id` int(11) NOT NULL,
+  `user_id` int(11) NOT NULL,
+  `type` text NOT NULL,
+  `group_id` int(11) DEFAULT NULL,
+  KEY `id` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2013-03-27 11:30:07

+ 1736 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.8.7/db_course2.sql

@@ -0,0 +1,1736 @@
+-- MySQL dump 10.13  Distrib 5.5.29, for debian-linux-gnu (i686)
+--
+-- Host: localhost    Database: chamilo187_222
+-- ------------------------------------------------------
+-- Server version	5.5.29-0ubuntu0.12.10.1
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `announcement`
+--
+
+DROP TABLE IF EXISTS `announcement`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `announcement` (
+  `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+  `title` text,
+  `content` mediumtext,
+  `end_date` date DEFAULT NULL,
+  `display_order` mediumint(9) NOT NULL DEFAULT '0',
+  `email_sent` tinyint(4) DEFAULT '0',
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `announcement_attachment`
+--
+
+DROP TABLE IF EXISTS `announcement_attachment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `announcement_attachment` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `path` varchar(255) NOT NULL,
+  `comment` text,
+  `size` int(11) NOT NULL DEFAULT '0',
+  `announcement_id` int(11) NOT NULL,
+  `filename` varchar(255) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `attendance`
+--
+
+DROP TABLE IF EXISTS `attendance`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `attendance` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `name` text NOT NULL,
+  `description` text,
+  `active` tinyint(4) NOT NULL DEFAULT '1',
+  `attendance_qualify_title` varchar(255) DEFAULT NULL,
+  `attendance_qualify_max` int(11) NOT NULL DEFAULT '0',
+  `attendance_weight` float(6,2) NOT NULL DEFAULT '0.00',
+  `session_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`),
+  KEY `active` (`active`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `attendance_calendar`
+--
+
+DROP TABLE IF EXISTS `attendance_calendar`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `attendance_calendar` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `attendance_id` int(11) NOT NULL,
+  `date_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `done_attendance` tinyint(4) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `attendance_id` (`attendance_id`),
+  KEY `done_attendance` (`done_attendance`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `attendance_result`
+--
+
+DROP TABLE IF EXISTS `attendance_result`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `attendance_result` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `user_id` int(11) NOT NULL,
+  `attendance_id` int(11) NOT NULL,
+  `score` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `attendance_id` (`attendance_id`),
+  KEY `user_id` (`user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `attendance_sheet`
+--
+
+DROP TABLE IF EXISTS `attendance_sheet`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `attendance_sheet` (
+  `user_id` int(11) NOT NULL,
+  `attendance_calendar_id` int(11) NOT NULL,
+  `presence` tinyint(4) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`user_id`,`attendance_calendar_id`),
+  KEY `presence` (`presence`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog`
+--
+
+DROP TABLE IF EXISTS `blog`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog` (
+  `blog_id` smallint(6) NOT NULL AUTO_INCREMENT,
+  `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(3) unsigned NOT NULL DEFAULT '0',
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`blog_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with blogs in this course';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_attachment`
+--
+
+DROP TABLE IF EXISTS `blog_attachment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_attachment` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `path` varchar(255) NOT NULL COMMENT 'the real filename',
+  `comment` text,
+  `size` int(11) NOT NULL DEFAULT '0',
+  `post_id` int(11) NOT NULL,
+  `filename` varchar(255) NOT NULL COMMENT 'the user s file name',
+  `blog_id` int(11) NOT NULL,
+  `comment_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_comment`
+--
+
+DROP TABLE IF EXISTS `blog_comment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_comment` (
+  `comment_id` int(11) NOT NULL AUTO_INCREMENT,
+  `title` varchar(250) NOT NULL DEFAULT '',
+  `comment` longtext NOT NULL,
+  `author_id` int(11) NOT NULL DEFAULT '0',
+  `date_creation` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `blog_id` mediumint(9) NOT NULL DEFAULT '0',
+  `post_id` int(11) NOT NULL DEFAULT '0',
+  `task_id` int(11) DEFAULT NULL,
+  `parent_comment_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`comment_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with comments on posts in a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_post`
+--
+
+DROP TABLE IF EXISTS `blog_post`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_post` (
+  `post_id` int(11) NOT NULL AUTO_INCREMENT,
+  `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` mediumint(9) NOT NULL DEFAULT '0',
+  `author_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`post_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with posts / blog.';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_rating`
+--
+
+DROP TABLE IF EXISTS `blog_rating`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_rating` (
+  `rating_id` int(11) NOT NULL AUTO_INCREMENT,
+  `blog_id` int(11) NOT NULL DEFAULT '0',
+  `rating_type` enum('post','comment') NOT NULL DEFAULT 'post',
+  `item_id` int(11) NOT NULL DEFAULT '0',
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  `rating` mediumint(9) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`rating_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with ratings for post/comments in a certain blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_rel_user`
+--
+
+DROP TABLE IF EXISTS `blog_rel_user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_rel_user` (
+  `blog_id` int(11) NOT NULL DEFAULT '0',
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`blog_id`,`user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table representing users subscribed to a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_task`
+--
+
+DROP TABLE IF EXISTS `blog_task`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_task` (
+  `task_id` mediumint(9) NOT NULL AUTO_INCREMENT,
+  `blog_id` mediumint(9) NOT NULL DEFAULT '0',
+  `title` varchar(250) NOT NULL DEFAULT '',
+  `description` text NOT NULL,
+  `color` varchar(10) NOT NULL DEFAULT '',
+  `system_task` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`task_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with tasks for a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_task_rel_user`
+--
+
+DROP TABLE IF EXISTS `blog_task_rel_user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_task_rel_user` (
+  `blog_id` mediumint(9) NOT NULL DEFAULT '0',
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  `task_id` mediumint(9) NOT NULL DEFAULT '0',
+  `target_date` date NOT NULL DEFAULT '0000-00-00',
+  PRIMARY KEY (`blog_id`,`user_id`,`task_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with tasks assigned to a user in a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `calendar_event`
+--
+
+DROP TABLE IF EXISTS `calendar_event`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `calendar_event` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `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(11) DEFAULT NULL,
+  `session_id` int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `calendar_event_attachment`
+--
+
+DROP TABLE IF EXISTS `calendar_event_attachment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `calendar_event_attachment` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `path` varchar(255) NOT NULL,
+  `comment` text,
+  `size` int(11) NOT NULL DEFAULT '0',
+  `agenda_id` int(11) NOT NULL,
+  `filename` varchar(255) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `calendar_event_repeat`
+--
+
+DROP TABLE IF EXISTS `calendar_event_repeat`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `calendar_event_repeat` (
+  `cal_id` int(11) NOT NULL DEFAULT '0',
+  `cal_type` varchar(20) DEFAULT NULL,
+  `cal_end` int(11) DEFAULT NULL,
+  `cal_frequency` int(11) DEFAULT '1',
+  `cal_days` char(7) DEFAULT NULL,
+  PRIMARY KEY (`cal_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `calendar_event_repeat_not`
+--
+
+DROP TABLE IF EXISTS `calendar_event_repeat_not`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `calendar_event_repeat_not` (
+  `cal_id` int(11) NOT NULL,
+  `cal_date` int(11) NOT NULL,
+  PRIMARY KEY (`cal_id`,`cal_date`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `chat_connected`
+--
+
+DROP TABLE IF EXISTS `chat_connected`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `chat_connected` (
+  `user_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `last_connection` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `session_id` int(11) NOT NULL DEFAULT '0',
+  `to_group_id` int(11) NOT NULL DEFAULT '0',
+  KEY `char_connected_index` (`user_id`,`session_id`,`to_group_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `course_description`
+--
+
+DROP TABLE IF EXISTS `course_description`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `course_description` (
+  `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
+  `title` varchar(255) DEFAULT NULL,
+  `content` text,
+  `session_id` smallint(6) DEFAULT '0',
+  `description_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `progress` int(11) NOT NULL DEFAULT '0',
+  UNIQUE KEY `id` (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `course_setting`
+--
+
+DROP TABLE IF EXISTS `course_setting`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `course_setting` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `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`)
+) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `document`
+--
+
+DROP TABLE IF EXISTS `document`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `document` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `path` varchar(255) NOT NULL DEFAULT '',
+  `comment` text,
+  `title` varchar(255) DEFAULT NULL,
+  `filetype` set('file','folder') NOT NULL DEFAULT 'file',
+  `size` int(11) NOT NULL DEFAULT '0',
+  `readonly` tinyint(3) unsigned NOT NULL,
+  `session_id` int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=198 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `dropbox_category`
+--
+
+DROP TABLE IF EXISTS `dropbox_category`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `dropbox_category` (
+  `cat_id` int(11) NOT NULL AUTO_INCREMENT,
+  `cat_name` text NOT NULL,
+  `received` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `sent` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(6) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`cat_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `dropbox_feedback`
+--
+
+DROP TABLE IF EXISTS `dropbox_feedback`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `dropbox_feedback` (
+  `feedback_id` int(11) NOT NULL AUTO_INCREMENT,
+  `file_id` int(11) NOT NULL DEFAULT '0',
+  `author_user_id` int(11) NOT NULL DEFAULT '0',
+  `feedback` text NOT NULL,
+  `feedback_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  PRIMARY KEY (`feedback_id`),
+  KEY `file_id` (`file_id`),
+  KEY `author_user_id` (`author_user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `dropbox_file`
+--
+
+DROP TABLE IF EXISTS `dropbox_file`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `dropbox_file` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `uploader_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `filename` varchar(250) NOT NULL DEFAULT '',
+  `filesize` int(10) 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(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(5) unsigned NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `UN_filename` (`filename`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `dropbox_person`
+--
+
+DROP TABLE IF EXISTS `dropbox_person`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `dropbox_person` (
+  `file_id` int(10) unsigned NOT NULL,
+  `user_id` int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`file_id`,`user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `dropbox_post`
+--
+
+DROP TABLE IF EXISTS `dropbox_post`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `dropbox_post` (
+  `file_id` int(10) unsigned NOT NULL,
+  `dest_user_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `feedback_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `feedback` text,
+  `cat_id` int(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(5) unsigned NOT NULL,
+  PRIMARY KEY (`file_id`,`dest_user_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_attachment`
+--
+
+DROP TABLE IF EXISTS `forum_attachment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_attachment` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `path` varchar(255) NOT NULL,
+  `comment` text,
+  `size` int(11) NOT NULL DEFAULT '0',
+  `post_id` int(11) NOT NULL,
+  `filename` varchar(255) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_category`
+--
+
+DROP TABLE IF EXISTS `forum_category`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_category` (
+  `cat_id` int(11) NOT NULL AUTO_INCREMENT,
+  `cat_title` varchar(255) NOT NULL DEFAULT '',
+  `cat_comment` text,
+  `cat_order` int(11) NOT NULL DEFAULT '0',
+  `locked` int(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`cat_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_forum`
+--
+
+DROP TABLE IF EXISTS `forum_forum`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_forum` (
+  `forum_id` int(11) NOT NULL AUTO_INCREMENT,
+  `forum_title` varchar(255) NOT NULL DEFAULT '',
+  `forum_comment` text,
+  `forum_threads` int(11) DEFAULT '0',
+  `forum_posts` int(11) DEFAULT '0',
+  `forum_last_post` int(11) DEFAULT '0',
+  `forum_category` int(11) DEFAULT NULL,
+  `allow_anonymous` int(11) DEFAULT NULL,
+  `allow_edit` int(11) DEFAULT NULL,
+  `approval_direct_post` varchar(20) DEFAULT NULL,
+  `allow_attachments` int(11) DEFAULT NULL,
+  `allow_new_threads` int(11) 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(11) DEFAULT NULL,
+  `locked` int(11) NOT NULL DEFAULT '0',
+  `session_id` int(11) NOT NULL DEFAULT '0',
+  `forum_image` varchar(255) NOT NULL DEFAULT '',
+  PRIMARY KEY (`forum_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_mailcue`
+--
+
+DROP TABLE IF EXISTS `forum_mailcue`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_mailcue` (
+  `thread_id` int(11) DEFAULT NULL,
+  `user_id` int(11) DEFAULT NULL,
+  `post_id` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_notification`
+--
+
+DROP TABLE IF EXISTS `forum_notification`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_notification` (
+  `user_id` int(11) DEFAULT NULL,
+  `forum_id` int(11) DEFAULT NULL,
+  `thread_id` int(11) DEFAULT NULL,
+  `post_id` int(11) DEFAULT NULL,
+  KEY `user_id` (`user_id`),
+  KEY `forum_id` (`forum_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_post`
+--
+
+DROP TABLE IF EXISTS `forum_post`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_post` (
+  `post_id` int(11) NOT NULL AUTO_INCREMENT,
+  `post_title` varchar(250) DEFAULT NULL,
+  `post_text` text,
+  `thread_id` int(11) DEFAULT '0',
+  `forum_id` int(11) DEFAULT '0',
+  `poster_id` int(11) DEFAULT '0',
+  `poster_name` varchar(100) DEFAULT '',
+  `post_date` datetime DEFAULT '0000-00-00 00:00:00',
+  `post_notification` tinyint(4) DEFAULT '0',
+  `post_parent_id` int(11) DEFAULT '0',
+  `visible` tinyint(4) DEFAULT '1',
+  PRIMARY KEY (`post_id`),
+  KEY `poster_id` (`poster_id`),
+  KEY `forum_id` (`forum_id`),
+  KEY `idx_forum_post_thread_id` (`thread_id`),
+  KEY `idx_forum_post_visible` (`visible`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_thread`
+--
+
+DROP TABLE IF EXISTS `forum_thread`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_thread` (
+  `thread_id` int(11) NOT NULL AUTO_INCREMENT,
+  `thread_title` varchar(255) DEFAULT NULL,
+  `forum_id` int(11) DEFAULT NULL,
+  `thread_replies` int(11) DEFAULT '0',
+  `thread_poster_id` int(11) DEFAULT NULL,
+  `thread_poster_name` varchar(100) DEFAULT '',
+  `thread_views` int(11) DEFAULT '0',
+  `thread_last_post` int(11) DEFAULT NULL,
+  `thread_date` datetime DEFAULT '0000-00-00 00:00:00',
+  `thread_sticky` tinyint(3) unsigned DEFAULT '0',
+  `locked` int(11) NOT NULL DEFAULT '0',
+  `session_id` int(10) unsigned DEFAULT NULL,
+  `thread_title_qualify` varchar(255) DEFAULT '',
+  `thread_qualify_max` float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  `thread_close_date` datetime DEFAULT '0000-00-00 00:00:00',
+  `thread_weight` float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  PRIMARY KEY (`thread_id`),
+  KEY `idx_forum_thread_forum_id` (`forum_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_thread_qualify`
+--
+
+DROP TABLE IF EXISTS `forum_thread_qualify`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_thread_qualify` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `user_id` int(10) unsigned NOT NULL,
+  `thread_id` int(11) NOT NULL,
+  `qualify` float(6,2) NOT NULL DEFAULT '0.00',
+  `qualify_user_id` int(11) DEFAULT NULL,
+  `qualify_time` datetime DEFAULT '0000-00-00 00:00:00',
+  `session_id` int(11) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `user_id` (`user_id`,`thread_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_thread_qualify_log`
+--
+
+DROP TABLE IF EXISTS `forum_thread_qualify_log`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_thread_qualify_log` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `user_id` int(10) unsigned NOT NULL,
+  `thread_id` int(11) NOT NULL,
+  `qualify` float(6,2) NOT NULL DEFAULT '0.00',
+  `qualify_user_id` int(11) DEFAULT NULL,
+  `qualify_time` datetime DEFAULT '0000-00-00 00:00:00',
+  `session_id` int(11) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `user_id` (`user_id`,`thread_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `glossary`
+--
+
+DROP TABLE IF EXISTS `glossary`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `glossary` (
+  `glossary_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `name` varchar(255) NOT NULL,
+  `description` text NOT NULL,
+  `display_order` int(11) DEFAULT NULL,
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`glossary_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `group_category`
+--
+
+DROP TABLE IF EXISTS `group_category`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `group_category` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `title` varchar(255) NOT NULL DEFAULT '',
+  `description` text NOT NULL,
+  `doc_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `calendar_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `work_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `announcements_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `forum_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `wiki_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `chat_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `max_student` smallint(5) unsigned NOT NULL DEFAULT '8',
+  `self_reg_allowed` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `self_unreg_allowed` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `groups_per_user` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `display_order` smallint(5) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `group_info`
+--
+
+DROP TABLE IF EXISTS `group_info`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `group_info` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `name` varchar(100) DEFAULT NULL,
+  `category_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `description` text,
+  `max_student` smallint(5) unsigned NOT NULL DEFAULT '8',
+  `doc_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `calendar_state` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `work_state` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `announcements_state` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `forum_state` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `wiki_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `chat_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `secret_directory` varchar(255) DEFAULT NULL,
+  `self_registration_allowed` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `self_unregistration_allowed` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `session_id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `group_rel_tutor`
+--
+
+DROP TABLE IF EXISTS `group_rel_tutor`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `group_rel_tutor` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `user_id` int(11) NOT NULL,
+  `group_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `group_rel_user`
+--
+
+DROP TABLE IF EXISTS `group_rel_user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `group_rel_user` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `user_id` int(10) unsigned NOT NULL,
+  `group_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `status` int(11) NOT NULL DEFAULT '0',
+  `role` char(50) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `item_property`
+--
+
+DROP TABLE IF EXISTS `item_property`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `item_property` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `tool` varchar(100) NOT NULL DEFAULT '',
+  `insert_user_id` int(10) 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(11) NOT NULL DEFAULT '0',
+  `lastedit_type` varchar(100) NOT NULL DEFAULT '',
+  `lastedit_user_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `to_group_id` int(10) unsigned DEFAULT NULL,
+  `to_user_id` int(10) unsigned DEFAULT NULL,
+  `visibility` tinyint(4) 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(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `idx_item_property_toolref` (`tool`,`ref`)
+) ENGINE=InnoDB AUTO_INCREMENT=205 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `link`
+--
+
+DROP TABLE IF EXISTS `link`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `link` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `url` text NOT NULL,
+  `title` varchar(150) DEFAULT NULL,
+  `description` text,
+  `category_id` smallint(5) unsigned DEFAULT NULL,
+  `display_order` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `on_homepage` enum('0','1') NOT NULL DEFAULT '0',
+  `target` char(10) DEFAULT '_self',
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `link_category`
+--
+
+DROP TABLE IF EXISTS `link_category`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `link_category` (
+  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
+  `category_title` varchar(255) NOT NULL,
+  `description` text,
+  `display_order` mediumint(8) unsigned NOT NULL DEFAULT '0',
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp`
+--
+
+DROP TABLE IF EXISTS `lp`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `lp_type` smallint(5) unsigned NOT NULL,
+  `name` varchar(255) NOT NULL,
+  `ref` tinytext,
+  `description` text,
+  `path` text NOT NULL,
+  `force_commit` tinyint(3) 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(10) unsigned NOT NULL DEFAULT '0',
+  `content_maker` tinytext NOT NULL,
+  `content_local` varchar(32) NOT NULL DEFAULT 'local',
+  `content_license` text NOT NULL,
+  `prevent_reinit` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `js_lib` tinytext NOT NULL,
+  `debug` tinyint(3) 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(10) unsigned NOT NULL DEFAULT '0',
+  `prerequisite` int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp_item`
+--
+
+DROP TABLE IF EXISTS `lp_item`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp_item` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `lp_id` int(10) unsigned NOT NULL,
+  `item_type` char(32) NOT NULL DEFAULT 'dokeos_document',
+  `ref` tinytext NOT NULL,
+  `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 NOT NULL DEFAULT '100',
+  `mastery_score` float unsigned DEFAULT NULL,
+  `parent_item_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `previous_item_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `next_item_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `display_order` int(10) unsigned NOT NULL DEFAULT '0',
+  `prerequisite` text,
+  `parameters` text,
+  `launch_data` text NOT NULL,
+  `max_time_allowed` char(13) DEFAULT '',
+  `terms` text,
+  `search_did` int(11) DEFAULT NULL,
+  `audio` varchar(250) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `lp_id` (`lp_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp_item_view`
+--
+
+DROP TABLE IF EXISTS `lp_item_view`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp_item_view` (
+  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+  `lp_item_id` int(10) unsigned NOT NULL,
+  `lp_view_id` int(10) unsigned NOT NULL,
+  `view_count` int(10) unsigned NOT NULL DEFAULT '0',
+  `start_time` int(10) unsigned NOT NULL,
+  `total_time` int(10) unsigned NOT NULL DEFAULT '0',
+  `score` float unsigned NOT NULL DEFAULT '0',
+  `status` char(32) NOT NULL DEFAULT 'not attempted',
+  `suspend_data` text,
+  `lesson_location` text,
+  `core_exit` varchar(32) NOT NULL DEFAULT 'none',
+  `max_score` varchar(8) DEFAULT '',
+  PRIMARY KEY (`id`),
+  KEY `lp_item_id` (`lp_item_id`),
+  KEY `lp_view_id` (`lp_view_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp_iv_interaction`
+--
+
+DROP TABLE IF EXISTS `lp_iv_interaction`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp_iv_interaction` (
+  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+  `order_id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `lp_iv_id` bigint(20) 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,
+  `student_response` text NOT NULL,
+  `result` varchar(255) NOT NULL DEFAULT '',
+  `latency` varchar(16) NOT NULL DEFAULT '',
+  PRIMARY KEY (`id`),
+  KEY `lp_iv_id` (`lp_iv_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp_iv_objective`
+--
+
+DROP TABLE IF EXISTS `lp_iv_objective`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp_iv_objective` (
+  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+  `lp_iv_id` bigint(20) unsigned NOT NULL,
+  `order_id` smallint(5) 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`),
+  KEY `lp_iv_id` (`lp_iv_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp_view`
+--
+
+DROP TABLE IF EXISTS `lp_view`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp_view` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `lp_id` int(10) unsigned NOT NULL,
+  `user_id` int(10) unsigned NOT NULL,
+  `view_count` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `last_item` int(10) unsigned NOT NULL DEFAULT '0',
+  `progress` int(10) unsigned DEFAULT '0',
+  `session_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `lp_id` (`lp_id`),
+  KEY `user_id` (`user_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `notebook`
+--
+
+DROP TABLE IF EXISTS `notebook`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `notebook` (
+  `notebook_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `user_id` int(10) unsigned NOT NULL,
+  `course` varchar(40) NOT NULL,
+  `session_id` int(11) 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(11) DEFAULT NULL,
+  PRIMARY KEY (`notebook_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `online_connected`
+--
+
+DROP TABLE IF EXISTS `online_connected`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `online_connected` (
+  `user_id` int(10) unsigned NOT NULL,
+  `last_connection` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  PRIMARY KEY (`user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `online_link`
+--
+
+DROP TABLE IF EXISTS `online_link`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `online_link` (
+  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
+  `name` char(50) NOT NULL DEFAULT '',
+  `url` char(100) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `permission_group`
+--
+
+DROP TABLE IF EXISTS `permission_group`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `permission_group` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `group_id` int(11) NOT NULL DEFAULT '0',
+  `tool` varchar(250) NOT NULL DEFAULT '',
+  `action` varchar(250) NOT NULL DEFAULT '',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `permission_task`
+--
+
+DROP TABLE IF EXISTS `permission_task`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `permission_task` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `task_id` int(11) NOT NULL DEFAULT '0',
+  `tool` varchar(250) NOT NULL DEFAULT '',
+  `action` varchar(250) NOT NULL DEFAULT '',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `permission_user`
+--
+
+DROP TABLE IF EXISTS `permission_user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `permission_user` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  `tool` varchar(250) NOT NULL DEFAULT '',
+  `action` varchar(250) NOT NULL DEFAULT '',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `quiz`
+--
+
+DROP TABLE IF EXISTS `quiz`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `quiz` (
+  `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+  `title` varchar(255) NOT NULL,
+  `description` text,
+  `sound` varchar(255) DEFAULT NULL,
+  `type` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `random` smallint(6) NOT NULL DEFAULT '0',
+  `random_answers` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `active` tinyint(4) NOT NULL DEFAULT '0',
+  `results_disabled` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `access_condition` text,
+  `max_attempt` int(11) 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(11) NOT NULL DEFAULT '0',
+  `expired_time` int(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `quiz_answer`
+--
+
+DROP TABLE IF EXISTS `quiz_answer`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `quiz_answer` (
+  `id` mediumint(8) unsigned NOT NULL,
+  `question_id` mediumint(8) unsigned NOT NULL,
+  `answer` text NOT NULL,
+  `correct` mediumint(8) unsigned DEFAULT NULL,
+  `comment` text,
+  `ponderation` float(6,2) NOT NULL DEFAULT '0.00',
+  `position` mediumint(8) unsigned NOT NULL DEFAULT '1',
+  `hotspot_coordinates` text,
+  `hotspot_type` enum('square','circle','poly','delineation') DEFAULT NULL,
+  `destination` text NOT NULL,
+  `id_auto` int(11) NOT NULL AUTO_INCREMENT,
+  PRIMARY KEY (`id`,`question_id`),
+  UNIQUE KEY `id_auto` (`id_auto`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `quiz_question`
+--
+
+DROP TABLE IF EXISTS `quiz_question`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `quiz_question` (
+  `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+  `question` varchar(511) NOT NULL,
+  `description` text,
+  `ponderation` float(6,2) NOT NULL DEFAULT '0.00',
+  `position` mediumint(8) unsigned NOT NULL DEFAULT '1',
+  `type` tinyint(3) unsigned NOT NULL DEFAULT '2',
+  `picture` varchar(50) DEFAULT NULL,
+  `level` int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `position` (`position`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `quiz_rel_question`
+--
+
+DROP TABLE IF EXISTS `quiz_rel_question`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `quiz_rel_question` (
+  `question_id` mediumint(8) unsigned NOT NULL,
+  `exercice_id` mediumint(8) unsigned NOT NULL,
+  `question_order` mediumint(8) unsigned NOT NULL DEFAULT '1',
+  PRIMARY KEY (`question_id`,`exercice_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `resource`
+--
+
+DROP TABLE IF EXISTS `resource`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `resource` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `source_type` varchar(50) DEFAULT NULL,
+  `source_id` int(10) unsigned DEFAULT NULL,
+  `resource_type` varchar(50) DEFAULT NULL,
+  `resource_id` int(10) unsigned DEFAULT NULL,
+  UNIQUE KEY `id` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `role`
+--
+
+DROP TABLE IF EXISTS `role`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `role` (
+  `role_id` int(11) NOT NULL AUTO_INCREMENT,
+  `role_name` varchar(250) NOT NULL DEFAULT '',
+  `role_comment` text,
+  `default_role` tinyint(4) DEFAULT '0',
+  PRIMARY KEY (`role_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `role_group`
+--
+
+DROP TABLE IF EXISTS `role_group`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `role_group` (
+  `role_id` int(11) NOT NULL DEFAULT '0',
+  `scope` varchar(20) NOT NULL DEFAULT 'course',
+  `group_id` int(11) NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `role_permissions`
+--
+
+DROP TABLE IF EXISTS `role_permissions`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `role_permissions` (
+  `role_id` int(11) NOT NULL DEFAULT '0',
+  `tool` varchar(250) NOT NULL DEFAULT '',
+  `action` varchar(50) NOT NULL DEFAULT '',
+  `default_perm` tinyint(4) NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `role_user`
+--
+
+DROP TABLE IF EXISTS `role_user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `role_user` (
+  `role_id` int(11) NOT NULL DEFAULT '0',
+  `scope` varchar(20) NOT NULL DEFAULT 'course',
+  `user_id` int(11) NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `student_publication`
+--
+
+DROP TABLE IF EXISTS `student_publication`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `student_publication` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `url` varchar(255) DEFAULT NULL,
+  `title` varchar(255) DEFAULT NULL,
+  `description` text,
+  `author` varchar(255) DEFAULT NULL,
+  `active` tinyint(4) DEFAULT NULL,
+  `accepted` tinyint(4) DEFAULT '0',
+  `post_group_id` int(11) NOT NULL DEFAULT '0',
+  `sent_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `filetype` set('file','folder') NOT NULL DEFAULT 'file',
+  `has_properties` int(10) unsigned NOT NULL DEFAULT '0',
+  `view_properties` tinyint(4) DEFAULT NULL,
+  `qualification` float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  `date_of_qualification` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `parent_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `qualificator_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `weight` float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  `session_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `user_id` int(11) NOT NULL,
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `student_publication_assignment`
+--
+
+DROP TABLE IF EXISTS `student_publication_assignment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `student_publication_assignment` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `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(4) NOT NULL,
+  `enable_qualification` tinyint(4) NOT NULL,
+  `publication_id` int(11) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey`
+--
+
+DROP TABLE IF EXISTS `survey`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey` (
+  `survey_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `code` varchar(20) DEFAULT NULL,
+  `title` text,
+  `subtitle` text,
+  `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(11) NOT NULL,
+  `answered` int(11) 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,
+  `shuffle` tinyint(1) NOT NULL DEFAULT '0',
+  `one_question_per_page` tinyint(1) NOT NULL DEFAULT '0',
+  `survey_version` varchar(255) NOT NULL DEFAULT '',
+  `parent_id` int(10) unsigned NOT NULL,
+  `survey_type` int(11) NOT NULL DEFAULT '0',
+  `show_form_profile` int(11) NOT NULL DEFAULT '0',
+  `form_fields` text NOT NULL,
+  `session_id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`survey_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey_answer`
+--
+
+DROP TABLE IF EXISTS `survey_answer`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey_answer` (
+  `answer_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `survey_id` int(10) unsigned NOT NULL,
+  `question_id` int(10) unsigned NOT NULL,
+  `option_id` text NOT NULL,
+  `value` int(10) unsigned NOT NULL,
+  `user` varchar(250) NOT NULL,
+  PRIMARY KEY (`answer_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey_group`
+--
+
+DROP TABLE IF EXISTS `survey_group`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey_group` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `name` varchar(20) NOT NULL,
+  `description` varchar(255) NOT NULL,
+  `survey_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey_invitation`
+--
+
+DROP TABLE IF EXISTS `survey_invitation`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey_invitation` (
+  `survey_invitation_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `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(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`survey_invitation_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey_question`
+--
+
+DROP TABLE IF EXISTS `survey_question`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey_question` (
+  `question_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `survey_id` int(10) 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(11) NOT NULL,
+  `shared_question_id` int(11) DEFAULT NULL,
+  `max_value` int(11) DEFAULT NULL,
+  `survey_group_pri` int(10) unsigned NOT NULL DEFAULT '0',
+  `survey_group_sec1` int(10) unsigned NOT NULL DEFAULT '0',
+  `survey_group_sec2` int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`question_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey_question_option`
+--
+
+DROP TABLE IF EXISTS `survey_question_option`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey_question_option` (
+  `question_option_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `question_id` int(10) unsigned NOT NULL,
+  `survey_id` int(10) unsigned NOT NULL,
+  `option_text` text NOT NULL,
+  `sort` int(11) NOT NULL,
+  `value` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`question_option_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `thematic`
+--
+
+DROP TABLE IF EXISTS `thematic`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `thematic` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `title` varchar(255) NOT NULL,
+  `content` text,
+  `display_order` int(10) unsigned NOT NULL DEFAULT '0',
+  `active` tinyint(4) NOT NULL DEFAULT '0',
+  `session_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `active` (`active`,`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `thematic_advance`
+--
+
+DROP TABLE IF EXISTS `thematic_advance`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `thematic_advance` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `thematic_id` int(11) NOT NULL,
+  `attendance_id` int(11) NOT NULL DEFAULT '0',
+  `content` text,
+  `start_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `duration` int(11) NOT NULL DEFAULT '0',
+  `done_advance` tinyint(4) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `thematic_id` (`thematic_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `thematic_plan`
+--
+
+DROP TABLE IF EXISTS `thematic_plan`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `thematic_plan` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `thematic_id` int(11) NOT NULL,
+  `title` varchar(255) NOT NULL,
+  `description` text,
+  `description_type` int(11) NOT NULL,
+  PRIMARY KEY (`id`),
+  KEY `thematic_id` (`thematic_id`,`description_type`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `tool`
+--
+
+DROP TABLE IF EXISTS `tool`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `tool` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `name` varchar(255) NOT NULL,
+  `link` varchar(255) NOT NULL,
+  `image` varchar(255) DEFAULT NULL,
+  `visibility` tinyint(3) unsigned DEFAULT '0',
+  `admin` varchar(255) DEFAULT NULL,
+  `address` varchar(255) DEFAULT NULL,
+  `added_tool` tinyint(3) unsigned DEFAULT '1',
+  `target` enum('_self','_blank') NOT NULL DEFAULT '_self',
+  `category` enum('authoring','interaction','admin') NOT NULL DEFAULT 'authoring',
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `tool_intro`
+--
+
+DROP TABLE IF EXISTS `tool_intro`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `tool_intro` (
+  `id` varchar(50) NOT NULL,
+  `intro_text` text NOT NULL,
+  `session_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`,`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `userinfo_content`
+--
+
+DROP TABLE IF EXISTS `userinfo_content`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `userinfo_content` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `user_id` int(10) unsigned NOT NULL,
+  `definition_id` int(10) unsigned NOT NULL,
+  `editor_ip` varchar(39) DEFAULT NULL,
+  `edition_time` datetime DEFAULT NULL,
+  `content` text NOT NULL,
+  PRIMARY KEY (`id`),
+  KEY `user_id` (`user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `userinfo_def`
+--
+
+DROP TABLE IF EXISTS `userinfo_def`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `userinfo_def` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `title` varchar(80) NOT NULL DEFAULT '',
+  `comment` text,
+  `line_count` tinyint(3) unsigned NOT NULL DEFAULT '5',
+  `rank` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `wiki`
+--
+
+DROP TABLE IF EXISTS `wiki`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `wiki` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `page_id` int(11) NOT NULL DEFAULT '0',
+  `reflink` varchar(255) NOT NULL DEFAULT 'index',
+  `title` varchar(255) NOT NULL,
+  `content` mediumtext NOT NULL,
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  `group_id` int(11) DEFAULT NULL,
+  `dtime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `addlock` int(11) NOT NULL DEFAULT '1',
+  `editlock` int(11) NOT NULL DEFAULT '0',
+  `visibility` int(11) NOT NULL DEFAULT '1',
+  `addlock_disc` int(11) NOT NULL DEFAULT '1',
+  `visibility_disc` int(11) NOT NULL DEFAULT '1',
+  `ratinglock_disc` int(11) NOT NULL DEFAULT '1',
+  `assignment` int(11) NOT NULL DEFAULT '0',
+  `comment` text NOT NULL,
+  `progress` text NOT NULL,
+  `score` int(11) DEFAULT '0',
+  `version` int(11) DEFAULT NULL,
+  `is_editing` int(11) NOT NULL DEFAULT '0',
+  `time_edit` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `hits` int(11) DEFAULT '0',
+  `linksto` text NOT NULL,
+  `tag` text NOT NULL,
+  `user_ip` varchar(39) NOT NULL,
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `reflink` (`reflink`),
+  KEY `group_id` (`group_id`),
+  KEY `page_id` (`page_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `wiki_conf`
+--
+
+DROP TABLE IF EXISTS `wiki_conf`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `wiki_conf` (
+  `page_id` int(11) 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(11) DEFAULT NULL,
+  `max_text` int(11) DEFAULT NULL,
+  `max_version` int(11) 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(11) NOT NULL DEFAULT '0',
+  KEY `page_id` (`page_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `wiki_discuss`
+--
+
+DROP TABLE IF EXISTS `wiki_discuss`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `wiki_discuss` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `publication_id` int(11) NOT NULL DEFAULT '0',
+  `userc_id` int(11) 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`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `wiki_mailcue`
+--
+
+DROP TABLE IF EXISTS `wiki_mailcue`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `wiki_mailcue` (
+  `id` int(11) NOT NULL,
+  `user_id` int(11) NOT NULL,
+  `type` text NOT NULL,
+  `group_id` int(11) DEFAULT NULL,
+  KEY `id` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2013-03-27 11:30:20

+ 2420 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.8.7/db_main.sql

@@ -0,0 +1,2420 @@
+-- MySQL dump 10.9
+--
+-- Host: localhost    Database: chamilo_main
+-- ------------------------------------------------------
+-- Server version	4.1.14
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+
+--
+-- Table structure for table user
+--
+
+DROP TABLE IF EXISTS user;
+CREATE TABLE user (
+  user_id int unsigned NOT NULL auto_increment,
+  lastname varchar(60) default NULL,
+  firstname varchar(60) default NULL,
+  username varchar(20) NOT NULL default '',
+  password varchar(50) NOT NULL default '',
+  auth_source varchar(50) default 'platform',
+  email varchar(100) default NULL,
+  status tinyint NOT NULL default '5',
+  official_code varchar(40) default NULL,
+  phone varchar(30) default NULL,
+  picture_uri varchar(250) default NULL,
+  creator_id int unsigned default NULL,
+  competences text,
+  diplomas text,
+  openarea text,
+  teach text,
+  productions varchar(250) default NULL,
+  chatcall_user_id int unsigned NOT NULL default '0',
+  chatcall_date datetime NOT NULL default '0000-00-00 00:00:00',
+  chatcall_text varchar(50) NOT NULL default '',
+  language varchar(40) default NULL,
+  registration_date datetime NOT NULL default '0000-00-00 00:00:00',
+  expiration_date datetime NOT NULL default '0000-00-00 00:00:00',
+  active tinyint unsigned NOT NULL default 1,
+  openid varchar(255) DEFAULT NULL,
+  theme varchar(255) DEFAULT NULL,
+  hr_dept_id smallint unsigned NOT NULL default 0,
+  PRIMARY KEY  (user_id),
+  UNIQUE KEY username (username)
+);
+ALTER TABLE user ADD INDEX (status);
+
+--
+-- Dumping data for table user
+--
+
+/*!40000 ALTER TABLE user DISABLE KEYS */;
+LOCK TABLES user WRITE;
+INSERT INTO user (lastname, firstname, username, password, auth_source, email, status, official_code,phone, creator_id, registration_date, expiration_date,active,openid,language) VALUES ('{ADMINLASTNAME}','{ADMINFIRSTNAME}','{ADMINLOGIN}','{ADMINPASSWORD}','{PLATFORM_AUTH_SOURCE}','{ADMINEMAIL}',1,'ADMIN','{ADMINPHONE}',1,NOW(),'0000-00-00 00:00:00','1',NULL,'{ADMINLANGUAGE}');
+-- Insert anonymous user
+INSERT INTO user (lastname, firstname, username, password, auth_source, email, status, official_code, creator_id, registration_date, expiration_date,active,openid,language) VALUES ('Anonymous', 'Joe', '', '', 'platform', 'anonymous@localhost', 6, 'anonymous', 1, NOW(), '0000-00-00 00:00:00', 1,NULL,'{ADMINLANGUAGE}');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE user ENABLE KEYS */;
+
+--
+-- Table structure for table admin
+--
+
+DROP TABLE IF EXISTS admin;
+CREATE TABLE admin (
+  user_id int unsigned NOT NULL default '0',
+  UNIQUE KEY user_id (user_id)
+);
+
+--
+-- Dumping data for table admin
+--
+
+
+/*!40000 ALTER TABLE admin DISABLE KEYS */;
+LOCK TABLES admin WRITE;
+INSERT INTO admin VALUES (1);
+UNLOCK TABLES;
+/*!40000 ALTER TABLE admin ENABLE KEYS */;
+
+--
+-- Table structure for table class
+--
+
+DROP TABLE IF EXISTS class;
+CREATE TABLE class (
+  id mediumint unsigned NOT NULL auto_increment,
+  code varchar(40) default '',
+  name text NOT NULL,
+  PRIMARY KEY  (id)
+);
+
+--
+-- Dumping data for table class
+--
+
+
+/*!40000 ALTER TABLE class DISABLE KEYS */;
+LOCK TABLES class WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE class ENABLE KEYS */;
+
+--
+-- Table structure for table class_user
+--
+
+DROP TABLE IF EXISTS class_user;
+CREATE TABLE class_user (
+  class_id mediumint unsigned NOT NULL default '0',
+  user_id int unsigned NOT NULL default '0',
+  PRIMARY KEY  (class_id,user_id)
+);
+
+--
+-- Dumping data for table class_user
+--
+
+
+/*!40000 ALTER TABLE class_user DISABLE KEYS */;
+LOCK TABLES class_user WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE class_user ENABLE KEYS */;
+
+--
+-- Table structure for table course
+--
+
+DROP TABLE IF EXISTS course;
+CREATE TABLE course (
+  id int auto_increment,
+  code varchar(40) NOT NULL,
+  directory varchar(40) default NULL,
+  db_name varchar(40) default NULL,
+  course_language varchar(20) default NULL,
+  title varchar(250) default NULL,
+  description text,
+  category_code varchar(40) default NULL,
+  visibility tinyint default '0',
+  show_score int NOT NULL default '1',
+  tutor_name varchar(200) default NULL,
+  visual_code varchar(40) default NULL,
+  department_name varchar(30) default NULL,
+  department_url varchar(180) default NULL,
+  disk_quota int unsigned default NULL,
+  last_visit datetime default NULL,
+  last_edit datetime default NULL,
+  creation_date datetime default NULL,
+  expiration_date datetime default NULL,
+  target_course_code varchar(40) default NULL,
+  subscribe tinyint NOT NULL default '1',
+  unsubscribe tinyint NOT NULL default '1',
+  registration_code varchar(255) NOT NULL default '',
+  PRIMARY KEY (id),
+  UNIQUE KEY code (code)
+);
+
+--
+-- Dumping data for table course
+--
+
+
+/*!40000 ALTER TABLE course DISABLE KEYS */;
+LOCK TABLES course WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE course ENABLE KEYS */;
+
+--
+-- Table structure for table course_category
+--
+
+DROP TABLE IF EXISTS course_category;
+CREATE TABLE course_category (
+  id int unsigned NOT NULL auto_increment,
+  name varchar(100) NOT NULL default '',
+  code varchar(40) NOT NULL default '',
+  parent_id varchar(40) default NULL,
+  tree_pos int unsigned default NULL,
+  children_count smallint default NULL,
+  auth_course_child enum('TRUE','FALSE') default 'TRUE',
+  auth_cat_child enum('TRUE','FALSE') default 'TRUE',
+  PRIMARY KEY  (id),
+  UNIQUE KEY code (code),
+  KEY parent_id (parent_id),
+  KEY tree_pos (tree_pos)
+);
+
+--
+-- Dumping data for table course_category
+--
+
+
+/*!40000 ALTER TABLE course_category DISABLE KEYS */;
+LOCK TABLES course_category WRITE;
+INSERT INTO course_category VALUES (1,'Language skills','LANG',NULL,1,0,'TRUE','TRUE'),(2,'PC Skills','PC',NULL,2,0,'TRUE','TRUE'),(3,'Projects','PROJ',NULL,3,0,'TRUE','TRUE');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE course_category ENABLE KEYS */;
+
+--
+-- Table structure for table course_field
+--
+
+DROP TABLE IF EXISTS course_field;
+CREATE TABLE course_field (
+    id  int NOT NULL auto_increment,
+    field_type int NOT NULL default 1,
+    field_variable  varchar(64) NOT NULL,
+    field_display_text  varchar(64),
+    field_default_value text,
+    field_order int,
+    field_visible tinyint default 0,
+    field_changeable tinyint default 0,
+    field_filter tinyint default 0,
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+--
+-- Table structure for table course_field_values
+--
+
+DROP TABLE IF EXISTS course_field_values;
+CREATE TABLE course_field_values(
+    id  int NOT NULL auto_increment,
+    course_code varchar(40) NOT NULL,
+    field_id int NOT NULL,
+    field_value text,
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+
+--
+-- Table structure for table course_module
+--
+
+DROP TABLE IF EXISTS course_module;
+CREATE TABLE course_module (
+  id int unsigned NOT NULL auto_increment,
+  name varchar(255) NOT NULL,
+  link varchar(255) NOT NULL,
+  image varchar(100) default NULL,
+  `row` int unsigned NOT NULL default '0',
+  `column` int unsigned NOT NULL default '0',
+  position varchar(20) NOT NULL default 'basic',
+  PRIMARY KEY  (id)
+);
+
+--
+-- Dumping data for table course_module
+--
+
+
+/*!40000 ALTER TABLE course_module DISABLE KEYS */;
+LOCK TABLES course_module WRITE;
+INSERT INTO course_module VALUES
+(1,'calendar_event','calendar/agenda.php','agenda.gif',1,1,'basic'),
+(2,'link','link/link.php','links.gif',4,1,'basic'),
+(3,'document','document/document.php','documents.gif',3,1,'basic'),
+(4,'student_publication','work/work.php','works.gif',3,2,'basic'),
+(5,'announcement','announcements/announcements.php','valves.gif',2,1,'basic'),
+(6,'user','user/user.php','members.gif',2,3,'basic'),
+(7,'forum','forum/index.php','forum.gif',1,2,'basic'),
+(8,'quiz','exercice/exercice.php','quiz.gif',2,2,'basic'),
+(9,'group','group/group.php','group.gif',3,3,'basic'),
+(10,'course_description','course_description/','info.gif',1,3,'basic'),
+(11,'chat','chat/chat.php','chat.gif',0,0,'external'),
+(12,'dropbox','dropbox/index.php','dropbox.gif',4,2,'basic'),
+(13,'tracking','tracking/courseLog.php','statistics.gif',1,3,'courseadmin'),
+(14,'homepage_link','link/link.php?action=addlink','npage.gif',1,1,'courseadmin'),
+(15,'course_setting','course_info/infocours.php','reference.gif',1,1,'courseadmin'),
+(16,'External','','external.gif',0,0,'external'),
+(17,'AddedLearnpath','','scormbuilder.gif',0,0,'external'),
+(18,'conference','conference/index.php?type=conference','conf.gif',0,0,'external'),
+(19,'conference','conference/index.php?type=classroom','conf.gif',0,0,'external'),
+(20,'learnpath','newscorm/lp_controller.php','scorm.gif',5,1,'basic'),
+(21,'blog','blog/blog.php','blog.gif',1,2,'basic'),
+(22,'blog_management','blog/blog_admin.php','blog_admin.gif',1,2,'courseadmin'),
+(23,'course_maintenance','course_info/maintenance.php','backup.gif',2,3,'courseadmin'),
+(24,'survey','survey/survey_list.php','survey.gif',2,1,'basic'),
+(25,'wiki','wiki/index.php','wiki.gif',2,3,'basic'),
+(26,'gradebook','gradebook/index.php','gradebook.gif',2,2,'basic'),
+(27,'glossary','glossary/index.php','glossary.gif',2,1,'basic'),
+(28,'notebook','notebook/index.php','notebook.gif',2,1,'basic'),
+(29,'attendance','attendance/index.php','attendance.gif',2,1,'basic'),
+(30,'course_progress','course_progress/index.php','course_progress.gif',2,1,'basic');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE course_module ENABLE KEYS */;
+
+--
+-- Table structure for table course_rel_class
+--
+
+DROP TABLE IF EXISTS course_rel_class;
+CREATE TABLE course_rel_class (
+  course_code char(40) NOT NULL,
+  class_id mediumint unsigned NOT NULL,
+  PRIMARY KEY  (course_code,class_id)
+);
+
+--
+-- Dumping data for table course_rel_class
+--
+
+
+/*!40000 ALTER TABLE course_rel_class DISABLE KEYS */;
+LOCK TABLES course_rel_class WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE course_rel_class ENABLE KEYS */;
+
+--
+-- Table structure for table course_rel_user
+--
+
+DROP TABLE IF EXISTS course_rel_user;
+CREATE TABLE course_rel_user (
+  course_code varchar(40) NOT NULL,
+  user_id int unsigned NOT NULL default '0',
+  status tinyint NOT NULL default '5',
+  role varchar(60) default NULL,
+  group_id int NOT NULL default '0',
+  tutor_id int unsigned NOT NULL default '0',
+  sort int default NULL,
+  user_course_cat int default '0',
+  relation_type int default 0,
+  PRIMARY KEY  (course_code,user_id,relation_type)
+);
+ALTER TABLE course_rel_user ADD INDEX (user_id);
+
+--
+-- Dumping data for table course_rel_user
+--
+
+
+/*!40000 ALTER TABLE course_rel_user DISABLE KEYS */;
+LOCK TABLES course_rel_user WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE course_rel_user ENABLE KEYS */;
+
+--
+-- Table structure for table language
+--
+
+DROP TABLE IF EXISTS language;
+CREATE TABLE language (
+  id tinyint unsigned NOT NULL auto_increment,
+  original_name varchar(255) default NULL,
+  english_name varchar(255) default NULL,
+  isocode varchar(10) default NULL,
+  dokeos_folder varchar(250) default NULL,
+  available tinyint NOT NULL default 1,
+  parent_id tinyint unsigned,
+  PRIMARY KEY  (id)
+);
+ALTER TABLE language ADD INDEX idx_language_dokeos_folder(dokeos_folder);
+
+--
+-- Dumping data for table language
+--
+
+
+/*!40000 ALTER TABLE language DISABLE KEYS */;
+LOCK TABLES language WRITE;
+INSERT INTO language (original_name, english_name, isocode, dokeos_folder, available) VALUES
+('&#1575;&#1604;&#1593;&#1585;&#1576;&#1610;&#1577;','arabic','ar','arabic',0),
+('Asturianu','asturian','ast','asturian',0),
+('&#1041;&#1098;&#1083;&#1075;&#1072;&#1088;&#1089;&#1082;&#1080;','bulgarian','bg','bulgarian',1),
+('Bosanski','bosnian','bs','bosnian',1),
+('Catal&agrave;','catalan','ca','catalan',0),
+('&#20013;&#25991;&#65288;&#31616;&#20307;&#65289;','simpl_chinese','zh','simpl_chinese',0),
+('&#32321;&#39636;&#20013;&#25991;','trad_chinese','zh-TW','trad_chinese',0),
+('&#268;esky','czech','cs','czech',0),
+('Dansk','danish','da','danish',0),
+('&#1583;&#1585;&#1740;','dari','prs','dari',0),
+('Deutsch','german','de','german',1),
+('&Epsilon;&lambda;&lambda;&eta;&nu;&iota;&kappa;&#940;','greek','el','greek',0),
+('English','english','en','english',1),
+('Espa&ntilde;ol','spanish','es','spanish',1),
+('Esperanto','esperanto','eo','esperanto',0),
+('Euskara','euskera','eu','euskera',0),
+('&#1601;&#1575;&#1585;&#1587;&#1740;','persian','fa','persian',0),
+('Fran&ccedil;ais','french','fr','french',1),
+('Furlan','friulian','fur','friulian',0),
+('Galego','galician','gl','galician',0),
+('&#4325;&#4304;&#4320;&#4311;&#4323;&#4314;&#4312;','georgian','ka','georgian',0),
+('Hrvatski','croatian','hr','croatian',0),
+('&#1506;&#1489;&#1512;&#1497;&#1514;','hebrew','he','hebrew',0),
+('Bahasa Indonesia','indonesian','id','indonesian',1),
+('Italiano','italian','it','italian',1),
+('&#54620;&#44397;&#50612;','korean','ko','korean',0),
+('Latvie&scaron;u','latvian','lv','latvian',0),
+('Lietuvi&#371;','lithuanian','lt','lithuanian',0),
+('&#1052;&#1072;&#1082;&#1077;&#1076;&#1086;&#1085;&#1089;&#1082;&#1080;','macedonian','mk','macedonian',0),
+('Magyar','hungarian','hu','hungarian',1),
+('Bahasa Melayu','malay','ms','malay',0),
+('Nederlands','dutch','nl','dutch',1),
+('&#26085;&#26412;&#35486;','japanese','ja','japanese',0),
+('Norsk','norwegian','no','norwegian',0),
+('Occitan','occitan','oc','occitan',0),
+('&#1662;&#1690;&#1578;&#1608;','pashto','ps','pashto',0),
+('Polski','polish','pl','polish',0),
+('Portugu&ecirc;s europeu','portuguese','pt','portuguese',1),
+('Portugu&ecirc;s do Brasil','brazilian','pt-BR','brazilian',1),
+('Rom&acirc;n&#259;','romanian','ro','romanian',0),
+('Runasimi','quechua_cusco','qu','quechua_cusco',0),
+('&#1056;&#1091;&#1089;&#1089;&#1082;&#1080;&#1081;','russian','ru','russian',0),
+('Sloven&#269;ina','slovak','sk','slovak',0),
+('Sloven&scaron;&#269;ina','slovenian','sl','slovenian',1),
+('Srpski','serbian','sr','serbian',0),
+('Suomi','finnish','fi','finnish',0),
+('Svenska','swedish','sv','swedish',0),
+('&#3652;&#3607;&#3618;','thai','th','thai',0),
+('T&uuml;rk&ccedil;e','turkce','tr','turkce',0),
+('&#1059;&#1082;&#1088;&#1072;&#1111;&#1085;&#1089;&#1100;&#1082;&#1072;','ukrainian','uk','ukrainian',0),
+('Ti&#7871;ng Vi&#7879;t','vietnamese','vi','vietnamese',0),
+('Kiswahili','swahili','sw','swahili',0),
+('Yor&ugrave;b&aacute;','yoruba','yo','yoruba',0);
+
+-- The chosen during the installation platform language should be enabled.
+UPDATE language SET available=1 WHERE dokeos_folder = '{PLATFORMLANGUAGE}';
+
+UNLOCK TABLES;
+/*!40000 ALTER TABLE language ENABLE KEYS */;
+
+--
+-- Table structure for table php_session
+--
+
+DROP TABLE IF EXISTS php_session;
+CREATE TABLE php_session (
+  session_id varchar(32) NOT NULL default '',
+  session_name varchar(10) NOT NULL default '',
+  session_time int NOT NULL default '0',
+  session_start int NOT NULL default '0',
+  session_value mediumtext NOT NULL,
+  PRIMARY KEY  (session_id)
+);
+
+--
+-- Table structure for table session
+--
+DROP TABLE IF EXISTS session;
+CREATE TABLE session (
+  id smallint unsigned NOT NULL auto_increment,
+  id_coach int unsigned NOT NULL default '0',
+  name char(50) NOT NULL default '',
+  nbr_courses smallint unsigned NOT NULL default '0',
+  nbr_users mediumint unsigned NOT NULL default '0',
+  nbr_classes mediumint unsigned NOT NULL default '0',
+  date_start date NOT NULL default '0000-00-00',
+  date_end date NOT NULL default '0000-00-00',
+  nb_days_access_before_beginning TINYINT UNSIGNED NULL default '0',
+  nb_days_access_after_end TINYINT UNSIGNED NULL default '0',
+  session_admin_id INT UNSIGNED NOT NULL,
+  visibility int NOT NULL default 1,
+  session_category_id int NOT NULL,
+  PRIMARY KEY  (id),
+  INDEX (session_admin_id),
+  UNIQUE KEY name (name)
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table session_rel_course
+--
+DROP TABLE IF EXISTS session_rel_course;
+CREATE TABLE session_rel_course (
+  id_session smallint unsigned NOT NULL default '0',
+  course_code char(40) NOT NULL default '',
+  nbr_users smallint unsigned NOT NULL default '0',
+  PRIMARY KEY  (id_session,course_code),
+  KEY course_code (course_code)
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table session_rel_course_rel_user
+--
+DROP TABLE IF EXISTS session_rel_course_rel_user;
+CREATE TABLE session_rel_course_rel_user (
+  id_session smallint unsigned NOT NULL default '0',
+  course_code char(40) NOT NULL default '',
+  id_user int unsigned NOT NULL default '0',
+  visibility int NOT NULL default 1,
+  status int NOT NULL default 0,
+  PRIMARY KEY  (id_session,course_code,id_user),
+  KEY id_user (id_user),
+  KEY course_code (course_code)
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table session_rel_user
+--
+DROP TABLE IF EXISTS session_rel_user;
+CREATE TABLE session_rel_user (
+  id_session mediumint unsigned NOT NULL default '0',
+  id_user mediumint unsigned NOT NULL default '0',
+  relation_type int default 0,
+  PRIMARY KEY (id_session, id_user, relation_type)
+);
+
+
+DROP TABLE IF EXISTS session_field;
+CREATE TABLE session_field (
+    id  int NOT NULL auto_increment,
+    field_type int NOT NULL default 1,
+    field_variable  varchar(64) NOT NULL,
+    field_display_text  varchar(64),
+    field_default_value text,
+    field_order int,
+    field_visible tinyint default 0,
+    field_changeable tinyint default 0,
+    field_filter tinyint default 0,
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+DROP TABLE IF EXISTS session_field_values;
+CREATE TABLE session_field_values(
+    id  int NOT NULL auto_increment,
+    session_id int NOT NULL,
+    field_id int NOT NULL,
+    field_value text,
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+--
+-- Table structure for table settings_current
+--
+
+DROP TABLE IF EXISTS settings_current;
+CREATE TABLE settings_current (
+  id int unsigned NOT NULL auto_increment,
+  variable varchar(255) default NULL,
+  subkey varchar(255) default NULL,
+  type varchar(255) default NULL,
+  category varchar(255) default NULL,
+  selected_value varchar(255) default NULL,
+  title varchar(255) NOT NULL default '',
+  comment varchar(255) default NULL,
+  scope varchar(50) default NULL,
+  subkeytext varchar(255) default NULL,
+  access_url int unsigned not null default 1,
+  access_url_changeable int unsigned not null default 0,
+  PRIMARY KEY id (id),
+  INDEX (access_url)
+);
+
+ALTER TABLE settings_current ADD UNIQUE unique_setting ( variable , subkey , category, access_url) ;
+
+--
+-- Dumping data for table settings_current
+--
+
+/*!40000 ALTER TABLE settings_current DISABLE KEYS */;
+LOCK TABLES settings_current WRITE;
+INSERT INTO settings_current
+(variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable)
+VALUES
+('Institution',NULL,'textfield','Platform','{ORGANISATIONNAME}','InstitutionTitle','InstitutionComment','platform',NULL, 1),
+('InstitutionUrl',NULL,'textfield','Platform','{ORGANISATIONURL}','InstitutionUrlTitle','InstitutionUrlComment',NULL,NULL, 1),
+('siteName',NULL,'textfield','Platform','{CAMPUSNAME}','SiteNameTitle','SiteNameComment',NULL,NULL, 1),
+('emailAdministrator',NULL,'textfield','Platform','{ADMINEMAIL}','emailAdministratorTitle','emailAdministratorComment',NULL,NULL, 1),
+('administratorSurname',NULL,'textfield','Platform','{ADMINLASTNAME}','administratorSurnameTitle','administratorSurnameComment',NULL,NULL, 1),
+('administratorName',NULL,'textfield','Platform','{ADMINFIRSTNAME}','administratorNameTitle','administratorNameComment',NULL,NULL, 1),
+('show_administrator_data',NULL,'radio','Platform','true','ShowAdministratorDataTitle','ShowAdministratorDataComment',NULL,NULL, 1),
+('show_tutor_data',NULL,'radio','Platform','true','ShowTutorDataTitle','ShowTutorDataComment',NULL,NULL, 1),
+('show_teacher_data',NULL,'radio','Platform','true','ShowTeacherDataTitle','ShowTeacherDataComment',NULL,NULL, 1),
+('homepage_view',NULL,'radio','Course','activity','HomepageViewTitle','HomepageViewComment',NULL,NULL, 0),
+('show_toolshortcuts',NULL,'radio','Course','false','ShowToolShortcutsTitle','ShowToolShortcutsComment',NULL,NULL, 0),
+('allow_group_categories',NULL,'radio','Course','false','AllowGroupCategories','AllowGroupCategoriesComment',NULL,NULL, 0),
+('server_type',NULL,'radio','Platform','production','ServerStatusTitle','ServerStatusComment',NULL,NULL, 0),
+('platformLanguage',NULL,'link','Languages','{PLATFORMLANGUAGE}','PlatformLanguageTitle','PlatformLanguageComment',NULL,NULL, 0),
+('showonline','world','checkbox','Platform','true','ShowOnlineTitle','ShowOnlineComment',NULL,'ShowOnlineWorld', 0),
+('showonline','users','checkbox','Platform','true','ShowOnlineTitle','ShowOnlineComment',NULL,'ShowOnlineUsers', 0),
+('showonline','course','checkbox','Platform','true','ShowOnlineTitle','ShowOnlineComment',NULL,'ShowOnlineCourse', 0),
+('profile','name','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'name', 0),
+('profile','officialcode','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'officialcode', 0),
+('profile','email','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'Email', 0),
+('profile','picture','checkbox','User','true','ProfileChangesTitle','ProfileChangesComment',NULL,'UserPicture', 0),
+('profile','login','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'Login', 0),
+('profile','password','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'UserPassword', 0),
+('profile','language','checkbox','User','true','ProfileChangesTitle','ProfileChangesComment',NULL,'Language', 0),
+('default_document_quotum',NULL,'textfield','Course','50000000','DefaultDocumentQuotumTitle','DefaultDocumentQuotumComment',NULL,NULL, 0),
+('registration','officialcode','checkbox','User','false','RegistrationRequiredFormsTitle','RegistrationRequiredFormsComment',NULL,'OfficialCode', 0),
+('registration','email','checkbox','User','true','RegistrationRequiredFormsTitle','RegistrationRequiredFormsComment',NULL,'Email', 0),
+('registration','language','checkbox','User','true','RegistrationRequiredFormsTitle','RegistrationRequiredFormsComment',NULL,'Language', 0),
+('default_group_quotum',NULL,'textfield','Course','5000000','DefaultGroupQuotumTitle','DefaultGroupQuotumComment',NULL,NULL, 0),
+('allow_registration',NULL,'radio','Platform','{ALLOWSELFREGISTRATION}','AllowRegistrationTitle','AllowRegistrationComment',NULL,NULL, 0),
+('allow_registration_as_teacher',NULL,'radio','Platform','{ALLOWTEACHERSELFREGISTRATION}','AllowRegistrationAsTeacherTitle','AllowRegistrationAsTeacherComment',NULL,NULL, 0),
+('allow_lostpassword',NULL,'radio','Platform','true','AllowLostPasswordTitle','AllowLostPasswordComment',NULL,NULL, 0),
+('allow_user_headings',NULL,'radio','Course','false','AllowUserHeadings','AllowUserHeadingsComment',NULL,NULL, 0),
+('course_create_active_tools','course_description','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'CourseDescription', 0),
+('course_create_active_tools','agenda','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Agenda', 0),
+('course_create_active_tools','documents','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Documents', 0),
+('course_create_active_tools','learning_path','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'LearningPath', 0),
+('course_create_active_tools','links','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Links', 0),
+('course_create_active_tools','announcements','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Announcements', 0),
+('course_create_active_tools','forums','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Forums', 0),
+('course_create_active_tools','dropbox','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Dropbox', 0),
+('course_create_active_tools','quiz','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Quiz', 0),
+('course_create_active_tools','users','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Users', 0),
+('course_create_active_tools','groups','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Groups', 0),
+('course_create_active_tools','chat','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Chat', 0),
+('course_create_active_tools','online_conference','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'OnlineConference', 0),
+('course_create_active_tools','student_publications','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'StudentPublications', 0),
+('allow_personal_agenda',NULL,'radio','User','false','AllowPersonalAgendaTitle','AllowPersonalAgendaComment',NULL,NULL, 0),
+('display_coursecode_in_courselist',NULL,'radio','Platform','false','DisplayCourseCodeInCourselistTitle','DisplayCourseCodeInCourselistComment',NULL,NULL, 0),
+('display_teacher_in_courselist',NULL,'radio','Platform','true','DisplayTeacherInCourselistTitle','DisplayTeacherInCourselistComment',NULL,NULL, 0),
+('use_document_title',NULL,'radio','Tools','true','UseDocumentTitleTitle','UseDocumentTitleComment',NULL,NULL, 0),
+('permanently_remove_deleted_files',NULL,'radio','Tools','false','PermanentlyRemoveFilesTitle','PermanentlyRemoveFilesComment',NULL,NULL, 0),
+('dropbox_allow_overwrite',NULL,'radio','Tools','true','DropboxAllowOverwriteTitle','DropboxAllowOverwriteComment',NULL,NULL, 0),
+('dropbox_max_filesize',NULL,'textfield','Tools','100000000','DropboxMaxFilesizeTitle','DropboxMaxFilesizeComment',NULL,NULL, 0),
+('dropbox_allow_just_upload',NULL,'radio','Tools','true','DropboxAllowJustUploadTitle','DropboxAllowJustUploadComment',NULL,NULL, 0),
+('dropbox_allow_student_to_student',NULL,'radio','Tools','true','DropboxAllowStudentToStudentTitle','DropboxAllowStudentToStudentComment',NULL,NULL, 0),
+('dropbox_allow_group',NULL,'radio','Tools','true','DropboxAllowGroupTitle','DropboxAllowGroupComment',NULL,NULL, 0),
+('dropbox_allow_mailing',NULL,'radio','Tools','false','DropboxAllowMailingTitle','DropboxAllowMailingComment',NULL,NULL, 0),
+('administratorTelephone',NULL,'textfield','Platform','(000) 001 02 03','administratorTelephoneTitle','administratorTelephoneComment',NULL,NULL, 1),
+('extended_profile',NULL,'radio','User','true','ExtendedProfileTitle','ExtendedProfileComment',NULL,NULL, 0),
+('student_view_enabled',NULL,'radio','Platform','true','StudentViewEnabledTitle','StudentViewEnabledComment',NULL,NULL, 0),
+('show_navigation_menu',NULL,'radio','Course','false','ShowNavigationMenuTitle','ShowNavigationMenuComment',NULL,NULL, 0),
+('enable_tool_introduction',NULL,'radio','course','false','EnableToolIntroductionTitle','EnableToolIntroductionComment',NULL,NULL, 0),
+('page_after_login', NULL, 'radio','Platform','user_portal.php', 'PageAfterLoginTitle','PageAfterLoginComment', NULL, NULL, 0),
+('time_limit_whosonline', NULL, 'textfield','Platform','30', 'TimeLimitWhosonlineTitle','TimeLimitWhosonlineComment', NULL, NULL, 0),
+('breadcrumbs_course_homepage', NULL, 'radio','Course','course_title', 'BreadCrumbsCourseHomepageTitle','BreadCrumbsCourseHomepageComment', NULL, NULL, 0),
+('example_material_course_creation', NULL, 'radio','Platform','true', 'ExampleMaterialCourseCreationTitle','ExampleMaterialCourseCreationComment', NULL, NULL, 0),
+('account_valid_duration',NULL, 'textfield','Platform','3660', 'AccountValidDurationTitle','AccountValidDurationComment', NULL, NULL, 0),
+('use_session_mode', NULL, 'radio','Platform','true', 'UseSessionModeTitle','UseSessionModeComment', NULL, NULL, 0),
+('allow_email_editor', NULL, 'radio', 'Tools', 'false', 'AllowEmailEditorTitle', 'AllowEmailEditorComment', NULL, NULL, 0),
+('registered', NULL, 'textfield', NULL, 'false', NULL, NULL, NULL, NULL, 0),
+('donotlistcampus', NULL, 'textfield', NULL, 'false', NULL, NULL, NULL, NULL,0 ),
+('show_email_addresses', NULL,'radio','Platform','false','ShowEmailAddresses','ShowEmailAddressesComment',NULL,NULL, 1),
+('profile','phone','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'phone', 0),
+('service_visio', 'active', 'radio',NULL,'false', 'VisioEnable','', NULL, NULL, 0),
+('service_visio', 'visio_host', 'textfield',NULL,'', 'VisioHost','', NULL, NULL, 0),
+('service_visio', 'visio_port', 'textfield',NULL,'1935', 'VisioPort','', NULL, NULL, 0),
+('service_visio', 'visio_pass', 'textfield',NULL,'', 'VisioPassword','', NULL, NULL, 0),
+('service_ppt2lp', 'active', 'radio',NULL,'false', 'ppt2lp_actived','', NULL, NULL, 0),
+('service_ppt2lp', 'host', 'textfield', NULL, NULL, 'Host', NULL, NULL, NULL, 0),
+('service_ppt2lp', 'port', 'textfield', NULL, 2002, 'Port', NULL, NULL, NULL, 0),
+('service_ppt2lp', 'user', 'textfield', NULL, NULL, 'UserOnHost', NULL, NULL, NULL, 0),
+('service_ppt2lp', 'ftp_password', 'textfield', NULL, NULL, 'FtpPassword', NULL, NULL, NULL, 0),
+('service_ppt2lp', 'path_to_lzx', 'textfield', NULL, NULL, '', NULL, NULL, NULL, 0),
+('service_ppt2lp', 'size', 'radio', NULL, '720x540', '', NULL, NULL, NULL, 0),
+('wcag_anysurfer_public_pages', NULL, 'radio','Editor','false','PublicPagesComplyToWAITitle','PublicPagesComplyToWAIComment', NULL, NULL, 0),
+('stylesheets', NULL, 'textfield','stylesheets','chamilo','',NULL, NULL, NULL, 1),
+('upload_extensions_list_type', NULL, 'radio', 'Security', 'blacklist', 'UploadExtensionsListType', 'UploadExtensionsListTypeComment', NULL, NULL, 0),
+('upload_extensions_blacklist', NULL, 'textfield', 'Security', '', 'UploadExtensionsBlacklist', 'UploadExtensionsBlacklistComment', NULL, NULL, 0),
+('upload_extensions_whitelist', NULL, 'textfield', 'Security', 'htm;html;jpg;jpeg;gif;png;swf;avi;mpg;mpeg;mov;flv;doc;docx;xls;xlsx;ppt;pptx;odt;odp;ods;pdf', 'UploadExtensionsWhitelist', 'UploadExtensionsWhitelistComment', NULL, NULL, 0),
+('upload_extensions_skip', NULL, 'radio', 'Security', 'true', 'UploadExtensionsSkip', 'UploadExtensionsSkipComment', NULL, NULL, 0),
+('upload_extensions_replace_by', NULL, 'textfield', 'Security', 'dangerous', 'UploadExtensionsReplaceBy', 'UploadExtensionsReplaceByComment', NULL, NULL, 0),
+('show_number_of_courses', NULL, 'radio','Platform','false', 'ShowNumberOfCourses','ShowNumberOfCoursesComment', NULL, NULL, 0),
+('show_empty_course_categories', NULL, 'radio','Platform','true', 'ShowEmptyCourseCategories','ShowEmptyCourseCategoriesComment', NULL, NULL, 0),
+('show_back_link_on_top_of_tree', NULL, 'radio','Platform','false', 'ShowBackLinkOnTopOfCourseTree','ShowBackLinkOnTopOfCourseTreeComment', NULL, NULL, 0),
+('show_different_course_language', NULL, 'radio','Platform','true', 'ShowDifferentCourseLanguage','ShowDifferentCourseLanguageComment', NULL, NULL, 1),
+('split_users_upload_directory', NULL, 'radio','Tuning','false', 'SplitUsersUploadDirectory','SplitUsersUploadDirectoryComment', NULL, NULL, 0),
+('hide_dltt_markup', NULL, 'radio','Languages','true', 'HideDLTTMarkup','HideDLTTMarkupComment', NULL, NULL, 0),
+('display_categories_on_homepage',NULL,'radio','Platform','false','DisplayCategoriesOnHomepageTitle','DisplayCategoriesOnHomepageComment',NULL,NULL, 1),
+('permissions_for_new_directories', NULL, 'textfield', 'Security', '0777', 'PermissionsForNewDirs', 'PermissionsForNewDirsComment', NULL, NULL, 0),
+('permissions_for_new_files', NULL, 'textfield', 'Security', '0666', 'PermissionsForNewFiles', 'PermissionsForNewFilesComment', NULL, NULL, 0),
+('show_tabs', 'campus_homepage', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsCampusHomepage', 1),
+('show_tabs', 'my_courses', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsMyCourses', 1),
+('show_tabs', 'reporting', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsReporting', 1),
+('show_tabs', 'platform_administration', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsPlatformAdministration', 1),
+('show_tabs', 'my_agenda', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsMyAgenda', 1),
+('show_tabs', 'my_profile', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsMyProfile', 1),
+('default_forum_view', NULL, 'radio', 'Course', 'flat', 'DefaultForumViewTitle','DefaultForumViewComment',NULL,NULL, 0),
+('platform_charset',NULL,'textfield','Languages','UTF-8','PlatformCharsetTitle','PlatformCharsetComment','platform',NULL, 0),
+('noreply_email_address', '', 'textfield', 'Platform', '', 'NoReplyEmailAddress', 'NoReplyEmailAddressComment', NULL, NULL, 0),
+('survey_email_sender_noreply', '', 'radio', 'Course', 'coach', 'SurveyEmailSenderNoReply', 'SurveyEmailSenderNoReplyComment', NULL, NULL, 0),
+('openid_authentication',NULL,'radio','Security','false','OpenIdAuthentication','OpenIdAuthenticationComment',NULL,NULL, 0),
+('profile','openid','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'OpenIDURL', 0),
+('gradebook_enable',NULL,'radio','Gradebook','false','GradebookActivation','GradebookActivationComment',NULL,NULL, 0),
+('show_tabs','my_gradebook','checkbox','Platform','true','ShowTabsTitle','ShowTabsComment',NULL,'TabsMyGradebook', 1),
+('gradebook_score_display_coloring','my_display_coloring','checkbox','Gradebook','false','GradebookScoreDisplayColoring','GradebookScoreDisplayColoringComment',NULL,'TabsGradebookEnableColoring', 0),
+('gradebook_score_display_custom','my_display_custom','checkbox','Gradebook','false','GradebookScoreDisplayCustom','GradebookScoreDisplayCustomComment',NULL,'TabsGradebookEnableCustom', 0),
+('gradebook_score_display_colorsplit',NULL,'textfield','Gradebook','50','GradebookScoreDisplayColorSplit','GradebookScoreDisplayColorSplitComment',NULL,NULL, 0),
+('gradebook_score_display_upperlimit','my_display_upperlimit','checkbox','Gradebook','false','GradebookScoreDisplayUpperLimit','GradebookScoreDisplayUpperLimitComment',NULL,'TabsGradebookEnableUpperLimit', 0),
+('gradebook_number_decimals', NULL, 'select', 'Gradebook', '0', 'GradebookNumberDecimals', 'GradebookNumberDecimalsComment', NULL, NULL, 0),
+('user_selected_theme',NULL,'radio','Platform','false','UserThemeSelection','UserThemeSelectionComment',NULL,NULL, 0),
+('profile','theme','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'UserTheme', 0),
+('allow_course_theme',NULL,'radio','Course','true','AllowCourseThemeTitle','AllowCourseThemeComment',NULL,NULL, 0),
+('display_mini_month_calendar',NULL,'radio','Tools', 'true', 'DisplayMiniMonthCalendarTitle', 'DisplayMiniMonthCalendarComment', NULL, NULL, 0),
+('display_upcoming_events',NULL,'radio','Tools','true','DisplayUpcomingEventsTitle','DisplayUpcomingEventsComment',NULL,NULL, 0),
+('number_of_upcoming_events',NULL,'textfield','Tools','1','NumberOfUpcomingEventsTitle','NumberOfUpcomingEventsComment',NULL,NULL, 0),
+('show_closed_courses',NULL,'radio','Platform','false','ShowClosedCoursesTitle','ShowClosedCoursesComment',NULL,NULL, 0),
+('ldap_main_server_address', NULL, 'textfield', 'LDAP', 'localhost', 'LDAPMainServerAddressTitle', 'LDAPMainServerAddressComment', NULL, NULL, 0),
+('ldap_main_server_port', NULL, 'textfield', 'LDAP', '389', 'LDAPMainServerPortTitle', 'LDAPMainServerPortComment', NULL, NULL, 0),
+('ldap_domain', NULL, 'textfield', 'LDAP', 'dc=nodomain', 'LDAPDomainTitle', 'LDAPDomainComment', NULL, NULL, 0),
+('ldap_replicate_server_address', NULL, 'textfield', 'LDAP', 'localhost', 'LDAPReplicateServerAddressTitle', 'LDAPReplicateServerAddressComment', NULL, NULL, 0),
+('ldap_replicate_server_port', NULL, 'textfield', 'LDAP', '389', 'LDAPReplicateServerPortTitle', 'LDAPReplicateServerPortComment', NULL, NULL, 0),
+('ldap_search_term', NULL, 'textfield', 'LDAP', '', 'LDAPSearchTermTitle', 'LDAPSearchTermComment', NULL, NULL, 0),
+('ldap_version', NULL, 'radio', 'LDAP', '3', 'LDAPVersionTitle', 'LDAPVersionComment', NULL, '', 0),
+('ldap_filled_tutor_field', NULL, 'textfield', 'LDAP', 'employeenumber', 'LDAPFilledTutorFieldTitle', 'LDAPFilledTutorFieldComment', NULL, '', 0),
+('ldap_authentication_login', NULL, 'textfield', 'LDAP', '', 'LDAPAuthenticationLoginTitle', 'LDAPAuthenticationLoginComment', NULL, '', 0),
+('ldap_authentication_password', NULL, 'textfield', 'LDAP', '', 'LDAPAuthenticationPasswordTitle', 'LDAPAuthenticationPasswordComment', NULL, '', 0),
+('service_visio', 'visio_use_rtmpt', 'radio',null,'false', 'VisioUseRtmptTitle','VisioUseRtmptComment', NULL, NULL, 0),
+('extendedprofile_registration', 'mycomptetences', 'checkbox','User','false', 'ExtendedProfileRegistrationTitle','ExtendedProfileRegistrationComment', NULL, 'MyCompetences', 0),
+('extendedprofile_registration', 'mydiplomas', 'checkbox','User','false', 'ExtendedProfileRegistrationTitle','ExtendedProfileRegistrationComment', NULL, 'MyDiplomas', 0),
+('extendedprofile_registration', 'myteach', 'checkbox','User','false', 'ExtendedProfileRegistrationTitle','ExtendedProfileRegistrationComment', NULL, 'MyTeach', 0),
+('extendedprofile_registration', 'mypersonalopenarea', 'checkbox','User','false', 'ExtendedProfileRegistrationTitle','ExtendedProfileRegistrationComment', NULL, 'MyPersonalOpenArea', 0),
+('extendedprofile_registrationrequired', 'mycomptetences', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyCompetences', 0),
+('extendedprofile_registrationrequired', 'mydiplomas', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyDiplomas', 0),
+('extendedprofile_registrationrequired', 'myteach', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyTeach', 0),
+('extendedprofile_registrationrequired', 'mypersonalopenarea', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyPersonalOpenArea', 0),
+('ldap_filled_tutor_field_value', NULL, 'textfield', 'LDAP', '', 'LDAPFilledTutorFieldValueTitle', 'LDAPFilledTutorFieldValueComment', NULL, '', 0),
+('registration','phone','textfield','User','false','RegistrationRequiredFormsTitle','RegistrationRequiredFormsComment',NULL,'Phone', 0),
+('add_users_by_coach',NULL,'radio','Security','false','AddUsersByCoachTitle','AddUsersByCoachComment',NULL,NULL, 0),
+('extend_rights_for_coach',NULL,'radio','Security','false','ExtendRightsForCoachTitle','ExtendRightsForCoachComment',NULL,NULL, 0),
+('extend_rights_for_coach_on_survey',NULL,'radio','Security','true','ExtendRightsForCoachOnSurveyTitle','ExtendRightsForCoachOnSurveyComment',NULL,NULL, 0),
+('course_create_active_tools','wiki','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Wiki', 0),
+('show_session_coach', NULL, 'radio','Platform','false', 'ShowSessionCoachTitle','ShowSessionCoachComment', NULL, NULL, 0),
+('course_create_active_tools','gradebook','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Gradebook', 0),
+('allow_users_to_create_courses',NULL,'radio','Platform','true','AllowUsersToCreateCoursesTitle','AllowUsersToCreateCoursesComment',NULL,NULL, 0),
+('course_create_active_tools','survey','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Survey', 0),
+('course_create_active_tools','glossary','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Glossary', 0),
+('course_create_active_tools','notebook','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Notebook', 0),
+('course_create_active_tools','attendances','checkbox','Tools','false','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Attendances', 0),
+('course_create_active_tools','course_progress','checkbox','Tools','false','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'CourseProgress', 0),
+('advanced_filemanager',NULL,'radio','Editor','false','AdvancedFileManagerTitle','AdvancedFileManagerComment',NULL,NULL, 0),
+('allow_reservation', NULL, 'radio', 'Tools', 'false', 'AllowReservationTitle', 'AllowReservationComment', NULL, NULL, 0),
+('profile','apikeys','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'ApiKeys', 0),
+('allow_message_tool', NULL, 'radio', 'Tools', 'true', 'AllowMessageToolTitle', 'AllowMessageToolComment', NULL, NULL,0),
+('allow_social_tool', NULL, 'radio', 'Tools', 'true', 'AllowSocialToolTitle', 'AllowSocialToolComment', NULL, NULL, 0),
+('allow_students_to_browse_courses',NULL,'radio','Platform','true','AllowStudentsToBrowseCoursesTitle','AllowStudentsToBrowseCoursesComment',NULL,NULL, 1),
+('show_session_data', NULL, 'radio', 'Course', 'false', 'ShowSessionDataTitle', 'ShowSessionDataComment', NULL, NULL, 1),
+('allow_use_sub_language', NULL, 'radio', 'Languages', 'false', 'AllowUseSubLanguageTitle', 'AllowUseSubLanguageComment', NULL, NULL,0),
+('show_glossary_in_documents', NULL, 'radio', 'Course', 'none', 'ShowGlossaryInDocumentsTitle', 'ShowGlossaryInDocumentsComment', NULL, NULL,1),
+('allow_terms_conditions', NULL, 'radio', 'Platform', 'false', 'AllowTermsAndConditionsTitle', 'AllowTermsAndConditionsComment', NULL, NULL,0),
+('course_create_active_tools','enable_search','checkbox','Tools','false','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Search',0),
+('search_enabled',NULL,'radio','Tools','false','EnableSearchTitle','EnableSearchComment',NULL,NULL,1),
+('search_prefilter_prefix',NULL, NULL,'Search','','SearchPrefilterPrefix','SearchPrefilterPrefixComment',NULL,NULL,0),
+('search_show_unlinked_results',NULL,'radio','Search','true','SearchShowUnlinkedResultsTitle','SearchShowUnlinkedResultsComment',NULL,NULL,1),
+('show_courses_descriptions_in_catalog', NULL, 'radio', 'Course', 'true', 'ShowCoursesDescriptionsInCatalogTitle', 'ShowCoursesDescriptionsInCatalogComment', NULL, NULL, 1),
+('allow_coach_to_edit_course_session',NULL,'radio','Course','true','AllowCoachsToEditInsideTrainingSessions','AllowCoachsToEditInsideTrainingSessionsComment',NULL,NULL, 0),
+('show_glossary_in_extra_tools', NULL, 'radio', 'Course', 'false', 'ShowGlossaryInExtraToolsTitle', 'ShowGlossaryInExtraToolsComment', NULL, NULL,1),
+('send_email_to_admin_when_create_course',NULL,'radio','Platform','false','SendEmailToAdminTitle','SendEmailToAdminComment',NULL,NULL, 1),
+('go_to_course_after_login',NULL,'radio','Course','false','GoToCourseAfterLoginTitle','GoToCourseAfterLoginComment',NULL,NULL, 0),
+('math_mimetex',NULL,'radio','Editor','false','MathMimetexTitle','MathMimetexComment',NULL,NULL, 0),
+('math_asciimathML',NULL,'radio','Editor','false','MathASCIImathMLTitle','MathASCIImathMLComment',NULL,NULL, 0),
+('youtube_for_students',NULL,'radio','Editor','true','YoutubeForStudentsTitle','YoutubeForStudentsComment',NULL,NULL, 0),
+('block_copy_paste_for_students',NULL,'radio','Editor','false','BlockCopyPasteForStudentsTitle','BlockCopyPasteForStudentsComment',NULL,NULL, 0),
+('more_buttons_maximized_mode',NULL,'radio','Editor','false','MoreButtonsForMaximizedModeTitle','MoreButtonsForMaximizedModeComment',NULL,NULL, 0),
+('students_download_folders',NULL,'radio','Tools','true','AllowStudentsDownloadFoldersTitle','AllowStudentsDownloadFoldersComment',NULL,NULL, 0),
+('show_tabs', 'social', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsSocial', 0),
+('allow_students_to_create_groups_in_social',NULL,'radio','Tools','false','AllowStudentsToCreateGroupsInSocialTitle','AllowStudentsToCreateGroupsInSocialComment',NULL,NULL, 0),
+('allow_send_message_to_all_platform_users',NULL,'radio','Tools','false','AllowSendMessageToAllPlatformUsersTitle','AllowSendMessageToAllPlatformUsersComment',NULL,NULL, 0),
+('message_max_upload_filesize',NULL,'textfield','Tools','20971520','MessageMaxUploadFilesizeTitle','MessageMaxUploadFilesizeComment',NULL,NULL, 0),
+('show_tabs', 'dashboard', 'checkbox', 'Platform', 'true', 'ShowTabsTitle', 'ShowTabsComment', NULL, 'TabsDashboard', 1),
+('use_users_timezone', 'timezones', 'radio', 'Timezones', 'true', 'UseUsersTimezoneTitle','UseUsersTimezoneComment',NULL,'Timezones', 1),
+('timezone_value', 'timezones', 'select', 'Timezones', '', 'TimezoneValueTitle','TimezoneValueComment',NULL,'Timezones', 1),
+('allow_user_course_subscription_by_course_admin', NULL, 'radio', 'Security', 'true', 'AllowUserCourseSubscriptionByCourseAdminTitle', 'AllowUserCourseSubscriptionByCourseAdminComment', NULL, NULL, 1),
+('show_link_bug_notification', NULL, 'radio', 'Platform', 'true', 'ShowLinkBugNotificationTitle', 'ShowLinkBugNotificationComment', NULL, NULL, 0),
+('dokeos_database_version', NULL, 'textfield', NULL,'1.8.7.11571','DokeosDatabaseVersion','',NULL,NULL,0);
+
+
+UNLOCK TABLES;
+/*!40000 ALTER TABLE settings_current ENABLE KEYS */;
+
+--
+-- Table structure for table settings_options
+--
+
+DROP TABLE IF EXISTS settings_options;
+CREATE TABLE settings_options (
+  id int unsigned NOT NULL auto_increment,
+  variable varchar(255) default NULL,
+  value varchar(255) default NULL,
+  display_text varchar(255) NOT NULL default '',
+  PRIMARY KEY  (id),
+  UNIQUE KEY id (id)
+);
+
+ALTER TABLE settings_options ADD UNIQUE unique_setting_option (variable , value) ;
+
+--
+-- Dumping data for table settings_options
+--
+
+
+/*!40000 ALTER TABLE settings_options DISABLE KEYS */;
+LOCK TABLES settings_options WRITE;
+INSERT INTO settings_options
+(variable, value, display_text)
+VALUES
+('show_administrator_data','true','Yes'),
+('show_administrator_data','false','No'),
+('show_tutor_data','true','Yes'),
+('show_tutor_data','false','No'),
+('show_teacher_data','true','Yes'),
+('show_teacher_data','false','No'),
+('homepage_view','activity','HomepageViewActivity'),
+('homepage_view','2column','HomepageView2column'),
+('homepage_view','3column','HomepageView3column'),
+('homepage_view','vertical_activity','HomepageViewVerticalActivity'),
+('show_toolshortcuts','true','Yes'),
+('show_toolshortcuts','false','No'),
+('allow_group_categories','true','Yes'),
+('allow_group_categories','false','No'),
+('server_type','production','ProductionServer'),
+('server_type','test','TestServer'),
+('allow_name_change','true','Yes'),
+('allow_name_change','false','No'),
+('allow_officialcode_change','true','Yes'),
+('allow_officialcode_change','false','No'),
+('allow_registration','true','Yes'),
+('allow_registration','false','No'),
+('allow_registration','approval','AfterApproval'),
+('allow_registration_as_teacher','true','Yes'),
+('allow_registration_as_teacher','false','No'),
+('allow_lostpassword','true','Yes'),
+('allow_lostpassword','false','No'),
+('allow_user_headings','true','Yes'),
+('allow_user_headings','false','No'),
+('allow_personal_agenda','true','Yes'),
+('allow_personal_agenda','false','No'),
+('display_coursecode_in_courselist','true','Yes'),
+('display_coursecode_in_courselist','false','No'),
+('display_teacher_in_courselist','true','Yes'),
+('display_teacher_in_courselist','false','No'),
+('use_document_title','true','Yes'),
+('use_document_title','false','No'),
+('permanently_remove_deleted_files','true','YesWillDeletePermanently'),
+('permanently_remove_deleted_files','false','NoWillDeletePermanently'),
+('dropbox_allow_overwrite','true','Yes'),
+('dropbox_allow_overwrite','false','No'),
+('dropbox_allow_just_upload','true','Yes'),
+('dropbox_allow_just_upload','false','No'),
+('dropbox_allow_student_to_student','true','Yes'),
+('dropbox_allow_student_to_student','false','No'),
+('dropbox_allow_group','true','Yes'),
+('dropbox_allow_group','false','No'),
+('dropbox_allow_mailing','true','Yes'),
+('dropbox_allow_mailing','false','No'),
+('extended_profile','true','Yes'),
+('extended_profile','false','No'),
+('student_view_enabled','true','Yes'),
+('student_view_enabled','false','No'),
+('show_navigation_menu','false','No'),
+('show_navigation_menu','icons','IconsOnly'),
+('show_navigation_menu','text','TextOnly'),
+('show_navigation_menu','iconstext','IconsText'),
+('enable_tool_introduction','true','Yes'),
+('enable_tool_introduction','false','No'),
+('page_after_login', 'index.php', 'CampusHomepage'),
+('page_after_login', 'user_portal.php', 'MyCourses'),
+('breadcrumbs_course_homepage', 'get_lang', 'CourseHomepage'),
+('breadcrumbs_course_homepage', 'course_code', 'CourseCode'),
+('breadcrumbs_course_homepage', 'course_title', 'CourseTitle'),
+('example_material_course_creation', 'true', 'Yes'),
+('example_material_course_creation', 'false', 'No'),
+('use_session_mode', 'true', 'Yes'),
+('use_session_mode', 'false', 'No'),
+('allow_email_editor', 'true' ,'Yes'),
+('allow_email_editor', 'false', 'No'),
+('show_email_addresses','true','Yes'),
+('show_email_addresses','false','No'),
+('wcag_anysurfer_public_pages', 'true', 'Yes'),
+('wcag_anysurfer_public_pages', 'false', 'No'),
+('upload_extensions_list_type', 'blacklist', 'Blacklist'),
+('upload_extensions_list_type', 'whitelist', 'Whitelist'),
+('upload_extensions_skip', 'true', 'Remove'),
+('upload_extensions_skip', 'false', 'Rename'),
+('show_number_of_courses', 'true', 'Yes'),
+('show_number_of_courses', 'false', 'No'),
+('show_empty_course_categories', 'true', 'Yes'),
+('show_empty_course_categories', 'false', 'No'),
+('show_back_link_on_top_of_tree', 'true', 'Yes'),
+('show_back_link_on_top_of_tree', 'false', 'No'),
+('show_different_course_language', 'true', 'Yes'),
+('show_different_course_language', 'false', 'No'),
+('split_users_upload_directory', 'true', 'Yes'),
+('split_users_upload_directory', 'false', 'No'),
+('hide_dltt_markup', 'false', 'No'),
+('hide_dltt_markup', 'true', 'Yes'),
+('display_categories_on_homepage','true','Yes'),
+('display_categories_on_homepage','false','No'),
+('default_forum_view', 'flat', 'Flat'),
+('default_forum_view', 'threaded', 'Threaded'),
+('default_forum_view', 'nested', 'Nested'),
+('survey_email_sender_noreply', 'coach', 'CourseCoachEmailSender'),
+('survey_email_sender_noreply', 'noreply', 'NoReplyEmailSender'),
+('openid_authentication','true','Yes'),
+('openid_authentication','false','No'),
+('gradebook_enable','true','Yes'),
+('gradebook_enable','false','No'),
+('user_selected_theme','true','Yes'),
+('user_selected_theme','false','No'),
+('allow_course_theme','true','Yes'),
+('allow_course_theme','false','No'),
+('display_mini_month_calendar', 'true', 'Yes'),
+('display_mini_month_calendar', 'false', 'No'),
+('display_upcoming_events', 'true', 'Yes'),
+('display_upcoming_events', 'false', 'No'),
+('show_closed_courses', 'true', 'Yes'),
+('show_closed_courses', 'false', 'No'),
+('ldap_version', '2', 'LDAPVersion2'),
+('ldap_version', '3', 'LDAPVersion3'),
+('visio_use_rtmpt','true','Yes'),
+('visio_use_rtmpt','false','No'),
+('add_users_by_coach', 'true', 'Yes'),
+('add_users_by_coach', 'false', 'No'),
+('extend_rights_for_coach', 'true', 'Yes'),
+('extend_rights_for_coach', 'false', 'No'),
+('extend_rights_for_coach_on_survey', 'true', 'Yes'),
+('extend_rights_for_coach_on_survey', 'false', 'No'),
+('show_session_coach', 'true', 'Yes'),
+('show_session_coach', 'false', 'No'),
+('allow_users_to_create_courses','true','Yes'),
+('allow_users_to_create_courses','false','No'),
+('breadcrumbs_course_homepage', 'session_name_and_course_title', 'SessionNameAndCourseTitle'),
+('advanced_filemanager','true','Yes'),
+('advanced_filemanager','false','No'),
+('allow_reservation', 'true', 'Yes'),
+('allow_reservation', 'false', 'No'),
+('allow_message_tool', 'true', 'Yes'),
+('allow_message_tool', 'false', 'No'),
+('allow_social_tool', 'true', 'Yes'),
+('allow_social_tool', 'false', 'No'),
+('allow_students_to_browse_courses','true','Yes'),
+('allow_students_to_browse_courses','false','No'),
+('show_email_of_teacher_or_tutor ', 'true', 'Yes'),
+('show_email_of_teacher_or_tutor ', 'false', 'No'),
+('show_session_data ', 'true', 'Yes'),
+('show_session_data ', 'false', 'No'),
+('allow_use_sub_language', 'true', 'Yes'),
+('allow_use_sub_language', 'false', 'No'),
+('show_glossary_in_documents', 'none', 'ShowGlossaryInDocumentsIsNone'),
+('show_glossary_in_documents', 'ismanual', 'ShowGlossaryInDocumentsIsManual'),
+('show_glossary_in_documents', 'isautomatic', 'ShowGlossaryInDocumentsIsAutomatic'),
+('allow_terms_conditions', 'true', 'Yes'),
+('allow_terms_conditions', 'false', 'No'),
+('search_enabled', 'true', 'Yes'),
+('search_enabled', 'false', 'No'),
+('search_show_unlinked_results', 'true', 'SearchShowUnlinkedResults'),
+('search_show_unlinked_results', 'false', 'SearchHideUnlinkedResults'),
+('show_courses_descriptions_in_catalog', 'true', 'Yes'),
+('show_courses_descriptions_in_catalog', 'false', 'No'),
+('allow_coach_to_edit_course_session','true','Yes'),
+('allow_coach_to_edit_course_session','false','No'),
+('show_glossary_in_extra_tools', 'true', 'Yes'),
+('show_glossary_in_extra_tools', 'false', 'No'),
+('send_email_to_admin_when_create_course','true','Yes'),
+('send_email_to_admin_when_create_course','false','No'),
+('go_to_course_after_login','true','Yes'),
+('go_to_course_after_login','false','No'),
+('math_mimetex','true','Yes'),
+('math_mimetex','false','No'),
+('math_asciimathML','true','Yes'),
+('math_asciimathML','false','No'),
+('youtube_for_students','true','Yes'),
+('youtube_for_students','false','No'),
+('block_copy_paste_for_students','true','Yes'),
+('block_copy_paste_for_students','false','No'),
+('more_buttons_maximized_mode','true','Yes'),
+('more_buttons_maximized_mode','false','No'),
+('students_download_folders','true','Yes'),
+('students_download_folders','false','No'),
+('allow_students_to_create_groups_in_social','true','Yes'),
+('allow_students_to_create_groups_in_social','false','No'),
+('allow_send_message_to_all_platform_users','true','Yes'),
+('allow_send_message_to_all_platform_users','false','No'),
+('use_users_timezone', 'true', 'Yes'),
+('use_users_timezone', 'false', 'No'),
+('allow_user_course_subscription_by_course_admin', 'true', 'Yes'),
+('allow_user_course_subscription_by_course_admin', 'false', 'No'),
+('show_link_bug_notification', 'true', 'Yes'),
+('show_link_bug_notification', 'false', 'No');
+
+UNLOCK TABLES;
+
+/*!40000 ALTER TABLE settings_options ENABLE KEYS */;
+
+--
+-- Table structure for table sys_announcement
+--
+
+DROP TABLE IF EXISTS sys_announcement;
+CREATE TABLE sys_announcement (
+  id int unsigned NOT NULL auto_increment,
+  date_start datetime NOT NULL default '0000-00-00 00:00:00',
+  date_end datetime NOT NULL default '0000-00-00 00:00:00',
+  visible_teacher tinyint NOT NULL default 0,
+  visible_student tinyint NOT NULL default 0,
+  visible_guest tinyint NOT NULL default 0,
+  title varchar(250) NOT NULL default '',
+  content text NOT NULL,
+  lang varchar(70) NULL default NULL,
+  PRIMARY KEY  (id)
+);
+
+--
+-- Dumping data for table sys_announcement
+--
+
+
+/*!40000 ALTER TABLE sys_announcement DISABLE KEYS */;
+LOCK TABLES sys_announcement WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE sys_announcement ENABLE KEYS */;
+
+--
+-- Table structure for shared_survey
+--
+
+DROP TABLE IF EXISTS shared_survey;
+CREATE TABLE shared_survey (
+  survey_id int unsigned NOT NULL auto_increment,
+  code varchar(20) default NULL,
+  title text default NULL,
+  subtitle text default NULL,
+  author varchar(250) default NULL,
+  lang varchar(20) default NULL,
+  template varchar(20) default NULL,
+  intro text,
+  surveythanks text,
+  creation_date datetime NOT NULL default '0000-00-00 00:00:00',
+  course_code varchar(40) NOT NULL default '',
+  PRIMARY KEY  (survey_id),
+  UNIQUE KEY id (survey_id)
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for shared_survey_question
+--
+
+DROP TABLE IF EXISTS shared_survey_question;
+CREATE TABLE shared_survey_question (
+  question_id int NOT NULL auto_increment,
+  survey_id int NOT NULL default '0',
+  survey_question text NOT NULL,
+  survey_question_comment text NOT NULL,
+  type varchar(250) NOT NULL default '',
+  display varchar(10) NOT NULL default '',
+  sort int NOT NULL default '0',
+  code varchar(40) NOT NULL default '',
+  max_value int NOT NULL,
+  PRIMARY KEY  (question_id)
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for shared_survey_question_option
+--
+
+DROP TABLE IF EXISTS shared_survey_question_option;
+CREATE TABLE shared_survey_question_option (
+  question_option_id int NOT NULL auto_increment,
+  question_id int NOT NULL default '0',
+  survey_id int NOT NULL default '0',
+  option_text text NOT NULL,
+  sort int NOT NULL default '0',
+  PRIMARY KEY  (question_option_id)
+);
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for templates (User's FCKEditor templates)
+--
+
+DROP TABLE IF EXISTS templates;
+CREATE TABLE templates (
+  id int NOT NULL auto_increment,
+  title varchar(100) NOT NULL,
+  description varchar(250) NOT NULL,
+  course_code varchar(40) NOT NULL,
+  user_id int NOT NULL,
+  ref_doc int NOT NULL,
+  image varchar(250) NOT NULL,
+  PRIMARY KEY  (id)
+);
+
+
+
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure of openid_association (keep info on openid servers)
+--
+
+DROP TABLE IF EXISTS openid_association;
+CREATE TABLE IF NOT EXISTS openid_association (
+  id int NOT NULL auto_increment,
+  idp_endpoint_uri text NOT NULL,
+  session_type varchar(30) NOT NULL,
+  assoc_handle text NOT NULL,
+  assoc_type text NOT NULL,
+  expires_in bigint NOT NULL,
+  mac_key text NOT NULL,
+  created bigint NOT NULL,
+  PRIMARY KEY  (id)
+);
+--
+-- --------------------------------------------------------
+--
+-- Tables for gradebook
+--
+DROP TABLE IF EXISTS gradebook_category;
+CREATE TABLE gradebook_category (
+  id int NOT NULL auto_increment,
+  name text NOT NULL,
+  description text,
+  user_id int NOT NULL,
+  course_code varchar(40) default NULL,
+  parent_id int default NULL,
+  weight smallint NOT NULL,
+  visible tinyint NOT NULL,
+  certif_min_score int DEFAULT NULL,
+  session_id int DEFAULT NULL,
+  document_id int unsigned DEFAULT NULL,
+  PRIMARY KEY  (id)
+);
+DROP TABLE IF EXISTS gradebook_evaluation;
+CREATE TABLE gradebook_evaluation (
+  id int unsigned NOT NULL auto_increment,
+  name text NOT NULL,
+  description text,
+  user_id int NOT NULL,
+  course_code varchar(40) default NULL,
+  category_id int default NULL,
+  created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+  weight smallint NOT NULL,
+  max float unsigned NOT NULL,
+  visible tinyint NOT NULL,
+  type varchar(40) NOT NULL default 'evaluation',
+  PRIMARY KEY  (id)
+);
+DROP TABLE IF EXISTS gradebook_link;
+CREATE TABLE gradebook_link (
+  id int NOT NULL auto_increment,
+  type int NOT NULL,
+  ref_id int NOT NULL,
+  user_id int NOT NULL,
+  course_code varchar(40) NOT NULL,
+  category_id int NOT NULL,
+  created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+  weight smallint NOT NULL,
+  visible tinyint NOT NULL,
+  PRIMARY KEY  (id)
+);
+DROP TABLE IF EXISTS gradebook_result;
+CREATE TABLE gradebook_result (
+  id int NOT NULL auto_increment,
+  user_id int NOT NULL,
+  evaluation_id int NOT NULL,
+  created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+  score float unsigned default NULL,
+  PRIMARY KEY  (id)
+);
+DROP TABLE IF EXISTS gradebook_score_display;
+CREATE TABLE gradebook_score_display (
+  id int NOT NULL auto_increment,
+  score float unsigned NOT NULL,
+  display varchar(40) NOT NULL,
+  category_id int NOT NULL default 0,
+  score_color_percent float unsigned NOT NULL default 0,
+  PRIMARY KEY (id)
+);
+ALTER TABLE gradebook_score_display ADD INDEX(category_id);
+
+DROP TABLE IF EXISTS user_field;
+CREATE TABLE user_field (
+	id	INT NOT NULL auto_increment,
+	field_type int NOT NULL DEFAULT 1,
+	field_variable	varchar(64) NOT NULL,
+	field_display_text	varchar(64),
+	field_default_value text,
+	field_order int,
+	field_visible tinyint default 0,
+	field_changeable tinyint default 0,
+	field_filter tinyint default 0,
+	tms	DATETIME NOT NULL default '0000-00-00 00:00:00',
+	PRIMARY KEY(id)
+);
+DROP TABLE IF EXISTS user_field_options;
+CREATE TABLE user_field_options (
+	id	int NOT NULL auto_increment,
+	field_id int	NOT NULL,
+	option_value	text,
+	option_display_text varchar(64),
+	option_order int,
+	tms	DATETIME NOT NULL default '0000-00-00 00:00:00',
+	PRIMARY KEY (id)
+);
+DROP TABLE IF EXISTS user_field_values;
+CREATE TABLE user_field_values(
+	id	bigint	NOT NULL auto_increment,
+	user_id	int	unsigned NOT NULL,
+	field_id int NOT NULL,
+	field_value	text,
+	tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+	PRIMARY KEY(id)
+);
+
+ALTER TABLE user_field_values ADD INDEX (user_id, field_id);
+
+DROP TABLE IF EXISTS gradebook_result_log;
+CREATE TABLE gradebook_result_log (
+	id int NOT NULL auto_increment,
+	id_result int NOT NULL,
+	user_id int NOT NULL,
+	evaluation_id int NOT NULL,
+	created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+	score float unsigned default NULL,
+	PRIMARY KEY(id)
+);
+
+DROP TABLE IF EXISTS gradebook_linkeval_log;
+CREATE TABLE gradebook_linkeval_log (
+	id int NOT NULL auto_increment,
+	id_linkeval_log int NOT NULL,
+	name text,
+	description text,
+	created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+	weight smallint default NULL,
+	visible tinyint default NULL,
+	type varchar(20) NOT NULL,
+	user_id_log int NOT NULL,
+	PRIMARY KEY  (id)
+);
+
+--
+-- --------------------------------------------------------
+--
+-- Tables for the access URL feature
+--
+
+DROP TABLE IF EXISTS access_url;
+CREATE TABLE access_url(
+	id	int	unsigned NOT NULL auto_increment,
+	url	varchar(255) NOT NULL,
+	description text,
+	active	int unsigned not null default 0,
+	created_by	int	not null,
+	tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+	PRIMARY KEY (id)
+);
+
+INSERT INTO access_url(url, description, active, created_by) VALUES ('http://localhost/',' ',1,1);
+
+DROP TABLE IF EXISTS access_url_rel_user;
+CREATE TABLE access_url_rel_user (
+  access_url_id int unsigned NOT NULL,
+  user_id int unsigned NOT NULL,
+  PRIMARY KEY (access_url_id, user_id)
+);
+
+ALTER TABLE access_url_rel_user ADD INDEX idx_access_url_rel_user_user (user_id);
+ALTER TABLE access_url_rel_user ADD INDEX idx_access_url_rel_user_access_url(access_url_id);
+ALTER TABLE access_url_rel_user ADD INDEX idx_access_url_rel_user_access_url_user (user_id,access_url_id);
+
+DROP TABLE IF EXISTS access_url_rel_course;
+CREATE TABLE access_url_rel_course (
+  access_url_id int unsigned NOT NULL,
+  course_code char(40) NOT NULL,
+  PRIMARY KEY (access_url_id, course_code)
+);
+
+
+DROP TABLE IF EXISTS access_url_rel_session;
+CREATE TABLE access_url_rel_session (
+  access_url_id int unsigned NOT NULL,
+  session_id int unsigned NOT NULL,
+  PRIMARY KEY (access_url_id, session_id)
+);
+
+--
+-- Table structure for table sys_calendar
+--
+CREATE TABLE IF NOT EXISTS sys_calendar (
+  id int unsigned NOT NULL auto_increment,
+  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',
+  PRIMARY KEY  (id)
+);
+
+CREATE TABLE IF NOT EXISTS system_template (
+  id int UNSIGNED NOT NULL auto_increment,
+  title varchar(250) NOT NULL,
+  comment text NOT NULL,
+  image varchar(250) NOT NULL,
+  content text NOT NULL,
+  PRIMARY KEY  (id)
+);
+
+-- Adding the platform templates
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleCourseTitle', 'TemplateTitleCourseTitleDescription', 'coursetitle.gif', '
+<head>
+            	{CSS}
+            	<style type="text/css">
+            	.gris_title         	{
+            		color: silver;
+            	}
+            	h1
+            	{
+            		text-align: right;
+            	}
+				</style>
+
+            </head>
+            <body>
+			<table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+			<tbody>
+			<tr>
+			<td style="vertical-align: middle; width: 50%;" colspan="1" rowspan="1">
+				<h1>TITULUS 1<br>
+				<span class="gris_title">TITULUS 2</span><br>
+				</h1>
+			</td>
+			<td style="width: 50%;">
+				<img style="width: 100px; height: 100px;" alt="dokeos logo" src="{COURSE_DIR}images/logo_dokeos.png"></td>
+			</tr>
+			</tbody>
+			</table>
+			<p><br>
+			<br>
+			</p>
+			</body>
+');
+
+/*
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleCheckList', 'TemplateTitleCheckListDescription', 'checklist.gif', '
+      <head>
+	               {CSS}
+	            </head>
+	            <body>
+				<table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+				<tbody>
+				<tr>
+				<td style="vertical-align: top; width: 66%;">
+				<h3>Lorem ipsum dolor sit amet</h3>
+				<ul>
+					<li>consectetur adipisicing elit</li>
+					<li>sed do eiusmod tempor incididunt</li>
+					<li>ut labore et dolore magna aliqua</li>
+				</ul>
+
+				<h3>Ut enim ad minim veniam</h3>
+				<ul>
+					<li>quis nostrud exercitation ullamco</li>
+					<li>laboris nisi ut aliquip ex ea commodo consequat</li>
+					<li>Excepteur sint occaecat cupidatat non proident</li>
+				</ul>
+
+				<h3>Sed ut perspiciatis unde omnis</h3>
+				<ul>
+					<li>iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam</li>
+					<li>eaque ipsa quae ab illo inventore veritatis</li>
+					<li>et quasi architecto beatae vitae dicta sunt explicabo.&nbsp;</li>
+				</ul>
+
+				</td>
+				<td style="background: transparent url({IMG_DIR}postit.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; width: 33%; text-align: center; vertical-align: bottom;">
+				<h3>Ut enim ad minima</h3>
+				Veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur.<br>
+				<h3>
+				<img style="width: 180px; height: 144px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_smile.png "><br></h3>
+				</td>
+				</tr>
+				</tbody>
+				</table>
+				<p><br>
+				<br>
+				</p>
+				</body>
+');
+*/
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleTeacher', 'TemplateTitleTeacherDescription', 'yourinstructor.gif', '
+<head>
+                   {CSS}
+                   <style type="text/css">
+	            	.text
+	            	{
+	            		font-weight: normal;
+	            	}
+					</style>
+                </head>
+                <body>
+					<table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+					<tbody>
+					<tr>
+					<td></td>
+					<td style="height: 33%;"></td>
+					<td></td>
+					</tr>
+					<tr>
+					<td style="width: 25%;"></td>
+					<td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right; font-weight: bold;" colspan="1" rowspan="1">
+					<span class="text">
+					<br>
+					Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis pellentesque.</span>
+					</td>
+					<td style="width: 25%; font-weight: bold;">
+					<img style="width: 180px; height: 241px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_case.png "></td>
+					</tr>
+					</tbody>
+					</table>
+					<p><br>
+					<br>
+					</p>
+				</body>
+');
+
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleLeftList', 'TemplateTitleListLeftListDescription', 'leftlist.gif', '
+<head>
+	           {CSS}
+	       </head>
+		    <body>
+				<table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+				<tbody>
+				<tr>
+				<td style="width: 66%;"></td>
+				<td style="vertical-align: bottom; width: 33%;" colspan="1" rowspan="4">&nbsp;<img style="width: 180px; height: 248px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_reads.png "><br>
+				</td>
+				</tr>
+				<tr align="right">
+				<td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">Lorem
+				ipsum dolor sit amet.
+				</td>
+				</tr>
+				<tr align="right">
+				<td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
+				Vivamus
+				a quam.&nbsp;<br>
+				</td>
+				</tr>
+				<tr align="right">
+				<td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
+				Proin
+				a est stibulum ante ipsum.</td>
+				</tr>
+				</tbody>
+				</table>
+			<p><br>
+			<br>
+			</p>
+			</body>
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleLeftRightList', 'TemplateTitleLeftRightListDescription', 'leftrightlist.gif', '
+
+<head>
+	           {CSS}
+		    </head>
+			<body>
+				<table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; height: 400px; width: 720px;" border="0" cellpadding="15" cellspacing="6">
+				<tbody>
+				<tr>
+				<td></td>
+				<td style="vertical-align: top;" colspan="1" rowspan="4">&nbsp;<img style="width: 180px; height: 294px;" alt="Trainer" src="{COURSE_DIR}images/trainer/trainer_join_hands.png "><br>
+				</td>
+				<td></td>
+				</tr>
+				<tr>
+				<td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right;">Lorem
+				ipsum dolor sit amet.
+				</td>
+				<td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: left;">
+				Convallis
+				ut.&nbsp;Cras dui magna.</td>
+				</tr>
+				<tr>
+				<td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right;">
+				Vivamus
+				a quam.&nbsp;<br>
+				</td>
+				<td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: left;">
+				Etiam
+				lacinia stibulum ante.<br>
+				</td>
+				</tr>
+				<tr>
+				<td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right;">
+				Proin
+				a est stibulum ante ipsum.</td>
+				<td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: left;">
+				Consectetuer
+				adipiscing elit. <br>
+				</td>
+				</tr>
+				</tbody>
+				</table>
+			<p><br>
+			<br>
+			</p>
+			</body>
+
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleRightList', 'TemplateTitleRightListDescription', 'rightlist.gif', '
+	<head>
+	           {CSS}
+		    </head>
+		    <body style="direction: ltr;">
+				<table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+				<tbody>
+				<tr>
+				<td style="vertical-align: bottom; width: 50%;" colspan="1" rowspan="4"><img style="width: 300px; height: 199px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_points_right.png"><br>
+				</td>
+				<td style="width: 50%;"></td>
+				</tr>
+				<tr>
+				<td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 50%;">
+				Convallis
+				ut.&nbsp;Cras dui magna.</td>
+				</tr>
+				<tr>
+				<td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 50%;">
+				Etiam
+				lacinia.<br>
+				</td>
+				</tr>
+				<tr>
+				<td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 50%;">
+				Consectetuer
+				adipiscing elit. <br>
+				</td>
+				</tr>
+				</tbody>
+				</table>
+			<p><br>
+			<br>
+			</p>
+			</body>
+');
+
+/*
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleComparison', 'TemplateTitleComparisonDescription', 'compare.gif', '
+<head>
+            {CSS}
+            </head>
+
+            <body>
+            	<table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+				<tr>
+					<td style="height: 10%; width: 33%;"></td>
+					<td style="vertical-align: top; width: 33%;" colspan="1" rowspan="2">&nbsp;<img style="width: 180px; height: 271px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_standing.png "><br>
+					</td>
+					<td style="height: 10%; width: 33%;"></td>
+				</tr>
+			<tr>
+			<td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right;">
+			Lorem ipsum dolor sit amet.
+			</td>
+			<td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 33%;">
+			Convallis
+			ut.&nbsp;Cras dui magna.</td>
+			</tr>
+			</body>
+');
+*/
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleDiagram', 'TemplateTitleDiagramDescription', 'diagram.gif', '
+	<head>
+	                   {CSS}
+				    </head>
+
+					<body>
+					<table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+					<tbody>
+					<tr>
+					<td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; height: 33%; width: 33%;">
+					<br>
+					Etiam
+					lacinia stibulum ante.
+					Convallis
+					ut.&nbsp;Cras dui magna.</td>
+					<td colspan="1" rowspan="3">
+						<img style="width: 350px; height: 267px;" alt="Alaska chart" src="{COURSE_DIR}images/diagrams/alaska_chart.png "></td>
+					</tr>
+					<tr>
+					<td colspan="1" rowspan="1">
+					<img style="width: 300px; height: 199px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_points_right.png "></td>
+					</tr>
+					<tr>
+					</tr>
+					</tbody>
+					</table>
+					<p><br>
+					<br>
+					</p>
+					</body>
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleDesc', 'TemplateTitleCheckListDescription', 'description.gif', '
+<head>
+	                   {CSS}
+				    </head>
+					<body>
+						<table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+						<tbody>
+						<tr>
+						<td style="width: 50%; vertical-align: top;">
+							<img style="width: 48px; height: 49px; float: left;" alt="01" src="{COURSE_DIR}images/small/01.png " hspace="5"><br>Lorem ipsum dolor sit amet<br><br><br>
+							<img style="width: 48px; height: 49px; float: left;" alt="02" src="{COURSE_DIR}images/small/02.png " hspace="5">
+							<br>Ut enim ad minim veniam<br><br><br>
+							<img style="width: 48px; height: 49px; float: left;" alt="03" src="{COURSE_DIR}images/small/03.png " hspace="5">Duis aute irure dolor in reprehenderit<br><br><br>
+							<img style="width: 48px; height: 49px; float: left;" alt="04" src="{COURSE_DIR}images/small/04.png " hspace="5">Neque porro quisquam est</td>
+
+						<td style="vertical-align: top; width: 50%; text-align: right;" colspan="1" rowspan="1">
+							<img style="width: 300px; height: 291px;" alt="Gearbox" src="{COURSE_DIR}images/diagrams/gearbox.jpg "><br></td>
+						</tr><tr></tr>
+						</tbody>
+						</table>
+						<p><br>
+						<br>
+						</p>
+					</body>
+');
+
+/*
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleObjectives', 'TemplateTitleObjectivesDescription', 'courseobjectives.gif', '
+<head>
+	               {CSS}
+			    </head>
+
+			    <body>
+					<table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+					<tbody>
+					<tr>
+					<td style="vertical-align: bottom; width: 33%;" colspan="1" rowspan="2">
+					<img style="width: 180px; height: 271px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_chair.png "><br>
+					</td>
+					<td style="height: 10%; width: 66%;"></td>
+					</tr>
+					<tr>
+					<td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 66%;">
+					<h3>Lorem ipsum dolor sit amet</h3>
+					<ul>
+					<li>consectetur adipisicing elit</li>
+					<li>sed do eiusmod tempor incididunt</li>
+					<li>ut labore et dolore magna aliqua</li>
+					</ul>
+					<h3>Ut enim ad minim veniam</h3>
+					<ul>
+					<li>quis nostrud exercitation ullamco</li>
+					<li>laboris nisi ut aliquip ex ea commodo consequat</li>
+					<li>Excepteur sint occaecat cupidatat non proident</li>
+					</ul>
+					</td>
+					</tr>
+					</tbody>
+					</table>
+				<p><br>
+				<br>
+				</p>
+				</body>
+');
+*/
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleCycle', 'TemplateTitleCycleDescription', 'cyclechart.gif', '
+<head>
+	               {CSS}
+	               <style>
+	               .title
+	               {
+	               	color: white; font-weight: bold;
+	               }
+	               </style>
+			    </head>
+
+
+			    <body>
+				<table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="8" cellspacing="6">
+				<tbody>
+				<tr>
+					<td style="text-align: center; vertical-align: bottom; height: 10%;" colspan="3" rowspan="1">
+						<img style="width: 250px; height: 76px;" alt="arrow" src="{COURSE_DIR}images/diagrams/top_arrow.png ">
+					</td>
+				</tr>
+				<tr>
+					<td style="height: 5%; width: 45%; vertical-align: top; background-color: rgb(153, 153, 153); text-align: center;">
+						<span class="title">Lorem ipsum</span>
+					</td>
+
+					<td style="height: 5%; width: 10%;"></td>
+					<td style="height: 5%; vertical-align: top; background-color: rgb(153, 153, 153); text-align: center;">
+						<span class="title">Sed ut perspiciatis</span>
+					</td>
+				</tr>
+					<tr>
+						<td style="background-color: rgb(204, 204, 255); width: 45%; vertical-align: top;">
+							<ul>
+								<li>dolor sit amet</li>
+								<li>consectetur adipisicing elit</li>
+								<li>sed do eiusmod tempor&nbsp;</li>
+								<li>adipisci velit, sed quia non numquam</li>
+								<li>eius modi tempora incidunt ut labore et dolore magnam</li>
+							</ul>
+				</td>
+				<td style="width: 10%;"></td>
+				<td style="background-color: rgb(204, 204, 255); width: 45%; vertical-align: top;">
+					<ul>
+					<li>ut enim ad minim veniam</li>
+					<li>quis nostrud exercitation</li><li>ullamco laboris nisi ut</li>
+					<li> Quis autem vel eum iure reprehenderit qui in ea</li>
+					<li>voluptate velit esse quam nihil molestiae consequatur,</li>
+					</ul>
+					</td>
+					</tr>
+					<tr align="center">
+					<td style="height: 10%; vertical-align: top;" colspan="3" rowspan="1">
+					<img style="width: 250px; height: 76px;" alt="arrow" src="{COURSE_DIR}images/diagrams/bottom_arrow.png ">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
+				</td>
+				</tr>
+				</tbody>
+				</table>
+				<p><br>
+				<br>
+				</p>
+				</body>
+');
+
+/*
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleLearnerWonder', 'TemplateTitleLearnerWonderDescription', 'learnerwonder.gif', '
+<head>
+               {CSS}
+		    </head>
+
+		    <body>
+				<table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+				<tbody>
+				<tr>
+				<td style="width: 33%;" colspan="1" rowspan="4">
+					<img style="width: 120px; height: 348px;" alt="learner wonders" src="{COURSE_DIR}images/silhouette.png "><br>
+				</td>
+				<td style="width: 66%;"></td>
+				</tr>
+				<tr align="center">
+				<td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
+				Convallis
+				ut.&nbsp;Cras dui magna.</td>
+				</tr>
+				<tr align="center">
+				<td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
+				Etiam
+				lacinia stibulum ante.<br>
+				</td>
+				</tr>
+				<tr align="center">
+				<td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
+				Consectetuer
+				adipiscing elit. <br>
+				</td>
+				</tr>
+				</tbody>
+				</table>
+			<p><br>
+			<br>
+			</p>
+			</body>
+');
+*/
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleTimeline', 'TemplateTitleTimelineDescription', 'phasetimeline.gif', '
+<head>
+               {CSS}
+				<style>
+				.title
+				{
+					font-weight: bold; text-align: center;
+				}
+				</style>
+		    </head>
+
+		    <body>
+				<table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="8" cellspacing="5">
+				<tbody>
+				<tr class="title">
+					<td style="vertical-align: top; height: 3%; background-color: rgb(224, 224, 224);">Lorem ipsum</td>
+					<td style="height: 3%;"></td>
+					<td style="vertical-align: top; height: 3%; background-color: rgb(237, 237, 237);">Perspiciatis</td>
+					<td style="height: 3%;"></td>
+					<td style="vertical-align: top; height: 3%; background-color: rgb(245, 245, 245);">Nemo enim</td>
+				</tr>
+
+				<tr>
+					<td style="vertical-align: top; width: 30%; background-color: rgb(224, 224, 224);">
+						<ul>
+						<li>dolor sit amet</li>
+						<li>consectetur</li>
+						<li>adipisicing elit</li>
+					</ul>
+					<br>
+					</td>
+					<td>
+						<img style="width: 32px; height: 32px;" alt="arrow" src="{COURSE_DIR}images/small/arrow.png ">
+					</td>
+
+					<td style="vertical-align: top; width: 30%; background-color: rgb(237, 237, 237);">
+						<ul>
+							<li>ut labore</li>
+							<li>et dolore</li>
+							<li>magni dolores</li>
+						</ul>
+					</td>
+					<td>
+						<img style="width: 32px; height: 32px;" alt="arrow" src="{COURSE_DIR}images/small/arrow.png ">
+					</td>
+
+					<td style="vertical-align: top; background-color: rgb(245, 245, 245); width: 30%;">
+						<ul>
+							<li>neque porro</li>
+							<li>quisquam est</li>
+							<li>qui dolorem&nbsp;&nbsp;</li>
+						</ul>
+						<br><br>
+					</td>
+				</tr>
+				</tbody>
+				</table>
+			<p><br>
+			<br>
+			</p>
+			</body>
+');
+
+/*
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleStopAndThink', 'TemplateTitleStopAndThinkDescription', 'stopthink.gif', '
+<head>
+               {CSS}
+		    </head>
+		    <body>
+				<table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+				<tbody>
+				<tr>
+				<td style="vertical-align: bottom; width: 33%;" colspan="1" rowspan="2">
+					<img style="width: 180px; height: 169px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_staring.png ">
+				<br>
+				</td>
+				<td style="height: 10%; width: 66%;"></td>
+				</tr>
+				<tr>
+				<td style="background: transparent url({IMG_DIR}postit.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; width: 66%; vertical-align: middle; text-align: center;">
+					<h3>Attentio sectetur adipisicing elit</h3>
+					<ul>
+						<li>sed do eiusmod tempor incididunt</li>
+						<li>ut labore et dolore magna aliqua</li>
+						<li>quis nostrud exercitation ullamco</li>
+					</ul><br></td>
+				</tr>
+				</tbody>
+				</table>
+			<p><br>
+			<br>
+			</p>
+			</body>
+');
+*/
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleTable', 'TemplateTitleCheckListDescription', 'table.gif', '
+<head>
+                   {CSS}
+                   <style type="text/css">
+				.title
+				{
+					font-weight: bold; text-align: center;
+				}
+
+				.items
+				{
+					text-align: right;
+				}
+
+
+					</style>
+
+			    </head>
+			    <body>
+			    <br />
+			   <h2>A table</h2>
+				<table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px;" border="1" cellpadding="5" cellspacing="0">
+				<tbody>
+				<tr class="title">
+					<td>City</td>
+					<td>2005</td>
+					<td>2006</td>
+					<td>2007</td>
+					<td>2008</td>
+				</tr>
+				<tr class="items">
+					<td>Lima</td>
+					<td>10,40</td>
+					<td>8,95</td>
+					<td>9,19</td>
+					<td>9,76</td>
+				</tr>
+				<tr class="items">
+				<td>New York</td>
+					<td>18,39</td>
+					<td>17,52</td>
+					<td>16,57</td>
+					<td>16,60</td>
+				</tr>
+				<tr class="items">
+				<td>Barcelona</td>
+					<td>0,10</td>
+					<td>0,10</td>
+					<td>0,05</td>
+					<td>0,05</td>
+				</tr>
+				<tr class="items">
+				<td>Paris</td>
+					<td>3,38</td>
+					<td >3,63</td>
+					<td>3,63</td>
+					<td>3,54</td>
+				</tr>
+				</tbody>
+				</table>
+				<br>
+				</body>
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleAudio', 'TemplateTitleAudioDescription', 'audiocomment.gif', '
+<head>
+               {CSS}
+		    </head>
+                   <body>
+					<table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+					<tbody>
+					<tr>
+					<td>
+					<div align="center">
+					<span style="text-align: center;">
+						<embed  type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="300" height="20" bgcolor="#FFFFFF" src="{REL_PATH}main/inc/lib/mediaplayer/player.swf" allowfullscreen="false" allowscriptaccess="always" flashvars="file={COURSE_DIR}audio/ListeningComprehension.mp3&amp;autostart=true"></embed>
+                    </span></div>
+
+					<br>
+					</td>
+					<td colspan="1" rowspan="3"><br>
+						<img style="width: 300px; height: 341px; float: right;" alt="image" src="{COURSE_DIR}images/diagrams/head_olfactory_nerve.png "><br></td>
+					</tr>
+					<tr>
+					<td colspan="1" rowspan="1">
+						<img style="width: 180px; height: 271px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_glasses.png"><br></td>
+					</tr>
+					<tr>
+					</tr>
+					</tbody>
+					</table>
+					<p><br>
+					<br>
+					</p>
+					</body>
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleVideo', 'TemplateTitleVideoDescription', 'video.gif', '
+<head>
+            	{CSS}
+			</head>
+
+			<body>
+			<table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+			<tbody>
+			<tr>
+			<td style="width: 50%; vertical-align: top;">
+
+ 				<div style="text-align: center;" id="player810625-parent">
+					<div style="border-style: none; overflow: hidden; width: 320px; height: 240px; background-color: rgb(220, 220, 220);">
+
+						<div id="player810625">
+							<div id="player810625-config" style="overflow: hidden; display: none; visibility: hidden; width: 0px; height: 0px;">url={REL_PATH}main/default_course_document/video/flv/example.flv width=320 height=240 loop=false play=false downloadable=false fullscreen=true displayNavigation=true displayDigits=true align=left dispPlaylist=none playlistThumbs=false</div>
+						</div>
+
+						<embed
+							type="application/x-shockwave-flash"
+							src="{REL_PATH}main/inc/lib/mediaplayer/player.swf"
+							width="320"
+							height="240"
+							id="single"
+							name="single"
+							quality="high"
+							allowfullscreen="true"
+							flashvars="width=320&height=240&autostart=false&file={REL_PATH}main/default_course_document/video/flv/example.flv&repeat=false&image=&showdownload=false&link={REL_PATH}main/default_course_document/video/flv/example.flv&showdigits=true&shownavigation=true&logo="
+						/>
+
+					</div>
+				</div>
+
+			</td>
+			<td style="background: transparent url({IMG_DIR}faded_grey.png) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 50%;">
+			<h3><br>
+			</h3>
+			<h3>Lorem ipsum dolor sit amet</h3>
+				<ul>
+				<li>consectetur adipisicing elit</li>
+				<li>sed do eiusmod tempor incididunt</li>
+				<li>ut labore et dolore magna aliqua</li>
+				</ul>
+			<h3>Ut enim ad minim veniam</h3>
+				<ul>
+				<li>quis nostrud exercitation ullamco</li>
+				<li>laboris nisi ut aliquip ex ea commodo consequat</li>
+				<li>Excepteur sint occaecat cupidatat non proident</li>
+				</ul>
+			</td>
+			</tr>
+			</tbody>
+			</table>
+			<p><br>
+			<br>
+			</p>
+			 <style type="text/css">body{}</style><!-- to fix a strange bug appearing with firefox when editing this template -->
+			</body>
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleFlash', 'TemplateTitleFlashDescription', 'flash.gif', '
+<head>
+               {CSS}
+		    </head>
+		    <body>
+		    <center>
+				<table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 100%; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+				<tbody>
+					<tr>
+					<td align="center">
+					<embed width="700" height="300" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="{COURSE_DIR}flash/SpinEchoSequence.swf" play="true" loop="true" menu="true"></embed></span><br />
+					</td>
+					</tr>
+				</tbody>
+				</table>
+				<p><br>
+				<br>
+				</p>
+			</center>
+			</body>
+');
+
+
+--
+-- --------------------------------------------------------
+--
+-- Tables for reservation
+--
+
+
+--
+-- Table structure for table reservation category
+--
+
+CREATE TABLE reservation_category (
+   id  int unsigned NOT NULL auto_increment,
+   parent_id  int NOT NULL default 0,
+   name  varchar(128) NOT NULL default '',
+  PRIMARY KEY  ( id )
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table reservation category_rights
+--
+
+CREATE TABLE  reservation_category_rights  (
+   category_id  int NOT NULL default 0,
+   class_id  int NOT NULL default 0,
+   m_items  tinyint NOT NULL default 0
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table  item reservation
+--
+
+CREATE TABLE  reservation_item  (
+   id  int unsigned NOT NULL auto_increment,
+   category_id  int unsigned NOT NULL default 0,
+   course_code  varchar(40) NOT NULL default '',
+   name  varchar(128) NOT NULL default '',
+   description  text NOT NULL,
+   blackout  tinyint NOT NULL default 0,
+   creator  int unsigned NOT NULL default 0,
+   always_available TINYINT NOT NULL default 0,
+  PRIMARY KEY  ( id )
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table reservation item_rights
+--
+
+CREATE TABLE  reservation_item_rights  (
+   item_id  int unsigned NOT NULL default 0,
+   class_id  int unsigned NOT NULL default 0,
+   edit_right  tinyint unsigned NOT NULL default 0,
+   delete_right  tinyint unsigned NOT NULL default 0,
+   m_reservation  tinyint unsigned NOT NULL default 0,
+   view_right  tinyint NOT NULL default 0,
+  PRIMARY KEY  ( item_id , class_id )
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for main reservation table
+--
+
+CREATE TABLE  reservation_main  (
+   id  int unsigned NOT NULL auto_increment,
+   subid  int unsigned NOT NULL default 0,
+   item_id  int unsigned NOT NULL default 0,
+   auto_accept  tinyint unsigned NOT NULL default 0,
+   max_users  int unsigned NOT NULL default 1,
+   start_at  datetime NOT NULL default '0000-00-00 00:00:00',
+   end_at  datetime NOT NULL default '0000-00-00 00:00:00',
+   subscribe_from  datetime NOT NULL default '0000-00-00 00:00:00',
+   subscribe_until  datetime NOT NULL default '0000-00-00 00:00:00',
+   subscribers  int unsigned NOT NULL default 0,
+   notes  text NOT NULL,
+   timepicker  tinyint NOT NULL default 0,
+   timepicker_min  int NOT NULL default 0,
+   timepicker_max  int NOT NULL default 0,
+  PRIMARY KEY  ( id )
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for reservation subscription table
+--
+
+CREATE TABLE  reservation_subscription  (
+   dummy  int unsigned NOT NULL auto_increment,
+   user_id  int unsigned NOT NULL default 0,
+   reservation_id  int unsigned NOT NULL default 0,
+   accepted  tinyint unsigned NOT NULL default 0,
+   start_at  datetime NOT NULL default '0000-00-00 00:00:00',
+   end_at  datetime NOT NULL default '0000-00-00 00:00:00',
+  PRIMARY KEY  ( dummy )
+);
+
+-- ---------------------------------------------------------
+
+--
+-- Table structure for table user_rel_user
+--
+CREATE TABLE user_rel_user (
+  id bigint unsigned not null auto_increment,
+  user_id int unsigned not null,
+  friend_user_id int unsigned not null,
+  relation_type int not null default 0,
+  last_edit DATETIME,
+  PRIMARY KEY(id)
+);
+
+-- Commenting by jmontoya produces errors
+-- ALTER TABLE user_friend ADD INDEX idx_user_friend_user (user_id);
+-- ALTER TABLE user_friend ADD INDEX idx_user_friend_friend_user(friend_user_id);
+-- ALTER TABLE user_friend ADD INDEX idx_user_friend_user_friend_user(user_id,friend_user_id);
+
+--
+-- Table structure for table user_friend_relation_type
+--
+CREATE TABLE user_friend_relation_type(
+  id int unsigned not null auto_increment,
+  title char(20),
+  PRIMARY KEY(id)
+);
+
+
+--
+-- Table structure for MD5 API keys for users
+--
+
+CREATE TABLE user_api_key (
+    id int unsigned NOT NULL auto_increment,
+    user_id int unsigned NOT NULL,
+    api_key char(32) NOT NULL,
+    api_service char(10) NOT NULL default 'dokeos',
+    PRIMARY KEY (id)
+);
+ALTER TABLE user_api_key ADD INDEX idx_user_api_keys_user (user_id);
+
+--
+-- Table structure for table message
+--
+CREATE TABLE message(
+	id bigint unsigned not null auto_increment,
+	user_sender_id int unsigned not null,
+	user_receiver_id int unsigned not null,
+	msg_status tinyint unsigned not null default 0, -- 0 read, 1 unread, 3 deleted, 5 pending invitation, 6 accepted invitation, 7 invitation denied
+	send_date datetime not null default '0000-00-00 00:00:00',
+	title varchar(255) not null,
+	content text not null,
+	group_id int unsigned not null default 0,
+	parent_id int unsigned not null default 0,
+	update_date datetime not null default '0000-00-00 00:00:00',
+	PRIMARY KEY(id)
+);
+ALTER TABLE message ADD INDEX idx_message_user_sender(user_sender_id);
+ALTER TABLE message ADD INDEX idx_message_user_receiver(user_receiver_id);
+ALTER TABLE message ADD INDEX idx_message_user_sender_user_receiver(user_sender_id,user_receiver_id);
+ALTER TABLE message ADD INDEX idx_message_group(group_id);
+ALTER TABLE message ADD INDEX idx_message_parent(parent_id);
+
+INSERT INTO user_friend_relation_type (id,title)
+VALUES
+(1,'SocialUnknow'),
+(2,'SocialParent'),
+(3,'SocialFriend'),
+(4,'SocialGoodFriend'),
+(5,'SocialEnemy'),
+(6,'SocialDeleted');
+
+--
+-- Table structure for table legal (Terms & Conditions)
+--
+
+CREATE TABLE legal (
+  legal_id int NOT NULL auto_increment,
+  language_id int NOT NULL,
+  date int NOT NULL default 0,
+  content text,
+  type int NOT NULL,
+  changes text NOT NULL,
+  version int,
+  PRIMARY KEY (legal_id,language_id)
+);
+
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) values (1, 'legal_accept','Legal',0,0);
+
+--
+-- Table structure for certificate with gradebook
+--
+
+CREATE TABLE gradebook_certificate (
+	id bigint unsigned not null auto_increment,
+	cat_id int unsigned not null,
+	user_id int unsigned not null,
+	score_certificate float unsigned not null default 0,
+	created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+	path_certificate text null,
+	PRIMARY KEY(id)
+);
+ALTER TABLE gradebook_certificate ADD INDEX idx_gradebook_certificate_category_id(cat_id);
+ALTER TABLE gradebook_certificate ADD INDEX idx_gradebook_certificate_user_id(user_id);
+ALTER TABLE gradebook_certificate ADD INDEX idx_gradebook_certificate_category_id_user_id(cat_id,user_id);
+
+
+
+--
+-- Tables structure for search tool
+--
+
+-- specific fields tables
+CREATE TABLE specific_field (
+	id INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+	code char(1) NOT NULL,
+	name VARCHAR(200) NOT NULL
+);
+
+CREATE TABLE specific_field_values (
+	id INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+	course_code VARCHAR(40) NOT NULL ,
+	tool_id VARCHAR(100) NOT NULL ,
+	ref_id INT NOT NULL ,
+	field_id INT NOT NULL ,
+	value VARCHAR(200) NOT NULL
+);
+ALTER TABLE specific_field ADD CONSTRAINT unique_specific_field__code UNIQUE (code);
+
+-- search engine references to map dokeos resources
+
+CREATE TABLE search_engine_ref (
+	id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+	course_code VARCHAR( 40 ) NOT NULL,
+	tool_id VARCHAR( 100 ) NOT NULL,
+	ref_id_high_level INT NOT NULL,
+	ref_id_second_level INT NULL,
+	search_did INT NOT NULL
+);
+
+--
+-- Table structure for table sessions categories
+--
+
+CREATE TABLE session_category (
+	id int NOT NULL auto_increment,
+	name varchar(100) default NULL,
+	date_start date default NULL,
+	date_end date default NULL,
+  PRIMARY KEY (id)
+);
+
+
+--
+-- Table structure for table user tag
+--
+
+CREATE TABLE tag (
+	id int NOT NULL auto_increment,
+	tag char(255) NOT NULL,
+	field_id int NOT NULL,
+	count int NOT NULL,
+	PRIMARY KEY  (id)
+);
+
+
+CREATE TABLE user_rel_tag (
+	id int NOT NULL auto_increment,
+	user_id int NOT NULL,
+	tag_id int NOT NULL,
+	PRIMARY KEY  (id)
+);
+
+--
+-- Table structure for user platform groups
+--
+
+CREATE TABLE groups (
+	id int NOT NULL AUTO_INCREMENT,
+	name varchar(255) NOT NULL,
+	description varchar(255) NOT NULL,
+	picture_uri varchar(255) NOT NULL,
+	url varchar(255) NOT NULL,
+	visibility int NOT NULL,
+	updated_on varchar(255) NOT NULL,
+	created_on varchar(255) NOT NULL,
+	PRIMARY KEY (id)
+);
+
+CREATE TABLE group_rel_tag (
+	id int NOT NULL AUTO_INCREMENT,
+	tag_id int NOT NULL,
+	group_id int NOT NULL,
+	PRIMARY KEY (id)
+);
+
+ALTER TABLE group_rel_tag ADD INDEX ( group_id );
+ALTER TABLE group_rel_tag ADD INDEX ( tag_id );
+
+CREATE TABLE group_rel_user (
+	id int NOT NULL AUTO_INCREMENT,
+	group_id int NOT NULL,
+	user_id int NOT NULL,
+	relation_type int NOT NULL,
+	PRIMARY KEY (id)
+);
+ALTER TABLE group_rel_user ADD INDEX ( group_id );
+ALTER TABLE group_rel_user ADD INDEX ( user_id );
+ALTER TABLE group_rel_user ADD INDEX ( relation_type );
+--
+-- Table structure for table message attachment
+--
+
+CREATE TABLE IF NOT EXISTS message_attachment (
+	id int NOT NULL AUTO_INCREMENT,
+	path varchar(255) NOT NULL,
+	comment text,
+	size int NOT NULL default 0,
+	message_id int NOT NULL,
+	filename varchar(255) NOT NULL,
+	PRIMARY KEY  (id)
+);
+
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) values (10, 'tags','tags',0,0);
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) values (1, 'rssfeeds','RSS',0,0);
+INSERT INTO course_field (field_type, field_variable, field_display_text, field_default_value, field_visible, field_changeable) values (10, 'special_course','Special course', 'Yes', 1 , 1);
+
+--
+-- Table structure for table block
+--
+
+CREATE TABLE IF NOT EXISTS block (
+	id INT NOT NULL AUTO_INCREMENT,
+	name VARCHAR(255) NULL,
+	description TEXT NULL,
+	path VARCHAR(255) NOT NULL,
+	controller VARCHAR(100) NOT NULL,
+	active TINYINT NOT NULL DEFAULT 1,
+	PRIMARY KEY(id)
+);
+ALTER TABLE block ADD UNIQUE(path);
+
+INSERT INTO user_field(field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES(1, 'dashboard', 'Dashboard', 0, 0);
+INSERT INTO user_field(field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES(11, 'timezone', 'Timezone', 0, 0);

+ 267 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.8.7/db_stats.sql

@@ -0,0 +1,267 @@
+-- MySQL dump
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+CREATE TABLE track_c_browsers (
+  id int NOT NULL auto_increment,
+  browser varchar(255) NOT NULL default '',
+  counter int NOT NULL default 0,
+  PRIMARY KEY  (id)
+);
+
+CREATE TABLE track_c_countries (
+  id int NOT NULL auto_increment,
+  code varchar(40) NOT NULL default '',
+  country varchar(50) NOT NULL default '',
+  counter int NOT NULL default 0,
+  PRIMARY KEY  (id)
+);
+
+CREATE TABLE track_c_os (
+  id int NOT NULL auto_increment,
+  os varchar(255) NOT NULL default '',
+  counter int NOT NULL default 0,
+  PRIMARY KEY  (id)
+);
+
+CREATE TABLE track_c_providers (
+  id int NOT NULL auto_increment,
+  provider varchar(255) NOT NULL default '',
+  counter int NOT NULL default 0,
+  PRIMARY KEY  (id)
+);
+
+CREATE TABLE track_c_referers (
+  id int NOT NULL auto_increment,
+  referer varchar(255) NOT NULL default '',
+  counter int NOT NULL default 0,
+  PRIMARY KEY  (id)
+);
+
+CREATE TABLE track_e_access (
+  access_id int NOT NULL auto_increment,
+  access_user_id int unsigned default NULL,
+  access_date datetime NOT NULL default '0000-00-00 00:00:00',
+  access_cours_code varchar(40) NOT NULL default '',
+  access_tool varchar(30) default NULL,
+  access_session_id int NOT NULL default 0,
+  PRIMARY KEY  (access_id),
+  KEY access_user_id (access_user_id),
+  KEY access_cours_code (access_cours_code)
+);
+
+CREATE TABLE track_e_lastaccess (
+  access_id bigint NOT NULL auto_increment,
+  access_user_id int unsigned default NULL,
+  access_date datetime NOT NULL default '0000-00-00 00:00:00',
+  access_cours_code varchar(40) NOT NULL,
+  access_tool varchar(30) default NULL,
+  access_session_id int unsigned default NULL,
+  PRIMARY KEY  (access_id),
+  KEY access_user_id (access_user_id),
+  KEY access_cours_code (access_cours_code),
+  KEY access_session_id (access_session_id)
+);
+
+
+CREATE TABLE track_e_default (
+  default_id int NOT NULL auto_increment,
+  default_user_id int unsigned NOT NULL default 0,
+  default_cours_code varchar(40) NOT NULL default '',
+  default_date datetime NOT NULL default '0000-00-00 00:00:00',
+  default_event_type varchar(20) NOT NULL default '',
+  default_value_type varchar(20) NOT NULL default '',
+  default_value tinytext NOT NULL,
+  PRIMARY KEY  (default_id)
+);
+
+CREATE TABLE track_e_downloads (
+  down_id int NOT NULL auto_increment,
+  down_user_id int unsigned default NULL,
+  down_date datetime NOT NULL default '0000-00-00 00:00:00',
+  down_cours_id varchar(40) NOT NULL default '',
+  down_doc_path varchar(255) NOT NULL default '',
+  down_session_id INT NOT NULL DEFAULT 0,
+  PRIMARY KEY  (down_id),
+  KEY down_user_id (down_user_id),
+  KEY down_cours_id (down_cours_id)
+);
+
+CREATE TABLE track_e_exercices (
+  exe_id int NOT NULL auto_increment,
+  exe_user_id int unsigned default NULL,
+  exe_date datetime NOT NULL default '0000-00-00 00:00:00',
+  exe_cours_id varchar(40) NOT NULL default '',
+  exe_exo_id mediumint unsigned NOT NULL default 0,
+  exe_result float(6,2) NOT NULL default 0,
+  exe_weighting float(6,2) NOT NULL default 0,
+  PRIMARY KEY  (exe_id),
+  KEY exe_user_id (exe_user_id),
+  KEY exe_cours_id (exe_cours_id)
+);
+
+ALTER TABLE track_e_exercices ADD status varchar(20) NOT NULL default '';
+ALTER TABLE track_e_exercices ADD data_tracking text NOT NULL default '';
+ALTER TABLE track_e_exercices ADD start_date datetime NOT NULL default '0000-00-00 00:00:00';
+ALTER TABLE track_e_exercices ADD steps_counter SMALLINT UNSIGNED NOT NULL default 0;
+ALTER TABLE track_e_exercices ADD session_id SMALLINT UNSIGNED NOT NULL default 0;
+ALTER TABLE track_e_exercices ADD INDEX ( session_id ) ;
+ALTER TABLE track_e_exercices ADD orig_lp_id int  NOT NULL default 0;
+ALTER TABLE track_e_exercices ADD orig_lp_item_id int  NOT NULL default 0;
+ALTER TABLE track_e_exercices ADD exe_duration int UNSIGNED NOT NULL default 0;
+ALTER TABLE track_e_exercices ADD COLUMN expired_time_control datetime NOT NULL DEFAULT '0000-00-00 00:00:00';
+
+CREATE TABLE track_e_attempt (
+  exe_id int default NULL,
+  user_id int NOT NULL default 0,
+  question_id int NOT NULL default 0,
+  answer text NOT NULL,
+  teacher_comment text NOT NULL,
+  marks float(6,2) NOT NULL default 0,
+  course_code varchar(40) NOT NULL default '',
+  position int default 0,
+  tms datetime NOT NULL default '0000-00-00 00:00:00',
+  session_id INT NOT NULL DEFAULT 0
+);
+ALTER TABLE track_e_attempt ADD INDEX (exe_id);
+ALTER TABLE track_e_attempt ADD INDEX (user_id); 
+ALTER TABLE track_e_attempt ADD INDEX (question_id);
+ALTER TABLE track_e_attempt ADD INDEX (session_id);
+
+CREATE TABLE track_e_attempt_recording (
+  exe_id int unsigned NOT NULL, 
+  question_id int unsigned NOT NULL,  
+  marks int NOT NULL,  
+  insert_date datetime NOT NULL default '0000-00-00 00:00:00',  
+  author int unsigned NOT NULL,  
+  teacher_comment text NOT NULL,
+  session_id INT NOT NULL DEFAULT 0
+);
+ALTER TABLE track_e_attempt_recording ADD INDEX (exe_id);
+ALTER TABLE track_e_attempt_recording ADD INDEX (question_id);
+ALTER TABLE track_e_attempt_recording ADD INDEX (session_id);
+
+CREATE TABLE track_e_hotpotatoes (
+  exe_name VARCHAR( 255 ) NOT NULL ,
+  exe_user_id int unsigned DEFAULT NULL ,
+  exe_date DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL ,
+  exe_cours_id varchar(40) NOT NULL ,
+  exe_result smallint default 0 NOT NULL ,
+  exe_weighting smallint default 0 NOT NULL,
+  KEY exe_user_id (exe_user_id),
+  KEY exe_cours_id (exe_cours_id)
+);
+
+CREATE TABLE track_e_links (
+  links_id int NOT NULL auto_increment,
+  links_user_id int unsigned default NULL,
+  links_date datetime NOT NULL default '0000-00-00 00:00:00',
+  links_cours_id varchar(40) NOT NULL default '' ,
+  links_link_id int NOT NULL default 0,
+  links_session_id INT NOT NULL DEFAULT 0,
+  PRIMARY KEY  (links_id),
+  KEY links_cours_id (links_cours_id),
+  KEY links_user_id (links_user_id)
+);
+
+CREATE TABLE track_e_login (
+  login_id int NOT NULL auto_increment,
+  login_user_id int unsigned NOT NULL default 0,
+  login_date datetime NOT NULL default '0000-00-00 00:00:00',
+  login_ip varchar(39) NOT NULL default '',
+  logout_date datetime NULL default NULL,
+  PRIMARY KEY  (login_id),
+  KEY login_user_id (login_user_id)
+);
+
+CREATE TABLE track_e_online (
+  login_id int NOT NULL auto_increment,
+  login_user_id int unsigned NOT NULL default 0,
+  login_date datetime NOT NULL default '0000-00-00 00:00:00',
+  login_ip varchar(39) NOT NULL default '',
+  course varchar(40) default NULL,
+  session_id INT NOT NULL DEFAULT 0,
+  access_url_id INT NOT NULL DEFAULT 1,
+  PRIMARY KEY  (login_id),
+  KEY login_user_id (login_user_id)
+);
+
+CREATE TABLE track_e_open (
+  open_id int NOT NULL auto_increment,
+  open_remote_host tinytext NOT NULL,
+  open_agent tinytext NOT NULL,
+  open_referer tinytext NOT NULL,
+  open_date datetime NOT NULL default '0000-00-00 00:00:00',
+  PRIMARY KEY  (open_id)
+);
+
+CREATE TABLE track_e_uploads (
+  upload_id int NOT NULL auto_increment,
+  upload_user_id int unsigned default NULL,
+  upload_date datetime NOT NULL default '0000-00-00 00:00:00',
+  upload_cours_id varchar(40) NOT NULL default '',
+  upload_work_id int NOT NULL default 0,
+  upload_session_id INT NOT NULL DEFAULT 0,
+  PRIMARY KEY  (upload_id),
+  KEY upload_user_id (upload_user_id),
+  KEY upload_cours_id (upload_cours_id)
+);
+
+CREATE TABLE track_e_course_access (
+  course_access_id int NOT NULL auto_increment,
+  course_code varchar(40) NOT NULL,
+  user_id int NOT NULL,
+  login_course_date datetime NOT NULL default '0000-00-00 00:00:00',
+  logout_course_date datetime default NULL,
+  counter int NOT NULL,
+  session_id int NOT NULL default 0,
+  PRIMARY KEY  (course_access_id)
+);
+
+CREATE TABLE track_e_hotspot (
+  hotspot_id int NOT NULL auto_increment,
+  hotspot_user_id int NOT NULL,
+  hotspot_course_code varchar(50) NOT NULL,
+  hotspot_exe_id int NOT NULL,
+  hotspot_question_id int NOT NULL,
+  hotspot_answer_id int NOT NULL,
+  hotspot_correct tinyint(3) unsigned NOT NULL,
+  hotspot_coordinate text NOT NULL,
+  PRIMARY KEY  (hotspot_id),
+  KEY hotspot_course_code (hotspot_course_code),
+  KEY hotspot_user_id (hotspot_user_id),
+  KEY hotspot_exe_id (hotspot_exe_id),
+  KEY hotspot_question_id (hotspot_question_id)
+);
+
+CREATE TABLE track_e_item_property (
+  id int NOT NULL auto_increment PRIMARY KEY,
+  course_id int NOT NULL,
+  item_property_id int NOT NULL,
+  title varchar(255),
+  content text,
+  progress int NOT NULL default 0,
+  lastedit_date datetime NOT NULL default '0000-00-00 00:00:00',
+  lastedit_user_id int  NOT NULL,
+  session_id int NOT NULL default 0
+);
+
+ALTER TABLE track_e_course_access ADD INDEX (user_id);
+ALTER TABLE track_e_course_access ADD INDEX (login_course_date);
+ALTER TABLE track_e_course_access ADD INDEX (course_code);
+ALTER TABLE track_e_course_access ADD INDEX (session_id);
+ALTER TABLE track_e_access ADD INDEX (access_session_id);
+
+ALTER TABLE track_e_online ADD INDEX (course);
+ALTER TABLE track_e_online ADD INDEX (session_id);
+
+ALTER TABLE track_e_item_property ADD INDEX (course_id, item_property_id, session_id);
+ALTER TABLE track_e_downloads ADD INDEX (down_session_id);  
+ALTER TABLE track_e_links ADD INDEX (links_session_id); 
+ALTER TABLE track_e_uploads ADD INDEX (upload_session_id);  

+ 41 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.8.7/db_user.sql

@@ -0,0 +1,41 @@
+-- MySQL dump
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+CREATE TABLE personal_agenda (
+  id int NOT NULL auto_increment,
+  user int unsigned,
+  title text,
+  `text` text,
+  `date` datetime default NULL,
+  enddate datetime default NULL,
+  course varchar(255),
+  parent_event_id int null,
+  UNIQUE KEY id (id)
+);
+CREATE TABLE personal_agenda_repeat (
+  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 (cal_id)
+);
+CREATE TABLE personal_agenda_repeat_not (
+  cal_id INT NOT NULL,
+  cal_date INT NOT NULL,
+  PRIMARY KEY ( cal_id, cal_date )
+);
+CREATE TABLE user_course_category (
+  id int unsigned NOT NULL auto_increment,
+  user_id int unsigned NOT NULL default 0,
+  title text NOT NULL,
+  sort int, 
+  PRIMARY KEY  (id)
+);

+ 1782 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.8.8/db_course1.sql

@@ -0,0 +1,1782 @@
+-- MySQL dump 10.13  Distrib 5.5.29, for debian-linux-gnu (i686)
+--
+-- Host: localhost    Database: chamilo1884
+-- ------------------------------------------------------
+-- Server version	5.5.29-0ubuntu0.12.10.1
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `announcement`
+--
+
+DROP TABLE IF EXISTS `announcement`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `announcement` (
+  `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+  `title` text,
+  `content` mediumtext,
+  `end_date` date DEFAULT NULL,
+  `display_order` mediumint(9) NOT NULL DEFAULT '0',
+  `email_sent` tinyint(4) DEFAULT '0',
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `announcement_attachment`
+--
+
+DROP TABLE IF EXISTS `announcement_attachment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `announcement_attachment` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `path` varchar(255) NOT NULL,
+  `comment` text,
+  `size` int(11) NOT NULL DEFAULT '0',
+  `announcement_id` int(11) NOT NULL,
+  `filename` varchar(255) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `attendance`
+--
+
+DROP TABLE IF EXISTS `attendance`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `attendance` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `name` text NOT NULL,
+  `description` text,
+  `active` tinyint(4) NOT NULL DEFAULT '1',
+  `attendance_qualify_title` varchar(255) DEFAULT NULL,
+  `attendance_qualify_max` int(11) NOT NULL DEFAULT '0',
+  `attendance_weight` float(6,2) NOT NULL DEFAULT '0.00',
+  `session_id` int(11) NOT NULL DEFAULT '0',
+  `locked` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`),
+  KEY `active` (`active`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `attendance_calendar`
+--
+
+DROP TABLE IF EXISTS `attendance_calendar`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `attendance_calendar` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `attendance_id` int(11) NOT NULL,
+  `date_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `done_attendance` tinyint(4) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `attendance_id` (`attendance_id`),
+  KEY `done_attendance` (`done_attendance`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `attendance_result`
+--
+
+DROP TABLE IF EXISTS `attendance_result`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `attendance_result` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `user_id` int(11) NOT NULL,
+  `attendance_id` int(11) NOT NULL,
+  `score` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `attendance_id` (`attendance_id`),
+  KEY `user_id` (`user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `attendance_sheet`
+--
+
+DROP TABLE IF EXISTS `attendance_sheet`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `attendance_sheet` (
+  `user_id` int(11) NOT NULL,
+  `attendance_calendar_id` int(11) NOT NULL,
+  `presence` tinyint(4) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`user_id`,`attendance_calendar_id`),
+  KEY `presence` (`presence`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `attendance_sheet_log`
+--
+
+DROP TABLE IF EXISTS `attendance_sheet_log`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `attendance_sheet_log` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `attendance_id` int(11) 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(11) NOT NULL DEFAULT '0',
+  `calendar_date_value` datetime DEFAULT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog`
+--
+
+DROP TABLE IF EXISTS `blog`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog` (
+  `blog_id` smallint(6) NOT NULL AUTO_INCREMENT,
+  `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(3) unsigned NOT NULL DEFAULT '0',
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`blog_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with blogs in this course';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_attachment`
+--
+
+DROP TABLE IF EXISTS `blog_attachment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_attachment` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `path` varchar(255) NOT NULL COMMENT 'the real filename',
+  `comment` text,
+  `size` int(11) NOT NULL DEFAULT '0',
+  `post_id` int(11) NOT NULL,
+  `filename` varchar(255) NOT NULL COMMENT 'the user s file name',
+  `blog_id` int(11) NOT NULL,
+  `comment_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_comment`
+--
+
+DROP TABLE IF EXISTS `blog_comment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_comment` (
+  `comment_id` int(11) NOT NULL AUTO_INCREMENT,
+  `title` varchar(250) NOT NULL DEFAULT '',
+  `comment` longtext NOT NULL,
+  `author_id` int(11) NOT NULL DEFAULT '0',
+  `date_creation` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `blog_id` mediumint(9) NOT NULL DEFAULT '0',
+  `post_id` int(11) NOT NULL DEFAULT '0',
+  `task_id` int(11) DEFAULT NULL,
+  `parent_comment_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`comment_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with comments on posts in a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_post`
+--
+
+DROP TABLE IF EXISTS `blog_post`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_post` (
+  `post_id` int(11) NOT NULL AUTO_INCREMENT,
+  `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` mediumint(9) NOT NULL DEFAULT '0',
+  `author_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`post_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with posts / blog.';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_rating`
+--
+
+DROP TABLE IF EXISTS `blog_rating`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_rating` (
+  `rating_id` int(11) NOT NULL AUTO_INCREMENT,
+  `blog_id` int(11) NOT NULL DEFAULT '0',
+  `rating_type` enum('post','comment') NOT NULL DEFAULT 'post',
+  `item_id` int(11) NOT NULL DEFAULT '0',
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  `rating` mediumint(9) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`rating_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with ratings for post/comments in a certain blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_rel_user`
+--
+
+DROP TABLE IF EXISTS `blog_rel_user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_rel_user` (
+  `blog_id` int(11) NOT NULL DEFAULT '0',
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`blog_id`,`user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table representing users subscribed to a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_task`
+--
+
+DROP TABLE IF EXISTS `blog_task`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_task` (
+  `task_id` mediumint(9) NOT NULL AUTO_INCREMENT,
+  `blog_id` mediumint(9) NOT NULL DEFAULT '0',
+  `title` varchar(250) NOT NULL DEFAULT '',
+  `description` text NOT NULL,
+  `color` varchar(10) NOT NULL DEFAULT '',
+  `system_task` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`task_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with tasks for a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_task_rel_user`
+--
+
+DROP TABLE IF EXISTS `blog_task_rel_user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_task_rel_user` (
+  `blog_id` mediumint(9) NOT NULL DEFAULT '0',
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  `task_id` mediumint(9) NOT NULL DEFAULT '0',
+  `target_date` date NOT NULL DEFAULT '0000-00-00',
+  PRIMARY KEY (`blog_id`,`user_id`,`task_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with tasks assigned to a user in a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `calendar_event`
+--
+
+DROP TABLE IF EXISTS `calendar_event`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `calendar_event` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `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(11) DEFAULT NULL,
+  `session_id` int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `calendar_event_attachment`
+--
+
+DROP TABLE IF EXISTS `calendar_event_attachment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `calendar_event_attachment` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `path` varchar(255) NOT NULL,
+  `comment` text,
+  `size` int(11) NOT NULL DEFAULT '0',
+  `agenda_id` int(11) NOT NULL,
+  `filename` varchar(255) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `calendar_event_repeat`
+--
+
+DROP TABLE IF EXISTS `calendar_event_repeat`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `calendar_event_repeat` (
+  `cal_id` int(11) NOT NULL DEFAULT '0',
+  `cal_type` varchar(20) DEFAULT NULL,
+  `cal_end` int(11) DEFAULT NULL,
+  `cal_frequency` int(11) DEFAULT '1',
+  `cal_days` char(7) DEFAULT NULL,
+  PRIMARY KEY (`cal_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `calendar_event_repeat_not`
+--
+
+DROP TABLE IF EXISTS `calendar_event_repeat_not`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `calendar_event_repeat_not` (
+  `cal_id` int(11) NOT NULL,
+  `cal_date` int(11) NOT NULL,
+  PRIMARY KEY (`cal_id`,`cal_date`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `chat_connected`
+--
+
+DROP TABLE IF EXISTS `chat_connected`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `chat_connected` (
+  `user_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `last_connection` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `session_id` int(11) NOT NULL DEFAULT '0',
+  `to_group_id` int(11) NOT NULL DEFAULT '0',
+  KEY `char_connected_index` (`user_id`,`session_id`,`to_group_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `course_description`
+--
+
+DROP TABLE IF EXISTS `course_description`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `course_description` (
+  `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
+  `title` varchar(255) DEFAULT NULL,
+  `content` text,
+  `session_id` smallint(6) DEFAULT '0',
+  `description_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `progress` int(11) NOT NULL DEFAULT '0',
+  UNIQUE KEY `id` (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `course_setting`
+--
+
+DROP TABLE IF EXISTS `course_setting`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `course_setting` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `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`)
+) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `document`
+--
+
+DROP TABLE IF EXISTS `document`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `document` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `path` varchar(255) NOT NULL DEFAULT '',
+  `comment` text,
+  `title` varchar(255) DEFAULT NULL,
+  `filetype` set('file','folder') NOT NULL DEFAULT 'file',
+  `size` int(11) NOT NULL DEFAULT '0',
+  `readonly` tinyint(3) unsigned NOT NULL,
+  `session_id` int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `dropbox_category`
+--
+
+DROP TABLE IF EXISTS `dropbox_category`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `dropbox_category` (
+  `cat_id` int(11) NOT NULL AUTO_INCREMENT,
+  `cat_name` text NOT NULL,
+  `received` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `sent` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(6) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`cat_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `dropbox_feedback`
+--
+
+DROP TABLE IF EXISTS `dropbox_feedback`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `dropbox_feedback` (
+  `feedback_id` int(11) NOT NULL AUTO_INCREMENT,
+  `file_id` int(11) NOT NULL DEFAULT '0',
+  `author_user_id` int(11) NOT NULL DEFAULT '0',
+  `feedback` text NOT NULL,
+  `feedback_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  PRIMARY KEY (`feedback_id`),
+  KEY `file_id` (`file_id`),
+  KEY `author_user_id` (`author_user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `dropbox_file`
+--
+
+DROP TABLE IF EXISTS `dropbox_file`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `dropbox_file` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `uploader_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `filename` varchar(250) NOT NULL DEFAULT '',
+  `filesize` int(10) 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(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(5) unsigned NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `UN_filename` (`filename`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `dropbox_person`
+--
+
+DROP TABLE IF EXISTS `dropbox_person`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `dropbox_person` (
+  `file_id` int(10) unsigned NOT NULL,
+  `user_id` int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`file_id`,`user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `dropbox_post`
+--
+
+DROP TABLE IF EXISTS `dropbox_post`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `dropbox_post` (
+  `file_id` int(10) unsigned NOT NULL,
+  `dest_user_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `feedback_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `feedback` text,
+  `cat_id` int(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(5) unsigned NOT NULL,
+  PRIMARY KEY (`file_id`,`dest_user_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_attachment`
+--
+
+DROP TABLE IF EXISTS `forum_attachment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_attachment` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `path` varchar(255) NOT NULL,
+  `comment` text,
+  `size` int(11) NOT NULL DEFAULT '0',
+  `post_id` int(11) NOT NULL,
+  `filename` varchar(255) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_category`
+--
+
+DROP TABLE IF EXISTS `forum_category`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_category` (
+  `cat_id` int(11) NOT NULL AUTO_INCREMENT,
+  `cat_title` varchar(255) NOT NULL DEFAULT '',
+  `cat_comment` text,
+  `cat_order` int(11) NOT NULL DEFAULT '0',
+  `locked` int(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`cat_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_forum`
+--
+
+DROP TABLE IF EXISTS `forum_forum`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_forum` (
+  `forum_id` int(11) NOT NULL AUTO_INCREMENT,
+  `forum_title` varchar(255) NOT NULL DEFAULT '',
+  `forum_comment` text,
+  `forum_threads` int(11) DEFAULT '0',
+  `forum_posts` int(11) DEFAULT '0',
+  `forum_last_post` int(11) DEFAULT '0',
+  `forum_category` int(11) DEFAULT NULL,
+  `allow_anonymous` int(11) DEFAULT NULL,
+  `allow_edit` int(11) DEFAULT NULL,
+  `approval_direct_post` varchar(20) DEFAULT NULL,
+  `allow_attachments` int(11) DEFAULT NULL,
+  `allow_new_threads` int(11) 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(11) DEFAULT NULL,
+  `locked` int(11) NOT NULL DEFAULT '0',
+  `session_id` int(11) 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`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_mailcue`
+--
+
+DROP TABLE IF EXISTS `forum_mailcue`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_mailcue` (
+  `thread_id` int(11) DEFAULT NULL,
+  `user_id` int(11) DEFAULT NULL,
+  `post_id` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_notification`
+--
+
+DROP TABLE IF EXISTS `forum_notification`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_notification` (
+  `user_id` int(11) DEFAULT NULL,
+  `forum_id` int(11) DEFAULT NULL,
+  `thread_id` int(11) DEFAULT NULL,
+  `post_id` int(11) DEFAULT NULL,
+  KEY `user_id` (`user_id`),
+  KEY `forum_id` (`forum_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_post`
+--
+
+DROP TABLE IF EXISTS `forum_post`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_post` (
+  `post_id` int(11) NOT NULL AUTO_INCREMENT,
+  `post_title` varchar(250) DEFAULT NULL,
+  `post_text` text,
+  `thread_id` int(11) DEFAULT '0',
+  `forum_id` int(11) DEFAULT '0',
+  `poster_id` int(11) DEFAULT '0',
+  `poster_name` varchar(100) DEFAULT '',
+  `post_date` datetime DEFAULT '0000-00-00 00:00:00',
+  `post_notification` tinyint(4) DEFAULT '0',
+  `post_parent_id` int(11) DEFAULT '0',
+  `visible` tinyint(4) DEFAULT '1',
+  PRIMARY KEY (`post_id`),
+  KEY `poster_id` (`poster_id`),
+  KEY `forum_id` (`forum_id`),
+  KEY `idx_forum_post_thread_id` (`thread_id`),
+  KEY `idx_forum_post_visible` (`visible`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_thread`
+--
+
+DROP TABLE IF EXISTS `forum_thread`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_thread` (
+  `thread_id` int(11) NOT NULL AUTO_INCREMENT,
+  `thread_title` varchar(255) DEFAULT NULL,
+  `forum_id` int(11) DEFAULT NULL,
+  `thread_replies` int(11) DEFAULT '0',
+  `thread_poster_id` int(11) DEFAULT NULL,
+  `thread_poster_name` varchar(100) DEFAULT '',
+  `thread_views` int(11) DEFAULT '0',
+  `thread_last_post` int(11) DEFAULT NULL,
+  `thread_date` datetime DEFAULT '0000-00-00 00:00:00',
+  `thread_sticky` tinyint(3) unsigned DEFAULT '0',
+  `locked` int(11) NOT NULL DEFAULT '0',
+  `session_id` int(10) unsigned DEFAULT NULL,
+  `thread_title_qualify` varchar(255) DEFAULT '',
+  `thread_qualify_max` float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  `thread_close_date` datetime DEFAULT '0000-00-00 00:00:00',
+  `thread_weight` float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  PRIMARY KEY (`thread_id`),
+  KEY `idx_forum_thread_forum_id` (`forum_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_thread_qualify`
+--
+
+DROP TABLE IF EXISTS `forum_thread_qualify`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_thread_qualify` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `user_id` int(10) unsigned NOT NULL,
+  `thread_id` int(11) NOT NULL,
+  `qualify` float(6,2) NOT NULL DEFAULT '0.00',
+  `qualify_user_id` int(11) DEFAULT NULL,
+  `qualify_time` datetime DEFAULT '0000-00-00 00:00:00',
+  `session_id` int(11) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `user_id` (`user_id`,`thread_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_thread_qualify_log`
+--
+
+DROP TABLE IF EXISTS `forum_thread_qualify_log`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_thread_qualify_log` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `user_id` int(10) unsigned NOT NULL,
+  `thread_id` int(11) NOT NULL,
+  `qualify` float(6,2) NOT NULL DEFAULT '0.00',
+  `qualify_user_id` int(11) DEFAULT NULL,
+  `qualify_time` datetime DEFAULT '0000-00-00 00:00:00',
+  `session_id` int(11) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `user_id` (`user_id`,`thread_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `glossary`
+--
+
+DROP TABLE IF EXISTS `glossary`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `glossary` (
+  `glossary_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `name` varchar(255) NOT NULL,
+  `description` text NOT NULL,
+  `display_order` int(11) DEFAULT NULL,
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`glossary_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `group_category`
+--
+
+DROP TABLE IF EXISTS `group_category`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `group_category` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `title` varchar(255) NOT NULL DEFAULT '',
+  `description` text NOT NULL,
+  `doc_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `calendar_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `work_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `announcements_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `forum_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `wiki_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `chat_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `max_student` smallint(5) unsigned NOT NULL DEFAULT '8',
+  `self_reg_allowed` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `self_unreg_allowed` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `groups_per_user` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `display_order` smallint(5) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `group_info`
+--
+
+DROP TABLE IF EXISTS `group_info`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `group_info` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `name` varchar(100) DEFAULT NULL,
+  `category_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `description` text,
+  `max_student` smallint(5) unsigned NOT NULL DEFAULT '8',
+  `doc_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `calendar_state` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `work_state` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `announcements_state` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `forum_state` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `wiki_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `chat_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `secret_directory` varchar(255) DEFAULT NULL,
+  `self_registration_allowed` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `self_unregistration_allowed` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `session_id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `group_rel_tutor`
+--
+
+DROP TABLE IF EXISTS `group_rel_tutor`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `group_rel_tutor` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `user_id` int(11) NOT NULL,
+  `group_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `group_rel_user`
+--
+
+DROP TABLE IF EXISTS `group_rel_user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `group_rel_user` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `user_id` int(10) unsigned NOT NULL,
+  `group_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `status` int(11) NOT NULL DEFAULT '0',
+  `role` char(50) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `item_property`
+--
+
+DROP TABLE IF EXISTS `item_property`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `item_property` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `tool` varchar(100) NOT NULL DEFAULT '',
+  `insert_user_id` int(10) 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(11) NOT NULL DEFAULT '0',
+  `lastedit_type` varchar(100) NOT NULL DEFAULT '',
+  `lastedit_user_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `to_group_id` int(10) unsigned DEFAULT NULL,
+  `to_user_id` int(10) unsigned DEFAULT NULL,
+  `visibility` tinyint(4) 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(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `idx_item_property_toolref` (`tool`,`ref`)
+) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `link`
+--
+
+DROP TABLE IF EXISTS `link`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `link` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `url` text NOT NULL,
+  `title` varchar(150) DEFAULT NULL,
+  `description` text,
+  `category_id` smallint(5) unsigned DEFAULT NULL,
+  `display_order` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `on_homepage` enum('0','1') NOT NULL DEFAULT '0',
+  `target` char(10) DEFAULT '_self',
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `link_category`
+--
+
+DROP TABLE IF EXISTS `link_category`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `link_category` (
+  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
+  `category_title` varchar(255) NOT NULL,
+  `description` text,
+  `display_order` mediumint(8) unsigned NOT NULL DEFAULT '0',
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp`
+--
+
+DROP TABLE IF EXISTS `lp`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `lp_type` smallint(5) unsigned NOT NULL,
+  `name` varchar(255) NOT NULL,
+  `ref` tinytext,
+  `description` text,
+  `path` text NOT NULL,
+  `force_commit` tinyint(3) 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(10) unsigned NOT NULL DEFAULT '0',
+  `content_maker` tinytext NOT NULL,
+  `content_local` varchar(32) NOT NULL DEFAULT 'local',
+  `content_license` text NOT NULL,
+  `prevent_reinit` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `js_lib` tinytext NOT NULL,
+  `debug` tinyint(3) 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(10) unsigned NOT NULL DEFAULT '0',
+  `prerequisite` int(10) unsigned NOT NULL DEFAULT '0',
+  `use_max_score` int(10) unsigned NOT NULL DEFAULT '1',
+  `autolunch` int(10) 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`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp_item`
+--
+
+DROP TABLE IF EXISTS `lp_item`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp_item` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `lp_id` int(10) unsigned NOT NULL,
+  `item_type` char(32) NOT NULL DEFAULT 'dokeos_document',
+  `ref` tinytext NOT NULL,
+  `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 DEFAULT NULL,
+  `parent_item_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `previous_item_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `next_item_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `display_order` int(10) unsigned NOT NULL DEFAULT '0',
+  `prerequisite` text,
+  `parameters` text,
+  `launch_data` text NOT NULL,
+  `max_time_allowed` char(13) DEFAULT '',
+  `terms` text,
+  `search_did` int(11) DEFAULT NULL,
+  `audio` varchar(250) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `lp_id` (`lp_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp_item_view`
+--
+
+DROP TABLE IF EXISTS `lp_item_view`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp_item_view` (
+  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+  `lp_item_id` int(10) unsigned NOT NULL,
+  `lp_view_id` int(10) unsigned NOT NULL,
+  `view_count` int(10) unsigned NOT NULL DEFAULT '0',
+  `start_time` int(10) unsigned NOT NULL,
+  `total_time` int(10) unsigned NOT NULL DEFAULT '0',
+  `score` float unsigned NOT NULL DEFAULT '0',
+  `status` char(32) NOT NULL DEFAULT 'not attempted',
+  `suspend_data` text,
+  `lesson_location` text,
+  `core_exit` varchar(32) NOT NULL DEFAULT 'none',
+  `max_score` varchar(8) DEFAULT '',
+  PRIMARY KEY (`id`),
+  KEY `lp_item_id` (`lp_item_id`),
+  KEY `lp_view_id` (`lp_view_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp_iv_interaction`
+--
+
+DROP TABLE IF EXISTS `lp_iv_interaction`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp_iv_interaction` (
+  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+  `order_id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `lp_iv_id` bigint(20) 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,
+  `student_response` text NOT NULL,
+  `result` varchar(255) NOT NULL DEFAULT '',
+  `latency` varchar(16) NOT NULL DEFAULT '',
+  PRIMARY KEY (`id`),
+  KEY `lp_iv_id` (`lp_iv_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp_iv_objective`
+--
+
+DROP TABLE IF EXISTS `lp_iv_objective`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp_iv_objective` (
+  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+  `lp_iv_id` bigint(20) unsigned NOT NULL,
+  `order_id` smallint(5) 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`),
+  KEY `lp_iv_id` (`lp_iv_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp_view`
+--
+
+DROP TABLE IF EXISTS `lp_view`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp_view` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `lp_id` int(10) unsigned NOT NULL,
+  `user_id` int(10) unsigned NOT NULL,
+  `view_count` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `last_item` int(10) unsigned NOT NULL DEFAULT '0',
+  `progress` int(10) unsigned DEFAULT '0',
+  `session_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `lp_id` (`lp_id`),
+  KEY `user_id` (`user_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `notebook`
+--
+
+DROP TABLE IF EXISTS `notebook`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `notebook` (
+  `notebook_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `user_id` int(10) unsigned NOT NULL,
+  `course` varchar(40) NOT NULL,
+  `session_id` int(11) 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(11) DEFAULT NULL,
+  PRIMARY KEY (`notebook_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `online_connected`
+--
+
+DROP TABLE IF EXISTS `online_connected`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `online_connected` (
+  `user_id` int(10) unsigned NOT NULL,
+  `last_connection` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  PRIMARY KEY (`user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `online_link`
+--
+
+DROP TABLE IF EXISTS `online_link`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `online_link` (
+  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
+  `name` char(50) NOT NULL DEFAULT '',
+  `url` char(100) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `permission_group`
+--
+
+DROP TABLE IF EXISTS `permission_group`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `permission_group` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `group_id` int(11) NOT NULL DEFAULT '0',
+  `tool` varchar(250) NOT NULL DEFAULT '',
+  `action` varchar(250) NOT NULL DEFAULT '',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `permission_task`
+--
+
+DROP TABLE IF EXISTS `permission_task`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `permission_task` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `task_id` int(11) NOT NULL DEFAULT '0',
+  `tool` varchar(250) NOT NULL DEFAULT '',
+  `action` varchar(250) NOT NULL DEFAULT '',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `permission_user`
+--
+
+DROP TABLE IF EXISTS `permission_user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `permission_user` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  `tool` varchar(250) NOT NULL DEFAULT '',
+  `action` varchar(250) NOT NULL DEFAULT '',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `quiz`
+--
+
+DROP TABLE IF EXISTS `quiz`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `quiz` (
+  `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+  `title` varchar(255) NOT NULL,
+  `description` text,
+  `sound` varchar(255) DEFAULT NULL,
+  `type` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `random` smallint(6) NOT NULL DEFAULT '0',
+  `random_answers` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `active` tinyint(4) NOT NULL DEFAULT '0',
+  `results_disabled` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `access_condition` text,
+  `max_attempt` int(11) 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(11) NOT NULL DEFAULT '0',
+  `expired_time` int(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(6) DEFAULT '0',
+  `propagate_neg` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `quiz_answer`
+--
+
+DROP TABLE IF EXISTS `quiz_answer`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `quiz_answer` (
+  `id` mediumint(8) unsigned NOT NULL,
+  `question_id` mediumint(8) unsigned NOT NULL,
+  `answer` text NOT NULL,
+  `correct` mediumint(8) unsigned DEFAULT NULL,
+  `comment` text,
+  `ponderation` float(6,2) NOT NULL DEFAULT '0.00',
+  `position` mediumint(8) unsigned NOT NULL DEFAULT '1',
+  `hotspot_coordinates` text,
+  `hotspot_type` enum('square','circle','poly','delineation','oar') DEFAULT NULL,
+  `destination` text NOT NULL,
+  `id_auto` int(11) NOT NULL AUTO_INCREMENT,
+  PRIMARY KEY (`id`,`question_id`),
+  UNIQUE KEY `id_auto` (`id_auto`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `quiz_question`
+--
+
+DROP TABLE IF EXISTS `quiz_question`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `quiz_question` (
+  `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+  `question` text NOT NULL,
+  `description` text,
+  `ponderation` float(6,2) NOT NULL DEFAULT '0.00',
+  `position` mediumint(8) unsigned NOT NULL DEFAULT '1',
+  `type` tinyint(3) unsigned NOT NULL DEFAULT '2',
+  `picture` varchar(50) DEFAULT NULL,
+  `level` int(10) unsigned NOT NULL DEFAULT '0',
+  `extra` varchar(255) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `position` (`position`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `quiz_question_option`
+--
+
+DROP TABLE IF EXISTS `quiz_question_option`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `quiz_question_option` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `question_id` int(11) NOT NULL,
+  `name` varchar(255) DEFAULT NULL,
+  `position` int(10) unsigned NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `quiz_rel_question`
+--
+
+DROP TABLE IF EXISTS `quiz_rel_question`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `quiz_rel_question` (
+  `question_id` mediumint(8) unsigned NOT NULL,
+  `exercice_id` mediumint(8) unsigned NOT NULL,
+  `question_order` mediumint(8) unsigned NOT NULL DEFAULT '1',
+  PRIMARY KEY (`question_id`,`exercice_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `resource`
+--
+
+DROP TABLE IF EXISTS `resource`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `resource` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `source_type` varchar(50) DEFAULT NULL,
+  `source_id` int(10) unsigned DEFAULT NULL,
+  `resource_type` varchar(50) DEFAULT NULL,
+  `resource_id` int(10) unsigned DEFAULT NULL,
+  UNIQUE KEY `id` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `role`
+--
+
+DROP TABLE IF EXISTS `role`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `role` (
+  `role_id` int(11) NOT NULL AUTO_INCREMENT,
+  `role_name` varchar(250) NOT NULL DEFAULT '',
+  `role_comment` text,
+  `default_role` tinyint(4) DEFAULT '0',
+  PRIMARY KEY (`role_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `role_group`
+--
+
+DROP TABLE IF EXISTS `role_group`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `role_group` (
+  `role_id` int(11) NOT NULL DEFAULT '0',
+  `scope` varchar(20) NOT NULL DEFAULT 'course',
+  `group_id` int(11) NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `role_permissions`
+--
+
+DROP TABLE IF EXISTS `role_permissions`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `role_permissions` (
+  `role_id` int(11) NOT NULL DEFAULT '0',
+  `tool` varchar(250) NOT NULL DEFAULT '',
+  `action` varchar(50) NOT NULL DEFAULT '',
+  `default_perm` tinyint(4) NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `role_user`
+--
+
+DROP TABLE IF EXISTS `role_user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `role_user` (
+  `role_id` int(11) NOT NULL DEFAULT '0',
+  `scope` varchar(20) NOT NULL DEFAULT 'course',
+  `user_id` int(11) NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `student_publication`
+--
+
+DROP TABLE IF EXISTS `student_publication`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `student_publication` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `url` varchar(255) DEFAULT NULL,
+  `title` varchar(255) DEFAULT NULL,
+  `description` text,
+  `author` varchar(255) DEFAULT NULL,
+  `active` tinyint(4) DEFAULT NULL,
+  `accepted` tinyint(4) DEFAULT '0',
+  `post_group_id` int(11) NOT NULL DEFAULT '0',
+  `sent_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `filetype` set('file','folder') NOT NULL DEFAULT 'file',
+  `has_properties` int(10) unsigned NOT NULL DEFAULT '0',
+  `view_properties` tinyint(4) DEFAULT NULL,
+  `qualification` float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  `date_of_qualification` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `parent_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `qualificator_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `weight` float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  `session_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `user_id` int(11) NOT NULL,
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `student_publication_assignment`
+--
+
+DROP TABLE IF EXISTS `student_publication_assignment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `student_publication_assignment` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `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(4) NOT NULL,
+  `enable_qualification` tinyint(4) NOT NULL,
+  `publication_id` int(11) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey`
+--
+
+DROP TABLE IF EXISTS `survey`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey` (
+  `survey_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `code` varchar(20) DEFAULT NULL,
+  `title` text,
+  `subtitle` text,
+  `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(11) NOT NULL,
+  `answered` int(11) 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,
+  `shuffle` tinyint(1) NOT NULL DEFAULT '0',
+  `one_question_per_page` tinyint(1) NOT NULL DEFAULT '0',
+  `survey_version` varchar(255) NOT NULL DEFAULT '',
+  `parent_id` int(10) unsigned NOT NULL,
+  `survey_type` int(11) NOT NULL DEFAULT '0',
+  `show_form_profile` int(11) NOT NULL DEFAULT '0',
+  `form_fields` text NOT NULL,
+  `session_id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`survey_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey_answer`
+--
+
+DROP TABLE IF EXISTS `survey_answer`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey_answer` (
+  `answer_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `survey_id` int(10) unsigned NOT NULL,
+  `question_id` int(10) unsigned NOT NULL,
+  `option_id` text NOT NULL,
+  `value` int(10) unsigned NOT NULL,
+  `user` varchar(250) NOT NULL,
+  PRIMARY KEY (`answer_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey_group`
+--
+
+DROP TABLE IF EXISTS `survey_group`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey_group` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `name` varchar(20) NOT NULL,
+  `description` varchar(255) NOT NULL,
+  `survey_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey_invitation`
+--
+
+DROP TABLE IF EXISTS `survey_invitation`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey_invitation` (
+  `survey_invitation_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `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(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`survey_invitation_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey_question`
+--
+
+DROP TABLE IF EXISTS `survey_question`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey_question` (
+  `question_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `survey_id` int(10) 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(11) NOT NULL,
+  `shared_question_id` int(11) DEFAULT NULL,
+  `max_value` int(11) DEFAULT NULL,
+  `survey_group_pri` int(10) unsigned NOT NULL DEFAULT '0',
+  `survey_group_sec1` int(10) unsigned NOT NULL DEFAULT '0',
+  `survey_group_sec2` int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`question_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey_question_option`
+--
+
+DROP TABLE IF EXISTS `survey_question_option`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey_question_option` (
+  `question_option_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `question_id` int(10) unsigned NOT NULL,
+  `survey_id` int(10) unsigned NOT NULL,
+  `option_text` text NOT NULL,
+  `sort` int(11) NOT NULL,
+  `value` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`question_option_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `thematic`
+--
+
+DROP TABLE IF EXISTS `thematic`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `thematic` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `title` varchar(255) NOT NULL,
+  `content` text,
+  `display_order` int(10) unsigned NOT NULL DEFAULT '0',
+  `active` tinyint(4) NOT NULL DEFAULT '0',
+  `session_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `active` (`active`,`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `thematic_advance`
+--
+
+DROP TABLE IF EXISTS `thematic_advance`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `thematic_advance` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `thematic_id` int(11) NOT NULL,
+  `attendance_id` int(11) NOT NULL DEFAULT '0',
+  `content` text,
+  `start_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `duration` int(11) NOT NULL DEFAULT '0',
+  `done_advance` tinyint(4) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `thematic_id` (`thematic_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `thematic_plan`
+--
+
+DROP TABLE IF EXISTS `thematic_plan`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `thematic_plan` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `thematic_id` int(11) NOT NULL,
+  `title` varchar(255) NOT NULL,
+  `description` text,
+  `description_type` int(11) NOT NULL,
+  PRIMARY KEY (`id`),
+  KEY `thematic_id` (`thematic_id`,`description_type`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `tool`
+--
+
+DROP TABLE IF EXISTS `tool`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `tool` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `name` varchar(255) NOT NULL,
+  `link` varchar(255) NOT NULL,
+  `image` varchar(255) DEFAULT NULL,
+  `visibility` tinyint(3) unsigned DEFAULT '0',
+  `admin` varchar(255) DEFAULT NULL,
+  `address` varchar(255) DEFAULT NULL,
+  `added_tool` tinyint(3) unsigned DEFAULT '1',
+  `target` enum('_self','_blank') NOT NULL DEFAULT '_self',
+  `category` varchar(20) NOT NULL DEFAULT 'authoring',
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `tool_intro`
+--
+
+DROP TABLE IF EXISTS `tool_intro`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `tool_intro` (
+  `id` varchar(50) NOT NULL,
+  `intro_text` text NOT NULL,
+  `session_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`,`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `userinfo_content`
+--
+
+DROP TABLE IF EXISTS `userinfo_content`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `userinfo_content` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `user_id` int(10) unsigned NOT NULL,
+  `definition_id` int(10) unsigned NOT NULL,
+  `editor_ip` varchar(39) DEFAULT NULL,
+  `edition_time` datetime DEFAULT NULL,
+  `content` text NOT NULL,
+  PRIMARY KEY (`id`),
+  KEY `user_id` (`user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `userinfo_def`
+--
+
+DROP TABLE IF EXISTS `userinfo_def`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `userinfo_def` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `title` varchar(80) NOT NULL DEFAULT '',
+  `comment` text,
+  `line_count` tinyint(3) unsigned NOT NULL DEFAULT '5',
+  `rank` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `wiki`
+--
+
+DROP TABLE IF EXISTS `wiki`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `wiki` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `page_id` int(11) NOT NULL DEFAULT '0',
+  `reflink` varchar(255) NOT NULL DEFAULT 'index',
+  `title` varchar(255) NOT NULL,
+  `content` mediumtext NOT NULL,
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  `group_id` int(11) DEFAULT NULL,
+  `dtime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `addlock` int(11) NOT NULL DEFAULT '1',
+  `editlock` int(11) NOT NULL DEFAULT '0',
+  `visibility` int(11) NOT NULL DEFAULT '1',
+  `addlock_disc` int(11) NOT NULL DEFAULT '1',
+  `visibility_disc` int(11) NOT NULL DEFAULT '1',
+  `ratinglock_disc` int(11) NOT NULL DEFAULT '1',
+  `assignment` int(11) NOT NULL DEFAULT '0',
+  `comment` text NOT NULL,
+  `progress` text NOT NULL,
+  `score` int(11) DEFAULT '0',
+  `version` int(11) DEFAULT NULL,
+  `is_editing` int(11) NOT NULL DEFAULT '0',
+  `time_edit` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `hits` int(11) DEFAULT '0',
+  `linksto` text NOT NULL,
+  `tag` text NOT NULL,
+  `user_ip` varchar(39) NOT NULL,
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `reflink` (`reflink`),
+  KEY `group_id` (`group_id`),
+  KEY `page_id` (`page_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `wiki_conf`
+--
+
+DROP TABLE IF EXISTS `wiki_conf`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `wiki_conf` (
+  `page_id` int(11) 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(11) DEFAULT NULL,
+  `max_text` int(11) DEFAULT NULL,
+  `max_version` int(11) 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(11) NOT NULL DEFAULT '0',
+  KEY `page_id` (`page_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `wiki_discuss`
+--
+
+DROP TABLE IF EXISTS `wiki_discuss`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `wiki_discuss` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `publication_id` int(11) NOT NULL DEFAULT '0',
+  `userc_id` int(11) 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`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `wiki_mailcue`
+--
+
+DROP TABLE IF EXISTS `wiki_mailcue`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `wiki_mailcue` (
+  `id` int(11) NOT NULL,
+  `user_id` int(11) NOT NULL,
+  `type` text NOT NULL,
+  `group_id` int(11) DEFAULT NULL,
+  `session_id` smallint(6) DEFAULT '0',
+  KEY `id` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2013-03-27 11:48:18

+ 1782 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.8.8/db_course2.sql

@@ -0,0 +1,1782 @@
+-- MySQL dump 10.13  Distrib 5.5.29, for debian-linux-gnu (i686)
+--
+-- Host: localhost    Database: chamilo1884
+-- ------------------------------------------------------
+-- Server version	5.5.29-0ubuntu0.12.10.1
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `announcement`
+--
+
+DROP TABLE IF EXISTS `announcement`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `announcement` (
+  `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+  `title` text,
+  `content` mediumtext,
+  `end_date` date DEFAULT NULL,
+  `display_order` mediumint(9) NOT NULL DEFAULT '0',
+  `email_sent` tinyint(4) DEFAULT '0',
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `announcement_attachment`
+--
+
+DROP TABLE IF EXISTS `announcement_attachment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `announcement_attachment` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `path` varchar(255) NOT NULL,
+  `comment` text,
+  `size` int(11) NOT NULL DEFAULT '0',
+  `announcement_id` int(11) NOT NULL,
+  `filename` varchar(255) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `attendance`
+--
+
+DROP TABLE IF EXISTS `attendance`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `attendance` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `name` text NOT NULL,
+  `description` text,
+  `active` tinyint(4) NOT NULL DEFAULT '1',
+  `attendance_qualify_title` varchar(255) DEFAULT NULL,
+  `attendance_qualify_max` int(11) NOT NULL DEFAULT '0',
+  `attendance_weight` float(6,2) NOT NULL DEFAULT '0.00',
+  `session_id` int(11) NOT NULL DEFAULT '0',
+  `locked` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`),
+  KEY `active` (`active`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `attendance_calendar`
+--
+
+DROP TABLE IF EXISTS `attendance_calendar`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `attendance_calendar` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `attendance_id` int(11) NOT NULL,
+  `date_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `done_attendance` tinyint(4) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `attendance_id` (`attendance_id`),
+  KEY `done_attendance` (`done_attendance`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `attendance_result`
+--
+
+DROP TABLE IF EXISTS `attendance_result`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `attendance_result` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `user_id` int(11) NOT NULL,
+  `attendance_id` int(11) NOT NULL,
+  `score` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `attendance_id` (`attendance_id`),
+  KEY `user_id` (`user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `attendance_sheet`
+--
+
+DROP TABLE IF EXISTS `attendance_sheet`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `attendance_sheet` (
+  `user_id` int(11) NOT NULL,
+  `attendance_calendar_id` int(11) NOT NULL,
+  `presence` tinyint(4) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`user_id`,`attendance_calendar_id`),
+  KEY `presence` (`presence`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `attendance_sheet_log`
+--
+
+DROP TABLE IF EXISTS `attendance_sheet_log`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `attendance_sheet_log` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `attendance_id` int(11) 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(11) NOT NULL DEFAULT '0',
+  `calendar_date_value` datetime DEFAULT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog`
+--
+
+DROP TABLE IF EXISTS `blog`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog` (
+  `blog_id` smallint(6) NOT NULL AUTO_INCREMENT,
+  `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(3) unsigned NOT NULL DEFAULT '0',
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`blog_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with blogs in this course';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_attachment`
+--
+
+DROP TABLE IF EXISTS `blog_attachment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_attachment` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `path` varchar(255) NOT NULL COMMENT 'the real filename',
+  `comment` text,
+  `size` int(11) NOT NULL DEFAULT '0',
+  `post_id` int(11) NOT NULL,
+  `filename` varchar(255) NOT NULL COMMENT 'the user s file name',
+  `blog_id` int(11) NOT NULL,
+  `comment_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_comment`
+--
+
+DROP TABLE IF EXISTS `blog_comment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_comment` (
+  `comment_id` int(11) NOT NULL AUTO_INCREMENT,
+  `title` varchar(250) NOT NULL DEFAULT '',
+  `comment` longtext NOT NULL,
+  `author_id` int(11) NOT NULL DEFAULT '0',
+  `date_creation` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `blog_id` mediumint(9) NOT NULL DEFAULT '0',
+  `post_id` int(11) NOT NULL DEFAULT '0',
+  `task_id` int(11) DEFAULT NULL,
+  `parent_comment_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`comment_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with comments on posts in a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_post`
+--
+
+DROP TABLE IF EXISTS `blog_post`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_post` (
+  `post_id` int(11) NOT NULL AUTO_INCREMENT,
+  `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` mediumint(9) NOT NULL DEFAULT '0',
+  `author_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`post_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with posts / blog.';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_rating`
+--
+
+DROP TABLE IF EXISTS `blog_rating`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_rating` (
+  `rating_id` int(11) NOT NULL AUTO_INCREMENT,
+  `blog_id` int(11) NOT NULL DEFAULT '0',
+  `rating_type` enum('post','comment') NOT NULL DEFAULT 'post',
+  `item_id` int(11) NOT NULL DEFAULT '0',
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  `rating` mediumint(9) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`rating_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with ratings for post/comments in a certain blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_rel_user`
+--
+
+DROP TABLE IF EXISTS `blog_rel_user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_rel_user` (
+  `blog_id` int(11) NOT NULL DEFAULT '0',
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`blog_id`,`user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table representing users subscribed to a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_task`
+--
+
+DROP TABLE IF EXISTS `blog_task`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_task` (
+  `task_id` mediumint(9) NOT NULL AUTO_INCREMENT,
+  `blog_id` mediumint(9) NOT NULL DEFAULT '0',
+  `title` varchar(250) NOT NULL DEFAULT '',
+  `description` text NOT NULL,
+  `color` varchar(10) NOT NULL DEFAULT '',
+  `system_task` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`task_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with tasks for a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `blog_task_rel_user`
+--
+
+DROP TABLE IF EXISTS `blog_task_rel_user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `blog_task_rel_user` (
+  `blog_id` mediumint(9) NOT NULL DEFAULT '0',
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  `task_id` mediumint(9) NOT NULL DEFAULT '0',
+  `target_date` date NOT NULL DEFAULT '0000-00-00',
+  PRIMARY KEY (`blog_id`,`user_id`,`task_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with tasks assigned to a user in a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `calendar_event`
+--
+
+DROP TABLE IF EXISTS `calendar_event`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `calendar_event` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `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(11) DEFAULT NULL,
+  `session_id` int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `calendar_event_attachment`
+--
+
+DROP TABLE IF EXISTS `calendar_event_attachment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `calendar_event_attachment` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `path` varchar(255) NOT NULL,
+  `comment` text,
+  `size` int(11) NOT NULL DEFAULT '0',
+  `agenda_id` int(11) NOT NULL,
+  `filename` varchar(255) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `calendar_event_repeat`
+--
+
+DROP TABLE IF EXISTS `calendar_event_repeat`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `calendar_event_repeat` (
+  `cal_id` int(11) NOT NULL DEFAULT '0',
+  `cal_type` varchar(20) DEFAULT NULL,
+  `cal_end` int(11) DEFAULT NULL,
+  `cal_frequency` int(11) DEFAULT '1',
+  `cal_days` char(7) DEFAULT NULL,
+  PRIMARY KEY (`cal_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `calendar_event_repeat_not`
+--
+
+DROP TABLE IF EXISTS `calendar_event_repeat_not`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `calendar_event_repeat_not` (
+  `cal_id` int(11) NOT NULL,
+  `cal_date` int(11) NOT NULL,
+  PRIMARY KEY (`cal_id`,`cal_date`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `chat_connected`
+--
+
+DROP TABLE IF EXISTS `chat_connected`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `chat_connected` (
+  `user_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `last_connection` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `session_id` int(11) NOT NULL DEFAULT '0',
+  `to_group_id` int(11) NOT NULL DEFAULT '0',
+  KEY `char_connected_index` (`user_id`,`session_id`,`to_group_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `course_description`
+--
+
+DROP TABLE IF EXISTS `course_description`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `course_description` (
+  `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
+  `title` varchar(255) DEFAULT NULL,
+  `content` text,
+  `session_id` smallint(6) DEFAULT '0',
+  `description_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `progress` int(11) NOT NULL DEFAULT '0',
+  UNIQUE KEY `id` (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `course_setting`
+--
+
+DROP TABLE IF EXISTS `course_setting`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `course_setting` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `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`)
+) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `document`
+--
+
+DROP TABLE IF EXISTS `document`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `document` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `path` varchar(255) NOT NULL DEFAULT '',
+  `comment` text,
+  `title` varchar(255) DEFAULT NULL,
+  `filetype` set('file','folder') NOT NULL DEFAULT 'file',
+  `size` int(11) NOT NULL DEFAULT '0',
+  `readonly` tinyint(3) unsigned NOT NULL,
+  `session_id` int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `dropbox_category`
+--
+
+DROP TABLE IF EXISTS `dropbox_category`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `dropbox_category` (
+  `cat_id` int(11) NOT NULL AUTO_INCREMENT,
+  `cat_name` text NOT NULL,
+  `received` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `sent` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(6) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`cat_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `dropbox_feedback`
+--
+
+DROP TABLE IF EXISTS `dropbox_feedback`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `dropbox_feedback` (
+  `feedback_id` int(11) NOT NULL AUTO_INCREMENT,
+  `file_id` int(11) NOT NULL DEFAULT '0',
+  `author_user_id` int(11) NOT NULL DEFAULT '0',
+  `feedback` text NOT NULL,
+  `feedback_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  PRIMARY KEY (`feedback_id`),
+  KEY `file_id` (`file_id`),
+  KEY `author_user_id` (`author_user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `dropbox_file`
+--
+
+DROP TABLE IF EXISTS `dropbox_file`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `dropbox_file` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `uploader_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `filename` varchar(250) NOT NULL DEFAULT '',
+  `filesize` int(10) 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(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(5) unsigned NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `UN_filename` (`filename`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `dropbox_person`
+--
+
+DROP TABLE IF EXISTS `dropbox_person`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `dropbox_person` (
+  `file_id` int(10) unsigned NOT NULL,
+  `user_id` int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`file_id`,`user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `dropbox_post`
+--
+
+DROP TABLE IF EXISTS `dropbox_post`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `dropbox_post` (
+  `file_id` int(10) unsigned NOT NULL,
+  `dest_user_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `feedback_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `feedback` text,
+  `cat_id` int(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(5) unsigned NOT NULL,
+  PRIMARY KEY (`file_id`,`dest_user_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_attachment`
+--
+
+DROP TABLE IF EXISTS `forum_attachment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_attachment` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `path` varchar(255) NOT NULL,
+  `comment` text,
+  `size` int(11) NOT NULL DEFAULT '0',
+  `post_id` int(11) NOT NULL,
+  `filename` varchar(255) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_category`
+--
+
+DROP TABLE IF EXISTS `forum_category`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_category` (
+  `cat_id` int(11) NOT NULL AUTO_INCREMENT,
+  `cat_title` varchar(255) NOT NULL DEFAULT '',
+  `cat_comment` text,
+  `cat_order` int(11) NOT NULL DEFAULT '0',
+  `locked` int(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`cat_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_forum`
+--
+
+DROP TABLE IF EXISTS `forum_forum`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_forum` (
+  `forum_id` int(11) NOT NULL AUTO_INCREMENT,
+  `forum_title` varchar(255) NOT NULL DEFAULT '',
+  `forum_comment` text,
+  `forum_threads` int(11) DEFAULT '0',
+  `forum_posts` int(11) DEFAULT '0',
+  `forum_last_post` int(11) DEFAULT '0',
+  `forum_category` int(11) DEFAULT NULL,
+  `allow_anonymous` int(11) DEFAULT NULL,
+  `allow_edit` int(11) DEFAULT NULL,
+  `approval_direct_post` varchar(20) DEFAULT NULL,
+  `allow_attachments` int(11) DEFAULT NULL,
+  `allow_new_threads` int(11) 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(11) DEFAULT NULL,
+  `locked` int(11) NOT NULL DEFAULT '0',
+  `session_id` int(11) 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`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_mailcue`
+--
+
+DROP TABLE IF EXISTS `forum_mailcue`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_mailcue` (
+  `thread_id` int(11) DEFAULT NULL,
+  `user_id` int(11) DEFAULT NULL,
+  `post_id` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_notification`
+--
+
+DROP TABLE IF EXISTS `forum_notification`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_notification` (
+  `user_id` int(11) DEFAULT NULL,
+  `forum_id` int(11) DEFAULT NULL,
+  `thread_id` int(11) DEFAULT NULL,
+  `post_id` int(11) DEFAULT NULL,
+  KEY `user_id` (`user_id`),
+  KEY `forum_id` (`forum_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_post`
+--
+
+DROP TABLE IF EXISTS `forum_post`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_post` (
+  `post_id` int(11) NOT NULL AUTO_INCREMENT,
+  `post_title` varchar(250) DEFAULT NULL,
+  `post_text` text,
+  `thread_id` int(11) DEFAULT '0',
+  `forum_id` int(11) DEFAULT '0',
+  `poster_id` int(11) DEFAULT '0',
+  `poster_name` varchar(100) DEFAULT '',
+  `post_date` datetime DEFAULT '0000-00-00 00:00:00',
+  `post_notification` tinyint(4) DEFAULT '0',
+  `post_parent_id` int(11) DEFAULT '0',
+  `visible` tinyint(4) DEFAULT '1',
+  PRIMARY KEY (`post_id`),
+  KEY `poster_id` (`poster_id`),
+  KEY `forum_id` (`forum_id`),
+  KEY `idx_forum_post_thread_id` (`thread_id`),
+  KEY `idx_forum_post_visible` (`visible`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_thread`
+--
+
+DROP TABLE IF EXISTS `forum_thread`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_thread` (
+  `thread_id` int(11) NOT NULL AUTO_INCREMENT,
+  `thread_title` varchar(255) DEFAULT NULL,
+  `forum_id` int(11) DEFAULT NULL,
+  `thread_replies` int(11) DEFAULT '0',
+  `thread_poster_id` int(11) DEFAULT NULL,
+  `thread_poster_name` varchar(100) DEFAULT '',
+  `thread_views` int(11) DEFAULT '0',
+  `thread_last_post` int(11) DEFAULT NULL,
+  `thread_date` datetime DEFAULT '0000-00-00 00:00:00',
+  `thread_sticky` tinyint(3) unsigned DEFAULT '0',
+  `locked` int(11) NOT NULL DEFAULT '0',
+  `session_id` int(10) unsigned DEFAULT NULL,
+  `thread_title_qualify` varchar(255) DEFAULT '',
+  `thread_qualify_max` float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  `thread_close_date` datetime DEFAULT '0000-00-00 00:00:00',
+  `thread_weight` float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  PRIMARY KEY (`thread_id`),
+  KEY `idx_forum_thread_forum_id` (`forum_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_thread_qualify`
+--
+
+DROP TABLE IF EXISTS `forum_thread_qualify`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_thread_qualify` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `user_id` int(10) unsigned NOT NULL,
+  `thread_id` int(11) NOT NULL,
+  `qualify` float(6,2) NOT NULL DEFAULT '0.00',
+  `qualify_user_id` int(11) DEFAULT NULL,
+  `qualify_time` datetime DEFAULT '0000-00-00 00:00:00',
+  `session_id` int(11) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `user_id` (`user_id`,`thread_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `forum_thread_qualify_log`
+--
+
+DROP TABLE IF EXISTS `forum_thread_qualify_log`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `forum_thread_qualify_log` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `user_id` int(10) unsigned NOT NULL,
+  `thread_id` int(11) NOT NULL,
+  `qualify` float(6,2) NOT NULL DEFAULT '0.00',
+  `qualify_user_id` int(11) DEFAULT NULL,
+  `qualify_time` datetime DEFAULT '0000-00-00 00:00:00',
+  `session_id` int(11) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `user_id` (`user_id`,`thread_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `glossary`
+--
+
+DROP TABLE IF EXISTS `glossary`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `glossary` (
+  `glossary_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `name` varchar(255) NOT NULL,
+  `description` text NOT NULL,
+  `display_order` int(11) DEFAULT NULL,
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`glossary_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `group_category`
+--
+
+DROP TABLE IF EXISTS `group_category`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `group_category` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `title` varchar(255) NOT NULL DEFAULT '',
+  `description` text NOT NULL,
+  `doc_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `calendar_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `work_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `announcements_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `forum_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `wiki_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `chat_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `max_student` smallint(5) unsigned NOT NULL DEFAULT '8',
+  `self_reg_allowed` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `self_unreg_allowed` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `groups_per_user` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `display_order` smallint(5) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `group_info`
+--
+
+DROP TABLE IF EXISTS `group_info`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `group_info` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `name` varchar(100) DEFAULT NULL,
+  `category_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `description` text,
+  `max_student` smallint(5) unsigned NOT NULL DEFAULT '8',
+  `doc_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `calendar_state` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `work_state` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `announcements_state` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `forum_state` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `wiki_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `chat_state` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `secret_directory` varchar(255) DEFAULT NULL,
+  `self_registration_allowed` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `self_unregistration_allowed` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `session_id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `group_rel_tutor`
+--
+
+DROP TABLE IF EXISTS `group_rel_tutor`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `group_rel_tutor` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `user_id` int(11) NOT NULL,
+  `group_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `group_rel_user`
+--
+
+DROP TABLE IF EXISTS `group_rel_user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `group_rel_user` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `user_id` int(10) unsigned NOT NULL,
+  `group_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `status` int(11) NOT NULL DEFAULT '0',
+  `role` char(50) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `item_property`
+--
+
+DROP TABLE IF EXISTS `item_property`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `item_property` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `tool` varchar(100) NOT NULL DEFAULT '',
+  `insert_user_id` int(10) 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(11) NOT NULL DEFAULT '0',
+  `lastedit_type` varchar(100) NOT NULL DEFAULT '',
+  `lastedit_user_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `to_group_id` int(10) unsigned DEFAULT NULL,
+  `to_user_id` int(10) unsigned DEFAULT NULL,
+  `visibility` tinyint(4) 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(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `idx_item_property_toolref` (`tool`,`ref`)
+) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `link`
+--
+
+DROP TABLE IF EXISTS `link`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `link` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `url` text NOT NULL,
+  `title` varchar(150) DEFAULT NULL,
+  `description` text,
+  `category_id` smallint(5) unsigned DEFAULT NULL,
+  `display_order` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `on_homepage` enum('0','1') NOT NULL DEFAULT '0',
+  `target` char(10) DEFAULT '_self',
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `link_category`
+--
+
+DROP TABLE IF EXISTS `link_category`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `link_category` (
+  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
+  `category_title` varchar(255) NOT NULL,
+  `description` text,
+  `display_order` mediumint(8) unsigned NOT NULL DEFAULT '0',
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp`
+--
+
+DROP TABLE IF EXISTS `lp`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `lp_type` smallint(5) unsigned NOT NULL,
+  `name` varchar(255) NOT NULL,
+  `ref` tinytext,
+  `description` text,
+  `path` text NOT NULL,
+  `force_commit` tinyint(3) 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(10) unsigned NOT NULL DEFAULT '0',
+  `content_maker` tinytext NOT NULL,
+  `content_local` varchar(32) NOT NULL DEFAULT 'local',
+  `content_license` text NOT NULL,
+  `prevent_reinit` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `js_lib` tinytext NOT NULL,
+  `debug` tinyint(3) 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(10) unsigned NOT NULL DEFAULT '0',
+  `prerequisite` int(10) unsigned NOT NULL DEFAULT '0',
+  `use_max_score` int(10) unsigned NOT NULL DEFAULT '1',
+  `autolunch` int(10) 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`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp_item`
+--
+
+DROP TABLE IF EXISTS `lp_item`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp_item` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `lp_id` int(10) unsigned NOT NULL,
+  `item_type` char(32) NOT NULL DEFAULT 'dokeos_document',
+  `ref` tinytext NOT NULL,
+  `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 DEFAULT NULL,
+  `parent_item_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `previous_item_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `next_item_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `display_order` int(10) unsigned NOT NULL DEFAULT '0',
+  `prerequisite` text,
+  `parameters` text,
+  `launch_data` text NOT NULL,
+  `max_time_allowed` char(13) DEFAULT '',
+  `terms` text,
+  `search_did` int(11) DEFAULT NULL,
+  `audio` varchar(250) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `lp_id` (`lp_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp_item_view`
+--
+
+DROP TABLE IF EXISTS `lp_item_view`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp_item_view` (
+  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+  `lp_item_id` int(10) unsigned NOT NULL,
+  `lp_view_id` int(10) unsigned NOT NULL,
+  `view_count` int(10) unsigned NOT NULL DEFAULT '0',
+  `start_time` int(10) unsigned NOT NULL,
+  `total_time` int(10) unsigned NOT NULL DEFAULT '0',
+  `score` float unsigned NOT NULL DEFAULT '0',
+  `status` char(32) NOT NULL DEFAULT 'not attempted',
+  `suspend_data` text,
+  `lesson_location` text,
+  `core_exit` varchar(32) NOT NULL DEFAULT 'none',
+  `max_score` varchar(8) DEFAULT '',
+  PRIMARY KEY (`id`),
+  KEY `lp_item_id` (`lp_item_id`),
+  KEY `lp_view_id` (`lp_view_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp_iv_interaction`
+--
+
+DROP TABLE IF EXISTS `lp_iv_interaction`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp_iv_interaction` (
+  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+  `order_id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `lp_iv_id` bigint(20) 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,
+  `student_response` text NOT NULL,
+  `result` varchar(255) NOT NULL DEFAULT '',
+  `latency` varchar(16) NOT NULL DEFAULT '',
+  PRIMARY KEY (`id`),
+  KEY `lp_iv_id` (`lp_iv_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp_iv_objective`
+--
+
+DROP TABLE IF EXISTS `lp_iv_objective`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp_iv_objective` (
+  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+  `lp_iv_id` bigint(20) unsigned NOT NULL,
+  `order_id` smallint(5) 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`),
+  KEY `lp_iv_id` (`lp_iv_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `lp_view`
+--
+
+DROP TABLE IF EXISTS `lp_view`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `lp_view` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `lp_id` int(10) unsigned NOT NULL,
+  `user_id` int(10) unsigned NOT NULL,
+  `view_count` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `last_item` int(10) unsigned NOT NULL DEFAULT '0',
+  `progress` int(10) unsigned DEFAULT '0',
+  `session_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `lp_id` (`lp_id`),
+  KEY `user_id` (`user_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `notebook`
+--
+
+DROP TABLE IF EXISTS `notebook`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `notebook` (
+  `notebook_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `user_id` int(10) unsigned NOT NULL,
+  `course` varchar(40) NOT NULL,
+  `session_id` int(11) 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(11) DEFAULT NULL,
+  PRIMARY KEY (`notebook_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `online_connected`
+--
+
+DROP TABLE IF EXISTS `online_connected`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `online_connected` (
+  `user_id` int(10) unsigned NOT NULL,
+  `last_connection` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  PRIMARY KEY (`user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `online_link`
+--
+
+DROP TABLE IF EXISTS `online_link`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `online_link` (
+  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
+  `name` char(50) NOT NULL DEFAULT '',
+  `url` char(100) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `permission_group`
+--
+
+DROP TABLE IF EXISTS `permission_group`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `permission_group` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `group_id` int(11) NOT NULL DEFAULT '0',
+  `tool` varchar(250) NOT NULL DEFAULT '',
+  `action` varchar(250) NOT NULL DEFAULT '',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `permission_task`
+--
+
+DROP TABLE IF EXISTS `permission_task`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `permission_task` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `task_id` int(11) NOT NULL DEFAULT '0',
+  `tool` varchar(250) NOT NULL DEFAULT '',
+  `action` varchar(250) NOT NULL DEFAULT '',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `permission_user`
+--
+
+DROP TABLE IF EXISTS `permission_user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `permission_user` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  `tool` varchar(250) NOT NULL DEFAULT '',
+  `action` varchar(250) NOT NULL DEFAULT '',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `quiz`
+--
+
+DROP TABLE IF EXISTS `quiz`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `quiz` (
+  `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+  `title` varchar(255) NOT NULL,
+  `description` text,
+  `sound` varchar(255) DEFAULT NULL,
+  `type` tinyint(3) unsigned NOT NULL DEFAULT '1',
+  `random` smallint(6) NOT NULL DEFAULT '0',
+  `random_answers` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `active` tinyint(4) NOT NULL DEFAULT '0',
+  `results_disabled` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `access_condition` text,
+  `max_attempt` int(11) 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(11) NOT NULL DEFAULT '0',
+  `expired_time` int(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(6) DEFAULT '0',
+  `propagate_neg` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `quiz_answer`
+--
+
+DROP TABLE IF EXISTS `quiz_answer`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `quiz_answer` (
+  `id` mediumint(8) unsigned NOT NULL,
+  `question_id` mediumint(8) unsigned NOT NULL,
+  `answer` text NOT NULL,
+  `correct` mediumint(8) unsigned DEFAULT NULL,
+  `comment` text,
+  `ponderation` float(6,2) NOT NULL DEFAULT '0.00',
+  `position` mediumint(8) unsigned NOT NULL DEFAULT '1',
+  `hotspot_coordinates` text,
+  `hotspot_type` enum('square','circle','poly','delineation','oar') DEFAULT NULL,
+  `destination` text NOT NULL,
+  `id_auto` int(11) NOT NULL AUTO_INCREMENT,
+  PRIMARY KEY (`id`,`question_id`),
+  UNIQUE KEY `id_auto` (`id_auto`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `quiz_question`
+--
+
+DROP TABLE IF EXISTS `quiz_question`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `quiz_question` (
+  `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+  `question` text NOT NULL,
+  `description` text,
+  `ponderation` float(6,2) NOT NULL DEFAULT '0.00',
+  `position` mediumint(8) unsigned NOT NULL DEFAULT '1',
+  `type` tinyint(3) unsigned NOT NULL DEFAULT '2',
+  `picture` varchar(50) DEFAULT NULL,
+  `level` int(10) unsigned NOT NULL DEFAULT '0',
+  `extra` varchar(255) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `position` (`position`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `quiz_question_option`
+--
+
+DROP TABLE IF EXISTS `quiz_question_option`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `quiz_question_option` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `question_id` int(11) NOT NULL,
+  `name` varchar(255) DEFAULT NULL,
+  `position` int(10) unsigned NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `quiz_rel_question`
+--
+
+DROP TABLE IF EXISTS `quiz_rel_question`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `quiz_rel_question` (
+  `question_id` mediumint(8) unsigned NOT NULL,
+  `exercice_id` mediumint(8) unsigned NOT NULL,
+  `question_order` mediumint(8) unsigned NOT NULL DEFAULT '1',
+  PRIMARY KEY (`question_id`,`exercice_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `resource`
+--
+
+DROP TABLE IF EXISTS `resource`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `resource` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `source_type` varchar(50) DEFAULT NULL,
+  `source_id` int(10) unsigned DEFAULT NULL,
+  `resource_type` varchar(50) DEFAULT NULL,
+  `resource_id` int(10) unsigned DEFAULT NULL,
+  UNIQUE KEY `id` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `role`
+--
+
+DROP TABLE IF EXISTS `role`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `role` (
+  `role_id` int(11) NOT NULL AUTO_INCREMENT,
+  `role_name` varchar(250) NOT NULL DEFAULT '',
+  `role_comment` text,
+  `default_role` tinyint(4) DEFAULT '0',
+  PRIMARY KEY (`role_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `role_group`
+--
+
+DROP TABLE IF EXISTS `role_group`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `role_group` (
+  `role_id` int(11) NOT NULL DEFAULT '0',
+  `scope` varchar(20) NOT NULL DEFAULT 'course',
+  `group_id` int(11) NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `role_permissions`
+--
+
+DROP TABLE IF EXISTS `role_permissions`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `role_permissions` (
+  `role_id` int(11) NOT NULL DEFAULT '0',
+  `tool` varchar(250) NOT NULL DEFAULT '',
+  `action` varchar(50) NOT NULL DEFAULT '',
+  `default_perm` tinyint(4) NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `role_user`
+--
+
+DROP TABLE IF EXISTS `role_user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `role_user` (
+  `role_id` int(11) NOT NULL DEFAULT '0',
+  `scope` varchar(20) NOT NULL DEFAULT 'course',
+  `user_id` int(11) NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `student_publication`
+--
+
+DROP TABLE IF EXISTS `student_publication`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `student_publication` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `url` varchar(255) DEFAULT NULL,
+  `title` varchar(255) DEFAULT NULL,
+  `description` text,
+  `author` varchar(255) DEFAULT NULL,
+  `active` tinyint(4) DEFAULT NULL,
+  `accepted` tinyint(4) DEFAULT '0',
+  `post_group_id` int(11) NOT NULL DEFAULT '0',
+  `sent_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `filetype` set('file','folder') NOT NULL DEFAULT 'file',
+  `has_properties` int(10) unsigned NOT NULL DEFAULT '0',
+  `view_properties` tinyint(4) DEFAULT NULL,
+  `qualification` float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  `date_of_qualification` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `parent_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `qualificator_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `weight` float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  `session_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `user_id` int(11) NOT NULL,
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `student_publication_assignment`
+--
+
+DROP TABLE IF EXISTS `student_publication_assignment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `student_publication_assignment` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `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(4) NOT NULL,
+  `enable_qualification` tinyint(4) NOT NULL,
+  `publication_id` int(11) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey`
+--
+
+DROP TABLE IF EXISTS `survey`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey` (
+  `survey_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `code` varchar(20) DEFAULT NULL,
+  `title` text,
+  `subtitle` text,
+  `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(11) NOT NULL,
+  `answered` int(11) 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,
+  `shuffle` tinyint(1) NOT NULL DEFAULT '0',
+  `one_question_per_page` tinyint(1) NOT NULL DEFAULT '0',
+  `survey_version` varchar(255) NOT NULL DEFAULT '',
+  `parent_id` int(10) unsigned NOT NULL,
+  `survey_type` int(11) NOT NULL DEFAULT '0',
+  `show_form_profile` int(11) NOT NULL DEFAULT '0',
+  `form_fields` text NOT NULL,
+  `session_id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`survey_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey_answer`
+--
+
+DROP TABLE IF EXISTS `survey_answer`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey_answer` (
+  `answer_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `survey_id` int(10) unsigned NOT NULL,
+  `question_id` int(10) unsigned NOT NULL,
+  `option_id` text NOT NULL,
+  `value` int(10) unsigned NOT NULL,
+  `user` varchar(250) NOT NULL,
+  PRIMARY KEY (`answer_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey_group`
+--
+
+DROP TABLE IF EXISTS `survey_group`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey_group` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `name` varchar(20) NOT NULL,
+  `description` varchar(255) NOT NULL,
+  `survey_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey_invitation`
+--
+
+DROP TABLE IF EXISTS `survey_invitation`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey_invitation` (
+  `survey_invitation_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `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(11) NOT NULL DEFAULT '0',
+  `session_id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`survey_invitation_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey_question`
+--
+
+DROP TABLE IF EXISTS `survey_question`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey_question` (
+  `question_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `survey_id` int(10) 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(11) NOT NULL,
+  `shared_question_id` int(11) DEFAULT NULL,
+  `max_value` int(11) DEFAULT NULL,
+  `survey_group_pri` int(10) unsigned NOT NULL DEFAULT '0',
+  `survey_group_sec1` int(10) unsigned NOT NULL DEFAULT '0',
+  `survey_group_sec2` int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`question_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `survey_question_option`
+--
+
+DROP TABLE IF EXISTS `survey_question_option`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `survey_question_option` (
+  `question_option_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `question_id` int(10) unsigned NOT NULL,
+  `survey_id` int(10) unsigned NOT NULL,
+  `option_text` text NOT NULL,
+  `sort` int(11) NOT NULL,
+  `value` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`question_option_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `thematic`
+--
+
+DROP TABLE IF EXISTS `thematic`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `thematic` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `title` varchar(255) NOT NULL,
+  `content` text,
+  `display_order` int(10) unsigned NOT NULL DEFAULT '0',
+  `active` tinyint(4) NOT NULL DEFAULT '0',
+  `session_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `active` (`active`,`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `thematic_advance`
+--
+
+DROP TABLE IF EXISTS `thematic_advance`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `thematic_advance` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `thematic_id` int(11) NOT NULL,
+  `attendance_id` int(11) NOT NULL DEFAULT '0',
+  `content` text,
+  `start_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `duration` int(11) NOT NULL DEFAULT '0',
+  `done_advance` tinyint(4) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `thematic_id` (`thematic_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `thematic_plan`
+--
+
+DROP TABLE IF EXISTS `thematic_plan`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `thematic_plan` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `thematic_id` int(11) NOT NULL,
+  `title` varchar(255) NOT NULL,
+  `description` text,
+  `description_type` int(11) NOT NULL,
+  PRIMARY KEY (`id`),
+  KEY `thematic_id` (`thematic_id`,`description_type`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `tool`
+--
+
+DROP TABLE IF EXISTS `tool`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `tool` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `name` varchar(255) NOT NULL,
+  `link` varchar(255) NOT NULL,
+  `image` varchar(255) DEFAULT NULL,
+  `visibility` tinyint(3) unsigned DEFAULT '0',
+  `admin` varchar(255) DEFAULT NULL,
+  `address` varchar(255) DEFAULT NULL,
+  `added_tool` tinyint(3) unsigned DEFAULT '1',
+  `target` enum('_self','_blank') NOT NULL DEFAULT '_self',
+  `category` varchar(20) NOT NULL DEFAULT 'authoring',
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `tool_intro`
+--
+
+DROP TABLE IF EXISTS `tool_intro`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `tool_intro` (
+  `id` varchar(50) NOT NULL,
+  `intro_text` text NOT NULL,
+  `session_id` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`,`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `userinfo_content`
+--
+
+DROP TABLE IF EXISTS `userinfo_content`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `userinfo_content` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `user_id` int(10) unsigned NOT NULL,
+  `definition_id` int(10) unsigned NOT NULL,
+  `editor_ip` varchar(39) DEFAULT NULL,
+  `edition_time` datetime DEFAULT NULL,
+  `content` text NOT NULL,
+  PRIMARY KEY (`id`),
+  KEY `user_id` (`user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `userinfo_def`
+--
+
+DROP TABLE IF EXISTS `userinfo_def`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `userinfo_def` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `title` varchar(80) NOT NULL DEFAULT '',
+  `comment` text,
+  `line_count` tinyint(3) unsigned NOT NULL DEFAULT '5',
+  `rank` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `wiki`
+--
+
+DROP TABLE IF EXISTS `wiki`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `wiki` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `page_id` int(11) NOT NULL DEFAULT '0',
+  `reflink` varchar(255) NOT NULL DEFAULT 'index',
+  `title` varchar(255) NOT NULL,
+  `content` mediumtext NOT NULL,
+  `user_id` int(11) NOT NULL DEFAULT '0',
+  `group_id` int(11) DEFAULT NULL,
+  `dtime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `addlock` int(11) NOT NULL DEFAULT '1',
+  `editlock` int(11) NOT NULL DEFAULT '0',
+  `visibility` int(11) NOT NULL DEFAULT '1',
+  `addlock_disc` int(11) NOT NULL DEFAULT '1',
+  `visibility_disc` int(11) NOT NULL DEFAULT '1',
+  `ratinglock_disc` int(11) NOT NULL DEFAULT '1',
+  `assignment` int(11) NOT NULL DEFAULT '0',
+  `comment` text NOT NULL,
+  `progress` text NOT NULL,
+  `score` int(11) DEFAULT '0',
+  `version` int(11) DEFAULT NULL,
+  `is_editing` int(11) NOT NULL DEFAULT '0',
+  `time_edit` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `hits` int(11) DEFAULT '0',
+  `linksto` text NOT NULL,
+  `tag` text NOT NULL,
+  `user_ip` varchar(39) NOT NULL,
+  `session_id` smallint(6) DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `reflink` (`reflink`),
+  KEY `group_id` (`group_id`),
+  KEY `page_id` (`page_id`),
+  KEY `session_id` (`session_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `wiki_conf`
+--
+
+DROP TABLE IF EXISTS `wiki_conf`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `wiki_conf` (
+  `page_id` int(11) 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(11) DEFAULT NULL,
+  `max_text` int(11) DEFAULT NULL,
+  `max_version` int(11) 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(11) NOT NULL DEFAULT '0',
+  KEY `page_id` (`page_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `wiki_discuss`
+--
+
+DROP TABLE IF EXISTS `wiki_discuss`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `wiki_discuss` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `publication_id` int(11) NOT NULL DEFAULT '0',
+  `userc_id` int(11) 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`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `wiki_mailcue`
+--
+
+DROP TABLE IF EXISTS `wiki_mailcue`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `wiki_mailcue` (
+  `id` int(11) NOT NULL,
+  `user_id` int(11) NOT NULL,
+  `type` text NOT NULL,
+  `group_id` int(11) DEFAULT NULL,
+  `session_id` smallint(6) DEFAULT '0',
+  KEY `id` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2013-03-27 11:48:31

+ 2648 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.8.8/db_main.sql

@@ -0,0 +1,2648 @@
+-- MySQL dump 10.9
+--
+-- Host: localhost    Database: chamilo_main
+-- ------------------------------------------------------
+-- Server version	4.1.14
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+
+--
+-- Table structure for table user
+--
+
+DROP TABLE IF EXISTS user;
+CREATE TABLE user (
+  user_id int unsigned NOT NULL auto_increment,
+  lastname varchar(60) default NULL,
+  firstname varchar(60) default NULL,
+  username varchar(40) NOT NULL default '',
+  password varchar(50) NOT NULL default '',
+  auth_source varchar(50) default 'platform',
+  email varchar(100) default NULL,
+  status tinyint NOT NULL default '5',
+  official_code varchar(40) default NULL,
+  phone varchar(30) default NULL,
+  picture_uri varchar(250) default NULL,
+  creator_id int unsigned default NULL,
+  competences text,
+  diplomas text,
+  openarea text,
+  teach text,
+  productions varchar(250) default NULL,
+  chatcall_user_id int unsigned NOT NULL default '0',
+  chatcall_date datetime NOT NULL default '0000-00-00 00:00:00',
+  chatcall_text varchar(50) NOT NULL default '',
+  language varchar(40) default NULL,
+  registration_date datetime NOT NULL default '0000-00-00 00:00:00',
+  expiration_date datetime NOT NULL default '0000-00-00 00:00:00',
+  active tinyint unsigned NOT NULL default 1,
+  openid varchar(255) DEFAULT NULL,
+  theme varchar(255) DEFAULT NULL,
+  hr_dept_id smallint unsigned NOT NULL default 0,
+  PRIMARY KEY  (user_id),
+  UNIQUE KEY username (username)
+);
+ALTER TABLE user ADD INDEX (status);
+
+--
+-- Dumping data for table user
+--
+
+/*!40000 ALTER TABLE user DISABLE KEYS */;
+LOCK TABLES user WRITE;
+INSERT INTO user (lastname, firstname, username, password, auth_source, email, status, official_code,phone, creator_id, registration_date, expiration_date,active,openid,language) VALUES ('{ADMINLASTNAME}','{ADMINFIRSTNAME}','{ADMINLOGIN}','{ADMINPASSWORD}','{PLATFORM_AUTH_SOURCE}','{ADMINEMAIL}',1,'ADMIN','{ADMINPHONE}',1,NOW(),'0000-00-00 00:00:00','1',NULL,'{ADMINLANGUAGE}');
+-- Insert anonymous user
+INSERT INTO user (lastname, firstname, username, password, auth_source, email, status, official_code, creator_id, registration_date, expiration_date,active,openid,language) VALUES ('Anonymous', 'Joe', '', '', 'platform', 'anonymous@localhost', 6, 'anonymous', 1, NOW(), '0000-00-00 00:00:00', 1,NULL,'{ADMINLANGUAGE}');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE user ENABLE KEYS */;
+
+--
+-- Table structure for table admin
+--
+
+DROP TABLE IF EXISTS admin;
+CREATE TABLE admin (
+  user_id int unsigned NOT NULL default '0',
+  UNIQUE KEY user_id (user_id)
+);
+
+--
+-- Dumping data for table admin
+--
+
+
+/*!40000 ALTER TABLE admin DISABLE KEYS */;
+LOCK TABLES admin WRITE;
+INSERT INTO admin VALUES (1);
+UNLOCK TABLES;
+/*!40000 ALTER TABLE admin ENABLE KEYS */;
+
+--
+-- Table structure for table class
+--
+
+DROP TABLE IF EXISTS class;
+CREATE TABLE class (
+  id mediumint unsigned NOT NULL auto_increment,
+  code varchar(40) default '',
+  name text NOT NULL,
+  PRIMARY KEY  (id)
+);
+
+--
+-- Dumping data for table class
+--
+
+
+/*!40000 ALTER TABLE class DISABLE KEYS */;
+LOCK TABLES class WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE class ENABLE KEYS */;
+
+--
+-- Table structure for table class_user
+--
+
+DROP TABLE IF EXISTS class_user;
+CREATE TABLE class_user (
+  class_id mediumint unsigned NOT NULL default '0',
+  user_id int unsigned NOT NULL default '0',
+  PRIMARY KEY  (class_id,user_id)
+);
+
+--
+-- Dumping data for table class_user
+--
+
+
+/*!40000 ALTER TABLE class_user DISABLE KEYS */;
+LOCK TABLES class_user WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE class_user ENABLE KEYS */;
+
+--
+-- Table structure for table course
+--
+
+DROP TABLE IF EXISTS course;
+CREATE TABLE course (
+  id int auto_increment,
+  code varchar(40) NOT NULL,
+  directory varchar(40) default NULL,
+  db_name varchar(40) default NULL,
+  course_language varchar(20) default NULL,
+  title varchar(250) default NULL,
+  description text,
+  category_code varchar(40) default NULL,
+  visibility tinyint default '0',
+  show_score int NOT NULL default '1',
+  tutor_name varchar(200) default NULL,
+  visual_code varchar(40) default NULL,
+  department_name varchar(30) default NULL,
+  department_url varchar(180) default NULL,
+  disk_quota int unsigned default NULL,
+  last_visit datetime default NULL,
+  last_edit datetime default NULL,
+  creation_date datetime default NULL,
+  expiration_date datetime default NULL,
+  target_course_code varchar(40) default NULL,
+  subscribe tinyint NOT NULL default '1',
+  unsubscribe tinyint NOT NULL default '1',
+  registration_code varchar(255) NOT NULL default '',
+  PRIMARY KEY (id),
+  UNIQUE KEY code (code)
+);
+ALTER TABLE course ADD INDEX idx_course_category_code (category_code);
+ALTER TABLE course ADD INDEX idx_course_directory (directory(10));
+--
+-- Dumping data for table course
+--
+
+
+/*!40000 ALTER TABLE course DISABLE KEYS */;
+LOCK TABLES course WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE course ENABLE KEYS */;
+
+--
+-- Table structure for table course_category
+--
+
+DROP TABLE IF EXISTS course_category;
+CREATE TABLE course_category (
+  id int unsigned NOT NULL auto_increment,
+  name varchar(100) NOT NULL default '',
+  code varchar(40) NOT NULL default '',
+  parent_id varchar(40) default NULL,
+  tree_pos int unsigned default NULL,
+  children_count smallint default NULL,
+  auth_course_child enum('TRUE','FALSE') default 'TRUE',
+  auth_cat_child enum('TRUE','FALSE') default 'TRUE',
+  PRIMARY KEY  (id),
+  UNIQUE KEY code (code),
+  KEY parent_id (parent_id),
+  KEY tree_pos (tree_pos)
+);
+
+--
+-- Dumping data for table course_category
+--
+
+
+/*!40000 ALTER TABLE course_category DISABLE KEYS */;
+LOCK TABLES course_category WRITE;
+INSERT INTO course_category VALUES (1,'Language skills','LANG',NULL,1,0,'TRUE','TRUE'),(2,'PC Skills','PC',NULL,2,0,'TRUE','TRUE'),(3,'Projects','PROJ',NULL,3,0,'TRUE','TRUE');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE course_category ENABLE KEYS */;
+
+--
+-- Table structure for table course_field
+--
+
+DROP TABLE IF EXISTS course_field;
+CREATE TABLE course_field (
+    id  int NOT NULL auto_increment,
+    field_type int NOT NULL default 1,
+    field_variable  varchar(64) NOT NULL,
+    field_display_text  varchar(64),
+    field_default_value text,
+    field_order int,
+    field_visible tinyint default 0,
+    field_changeable tinyint default 0,
+    field_filter tinyint default 0,
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+--
+-- Table structure for table course_field_values
+--
+
+DROP TABLE IF EXISTS course_field_values;
+CREATE TABLE course_field_values(
+    id  int NOT NULL auto_increment,
+    course_code varchar(40) NOT NULL,
+    field_id int NOT NULL,
+    field_value text,
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+
+--
+-- Table structure for table course_module
+--
+
+DROP TABLE IF EXISTS course_module;
+CREATE TABLE course_module (
+  id int unsigned NOT NULL auto_increment,
+  name varchar(255) NOT NULL,
+  link varchar(255) NOT NULL,
+  image varchar(100) default NULL,
+  `row` int unsigned NOT NULL default '0',
+  `column` int unsigned NOT NULL default '0',
+  position varchar(20) NOT NULL default 'basic',
+  PRIMARY KEY  (id)
+);
+
+--
+-- Dumping data for table course_module
+--
+
+
+/*!40000 ALTER TABLE course_module DISABLE KEYS */;
+LOCK TABLES course_module WRITE;
+INSERT INTO course_module VALUES
+(1,'calendar_event','calendar/agenda.php','agenda.gif',1,1,'basic'),
+(2,'link','link/link.php','links.gif',4,1,'basic'),
+(3,'document','document/document.php','documents.gif',3,1,'basic'),
+(4,'student_publication','work/work.php','works.gif',3,2,'basic'),
+(5,'announcement','announcements/announcements.php','valves.gif',2,1,'basic'),
+(6,'user','user/user.php','members.gif',2,3,'basic'),
+(7,'forum','forum/index.php','forum.gif',1,2,'basic'),
+(8,'quiz','exercice/exercice.php','quiz.gif',2,2,'basic'),
+(9,'group','group/group.php','group.gif',3,3,'basic'),
+(10,'course_description','course_description/','info.gif',1,3,'basic'),
+(11,'chat','chat/chat.php','chat.gif',0,0,'external'),
+(12,'dropbox','dropbox/index.php','dropbox.gif',4,2,'basic'),
+(13,'tracking','tracking/courseLog.php','statistics.gif',1,3,'courseadmin'),
+(14,'homepage_link','link/link.php?action=addlink','npage.gif',1,1,'courseadmin'),
+(15,'course_setting','course_info/infocours.php','reference.gif',1,1,'courseadmin'),
+(16,'External','','external.gif',0,0,'external'),
+(17,'AddedLearnpath','','scormbuilder.gif',0,0,'external'),
+(18,'conference','conference/index.php?type=conference','conf.gif',0,0,'external'),
+(19,'conference','conference/index.php?type=classroom','conf.gif',0,0,'external'),
+(20,'learnpath','newscorm/lp_controller.php','scorms.gif',5,1,'basic'),
+(21,'blog','blog/blog.php','blog.gif',1,2,'basic'),
+(22,'blog_management','blog/blog_admin.php','blog_admin.gif',1,2,'courseadmin'),
+(23,'course_maintenance','course_info/maintenance.php','backup.gif',2,3,'courseadmin'),
+(24,'survey','survey/survey_list.php','survey.gif',2,1,'basic'),
+(25,'wiki','wiki/index.php','wiki.gif',2,3,'basic'),
+(26,'gradebook','gradebook/index.php','gradebook.gif',2,2,'basic'),
+(27,'glossary','glossary/index.php','glossary.gif',2,1,'basic'),
+(28,'notebook','notebook/index.php','notebook.gif',2,1,'basic'),
+(29,'attendance','attendance/index.php','attendance.gif',2,1,'basic'),
+(30,'course_progress','course_progress/index.php','course_progress.gif',2,1,'basic');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE course_module ENABLE KEYS */;
+
+--
+-- Table structure for table course_rel_class
+--
+
+DROP TABLE IF EXISTS course_rel_class;
+CREATE TABLE course_rel_class (
+  course_code char(40) NOT NULL,
+  class_id mediumint unsigned NOT NULL,
+  PRIMARY KEY  (course_code,class_id)
+);
+
+--
+-- Dumping data for table course_rel_class
+--
+
+
+/*!40000 ALTER TABLE course_rel_class DISABLE KEYS */;
+LOCK TABLES course_rel_class WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE course_rel_class ENABLE KEYS */;
+
+--
+-- Table structure for table course_rel_user
+--
+
+DROP TABLE IF EXISTS course_rel_user;
+CREATE TABLE course_rel_user (
+  course_code varchar(40) NOT NULL,
+  user_id int unsigned NOT NULL default '0',
+  status tinyint NOT NULL default '5',
+  role varchar(60) default NULL,
+  group_id int NOT NULL default '0',
+  tutor_id int unsigned NOT NULL default '0',
+  sort int default NULL,
+  user_course_cat int default '0',
+  relation_type int default 0,
+  PRIMARY KEY  (course_code,user_id,relation_type)
+);
+ALTER TABLE course_rel_user ADD INDEX (user_id);
+
+--
+-- Dumping data for table course_rel_user
+--
+
+
+/*!40000 ALTER TABLE course_rel_user DISABLE KEYS */;
+LOCK TABLES course_rel_user WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE course_rel_user ENABLE KEYS */;
+
+--
+-- Table structure for table language
+--
+
+DROP TABLE IF EXISTS language;
+CREATE TABLE language (
+  id tinyint unsigned NOT NULL auto_increment,
+  original_name varchar(255) default NULL,
+  english_name varchar(255) default NULL,
+  isocode varchar(10) default NULL,
+  dokeos_folder varchar(250) default NULL,
+  available tinyint NOT NULL default 1,
+  parent_id tinyint unsigned,
+  PRIMARY KEY  (id)
+);
+ALTER TABLE language ADD INDEX idx_language_dokeos_folder(dokeos_folder);
+
+--
+-- Dumping data for table language
+--
+
+
+/*!40000 ALTER TABLE language DISABLE KEYS */;
+LOCK TABLES language WRITE;
+INSERT INTO language (original_name, english_name, isocode, dokeos_folder, available) VALUES
+('&#1575;&#1604;&#1593;&#1585;&#1576;&#1610;&#1577;','arabic','ar','arabic',0),
+('Asturianu','asturian','ast','asturian',0),
+('&#1041;&#1098;&#1083;&#1075;&#1072;&#1088;&#1089;&#1082;&#1080;','bulgarian','bg','bulgarian',1),
+('Bosanski','bosnian','bs','bosnian',1),
+('Catal&agrave;','catalan','ca','catalan',0),
+('&#20013;&#25991;&#65288;&#31616;&#20307;&#65289;','simpl_chinese','zh','simpl_chinese',0),
+('&#32321;&#39636;&#20013;&#25991;','trad_chinese','zh-TW','trad_chinese',0),
+('&#268;esky','czech','cs','czech',0),
+('Dansk','danish','da','danish',0),
+('&#1583;&#1585;&#1740;','dari','prs','dari',0),
+('Deutsch','german','de','german',1),
+('&Epsilon;&lambda;&lambda;&eta;&nu;&iota;&kappa;&#940;','greek','el','greek',0),
+('English','english','en','english',1),
+('Espa&ntilde;ol','spanish','es','spanish',1),
+('Esperanto','esperanto','eo','esperanto',0),
+('Euskara','euskera','eu','euskera',0),
+('&#1601;&#1575;&#1585;&#1587;&#1740;','persian','fa','persian',0),
+('Fran&ccedil;ais','french','fr','french',1),
+('Furlan','friulian','fur','friulian',0),
+('Galego','galician','gl','galician',0),
+('&#4325;&#4304;&#4320;&#4311;&#4323;&#4314;&#4312;','georgian','ka','georgian',0),
+('Hrvatski','croatian','hr','croatian',0),
+('&#1506;&#1489;&#1512;&#1497;&#1514;','hebrew','he','hebrew',0),
+('&#2361;&#2367;&#2344;&#2381;&#2342;&#2368;','hindi','hi','hindi',0),
+('Bahasa Indonesia','indonesian','id','indonesian',1),
+('Italiano','italian','it','italian',1),
+('&#54620;&#44397;&#50612;','korean','ko','korean',0),
+('Latvie&scaron;u','latvian','lv','latvian',0),
+('Lietuvi&#371;','lithuanian','lt','lithuanian',0),
+('&#1052;&#1072;&#1082;&#1077;&#1076;&#1086;&#1085;&#1089;&#1082;&#1080;','macedonian','mk','macedonian',0),
+('Magyar','hungarian','hu','hungarian',1),
+('Bahasa Melayu','malay','ms','malay',0),
+('Nederlands','dutch','nl','dutch',1),
+('&#26085;&#26412;&#35486;','japanese','ja','japanese',0),
+('Norsk','norwegian','no','norwegian',0),
+('Occitan','occitan','oc','occitan',0),
+('&#1662;&#1690;&#1578;&#1608;','pashto','ps','pashto',0),
+('Polski','polish','pl','polish',0),
+('Portugu&ecirc;s europeu','portuguese','pt','portuguese',1),
+('Portugu&ecirc;s do Brasil','brazilian','pt-BR','brazilian',1),
+('Rom&acirc;n&#259;','romanian','ro','romanian',0),
+('Runasimi','quechua_cusco','qu','quechua_cusco',0),
+('&#1056;&#1091;&#1089;&#1089;&#1082;&#1080;&#1081;','russian','ru','russian',0),
+('Sloven&#269;ina','slovak','sk','slovak',0),
+('Sloven&scaron;&#269;ina','slovenian','sl','slovenian',1),
+('Srpski','serbian','sr','serbian',0),
+('Suomi','finnish','fi','finnish',0),
+('Svenska','swedish','sv','swedish',0),
+('&#3652;&#3607;&#3618;','thai','th','thai',0),
+('T&uuml;rk&ccedil;e','turkce','tr','turkce',0),
+('&#1059;&#1082;&#1088;&#1072;&#1111;&#1085;&#1089;&#1100;&#1082;&#1072;','ukrainian','uk','ukrainian',0),
+('Ti&#7871;ng Vi&#7879;t','vietnamese','vi','vietnamese',0),
+('Kiswahili','swahili','sw','swahili',0),
+('Yor&ugrave;b&aacute;','yoruba','yo','yoruba',0);
+
+-- The chosen during the installation platform language should be enabled.
+UPDATE language SET available=1 WHERE dokeos_folder = '{PLATFORMLANGUAGE}';
+
+UNLOCK TABLES;
+/*!40000 ALTER TABLE language ENABLE KEYS */;
+
+--
+-- Table structure for table php_session
+--
+
+DROP TABLE IF EXISTS php_session;
+CREATE TABLE php_session (
+  session_id varchar(32) NOT NULL default '',
+  session_name varchar(10) NOT NULL default '',
+  session_time int NOT NULL default '0',
+  session_start int NOT NULL default '0',
+  session_value mediumtext NOT NULL,
+  PRIMARY KEY  (session_id)
+);
+
+--
+-- Table structure for table session
+--
+DROP TABLE IF EXISTS session;
+CREATE TABLE session (
+  id smallint unsigned NOT NULL auto_increment,
+  id_coach int unsigned NOT NULL default '0',
+  name char(50) NOT NULL default '',
+  nbr_courses smallint unsigned NOT NULL default '0',
+  nbr_users mediumint unsigned NOT NULL default '0',
+  nbr_classes mediumint unsigned NOT NULL default '0',
+  date_start date NOT NULL default '0000-00-00',
+  date_end date NOT NULL default '0000-00-00',
+  nb_days_access_before_beginning TINYINT UNSIGNED NULL default '0',
+  nb_days_access_after_end TINYINT UNSIGNED NULL default '0',
+  session_admin_id INT UNSIGNED NOT NULL,
+  visibility int NOT NULL default 1,
+  session_category_id int NOT NULL,
+  promotion_id INT NOT NULL,
+  PRIMARY KEY  (id),
+  INDEX (session_admin_id),
+  UNIQUE KEY name (name)
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table session_rel_course
+--
+DROP TABLE IF EXISTS session_rel_course;
+CREATE TABLE session_rel_course (
+  id_session smallint unsigned NOT NULL default '0',
+  course_code char(40) NOT NULL default '',
+  nbr_users smallint unsigned NOT NULL default '0',
+  PRIMARY KEY  (id_session,course_code),
+  KEY course_code (course_code)
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table session_rel_course_rel_user
+--
+DROP TABLE IF EXISTS session_rel_course_rel_user;
+CREATE TABLE session_rel_course_rel_user (
+  id_session smallint unsigned NOT NULL default '0',
+  course_code char(40) NOT NULL default '',
+  id_user int unsigned NOT NULL default '0',
+  visibility int NOT NULL default 1,
+  status int NOT NULL default 0,
+  PRIMARY KEY  (id_session,course_code,id_user),
+  KEY id_user (id_user),
+  KEY course_code (course_code)
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table session_rel_user
+--
+DROP TABLE IF EXISTS session_rel_user;
+CREATE TABLE session_rel_user (
+  id_session mediumint unsigned NOT NULL default '0',
+  id_user mediumint unsigned NOT NULL default '0',
+  relation_type int default 0,
+  PRIMARY KEY (id_session, id_user, relation_type)
+);
+
+
+DROP TABLE IF EXISTS session_field;
+CREATE TABLE session_field (
+    id  int NOT NULL auto_increment,
+    field_type int NOT NULL default 1,
+    field_variable  varchar(64) NOT NULL,
+    field_display_text  varchar(64),
+    field_default_value text,
+    field_order int,
+    field_visible tinyint default 0,
+    field_changeable tinyint default 0,
+    field_filter tinyint default 0,
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+DROP TABLE IF EXISTS session_field_values;
+CREATE TABLE session_field_values(
+    id  int NOT NULL auto_increment,
+    session_id int NOT NULL,
+    field_id int NOT NULL,
+    field_value text,
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+--
+-- Table structure for table settings_current
+--
+
+DROP TABLE IF EXISTS settings_current;
+CREATE TABLE settings_current (
+  id int unsigned NOT NULL auto_increment,
+  variable varchar(255) default NULL,
+  subkey varchar(255) default NULL,
+  type varchar(255) default NULL,
+  category varchar(255) default NULL,
+  selected_value varchar(255) default NULL,
+  title varchar(255) NOT NULL default '',
+  comment varchar(255) default NULL,
+  scope varchar(50) default NULL,
+  subkeytext varchar(255) default NULL,
+  access_url int unsigned not null default 1,
+  access_url_changeable int unsigned not null default 0,
+  PRIMARY KEY id (id),
+  INDEX (access_url)
+);
+
+ALTER TABLE settings_current ADD UNIQUE unique_setting (variable(110), subkey(110), category(110), access_url);
+
+--
+-- Dumping data for table settings_current
+--
+
+/*!40000 ALTER TABLE settings_current DISABLE KEYS */;
+LOCK TABLES settings_current WRITE;
+INSERT INTO settings_current
+(variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable)
+VALUES
+('Institution',NULL,'textfield','Platform','{ORGANISATIONNAME}','InstitutionTitle','InstitutionComment','platform',NULL, 1),
+('InstitutionUrl',NULL,'textfield','Platform','{ORGANISATIONURL}','InstitutionUrlTitle','InstitutionUrlComment',NULL,NULL, 1),
+('siteName',NULL,'textfield','Platform','{CAMPUSNAME}','SiteNameTitle','SiteNameComment',NULL,NULL, 1),
+('emailAdministrator',NULL,'textfield','Platform','{ADMINEMAIL}','emailAdministratorTitle','emailAdministratorComment',NULL,NULL, 1),
+('administratorSurname',NULL,'textfield','Platform','{ADMINLASTNAME}','administratorSurnameTitle','administratorSurnameComment',NULL,NULL, 1),
+('administratorName',NULL,'textfield','Platform','{ADMINFIRSTNAME}','administratorNameTitle','administratorNameComment',NULL,NULL, 1),
+('show_administrator_data',NULL,'radio','Platform','true','ShowAdministratorDataTitle','ShowAdministratorDataComment',NULL,NULL, 1),
+('show_tutor_data',NULL,'radio','Platform','true','ShowTutorDataTitle','ShowTutorDataComment',NULL,NULL, 1),
+('show_teacher_data',NULL,'radio','Platform','true','ShowTeacherDataTitle','ShowTeacherDataComment',NULL,NULL, 1),
+('homepage_view',NULL,'radio','Course','activity','HomepageViewTitle','HomepageViewComment',NULL,NULL, 0),
+('show_toolshortcuts',NULL,'radio','Course','false','ShowToolShortcutsTitle','ShowToolShortcutsComment',NULL,NULL, 0),
+('allow_group_categories',NULL,'radio','Course','false','AllowGroupCategories','AllowGroupCategoriesComment',NULL,NULL, 0),
+('server_type',NULL,'radio','Platform','production','ServerStatusTitle','ServerStatusComment',NULL,NULL, 0),
+('platformLanguage',NULL,'link','Languages','{PLATFORMLANGUAGE}','PlatformLanguageTitle','PlatformLanguageComment',NULL,NULL, 0),
+('showonline','world','checkbox','Platform','true','ShowOnlineTitle','ShowOnlineComment',NULL,'ShowOnlineWorld', 0),
+('showonline','users','checkbox','Platform','true','ShowOnlineTitle','ShowOnlineComment',NULL,'ShowOnlineUsers', 0),
+('showonline','course','checkbox','Platform','true','ShowOnlineTitle','ShowOnlineComment',NULL,'ShowOnlineCourse', 0),
+('profile','name','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'name', 0),
+('profile','officialcode','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'officialcode', 0),
+('profile','email','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'Email', 0),
+('profile','picture','checkbox','User','true','ProfileChangesTitle','ProfileChangesComment',NULL,'UserPicture', 0),
+('profile','login','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'Login', 0),
+('profile','password','checkbox','User','true','ProfileChangesTitle','ProfileChangesComment',NULL,'UserPassword', 0),
+('profile','language','checkbox','User','true','ProfileChangesTitle','ProfileChangesComment',NULL,'Language', 0),
+('default_document_quotum',NULL,'textfield','Course','100000000','DefaultDocumentQuotumTitle','DefaultDocumentQuotumComment',NULL,NULL, 0),
+('registration','officialcode','checkbox','User','false','RegistrationRequiredFormsTitle','RegistrationRequiredFormsComment',NULL,'OfficialCode', 0),
+('registration','email','checkbox','User','true','RegistrationRequiredFormsTitle','RegistrationRequiredFormsComment',NULL,'Email', 0),
+('registration','language','checkbox','User','true','RegistrationRequiredFormsTitle','RegistrationRequiredFormsComment',NULL,'Language', 0),
+('default_group_quotum',NULL,'textfield','Course','5000000','DefaultGroupQuotumTitle','DefaultGroupQuotumComment',NULL,NULL, 0),
+('allow_registration',NULL,'radio','Platform','{ALLOWSELFREGISTRATION}','AllowRegistrationTitle','AllowRegistrationComment',NULL,NULL, 0),
+('allow_registration_as_teacher',NULL,'radio','Platform','{ALLOWTEACHERSELFREGISTRATION}','AllowRegistrationAsTeacherTitle','AllowRegistrationAsTeacherComment',NULL,NULL, 0),
+('allow_lostpassword',NULL,'radio','Platform','true','AllowLostPasswordTitle','AllowLostPasswordComment',NULL,NULL, 0),
+('allow_user_headings',NULL,'radio','Course','false','AllowUserHeadings','AllowUserHeadingsComment',NULL,NULL, 0),
+('course_create_active_tools','course_description','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'CourseDescription', 0),
+('course_create_active_tools','agenda','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Agenda', 0),
+('course_create_active_tools','documents','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Documents', 0),
+('course_create_active_tools','learning_path','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'LearningPath', 0),
+('course_create_active_tools','links','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Links', 0),
+('course_create_active_tools','announcements','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Announcements', 0),
+('course_create_active_tools','forums','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Forums', 0),
+('course_create_active_tools','dropbox','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Dropbox', 0),
+('course_create_active_tools','quiz','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Quiz', 0),
+('course_create_active_tools','users','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Users', 0),
+('course_create_active_tools','groups','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Groups', 0),
+('course_create_active_tools','chat','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Chat', 0),
+('course_create_active_tools','online_conference','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'OnlineConference', 0),
+('course_create_active_tools','student_publications','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'StudentPublications', 0),
+('allow_personal_agenda',NULL,'radio','User','false','AllowPersonalAgendaTitle','AllowPersonalAgendaComment',NULL,NULL, 0),
+('display_coursecode_in_courselist',NULL,'radio','Platform','false','DisplayCourseCodeInCourselistTitle','DisplayCourseCodeInCourselistComment',NULL,NULL, 0),
+('display_teacher_in_courselist',NULL,'radio','Platform','true','DisplayTeacherInCourselistTitle','DisplayTeacherInCourselistComment',NULL,NULL, 0),
+('use_document_title',NULL,'radio','Tools','true','UseDocumentTitleTitle','UseDocumentTitleComment',NULL,NULL, 0),
+('permanently_remove_deleted_files',NULL,'radio','Tools','false','PermanentlyRemoveFilesTitle','PermanentlyRemoveFilesComment',NULL,NULL, 0),
+('dropbox_allow_overwrite',NULL,'radio','Tools','true','DropboxAllowOverwriteTitle','DropboxAllowOverwriteComment',NULL,NULL, 0),
+('dropbox_max_filesize',NULL,'textfield','Tools','100000000','DropboxMaxFilesizeTitle','DropboxMaxFilesizeComment',NULL,NULL, 0),
+('dropbox_allow_just_upload',NULL,'radio','Tools','true','DropboxAllowJustUploadTitle','DropboxAllowJustUploadComment',NULL,NULL, 0),
+('dropbox_allow_student_to_student',NULL,'radio','Tools','true','DropboxAllowStudentToStudentTitle','DropboxAllowStudentToStudentComment',NULL,NULL, 0),
+('dropbox_allow_group',NULL,'radio','Tools','true','DropboxAllowGroupTitle','DropboxAllowGroupComment',NULL,NULL, 0),
+('dropbox_allow_mailing',NULL,'radio','Tools','false','DropboxAllowMailingTitle','DropboxAllowMailingComment',NULL,NULL, 0),
+('administratorTelephone',NULL,'textfield','Platform','(000) 001 02 03','administratorTelephoneTitle','administratorTelephoneComment',NULL,NULL, 1),
+('extended_profile',NULL,'radio','User','true','ExtendedProfileTitle','ExtendedProfileComment',NULL,NULL, 0),
+('student_view_enabled',NULL,'radio','Platform','true','StudentViewEnabledTitle','StudentViewEnabledComment',NULL,NULL, 0),
+('show_navigation_menu',NULL,'radio','Course','false','ShowNavigationMenuTitle','ShowNavigationMenuComment',NULL,NULL, 0),
+('enable_tool_introduction',NULL,'radio','course','false','EnableToolIntroductionTitle','EnableToolIntroductionComment',NULL,NULL, 0),
+('page_after_login', NULL, 'radio','Platform','user_portal.php', 'PageAfterLoginTitle','PageAfterLoginComment', NULL, NULL, 0),
+('time_limit_whosonline', NULL, 'textfield','Platform','30', 'TimeLimitWhosonlineTitle','TimeLimitWhosonlineComment', NULL, NULL, 0),
+('breadcrumbs_course_homepage', NULL, 'radio','Course','course_title', 'BreadCrumbsCourseHomepageTitle','BreadCrumbsCourseHomepageComment', NULL, NULL, 0),
+('example_material_course_creation', NULL, 'radio','Platform','true', 'ExampleMaterialCourseCreationTitle','ExampleMaterialCourseCreationComment', NULL, NULL, 0),
+('account_valid_duration',NULL, 'textfield','Platform','3660', 'AccountValidDurationTitle','AccountValidDurationComment', NULL, NULL, 0),
+('use_session_mode', NULL, 'radio','Platform','true', 'UseSessionModeTitle','UseSessionModeComment', NULL, NULL, 0),
+('allow_email_editor', NULL, 'radio', 'Tools', 'false', 'AllowEmailEditorTitle', 'AllowEmailEditorComment', NULL, NULL, 0),
+('registered', NULL, 'textfield', NULL, 'false', NULL, NULL, NULL, NULL, 0),
+('donotlistcampus', NULL, 'textfield', NULL, 'false', NULL, NULL, NULL, NULL,0 ),
+('show_email_addresses', NULL,'radio','Platform','false','ShowEmailAddresses','ShowEmailAddressesComment',NULL,NULL, 1),
+('profile','phone','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'phone', 0),
+('service_visio', 'active', 'radio',NULL,'false', 'VisioEnable','', NULL, NULL, 0),
+('service_visio', 'visio_host', 'textfield',NULL,'', 'VisioHost','', NULL, NULL, 0),
+('service_visio', 'visio_port', 'textfield',NULL,'1935', 'VisioPort','', NULL, NULL, 0),
+('service_visio', 'visio_pass', 'textfield',NULL,'', 'VisioPassword','', NULL, NULL, 0),
+('service_ppt2lp', 'active', 'radio',NULL,'false', 'ppt2lp_actived','', NULL, NULL, 0),
+('service_ppt2lp', 'host', 'textfield', NULL, NULL, 'Host', NULL, NULL, NULL, 0),
+('service_ppt2lp', 'port', 'textfield', NULL, 2002, 'Port', NULL, NULL, NULL, 0),
+('service_ppt2lp', 'user', 'textfield', NULL, NULL, 'UserOnHost', NULL, NULL, NULL, 0),
+('service_ppt2lp', 'ftp_password', 'textfield', NULL, NULL, 'FtpPassword', NULL, NULL, NULL, 0),
+('service_ppt2lp', 'path_to_lzx', 'textfield', NULL, NULL, '', NULL, NULL, NULL, 0),
+('service_ppt2lp', 'size', 'radio', NULL, '720x540', '', NULL, NULL, NULL, 0),
+('wcag_anysurfer_public_pages', NULL, 'radio','Editor','false','PublicPagesComplyToWAITitle','PublicPagesComplyToWAIComment', NULL, NULL, 0),
+('stylesheets', NULL, 'textfield','stylesheets','chamilo','',NULL, NULL, NULL, 1),
+('upload_extensions_list_type', NULL, 'radio', 'Security', 'blacklist', 'UploadExtensionsListType', 'UploadExtensionsListTypeComment', NULL, NULL, 0),
+('upload_extensions_blacklist', NULL, 'textfield', 'Security', '', 'UploadExtensionsBlacklist', 'UploadExtensionsBlacklistComment', NULL, NULL, 0),
+('upload_extensions_whitelist', NULL, 'textfield', 'Security', 'htm;html;jpg;jpeg;gif;png;swf;avi;mpg;mpeg;mov;flv;doc;docx;xls;xlsx;ppt;pptx;odt;odp;ods;pdf', 'UploadExtensionsWhitelist', 'UploadExtensionsWhitelistComment', NULL, NULL, 0),
+('upload_extensions_skip', NULL, 'radio', 'Security', 'true', 'UploadExtensionsSkip', 'UploadExtensionsSkipComment', NULL, NULL, 0),
+('upload_extensions_replace_by', NULL, 'textfield', 'Security', 'dangerous', 'UploadExtensionsReplaceBy', 'UploadExtensionsReplaceByComment', NULL, NULL, 0),
+('show_number_of_courses', NULL, 'radio','Platform','false', 'ShowNumberOfCourses','ShowNumberOfCoursesComment', NULL, NULL, 0),
+('show_empty_course_categories', NULL, 'radio','Platform','true', 'ShowEmptyCourseCategories','ShowEmptyCourseCategoriesComment', NULL, NULL, 0),
+('show_back_link_on_top_of_tree', NULL, 'radio','Platform','false', 'ShowBackLinkOnTopOfCourseTree','ShowBackLinkOnTopOfCourseTreeComment', NULL, NULL, 0),
+('show_different_course_language', NULL, 'radio','Platform','true', 'ShowDifferentCourseLanguage','ShowDifferentCourseLanguageComment', NULL, NULL, 1),
+('split_users_upload_directory', NULL, 'radio','Tuning','false', 'SplitUsersUploadDirectory','SplitUsersUploadDirectoryComment', NULL, NULL, 0),
+('hide_dltt_markup', NULL, 'radio','Languages','true', 'HideDLTTMarkup','HideDLTTMarkupComment', NULL, NULL, 0),
+('display_categories_on_homepage',NULL,'radio','Platform','false','DisplayCategoriesOnHomepageTitle','DisplayCategoriesOnHomepageComment',NULL,NULL, 1),
+('permissions_for_new_directories', NULL, 'textfield', 'Security', '0777', 'PermissionsForNewDirs', 'PermissionsForNewDirsComment', NULL, NULL, 0),
+('permissions_for_new_files', NULL, 'textfield', 'Security', '0666', 'PermissionsForNewFiles', 'PermissionsForNewFilesComment', NULL, NULL, 0),
+('show_tabs', 'campus_homepage', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsCampusHomepage', 1),
+('show_tabs', 'my_courses', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsMyCourses', 1),
+('show_tabs', 'reporting', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsReporting', 1),
+('show_tabs', 'platform_administration', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsPlatformAdministration', 1),
+('show_tabs', 'my_agenda', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsMyAgenda', 1),
+('show_tabs', 'my_profile', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsMyProfile', 1),
+('default_forum_view', NULL, 'radio', 'Course', 'flat', 'DefaultForumViewTitle','DefaultForumViewComment',NULL,NULL, 0),
+('platform_charset',NULL,'textfield','Languages','UTF-8','PlatformCharsetTitle','PlatformCharsetComment','platform',NULL, 0),
+('noreply_email_address', '', 'textfield', 'Platform', '', 'NoReplyEmailAddress', 'NoReplyEmailAddressComment', NULL, NULL, 0),
+('survey_email_sender_noreply', '', 'radio', 'Course', 'coach', 'SurveyEmailSenderNoReply', 'SurveyEmailSenderNoReplyComment', NULL, NULL, 0),
+('openid_authentication',NULL,'radio','Security','false','OpenIdAuthentication','OpenIdAuthenticationComment',NULL,NULL, 0),
+('profile','openid','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'OpenIDURL', 0),
+('gradebook_enable',NULL,'radio','Gradebook','false','GradebookActivation','GradebookActivationComment',NULL,NULL, 0),
+('show_tabs','my_gradebook','checkbox','Platform','true','ShowTabsTitle','ShowTabsComment',NULL,'TabsMyGradebook', 1),
+('gradebook_score_display_coloring','my_display_coloring','checkbox','Gradebook','false','GradebookScoreDisplayColoring','GradebookScoreDisplayColoringComment',NULL,'TabsGradebookEnableColoring', 0),
+('gradebook_score_display_custom','my_display_custom','checkbox','Gradebook','false','GradebookScoreDisplayCustom','GradebookScoreDisplayCustomComment',NULL,'TabsGradebookEnableCustom', 0),
+('gradebook_score_display_colorsplit',NULL,'textfield','Gradebook','50','GradebookScoreDisplayColorSplit','GradebookScoreDisplayColorSplitComment',NULL,NULL, 0),
+('gradebook_score_display_upperlimit','my_display_upperlimit','checkbox','Gradebook','false','GradebookScoreDisplayUpperLimit','GradebookScoreDisplayUpperLimitComment',NULL,'TabsGradebookEnableUpperLimit', 0),
+('gradebook_number_decimals', NULL, 'select', 'Gradebook', '0', 'GradebookNumberDecimals', 'GradebookNumberDecimalsComment', NULL, NULL, 0),
+('user_selected_theme',NULL,'radio','Platform','false','UserThemeSelection','UserThemeSelectionComment',NULL,NULL, 0),
+('profile','theme','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'UserTheme', 0),
+('allow_course_theme',NULL,'radio','Course','true','AllowCourseThemeTitle','AllowCourseThemeComment',NULL,NULL, 0),
+('display_mini_month_calendar',NULL,'radio','Tools', 'true', 'DisplayMiniMonthCalendarTitle', 'DisplayMiniMonthCalendarComment', NULL, NULL, 0),
+('display_upcoming_events',NULL,'radio','Tools','true','DisplayUpcomingEventsTitle','DisplayUpcomingEventsComment',NULL,NULL, 0),
+('number_of_upcoming_events',NULL,'textfield','Tools','1','NumberOfUpcomingEventsTitle','NumberOfUpcomingEventsComment',NULL,NULL, 0),
+('show_closed_courses',NULL,'radio','Platform','false','ShowClosedCoursesTitle','ShowClosedCoursesComment',NULL,NULL, 0),
+('ldap_main_server_address', NULL, 'textfield', 'LDAP', 'localhost', 'LDAPMainServerAddressTitle', 'LDAPMainServerAddressComment', NULL, NULL, 0),
+('ldap_main_server_port', NULL, 'textfield', 'LDAP', '389', 'LDAPMainServerPortTitle', 'LDAPMainServerPortComment', NULL, NULL, 0),
+('ldap_domain', NULL, 'textfield', 'LDAP', 'dc=nodomain', 'LDAPDomainTitle', 'LDAPDomainComment', NULL, NULL, 0),
+('ldap_replicate_server_address', NULL, 'textfield', 'LDAP', 'localhost', 'LDAPReplicateServerAddressTitle', 'LDAPReplicateServerAddressComment', NULL, NULL, 0),
+('ldap_replicate_server_port', NULL, 'textfield', 'LDAP', '389', 'LDAPReplicateServerPortTitle', 'LDAPReplicateServerPortComment', NULL, NULL, 0),
+('ldap_search_term', NULL, 'textfield', 'LDAP', '', 'LDAPSearchTermTitle', 'LDAPSearchTermComment', NULL, NULL, 0),
+('ldap_version', NULL, 'radio', 'LDAP', '3', 'LDAPVersionTitle', 'LDAPVersionComment', NULL, '', 0),
+('ldap_filled_tutor_field', NULL, 'textfield', 'LDAP', 'employeenumber', 'LDAPFilledTutorFieldTitle', 'LDAPFilledTutorFieldComment', NULL, '', 0),
+('ldap_authentication_login', NULL, 'textfield', 'LDAP', '', 'LDAPAuthenticationLoginTitle', 'LDAPAuthenticationLoginComment', NULL, '', 0),
+('ldap_authentication_password', NULL, 'textfield', 'LDAP', '', 'LDAPAuthenticationPasswordTitle', 'LDAPAuthenticationPasswordComment', NULL, '', 0),
+('service_visio', 'visio_use_rtmpt', 'radio',null,'false', 'VisioUseRtmptTitle','VisioUseRtmptComment', NULL, NULL, 0),
+('extendedprofile_registration', 'mycomptetences', 'checkbox','User','false', 'ExtendedProfileRegistrationTitle','ExtendedProfileRegistrationComment', NULL, 'MyCompetences', 0),
+('extendedprofile_registration', 'mydiplomas', 'checkbox','User','false', 'ExtendedProfileRegistrationTitle','ExtendedProfileRegistrationComment', NULL, 'MyDiplomas', 0),
+('extendedprofile_registration', 'myteach', 'checkbox','User','false', 'ExtendedProfileRegistrationTitle','ExtendedProfileRegistrationComment', NULL, 'MyTeach', 0),
+('extendedprofile_registration', 'mypersonalopenarea', 'checkbox','User','false', 'ExtendedProfileRegistrationTitle','ExtendedProfileRegistrationComment', NULL, 'MyPersonalOpenArea', 0),
+('extendedprofile_registrationrequired', 'mycomptetences', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyCompetences', 0),
+('extendedprofile_registrationrequired', 'mydiplomas', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyDiplomas', 0),
+('extendedprofile_registrationrequired', 'myteach', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyTeach', 0),
+('extendedprofile_registrationrequired', 'mypersonalopenarea', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyPersonalOpenArea', 0),
+('ldap_filled_tutor_field_value', NULL, 'textfield', 'LDAP', '', 'LDAPFilledTutorFieldValueTitle', 'LDAPFilledTutorFieldValueComment', NULL, '', 0),
+('registration','phone','textfield','User','false','RegistrationRequiredFormsTitle','RegistrationRequiredFormsComment',NULL,'Phone', 0),
+('add_users_by_coach',NULL,'radio','Security','false','AddUsersByCoachTitle','AddUsersByCoachComment',NULL,NULL, 0),
+('extend_rights_for_coach',NULL,'radio','Security','false','ExtendRightsForCoachTitle','ExtendRightsForCoachComment',NULL,NULL, 0),
+('extend_rights_for_coach_on_survey',NULL,'radio','Security','true','ExtendRightsForCoachOnSurveyTitle','ExtendRightsForCoachOnSurveyComment',NULL,NULL, 0),
+('course_create_active_tools','wiki','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Wiki', 0),
+('show_session_coach', NULL, 'radio','Platform','false', 'ShowSessionCoachTitle','ShowSessionCoachComment', NULL, NULL, 0),
+('course_create_active_tools','gradebook','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Gradebook', 0),
+('allow_users_to_create_courses',NULL,'radio','Platform','true','AllowUsersToCreateCoursesTitle','AllowUsersToCreateCoursesComment',NULL,NULL, 0),
+('course_create_active_tools','survey','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Survey', 0),
+('course_create_active_tools','glossary','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Glossary', 0),
+('course_create_active_tools','notebook','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Notebook', 0),
+('course_create_active_tools','attendances','checkbox','Tools','false','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Attendances', 0),
+('course_create_active_tools','course_progress','checkbox','Tools','false','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'CourseProgress', 0),
+('advanced_filemanager',NULL,'radio','Editor','true','AdvancedFileManagerTitle','AdvancedFileManagerComment',NULL,NULL, 1),
+('allow_reservation', NULL, 'radio', 'Tools', 'false', 'AllowReservationTitle', 'AllowReservationComment', NULL, NULL, 0),
+('profile','apikeys','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'ApiKeys', 0),
+('allow_message_tool', NULL, 'radio', 'Tools', 'true', 'AllowMessageToolTitle', 'AllowMessageToolComment', NULL, NULL,1),
+('allow_social_tool', NULL, 'radio', 'Tools', 'true', 'AllowSocialToolTitle', 'AllowSocialToolComment', NULL, NULL,1),
+('allow_students_to_browse_courses',NULL,'radio','Platform','true','AllowStudentsToBrowseCoursesTitle','AllowStudentsToBrowseCoursesComment',NULL,NULL, 1),
+('show_session_data', NULL, 'radio', 'Course', 'false', 'ShowSessionDataTitle', 'ShowSessionDataComment', NULL, NULL, 1),
+('allow_use_sub_language', NULL, 'radio', 'Languages', 'false', 'AllowUseSubLanguageTitle', 'AllowUseSubLanguageComment', NULL, NULL,0),
+('show_glossary_in_documents', NULL, 'radio', 'Course', 'none', 'ShowGlossaryInDocumentsTitle', 'ShowGlossaryInDocumentsComment', NULL, NULL,1),
+('allow_terms_conditions', NULL, 'radio', 'Platform', 'false', 'AllowTermsAndConditionsTitle', 'AllowTermsAndConditionsComment', NULL, NULL,0),
+('course_create_active_tools','enable_search','checkbox','Tools','false','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Search',0),
+('search_enabled',NULL,'radio','Search','false','EnableSearchTitle','EnableSearchComment',NULL,NULL,1),
+('search_prefilter_prefix',NULL, NULL,'Search','','SearchPrefilterPrefix','SearchPrefilterPrefixComment',NULL,NULL,0),
+('search_show_unlinked_results',NULL,'radio','Search','true','SearchShowUnlinkedResultsTitle','SearchShowUnlinkedResultsComment',NULL,NULL,1),
+('show_courses_descriptions_in_catalog', NULL, 'radio', 'Course', 'true', 'ShowCoursesDescriptionsInCatalogTitle', 'ShowCoursesDescriptionsInCatalogComment', NULL, NULL, 1),
+('allow_coach_to_edit_course_session',NULL,'radio','Course','true','AllowCoachsToEditInsideTrainingSessions','AllowCoachsToEditInsideTrainingSessionsComment',NULL,NULL, 0),
+('show_glossary_in_extra_tools', NULL, 'radio', 'Course', 'false', 'ShowGlossaryInExtraToolsTitle', 'ShowGlossaryInExtraToolsComment', NULL, NULL,1),
+('send_email_to_admin_when_create_course',NULL,'radio','Platform','false','SendEmailToAdminTitle','SendEmailToAdminComment',NULL,NULL, 1),
+('go_to_course_after_login',NULL,'radio','Course','false','GoToCourseAfterLoginTitle','GoToCourseAfterLoginComment',NULL,NULL, 0),
+('math_mimetex',NULL,'radio','Editor','false','MathMimetexTitle','MathMimetexComment',NULL,NULL, 0),
+('math_asciimathML',NULL,'radio','Editor','false','MathASCIImathMLTitle','MathASCIImathMLComment',NULL,NULL, 0),
+('enabled_asciisvg',NULL,'radio','Editor','false','AsciiSvgTitle','AsciiSvgComment',NULL,NULL, 0),
+('include_asciimathml_script',NULL,'radio','Editor','false','IncludeAsciiMathMlTitle','IncludeAsciiMathMlComment',NULL,NULL, 0),
+('youtube_for_students',NULL,'radio','Editor','true','YoutubeForStudentsTitle','YoutubeForStudentsComment',NULL,NULL, 0),
+('block_copy_paste_for_students',NULL,'radio','Editor','false','BlockCopyPasteForStudentsTitle','BlockCopyPasteForStudentsComment',NULL,NULL, 0),
+('more_buttons_maximized_mode',NULL,'radio','Editor','true','MoreButtonsForMaximizedModeTitle','MoreButtonsForMaximizedModeComment',NULL,NULL, 0),
+('students_download_folders',NULL,'radio','Tools','true','AllowStudentsDownloadFoldersTitle','AllowStudentsDownloadFoldersComment',NULL,NULL, 0),
+('users_copy_files',NULL,'radio','Tools','true','AllowUsersCopyFilesTitle','AllowUsersCopyFilesComment',NULL,NULL, 1),
+('show_tabs', 'social', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsSocial', 0),
+('allow_students_to_create_groups_in_social',NULL,'radio','Tools','false','AllowStudentsToCreateGroupsInSocialTitle','AllowStudentsToCreateGroupsInSocialComment',NULL,NULL, 0),
+('allow_send_message_to_all_platform_users',NULL,'radio','Tools','false','AllowSendMessageToAllPlatformUsersTitle','AllowSendMessageToAllPlatformUsersComment',NULL,NULL, 0),
+('message_max_upload_filesize',NULL,'textfield','Tools','20971520','MessageMaxUploadFilesizeTitle','MessageMaxUploadFilesizeComment',NULL,NULL, 0),
+('show_tabs', 'dashboard', 'checkbox', 'Platform', 'true', 'ShowTabsTitle', 'ShowTabsComment', NULL, 'TabsDashboard', 1),
+('use_users_timezone', 'timezones', 'radio', 'Timezones', 'true', 'UseUsersTimezoneTitle','UseUsersTimezoneComment',NULL,'Timezones', 1),
+('timezone_value', 'timezones', 'select', 'Timezones', '', 'TimezoneValueTitle','TimezoneValueComment',NULL,'Timezones', 1),
+('allow_user_course_subscription_by_course_admin', NULL, 'radio', 'Security', 'true', 'AllowUserCourseSubscriptionByCourseAdminTitle', 'AllowUserCourseSubscriptionByCourseAdminComment', NULL, NULL, 1),
+('show_link_bug_notification', NULL, 'radio', 'Platform', 'true', 'ShowLinkBugNotificationTitle', 'ShowLinkBugNotificationComment', NULL, NULL, 0),
+('course_validation', NULL, 'radio', 'Platform', 'false', 'EnableCourseValidation', 'EnableCourseValidationComment', NULL, NULL, 1),
+('course_validation_terms_and_conditions_url', NULL, 'textfield', 'Platform', '', 'CourseValidationTermsAndConditionsLink', 'CourseValidationTermsAndConditionsLinkComment', NULL, NULL, 1),
+('sso_authentication',NULL,'radio','Security','false','EnableSSOTitle','EnableSSOComment',NULL,NULL,1),
+('sso_authentication_domain',NULL,'textfield','Security','','SSOServerDomainTitle','SSOServerDomainComment',NULL,NULL,1),
+('sso_authentication_auth_uri',NULL,'textfield','Security','/?q=user','SSOServerAuthURITitle','SSOServerAuthURIComment',NULL,NULL,1),
+('sso_authentication_unauth_uri',NULL,'textfield','Security','/?q=logout','SSOServerUnAuthURITitle','SSOServerUnAuthURIComment',NULL,NULL,1),
+('sso_authentication_protocol',NULL,'radio','Security','http://','SSOServerProtocolTitle','SSOServerProtocolComment',NULL,NULL,1),
+('enabled_wiris',NULL,'radio','Editor','false','EnabledWirisTitle','EnabledWirisComment',NULL,NULL, 0),
+('allow_spellcheck',NULL,'radio','Editor','false','AllowSpellCheckTitle','AllowSpellCheckComment',NULL,NULL, 0),
+('force_wiki_paste_as_plain_text',NULL,'radio','Editor','false','ForceWikiPasteAsPlainTextTitle','ForceWikiPasteAsPlainTextComment',NULL,NULL, 0),
+('enabled_googlemaps',NULL,'radio','Editor','false','EnabledGooglemapsTitle','EnabledGooglemapsComment',NULL,NULL, 0),
+('enabled_imgmap',NULL,'radio','Editor','true','EnabledImageMapsTitle','EnabledImageMapsComment',NULL,NULL, 0),
+('enabled_support_svg',				NULL,'radio',		'Tools',	'true',	'EnabledSVGTitle','EnabledSVGComment',NULL,NULL, 0),
+('pdf_export_watermark_enable',		NULL,'radio',		'Platform',	'false','PDFExportWatermarkEnableTitle',	'PDFExportWatermarkEnableComment',	'platform',NULL, 1),
+('pdf_export_watermark_by_course',	NULL,'radio',		'Platform',	'false','PDFExportWatermarkByCourseTitle',	'PDFExportWatermarkByCourseComment','platform',NULL, 1),
+('pdf_export_watermark_text',		NULL,'textfield',	'Platform',	'',		'PDFExportWatermarkTextTitle',		'PDFExportWatermarkTextComment',	'platform',NULL, 1),
+('enabled_insertHtml',				NULL,'radio',		'Editor',	'true','EnabledInsertHtmlTitle',			'EnabledInsertHtmlComment',NULL,NULL, 0),
+('students_export2pdf',				NULL,'radio',		'Tools',	'true',	'EnabledStudentExport2PDFTitle',	'EnabledStudentExport2PDFComment',NULL,NULL, 0),
+('exercise_min_score', 				NULL,'textfield',	'Course',	'',		'ExerciseMinScoreTitle',			'ExerciseMinScoreComment','platform',NULL, 	1),
+('exercise_max_score', 				NULL,'textfield',	'Course',	'',		'ExerciseMaxScoreTitle',			'ExerciseMaxScoreComment','platform',NULL, 	1),
+('show_users_folders',				NULL,'radio',		'Tools',	'true',	'ShowUsersFoldersTitle','ShowUsersFoldersComment',NULL,NULL, 0),
+('show_default_folders',			NULL,'radio',		'Tools',	'true',	'ShowDefaultFoldersTitle','ShowDefaultFoldersComment',NULL,NULL, 0),
+('show_chat_folder',				NULL,'radio',		'Tools',	'true',	'ShowChatFolderTitle','ShowChatFolderComment',NULL,NULL, 0),
+('enabled_text2audio',				NULL,'radio',		'Tools',	'false',	'Text2AudioTitle','Text2AudioComment',NULL,NULL, 0),
+('course_hide_tools','course_description','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'CourseDescription', 1),
+('course_hide_tools','calendar_event','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Agenda', 1),
+('course_hide_tools','document','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Documents', 1),
+('course_hide_tools','learnpath','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'LearningPath', 1),
+('course_hide_tools','link','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Links', 1),
+('course_hide_tools','announcement','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Announcements', 1),
+('course_hide_tools','forum','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Forums', 1),
+('course_hide_tools','dropbox','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Dropbox', 1),
+('course_hide_tools','quiz','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Quiz', 1),
+('course_hide_tools','user','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Users', 1),
+('course_hide_tools','group','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Groups', 1),
+('course_hide_tools','chat','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Chat', 1),
+('course_hide_tools','student_publication','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'StudentPublications', 1),
+('course_hide_tools','wiki','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Wiki', 1),
+('course_hide_tools','gradebook','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Gradebook', 1),
+('course_hide_tools','survey','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Survey', 1),
+('course_hide_tools','glossary','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Glossary', 1),
+('course_hide_tools','notebook','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Notebook', 1),
+('course_hide_tools','attendance','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Attendances', 1),
+('course_hide_tools','course_progress','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'CourseProgress', 1),
+('course_hide_tools','blog_management','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Blog',1),
+('course_hide_tools','tracking','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Stats',1),
+('course_hide_tools','course_maintenance','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Maintenance',1),
+('course_hide_tools','course_setting','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'CourseSettings',1),
+('enabled_support_pixlr',NULL,'radio','Tools','false','EnabledPixlrTitle','EnabledPixlrComment',NULL,NULL, 0),
+('show_groups_to_users',NULL,'radio','Platform','false','ShowGroupsToUsersTitle','ShowGroupsToUsersComment',NULL,NULL, 0),
+('accessibility_font_resize',NULL,'radio','Platform','false','EnableAccessibilityFontResizeTitle','EnableAccessibilityFontResizeComment',NULL,NULL, 1),
+('hide_courses_in_sessions',NULL,'radio', 'Platform','false','HideCoursesInSessionsTitle',	'HideCoursesInSessionsComment','platform',NULL, 1),
+('enable_quiz_scenario',  NULL,'radio','Course','false','EnableQuizScenarioTitle','EnableQuizScenarioComment',NULL,NULL, 1),
+('enable_nanogong',NULL,'radio','Tools','false','EnableNanogongTitle','EnableNanogongComment',NULL,NULL, 0),
+('chamilo_database_version',NULL,'textfield',NULL, '1.8.8.14911','DokeosDatabaseVersion','', NULL, NULL, 0);
+
+UNLOCK TABLES;
+/*!40000 ALTER TABLE settings_current ENABLE KEYS */;
+
+--
+-- Table structure for table settings_options
+--
+
+DROP TABLE IF EXISTS settings_options;
+CREATE TABLE settings_options (
+  id int unsigned NOT NULL auto_increment,
+  variable varchar(255) default NULL,
+  value varchar(255) default NULL,
+  display_text varchar(255) NOT NULL default '',
+  PRIMARY KEY  (id),
+  UNIQUE KEY id (id)
+);
+
+ALTER TABLE settings_options ADD UNIQUE unique_setting_option (variable(165), value(165));
+
+--
+-- Dumping data for table settings_options
+--
+
+
+/*!40000 ALTER TABLE settings_options DISABLE KEYS */;
+LOCK TABLES settings_options WRITE;
+INSERT INTO settings_options
+(variable, value, display_text)
+VALUES
+('show_administrator_data','true','Yes'),
+('show_administrator_data','false','No'),
+('show_tutor_data','true','Yes'),
+('show_tutor_data','false','No'),
+('show_teacher_data','true','Yes'),
+('show_teacher_data','false','No'),
+('homepage_view','activity','HomepageViewActivity'),
+('homepage_view','2column','HomepageView2column'),
+('homepage_view','3column','HomepageView3column'),
+('homepage_view','vertical_activity','HomepageViewVerticalActivity'),
+('homepage_view','activity_big','HomepageViewActivityBig'),
+('show_toolshortcuts','true','Yes'),
+('show_toolshortcuts','false','No'),
+('allow_group_categories','true','Yes'),
+('allow_group_categories','false','No'),
+('server_type','production','ProductionServer'),
+('server_type','test','TestServer'),
+('allow_name_change','true','Yes'),
+('allow_name_change','false','No'),
+('allow_officialcode_change','true','Yes'),
+('allow_officialcode_change','false','No'),
+('allow_registration','true','Yes'),
+('allow_registration','false','No'),
+('allow_registration','approval','AfterApproval'),
+('allow_registration_as_teacher','true','Yes'),
+('allow_registration_as_teacher','false','No'),
+('allow_lostpassword','true','Yes'),
+('allow_lostpassword','false','No'),
+('allow_user_headings','true','Yes'),
+('allow_user_headings','false','No'),
+('allow_personal_agenda','true','Yes'),
+('allow_personal_agenda','false','No'),
+('display_coursecode_in_courselist','true','Yes'),
+('display_coursecode_in_courselist','false','No'),
+('display_teacher_in_courselist','true','Yes'),
+('display_teacher_in_courselist','false','No'),
+('use_document_title','true','Yes'),
+('use_document_title','false','No'),
+('permanently_remove_deleted_files','true','YesWillDeletePermanently'),
+('permanently_remove_deleted_files','false','NoWillDeletePermanently'),
+('dropbox_allow_overwrite','true','Yes'),
+('dropbox_allow_overwrite','false','No'),
+('dropbox_allow_just_upload','true','Yes'),
+('dropbox_allow_just_upload','false','No'),
+('dropbox_allow_student_to_student','true','Yes'),
+('dropbox_allow_student_to_student','false','No'),
+('dropbox_allow_group','true','Yes'),
+('dropbox_allow_group','false','No'),
+('dropbox_allow_mailing','true','Yes'),
+('dropbox_allow_mailing','false','No'),
+('extended_profile','true','Yes'),
+('extended_profile','false','No'),
+('student_view_enabled','true','Yes'),
+('student_view_enabled','false','No'),
+('show_navigation_menu','false','No'),
+('show_navigation_menu','icons','IconsOnly'),
+('show_navigation_menu','text','TextOnly'),
+('show_navigation_menu','iconstext','IconsText'),
+('enable_tool_introduction','true','Yes'),
+('enable_tool_introduction','false','No'),
+('page_after_login', 'index.php', 'CampusHomepage'),
+('page_after_login', 'user_portal.php', 'MyCourses'),
+('breadcrumbs_course_homepage', 'get_lang', 'CourseHomepage'),
+('breadcrumbs_course_homepage', 'course_code', 'CourseCode'),
+('breadcrumbs_course_homepage', 'course_title', 'CourseTitle'),
+('example_material_course_creation', 'true', 'Yes'),
+('example_material_course_creation', 'false', 'No'),
+('use_session_mode', 'true', 'Yes'),
+('use_session_mode', 'false', 'No'),
+('allow_email_editor', 'true' ,'Yes'),
+('allow_email_editor', 'false', 'No'),
+('show_email_addresses','true','Yes'),
+('show_email_addresses','false','No'),
+('wcag_anysurfer_public_pages', 'true', 'Yes'),
+('wcag_anysurfer_public_pages', 'false', 'No'),
+('upload_extensions_list_type', 'blacklist', 'Blacklist'),
+('upload_extensions_list_type', 'whitelist', 'Whitelist'),
+('upload_extensions_skip', 'true', 'Remove'),
+('upload_extensions_skip', 'false', 'Rename'),
+('show_number_of_courses', 'true', 'Yes'),
+('show_number_of_courses', 'false', 'No'),
+('show_empty_course_categories', 'true', 'Yes'),
+('show_empty_course_categories', 'false', 'No'),
+('show_back_link_on_top_of_tree', 'true', 'Yes'),
+('show_back_link_on_top_of_tree', 'false', 'No'),
+('show_different_course_language', 'true', 'Yes'),
+('show_different_course_language', 'false', 'No'),
+('split_users_upload_directory', 'true', 'Yes'),
+('split_users_upload_directory', 'false', 'No'),
+('hide_dltt_markup', 'false', 'No'),
+('hide_dltt_markup', 'true', 'Yes'),
+('display_categories_on_homepage','true','Yes'),
+('display_categories_on_homepage','false','No'),
+('default_forum_view', 'flat', 'Flat'),
+('default_forum_view', 'threaded', 'Threaded'),
+('default_forum_view', 'nested', 'Nested'),
+('survey_email_sender_noreply', 'coach', 'CourseCoachEmailSender'),
+('survey_email_sender_noreply', 'noreply', 'NoReplyEmailSender'),
+('openid_authentication','true','Yes'),
+('openid_authentication','false','No'),
+('gradebook_enable','true','Yes'),
+('gradebook_enable','false','No'),
+('user_selected_theme','true','Yes'),
+('user_selected_theme','false','No'),
+('allow_course_theme','true','Yes'),
+('allow_course_theme','false','No'),
+('display_mini_month_calendar', 'true', 'Yes'),
+('display_mini_month_calendar', 'false', 'No'),
+('display_upcoming_events', 'true', 'Yes'),
+('display_upcoming_events', 'false', 'No'),
+('show_closed_courses', 'true', 'Yes'),
+('show_closed_courses', 'false', 'No'),
+('ldap_version', '2', 'LDAPVersion2'),
+('ldap_version', '3', 'LDAPVersion3'),
+('visio_use_rtmpt','true','Yes'),
+('visio_use_rtmpt','false','No'),
+('add_users_by_coach', 'true', 'Yes'),
+('add_users_by_coach', 'false', 'No'),
+('extend_rights_for_coach', 'true', 'Yes'),
+('extend_rights_for_coach', 'false', 'No'),
+('extend_rights_for_coach_on_survey', 'true', 'Yes'),
+('extend_rights_for_coach_on_survey', 'false', 'No'),
+('show_session_coach', 'true', 'Yes'),
+('show_session_coach', 'false', 'No'),
+('allow_users_to_create_courses','true','Yes'),
+('allow_users_to_create_courses','false','No'),
+('breadcrumbs_course_homepage', 'session_name_and_course_title', 'SessionNameAndCourseTitle'),
+('advanced_filemanager','true','Yes'),
+('advanced_filemanager','false','No'),
+('allow_reservation', 'true', 'Yes'),
+('allow_reservation', 'false', 'No'),
+('allow_message_tool', 'true', 'Yes'),
+('allow_message_tool', 'false', 'No'),
+('allow_social_tool', 'true', 'Yes'),
+('allow_social_tool', 'false', 'No'),
+('allow_students_to_browse_courses','true','Yes'),
+('allow_students_to_browse_courses','false','No'),
+('show_email_of_teacher_or_tutor ', 'true', 'Yes'),
+('show_email_of_teacher_or_tutor ', 'false', 'No'),
+('show_session_data ', 'true', 'Yes'),
+('show_session_data ', 'false', 'No'),
+('allow_use_sub_language', 'true', 'Yes'),
+('allow_use_sub_language', 'false', 'No'),
+('show_glossary_in_documents', 'none', 'ShowGlossaryInDocumentsIsNone'),
+('show_glossary_in_documents', 'ismanual', 'ShowGlossaryInDocumentsIsManual'),
+('show_glossary_in_documents', 'isautomatic', 'ShowGlossaryInDocumentsIsAutomatic'),
+('allow_terms_conditions', 'true', 'Yes'),
+('allow_terms_conditions', 'false', 'No'),
+('search_enabled', 'true', 'Yes'),
+('search_enabled', 'false', 'No'),
+('search_show_unlinked_results', 'true', 'SearchShowUnlinkedResults'),
+('search_show_unlinked_results', 'false', 'SearchHideUnlinkedResults'),
+('show_courses_descriptions_in_catalog', 'true', 'Yes'),
+('show_courses_descriptions_in_catalog', 'false', 'No'),
+('allow_coach_to_edit_course_session','true','Yes'),
+('allow_coach_to_edit_course_session','false','No'),
+('show_glossary_in_extra_tools', 'true', 'Yes'),
+('show_glossary_in_extra_tools', 'false', 'No'),
+('send_email_to_admin_when_create_course','true','Yes'),
+('send_email_to_admin_when_create_course','false','No'),
+('go_to_course_after_login','true','Yes'),
+('go_to_course_after_login','false','No'),
+('math_mimetex','true','Yes'),
+('math_mimetex','false','No'),
+('math_asciimathML','true','Yes'),
+('math_asciimathML','false','No'),
+('enabled_asciisvg','true','Yes'),
+('enabled_asciisvg','false','No'),
+('include_asciimathml_script','true','Yes'),
+('include_asciimathml_script','false','No'),
+('youtube_for_students','true','Yes'),
+('youtube_for_students','false','No'),
+('block_copy_paste_for_students','true','Yes'),
+('block_copy_paste_for_students','false','No'),
+('more_buttons_maximized_mode','true','Yes'),
+('more_buttons_maximized_mode','false','No'),
+('students_download_folders','true','Yes'),
+('students_download_folders','false','No'),
+('users_copy_files','true','Yes'),
+('users_copy_files','false','No'),
+('allow_students_to_create_groups_in_social','true','Yes'),
+('allow_students_to_create_groups_in_social','false','No'),
+('allow_send_message_to_all_platform_users','true','Yes'),
+('allow_send_message_to_all_platform_users','false','No'),
+('use_users_timezone', 'true', 'Yes'),
+('use_users_timezone', 'false', 'No'),
+('allow_user_course_subscription_by_course_admin', 'true', 'Yes'),
+('allow_user_course_subscription_by_course_admin', 'false', 'No'),
+('show_link_bug_notification', 'true', 'Yes'),
+('show_link_bug_notification', 'false', 'No'),
+('course_validation', 'true', 'Yes'),
+('course_validation', 'false', 'No'),
+('sso_authentication', 'true', 'Yes'),
+('sso_authentication', 'false', 'No'),
+('sso_authentication_protocol', 'http://', 'http://'),
+('sso_authentication_protocol', 'https://', 'https://'),
+('enabled_wiris','true','Yes'),
+('enabled_wiris','false','No'),
+('allow_spellcheck','true','Yes'),
+('allow_spellcheck','false','No'),
+('force_wiki_paste_as_plain_text','true','Yes'),
+('force_wiki_paste_as_plain_text','false','No'),
+('enabled_googlemaps','true','Yes'),
+('enabled_googlemaps','false','No'),
+('enabled_imgmap','true','Yes'),
+('enabled_imgmap','false','No'),
+('enabled_support_svg','true','Yes'),
+('enabled_support_svg','false','No'),
+('pdf_export_watermark_enable','true','Yes'),
+('pdf_export_watermark_enable','false','No'),
+('pdf_export_watermark_by_course','true','Yes'),
+('pdf_export_watermark_by_course','false','No'),
+('enabled_insertHtml','true','Yes'),
+('enabled_insertHtml','false','No'),
+('students_export2pdf','true','Yes'),
+('students_export2pdf','false','No'),
+('show_users_folders','true','Yes'),
+('show_users_folders','false','No'),
+('show_default_folders','true','Yes'),
+('show_default_folders','false','No'),
+('show_chat_folder','true','Yes'),
+('show_chat_folder','false','No'),
+('enabled_text2audio','true','Yes'),
+('enabled_text2audio','false','No'),
+('enabled_support_pixlr','true','Yes'),
+('enabled_support_pixlr','false','No'),
+('show_groups_to_users','true','Yes'),
+('show_groups_to_users','false','No'),
+('accessibility_font_resize', 'true', 'Yes'),
+('accessibility_font_resize', 'false', 'No'),
+('hide_courses_in_sessions','true','Yes'),
+('hide_courses_in_sessions','false','No'),
+('enable_quiz_scenario', 'true', 'Yes'),
+('enable_quiz_scenario', 'false', 'No'),
+('enable_nanogong','true','Yes'),
+('enable_nanogong','false','No');
+
+UNLOCK TABLES;
+
+/*!40000 ALTER TABLE settings_options ENABLE KEYS */;
+
+--
+-- Table structure for table sys_announcement
+--
+
+DROP TABLE IF EXISTS sys_announcement;
+CREATE TABLE sys_announcement (
+  id int unsigned NOT NULL auto_increment,
+  date_start datetime NOT NULL default '0000-00-00 00:00:00',
+  date_end datetime NOT NULL default '0000-00-00 00:00:00',
+  visible_teacher tinyint NOT NULL default 0,
+  visible_student tinyint NOT NULL default 0,
+  visible_guest tinyint NOT NULL default 0,
+  title varchar(250) NOT NULL default '',
+  content text NOT NULL,
+  lang varchar(70) NULL default NULL,
+  access_url_id INT NOT NULL default 1,
+  PRIMARY KEY  (id)
+);
+
+--
+-- Dumping data for table sys_announcement
+--
+
+
+/*!40000 ALTER TABLE sys_announcement DISABLE KEYS */;
+LOCK TABLES sys_announcement WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE sys_announcement ENABLE KEYS */;
+
+--
+-- Table structure for shared_survey
+--
+
+DROP TABLE IF EXISTS shared_survey;
+CREATE TABLE shared_survey (
+  survey_id int unsigned NOT NULL auto_increment,
+  code varchar(20) default NULL,
+  title text default NULL,
+  subtitle text default NULL,
+  author varchar(250) default NULL,
+  lang varchar(20) default NULL,
+  template varchar(20) default NULL,
+  intro text,
+  surveythanks text,
+  creation_date datetime NOT NULL default '0000-00-00 00:00:00',
+  course_code varchar(40) NOT NULL default '',
+  PRIMARY KEY  (survey_id),
+  UNIQUE KEY id (survey_id)
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for shared_survey_question
+--
+
+DROP TABLE IF EXISTS shared_survey_question;
+CREATE TABLE shared_survey_question (
+  question_id int NOT NULL auto_increment,
+  survey_id int NOT NULL default '0',
+  survey_question text NOT NULL,
+  survey_question_comment text NOT NULL,
+  type varchar(250) NOT NULL default '',
+  display varchar(10) NOT NULL default '',
+  sort int NOT NULL default '0',
+  code varchar(40) NOT NULL default '',
+  max_value int NOT NULL,
+  PRIMARY KEY  (question_id)
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for shared_survey_question_option
+--
+
+DROP TABLE IF EXISTS shared_survey_question_option;
+CREATE TABLE shared_survey_question_option (
+  question_option_id int NOT NULL auto_increment,
+  question_id int NOT NULL default '0',
+  survey_id int NOT NULL default '0',
+  option_text text NOT NULL,
+  sort int NOT NULL default '0',
+  PRIMARY KEY  (question_option_id)
+);
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for templates (User's FCKEditor templates)
+--
+
+DROP TABLE IF EXISTS templates;
+CREATE TABLE templates (
+  id int NOT NULL auto_increment,
+  title varchar(100) NOT NULL,
+  description varchar(250) NOT NULL,
+  course_code varchar(40) NOT NULL,
+  user_id int NOT NULL,
+  ref_doc int NOT NULL,
+  image varchar(250) NOT NULL,
+  PRIMARY KEY  (id)
+);
+
+
+
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure of openid_association (keep info on openid servers)
+--
+
+DROP TABLE IF EXISTS openid_association;
+CREATE TABLE IF NOT EXISTS openid_association (
+  id int NOT NULL auto_increment,
+  idp_endpoint_uri text NOT NULL,
+  session_type varchar(30) NOT NULL,
+  assoc_handle text NOT NULL,
+  assoc_type text NOT NULL,
+  expires_in bigint NOT NULL,
+  mac_key text NOT NULL,
+  created bigint NOT NULL,
+  PRIMARY KEY  (id)
+);
+--
+-- --------------------------------------------------------
+--
+-- Tables for gradebook
+--
+DROP TABLE IF EXISTS gradebook_category;
+CREATE TABLE gradebook_category (
+  id int NOT NULL auto_increment,
+  name text NOT NULL,
+  description text,
+  user_id int NOT NULL,
+  course_code varchar(40) default NULL,
+  parent_id int default NULL,
+  weight smallint NOT NULL,
+  visible tinyint NOT NULL,
+  certif_min_score int DEFAULT NULL,
+  session_id int DEFAULT NULL,
+  document_id int unsigned DEFAULT NULL,
+  PRIMARY KEY  (id)
+);
+DROP TABLE IF EXISTS gradebook_evaluation;
+CREATE TABLE gradebook_evaluation (
+  id int unsigned NOT NULL auto_increment,
+  name text NOT NULL,
+  description text,
+  user_id int NOT NULL,
+  course_code varchar(40) default NULL,
+  category_id int default NULL,
+  created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+  weight smallint NOT NULL,
+  max float unsigned NOT NULL,
+  visible tinyint NOT NULL,
+  type varchar(40) NOT NULL default 'evaluation',
+  locked int NOT NULL DEFAULT 0,
+  PRIMARY KEY  (id)
+);
+DROP TABLE IF EXISTS gradebook_link;
+CREATE TABLE gradebook_link (
+  id int NOT NULL auto_increment,
+  type int NOT NULL,
+  ref_id int NOT NULL,
+  user_id int NOT NULL,
+  course_code varchar(40) NOT NULL,
+  category_id int NOT NULL,
+  created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+  weight smallint NOT NULL,
+  visible tinyint NOT NULL,
+  PRIMARY KEY  (id)
+);
+DROP TABLE IF EXISTS gradebook_result;
+CREATE TABLE gradebook_result (
+  id int NOT NULL auto_increment,
+  user_id int NOT NULL,
+  evaluation_id int NOT NULL,
+  created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+  score float unsigned default NULL,
+  PRIMARY KEY  (id)
+);
+DROP TABLE IF EXISTS gradebook_score_display;
+CREATE TABLE gradebook_score_display (
+  id int NOT NULL auto_increment,
+  score float unsigned NOT NULL,
+  display varchar(40) NOT NULL,
+  category_id int NOT NULL default 0,
+  score_color_percent float unsigned NOT NULL default 0,
+  PRIMARY KEY (id)
+);
+ALTER TABLE gradebook_score_display ADD INDEX(category_id);
+
+DROP TABLE IF EXISTS user_field;
+CREATE TABLE user_field (
+    id	INT NOT NULL auto_increment,
+    field_type int NOT NULL DEFAULT 1,
+    field_variable	varchar(64) NOT NULL,
+    field_display_text	varchar(64),
+    field_default_value text,
+    field_order int,
+    field_visible tinyint default 0,
+    field_changeable tinyint default 0,
+    field_filter tinyint default 0,
+    tms	DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+DROP TABLE IF EXISTS user_field_options;
+CREATE TABLE user_field_options (
+    id	int NOT NULL auto_increment,
+    field_id int	NOT NULL,
+    option_value	text,
+    option_display_text varchar(64),
+    option_order int,
+    tms	DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY (id)
+);
+DROP TABLE IF EXISTS user_field_values;
+CREATE TABLE user_field_values(
+    id	bigint	NOT NULL auto_increment,
+    user_id	int	unsigned NOT NULL,
+    field_id int NOT NULL,
+    field_value	text,
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+ALTER TABLE user_field_values ADD INDEX (user_id, field_id);
+
+DROP TABLE IF EXISTS gradebook_result_log;
+CREATE TABLE gradebook_result_log (
+    id int NOT NULL auto_increment,
+    id_result int NOT NULL,
+    user_id int NOT NULL,
+    evaluation_id int NOT NULL,
+    created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+    score float unsigned default NULL,
+    PRIMARY KEY(id)
+);
+
+DROP TABLE IF EXISTS gradebook_linkeval_log;
+CREATE TABLE gradebook_linkeval_log (
+    id int NOT NULL auto_increment,
+    id_linkeval_log int NOT NULL,
+    name text,
+    description text,
+    created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+    weight smallint default NULL,
+    visible tinyint default NULL,
+    type varchar(20) NOT NULL,
+    user_id_log int NOT NULL,
+    PRIMARY KEY  (id)
+);
+
+--
+-- --------------------------------------------------------
+--
+-- Tables for the access URL feature
+--
+
+DROP TABLE IF EXISTS access_url;
+CREATE TABLE access_url(
+    id	int	unsigned NOT NULL auto_increment,
+    url	varchar(255) NOT NULL,
+    description text,
+    active	int unsigned not null default 0,
+    created_by	int	not null,
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY (id)
+);
+
+INSERT INTO access_url(url, description, active, created_by) VALUES ('http://localhost/',' ',1,1);
+
+DROP TABLE IF EXISTS access_url_rel_user;
+CREATE TABLE access_url_rel_user (
+  access_url_id int unsigned NOT NULL,
+  user_id int unsigned NOT NULL,
+  PRIMARY KEY (access_url_id, user_id)
+);
+
+ALTER TABLE access_url_rel_user ADD INDEX idx_access_url_rel_user_user (user_id);
+ALTER TABLE access_url_rel_user ADD INDEX idx_access_url_rel_user_access_url(access_url_id);
+ALTER TABLE access_url_rel_user ADD INDEX idx_access_url_rel_user_access_url_user (user_id,access_url_id);
+
+DROP TABLE IF EXISTS access_url_rel_course;
+CREATE TABLE access_url_rel_course (
+  access_url_id int unsigned NOT NULL,
+  course_code char(40) NOT NULL,
+  PRIMARY KEY (access_url_id, course_code)
+);
+
+
+DROP TABLE IF EXISTS access_url_rel_session;
+CREATE TABLE access_url_rel_session (
+  access_url_id int unsigned NOT NULL,
+  session_id int unsigned NOT NULL,
+  PRIMARY KEY (access_url_id, session_id)
+);
+
+--
+-- Table structure for table sys_calendar
+--
+CREATE TABLE IF NOT EXISTS sys_calendar (
+  id int unsigned NOT NULL auto_increment,
+  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',
+  access_url_id INT NOT NULL default 1,
+  PRIMARY KEY  (id)
+);
+
+CREATE TABLE IF NOT EXISTS system_template (
+  id int UNSIGNED NOT NULL auto_increment,
+  title varchar(250) NOT NULL,
+  comment text NOT NULL,
+  image varchar(250) NOT NULL,
+  content text NOT NULL,
+  PRIMARY KEY  (id)
+);
+
+-- Adding the platform templates
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleCourseTitle', 'TemplateTitleCourseTitleDescription', 'coursetitle.gif', '
+<head>
+                {CSS}
+                <style type="text/css">
+                .gris_title         	{
+                    color: silver;
+                }
+                h1
+                {
+                    text-align: right;
+                }
+                </style>
+
+            </head>
+            <body>
+            <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+            <tbody>
+            <tr>
+            <td style="vertical-align: middle; width: 50%;" colspan="1" rowspan="1">
+                <h1>TITULUS 1<br>
+                <span class="gris_title">TITULUS 2</span><br>
+                </h1>
+            </td>
+            <td style="width: 50%;">
+                <img style="width: 100px; height: 100px;" alt="dokeos logo" src="{COURSE_DIR}images/logo_dokeos.png"></td>
+            </tr>
+            </tbody>
+            </table>
+            <p><br>
+            <br>
+            </p>
+            </body>
+');
+
+/*
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleCheckList', 'TemplateTitleCheckListDescription', 'checklist.gif', '
+      <head>
+                   {CSS}
+                </head>
+                <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                <tbody>
+                <tr>
+                <td style="vertical-align: top; width: 66%;">
+                <h3>Lorem ipsum dolor sit amet</h3>
+                <ul>
+                    <li>consectetur adipisicing elit</li>
+                    <li>sed do eiusmod tempor incididunt</li>
+                    <li>ut labore et dolore magna aliqua</li>
+                </ul>
+
+                <h3>Ut enim ad minim veniam</h3>
+                <ul>
+                    <li>quis nostrud exercitation ullamco</li>
+                    <li>laboris nisi ut aliquip ex ea commodo consequat</li>
+                    <li>Excepteur sint occaecat cupidatat non proident</li>
+                </ul>
+
+                <h3>Sed ut perspiciatis unde omnis</h3>
+                <ul>
+                    <li>iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam</li>
+                    <li>eaque ipsa quae ab illo inventore veritatis</li>
+                    <li>et quasi architecto beatae vitae dicta sunt explicabo.&nbsp;</li>
+                </ul>
+
+                </td>
+                <td style="background: transparent url({IMG_DIR}postit.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; width: 33%; text-align: center; vertical-align: bottom;">
+                <h3>Ut enim ad minima</h3>
+                Veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur.<br>
+                <h3>
+                <img style="width: 180px; height: 144px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_smile.png "><br></h3>
+                </td>
+                </tr>
+                </tbody>
+                </table>
+                <p><br>
+                <br>
+                </p>
+                </body>
+');
+*/
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleTeacher', 'TemplateTitleTeacherDescription', 'yourinstructor.gif', '
+<head>
+                   {CSS}
+                   <style type="text/css">
+                    .text
+                    {
+                        font-weight: normal;
+                    }
+                    </style>
+                </head>
+                <body>
+                    <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                    <tbody>
+                    <tr>
+                    <td></td>
+                    <td style="height: 33%;"></td>
+                    <td></td>
+                    </tr>
+                    <tr>
+                    <td style="width: 25%;"></td>
+                    <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right; font-weight: bold;" colspan="1" rowspan="1">
+                    <span class="text">
+                    <br>
+                    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis pellentesque.</span>
+                    </td>
+                    <td style="width: 25%; font-weight: bold;">
+                    <img style="width: 180px; height: 241px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_case.png "></td>
+                    </tr>
+                    </tbody>
+                    </table>
+                    <p><br>
+                    <br>
+                    </p>
+                </body>
+');
+
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleLeftList', 'TemplateTitleListLeftListDescription', 'leftlist.gif', '
+<head>
+               {CSS}
+           </head>
+            <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                <tbody>
+                <tr>
+                <td style="width: 66%;"></td>
+                <td style="vertical-align: bottom; width: 33%;" colspan="1" rowspan="4">&nbsp;<img style="width: 180px; height: 248px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_reads.png "><br>
+                </td>
+                </tr>
+                <tr align="right">
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">Lorem
+                ipsum dolor sit amet.
+                </td>
+                </tr>
+                <tr align="right">
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
+                Vivamus
+                a quam.&nbsp;<br>
+                </td>
+                </tr>
+                <tr align="right">
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
+                Proin
+                a est stibulum ante ipsum.</td>
+                </tr>
+                </tbody>
+                </table>
+            <p><br>
+            <br>
+            </p>
+            </body>
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleLeftRightList', 'TemplateTitleLeftRightListDescription', 'leftrightlist.gif', '
+
+<head>
+               {CSS}
+            </head>
+            <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; height: 400px; width: 720px;" border="0" cellpadding="15" cellspacing="6">
+                <tbody>
+                <tr>
+                <td></td>
+                <td style="vertical-align: top;" colspan="1" rowspan="4">&nbsp;<img style="width: 180px; height: 294px;" alt="Trainer" src="{COURSE_DIR}images/trainer/trainer_join_hands.png "><br>
+                </td>
+                <td></td>
+                </tr>
+                <tr>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right;">Lorem
+                ipsum dolor sit amet.
+                </td>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: left;">
+                Convallis
+                ut.&nbsp;Cras dui magna.</td>
+                </tr>
+                <tr>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right;">
+                Vivamus
+                a quam.&nbsp;<br>
+                </td>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: left;">
+                Etiam
+                lacinia stibulum ante.<br>
+                </td>
+                </tr>
+                <tr>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right;">
+                Proin
+                a est stibulum ante ipsum.</td>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: left;">
+                Consectetuer
+                adipiscing elit. <br>
+                </td>
+                </tr>
+                </tbody>
+                </table>
+            <p><br>
+            <br>
+            </p>
+            </body>
+
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleRightList', 'TemplateTitleRightListDescription', 'rightlist.gif', '
+    <head>
+               {CSS}
+            </head>
+            <body style="direction: ltr;">
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                <tbody>
+                <tr>
+                <td style="vertical-align: bottom; width: 50%;" colspan="1" rowspan="4"><img style="width: 300px; height: 199px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_points_right.png"><br>
+                </td>
+                <td style="width: 50%;"></td>
+                </tr>
+                <tr>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 50%;">
+                Convallis
+                ut.&nbsp;Cras dui magna.</td>
+                </tr>
+                <tr>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 50%;">
+                Etiam
+                lacinia.<br>
+                </td>
+                </tr>
+                <tr>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 50%;">
+                Consectetuer
+                adipiscing elit. <br>
+                </td>
+                </tr>
+                </tbody>
+                </table>
+            <p><br>
+            <br>
+            </p>
+            </body>
+');
+
+/*
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleComparison', 'TemplateTitleComparisonDescription', 'compare.gif', '
+<head>
+            {CSS}
+            </head>
+
+            <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                <tr>
+                    <td style="height: 10%; width: 33%;"></td>
+                    <td style="vertical-align: top; width: 33%;" colspan="1" rowspan="2">&nbsp;<img style="width: 180px; height: 271px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_standing.png "><br>
+                    </td>
+                    <td style="height: 10%; width: 33%;"></td>
+                </tr>
+            <tr>
+            <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right;">
+            Lorem ipsum dolor sit amet.
+            </td>
+            <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 33%;">
+            Convallis
+            ut.&nbsp;Cras dui magna.</td>
+            </tr>
+            </body>
+');
+*/
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleDiagram', 'TemplateTitleDiagramDescription', 'diagram.gif', '
+    <head>
+                       {CSS}
+                    </head>
+
+                    <body>
+                    <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                    <tbody>
+                    <tr>
+                    <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; height: 33%; width: 33%;">
+                    <br>
+                    Etiam
+                    lacinia stibulum ante.
+                    Convallis
+                    ut.&nbsp;Cras dui magna.</td>
+                    <td colspan="1" rowspan="3">
+                        <img style="width: 350px; height: 267px;" alt="Alaska chart" src="{COURSE_DIR}images/diagrams/alaska_chart.png "></td>
+                    </tr>
+                    <tr>
+                    <td colspan="1" rowspan="1">
+                    <img style="width: 300px; height: 199px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_points_right.png "></td>
+                    </tr>
+                    <tr>
+                    </tr>
+                    </tbody>
+                    </table>
+                    <p><br>
+                    <br>
+                    </p>
+                    </body>
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleDesc', 'TemplateTitleCheckListDescription', 'description.gif', '
+<head>
+                       {CSS}
+                    </head>
+                    <body>
+                        <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                        <tbody>
+                        <tr>
+                        <td style="width: 50%; vertical-align: top;">
+                            <img style="width: 48px; height: 49px; float: left;" alt="01" src="{COURSE_DIR}images/small/01.png " hspace="5"><br>Lorem ipsum dolor sit amet<br><br><br>
+                            <img style="width: 48px; height: 49px; float: left;" alt="02" src="{COURSE_DIR}images/small/02.png " hspace="5">
+                            <br>Ut enim ad minim veniam<br><br><br>
+                            <img style="width: 48px; height: 49px; float: left;" alt="03" src="{COURSE_DIR}images/small/03.png " hspace="5">Duis aute irure dolor in reprehenderit<br><br><br>
+                            <img style="width: 48px; height: 49px; float: left;" alt="04" src="{COURSE_DIR}images/small/04.png " hspace="5">Neque porro quisquam est</td>
+
+                        <td style="vertical-align: top; width: 50%; text-align: right;" colspan="1" rowspan="1">
+                            <img style="width: 300px; height: 291px;" alt="Gearbox" src="{COURSE_DIR}images/diagrams/gearbox.jpg "><br></td>
+                        </tr><tr></tr>
+                        </tbody>
+                        </table>
+                        <p><br>
+                        <br>
+                        </p>
+                    </body>
+');
+
+/*
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleObjectives', 'TemplateTitleObjectivesDescription', 'courseobjectives.gif', '
+<head>
+                   {CSS}
+                </head>
+
+                <body>
+                    <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                    <tbody>
+                    <tr>
+                    <td style="vertical-align: bottom; width: 33%;" colspan="1" rowspan="2">
+                    <img style="width: 180px; height: 271px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_chair.png "><br>
+                    </td>
+                    <td style="height: 10%; width: 66%;"></td>
+                    </tr>
+                    <tr>
+                    <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 66%;">
+                    <h3>Lorem ipsum dolor sit amet</h3>
+                    <ul>
+                    <li>consectetur adipisicing elit</li>
+                    <li>sed do eiusmod tempor incididunt</li>
+                    <li>ut labore et dolore magna aliqua</li>
+                    </ul>
+                    <h3>Ut enim ad minim veniam</h3>
+                    <ul>
+                    <li>quis nostrud exercitation ullamco</li>
+                    <li>laboris nisi ut aliquip ex ea commodo consequat</li>
+                    <li>Excepteur sint occaecat cupidatat non proident</li>
+                    </ul>
+                    </td>
+                    </tr>
+                    </tbody>
+                    </table>
+                <p><br>
+                <br>
+                </p>
+                </body>
+');
+*/
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleCycle', 'TemplateTitleCycleDescription', 'cyclechart.gif', '
+<head>
+                   {CSS}
+                   <style>
+                   .title
+                   {
+                       color: white; font-weight: bold;
+                   }
+                   </style>
+                </head>
+
+
+                <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="8" cellspacing="6">
+                <tbody>
+                <tr>
+                    <td style="text-align: center; vertical-align: bottom; height: 10%;" colspan="3" rowspan="1">
+                        <img style="width: 250px; height: 76px;" alt="arrow" src="{COURSE_DIR}images/diagrams/top_arrow.png ">
+                    </td>
+                </tr>
+                <tr>
+                    <td style="height: 5%; width: 45%; vertical-align: top; background-color: rgb(153, 153, 153); text-align: center;">
+                        <span class="title">Lorem ipsum</span>
+                    </td>
+
+                    <td style="height: 5%; width: 10%;"></td>
+                    <td style="height: 5%; vertical-align: top; background-color: rgb(153, 153, 153); text-align: center;">
+                        <span class="title">Sed ut perspiciatis</span>
+                    </td>
+                </tr>
+                    <tr>
+                        <td style="background-color: rgb(204, 204, 255); width: 45%; vertical-align: top;">
+                            <ul>
+                                <li>dolor sit amet</li>
+                                <li>consectetur adipisicing elit</li>
+                                <li>sed do eiusmod tempor&nbsp;</li>
+                                <li>adipisci velit, sed quia non numquam</li>
+                                <li>eius modi tempora incidunt ut labore et dolore magnam</li>
+                            </ul>
+                </td>
+                <td style="width: 10%;"></td>
+                <td style="background-color: rgb(204, 204, 255); width: 45%; vertical-align: top;">
+                    <ul>
+                    <li>ut enim ad minim veniam</li>
+                    <li>quis nostrud exercitation</li><li>ullamco laboris nisi ut</li>
+                    <li> Quis autem vel eum iure reprehenderit qui in ea</li>
+                    <li>voluptate velit esse quam nihil molestiae consequatur,</li>
+                    </ul>
+                    </td>
+                    </tr>
+                    <tr align="center">
+                    <td style="height: 10%; vertical-align: top;" colspan="3" rowspan="1">
+                    <img style="width: 250px; height: 76px;" alt="arrow" src="{COURSE_DIR}images/diagrams/bottom_arrow.png ">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
+                </td>
+                </tr>
+                </tbody>
+                </table>
+                <p><br>
+                <br>
+                </p>
+                </body>
+');
+
+/*
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleLearnerWonder', 'TemplateTitleLearnerWonderDescription', 'learnerwonder.gif', '
+<head>
+               {CSS}
+            </head>
+
+            <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                <tbody>
+                <tr>
+                <td style="width: 33%;" colspan="1" rowspan="4">
+                    <img style="width: 120px; height: 348px;" alt="learner wonders" src="{COURSE_DIR}images/silhouette.png "><br>
+                </td>
+                <td style="width: 66%;"></td>
+                </tr>
+                <tr align="center">
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
+                Convallis
+                ut.&nbsp;Cras dui magna.</td>
+                </tr>
+                <tr align="center">
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
+                Etiam
+                lacinia stibulum ante.<br>
+                </td>
+                </tr>
+                <tr align="center">
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
+                Consectetuer
+                adipiscing elit. <br>
+                </td>
+                </tr>
+                </tbody>
+                </table>
+            <p><br>
+            <br>
+            </p>
+            </body>
+');
+*/
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleTimeline', 'TemplateTitleTimelineDescription', 'phasetimeline.gif', '
+<head>
+               {CSS}
+                <style>
+                .title
+                {
+                    font-weight: bold; text-align: center;
+                }
+                </style>
+            </head>
+
+            <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="8" cellspacing="5">
+                <tbody>
+                <tr class="title">
+                    <td style="vertical-align: top; height: 3%; background-color: rgb(224, 224, 224);">Lorem ipsum</td>
+                    <td style="height: 3%;"></td>
+                    <td style="vertical-align: top; height: 3%; background-color: rgb(237, 237, 237);">Perspiciatis</td>
+                    <td style="height: 3%;"></td>
+                    <td style="vertical-align: top; height: 3%; background-color: rgb(245, 245, 245);">Nemo enim</td>
+                </tr>
+
+                <tr>
+                    <td style="vertical-align: top; width: 30%; background-color: rgb(224, 224, 224);">
+                        <ul>
+                        <li>dolor sit amet</li>
+                        <li>consectetur</li>
+                        <li>adipisicing elit</li>
+                    </ul>
+                    <br>
+                    </td>
+                    <td>
+                        <img style="width: 32px; height: 32px;" alt="arrow" src="{COURSE_DIR}images/small/arrow.png ">
+                    </td>
+
+                    <td style="vertical-align: top; width: 30%; background-color: rgb(237, 237, 237);">
+                        <ul>
+                            <li>ut labore</li>
+                            <li>et dolore</li>
+                            <li>magni dolores</li>
+                        </ul>
+                    </td>
+                    <td>
+                        <img style="width: 32px; height: 32px;" alt="arrow" src="{COURSE_DIR}images/small/arrow.png ">
+                    </td>
+
+                    <td style="vertical-align: top; background-color: rgb(245, 245, 245); width: 30%;">
+                        <ul>
+                            <li>neque porro</li>
+                            <li>quisquam est</li>
+                            <li>qui dolorem&nbsp;&nbsp;</li>
+                        </ul>
+                        <br><br>
+                    </td>
+                </tr>
+                </tbody>
+                </table>
+            <p><br>
+            <br>
+            </p>
+            </body>
+');
+
+/*
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleStopAndThink', 'TemplateTitleStopAndThinkDescription', 'stopthink.gif', '
+<head>
+               {CSS}
+            </head>
+            <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                <tbody>
+                <tr>
+                <td style="vertical-align: bottom; width: 33%;" colspan="1" rowspan="2">
+                    <img style="width: 180px; height: 169px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_staring.png ">
+                <br>
+                </td>
+                <td style="height: 10%; width: 66%;"></td>
+                </tr>
+                <tr>
+                <td style="background: transparent url({IMG_DIR}postit.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; width: 66%; vertical-align: middle; text-align: center;">
+                    <h3>Attentio sectetur adipisicing elit</h3>
+                    <ul>
+                        <li>sed do eiusmod tempor incididunt</li>
+                        <li>ut labore et dolore magna aliqua</li>
+                        <li>quis nostrud exercitation ullamco</li>
+                    </ul><br></td>
+                </tr>
+                </tbody>
+                </table>
+            <p><br>
+            <br>
+            </p>
+            </body>
+');
+*/
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleTable', 'TemplateTitleCheckListDescription', 'table.gif', '
+<head>
+                   {CSS}
+                   <style type="text/css">
+                .title
+                {
+                    font-weight: bold; text-align: center;
+                }
+
+                .items
+                {
+                    text-align: right;
+                }
+
+
+                    </style>
+
+                </head>
+                <body>
+                <br />
+               <h2>A table</h2>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px;" border="1" cellpadding="5" cellspacing="0">
+                <tbody>
+                <tr class="title">
+                    <td>City</td>
+                    <td>2005</td>
+                    <td>2006</td>
+                    <td>2007</td>
+                    <td>2008</td>
+                </tr>
+                <tr class="items">
+                    <td>Lima</td>
+                    <td>10,40</td>
+                    <td>8,95</td>
+                    <td>9,19</td>
+                    <td>9,76</td>
+                </tr>
+                <tr class="items">
+                <td>New York</td>
+                    <td>18,39</td>
+                    <td>17,52</td>
+                    <td>16,57</td>
+                    <td>16,60</td>
+                </tr>
+                <tr class="items">
+                <td>Barcelona</td>
+                    <td>0,10</td>
+                    <td>0,10</td>
+                    <td>0,05</td>
+                    <td>0,05</td>
+                </tr>
+                <tr class="items">
+                <td>Paris</td>
+                    <td>3,38</td>
+                    <td >3,63</td>
+                    <td>3,63</td>
+                    <td>3,54</td>
+                </tr>
+                </tbody>
+                </table>
+                <br>
+                </body>
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleAudio', 'TemplateTitleAudioDescription', 'audiocomment.gif', '
+<head>
+               {CSS}
+            </head>
+                   <body>
+                    <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                    <tbody>
+                    <tr>
+                    <td>
+                    <div align="center">
+                    <span style="text-align: center;">
+                        <embed  type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="300" height="20" bgcolor="#FFFFFF" src="{REL_PATH}main/inc/lib/mediaplayer/player.swf" allowfullscreen="false" allowscriptaccess="always" flashvars="file={COURSE_DIR}audio/ListeningComprehension.mp3&amp;autostart=true"></embed>
+                    </span></div>
+
+                    <br>
+                    </td>
+                    <td colspan="1" rowspan="3"><br>
+                        <img style="width: 300px; height: 341px; float: right;" alt="image" src="{COURSE_DIR}images/diagrams/head_olfactory_nerve.png "><br></td>
+                    </tr>
+                    <tr>
+                    <td colspan="1" rowspan="1">
+                        <img style="width: 180px; height: 271px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_glasses.png"><br></td>
+                    </tr>
+                    <tr>
+                    </tr>
+                    </tbody>
+                    </table>
+                    <p><br>
+                    <br>
+                    </p>
+                    </body>
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleVideo', 'TemplateTitleVideoDescription', 'video.gif', '
+<head>
+                {CSS}
+            </head>
+
+            <body>
+            <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+            <tbody>
+            <tr>
+            <td style="width: 50%; vertical-align: top;">
+
+                 <div style="text-align: center;" id="player810625-parent">
+                    <div style="border-style: none; overflow: hidden; width: 320px; height: 240px; background-color: rgb(220, 220, 220);">
+
+                        <div id="player810625">
+                            <div id="player810625-config" style="overflow: hidden; display: none; visibility: hidden; width: 0px; height: 0px;">url={REL_PATH}main/default_course_document/video/flv/example.flv width=320 height=240 loop=false play=false downloadable=false fullscreen=true displayNavigation=true displayDigits=true align=left dispPlaylist=none playlistThumbs=false</div>
+                        </div>
+
+                        <embed
+                            type="application/x-shockwave-flash"
+                            src="{REL_PATH}main/inc/lib/mediaplayer/player.swf"
+                            width="320"
+                            height="240"
+                            id="single"
+                            name="single"
+                            quality="high"
+                            allowfullscreen="true"
+                            flashvars="width=320&height=240&autostart=false&file={REL_PATH}main/default_course_document/video/flv/example.flv&repeat=false&image=&showdownload=false&link={REL_PATH}main/default_course_document/video/flv/example.flv&showdigits=true&shownavigation=true&logo="
+                        />
+
+                    </div>
+                </div>
+
+            </td>
+            <td style="background: transparent url({IMG_DIR}faded_grey.png) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 50%;">
+            <h3><br>
+            </h3>
+            <h3>Lorem ipsum dolor sit amet</h3>
+                <ul>
+                <li>consectetur adipisicing elit</li>
+                <li>sed do eiusmod tempor incididunt</li>
+                <li>ut labore et dolore magna aliqua</li>
+                </ul>
+            <h3>Ut enim ad minim veniam</h3>
+                <ul>
+                <li>quis nostrud exercitation ullamco</li>
+                <li>laboris nisi ut aliquip ex ea commodo consequat</li>
+                <li>Excepteur sint occaecat cupidatat non proident</li>
+                </ul>
+            </td>
+            </tr>
+            </tbody>
+            </table>
+            <p><br>
+            <br>
+            </p>
+             <style type="text/css">body{}</style><!-- to fix a strange bug appearing with firefox when editing this template -->
+            </body>
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleFlash', 'TemplateTitleFlashDescription', 'flash.gif', '
+<head>
+               {CSS}
+            </head>
+            <body>
+            <center>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 100%; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                <tbody>
+                    <tr>
+                    <td align="center">
+                    <embed width="700" height="300" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="{COURSE_DIR}flash/SpinEchoSequence.swf" play="true" loop="true" menu="true"></embed></span><br />
+                    </td>
+                    </tr>
+                </tbody>
+                </table>
+                <p><br>
+                <br>
+                </p>
+            </center>
+            </body>
+');
+
+
+--
+-- --------------------------------------------------------
+--
+-- Tables for reservation
+--
+
+
+--
+-- Table structure for table reservation category
+--
+
+CREATE TABLE reservation_category (
+   id  int unsigned NOT NULL auto_increment,
+   parent_id  int NOT NULL default 0,
+   name  varchar(128) NOT NULL default '',
+  PRIMARY KEY  ( id )
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table reservation category_rights
+--
+
+CREATE TABLE  reservation_category_rights  (
+   category_id  int NOT NULL default 0,
+   class_id  int NOT NULL default 0,
+   m_items  tinyint NOT NULL default 0
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table  item reservation
+--
+
+CREATE TABLE  reservation_item  (
+   id  int unsigned NOT NULL auto_increment,
+   category_id  int unsigned NOT NULL default 0,
+   course_code  varchar(40) NOT NULL default '',
+   name  varchar(128) NOT NULL default '',
+   description  text NOT NULL,
+   blackout  tinyint NOT NULL default 0,
+   creator  int unsigned NOT NULL default 0,
+   always_available TINYINT NOT NULL default 0,
+  PRIMARY KEY  ( id )
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table reservation item_rights
+--
+
+CREATE TABLE  reservation_item_rights  (
+   item_id  int unsigned NOT NULL default 0,
+   class_id  int unsigned NOT NULL default 0,
+   edit_right  tinyint unsigned NOT NULL default 0,
+   delete_right  tinyint unsigned NOT NULL default 0,
+   m_reservation  tinyint unsigned NOT NULL default 0,
+   view_right  tinyint NOT NULL default 0,
+  PRIMARY KEY  ( item_id , class_id )
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for main reservation table
+--
+
+CREATE TABLE  reservation_main  (
+   id  int unsigned NOT NULL auto_increment,
+   subid  int unsigned NOT NULL default 0,
+   item_id  int unsigned NOT NULL default 0,
+   auto_accept  tinyint unsigned NOT NULL default 0,
+   max_users  int unsigned NOT NULL default 1,
+   start_at  datetime NOT NULL default '0000-00-00 00:00:00',
+   end_at  datetime NOT NULL default '0000-00-00 00:00:00',
+   subscribe_from  datetime NOT NULL default '0000-00-00 00:00:00',
+   subscribe_until  datetime NOT NULL default '0000-00-00 00:00:00',
+   subscribers  int unsigned NOT NULL default 0,
+   notes  text NOT NULL,
+   timepicker  tinyint NOT NULL default 0,
+   timepicker_min  int NOT NULL default 0,
+   timepicker_max  int NOT NULL default 0,
+  PRIMARY KEY  ( id )
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for reservation subscription table
+--
+
+CREATE TABLE  reservation_subscription  (
+   dummy  int unsigned NOT NULL auto_increment,
+   user_id  int unsigned NOT NULL default 0,
+   reservation_id  int unsigned NOT NULL default 0,
+   accepted  tinyint unsigned NOT NULL default 0,
+   start_at  datetime NOT NULL default '0000-00-00 00:00:00',
+   end_at  datetime NOT NULL default '0000-00-00 00:00:00',
+  PRIMARY KEY  ( dummy )
+);
+
+-- ---------------------------------------------------------
+
+--
+-- Table structure for table user_rel_user
+--
+CREATE TABLE user_rel_user (
+  id bigint unsigned not null auto_increment,
+  user_id int unsigned not null,
+  friend_user_id int unsigned not null,
+  relation_type int not null default 0,
+  last_edit DATETIME,
+  PRIMARY KEY(id)
+);
+
+-- Commenting by jmontoya produces errors
+--ALTER TABLE user_friend ADD INDEX idx_user_friend_user (user_id);
+--ALTER TABLE user_friend ADD INDEX idx_user_friend_friend_user(friend_user_id);
+--ALTER TABLE user_friend ADD INDEX idx_user_friend_user_friend_user(user_id,friend_user_id);
+
+--
+-- Table structure for table user_friend_relation_type
+--
+CREATE TABLE user_friend_relation_type(
+  id int unsigned not null auto_increment,
+  title char(20),
+  PRIMARY KEY(id)
+);
+
+
+--
+-- Table structure for MD5 API keys for users
+--
+
+CREATE TABLE user_api_key (
+    id int unsigned NOT NULL auto_increment,
+    user_id int unsigned NOT NULL,
+    api_key char(32) NOT NULL,
+    api_service char(10) NOT NULL default 'dokeos',
+    PRIMARY KEY (id)
+);
+ALTER TABLE user_api_key ADD INDEX idx_user_api_keys_user (user_id);
+
+--
+-- Table structure for table message
+--
+CREATE TABLE message(
+    id bigint unsigned not null auto_increment,
+    user_sender_id int unsigned not null,
+    user_receiver_id int unsigned not null,
+    msg_status tinyint unsigned not null default 0, -- 0 read, 1 unread, 3 deleted, 5 pending invitation, 6 accepted invitation, 7 invitation denied
+    send_date datetime not null default '0000-00-00 00:00:00',
+    title varchar(255) not null,
+    content text not null,
+    group_id int unsigned not null default 0,
+    parent_id int unsigned not null default 0,
+    update_date datetime not null default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+ALTER TABLE message ADD INDEX idx_message_user_sender(user_sender_id);
+ALTER TABLE message ADD INDEX idx_message_user_receiver(user_receiver_id);
+ALTER TABLE message ADD INDEX idx_message_user_sender_user_receiver(user_sender_id,user_receiver_id);
+ALTER TABLE message ADD INDEX idx_message_group(group_id);
+ALTER TABLE message ADD INDEX idx_message_parent(parent_id);
+
+INSERT INTO user_friend_relation_type (id,title)
+VALUES
+(1,'SocialUnknow'),
+(2,'SocialParent'),
+(3,'SocialFriend'),
+(4,'SocialGoodFriend'),
+(5,'SocialEnemy'),
+(6,'SocialDeleted');
+
+--
+-- Table structure for table legal (Terms & Conditions)
+--
+
+CREATE TABLE legal (
+  legal_id int NOT NULL auto_increment,
+  language_id int NOT NULL,
+  date int NOT NULL default 0,
+  content text,
+  type int NOT NULL,
+  changes text NOT NULL,
+  version int,
+  PRIMARY KEY (legal_id,language_id)
+);
+
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) values (1, 'legal_accept','Legal',0,0);
+
+--
+-- Table structure for certificate with gradebook
+--
+
+CREATE TABLE gradebook_certificate (
+    id bigint unsigned not null auto_increment,
+    cat_id int unsigned not null,
+    user_id int unsigned not null,
+    score_certificate float unsigned not null default 0,
+    created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+    path_certificate text null,
+    PRIMARY KEY(id)
+);
+ALTER TABLE gradebook_certificate ADD INDEX idx_gradebook_certificate_category_id(cat_id);
+ALTER TABLE gradebook_certificate ADD INDEX idx_gradebook_certificate_user_id(user_id);
+ALTER TABLE gradebook_certificate ADD INDEX idx_gradebook_certificate_category_id_user_id(cat_id,user_id);
+
+
+
+--
+-- Tables structure for search tool
+--
+
+-- specific fields tables
+CREATE TABLE specific_field (
+    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+    code char(1) NOT NULL,
+    name VARCHAR(200) NOT NULL
+);
+
+CREATE TABLE specific_field_values (
+    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+    course_code VARCHAR(40) NOT NULL ,
+    tool_id VARCHAR(100) NOT NULL ,
+    ref_id INT NOT NULL ,
+    field_id INT NOT NULL ,
+    value VARCHAR(200) NOT NULL
+);
+ALTER TABLE specific_field ADD CONSTRAINT unique_specific_field__code UNIQUE (code);
+
+-- search engine references to map dokeos resources
+
+CREATE TABLE search_engine_ref (
+    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+    course_code VARCHAR( 40 ) NOT NULL,
+    tool_id VARCHAR( 100 ) NOT NULL,
+    ref_id_high_level INT NOT NULL,
+    ref_id_second_level INT NULL,
+    search_did INT NOT NULL
+);
+
+--
+-- Table structure for table sessions categories
+--
+
+CREATE TABLE session_category (
+    id int NOT NULL auto_increment,
+    name varchar(100) default NULL,
+    date_start date default NULL,
+    date_end date default NULL,
+	access_url_id INT NOT NULL default 1,
+  PRIMARY KEY  (id)
+);
+
+
+--
+-- Table structure for table user tag
+--
+
+CREATE TABLE tag (
+    id int NOT NULL auto_increment,
+    tag char(255) NOT NULL,
+    field_id int NOT NULL,
+    count int NOT NULL,
+    PRIMARY KEY  (id)
+);
+
+
+CREATE TABLE user_rel_tag (
+    id int NOT NULL auto_increment,
+    user_id int NOT NULL,
+    tag_id int NOT NULL,
+    PRIMARY KEY  (id)
+);
+
+--
+-- Table structure for user platform groups
+--
+
+CREATE TABLE groups (
+    id int NOT NULL AUTO_INCREMENT,
+    name varchar(255) NOT NULL,
+    description varchar(255) NOT NULL,
+    picture_uri varchar(255) NOT NULL,
+    url varchar(255) NOT NULL,
+    visibility int NOT NULL,
+    updated_on varchar(255) NOT NULL,
+    created_on varchar(255) NOT NULL,
+    PRIMARY KEY (id)
+);
+
+CREATE TABLE group_rel_tag (
+    id int NOT NULL AUTO_INCREMENT,
+    tag_id int NOT NULL,
+    group_id int NOT NULL,
+    PRIMARY KEY (id)
+);
+
+ALTER TABLE group_rel_tag ADD INDEX ( group_id );
+ALTER TABLE group_rel_tag ADD INDEX ( tag_id );
+
+CREATE TABLE group_rel_user (
+    id int NOT NULL AUTO_INCREMENT,
+    group_id int NOT NULL,
+    user_id int NOT NULL,
+    relation_type int NOT NULL,
+    PRIMARY KEY (id)
+);
+ALTER TABLE group_rel_user ADD INDEX ( group_id );
+ALTER TABLE group_rel_user ADD INDEX ( user_id );
+ALTER TABLE group_rel_user ADD INDEX ( relation_type );
+--
+-- Table structure for table message attachment
+--
+
+CREATE TABLE IF NOT EXISTS message_attachment (
+    id int NOT NULL AUTO_INCREMENT,
+    path varchar(255) NOT NULL,
+    comment text,
+    size int NOT NULL default 0,
+    message_id int NOT NULL,
+    filename varchar(255) NOT NULL,
+    PRIMARY KEY  (id)
+);
+
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) values (10, 'tags','tags',0,0);
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) values (1, 'rssfeeds','RSS',0,0);
+INSERT INTO course_field (field_type, field_variable, field_display_text, field_default_value, field_visible, field_changeable) values (10, 'special_course','Special course', 'Yes', 1 , 1);
+
+--
+-- Table structure for table block
+--
+
+CREATE TABLE IF NOT EXISTS block (
+    id INT NOT NULL AUTO_INCREMENT,
+    name VARCHAR(255) NULL,
+    description TEXT NULL,
+    path VARCHAR(255) NOT NULL,
+    controller VARCHAR(100) NOT NULL,
+    active TINYINT NOT NULL DEFAULT 1,
+    PRIMARY KEY(id)
+);
+ALTER TABLE block ADD UNIQUE(path);
+
+INSERT INTO user_field(field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES(1, 'dashboard', 'Dashboard', 0, 0);
+INSERT INTO user_field(field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES(11, 'timezone', 'Timezone', 0, 0);
+
+--
+-- Structure for table 'course_request' ("Course validation" feature)
+--
+
+DROP TABLE IF EXISTS course_request;
+CREATE TABLE course_request (
+  id int NOT NULL AUTO_INCREMENT,
+  code varchar(40) NOT NULL,
+  user_id int unsigned NOT NULL default '0',
+  directory varchar(40) DEFAULT NULL,
+  db_name varchar(40) DEFAULT NULL,
+  course_language varchar(20) DEFAULT NULL,
+  title varchar(250) DEFAULT NULL,
+  description text,
+  category_code varchar(40) DEFAULT NULL,
+  tutor_name varchar(200) DEFAULT NULL,
+  visual_code varchar(40) DEFAULT NULL,
+  request_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  objetives text,
+  target_audience text,
+  status int unsigned NOT NULL default '0',
+  info int unsigned NOT NULL default '0',
+  exemplary_content int unsigned NOT NULL default '0',
+  PRIMARY KEY (id),
+  UNIQUE KEY code (code)
+);
+
+--
+-- Structure for Careers, Promotions and Usergroups
+--
+
+CREATE TABLE career (
+    id INT NOT NULL AUTO_INCREMENT,
+    name VARCHAR(255) NOT NULL ,
+    description TEXT NOT NULL,
+    status INT NOT NULL default '0',
+    created_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+    updated_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+    PRIMARY KEY (id)
+);
+
+CREATE TABLE promotion (
+    id INT NOT NULL AUTO_INCREMENT,
+    name VARCHAR(255) NOT NULL ,
+    description TEXT NOT NULL,
+    career_id INT NOT NULL,
+    status INT NOT NULL default '0',
+    created_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+    updated_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+
+CREATE TABLE usergroup (
+    id INT NOT NULL AUTO_INCREMENT,
+    name VARCHAR(255) NOT NULL,
+    description TEXT NOT NULL,
+    PRIMARY KEY (id)
+);
+
+CREATE TABLE usergroup_rel_user    (
+    usergroup_id INT NOT NULL,
+    user_id 	INT NOT NULL
+);
+
+CREATE TABLE usergroup_rel_course  (
+    usergroup_id INT NOT NULL,
+    course_id 	INT NOT NULL
+);
+
+CREATE TABLE usergroup_rel_session (
+    usergroup_id INT NOT NULL,
+    session_id  INT NOT NULL
+);
+
+
+--
+-- Structure for Mail notifications
+--
+
+CREATE TABLE notification (
+	id 			BIGINT PRIMARY KEY NOT NULL AUTO_INCREMENT,
+	dest_user_id INT NOT NULL,
+ 	dest_mail 	CHAR(255),
+ 	title 		CHAR(255),
+ 	content 	CHAR(255),
+ 	send_freq 	SMALLINT DEFAULT 1,
+ 	created_at 	DATETIME NOT NULL,
+ 	sent_at 	DATETIME NULL
+);
+
+ALTER TABLE notification ADD index mail_notify_sent_index (sent_at);
+ALTER TABLE notification ADD index mail_notify_freq_index (sent_at, send_freq, created_at);
+
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable, field_default_value) values (4, 'mail_notify_invitation',   'MailNotifyInvitation',1,1,'1');
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable, field_default_value) values (4, 'mail_notify_message',		 'MailNotifyMessage',1,1,'1');
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable, field_default_value) values (4, 'mail_notify_group_message','MailNotifyGroupMessage',1,1,'1');
+
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (6, '1', 'AtOnce',1);
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (6, '8', 'Daily',2);
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (6, '0', 'No',3);
+
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (7, '1', 'AtOnce',1);
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (7, '8', 'Daily',2);
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (7, '0', 'No',3);
+
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (8, '1', 'AtOnce',1);
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (8, '8', 'Daily',2);
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (8, '0', 'No',3);
+
+

+ 268 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.8.8/db_stats.sql

@@ -0,0 +1,268 @@
+-- MySQL dump
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+CREATE TABLE track_c_browsers (
+  id int NOT NULL auto_increment,
+  browser varchar(255) NOT NULL default '',
+  counter int NOT NULL default 0,
+  PRIMARY KEY  (id)
+);
+
+CREATE TABLE track_c_countries (
+  id int NOT NULL auto_increment,
+  code varchar(40) NOT NULL default '',
+  country varchar(50) NOT NULL default '',
+  counter int NOT NULL default 0,
+  PRIMARY KEY  (id)
+);
+
+CREATE TABLE track_c_os (
+  id int NOT NULL auto_increment,
+  os varchar(255) NOT NULL default '',
+  counter int NOT NULL default 0,
+  PRIMARY KEY  (id)
+);
+
+CREATE TABLE track_c_providers (
+  id int NOT NULL auto_increment,
+  provider varchar(255) NOT NULL default '',
+  counter int NOT NULL default 0,
+  PRIMARY KEY  (id)
+);
+
+CREATE TABLE track_c_referers (
+  id int NOT NULL auto_increment,
+  referer varchar(255) NOT NULL default '',
+  counter int NOT NULL default 0,
+  PRIMARY KEY  (id)
+);
+
+CREATE TABLE track_e_access (
+  access_id int NOT NULL auto_increment,
+  access_user_id int unsigned default NULL,
+  access_date datetime NOT NULL default '0000-00-00 00:00:00',
+  access_cours_code varchar(40) NOT NULL default '',
+  access_tool varchar(30) default NULL,
+  access_session_id int NOT NULL default 0,
+  PRIMARY KEY  (access_id),
+  KEY access_user_id (access_user_id),
+  KEY access_cours_code (access_cours_code)
+);
+
+CREATE TABLE track_e_lastaccess (
+  access_id bigint NOT NULL auto_increment,
+  access_user_id int unsigned default NULL,
+  access_date datetime NOT NULL default '0000-00-00 00:00:00',
+  access_cours_code varchar(40) NOT NULL,
+  access_tool varchar(30) default NULL,
+  access_session_id int unsigned default NULL,
+  PRIMARY KEY  (access_id),
+  KEY access_user_id (access_user_id),
+  KEY access_cours_code (access_cours_code),
+  KEY access_session_id (access_session_id)
+);
+
+
+CREATE TABLE track_e_default (
+  default_id int NOT NULL auto_increment,
+  default_user_id int unsigned NOT NULL default 0,
+  default_cours_code varchar(40) NOT NULL default '',
+  default_date datetime NOT NULL default '0000-00-00 00:00:00',
+  default_event_type varchar(20) NOT NULL default '',
+  default_value_type varchar(20) NOT NULL default '',
+  default_value tinytext NOT NULL,
+  PRIMARY KEY  (default_id)
+);
+
+CREATE TABLE track_e_downloads (
+  down_id int NOT NULL auto_increment,
+  down_user_id int unsigned default NULL,
+  down_date datetime NOT NULL default '0000-00-00 00:00:00',
+  down_cours_id varchar(40) NOT NULL default '',
+  down_doc_path varchar(255) NOT NULL default '',
+  down_session_id INT NOT NULL DEFAULT 0,
+  PRIMARY KEY  (down_id),
+  KEY down_user_id (down_user_id),
+  KEY down_cours_id (down_cours_id)
+);
+
+CREATE TABLE track_e_exercices (
+  exe_id int NOT NULL auto_increment,
+  exe_user_id int unsigned default NULL,
+  exe_date datetime NOT NULL default '0000-00-00 00:00:00',
+  exe_cours_id varchar(40) NOT NULL default '',
+  exe_exo_id mediumint unsigned NOT NULL default 0,
+  exe_result float(6,2) NOT NULL default 0,
+  exe_weighting float(6,2) NOT NULL default 0,
+  PRIMARY KEY  (exe_id),
+  KEY exe_user_id (exe_user_id),
+  KEY exe_cours_id (exe_cours_id)
+);
+
+ALTER TABLE track_e_exercices ADD status varchar(20) NOT NULL default '';
+ALTER TABLE track_e_exercices ADD data_tracking text NOT NULL default '';
+ALTER TABLE track_e_exercices ADD start_date datetime NOT NULL default '0000-00-00 00:00:00';
+ALTER TABLE track_e_exercices ADD steps_counter SMALLINT UNSIGNED NOT NULL default 0;
+ALTER TABLE track_e_exercices ADD session_id SMALLINT UNSIGNED NOT NULL default 0;
+ALTER TABLE track_e_exercices ADD INDEX ( session_id ) ;
+ALTER TABLE track_e_exercices ADD orig_lp_id int  NOT NULL default 0;
+ALTER TABLE track_e_exercices ADD orig_lp_item_id int  NOT NULL default 0;
+ALTER TABLE track_e_exercices ADD exe_duration int UNSIGNED NOT NULL default 0;
+ALTER TABLE track_e_exercices ADD COLUMN expired_time_control datetime NOT NULL DEFAULT '0000-00-00 00:00:00';
+ALTER TABLE track_e_exercices ADD COLUMN orig_lp_item_view_id INT NOT NULL DEFAULT 0;
+
+CREATE TABLE track_e_attempt (
+  exe_id int default NULL,
+  user_id int NOT NULL default 0,
+  question_id int NOT NULL default 0,
+  answer text NOT NULL,
+  teacher_comment text NOT NULL,
+  marks float(6,2) NOT NULL default 0,
+  course_code varchar(40) NOT NULL default '',
+  position int default 0,
+  tms datetime NOT NULL default '0000-00-00 00:00:00',
+  session_id INT NOT NULL DEFAULT 0
+);
+ALTER TABLE track_e_attempt ADD INDEX (exe_id);
+ALTER TABLE track_e_attempt ADD INDEX (user_id); 
+ALTER TABLE track_e_attempt ADD INDEX (question_id);
+ALTER TABLE track_e_attempt ADD INDEX (session_id);
+
+CREATE TABLE track_e_attempt_recording (
+  exe_id int unsigned NOT NULL, 
+  question_id int unsigned NOT NULL,  
+  marks int NOT NULL,  
+  insert_date datetime NOT NULL default '0000-00-00 00:00:00',  
+  author int unsigned NOT NULL,  
+  teacher_comment text NOT NULL,
+  session_id INT NOT NULL DEFAULT 0
+);
+ALTER TABLE track_e_attempt_recording ADD INDEX (exe_id);
+ALTER TABLE track_e_attempt_recording ADD INDEX (question_id);
+ALTER TABLE track_e_attempt_recording ADD INDEX (session_id);
+
+CREATE TABLE track_e_hotpotatoes (
+  exe_name VARCHAR( 255 ) NOT NULL ,
+  exe_user_id int unsigned DEFAULT NULL ,
+  exe_date DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL ,
+  exe_cours_id varchar(40) NOT NULL ,
+  exe_result smallint default 0 NOT NULL ,
+  exe_weighting smallint default 0 NOT NULL,
+  KEY exe_user_id (exe_user_id),
+  KEY exe_cours_id (exe_cours_id)
+);
+
+CREATE TABLE track_e_links (
+  links_id int NOT NULL auto_increment,
+  links_user_id int unsigned default NULL,
+  links_date datetime NOT NULL default '0000-00-00 00:00:00',
+  links_cours_id varchar(40) NOT NULL default '' ,
+  links_link_id int NOT NULL default 0,
+  links_session_id INT NOT NULL DEFAULT 0,
+  PRIMARY KEY  (links_id),
+  KEY links_cours_id (links_cours_id),
+  KEY links_user_id (links_user_id)
+);
+
+CREATE TABLE track_e_login (
+  login_id int NOT NULL auto_increment,
+  login_user_id int unsigned NOT NULL default 0,
+  login_date datetime NOT NULL default '0000-00-00 00:00:00',
+  login_ip varchar(39) NOT NULL default '',
+  logout_date datetime NULL default NULL,
+  PRIMARY KEY  (login_id),
+  KEY login_user_id (login_user_id)
+);
+
+CREATE TABLE track_e_online (
+  login_id int NOT NULL auto_increment,
+  login_user_id int unsigned NOT NULL default 0,
+  login_date datetime NOT NULL default '0000-00-00 00:00:00',
+  login_ip varchar(39) NOT NULL default '',
+  course varchar(40) default NULL,
+  session_id INT NOT NULL DEFAULT 0,
+  access_url_id INT NOT NULL DEFAULT 1,
+  PRIMARY KEY  (login_id),
+  KEY login_user_id (login_user_id)
+);
+
+CREATE TABLE track_e_open (
+  open_id int NOT NULL auto_increment,
+  open_remote_host tinytext NOT NULL,
+  open_agent tinytext NOT NULL,
+  open_referer tinytext NOT NULL,
+  open_date datetime NOT NULL default '0000-00-00 00:00:00',
+  PRIMARY KEY  (open_id)
+);
+
+CREATE TABLE track_e_uploads (
+  upload_id int NOT NULL auto_increment,
+  upload_user_id int unsigned default NULL,
+  upload_date datetime NOT NULL default '0000-00-00 00:00:00',
+  upload_cours_id varchar(40) NOT NULL default '',
+  upload_work_id int NOT NULL default 0,
+  upload_session_id INT NOT NULL DEFAULT 0,
+  PRIMARY KEY  (upload_id),
+  KEY upload_user_id (upload_user_id),
+  KEY upload_cours_id (upload_cours_id)
+);
+
+CREATE TABLE track_e_course_access (
+  course_access_id int NOT NULL auto_increment,
+  course_code varchar(40) NOT NULL,
+  user_id int NOT NULL,
+  login_course_date datetime NOT NULL default '0000-00-00 00:00:00',
+  logout_course_date datetime default NULL,
+  counter int NOT NULL,
+  session_id int NOT NULL default 0,
+  PRIMARY KEY  (course_access_id)
+);
+
+CREATE TABLE track_e_hotspot (
+  hotspot_id int NOT NULL auto_increment,
+  hotspot_user_id int NOT NULL,
+  hotspot_course_code varchar(50) NOT NULL,
+  hotspot_exe_id int NOT NULL,
+  hotspot_question_id int NOT NULL,
+  hotspot_answer_id int NOT NULL,
+  hotspot_correct tinyint(3) unsigned NOT NULL,
+  hotspot_coordinate text NOT NULL,
+  PRIMARY KEY  (hotspot_id),
+  KEY hotspot_course_code (hotspot_course_code),
+  KEY hotspot_user_id (hotspot_user_id),
+  KEY hotspot_exe_id (hotspot_exe_id),
+  KEY hotspot_question_id (hotspot_question_id)
+);
+
+CREATE TABLE track_e_item_property (
+  id int NOT NULL auto_increment PRIMARY KEY,
+  course_id int NOT NULL,
+  item_property_id int NOT NULL,
+  title varchar(255),
+  content text,
+  progress int NOT NULL default 0,
+  lastedit_date datetime NOT NULL default '0000-00-00 00:00:00',
+  lastedit_user_id int  NOT NULL,
+  session_id int NOT NULL default 0
+);
+
+ALTER TABLE track_e_course_access ADD INDEX (user_id);
+ALTER TABLE track_e_course_access ADD INDEX (login_course_date);
+ALTER TABLE track_e_course_access ADD INDEX (course_code);
+ALTER TABLE track_e_course_access ADD INDEX (session_id);
+ALTER TABLE track_e_access ADD INDEX (access_session_id);
+
+ALTER TABLE track_e_online ADD INDEX (course);
+ALTER TABLE track_e_online ADD INDEX (session_id);
+
+ALTER TABLE track_e_item_property ADD INDEX (course_id, item_property_id, session_id);
+ALTER TABLE track_e_downloads ADD INDEX (down_session_id);  
+ALTER TABLE track_e_links ADD INDEX (links_session_id); 
+ALTER TABLE track_e_uploads ADD INDEX (upload_session_id);  

+ 44 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.8.8/db_user.sql

@@ -0,0 +1,44 @@
+-- MySQL dump
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+CREATE TABLE personal_agenda (
+  id int NOT NULL auto_increment,
+  user int unsigned,
+  title text,
+  `text` text,
+  `date` datetime default NULL,
+  enddate datetime default NULL,
+  course varchar(255),
+  parent_event_id int null,
+  PRIMARY KEY id (id)
+);
+CREATE TABLE personal_agenda_repeat (
+  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 (cal_id)
+);
+CREATE TABLE personal_agenda_repeat_not (
+  cal_id INT NOT NULL,
+  cal_date INT NOT NULL,
+  PRIMARY KEY ( cal_id, cal_date )
+);
+CREATE TABLE user_course_category (
+  id int unsigned NOT NULL auto_increment,
+  user_id int unsigned NOT NULL default 0,
+  title text NOT NULL,
+  sort int, 
+  PRIMARY KEY  (id)
+);
+ALTER TABLE personal_agenda ADD INDEX idx_personal_agenda_user (user);
+ALTER TABLE personal_agenda ADD INDEX idx_personal_agenda_parent (parent_event_id);
+ALTER TABLE user_course_category ADD INDEX idx_user_c_cat_uid (user_id);

+ 231 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.8.8/migrate-db-1.8.7-1.8.8-pre.sql

@@ -0,0 +1,231 @@
+-- This script updates the databases structure before migrating the data from
+-- version 1.8.7 (or 1.8.7.1) to version 1.8.8
+-- it is intended as a standalone script, however, because of the multiple
+-- databases related difficulties, it should be parsed by a PHP script in
+-- order to connect to and update the right databases.
+-- There is one line per query, allowing the PHP function file() to read
+-- all lines separately into an array. The xxMAINxx-type markers are there
+-- to tell the PHP script which database we're talking about.
+-- By always using the keyword "TABLE" in the queries, we should be able
+-- to retrieve and modify the table name from the PHP script if needed, which
+-- will allow us to deal with the unique-database-type installations
+--
+-- This first part is for the main database
+
+-- xxMAINxx
+
+DROP PROCEDURE IF EXISTS drop_index;
+CREATE PROCEDURE drop_index(in t_name varchar(128), in i_name varchar(128) ) BEGIN IF ( (SELECT count(*) AS index_exists FROM  information_schema.statistics WHERE table_schema = DATABASE( )  AND table_name = t_name  AND  index_name =   i_name ) > 0) THEN    SET @s = CONCAT('DROP INDEX ' , i_name , ' ON ' , t_name );    PREPARE stmt FROM @s;    EXECUTE stmt;  END IF; END;
+
+CREATE TABLE course_request (id int NOT NULL AUTO_INCREMENT, code varchar(40) NOT NULL, user_id int unsigned NOT NULL default '0', directory varchar(40) DEFAULT NULL, db_name varchar(40) DEFAULT NULL, course_language varchar(20) DEFAULT NULL, title varchar(250) DEFAULT NULL, description text, category_code varchar(40) DEFAULT NULL, tutor_name varchar(200) DEFAULT NULL, visual_code varchar(40) DEFAULT NULL, request_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00', objetives text, target_audience text, status int unsigned NOT NULL default '0', info int unsigned NOT NULL default '0', exemplary_content int unsigned NOT NULL default '0', PRIMARY KEY (id), UNIQUE KEY code (code));
+
+CALL drop_index('settings_current', 'unique_setting');
+CALL drop_index('settings_options', 'unique_setting_option');
+
+ALTER TABLE settings_current ADD UNIQUE unique_setting (variable(110), subkey(110), category(110), access_url);
+ALTER TABLE settings_options ADD UNIQUE unique_setting_option (variable(165), value(165));
+ALTER TABLE settings_current CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
+ALTER TABLE settings_options CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
+
+ALTER TABLE user MODIFY COLUMN username VARCHAR(40) NOT NULL;
+
+UPDATE settings_current SET variable='chamilo_database_version' WHERE variable='dokeos_database_version';
+
+ALTER TABLE sys_announcement ADD COLUMN access_url_id INT  NOT NULL default 1;
+ALTER TABLE sys_calendar ADD COLUMN access_url_id INT  NOT NULL default 1;
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('users_copy_files', NULL, 'radio', 'Tools', 'true', 'AllowUsersCopyFilesTitle','AllowUsersCopyFilesComment', NULL,NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('users_copy_files', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('users_copy_files', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_validation', NULL, 'radio', 'Platform', 'false', 'EnableCourseValidation', 'EnableCourseValidationComment', NULL, NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('course_validation', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('course_validation', 'false', 'No');
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_validation_terms_and_conditions_url', NULL, 'textfield', 'Platform', '', 'CourseValidationTermsAndConditionsLink', 'CourseValidationTermsAndConditionsLinkComment', NULL, NULL, 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('sso_authentication',NULL,'radio','Security','false','EnableSSOTitle','EnableSSOComment',NULL,NULL,1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('sso_authentication_domain',NULL,'textfield','Security','','SSOServerDomainTitle','SSOServerDomainComment',NULL,NULL,1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('sso_authentication_auth_uri',NULL,'textfield','Security','/?q=user','SSOServerAuthURITitle','SSOServerAuthURIComment',NULL,NULL,1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('sso_authentication_unauth_uri',NULL,'textfield','Security','/?q=logout','SSOServerUnAuthURITitle','SSOServerUnAuthURIComment',NULL,NULL,1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('sso_authentication_protocol',NULL,'radio','Security','http://','SSOServerProtocolTitle','SSOServerProtocolComment',NULL,NULL,1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('sso_authentication', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('sso_authentication', 'false', 'No');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('sso_authentication_protocol', 'http://', 'http://');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('sso_authentication_protocol', 'https://', 'https://');
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('enabled_asciisvg',NULL,'radio','Editor','false','AsciiSvgTitle','AsciiSvgComment',NULL,NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_asciisvg', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_asciisvg', 'false', 'No');
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('include_asciimathml_script',NULL,'radio','Editor','false','IncludeAsciiMathMlTitle','IncludeAsciiMathMlComment',NULL,NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('include_asciimathml_script', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('include_asciimathml_script', 'false', 'No');
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('enabled_wiris',NULL,'radio','Editor','false','EnabledWirisTitle','EnabledWirisComment',NULL,NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_wiris', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_wiris', 'false', 'No');
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_spellcheck',NULL,'radio','Editor','false','AllowSpellCheckTitle','AllowSpellCheckComment',NULL,NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_spellcheck', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_spellcheck', 'false', 'No');
+ALTER TABLE course ADD INDEX idx_course_category_code (category_code);
+ALTER TABLE course ADD INDEX idx_course_directory (directory(10));
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('force_wiki_paste_as_plain_text',NULL,'radio','Editor','false','ForceWikiPasteAsPlainText','ForceWikiPasteAsPlainTextComment',NULL,NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('force_wiki_paste_as_plain_text', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('force_wiki_paste_as_plain_text', 'false', 'No');
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('enabled_googlemaps',NULL,'radio','Editor','false','EnabledGooglemapsTitle','EnabledGooglemapsComment',NULL,NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_googlemaps', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_googlemaps', 'false', 'No');
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('enabled_imgmap',NULL,'radio','Editor','true','EnabledImageMapsTitle','EnabledImageMapsComment',NULL,NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_imgmap', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_imgmap', 'false', 'No');
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('enabled_support_svg',NULL,'radio','Tools','true','EnabledSVGTitle','EnabledSVGComment',NULL,NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_support_svg', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_support_svg', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('pdf_export_watermark_enable',	NULL,'radio',		'Platform',	'false','PDFExportWatermarkEnableTitle',	'PDFExportWatermarkEnableComment','platform',NULL,  1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('pdf_export_watermark_enable','true','Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('pdf_export_watermark_enable','false','No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('pdf_export_watermark_by_course',	NULL,'radio',		'Platform',	'false','PDFExportWatermarkByCourseTitle',	'PDFExportWatermarkByCourseComment','platform',NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('pdf_export_watermark_by_course','true','Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('pdf_export_watermark_by_course','false','No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('hide_courses_in_sessions',	NULL,'radio',		'Platform',	'false','HideCoursesInSessionsTitle',	'HideCoursesInSessionsComment','platform',NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('hide_courses_in_sessions','true','Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('hide_courses_in_sessions','false','No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('pdf_export_watermark_text',		NULL,'textfield',	'Platform',	'',		'PDFExportWatermarkTextTitle','PDFExportWatermarkTextComment','platform',NULL, 	1);
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('enabled_insertHtml',NULL,'radio','Editor','true','EnabledInsertHtmlTitle','EnabledInsertHtmlComment',NULL,NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_insertHtml', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_insertHtml', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('students_export2pdf',NULL,'radio','Tools','true','EnabledStudentExport2PDFTitle','EnabledStudentExport2PDFComment',NULL,NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('students_export2pdf', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('students_export2pdf', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('exercise_min_score', NULL,'textfield',	'Course',	'',		'ExerciseMinScoreTitle',		'ExerciseMinScoreComment','platform',NULL, 	1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('exercise_max_score', NULL,'textfield',	'Course',	'',		'ExerciseMaxScoreTitle',		'ExerciseMaxScoreComment','platform',NULL, 	1);
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('show_users_folders',NULL,'radio','Tools','true','ShowUsersFoldersTitle','ShowUsersFoldersComment',NULL,NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('show_users_folders', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('show_users_folders', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('show_default_folders',NULL,'radio','Tools','true','ShowDefaultFoldersTitle','ShowDefaultFoldersComment',NULL,NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('show_default_folders', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('show_default_folders', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('show_chat_folder',NULL,'radio','Tools','true','ShowChatFolderTitle','ShowChatFolderComment',NULL,NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('show_chat_folder', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('show_chat_folder', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('enabled_text2audio',NULL,'radio','Tools','false','Text2AudioTitle','Text2AudioComment',NULL,NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_text2audio', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_text2audio', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','course_description','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'CourseDescription', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','calendar_event','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Agenda', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','document','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Documents', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','learnpath','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'LearningPath', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','link','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Links', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','announcement','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Announcements', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','forum','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Forums', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','dropbox','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Dropbox', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','quiz','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Quiz', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','user','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Users', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','group','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Groups', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','chat','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Chat', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','student_publication','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'StudentPublications', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','wiki','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Wiki', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','gradebook','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Gradebook', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','survey','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Survey', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','glossary','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Glossary', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','notebook','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Notebook', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','attendance','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Attendances', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','course_progress','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'CourseProgress', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','blog_management','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Blog',1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','tracking','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Stats',1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','course_maintenance','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Maintenance',1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_hide_tools','course_setting','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'CourseSettings',1);
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('enabled_support_pixlr',NULL,'radio','Tools','false','EnabledPixlrTitle','EnabledPixlrComment',NULL,NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_support_pixlr', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_support_pixlr', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('show_groups_to_users',NULL,'radio','Platform','false','ShowGroupsToUsersTitle','ShowGroupsToUsersComment',NULL,NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('show_groups_to_users', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('show_groups_to_users', 'false', 'No');
+
+INSERT INTO language (original_name, english_name, isocode, dokeos_folder, available) VALUES ('&#2361;&#2367;&#2344;&#2381;&#2342;&#2368;', 'hindi', 'hi', 'hindi', 0);
+
+ALTER TABLE session ADD COLUMN promotion_id INT NOT NULL;
+
+CREATE TABLE career (id INT NOT NULL AUTO_INCREMENT,	name VARCHAR(255) NOT NULL, description TEXT NOT NULL, status INT NOT NULL default '0', created_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00', updated_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id));
+CREATE TABLE promotion (id INT NOT NULL AUTO_INCREMENT,	name VARCHAR(255) NOT NULL, description TEXT NOT NULL, status INT NOT NULL default '0', career_id INT NOT NULL, created_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00', updated_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY(id));
+
+CREATE TABLE usergroup ( id INT NOT NULL AUTO_INCREMENT,	name VARCHAR(255) NOT NULL, description TEXT NOT NULL,PRIMARY KEY (id));
+CREATE TABLE usergroup_rel_user    ( usergroup_id INT NOT NULL, user_id 	INT NOT NULL );
+CREATE TABLE usergroup_rel_course  ( usergroup_id INT NOT NULL, course_id 	INT NOT NULL );
+CREATE TABLE usergroup_rel_session ( usergroup_id INT NOT NULL, session_id  INT NOT NULL );
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('accessibility_font_resize',NULL,'radio','Platform','false','EnableAccessibilityFontResizeTitle','EnableAccessibilityFontResizeComment',NULL,NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('accessibility_font_resize', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('accessibility_font_resize', 'false', 'No');
+
+CREATE TABLE notification (id BIGINT PRIMARY KEY NOT NULL AUTO_INCREMENT,dest_user_id INT NOT NULL, dest_mail CHAR(255),title CHAR(255), content CHAR(255), send_freq SMALLINT DEFAULT 1, created_at DATETIME NOT NULL, sent_at DATETIME NULL);
+
+ALTER TABLE notification ADD index mail_notify_sent_index (sent_at);
+ALTER TABLE notification ADD index mail_notify_freq_index (sent_at, send_freq, created_at);
+
+ALTER TABLE session_category ADD COLUMN access_url_id INT NOT NULL default 1;
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('enable_quiz_scenario', NULL,'radio','Course','false','EnableQuizScenarioTitle','EnableQuizScenarioComment',NULL,NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_quiz_scenario', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_quiz_scenario', 'false', 'No');
+
+UPDATE settings_current SET category='Search' WHERE variable='search_enable';
+
+INSERT INTO settings_options (variable, value, display_text) VALUES ('homepage_view', 'activity_big', 'HomepageViewActivityBig');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('enable_nanogong',NULL,'radio','Tools','false','EnableNanogongTitle','EnableNanogongComment',NULL,NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_nanogong', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_nanogong', 'false', 'No');
+
+ALTER TABLE gradebook_evaluation ADD COLUMN locked int NOT NULL DEFAULT 0;
+
+UPDATE settings_current SET selected_value = '1.8.8.14911' WHERE variable = 'chamilo_database_version';
+
+-- xxSTATSxx
+ALTER TABLE track_e_exercices ADD COLUMN orig_lp_item_view_id INT NOT NULL DEFAULT 0;
+
+-- xxUSERxx
+ALTER TABLE personal_agenda ADD PRIMARY KEY (id);
+ALTER TABLE personal_agenda ADD INDEX idx_personal_agenda_user (user);
+ALTER TABLE personal_agenda ADD INDEX idx_personal_agenda_parent (parent_event_id);
+ALTER TABLE user_course_category ADD INDEX idx_user_c_cat_uid (user_id);
+
+-- xxCOURSExx
+ALTER TABLE {prefix}course_setting CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
+ALTER TABLE {prefix}forum_forum ADD start_time DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';
+ALTER TABLE {prefix}forum_forum ADD end_time DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';
+ALTER TABLE {prefix}wiki_mailcue ADD session_id smallint DEFAULT 0;
+
+ALTER TABLE {prefix}lp ADD COLUMN use_max_score INT DEFAULT 1;
+ALTER TABLE {prefix}lp_item MODIFY COLUMN max_score FLOAT UNSIGNED DEFAULT 100;
+ALTER TABLE {prefix}tool MODIFY COLUMN category varchar(20) not null default 'authoring';
+
+ALTER TABLE {prefix}lp ADD COLUMN autolunch INT DEFAULT 0;
+ALTER TABLE {prefix}lp ADD COLUMN created_on 	DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';
+ALTER TABLE {prefix}lp ADD COLUMN modified_on 	DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';
+ALTER TABLE {prefix}lp ADD COLUMN expired_on 	DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';
+ALTER TABLE {prefix}lp ADD COLUMN publicated_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';
+
+CREATE TABLE {prefix}quiz_question_option (id int NOT NULL, name varchar(255), position int unsigned NOT NULL, PRIMARY KEY (id));
+ALTER TABLE {prefix}quiz_question ADD COLUMN extra varchar(255) DEFAULT NULL;
+ALTER TABLE {prefix}quiz_question CHANGE question question TEXT NOT NULL;
+
+INSERT INTO {prefix}course_setting(variable,value,category) VALUES ('enable_lp_auto_launch',0,'learning_path');
+INSERT INTO {prefix}course_setting(variable,value,category) VALUES ('pdf_export_watermark_text','','course');
+
+ALTER TABLE {prefix}quiz ADD COLUMN propagate_neg INT NOT NULL DEFAULT 0;
+ALTER TABLE {prefix}quiz_answer MODIFY COLUMN hotspot_type ENUM('square','circle','poly','delineation','oar');
+
+ALTER TABLE {prefix}attendance ADD COLUMN locked int NOT NULL default 0;
+CREATE TABLE {prefix}attendance_sheet_log (id INT  NOT NULL AUTO_INCREMENT, 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));
+

+ 183 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.8.8/update-db-1.8.7-1.8.8.inc.php

@@ -0,0 +1,183 @@
+<?php
+/* For licensing terms, see /license.txt */
+
+$update = function($_configuration, $mainConnection, $courseList, $dryRun, $output)
+{
+    $portalSettings = $this->getPortalSettings();
+    $databaseList = $this->generateDatabaseList($courseList);
+    $courseDatabaseConnectionList = $databaseList['course']; // main  user stats course
+
+    /** @var \Doctrine\DBAL\Connection $userConnection */
+    $userConnection = $this->getHelper($databaseList['user'][0]['database'])->getConnection();
+    /** @var \Doctrine\DBAL\Connection $mainConnection */
+    $mainConnection = $this->getHelper($databaseList['main'][0]['database'])->getConnection();
+    /** @var \Doctrine\DBAL\Connection $statsConnection */
+    $statsConnection = $this->getHelper($databaseList['stats'][0]['database'])->getConnection();
+
+    $mainConnection->beginTransaction();
+
+    try {
+        if (!empty($courseList)) {
+            foreach ($courseList as $row_course) {
+
+                $prefix = $this->getTablePrefix($_configuration, $row_course['db_name']);
+
+
+                $output->writeln('Updating course db: '.$row_course['db_name']);
+
+                $table_lp_item_view = $prefix."lp_item_view";
+                $table_lp_view = $prefix."lp_view";
+                $table_lp_item = $prefix."lp_item";
+
+                $courseConnection = null;
+                foreach ($courseDatabaseConnectionList as $database) {
+                    if ($database['database'] == '_chamilo_course_'.$row_course['db_name']) {
+                        /** @var \Doctrine\DBAL\Connection $courseConnection */
+                        $courseConnection = $this->getHelper($database['database'])->getConnection();
+                    }
+                }
+
+                if (empty($courseConnection)) {
+                    $output->writeln("<info> We can't established a DB connection for this course: ".$row_course['db_name']);
+                }
+
+                // Filling the track_e_exercices.orig_lp_item_view_id field  in order to have better traceability in exercises included in a LP see #3188
+
+                $query = "SELECT DISTINCT path as exercise_id, lp_item_id, lp_view_id, user_id, v.lp_id
+                          FROM $table_lp_item_view iv INNER JOIN  $table_lp_view v
+                          ON v.id = iv.lp_view_id INNER JOIN $table_lp_item i
+                          ON  i.id = lp_item_id
+                          WHERE item_type = 'quiz'";
+
+                $result = $courseConnection->executeQuery($query);
+                //$output->writeln($query);
+                $rows = $result->fetchAll();
+
+                if (count($rows) > 0) {
+                    foreach ($rows as $row) {
+                        $sql = "SELECT exe_id FROM track_e_exercices
+                                WHERE exe_user_id = {$row['user_id']} AND
+                                exe_cours_id = '{$row_course['code']}' AND
+                                exe_exo_id = {$row['exercise_id']}  AND
+                                orig_lp_id = {$row['lp_id']}  AND
+                                orig_lp_item_id = {$row['lp_item_id']} ";
+                        $sub_result = $statsConnection->executeQuery($sql);
+                        $sub_rows = $sub_result->fetchAll();
+                        $exe_list = array();
+                        foreach ($sub_rows as $sub_row) {
+                            $exe_list[] = $sub_row['exe_id'];
+                        }
+
+                        $sql = "SELECT iv.id, iv.view_count
+                                  FROM $table_lp_item_view iv INNER JOIN  $table_lp_view v
+                                  ON v.id = iv.lp_view_id INNER JOIN $table_lp_item i
+                                  ON  i.id = lp_item_id
+                                  WHERE item_type = 'quiz' AND user_id =  {$row['user_id']} AND path = {$row['exercise_id']} ";
+                        $sub_result = $courseConnection->executeQuery($sql);
+                        $sub_rows = $sub_result->fetchAll();
+                        $lp_item_view_id_list = array();
+                        foreach ($sub_rows as $sub_row) {
+                            $lp_item_view_id_list[] = $sub_row['id'];
+                        }
+                        $i = 0;
+
+                        foreach ($exe_list as $exe_id) {
+                            $lp_item_view_id = $lp_item_view_id_list[$i];
+                            $update = "UPDATE track_e_exercices SET orig_lp_item_view_id  = '$lp_item_view_id' WHERE exe_id = $exe_id ";
+                            $statsConnection->executeQuery($update);
+                            $output->writeln($update);
+
+                        }
+                    }
+                }
+            }
+        } else {
+            $output->writeln('<info>Any course found in this platform.<info>');
+        }
+
+        // Adding notifications options
+
+        $output->writeln('<comment>Updating main/stat/user db:</comment>');
+
+        $sql = "INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable, field_default_value) values (4, 'mail_notify_invitation', 'MailNotifyInvitation',1,1,'1') ";
+        $mainConnection->executeQuery($sql);
+        $output->writeln($sql);
+        $id = $mainConnection->lastInsertId();
+
+        $sql = "INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values ($id, '1', 'AtOnce',1) ";
+        $mainConnection->executeQuery($sql);
+        $output->writeln($sql);
+        $sql = "INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values ($id, '8', 'Daily',2) ";
+        $mainConnection->executeQuery($sql);
+        $output->writeln($sql);
+        $sql = "INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values ($id, '0', 'No',3) ";
+        $mainConnection->executeQuery($sql);
+        $output->writeln($sql);
+
+        $sql = "INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable, field_default_value)
+                values (4, 'mail_notify_message', 'MailNotifyMessage',1,1,'1')";
+        $mainConnection->executeQuery($sql);
+        $output->writeln($sql);
+        $id = $mainConnection->lastInsertId();
+
+        $sql = "INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values ($id, '1', 'AtOnce',1) ";
+        $mainConnection->executeQuery($sql);
+        $output->writeln($sql);
+
+        $sql = "INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values ($id, '8', 'Daily',2) ";
+        $mainConnection->executeQuery($sql);
+        $output->writeln($sql);
+        $sql = "INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values ($id, '0', 'No',3) ";
+        $mainConnection->executeQuery($sql);
+        $output->writeln($sql);
+
+        $sql = "INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable, field_default_value)
+                values (4, 'mail_notify_group_message', 'MailNotifyGroupMessage',1,1,'1') ";
+        $mainConnection->executeQuery($sql);
+        $output->writeln($sql);
+        $id = $mainConnection->lastInsertId();
+
+        $sql = "INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values ($id, '1', 'AtOnce',1) ";
+        $mainConnection->executeQuery($sql);
+        $output->writeln($sql);
+        $sql = "INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values ($id, '8', 'Daily',2) ";
+        $mainConnection->executeQuery($sql);
+        $output->writeln($sql);
+        $sql = "INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values ($id, '0', 'No',3) ";
+        $mainConnection->executeQuery($sql);
+        $output->writeln($sql);
+
+        // Fixing table access_url_rel_course if the platform have courses that were created in Dok€ 1.8.5.
+
+        if (!isset($_configuration['multiple_access_urls']) || $_configuration['multiple_access_urls'] == false) {
+            $output->writeln("Fixing access_url_rel_course:");
+            $sql = "SELECT code FROM course";
+            $result = $mainConnection->executeQuery($sql);
+            $rows = $result->fetchAll();
+            foreach ($rows as $row) {
+
+                // Adding course to default URL just in case.
+                // Check if already exists
+                $sql = "SELECT course_code FROM access_url_rel_course WHERE course_code = '".$row['code']."' AND access_url_id = 1";
+                $result = $mainConnection->executeQuery($sql);
+
+                if ($result->rowCount() == 0) {
+                    $sql = "INSERT INTO access_url_rel_course SET course_code = '".$row['code']."', access_url_id = '1' ";
+                    $mainConnection->executeQuery($sql);
+                    $output->writeln($sql);
+                }
+            }
+        }
+
+        if ($dryRun) {
+            $output->writeln('<info>Queries were not executed. Because dry-run is on<info>');
+
+        } else {
+            $mainConnection->commit();
+        }
+    } catch (Exception $e) {
+        $mainConnection->rollback();
+        throw $e;
+    }
+
+};

+ 1947 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.9.0/db_course.sql

@@ -0,0 +1,1947 @@
+-- MySQL dump 10.13  Distrib 5.5.29, for debian-linux-gnu (i686)
+--
+-- Host: localhost    Database: courses
+-- ------------------------------------------------------
+-- Server version	5.5.29-0ubuntu0.12.10.1
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table c_announcement
+--
+
+DROP TABLE IF EXISTS c_announcement;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_announcement (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  title text,
+  content mediumtext,
+  end_date date DEFAULT NULL,
+  display_order mediumint(9) NOT NULL DEFAULT '0',
+  email_sent tinyint(4) DEFAULT '0',
+  session_id int(11) DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_announcement_attachment
+--
+
+DROP TABLE IF EXISTS c_announcement_attachment;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_announcement_attachment (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  path varchar(255) NOT NULL,
+  comment text,
+  size int(11) NOT NULL DEFAULT '0',
+  announcement_id int(11) NOT NULL,
+  filename varchar(255) NOT NULL,
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_attendance
+--
+
+DROP TABLE IF EXISTS c_attendance;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_attendance (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  name text NOT NULL,
+  description text,
+  active tinyint(4) NOT NULL DEFAULT '1',
+  attendance_qualify_title varchar(255) DEFAULT NULL,
+  attendance_qualify_max int(11) NOT NULL DEFAULT '0',
+  attendance_weight float(6,2) NOT NULL DEFAULT '0.00',
+  session_id int(11) NOT NULL DEFAULT '0',
+  locked int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY session_id (session_id),
+  KEY active (active)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_attendance_calendar
+--
+
+DROP TABLE IF EXISTS c_attendance_calendar;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_attendance_calendar (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  attendance_id int(11) NOT NULL,
+  date_time datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  done_attendance tinyint(4) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY attendance_id (attendance_id),
+  KEY done_attendance (done_attendance)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_attendance_result
+--
+
+DROP TABLE IF EXISTS c_attendance_result;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_attendance_result (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  user_id int(11) NOT NULL,
+  attendance_id int(11) NOT NULL,
+  score int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY attendance_id (attendance_id),
+  KEY user_id (user_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_attendance_sheet
+--
+
+DROP TABLE IF EXISTS c_attendance_sheet;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_attendance_sheet (
+  c_id int(11) NOT NULL,
+  user_id int(11) NOT NULL,
+  attendance_calendar_id int(11) NOT NULL,
+  presence tinyint(4) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,user_id,attendance_calendar_id),
+  KEY presence (presence)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_attendance_sheet_log
+--
+
+DROP TABLE IF EXISTS c_attendance_sheet_log;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_attendance_sheet_log (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  attendance_id int(11) 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(11) NOT NULL DEFAULT '0',
+  calendar_date_value datetime DEFAULT NULL,
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_blog
+--
+
+DROP TABLE IF EXISTS c_blog;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_blog (
+  c_id int(11) NOT NULL,
+  blog_id int(11) NOT NULL AUTO_INCREMENT,
+  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(3) unsigned NOT NULL DEFAULT '0',
+  session_id int(11) DEFAULT '0',
+  PRIMARY KEY (c_id,blog_id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table with blogs in this course';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_blog_attachment
+--
+
+DROP TABLE IF EXISTS c_blog_attachment;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_blog_attachment (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  path varchar(255) NOT NULL COMMENT 'the real filename',
+  comment text,
+  size int(11) NOT NULL DEFAULT '0',
+  post_id int(11) NOT NULL,
+  filename varchar(255) NOT NULL COMMENT 'the user s file name',
+  blog_id int(11) NOT NULL,
+  comment_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_blog_comment
+--
+
+DROP TABLE IF EXISTS c_blog_comment;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_blog_comment (
+  c_id int(11) NOT NULL,
+  comment_id int(11) NOT NULL AUTO_INCREMENT,
+  title varchar(250) NOT NULL DEFAULT '',
+  comment longtext NOT NULL,
+  author_id int(11) NOT NULL DEFAULT '0',
+  date_creation datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  blog_id int(11) NOT NULL DEFAULT '0',
+  post_id int(11) NOT NULL DEFAULT '0',
+  task_id int(11) DEFAULT NULL,
+  parent_comment_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,comment_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table with comments on posts in a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_blog_post
+--
+
+DROP TABLE IF EXISTS c_blog_post;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_blog_post (
+  c_id int(11) NOT NULL,
+  post_id int(11) NOT NULL AUTO_INCREMENT,
+  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(11) NOT NULL DEFAULT '0',
+  author_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,post_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table with posts / blog.';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_blog_rating
+--
+
+DROP TABLE IF EXISTS c_blog_rating;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_blog_rating (
+  c_id int(11) NOT NULL,
+  rating_id int(11) NOT NULL AUTO_INCREMENT,
+  blog_id int(11) NOT NULL DEFAULT '0',
+  rating_type enum('post','comment') NOT NULL DEFAULT 'post',
+  item_id int(11) NOT NULL DEFAULT '0',
+  user_id int(11) NOT NULL DEFAULT '0',
+  rating int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,rating_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table with ratings for post/comments in a certain blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_blog_rel_user
+--
+
+DROP TABLE IF EXISTS c_blog_rel_user;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_blog_rel_user (
+  c_id int(11) NOT NULL,
+  blog_id int(11) NOT NULL DEFAULT '0',
+  user_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,blog_id,user_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table representing users subscribed to a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_blog_task
+--
+
+DROP TABLE IF EXISTS c_blog_task;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_blog_task (
+  c_id int(11) NOT NULL,
+  task_id int(11) NOT NULL AUTO_INCREMENT,
+  blog_id int(11) NOT NULL DEFAULT '0',
+  title varchar(250) NOT NULL DEFAULT '',
+  description text NOT NULL,
+  color varchar(10) NOT NULL DEFAULT '',
+  system_task tinyint(3) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,task_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table with tasks for a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_blog_task_rel_user
+--
+
+DROP TABLE IF EXISTS c_blog_task_rel_user;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_blog_task_rel_user (
+  c_id int(11) NOT NULL,
+  blog_id int(11) NOT NULL DEFAULT '0',
+  user_id int(11) NOT NULL DEFAULT '0',
+  task_id int(11) NOT NULL DEFAULT '0',
+  target_date date NOT NULL DEFAULT '0000-00-00',
+  PRIMARY KEY (c_id,blog_id,user_id,task_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table with tasks assigned to a user in a blog';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_calendar_event
+--
+
+DROP TABLE IF EXISTS c_calendar_event;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_calendar_event (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  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(11) DEFAULT NULL,
+  session_id int(10) unsigned NOT NULL DEFAULT '0',
+  all_day int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_calendar_event_attachment
+--
+
+DROP TABLE IF EXISTS c_calendar_event_attachment;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_calendar_event_attachment (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  path varchar(255) NOT NULL,
+  comment text,
+  size int(11) NOT NULL DEFAULT '0',
+  agenda_id int(11) NOT NULL,
+  filename varchar(255) NOT NULL,
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_calendar_event_repeat
+--
+
+DROP TABLE IF EXISTS c_calendar_event_repeat;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_calendar_event_repeat (
+  c_id int(11) NOT NULL,
+  cal_id int(11) NOT NULL DEFAULT '0',
+  cal_type varchar(20) DEFAULT NULL,
+  cal_end int(11) DEFAULT NULL,
+  cal_frequency int(11) DEFAULT '1',
+  cal_days char(7) DEFAULT NULL,
+  PRIMARY KEY (c_id,cal_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_calendar_event_repeat_not
+--
+
+DROP TABLE IF EXISTS c_calendar_event_repeat_not;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_calendar_event_repeat_not (
+  c_id int(11) NOT NULL,
+  cal_id int(11) NOT NULL,
+  cal_date int(11) NOT NULL,
+  PRIMARY KEY (c_id,cal_id,cal_date)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_chat_connected
+--
+
+DROP TABLE IF EXISTS c_chat_connected;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_chat_connected (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  user_id int(10) unsigned NOT NULL DEFAULT '0',
+  last_connection datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  session_id int(11) NOT NULL DEFAULT '0',
+  to_group_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id,user_id,last_connection),
+  KEY char_connected_index (user_id,session_id,to_group_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_course_description
+--
+
+DROP TABLE IF EXISTS c_course_description;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_course_description (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  title varchar(255) DEFAULT NULL,
+  content text,
+  session_id int(11) DEFAULT '0',
+  description_type tinyint(3) unsigned NOT NULL DEFAULT '0',
+  progress int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_course_setting
+--
+
+DROP TABLE IF EXISTS c_course_setting;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_course_setting (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  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 (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_document
+--
+
+DROP TABLE IF EXISTS c_document;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_document (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  path varchar(255) NOT NULL DEFAULT '',
+  comment text,
+  title varchar(255) DEFAULT NULL,
+  filetype set('file','folder') NOT NULL DEFAULT 'file',
+  size int(11) NOT NULL DEFAULT '0',
+  readonly tinyint(3) unsigned NOT NULL,
+  session_id int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_dropbox_category
+--
+
+DROP TABLE IF EXISTS c_dropbox_category;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_dropbox_category (
+  c_id int(11) NOT NULL,
+  cat_id int(11) NOT NULL AUTO_INCREMENT,
+  cat_name text NOT NULL,
+  received tinyint(3) unsigned NOT NULL DEFAULT '0',
+  sent tinyint(3) unsigned NOT NULL DEFAULT '0',
+  user_id int(11) NOT NULL DEFAULT '0',
+  session_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,cat_id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_dropbox_feedback
+--
+
+DROP TABLE IF EXISTS c_dropbox_feedback;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_dropbox_feedback (
+  c_id int(11) NOT NULL,
+  feedback_id int(11) NOT NULL AUTO_INCREMENT,
+  file_id int(11) NOT NULL DEFAULT '0',
+  author_user_id int(11) NOT NULL DEFAULT '0',
+  feedback text NOT NULL,
+  feedback_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  PRIMARY KEY (c_id,feedback_id),
+  KEY file_id (file_id),
+  KEY author_user_id (author_user_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_dropbox_file
+--
+
+DROP TABLE IF EXISTS c_dropbox_file;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_dropbox_file (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  uploader_id int(10) unsigned NOT NULL DEFAULT '0',
+  filename varchar(250) NOT NULL DEFAULT '',
+  filesize int(10) 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(11) NOT NULL DEFAULT '0',
+  session_id int(10) unsigned NOT NULL,
+  PRIMARY KEY (c_id,id),
+  UNIQUE KEY UN_filename (filename),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_dropbox_person
+--
+
+DROP TABLE IF EXISTS c_dropbox_person;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_dropbox_person (
+  c_id int(11) NOT NULL,
+  file_id int(10) unsigned NOT NULL,
+  user_id int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,file_id,user_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_dropbox_post
+--
+
+DROP TABLE IF EXISTS c_dropbox_post;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_dropbox_post (
+  c_id int(11) NOT NULL,
+  file_id int(10) unsigned NOT NULL,
+  dest_user_id int(10) unsigned NOT NULL DEFAULT '0',
+  feedback_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  feedback text,
+  cat_id int(11) NOT NULL DEFAULT '0',
+  session_id int(10) unsigned NOT NULL,
+  PRIMARY KEY (c_id,file_id,dest_user_id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_forum_attachment
+--
+
+DROP TABLE IF EXISTS c_forum_attachment;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_forum_attachment (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  path varchar(255) NOT NULL,
+  comment text,
+  size int(11) NOT NULL DEFAULT '0',
+  post_id int(11) NOT NULL,
+  filename varchar(255) NOT NULL,
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_forum_category
+--
+
+DROP TABLE IF EXISTS c_forum_category;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_forum_category (
+  c_id int(11) NOT NULL,
+  cat_id int(11) NOT NULL AUTO_INCREMENT,
+  cat_title varchar(255) NOT NULL DEFAULT '',
+  cat_comment text,
+  cat_order int(11) NOT NULL DEFAULT '0',
+  locked int(11) NOT NULL DEFAULT '0',
+  session_id int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,cat_id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_forum_forum
+--
+
+DROP TABLE IF EXISTS c_forum_forum;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_forum_forum (
+  c_id int(11) NOT NULL,
+  forum_id int(11) NOT NULL AUTO_INCREMENT,
+  forum_title varchar(255) NOT NULL DEFAULT '',
+  forum_comment text,
+  forum_threads int(11) DEFAULT '0',
+  forum_posts int(11) DEFAULT '0',
+  forum_last_post int(11) DEFAULT '0',
+  forum_category int(11) DEFAULT NULL,
+  allow_anonymous int(11) DEFAULT NULL,
+  allow_edit int(11) DEFAULT NULL,
+  approval_direct_post varchar(20) DEFAULT NULL,
+  allow_attachments int(11) DEFAULT NULL,
+  allow_new_threads int(11) 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(11) DEFAULT NULL,
+  locked int(11) NOT NULL DEFAULT '0',
+  session_id int(11) 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 (c_id,forum_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_forum_mailcue
+--
+
+DROP TABLE IF EXISTS c_forum_mailcue;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_forum_mailcue (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  user_id int(11) NOT NULL DEFAULT '0',
+  thread_id int(11) NOT NULL DEFAULT '0',
+  post_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (id,c_id,thread_id,user_id,post_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_forum_notification
+--
+
+DROP TABLE IF EXISTS c_forum_notification;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_forum_notification (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  user_id int(11) NOT NULL DEFAULT '0',
+  forum_id int(11) NOT NULL DEFAULT '0',
+  thread_id int(11) NOT NULL DEFAULT '0',
+  post_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (id,c_id,user_id,forum_id,thread_id,post_id),
+  KEY user_id (user_id),
+  KEY forum_id (forum_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_forum_post
+--
+
+DROP TABLE IF EXISTS c_forum_post;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_forum_post (
+  c_id int(11) NOT NULL,
+  post_id int(11) NOT NULL AUTO_INCREMENT,
+  post_title varchar(250) DEFAULT NULL,
+  post_text text,
+  thread_id int(11) DEFAULT '0',
+  forum_id int(11) DEFAULT '0',
+  poster_id int(11) DEFAULT '0',
+  poster_name varchar(100) DEFAULT '',
+  post_date datetime DEFAULT '0000-00-00 00:00:00',
+  post_notification tinyint(4) DEFAULT '0',
+  post_parent_id int(11) DEFAULT '0',
+  visible tinyint(4) DEFAULT '1',
+  PRIMARY KEY (c_id,post_id),
+  KEY poster_id (poster_id),
+  KEY forum_id (forum_id),
+  KEY idx_forum_post_thread_id (thread_id),
+  KEY idx_forum_post_visible (visible)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_forum_thread
+--
+
+DROP TABLE IF EXISTS c_forum_thread;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_forum_thread (
+  c_id int(11) NOT NULL,
+  thread_id int(11) NOT NULL AUTO_INCREMENT,
+  thread_title varchar(255) DEFAULT NULL,
+  forum_id int(11) DEFAULT NULL,
+  thread_replies int(11) DEFAULT '0',
+  thread_poster_id int(11) DEFAULT NULL,
+  thread_poster_name varchar(100) DEFAULT '',
+  thread_views int(11) DEFAULT '0',
+  thread_last_post int(11) DEFAULT NULL,
+  thread_date datetime DEFAULT '0000-00-00 00:00:00',
+  thread_sticky tinyint(3) unsigned DEFAULT '0',
+  locked int(11) NOT NULL DEFAULT '0',
+  session_id int(10) unsigned DEFAULT NULL,
+  thread_title_qualify varchar(255) DEFAULT '',
+  thread_qualify_max float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  thread_close_date datetime DEFAULT '0000-00-00 00:00:00',
+  thread_weight float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  PRIMARY KEY (c_id,thread_id),
+  KEY idx_forum_thread_forum_id (forum_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_forum_thread_qualify
+--
+
+DROP TABLE IF EXISTS c_forum_thread_qualify;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_forum_thread_qualify (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  user_id int(10) unsigned NOT NULL,
+  thread_id int(11) NOT NULL,
+  qualify float(6,2) NOT NULL DEFAULT '0.00',
+  qualify_user_id int(11) DEFAULT NULL,
+  qualify_time datetime DEFAULT '0000-00-00 00:00:00',
+  session_id int(11) DEFAULT NULL,
+  PRIMARY KEY (c_id,id),
+  KEY user_id (user_id,thread_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_forum_thread_qualify_log
+--
+
+DROP TABLE IF EXISTS c_forum_thread_qualify_log;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_forum_thread_qualify_log (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  user_id int(10) unsigned NOT NULL,
+  thread_id int(11) NOT NULL,
+  qualify float(6,2) NOT NULL DEFAULT '0.00',
+  qualify_user_id int(11) DEFAULT NULL,
+  qualify_time datetime DEFAULT '0000-00-00 00:00:00',
+  session_id int(11) DEFAULT NULL,
+  PRIMARY KEY (c_id,id),
+  KEY user_id (user_id,thread_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_glossary
+--
+
+DROP TABLE IF EXISTS c_glossary;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_glossary (
+  c_id int(11) NOT NULL,
+  glossary_id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  name varchar(255) NOT NULL,
+  description text NOT NULL,
+  display_order int(11) DEFAULT NULL,
+  session_id int(11) DEFAULT '0',
+  PRIMARY KEY (c_id,glossary_id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_group_category
+--
+
+DROP TABLE IF EXISTS c_group_category;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_group_category (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  title varchar(255) NOT NULL DEFAULT '',
+  description text NOT NULL,
+  doc_state tinyint(3) unsigned NOT NULL DEFAULT '1',
+  calendar_state tinyint(3) unsigned NOT NULL DEFAULT '1',
+  work_state tinyint(3) unsigned NOT NULL DEFAULT '1',
+  announcements_state tinyint(3) unsigned NOT NULL DEFAULT '1',
+  forum_state tinyint(3) unsigned NOT NULL DEFAULT '1',
+  wiki_state tinyint(3) unsigned NOT NULL DEFAULT '1',
+  chat_state tinyint(3) unsigned NOT NULL DEFAULT '1',
+  max_student int(10) unsigned NOT NULL DEFAULT '8',
+  self_reg_allowed tinyint(3) unsigned NOT NULL DEFAULT '0',
+  self_unreg_allowed tinyint(3) unsigned NOT NULL DEFAULT '0',
+  groups_per_user int(10) unsigned NOT NULL DEFAULT '0',
+  display_order int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_group_info
+--
+
+DROP TABLE IF EXISTS c_group_info;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_group_info (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  name varchar(100) DEFAULT NULL,
+  category_id int(10) unsigned NOT NULL DEFAULT '0',
+  description text,
+  max_student int(10) unsigned NOT NULL DEFAULT '8',
+  doc_state tinyint(3) unsigned NOT NULL DEFAULT '1',
+  calendar_state tinyint(3) unsigned NOT NULL DEFAULT '0',
+  work_state tinyint(3) unsigned NOT NULL DEFAULT '0',
+  announcements_state tinyint(3) unsigned NOT NULL DEFAULT '0',
+  forum_state tinyint(3) unsigned NOT NULL DEFAULT '0',
+  wiki_state tinyint(3) unsigned NOT NULL DEFAULT '1',
+  chat_state tinyint(3) unsigned NOT NULL DEFAULT '1',
+  secret_directory varchar(255) DEFAULT NULL,
+  self_registration_allowed tinyint(3) unsigned NOT NULL DEFAULT '0',
+  self_unregistration_allowed tinyint(3) unsigned NOT NULL DEFAULT '0',
+  session_id int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_group_rel_tutor
+--
+
+DROP TABLE IF EXISTS c_group_rel_tutor;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_group_rel_tutor (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  user_id int(11) NOT NULL,
+  group_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_group_rel_user
+--
+
+DROP TABLE IF EXISTS c_group_rel_user;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_group_rel_user (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  user_id int(10) unsigned NOT NULL,
+  group_id int(10) unsigned NOT NULL DEFAULT '0',
+  status int(11) NOT NULL DEFAULT '0',
+  role char(50) NOT NULL,
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_item_property
+--
+
+DROP TABLE IF EXISTS c_item_property;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_item_property (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  tool varchar(100) NOT NULL DEFAULT '',
+  insert_user_id int(10) 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(11) NOT NULL DEFAULT '0',
+  lastedit_type varchar(100) NOT NULL DEFAULT '',
+  lastedit_user_id int(10) unsigned NOT NULL DEFAULT '0',
+  to_group_id int(10) unsigned DEFAULT NULL,
+  to_user_id int(10) unsigned DEFAULT NULL,
+  visibility tinyint(4) 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(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY idx_item_property_toolref (tool,ref)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_link
+--
+
+DROP TABLE IF EXISTS c_link;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_link (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  url text NOT NULL,
+  title varchar(150) DEFAULT NULL,
+  description text,
+  category_id int(10) unsigned DEFAULT NULL,
+  display_order int(10) unsigned NOT NULL DEFAULT '0',
+  on_homepage enum('0','1') NOT NULL DEFAULT '0',
+  target char(10) DEFAULT '_self',
+  session_id int(11) DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_link_category
+--
+
+DROP TABLE IF EXISTS c_link_category;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_link_category (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  category_title varchar(255) NOT NULL,
+  description text,
+  display_order mediumint(8) unsigned NOT NULL DEFAULT '0',
+  session_id int(11) DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_lp
+--
+
+DROP TABLE IF EXISTS c_lp;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_lp (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  lp_type int(10) unsigned NOT NULL,
+  name varchar(255) NOT NULL,
+  ref tinytext,
+  description text,
+  path text NOT NULL,
+  force_commit tinyint(3) 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(10) unsigned NOT NULL DEFAULT '0',
+  content_maker tinytext NOT NULL,
+  content_local varchar(32) NOT NULL DEFAULT 'local',
+  content_license text NOT NULL,
+  prevent_reinit tinyint(3) unsigned NOT NULL DEFAULT '1',
+  js_lib tinytext NOT NULL,
+  debug tinyint(3) 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(10) unsigned NOT NULL DEFAULT '0',
+  prerequisite int(10) unsigned NOT NULL DEFAULT '0',
+  hide_toc_frame tinyint(4) NOT NULL DEFAULT '0',
+  seriousgame_mode tinyint(4) NOT NULL DEFAULT '0',
+  use_max_score int(10) unsigned NOT NULL DEFAULT '1',
+  autolunch int(10) 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 (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_lp_item
+--
+
+DROP TABLE IF EXISTS c_lp_item;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_lp_item (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  lp_id int(10) unsigned NOT NULL,
+  item_type char(32) NOT NULL DEFAULT 'dokeos_document',
+  ref tinytext NOT NULL,
+  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 DEFAULT NULL,
+  parent_item_id int(10) unsigned NOT NULL DEFAULT '0',
+  previous_item_id int(10) unsigned NOT NULL DEFAULT '0',
+  next_item_id int(10) unsigned NOT NULL DEFAULT '0',
+  display_order int(10) unsigned NOT NULL DEFAULT '0',
+  prerequisite text,
+  parameters text,
+  launch_data text NOT NULL,
+  max_time_allowed char(13) DEFAULT '',
+  terms text,
+  search_did int(11) DEFAULT NULL,
+  audio varchar(250) DEFAULT NULL,
+  PRIMARY KEY (c_id,id),
+  KEY lp_id (lp_id),
+  KEY idx_c_lp_item_cid_lp_id (c_id,lp_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_lp_item_view
+--
+
+DROP TABLE IF EXISTS c_lp_item_view;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_lp_item_view (
+  c_id int(11) NOT NULL,
+  id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+  lp_item_id int(10) unsigned NOT NULL,
+  lp_view_id int(10) unsigned NOT NULL,
+  view_count int(10) unsigned NOT NULL DEFAULT '0',
+  start_time int(10) unsigned NOT NULL,
+  total_time int(10) unsigned NOT NULL DEFAULT '0',
+  score float unsigned NOT NULL DEFAULT '0',
+  status char(32) NOT NULL DEFAULT 'not attempted',
+  suspend_data longtext,
+  lesson_location text,
+  core_exit varchar(32) NOT NULL DEFAULT 'none',
+  max_score varchar(8) DEFAULT '',
+  PRIMARY KEY (c_id,id),
+  KEY lp_item_id (lp_item_id),
+  KEY lp_view_id (lp_view_id),
+  KEY idx_c_lp_item_view_cid_lp_view_id_lp_item_id (c_id,lp_view_id,lp_item_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_lp_iv_interaction
+--
+
+DROP TABLE IF EXISTS c_lp_iv_interaction;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_lp_iv_interaction (
+  c_id int(11) NOT NULL,
+  id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+  order_id int(10) unsigned NOT NULL DEFAULT '0',
+  lp_iv_id bigint(20) 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,
+  student_response text NOT NULL,
+  result varchar(255) NOT NULL DEFAULT '',
+  latency varchar(16) NOT NULL DEFAULT '',
+  PRIMARY KEY (c_id,id),
+  KEY lp_iv_id (lp_iv_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_lp_iv_objective
+--
+
+DROP TABLE IF EXISTS c_lp_iv_objective;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_lp_iv_objective (
+  c_id int(11) NOT NULL,
+  id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+  lp_iv_id bigint(20) unsigned NOT NULL,
+  order_id int(10) 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 (c_id,id),
+  KEY lp_iv_id (lp_iv_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_lp_view
+--
+
+DROP TABLE IF EXISTS c_lp_view;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_lp_view (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  lp_id int(10) unsigned NOT NULL,
+  user_id int(10) unsigned NOT NULL,
+  view_count int(10) unsigned NOT NULL DEFAULT '0',
+  last_item int(10) unsigned NOT NULL DEFAULT '0',
+  progress int(10) unsigned DEFAULT '0',
+  session_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY lp_id (lp_id),
+  KEY user_id (user_id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_metadata
+--
+
+DROP TABLE IF EXISTS c_metadata;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_metadata (
+  c_id int(11) NOT NULL,
+  eid varchar(250) NOT NULL,
+  mdxmltext text,
+  md5 char(32) DEFAULT '',
+  htmlcache1 text,
+  htmlcache2 text,
+  indexabletext text,
+  PRIMARY KEY (c_id,eid)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_notebook
+--
+
+DROP TABLE IF EXISTS c_notebook;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_notebook (
+  c_id int(11) NOT NULL,
+  notebook_id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  user_id int(10) unsigned NOT NULL,
+  course varchar(40) NOT NULL,
+  session_id int(11) 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(11) DEFAULT NULL,
+  PRIMARY KEY (c_id,notebook_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_online_connected
+--
+
+DROP TABLE IF EXISTS c_online_connected;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_online_connected (
+  c_id int(11) NOT NULL,
+  user_id int(10) unsigned NOT NULL,
+  last_connection datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  PRIMARY KEY (c_id,user_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_online_link
+--
+
+DROP TABLE IF EXISTS c_online_link;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_online_link (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  name char(50) NOT NULL DEFAULT '',
+  url char(100) NOT NULL,
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_permission_group
+--
+
+DROP TABLE IF EXISTS c_permission_group;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_permission_group (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  group_id int(11) NOT NULL DEFAULT '0',
+  tool varchar(250) NOT NULL DEFAULT '',
+  action varchar(250) NOT NULL DEFAULT '',
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_permission_task
+--
+
+DROP TABLE IF EXISTS c_permission_task;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_permission_task (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  task_id int(11) NOT NULL DEFAULT '0',
+  tool varchar(250) NOT NULL DEFAULT '',
+  action varchar(250) NOT NULL DEFAULT '',
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_permission_user
+--
+
+DROP TABLE IF EXISTS c_permission_user;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_permission_user (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  user_id int(11) NOT NULL DEFAULT '0',
+  tool varchar(250) NOT NULL DEFAULT '',
+  action varchar(250) NOT NULL DEFAULT '',
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_quiz
+--
+
+DROP TABLE IF EXISTS c_quiz;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_quiz (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  title varchar(255) NOT NULL,
+  description text,
+  sound varchar(255) DEFAULT NULL,
+  type tinyint(3) unsigned NOT NULL DEFAULT '1',
+  random int(11) NOT NULL DEFAULT '0',
+  random_answers tinyint(3) unsigned NOT NULL DEFAULT '0',
+  active tinyint(4) NOT NULL DEFAULT '0',
+  results_disabled int(10) unsigned NOT NULL DEFAULT '0',
+  access_condition text,
+  max_attempt int(11) 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(11) NOT NULL DEFAULT '0',
+  expired_time int(11) NOT NULL DEFAULT '0',
+  session_id int(11) DEFAULT '0',
+  propagate_neg int(11) NOT NULL DEFAULT '0',
+  review_answers int(11) NOT NULL DEFAULT '0',
+  random_by_category int(11) NOT NULL DEFAULT '0',
+  text_when_finished text,
+  display_category_name int(11) NOT NULL DEFAULT '1',
+  pass_percentage int(11) DEFAULT NULL,
+  PRIMARY KEY (c_id,id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_quiz_answer
+--
+
+DROP TABLE IF EXISTS c_quiz_answer;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_quiz_answer (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL,
+  id_auto int(11) NOT NULL AUTO_INCREMENT,
+  question_id int(10) unsigned NOT NULL,
+  answer text NOT NULL,
+  correct mediumint(8) unsigned DEFAULT NULL,
+  comment text,
+  ponderation float(6,2) NOT NULL DEFAULT '0.00',
+  position mediumint(8) 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 (c_id,id_auto)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_quiz_question
+--
+
+DROP TABLE IF EXISTS c_quiz_question;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_quiz_question (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  question text NOT NULL,
+  description text,
+  ponderation float(6,2) NOT NULL DEFAULT '0.00',
+  position mediumint(8) unsigned NOT NULL DEFAULT '1',
+  type tinyint(3) unsigned NOT NULL DEFAULT '2',
+  picture varchar(50) DEFAULT NULL,
+  level int(10) unsigned NOT NULL DEFAULT '0',
+  extra varchar(255) DEFAULT NULL,
+  question_code char(10) DEFAULT '',
+  PRIMARY KEY (c_id,id),
+  KEY position (position)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_quiz_question_category
+--
+
+DROP TABLE IF EXISTS c_quiz_question_category;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_quiz_question_category (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  title varchar(255) NOT NULL,
+  description text NOT NULL,
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_quiz_question_option
+--
+
+DROP TABLE IF EXISTS c_quiz_question_option;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_quiz_question_option (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  question_id int(11) NOT NULL,
+  name varchar(255) DEFAULT NULL,
+  position int(10) unsigned NOT NULL,
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_quiz_question_rel_category
+--
+
+DROP TABLE IF EXISTS c_quiz_question_rel_category;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_quiz_question_rel_category (
+  c_id int(11) NOT NULL,
+  question_id int(11) NOT NULL,
+  category_id int(11) NOT NULL,
+  PRIMARY KEY (c_id,question_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_quiz_rel_question
+--
+
+DROP TABLE IF EXISTS c_quiz_rel_question;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_quiz_rel_question (
+  c_id int(11) NOT NULL,
+  question_id int(10) unsigned NOT NULL,
+  exercice_id int(10) unsigned NOT NULL,
+  question_order int(10) unsigned NOT NULL DEFAULT '1',
+  PRIMARY KEY (c_id,question_id,exercice_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_resource
+--
+
+DROP TABLE IF EXISTS c_resource;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_resource (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  source_type varchar(50) DEFAULT NULL,
+  source_id int(10) unsigned DEFAULT NULL,
+  resource_type varchar(50) DEFAULT NULL,
+  resource_id int(10) unsigned DEFAULT NULL,
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_role
+--
+
+DROP TABLE IF EXISTS c_role;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_role (
+  c_id int(11) NOT NULL,
+  role_id int(11) NOT NULL AUTO_INCREMENT,
+  role_name varchar(250) NOT NULL DEFAULT '',
+  role_comment text,
+  default_role tinyint(4) DEFAULT '0',
+  PRIMARY KEY (c_id,role_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_role_group
+--
+
+DROP TABLE IF EXISTS c_role_group;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_role_group (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  role_id int(11) NOT NULL DEFAULT '0',
+  scope varchar(20) NOT NULL DEFAULT 'course',
+  group_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (id,c_id,group_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_role_permissions
+--
+
+DROP TABLE IF EXISTS c_role_permissions;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_role_permissions (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  role_id int(11) NOT NULL DEFAULT '0',
+  tool varchar(250) NOT NULL DEFAULT '',
+  action varchar(50) NOT NULL DEFAULT '',
+  default_perm tinyint(4) NOT NULL DEFAULT '0',
+  PRIMARY KEY (id,c_id,role_id,tool,action)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_role_user
+--
+
+DROP TABLE IF EXISTS c_role_user;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_role_user (
+  c_id int(11) NOT NULL,
+  role_id int(11) NOT NULL DEFAULT '0',
+  scope varchar(20) NOT NULL DEFAULT 'course',
+  user_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,role_id,user_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_student_publication
+--
+
+DROP TABLE IF EXISTS c_student_publication;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_student_publication (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  url varchar(255) DEFAULT NULL,
+  title varchar(255) DEFAULT NULL,
+  description text,
+  author varchar(255) DEFAULT NULL,
+  active tinyint(4) DEFAULT NULL,
+  accepted tinyint(4) DEFAULT '0',
+  post_group_id int(11) NOT NULL DEFAULT '0',
+  sent_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  filetype set('file','folder') NOT NULL DEFAULT 'file',
+  has_properties int(10) unsigned NOT NULL DEFAULT '0',
+  view_properties tinyint(4) DEFAULT NULL,
+  qualification float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  date_of_qualification datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  parent_id int(10) unsigned NOT NULL DEFAULT '0',
+  qualificator_id int(10) unsigned NOT NULL DEFAULT '0',
+  weight float(6,2) unsigned NOT NULL DEFAULT '0.00',
+  session_id int(10) unsigned NOT NULL DEFAULT '0',
+  user_id int(11) NOT NULL,
+  allow_text_assignment int(11) NOT NULL DEFAULT '0',
+  contains_file int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_student_publication_assignment
+--
+
+DROP TABLE IF EXISTS c_student_publication_assignment;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_student_publication_assignment (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  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(4) NOT NULL,
+  enable_qualification tinyint(4) NOT NULL,
+  publication_id int(11) NOT NULL,
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_survey
+--
+
+DROP TABLE IF EXISTS c_survey;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_survey (
+  c_id int(11) NOT NULL,
+  survey_id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  code varchar(20) DEFAULT NULL,
+  title text,
+  subtitle text,
+  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(11) NOT NULL,
+  answered int(11) 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,
+  shuffle tinyint(1) NOT NULL DEFAULT '0',
+  one_question_per_page tinyint(1) NOT NULL DEFAULT '0',
+  survey_version varchar(255) NOT NULL DEFAULT '',
+  parent_id int(10) unsigned NOT NULL,
+  survey_type int(11) NOT NULL DEFAULT '0',
+  show_form_profile int(11) NOT NULL DEFAULT '0',
+  form_fields text NOT NULL,
+  session_id int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,survey_id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_survey_answer
+--
+
+DROP TABLE IF EXISTS c_survey_answer;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_survey_answer (
+  c_id int(11) NOT NULL,
+  answer_id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  survey_id int(10) unsigned NOT NULL,
+  question_id int(10) unsigned NOT NULL,
+  option_id text NOT NULL,
+  value int(10) unsigned NOT NULL,
+  user varchar(250) NOT NULL,
+  PRIMARY KEY (c_id,answer_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_survey_group
+--
+
+DROP TABLE IF EXISTS c_survey_group;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_survey_group (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  name varchar(20) NOT NULL,
+  description varchar(255) NOT NULL,
+  survey_id int(10) unsigned NOT NULL,
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_survey_invitation
+--
+
+DROP TABLE IF EXISTS c_survey_invitation;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_survey_invitation (
+  c_id int(11) NOT NULL,
+  survey_invitation_id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  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(11) NOT NULL DEFAULT '0',
+  session_id int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,survey_invitation_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_survey_question
+--
+
+DROP TABLE IF EXISTS c_survey_question;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_survey_question (
+  c_id int(11) NOT NULL,
+  question_id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  survey_id int(10) 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(11) NOT NULL,
+  shared_question_id int(11) DEFAULT NULL,
+  max_value int(11) DEFAULT NULL,
+  survey_group_pri int(10) unsigned NOT NULL DEFAULT '0',
+  survey_group_sec1 int(10) unsigned NOT NULL DEFAULT '0',
+  survey_group_sec2 int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,question_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_survey_question_option
+--
+
+DROP TABLE IF EXISTS c_survey_question_option;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_survey_question_option (
+  c_id int(11) NOT NULL,
+  question_option_id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  question_id int(10) unsigned NOT NULL,
+  survey_id int(10) unsigned NOT NULL,
+  option_text text NOT NULL,
+  sort int(11) NOT NULL,
+  value int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,question_option_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_thematic
+--
+
+DROP TABLE IF EXISTS c_thematic;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_thematic (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  title varchar(255) NOT NULL,
+  content text,
+  display_order int(10) unsigned NOT NULL DEFAULT '0',
+  active tinyint(4) NOT NULL DEFAULT '0',
+  session_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY active (active,session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_thematic_advance
+--
+
+DROP TABLE IF EXISTS c_thematic_advance;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_thematic_advance (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  thematic_id int(11) NOT NULL,
+  attendance_id int(11) NOT NULL DEFAULT '0',
+  content text,
+  start_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  duration int(11) NOT NULL DEFAULT '0',
+  done_advance tinyint(4) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY thematic_id (thematic_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_thematic_plan
+--
+
+DROP TABLE IF EXISTS c_thematic_plan;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_thematic_plan (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  thematic_id int(11) NOT NULL,
+  title varchar(255) NOT NULL,
+  description text,
+  description_type int(11) NOT NULL,
+  PRIMARY KEY (c_id,id),
+  KEY thematic_id (thematic_id,description_type)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_tool
+--
+
+DROP TABLE IF EXISTS c_tool;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_tool (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  name varchar(255) NOT NULL,
+  link varchar(255) NOT NULL,
+  image varchar(255) DEFAULT NULL,
+  visibility tinyint(3) unsigned DEFAULT '0',
+  admin varchar(255) DEFAULT NULL,
+  address varchar(255) DEFAULT NULL,
+  added_tool tinyint(3) unsigned DEFAULT '1',
+  target enum('_self','_blank') NOT NULL DEFAULT '_self',
+  category varchar(20) NOT NULL DEFAULT 'authoring',
+  session_id int(11) DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_tool_intro
+--
+
+DROP TABLE IF EXISTS c_tool_intro;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_tool_intro (
+  c_id int(11) NOT NULL,
+  id varchar(50) NOT NULL,
+  intro_text mediumtext NOT NULL,
+  session_id int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id,session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_userinfo_content
+--
+
+DROP TABLE IF EXISTS c_userinfo_content;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_userinfo_content (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  user_id int(10) unsigned NOT NULL,
+  definition_id int(10) unsigned NOT NULL,
+  editor_ip varchar(39) DEFAULT NULL,
+  edition_time datetime DEFAULT NULL,
+  content text NOT NULL,
+  PRIMARY KEY (c_id,id),
+  KEY user_id (user_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_userinfo_def
+--
+
+DROP TABLE IF EXISTS c_userinfo_def;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_userinfo_def (
+  c_id int(11) NOT NULL,
+  id int(10) unsigned NOT NULL AUTO_INCREMENT,
+  title varchar(80) NOT NULL DEFAULT '',
+  comment text,
+  line_count tinyint(3) unsigned NOT NULL DEFAULT '5',
+  rank tinyint(3) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_wiki
+--
+
+DROP TABLE IF EXISTS c_wiki;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_wiki (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  page_id int(11) NOT NULL DEFAULT '0',
+  reflink varchar(255) NOT NULL DEFAULT 'index',
+  title varchar(255) NOT NULL,
+  content mediumtext NOT NULL,
+  user_id int(11) NOT NULL DEFAULT '0',
+  group_id int(11) DEFAULT NULL,
+  dtime datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  addlock int(11) NOT NULL DEFAULT '1',
+  editlock int(11) NOT NULL DEFAULT '0',
+  visibility int(11) NOT NULL DEFAULT '1',
+  addlock_disc int(11) NOT NULL DEFAULT '1',
+  visibility_disc int(11) NOT NULL DEFAULT '1',
+  ratinglock_disc int(11) NOT NULL DEFAULT '1',
+  assignment int(11) NOT NULL DEFAULT '0',
+  comment text NOT NULL,
+  progress text NOT NULL,
+  score int(11) DEFAULT '0',
+  version int(11) DEFAULT NULL,
+  is_editing int(11) NOT NULL DEFAULT '0',
+  time_edit datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  hits int(11) DEFAULT '0',
+  linksto text NOT NULL,
+  tag text NOT NULL,
+  user_ip varchar(39) NOT NULL,
+  session_id int(11) DEFAULT '0',
+  PRIMARY KEY (c_id,id),
+  KEY reflink (reflink),
+  KEY group_id (group_id),
+  KEY page_id (page_id),
+  KEY session_id (session_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_wiki_conf
+--
+
+DROP TABLE IF EXISTS c_wiki_conf;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_wiki_conf (
+  c_id int(11) NOT NULL,
+  page_id int(11) 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(11) DEFAULT NULL,
+  max_text int(11) DEFAULT NULL,
+  max_version int(11) 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(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (c_id,page_id),
+  KEY page_id (page_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_wiki_discuss
+--
+
+DROP TABLE IF EXISTS c_wiki_discuss;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_wiki_discuss (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL AUTO_INCREMENT,
+  publication_id int(11) NOT NULL DEFAULT '0',
+  userc_id int(11) 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 (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table c_wiki_mailcue
+--
+
+DROP TABLE IF EXISTS c_wiki_mailcue;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE c_wiki_mailcue (
+  c_id int(11) NOT NULL,
+  id int(11) NOT NULL,
+  user_id int(11) NOT NULL,
+  type text NOT NULL,
+  group_id int(11) DEFAULT NULL,
+  session_id int(11) DEFAULT '0',
+  PRIMARY KEY (c_id,id,user_id),
+  KEY c_id (c_id,id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2013-03-22 18:59:00

+ 3028 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.9.0/db_main.sql

@@ -0,0 +1,3028 @@
+-- MySQL dump 10.9
+--
+-- Host: localhost    Database: chamilo_main
+-- ------------------------------------------------------
+-- Server version	4.1.14
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+
+--
+-- Table structure for table user
+--
+
+DROP TABLE IF EXISTS user;
+CREATE TABLE IF NOT EXISTS user (
+  user_id int unsigned NOT NULL auto_increment,
+  lastname varchar(60) default NULL,
+  firstname varchar(60) default NULL,
+  username varchar(100) NOT NULL default '',
+  password varchar(50) NOT NULL default '',
+  auth_source varchar(50) default 'platform',
+  email varchar(100) default NULL,
+  status tinyint NOT NULL default '5',
+  official_code varchar(40) default NULL,
+  phone varchar(30) default NULL,
+  picture_uri varchar(250) default NULL,
+  creator_id int unsigned default NULL,
+  competences text,
+  diplomas text,
+  openarea text,
+  teach text,
+  productions varchar(250) default NULL,
+  chatcall_user_id int unsigned NOT NULL default '0',
+  chatcall_date datetime NOT NULL default '0000-00-00 00:00:00',
+  chatcall_text varchar(50) NOT NULL default '',
+  language varchar(40) default NULL,
+  registration_date datetime NOT NULL default '0000-00-00 00:00:00',
+  expiration_date datetime NOT NULL default '0000-00-00 00:00:00',
+  active tinyint unsigned NOT NULL default 1,
+  openid varchar(255) DEFAULT NULL,
+  theme varchar(255) DEFAULT NULL,
+  hr_dept_id smallint unsigned NOT NULL default 0,
+  PRIMARY KEY  (user_id),
+  UNIQUE KEY username (username)
+);
+ALTER TABLE user ADD INDEX (status);
+
+--
+-- Dumping data for table user
+--
+
+/*!40000 ALTER TABLE user DISABLE KEYS */;
+LOCK TABLES user WRITE;
+INSERT INTO user (lastname, firstname, username, password, auth_source, email, status, official_code,phone, creator_id, registration_date, expiration_date,active,openid,language) VALUES ('{ADMINLASTNAME}','{ADMINFIRSTNAME}','{ADMINLOGIN}','{ADMINPASSWORD}','{PLATFORM_AUTH_SOURCE}','{ADMINEMAIL}',1,'ADMIN','{ADMINPHONE}',1,NOW(),'0000-00-00 00:00:00','1',NULL,'{ADMINLANGUAGE}');
+-- Insert anonymous user
+INSERT INTO user (lastname, firstname, username, password, auth_source, email, status, official_code, creator_id, registration_date, expiration_date,active,openid,language) VALUES ('Anonymous', 'Joe', '', '', 'platform', 'anonymous@localhost', 6, 'anonymous', 1, NOW(), '0000-00-00 00:00:00', 1,NULL,'{ADMINLANGUAGE}');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE user ENABLE KEYS */;
+
+--
+-- Table structure for table admin
+--
+
+DROP TABLE IF EXISTS admin;
+CREATE TABLE IF NOT EXISTS admin (
+  id  INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
+  user_id int unsigned NOT NULL default '0',
+  UNIQUE KEY user_id (user_id)
+);
+
+--
+-- Dumping data for table admin
+--
+
+
+/*!40000 ALTER TABLE admin DISABLE KEYS */;
+LOCK TABLES admin WRITE;
+INSERT INTO admin VALUES (1, 1);
+UNLOCK TABLES;
+/*!40000 ALTER TABLE admin ENABLE KEYS */;
+
+--
+-- Table structure for table class
+--
+
+DROP TABLE IF EXISTS class;
+CREATE TABLE IF NOT EXISTS class (
+  id mediumint unsigned NOT NULL auto_increment,
+  code varchar(40) default '',
+  name text NOT NULL,
+  PRIMARY KEY  (id)
+);
+
+--
+-- Dumping data for table class
+--
+
+
+/*!40000 ALTER TABLE class DISABLE KEYS */;
+LOCK TABLES class WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE class ENABLE KEYS */;
+
+--
+-- Table structure for table class_user
+--
+
+DROP TABLE IF EXISTS class_user;
+CREATE TABLE IF NOT EXISTS class_user (
+  class_id mediumint unsigned NOT NULL default '0',
+  user_id int unsigned NOT NULL default '0',
+  PRIMARY KEY  (class_id,user_id)
+);
+
+--
+-- Dumping data for table class_user
+--
+
+
+/*!40000 ALTER TABLE class_user DISABLE KEYS */;
+LOCK TABLES class_user WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE class_user ENABLE KEYS */;
+
+--
+-- Table structure for table course
+--
+
+DROP TABLE IF EXISTS course;
+CREATE TABLE IF NOT EXISTS course (
+  id int auto_increment,
+  code varchar(40) NOT NULL,
+  directory varchar(40) default NULL,
+  db_name varchar(40) default NULL,
+  course_language varchar(20) default NULL,
+  title varchar(250) default NULL,
+  description text,
+  category_code varchar(40) default NULL,
+  visibility tinyint default '0',
+  show_score int NOT NULL default '1',
+  tutor_name varchar(200) default NULL,
+  visual_code varchar(40) default NULL,
+  department_name varchar(30) default NULL,
+  department_url varchar(180) default NULL,
+  disk_quota bigint unsigned default NULL,
+  last_visit datetime default NULL,
+  last_edit datetime default NULL,
+  creation_date datetime default NULL,
+  expiration_date datetime default NULL,
+  target_course_code varchar(40) default NULL,
+  subscribe tinyint NOT NULL default '1',
+  unsubscribe tinyint NOT NULL default '1',
+  registration_code varchar(255) NOT NULL default '',
+  legal TEXT  NOT NULL,
+  activate_legal INT NOT NULL DEFAULT 0,
+  PRIMARY KEY (id),
+  UNIQUE KEY code (code)
+);
+ALTER TABLE course ADD INDEX idx_course_category_code (category_code);
+ALTER TABLE course ADD INDEX idx_course_directory (directory(10));
+--
+-- Dumping data for table course
+--
+
+
+/*!40000 ALTER TABLE course DISABLE KEYS */;
+LOCK TABLES course WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE course ENABLE KEYS */;
+
+--
+-- Table structure for table course_category
+--
+
+DROP TABLE IF EXISTS course_category;
+CREATE TABLE IF NOT EXISTS course_category (
+  id int unsigned NOT NULL auto_increment,
+  name varchar(100) NOT NULL default '',
+  code varchar(40) NOT NULL default '',
+  parent_id varchar(40) default NULL,
+  tree_pos int unsigned default NULL,
+  children_count smallint default NULL,
+  auth_course_child enum('TRUE','FALSE') default 'TRUE',
+  auth_cat_child enum('TRUE','FALSE') default 'TRUE',
+  PRIMARY KEY  (id),
+  UNIQUE KEY code (code),
+  KEY parent_id (parent_id),
+  KEY tree_pos (tree_pos)
+);
+
+--
+-- Dumping data for table course_category
+--
+
+
+/*!40000 ALTER TABLE course_category DISABLE KEYS */;
+LOCK TABLES course_category WRITE;
+INSERT INTO course_category VALUES (1,'Language skills','LANG',NULL,1,0,'TRUE','TRUE'),(2,'PC Skills','PC',NULL,2,0,'TRUE','TRUE'),(3,'Projects','PROJ',NULL,3,0,'TRUE','TRUE');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE course_category ENABLE KEYS */;
+
+--
+-- Table structure for table course_field
+--
+
+DROP TABLE IF EXISTS course_field;
+CREATE TABLE IF NOT EXISTS course_field (
+    id  int NOT NULL auto_increment,
+    field_type int NOT NULL default 1,
+    field_variable  varchar(64) NOT NULL,
+    field_display_text  varchar(64),
+    field_default_value text,
+    field_order int,
+    field_visible tinyint default 0,
+    field_changeable tinyint default 0,
+    field_filter tinyint default 0,
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+--
+-- Table structure for table course_field_values
+--
+
+DROP TABLE IF EXISTS course_field_values;
+CREATE TABLE IF NOT EXISTS course_field_values(
+    id  int NOT NULL auto_increment,
+    course_code varchar(40) NOT NULL,
+    field_id int NOT NULL,
+    field_value text,
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+
+--
+-- Table structure for table course_module
+--
+
+DROP TABLE IF EXISTS course_module;
+CREATE TABLE IF NOT EXISTS course_module (
+  id int unsigned NOT NULL auto_increment,
+  name varchar(255) NOT NULL,
+  link varchar(255) NOT NULL,
+  image varchar(100) default NULL,
+  `row` int unsigned NOT NULL default '0',
+  `column` int unsigned NOT NULL default '0',
+  position varchar(20) NOT NULL default 'basic',
+  PRIMARY KEY  (id)
+);
+
+--
+-- Dumping data for table course_module
+--
+
+
+/*!40000 ALTER TABLE course_module DISABLE KEYS */;
+LOCK TABLES course_module WRITE;
+INSERT INTO course_module VALUES
+(1,'calendar_event','calendar/agenda.php','agenda.gif',1,1,'basic'),
+(2,'link','link/link.php','links.gif',4,1,'basic'),
+(3,'document','document/document.php','documents.gif',3,1,'basic'),
+(4,'student_publication','work/work.php','works.gif',3,2,'basic'),
+(5,'announcement','announcements/announcements.php','valves.gif',2,1,'basic'),
+(6,'user','user/user.php','members.gif',2,3,'basic'),
+(7,'forum','forum/index.php','forum.gif',1,2,'basic'),
+(8,'quiz','exercice/exercice.php','quiz.gif',2,2,'basic'),
+(9,'group','group/group.php','group.gif',3,3,'basic'),
+(10,'course_description','course_description/','info.gif',1,3,'basic'),
+(11,'chat','chat/chat.php','chat.gif',0,0,'external'),
+(12,'dropbox','dropbox/index.php','dropbox.gif',4,2,'basic'),
+(13,'tracking','tracking/courseLog.php','statistics.gif',1,3,'courseadmin'),
+(14,'homepage_link','link/link.php?action=addlink','npage.gif',1,1,'courseadmin'),
+(15,'course_setting','course_info/infocours.php','reference.gif',1,1,'courseadmin'),
+(16,'External','','external.gif',0,0,'external'),
+(17,'AddedLearnpath','','scormbuilder.gif',0,0,'external'),
+(18,'conference','conference/index.php?type=conference','conf.gif',0,0,'external'),
+(19,'conference','conference/index.php?type=classroom','conf.gif',0,0,'external'),
+(20,'learnpath','newscorm/lp_controller.php','scorms.gif',5,1,'basic'),
+(21,'blog','blog/blog.php','blog.gif',1,2,'basic'),
+(22,'blog_management','blog/blog_admin.php','blog_admin.gif',1,2,'courseadmin'),
+(23,'course_maintenance','course_info/maintenance.php','backup.gif',2,3,'courseadmin'),
+(24,'survey','survey/survey_list.php','survey.gif',2,1,'basic'),
+(25,'wiki','wiki/index.php','wiki.gif',2,3,'basic'),
+(26,'gradebook','gradebook/index.php','gradebook.gif',2,2,'basic'),
+(27,'glossary','glossary/index.php','glossary.gif',2,1,'basic'),
+(28,'notebook','notebook/index.php','notebook.gif',2,1,'basic'),
+(29,'attendance','attendance/index.php','attendance.gif',2,1,'basic'),
+(30,'course_progress','course_progress/index.php','course_progress.gif',2,1,'basic');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE course_module ENABLE KEYS */;
+
+--
+-- Table structure for table course_rel_class
+--
+
+DROP TABLE IF EXISTS course_rel_class;
+CREATE TABLE IF NOT EXISTS course_rel_class (
+  course_code char(40) NOT NULL,
+  class_id mediumint unsigned NOT NULL,
+  PRIMARY KEY  (course_code,class_id)
+);
+
+--
+-- Dumping data for table course_rel_class
+--
+
+
+/*!40000 ALTER TABLE course_rel_class DISABLE KEYS */;
+LOCK TABLES course_rel_class WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE course_rel_class ENABLE KEYS */;
+
+--
+-- Table structure for table course_rel_user
+--
+
+DROP TABLE IF EXISTS course_rel_user;
+CREATE TABLE IF NOT EXISTS course_rel_user (
+  course_code varchar(40) NOT NULL,
+  user_id int unsigned NOT NULL default '0',
+  status tinyint NOT NULL default '5',
+  role varchar(60) default NULL,
+  group_id int NOT NULL default '0',
+  tutor_id int unsigned NOT NULL default '0',
+  sort int default NULL,
+  user_course_cat int default '0',
+  relation_type int default 0,
+  legal_agreement INTEGER DEFAULT 0,
+  PRIMARY KEY  (course_code,user_id,relation_type)
+);
+ALTER TABLE course_rel_user ADD INDEX (user_id);
+
+--
+-- Dumping data for table course_rel_user
+--
+
+
+/*!40000 ALTER TABLE course_rel_user DISABLE KEYS */;
+LOCK TABLES course_rel_user WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE course_rel_user ENABLE KEYS */;
+
+--
+-- Table structure for table language
+--
+
+DROP TABLE IF EXISTS language;
+CREATE TABLE IF NOT EXISTS language (
+  id tinyint unsigned NOT NULL auto_increment,
+  original_name varchar(255) default NULL,
+  english_name varchar(255) default NULL,
+  isocode varchar(10) default NULL,
+  dokeos_folder varchar(250) default NULL,
+  available tinyint NOT NULL default 1,
+  parent_id tinyint unsigned,
+  PRIMARY KEY  (id)
+);
+ALTER TABLE language ADD INDEX idx_language_dokeos_folder(dokeos_folder);
+
+--
+-- Dumping data for table language
+--
+
+
+/*!40000 ALTER TABLE language DISABLE KEYS */;
+LOCK TABLES language WRITE;
+INSERT INTO language (original_name, english_name, isocode, dokeos_folder, available) VALUES
+('&#1575;&#1604;&#1593;&#1585;&#1576;&#1610;&#1577;','arabic','ar','arabic',0),
+('Asturianu','asturian','ast','asturian',0),
+('&#2476;&#2494;&#2434;&#2482;&#2494;','bengali','bn','bengali',0),
+('&#1041;&#1098;&#1083;&#1075;&#1072;&#1088;&#1089;&#1082;&#1080;','bulgarian','bg','bulgarian',1),
+('Bosanski','bosnian','bs','bosnian',1),
+('Catal&agrave;','catalan','ca','catalan',0),
+('&#20013;&#25991;&#65288;&#31616;&#20307;&#65289;','simpl_chinese','zh','simpl_chinese',0),
+('&#32321;&#39636;&#20013;&#25991;','trad_chinese','zh-TW','trad_chinese',0),
+('&#268;esky','czech','cs','czech',0),
+('Dansk','danish','da','danish',0),
+('&#1583;&#1585;&#1740;','dari','prs','dari',0),
+('Deutsch','german','de','german',1),
+('&Epsilon;&lambda;&lambda;&eta;&nu;&iota;&kappa;&#940;','greek','el','greek',0),
+('English','english','en','english',1),
+('Espa&ntilde;ol','spanish','es','spanish',1),
+('Esperanto','esperanto','eo','esperanto',0),
+('Euskara','basque','eu','basque',0),
+('&#1601;&#1575;&#1585;&#1587;&#1740;','persian','fa','persian',0),
+('Fran&ccedil;ais','french','fr','french',1),
+('Furlan','friulian','fur','friulian',0),
+('Galego','galician','gl','galician',0),
+('&#4325;&#4304;&#4320;&#4311;&#4323;&#4314;&#4312;','georgian','ka','georgian',0),
+('Hrvatski','croatian','hr','croatian',0),
+('&#1506;&#1489;&#1512;&#1497;&#1514;','hebrew','he','hebrew',0),
+('&#2361;&#2367;&#2344;&#2381;&#2342;&#2368;','hindi','hi','hindi',0),
+('Bahasa Indonesia','indonesian','id','indonesian',1),
+('Italiano','italian','it','italian',1),
+('&#54620;&#44397;&#50612;','korean','ko','korean',0),
+('Latvie&scaron;u','latvian','lv','latvian',0),
+('Lietuvi&#371;','lithuanian','lt','lithuanian',0),
+('&#1052;&#1072;&#1082;&#1077;&#1076;&#1086;&#1085;&#1089;&#1082;&#1080;','macedonian','mk','macedonian',0),
+('Magyar','hungarian','hu','hungarian',1),
+('Bahasa Melayu','malay','ms','malay',0),
+('Nederlands','dutch','nl','dutch',1),
+('&#26085;&#26412;&#35486;','japanese','ja','japanese',0),
+('Norsk','norwegian','no','norwegian',0),
+('Occitan','occitan','oc','occitan',0),
+('&#1662;&#1690;&#1578;&#1608;','pashto','ps','pashto',0),
+('Polski','polish','pl','polish',0),
+('Portugu&ecirc;s europeu','portuguese','pt','portuguese',1),
+('Portugu&ecirc;s do Brasil','brazilian','pt-BR','brazilian',1),
+('Rom&acirc;n&#259;','romanian','ro','romanian',0),
+('Runasimi','quechua_cusco','qu','quechua_cusco',0),
+('&#1056;&#1091;&#1089;&#1089;&#1082;&#1080;&#1081;','russian','ru','russian',0),
+('Sloven&#269;ina','slovak','sk','slovak',0),
+('Sloven&scaron;&#269;ina','slovenian','sl','slovenian',1),
+('&#1575;&#1604;&#1589;&#1608;&#1605;&#1575;&#1604;&#1610;&#1577;','somali','so','somali',0),
+('Srpski','serbian','sr','serbian',0),
+('Suomi','finnish','fi','finnish',0),
+('Svenska','swedish','sv','swedish',0),
+('&#3652;&#3607;&#3618;','thai','th','thai',0),
+('T&uuml;rk&ccedil;e','turkish','tr','turkish',0),
+('&#1059;&#1082;&#1088;&#1072;&#1111;&#1085;&#1089;&#1100;&#1082;&#1072;','ukrainian','uk','ukrainian',0),
+('Ti&#7871;ng Vi&#7879;t','vietnamese','vi','vietnamese',0),
+('Kiswahili','swahili','sw','swahili',0),
+('Yor&ugrave;b&aacute;','yoruba','yo','yoruba',0);
+
+-- The chosen during the installation platform language should be enabled.
+UPDATE language SET available=1 WHERE dokeos_folder = '{PLATFORMLANGUAGE}';
+
+UNLOCK TABLES;
+/*!40000 ALTER TABLE language ENABLE KEYS */;
+
+--
+-- Table structure for table php_session
+--
+
+DROP TABLE IF EXISTS php_session;
+CREATE TABLE IF NOT EXISTS php_session (
+  session_id varchar(32) NOT NULL default '',
+  session_name varchar(10) NOT NULL default '',
+  session_time int NOT NULL default '0',
+  session_start int NOT NULL default '0',
+  session_value mediumtext NOT NULL,
+  PRIMARY KEY  (session_id)
+);
+
+--
+-- Table structure for table session
+--
+DROP TABLE IF EXISTS session;
+CREATE TABLE IF NOT EXISTS session (
+  id smallint unsigned NOT NULL auto_increment,
+  id_coach int unsigned NOT NULL default '0',
+  name char(50) NOT NULL default '',
+  nbr_courses smallint unsigned NOT NULL default '0',
+  nbr_users mediumint unsigned NOT NULL default '0',
+  nbr_classes mediumint unsigned NOT NULL default '0',
+  date_start date NOT NULL default '0000-00-00',
+  date_end date NOT NULL default '0000-00-00',
+  nb_days_access_before_beginning TINYINT UNSIGNED NULL default '0',
+  nb_days_access_after_end TINYINT UNSIGNED NULL default '0',
+  session_admin_id INT UNSIGNED NOT NULL,
+  visibility int NOT NULL default 1,
+  session_category_id int NOT NULL,
+  promotion_id INT NOT NULL,
+  PRIMARY KEY  (id),
+  INDEX (session_admin_id),
+  UNIQUE KEY name (name)
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table session_rel_course
+--
+DROP TABLE IF EXISTS session_rel_course;
+CREATE TABLE IF NOT EXISTS session_rel_course (
+  id_session smallint unsigned NOT NULL default '0',
+  course_code char(40) NOT NULL default '',
+  nbr_users smallint unsigned NOT NULL default '0',
+  PRIMARY KEY  (id_session,course_code),
+  KEY course_code (course_code)
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table session_rel_course_rel_user
+--
+DROP TABLE IF EXISTS session_rel_course_rel_user;
+CREATE TABLE IF NOT EXISTS session_rel_course_rel_user (
+  id_session smallint unsigned NOT NULL default '0',
+  course_code char(40) NOT NULL default '',
+  id_user int unsigned NOT NULL default '0',
+  visibility int NOT NULL default 1,
+  status int NOT NULL default 0,
+  legal_agreement INTEGER DEFAULT 0,
+  PRIMARY KEY  (id_session,course_code,id_user),
+  KEY id_user (id_user),
+  KEY course_code (course_code)
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table session_rel_user
+--
+DROP TABLE IF EXISTS session_rel_user;
+CREATE TABLE IF NOT EXISTS session_rel_user (
+  id_session mediumint unsigned NOT NULL default '0',
+  id_user mediumint unsigned NOT NULL default '0',
+  relation_type int default 0,
+  PRIMARY KEY (id_session, id_user, relation_type)
+);
+
+
+DROP TABLE IF EXISTS session_field;
+CREATE TABLE IF NOT EXISTS session_field (
+    id  int NOT NULL auto_increment,
+    field_type int NOT NULL default 1,
+    field_variable  varchar(64) NOT NULL,
+    field_display_text  varchar(64),
+    field_default_value text,
+    field_order int,
+    field_visible tinyint default 0,
+    field_changeable tinyint default 0,
+    field_filter tinyint default 0,
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+DROP TABLE IF EXISTS session_field_values;
+CREATE TABLE IF NOT EXISTS session_field_values(
+    id  int NOT NULL auto_increment,
+    session_id int NOT NULL,
+    field_id int NOT NULL,
+    field_value text,
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+--
+-- Table structure for table settings_current
+--
+
+DROP TABLE IF EXISTS settings_current;
+CREATE TABLE IF NOT EXISTS settings_current (
+  id int unsigned NOT NULL auto_increment,
+  variable varchar(255) default NULL,
+  subkey varchar(255) default NULL,
+  type varchar(255) default NULL,
+  category varchar(255) default NULL,
+  selected_value varchar(255) default NULL,
+  title varchar(255) NOT NULL default '',
+  comment varchar(255) default NULL,
+  scope varchar(50) default NULL,
+  subkeytext varchar(255) default NULL,
+  access_url int unsigned not null default 1,
+  access_url_changeable int unsigned not null default 0,
+  access_url_locked int not null default 0,
+  PRIMARY KEY id (id),
+  INDEX (access_url)
+);
+
+ALTER TABLE settings_current ADD UNIQUE unique_setting (variable(110), subkey(110), category(110), access_url);
+
+--
+-- Dumping data for table settings_current
+--
+
+/*!40000 ALTER TABLE settings_current DISABLE KEYS */;
+LOCK TABLES settings_current WRITE;
+INSERT INTO settings_current
+(variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable)
+VALUES
+('Institution',NULL,'textfield','Platform','{ORGANISATIONNAME}','InstitutionTitle','InstitutionComment','platform',NULL, 1),
+('InstitutionUrl',NULL,'textfield','Platform','{ORGANISATIONURL}','InstitutionUrlTitle','InstitutionUrlComment',NULL,NULL, 1),
+('siteName',NULL,'textfield','Platform','{CAMPUSNAME}','SiteNameTitle','SiteNameComment',NULL,NULL, 1),
+('emailAdministrator',NULL,'textfield','Platform','{ADMINEMAIL}','emailAdministratorTitle','emailAdministratorComment',NULL,NULL, 1),
+('administratorSurname',NULL,'textfield','Platform','{ADMINLASTNAME}','administratorSurnameTitle','administratorSurnameComment',NULL,NULL, 1),
+('administratorName',NULL,'textfield','Platform','{ADMINFIRSTNAME}','administratorNameTitle','administratorNameComment',NULL,NULL, 1),
+('show_administrator_data',NULL,'radio','Platform','true','ShowAdministratorDataTitle','ShowAdministratorDataComment',NULL,NULL, 1),
+('show_tutor_data',NULL,'radio','Session','true','ShowTutorDataTitle','ShowTutorDataComment',NULL,NULL, 1),
+('show_teacher_data',NULL,'radio','Platform','true','ShowTeacherDataTitle','ShowTeacherDataComment',NULL,NULL, 1),
+('homepage_view',NULL,'radio','Course','activity_big','HomepageViewTitle','HomepageViewComment',NULL,NULL, 1),
+('show_toolshortcuts',NULL,'radio','Course','false','ShowToolShortcutsTitle','ShowToolShortcutsComment',NULL,NULL, 0),
+('allow_group_categories',NULL,'radio','Course','false','AllowGroupCategories','AllowGroupCategoriesComment',NULL,NULL, 0),
+('server_type',NULL,'radio','Platform','production','ServerStatusTitle','ServerStatusComment',NULL,NULL, 0),
+('platformLanguage',NULL,'link','Languages','{PLATFORMLANGUAGE}','PlatformLanguageTitle','PlatformLanguageComment',NULL,NULL, 0),
+('showonline','world','checkbox','Platform','true','ShowOnlineTitle','ShowOnlineComment',NULL,'ShowOnlineWorld', 0),
+('showonline','users','checkbox','Platform','true','ShowOnlineTitle','ShowOnlineComment',NULL,'ShowOnlineUsers', 0),
+('showonline','course','checkbox','Platform','true','ShowOnlineTitle','ShowOnlineComment',NULL,'ShowOnlineCourse', 0),
+('profile','name','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'name', 0),
+('profile','officialcode','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'officialcode', 0),
+('profile','email','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'Email', 0),
+('profile','picture','checkbox','User','true','ProfileChangesTitle','ProfileChangesComment',NULL,'UserPicture', 0),
+('profile','login','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'Login', 0),
+('profile','password','checkbox','User','true','ProfileChangesTitle','ProfileChangesComment',NULL,'UserPassword', 0),
+('profile','language','checkbox','User','true','ProfileChangesTitle','ProfileChangesComment',NULL,'Language', 0),
+('default_document_quotum',NULL,'textfield','Course','100000000','DefaultDocumentQuotumTitle','DefaultDocumentQuotumComment',NULL,NULL, 0),
+('registration','officialcode','checkbox','User','false','RegistrationRequiredFormsTitle','RegistrationRequiredFormsComment',NULL,'OfficialCode', 0),
+('registration','email','checkbox','User','true','RegistrationRequiredFormsTitle','RegistrationRequiredFormsComment',NULL,'Email', 0),
+('registration','language','checkbox','User','true','RegistrationRequiredFormsTitle','RegistrationRequiredFormsComment',NULL,'Language', 0),
+('default_group_quotum',NULL,'textfield','Course','5000000','DefaultGroupQuotumTitle','DefaultGroupQuotumComment',NULL,NULL, 0),
+('allow_registration',NULL,'radio','Platform','{ALLOWSELFREGISTRATION}','AllowRegistrationTitle','AllowRegistrationComment',NULL,NULL, 0),
+('allow_registration_as_teacher',NULL,'radio','Platform','{ALLOWTEACHERSELFREGISTRATION}','AllowRegistrationAsTeacherTitle','AllowRegistrationAsTeacherComment',NULL,NULL, 0),
+('allow_lostpassword',NULL,'radio','Platform','true','AllowLostPasswordTitle','AllowLostPasswordComment',NULL,NULL, 0),
+('allow_user_headings',NULL,'radio','Course','false','AllowUserHeadings','AllowUserHeadingsComment',NULL,NULL, 0),
+('course_create_active_tools','course_description','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'CourseDescription', 0),
+('course_create_active_tools','agenda','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Agenda', 0),
+('course_create_active_tools','documents','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Documents', 0),
+('course_create_active_tools','learning_path','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'LearningPath', 0),
+('course_create_active_tools','links','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Links', 0),
+('course_create_active_tools','announcements','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Announcements', 0),
+('course_create_active_tools','forums','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Forums', 0),
+('course_create_active_tools','dropbox','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Dropbox', 0),
+('course_create_active_tools','quiz','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Quiz', 0),
+('course_create_active_tools','users','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Users', 0),
+('course_create_active_tools','groups','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Groups', 0),
+('course_create_active_tools','chat','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Chat', 0),
+('course_create_active_tools','online_conference','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'OnlineConference', 0),
+('course_create_active_tools','student_publications','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'StudentPublications', 0),
+('allow_personal_agenda',NULL,'radio','User','true','AllowPersonalAgendaTitle','AllowPersonalAgendaComment',NULL,NULL, 0),
+('display_coursecode_in_courselist',NULL,'radio','Platform','false','DisplayCourseCodeInCourselistTitle','DisplayCourseCodeInCourselistComment',NULL,NULL, 0),
+('display_teacher_in_courselist',NULL,'radio','Platform','true','DisplayTeacherInCourselistTitle','DisplayTeacherInCourselistComment',NULL,NULL, 0),
+('permanently_remove_deleted_files',NULL,'radio','Tools','false','PermanentlyRemoveFilesTitle','PermanentlyRemoveFilesComment',NULL,NULL, 0),
+('dropbox_allow_overwrite',NULL,'radio','Tools','true','DropboxAllowOverwriteTitle','DropboxAllowOverwriteComment',NULL,NULL, 0),
+('dropbox_max_filesize',NULL,'textfield','Tools','100000000','DropboxMaxFilesizeTitle','DropboxMaxFilesizeComment',NULL,NULL, 0),
+('dropbox_allow_just_upload',NULL,'radio','Tools','true','DropboxAllowJustUploadTitle','DropboxAllowJustUploadComment',NULL,NULL, 0),
+('dropbox_allow_student_to_student',NULL,'radio','Tools','true','DropboxAllowStudentToStudentTitle','DropboxAllowStudentToStudentComment',NULL,NULL, 0),
+('dropbox_allow_group',NULL,'radio','Tools','true','DropboxAllowGroupTitle','DropboxAllowGroupComment',NULL,NULL, 0),
+('dropbox_allow_mailing',NULL,'radio','Tools','false','DropboxAllowMailingTitle','DropboxAllowMailingComment',NULL,NULL, 0),
+('administratorTelephone',NULL,'textfield','Platform','(000) 001 02 03','administratorTelephoneTitle','administratorTelephoneComment',NULL,NULL, 1),
+('extended_profile',NULL,'radio','User','false','ExtendedProfileTitle','ExtendedProfileComment',NULL,NULL, 0),
+('student_view_enabled',NULL,'radio','Platform','true','StudentViewEnabledTitle','StudentViewEnabledComment',NULL,NULL, 0),
+('show_navigation_menu',NULL,'radio','Course','false','ShowNavigationMenuTitle','ShowNavigationMenuComment',NULL,NULL, 0),
+('enable_tool_introduction',NULL,'radio','course','false','EnableToolIntroductionTitle','EnableToolIntroductionComment',NULL,NULL, 0),
+('page_after_login', NULL, 'radio','Platform','user_portal.php', 'PageAfterLoginTitle','PageAfterLoginComment', NULL, NULL, 0),
+('time_limit_whosonline', NULL, 'textfield','Platform','30', 'TimeLimitWhosonlineTitle','TimeLimitWhosonlineComment', NULL, NULL, 0),
+('breadcrumbs_course_homepage', NULL, 'radio','Course','course_title', 'BreadCrumbsCourseHomepageTitle','BreadCrumbsCourseHomepageComment', NULL, NULL, 0),
+('example_material_course_creation', NULL, 'radio','Platform','true', 'ExampleMaterialCourseCreationTitle','ExampleMaterialCourseCreationComment', NULL, NULL, 0),
+('account_valid_duration',NULL, 'textfield','Platform','3660', 'AccountValidDurationTitle','AccountValidDurationComment', NULL, NULL, 0),
+('use_session_mode', NULL, 'radio','Session','true', 'UseSessionModeTitle','UseSessionModeComment', NULL, NULL, 0),
+('allow_email_editor', NULL, 'radio', 'Tools', 'false', 'AllowEmailEditorTitle', 'AllowEmailEditorComment', NULL, NULL, 0),
+('registered', NULL, 'textfield', NULL, 'false', NULL, NULL, NULL, NULL, 0),
+('donotlistcampus', NULL, 'textfield', NULL, 'false', NULL, NULL, NULL, NULL,0 ),
+('show_email_addresses', NULL,'radio','Platform','false','ShowEmailAddresses','ShowEmailAddressesComment',NULL,NULL, 1),
+('profile','phone','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'phone', 0),
+('service_visio', 'active', 'radio',NULL,'false', 'VisioEnable','', NULL, NULL, 0),
+('service_visio', 'visio_host', 'textfield',NULL,'', 'VisioHost','', NULL, NULL, 0),
+('service_visio', 'visio_port', 'textfield',NULL,'1935', 'VisioPort','', NULL, NULL, 0),
+('service_visio', 'visio_pass', 'textfield',NULL,'', 'VisioPassword','', NULL, NULL, 0),
+('service_ppt2lp', 'active', 'radio',NULL,'false', 'ppt2lp_actived','', NULL, NULL, 0),
+('service_ppt2lp', 'host', 'textfield', NULL, NULL, 'Host', NULL, NULL, NULL, 0),
+('service_ppt2lp', 'port', 'textfield', NULL, 2002, 'Port', NULL, NULL, NULL, 0),
+('service_ppt2lp', 'user', 'textfield', NULL, NULL, 'UserOnHost', NULL, NULL, NULL, 0),
+('service_ppt2lp', 'ftp_password', 'textfield', NULL, NULL, 'FtpPassword', NULL, NULL, NULL, 0),
+('service_ppt2lp', 'path_to_lzx', 'textfield', NULL, NULL, '', NULL, NULL, NULL, 0),
+('service_ppt2lp', 'size', 'radio', NULL, '720x540', '', NULL, NULL, NULL, 0),
+('wcag_anysurfer_public_pages', NULL, 'radio','Editor','false','PublicPagesComplyToWAITitle','PublicPagesComplyToWAIComment', NULL, NULL, 0),
+('stylesheets', NULL, 'textfield','stylesheets','chamilo','',NULL, NULL, NULL, 1),
+('upload_extensions_list_type', NULL, 'radio', 'Security', 'blacklist', 'UploadExtensionsListType', 'UploadExtensionsListTypeComment', NULL, NULL, 0),
+('upload_extensions_blacklist', NULL, 'textfield', 'Security', '', 'UploadExtensionsBlacklist', 'UploadExtensionsBlacklistComment', NULL, NULL, 0),
+('upload_extensions_whitelist', NULL, 'textfield', 'Security', 'htm;html;jpg;jpeg;gif;png;swf;avi;mpg;mpeg;mov;flv;doc;docx;xls;xlsx;ppt;pptx;odt;odp;ods;pdf', 'UploadExtensionsWhitelist', 'UploadExtensionsWhitelistComment', NULL, NULL, 0),
+('upload_extensions_skip', NULL, 'radio', 'Security', 'true', 'UploadExtensionsSkip', 'UploadExtensionsSkipComment', NULL, NULL, 0),
+('upload_extensions_replace_by', NULL, 'textfield', 'Security', 'dangerous', 'UploadExtensionsReplaceBy', 'UploadExtensionsReplaceByComment', NULL, NULL, 0),
+('show_number_of_courses', NULL, 'radio','Platform','false', 'ShowNumberOfCourses','ShowNumberOfCoursesComment', NULL, NULL, 0),
+('show_empty_course_categories', NULL, 'radio','Platform','true', 'ShowEmptyCourseCategories','ShowEmptyCourseCategoriesComment', NULL, NULL, 0),
+('show_back_link_on_top_of_tree', NULL, 'radio','Platform','false', 'ShowBackLinkOnTopOfCourseTree','ShowBackLinkOnTopOfCourseTreeComment', NULL, NULL, 0),
+('show_different_course_language', NULL, 'radio','Platform','true', 'ShowDifferentCourseLanguage','ShowDifferentCourseLanguageComment', NULL, NULL, 1),
+('split_users_upload_directory', NULL, 'radio','Tuning','true', 'SplitUsersUploadDirectory','SplitUsersUploadDirectoryComment', NULL, NULL, 0),
+('hide_dltt_markup', NULL, 'radio','Languages','true', 'HideDLTTMarkup','HideDLTTMarkupComment', NULL, NULL, 0),
+('display_categories_on_homepage',NULL,'radio','Platform','false','DisplayCategoriesOnHomepageTitle','DisplayCategoriesOnHomepageComment',NULL,NULL, 1),
+('permissions_for_new_directories', NULL, 'textfield', 'Security', '0777', 'PermissionsForNewDirs', 'PermissionsForNewDirsComment', NULL, NULL, 0),
+('permissions_for_new_files', NULL, 'textfield', 'Security', '0666', 'PermissionsForNewFiles', 'PermissionsForNewFilesComment', NULL, NULL, 0),
+('show_tabs', 'campus_homepage', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsCampusHomepage', 1),
+('show_tabs', 'my_courses', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsMyCourses', 1),
+('show_tabs', 'reporting', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsReporting', 1),
+('show_tabs', 'platform_administration', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsPlatformAdministration', 1),
+('show_tabs', 'my_agenda', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsMyAgenda', 1),
+('show_tabs', 'my_profile', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsMyProfile', 1),
+('default_forum_view', NULL, 'radio', 'Course', 'flat', 'DefaultForumViewTitle','DefaultForumViewComment',NULL,NULL, 0),
+('platform_charset',NULL,'textfield','Languages','UTF-8','PlatformCharsetTitle','PlatformCharsetComment','platform',NULL, 0),
+('noreply_email_address', '', 'textfield', 'Platform', '', 'NoReplyEmailAddress', 'NoReplyEmailAddressComment', NULL, NULL, 0),
+('survey_email_sender_noreply', '', 'radio', 'Course', 'coach', 'SurveyEmailSenderNoReply', 'SurveyEmailSenderNoReplyComment', NULL, NULL, 0),
+('openid_authentication',NULL,'radio','Security','false','OpenIdAuthentication','OpenIdAuthenticationComment',NULL,NULL, 0),
+('profile','openid','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'OpenIDURL', 0),
+('gradebook_enable',NULL,'radio','Gradebook','false','GradebookActivation','GradebookActivationComment',NULL,NULL, 0),
+('show_tabs','my_gradebook','checkbox','Platform','true','ShowTabsTitle','ShowTabsComment',NULL,'TabsMyGradebook', 1),
+('gradebook_score_display_coloring','my_display_coloring','checkbox','Gradebook','false','GradebookScoreDisplayColoring','GradebookScoreDisplayColoringComment',NULL,'TabsGradebookEnableColoring', 0),
+('gradebook_score_display_custom','my_display_custom','checkbox','Gradebook','false','GradebookScoreDisplayCustom','GradebookScoreDisplayCustomComment',NULL,'TabsGradebookEnableCustom', 0),
+('gradebook_score_display_colorsplit',NULL,'textfield','Gradebook','50','GradebookScoreDisplayColorSplit','GradebookScoreDisplayColorSplitComment',NULL,NULL, 0),
+('gradebook_score_display_upperlimit','my_display_upperlimit','checkbox','Gradebook','false','GradebookScoreDisplayUpperLimit','GradebookScoreDisplayUpperLimitComment',NULL,'TabsGradebookEnableUpperLimit', 0),
+('gradebook_number_decimals', NULL, 'select', 'Gradebook', '0', 'GradebookNumberDecimals', 'GradebookNumberDecimalsComment', NULL, NULL, 0),
+('user_selected_theme',NULL,'radio','Platform','false','UserThemeSelection','UserThemeSelectionComment',NULL,NULL, 0),
+('profile','theme','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'UserTheme', 0),
+('allow_course_theme',NULL,'radio','Course','true','AllowCourseThemeTitle','AllowCourseThemeComment',NULL,NULL, 0),
+('display_mini_month_calendar',NULL,'radio','Tools', 'true', 'DisplayMiniMonthCalendarTitle', 'DisplayMiniMonthCalendarComment', NULL, NULL, 0),
+('display_upcoming_events',NULL,'radio','Tools','true','DisplayUpcomingEventsTitle','DisplayUpcomingEventsComment',NULL,NULL, 0),
+('number_of_upcoming_events',NULL,'textfield','Tools','1','NumberOfUpcomingEventsTitle','NumberOfUpcomingEventsComment',NULL,NULL, 0),
+('show_closed_courses',NULL,'radio','Platform','false','ShowClosedCoursesTitle','ShowClosedCoursesComment',NULL,NULL, 0),
+('service_visio', 'visio_use_rtmpt', 'radio',null,'false', 'VisioUseRtmptTitle','VisioUseRtmptComment', NULL, NULL, 0),
+('extendedprofile_registration', 'mycomptetences', 'checkbox','User','false', 'ExtendedProfileRegistrationTitle','ExtendedProfileRegistrationComment', NULL, 'MyCompetences', 0),
+('extendedprofile_registration', 'mydiplomas', 'checkbox','User','false', 'ExtendedProfileRegistrationTitle','ExtendedProfileRegistrationComment', NULL, 'MyDiplomas', 0),
+('extendedprofile_registration', 'myteach', 'checkbox','User','false', 'ExtendedProfileRegistrationTitle','ExtendedProfileRegistrationComment', NULL, 'MyTeach', 0),
+('extendedprofile_registration', 'mypersonalopenarea', 'checkbox','User','false', 'ExtendedProfileRegistrationTitle','ExtendedProfileRegistrationComment', NULL, 'MyPersonalOpenArea', 0),
+('extendedprofile_registrationrequired', 'mycomptetences', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyCompetences', 0),
+('extendedprofile_registrationrequired', 'mydiplomas', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyDiplomas', 0),
+('extendedprofile_registrationrequired', 'myteach', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyTeach', 0),
+('extendedprofile_registrationrequired', 'mypersonalopenarea', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyPersonalOpenArea', 0),
+('registration','phone','textfield','User','false','RegistrationRequiredFormsTitle','RegistrationRequiredFormsComment',NULL,'Phone', 0),
+('add_users_by_coach',NULL,'radio','Session','false','AddUsersByCoachTitle','AddUsersByCoachComment',NULL,NULL, 0),
+('extend_rights_for_coach',NULL,'radio','Security','false','ExtendRightsForCoachTitle','ExtendRightsForCoachComment',NULL,NULL, 0),
+('extend_rights_for_coach_on_survey',NULL,'radio','Security','true','ExtendRightsForCoachOnSurveyTitle','ExtendRightsForCoachOnSurveyComment',NULL,NULL, 0),
+('course_create_active_tools','wiki','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Wiki', 0),
+('show_session_coach', NULL, 'radio','Session','false', 'ShowSessionCoachTitle','ShowSessionCoachComment', NULL, NULL, 0),
+('course_create_active_tools','gradebook','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Gradebook', 0),
+('allow_users_to_create_courses',NULL,'radio','Platform','true','AllowUsersToCreateCoursesTitle','AllowUsersToCreateCoursesComment',NULL,NULL, 0),
+('course_create_active_tools','survey','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Survey', 0),
+('course_create_active_tools','glossary','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Glossary', 0),
+('course_create_active_tools','notebook','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Notebook', 0),
+('course_create_active_tools','attendances','checkbox','Tools','false','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Attendances', 0),
+('course_create_active_tools','course_progress','checkbox','Tools','false','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'CourseProgress', 0),
+('advanced_filemanager',NULL,'radio','Editor','true','AdvancedFileManagerTitle','AdvancedFileManagerComment',NULL,NULL, 1),
+('allow_reservation', NULL, 'radio', 'Tools', 'false', 'AllowReservationTitle', 'AllowReservationComment', NULL, NULL, 0),
+('profile','apikeys','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'ApiKeys', 0),
+('allow_message_tool', NULL, 'radio', 'Tools', 'true', 'AllowMessageToolTitle', 'AllowMessageToolComment', NULL, NULL,1),
+('allow_social_tool', NULL, 'radio', 'Tools', 'true', 'AllowSocialToolTitle', 'AllowSocialToolComment', NULL, NULL,1),
+('allow_students_to_browse_courses',NULL,'radio','Platform','true','AllowStudentsToBrowseCoursesTitle','AllowStudentsToBrowseCoursesComment',NULL,NULL, 1),
+('show_session_data', NULL, 'radio', 'Session', 'false', 'ShowSessionDataTitle', 'ShowSessionDataComment', NULL, NULL, 1),
+('allow_use_sub_language', NULL, 'radio', 'Languages', 'false', 'AllowUseSubLanguageTitle', 'AllowUseSubLanguageComment', NULL, NULL,0),
+('show_glossary_in_documents', NULL, 'radio', 'Course', 'none', 'ShowGlossaryInDocumentsTitle', 'ShowGlossaryInDocumentsComment', NULL, NULL,1),
+('allow_terms_conditions', NULL, 'radio', 'Platform', 'false', 'AllowTermsAndConditionsTitle', 'AllowTermsAndConditionsComment', NULL, NULL,0),
+('course_create_active_tools','enable_search','checkbox','Tools','false','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Search',0),
+('search_enabled',NULL,'radio','Search','false','EnableSearchTitle','EnableSearchComment',NULL,NULL,1),
+('search_prefilter_prefix',NULL, NULL,'Search','','SearchPrefilterPrefix','SearchPrefilterPrefixComment',NULL,NULL,0),
+('search_show_unlinked_results',NULL,'radio','Search','true','SearchShowUnlinkedResultsTitle','SearchShowUnlinkedResultsComment',NULL,NULL,1),
+('show_courses_descriptions_in_catalog', NULL, 'radio', 'Course', 'true', 'ShowCoursesDescriptionsInCatalogTitle', 'ShowCoursesDescriptionsInCatalogComment', NULL, NULL, 1),
+('allow_coach_to_edit_course_session',NULL,'radio','Session','true','AllowCoachsToEditInsideTrainingSessions','AllowCoachsToEditInsideTrainingSessionsComment',NULL,NULL, 0),
+('show_glossary_in_extra_tools', NULL, 'radio', 'Course', 'false', 'ShowGlossaryInExtraToolsTitle', 'ShowGlossaryInExtraToolsComment', NULL, NULL,1),
+('send_email_to_admin_when_create_course',NULL,'radio','Platform','false','SendEmailToAdminTitle','SendEmailToAdminComment',NULL,NULL, 1),
+('go_to_course_after_login',NULL,'radio','Course','false','GoToCourseAfterLoginTitle','GoToCourseAfterLoginComment',NULL,NULL, 0),
+('math_mimetex',NULL,'radio','Editor','false','MathMimetexTitle','MathMimetexComment',NULL,NULL, 0),
+('math_asciimathML',NULL,'radio','Editor','false','MathASCIImathMLTitle','MathASCIImathMLComment',NULL,NULL, 0),
+('enabled_asciisvg',NULL,'radio','Editor','false','AsciiSvgTitle','AsciiSvgComment',NULL,NULL, 0),
+('include_asciimathml_script',NULL,'radio','Editor','false','IncludeAsciiMathMlTitle','IncludeAsciiMathMlComment',NULL,NULL, 0),
+('youtube_for_students',NULL,'radio','Editor','true','YoutubeForStudentsTitle','YoutubeForStudentsComment',NULL,NULL, 0),
+('block_copy_paste_for_students',NULL,'radio','Editor','false','BlockCopyPasteForStudentsTitle','BlockCopyPasteForStudentsComment',NULL,NULL, 0),
+('more_buttons_maximized_mode',NULL,'radio','Editor','true','MoreButtonsForMaximizedModeTitle','MoreButtonsForMaximizedModeComment',NULL,NULL, 0),
+('students_download_folders',NULL,'radio','Tools','true','AllowStudentsDownloadFoldersTitle','AllowStudentsDownloadFoldersComment',NULL,NULL, 0),
+('users_copy_files',NULL,'radio','Tools','true','AllowUsersCopyFilesTitle','AllowUsersCopyFilesComment',NULL,NULL, 1),
+('show_tabs', 'social', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsSocial', 0),
+('allow_students_to_create_groups_in_social',NULL,'radio','Tools','false','AllowStudentsToCreateGroupsInSocialTitle','AllowStudentsToCreateGroupsInSocialComment',NULL,NULL, 0),
+('allow_send_message_to_all_platform_users',NULL,'radio','Tools','true','AllowSendMessageToAllPlatformUsersTitle','AllowSendMessageToAllPlatformUsersComment',NULL,NULL, 0),
+('message_max_upload_filesize',NULL,'textfield','Tools','20971520','MessageMaxUploadFilesizeTitle','MessageMaxUploadFilesizeComment',NULL,NULL, 0),
+('show_tabs', 'dashboard', 'checkbox', 'Platform', 'true', 'ShowTabsTitle', 'ShowTabsComment', NULL, 'TabsDashboard', 1),
+('use_users_timezone', 'timezones', 'radio', 'Timezones', 'true', 'UseUsersTimezoneTitle','UseUsersTimezoneComment',NULL,'Timezones', 1),
+('timezone_value', 'timezones', 'select', 'Timezones', '', 'TimezoneValueTitle','TimezoneValueComment',NULL,'Timezones', 1),
+('allow_user_course_subscription_by_course_admin', NULL, 'radio', 'Security', 'true', 'AllowUserCourseSubscriptionByCourseAdminTitle', 'AllowUserCourseSubscriptionByCourseAdminComment', NULL, NULL, 1),
+('show_link_bug_notification', NULL, 'radio', 'Platform', 'true', 'ShowLinkBugNotificationTitle', 'ShowLinkBugNotificationComment', NULL, NULL, 0),
+('course_validation', NULL, 'radio', 'Platform', 'false', 'EnableCourseValidation', 'EnableCourseValidationComment', NULL, NULL, 1),
+('course_validation_terms_and_conditions_url', NULL, 'textfield', 'Platform', '', 'CourseValidationTermsAndConditionsLink', 'CourseValidationTermsAndConditionsLinkComment', NULL, NULL, 1),
+('sso_authentication',NULL,'radio','Security','false','EnableSSOTitle','EnableSSOComment',NULL,NULL,1),
+('sso_authentication_domain',NULL,'textfield','Security','','SSOServerDomainTitle','SSOServerDomainComment',NULL,NULL,1),
+('sso_authentication_auth_uri',NULL,'textfield','Security','/?q=user','SSOServerAuthURITitle','SSOServerAuthURIComment',NULL,NULL,1),
+('sso_authentication_unauth_uri',NULL,'textfield','Security','/?q=logout','SSOServerUnAuthURITitle','SSOServerUnAuthURIComment',NULL,NULL,1),
+('sso_authentication_protocol',NULL,'radio','Security','http://','SSOServerProtocolTitle','SSOServerProtocolComment',NULL,NULL,1),
+('enabled_wiris',NULL,'radio','Editor','false','EnabledWirisTitle','EnabledWirisComment',NULL,NULL, 0),
+('allow_spellcheck',NULL,'radio','Editor','false','AllowSpellCheckTitle','AllowSpellCheckComment',NULL,NULL, 0),
+('force_wiki_paste_as_plain_text',NULL,'radio','Editor','false','ForceWikiPasteAsPlainTextTitle','ForceWikiPasteAsPlainTextComment',NULL,NULL, 0),
+('enabled_googlemaps',NULL,'radio','Editor','false','EnabledGooglemapsTitle','EnabledGooglemapsComment',NULL,NULL, 0),
+('enabled_imgmap',NULL,'radio','Editor','true','EnabledImageMapsTitle','EnabledImageMapsComment',NULL,NULL, 0),
+('enabled_support_svg',				NULL,'radio',		'Tools',	'true',	'EnabledSVGTitle','EnabledSVGComment',NULL,NULL, 0),
+('pdf_export_watermark_enable',		NULL,'radio',		'Platform',	'false','PDFExportWatermarkEnableTitle',	'PDFExportWatermarkEnableComment',	'platform',NULL, 1),
+('pdf_export_watermark_by_course',	NULL,'radio',		'Platform',	'false','PDFExportWatermarkByCourseTitle',	'PDFExportWatermarkByCourseComment','platform',NULL, 1),
+('pdf_export_watermark_text',		NULL,'textfield',	'Platform',	'',		'PDFExportWatermarkTextTitle',		'PDFExportWatermarkTextComment',	'platform',NULL, 1),
+('enabled_insertHtml',				NULL,'radio',		'Editor',	'true','EnabledInsertHtmlTitle',			'EnabledInsertHtmlComment',NULL,NULL, 0),
+('students_export2pdf',				NULL,'radio',		'Tools',	'true',	'EnabledStudentExport2PDFTitle',	'EnabledStudentExport2PDFComment',NULL,NULL, 0),
+('exercise_min_score', 				NULL,'textfield',	'Course',	'',		'ExerciseMinScoreTitle',			'ExerciseMinScoreComment','platform',NULL, 	1),
+('exercise_max_score', 				NULL,'textfield',	'Course',	'',		'ExerciseMaxScoreTitle',			'ExerciseMaxScoreComment','platform',NULL, 	1),
+('show_users_folders',				NULL,'radio',		'Tools',	'true',	'ShowUsersFoldersTitle','ShowUsersFoldersComment',NULL,NULL, 0),
+('show_default_folders',			NULL,'radio',		'Tools',	'true',	'ShowDefaultFoldersTitle','ShowDefaultFoldersComment',NULL,NULL, 0),
+('show_chat_folder',				NULL,'radio',		'Tools',	'true',	'ShowChatFolderTitle','ShowChatFolderComment',NULL,NULL, 0),
+('enabled_text2audio',				NULL,'radio',		'Tools',	'false',	'Text2AudioTitle','Text2AudioComment',NULL,NULL, 0),
+('course_hide_tools','course_description','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'CourseDescription', 1),
+('course_hide_tools','calendar_event','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Agenda', 1),
+('course_hide_tools','document','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Documents', 1),
+('course_hide_tools','learnpath','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'LearningPath', 1),
+('course_hide_tools','link','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Links', 1),
+('course_hide_tools','announcement','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Announcements', 1),
+('course_hide_tools','forum','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Forums', 1),
+('course_hide_tools','dropbox','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Dropbox', 1),
+('course_hide_tools','quiz','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Quiz', 1),
+('course_hide_tools','user','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Users', 1),
+('course_hide_tools','group','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Groups', 1),
+('course_hide_tools','chat','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Chat', 1),
+('course_hide_tools','student_publication','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'StudentPublications', 1),
+('course_hide_tools','wiki','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Wiki', 1),
+('course_hide_tools','gradebook','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Gradebook', 1),
+('course_hide_tools','survey','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Survey', 1),
+('course_hide_tools','glossary','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Glossary', 1),
+('course_hide_tools','notebook','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Notebook', 1),
+('course_hide_tools','attendance','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Attendances', 1),
+('course_hide_tools','course_progress','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'CourseProgress', 1),
+('course_hide_tools','blog_management','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Blog',1),
+('course_hide_tools','tracking','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Stats',1),
+('course_hide_tools','course_maintenance','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'Maintenance',1),
+('course_hide_tools','course_setting','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'CourseSettings',1),
+('enabled_support_pixlr',NULL,'radio','Tools','false','EnabledPixlrTitle','EnabledPixlrComment',NULL,NULL, 0),
+('show_groups_to_users',NULL,'radio','Session','false','ShowGroupsToUsersTitle','ShowGroupsToUsersComment',NULL,NULL, 0),
+('accessibility_font_resize',NULL,'radio','Platform','false','EnableAccessibilityFontResizeTitle','EnableAccessibilityFontResizeComment',NULL,NULL, 1),
+('hide_courses_in_sessions',NULL,'radio', 'Session','false','HideCoursesInSessionsTitle',	'HideCoursesInSessionsComment','platform',NULL, 1),
+('enable_quiz_scenario',  NULL,'radio','Course','false','EnableQuizScenarioTitle','EnableQuizScenarioComment',NULL,NULL, 1),
+('enable_nanogong',NULL,'radio','Tools','false','EnableNanogongTitle','EnableNanogongComment',NULL,NULL, 0),
+('filter_terms',NULL,'textarea','Security','','FilterTermsTitle','FilterTermsComment',NULL,NULL, 0),
+('header_extra_content', NULL, 'textarea', 'Tracking', '', 'HeaderExtraContentTitle', 'HeaderExtraContentComment', NULL, NULL, 1),
+('footer_extra_content', NULL, 'textarea', 'Tracking', '', 'FooterExtraContentTitle', 'FooterExtraContentComment', NULL, NULL, 1),
+('show_documents_preview', NULL, 'radio', 'Tools', 'false', 'ShowDocumentPreviewTitle', 'ShowDocumentPreviewComment', NULL, NULL, 1),
+('htmlpurifier_wiki', NULL, 'radio', 'Editor', 'false', 'HtmlPurifierWikiTitle', 'HtmlPurifierWikiComment', NULL, NULL, 0),
+('cas_activate', NULL, 'radio', 'CAS', 'false', 'CasMainActivateTitle', 'CasMainActivateComment', NULL, NULL, 0),
+('cas_server', NULL, 'textfield', 'CAS', '', 'CasMainServerTitle', 'CasMainServerComment', NULL, NULL, 0),
+('cas_server_uri', NULL, 'textfield', 'CAS', '', 'CasMainServerURITitle', 'CasMainServerURIComment', NULL, NULL, 0),
+('cas_port', NULL, 'textfield', 'CAS', '', 'CasMainPortTitle', 'CasMainPortComment', NULL, NULL, 0),
+('cas_protocol', NULL, 'radio', 'CAS', '', 'CasMainProtocolTitle', 'CasMainProtocolComment', NULL, NULL, 0),
+('cas_add_user_activate', NULL, 'radio', 'CAS', 'false', 'CasUserAddActivateTitle', 'CasUserAddActivateComment', NULL, NULL, 0),
+('update_user_info_cas_with_ldap', NULL, 'radio', 'CAS', 'true', 'UpdateUserInfoCasWithLdapTitle', 'UpdateUserInfoCasWithLdapComment', NULL, NULL, 0),
+('student_page_after_login', NULL, 'textfield', 'Platform', '', 'StudentPageAfterLoginTitle', 'StudentPageAfterLoginComment', NULL, NULL, 0),
+('teacher_page_after_login', NULL, 'textfield', 'Platform', '', 'TeacherPageAfterLoginTitle', 'TeacherPageAfterLoginComment', NULL, NULL, 0),
+('drh_page_after_login', NULL, 'textfield', 'Platform', '', 'DRHPageAfterLoginTitle', 'DRHPageAfterLoginComment', NULL, NULL, 0),
+('sessionadmin_page_after_login', NULL, 'textfield', 'Session', '', 'SessionAdminPageAfterLoginTitle', 'SessionAdminPageAfterLoginComment', NULL, NULL, 0),
+('student_autosubscribe', NULL, 'textfield', 'Platform', '', 'StudentAutosubscribeTitle', 'StudentAutosubscribeComment', NULL, NULL, 0),
+('teacher_autosubscribe', NULL, 'textfield', 'Platform', '', 'TeacherAutosubscribeTitle', 'TeacherAutosubscribeComment', NULL, NULL, 0),
+('drh_autosubscribe', NULL, 'textfield', 'Platform', '', 'DRHAutosubscribeTitle', 'DRHAutosubscribeComment', NULL, NULL, 0),
+('sessionadmin_autosubscribe', NULL, 'textfield', 'Session', '', 'SessionadminAutosubscribeTitle', 'SessionadminAutosubscribeComment', NULL, NULL, 0),
+('scorm_cumulative_session_time', NULL, 'radio', 'Course', 'true', 'ScormCumulativeSessionTimeTitle', 'ScormCumulativeSessionTimeComment', NULL, NULL, 0),
+('allow_hr_skills_management', NULL, 'radio', 'Gradebook', 'true', 'AllowHRSkillsManagementTitle', 'AllowHRSkillsManagementComment', NULL, NULL, 1),
+('enable_help_link', NULL, 'radio', 'Platform', 'true', 'EnableHelpLinkTitle', 'EnableHelpLinkComment', NULL, NULL, 0),
+('teachers_can_change_score_settings', NULL, 'radio', 'Gradebook', 'true', 'TeachersCanChangeScoreSettingsTitle', 'TeachersCanChangeScoreSettingsComment', NULL, NULL, 1),
+('allow_users_to_change_email_with_no_password', NULL, 'radio', 'User', 'false', 'AllowUsersToChangeEmailWithNoPasswordTitle', 'AllowUsersToChangeEmailWithNoPasswordComment', NULL, NULL, 0),
+('show_admin_toolbar', NULL, 'radio', 'Platform', 'show_to_admin', 'ShowAdminToolbarTitle', 'ShowAdminToolbarComment', NULL, NULL, 1),
+('allow_global_chat', NULL, 'radio', 'Platform', 'true', 'AllowGlobalChatTitle', 'AllowGlobalChatComment', NULL, NULL, 1),
+('languagePriority1', NULL, 'radio', 'Languages', 'course_lang', 'LanguagePriority1Title', 'LanguagePriority1Comment', NULL, NULL, 0),
+('languagePriority2', NULL, 'radio', 'Languages','user_profil_lang', 'LanguagePriority2Title', 'LanguagePriority2Comment', NULL, NULL, 0),
+('languagePriority3', NULL, 'radio', 'Languages','user_selected_lang', 'LanguagePriority3Title', 'LanguagePriority3Comment', NULL, NULL, 0),
+('languagePriority4', NULL, 'radio', 'Languages', 'platform_lang','LanguagePriority4Title', 'LanguagePriority4Comment', NULL, NULL, 0),
+('login_is_email', NULL, 'radio', 'Platform', 'false', 'LoginIsEmailTitle', 'LoginIsEmailComment', NULL, NULL, 0),
+('courses_default_creation_visibility', NULL, 'radio', 'Course', '2', 'CoursesDefaultCreationVisibilityTitle', 'CoursesDefaultCreationVisibilityComment', NULL, NULL, 1),
+('allow_browser_sniffer', NULL, 'radio', 'Tuning', 'false', 'AllowBrowserSnifferTitle', 'AllowBrowserSnifferComment', NULL, NULL, 0),
+('enable_wami_record',NULL,'radio','Tools','false','EnableWamiRecordTitle','EnableWamiRecordComment',NULL,NULL, 0),
+('gradebook_enable_grade_model', NULL, 'radio', 'Gradebook', 'false', 'GradebookEnableGradeModelTitle', 'GradebookEnableGradeModelComment', NULL, NULL, 1),
+('teachers_can_change_grade_model_settings', NULL, 'radio', 'Gradebook', 'true', 'TeachersCanChangeGradeModelSettingsTitle', 'TeachersCanChangeGradeModelSettingsComment', NULL, NULL, 1),
+('gradebook_default_weight', NULL, 'textfield', 'Gradebook', '100', 'GradebookDefaultWeightTitle', 'GradebookDefaultWeightComment', NULL, NULL, 0),
+('ldap_description', NULL, 'radio', 'LDAP', NULL, 'LdapDescriptionTitle', 'LdapDescriptionComment', NULL, NULL, 0),
+('shibboleth_description', NULL, 'radio', 'Shibboleth', 'false', 'ShibbolethMainActivateTitle', 'ShibbolethMainActivateComment', NULL, NULL, 0),
+('facebook_description', NULL, 'radio', 'Facebook', 'false', 'FacebookMainActivateTitle', 'FacebookMainActivateComment', NULL, NULL, 0),
+('gradebook_locking_enabled', NULL, 'radio', 'Gradebook', 'false', 'GradebookEnableLockingTitle', 'GradebookEnableLockingComment', NULL, NULL, 0),
+('gradebook_default_grade_model_id', NULL, 'select', 'Gradebook', '', 'GradebookDefaultGradeModelTitle', 'GradebookDefaultGradeModelComment', NULL, NULL, 1),
+('allow_session_admins_to_manage_all_sessions', NULL, 'radio', 'Session', 'false', 'AllowSessionAdminsToSeeAllSessionsTitle', 'AllowSessionAdminsToSeeAllSessionsComment', NULL, NULL, 1),
+('allow_skills_tool', NULL, 'radio', 'Platform', 'false', 'AllowSkillsToolTitle', 'AllowSkillsToolComment', NULL, NULL, 1),
+('allow_public_certificates', NULL, 'radio', 'Course', 'false', 'AllowPublicCertificatesTitle', 'AllowPublicCertificatesComment', NULL, NULL, 1),
+('platform_unsubscribe_allowed', NULL, 'radio', 'Platform', 'false', 'PlatformUnsubscribeTitle', 'PlatformUnsubscribeComment', NULL, NULL, 1),
+('activate_email_template', NULL, 'radio', 'Platform', 'false', 'ActivateEmailTemplateTitle', 'ActivateEmailTemplateComment', NULL, NULL, 0),
+('enable_iframe_inclusion', NULL, 'radio', 'Editor', 'false', 'EnableIframeInclusionTitle', 'EnableIframeInclusionComment', NULL, NULL, 1),
+('show_hot_courses', NULL, 'radio', 'Platform', 'true', 'ShowHotCoursesTitle', 'ShowHotCoursesComment', NULL, NULL, 1),
+('enable_webcam_clip',NULL,'radio','Tools','false','EnableWebCamClipTitle','EnableWebCamClipComment',NULL,NULL, 0),
+('use_custom_pages', NULL, 'radio','Platform','false','UseCustomPagesTitle','UseCustomPagesComment', NULL, NULL, 1),
+('tool_visible_by_default_at_creation','documents','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Documents', 1),
+('tool_visible_by_default_at_creation','learning_path','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'LearningPath', 1),
+('tool_visible_by_default_at_creation','links','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Links', 1),
+('tool_visible_by_default_at_creation','announcements','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Announcements', 1),
+('tool_visible_by_default_at_creation','forums','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Forums', 1),
+('tool_visible_by_default_at_creation','quiz','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Quiz', 1),
+('tool_visible_by_default_at_creation','gradebook','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Gradebook', 1),
+('chamilo_database_version', NULL, 'textfield',NULL, '1.9.0.18715','DatabaseVersion','', NULL, NULL, 0);
+UNLOCK TABLES;
+/*!40000 ALTER TABLE settings_current ENABLE KEYS */;
+
+--
+-- Table structure for table settings_options
+--
+
+DROP TABLE IF EXISTS settings_options;
+CREATE TABLE IF NOT EXISTS settings_options (
+  id int unsigned NOT NULL auto_increment,
+  variable varchar(255) default NULL,
+  value varchar(255) default NULL,
+  display_text varchar(255) NOT NULL default '',
+  PRIMARY KEY  (id),
+  UNIQUE KEY id (id)
+);
+
+ALTER TABLE settings_options ADD UNIQUE unique_setting_option (variable(165), value(165));
+
+--
+-- Dumping data for table settings_options
+--
+
+/*!40000 ALTER TABLE settings_options DISABLE KEYS */;
+LOCK TABLES settings_options WRITE;
+INSERT INTO settings_options (variable, value, display_text)
+VALUES
+('show_administrator_data','true','Yes'),
+('show_administrator_data','false','No'),
+('show_tutor_data','true','Yes'),
+('show_tutor_data','false','No'),
+('show_teacher_data','true','Yes'),
+('show_teacher_data','false','No'),
+('homepage_view','activity','HomepageViewActivity'),
+('homepage_view','2column','HomepageView2column'),
+('homepage_view','3column','HomepageView3column'),
+('homepage_view','vertical_activity','HomepageViewVerticalActivity'),
+('homepage_view','activity_big','HomepageViewActivityBig'),
+('show_toolshortcuts','true','Yes'),
+('show_toolshortcuts','false','No'),
+('allow_group_categories','true','Yes'),
+('allow_group_categories','false','No'),
+('server_type','production','ProductionServer'),
+('server_type','test','TestServer'),
+('allow_name_change','true','Yes'),
+('allow_name_change','false','No'),
+('allow_officialcode_change','true','Yes'),
+('allow_officialcode_change','false','No'),
+('allow_registration','true','Yes'),
+('allow_registration','false','No'),
+('allow_registration','approval','AfterApproval'),
+('allow_registration_as_teacher','true','Yes'),
+('allow_registration_as_teacher','false','No'),
+('allow_lostpassword','true','Yes'),
+('allow_lostpassword','false','No'),
+('allow_user_headings','true','Yes'),
+('allow_user_headings','false','No'),
+('allow_personal_agenda','true','Yes'),
+('allow_personal_agenda','false','No'),
+('display_coursecode_in_courselist','true','Yes'),
+('display_coursecode_in_courselist','false','No'),
+('display_teacher_in_courselist','true','Yes'),
+('display_teacher_in_courselist','false','No'),
+('permanently_remove_deleted_files','true','YesWillDeletePermanently'),
+('permanently_remove_deleted_files','false','NoWillDeletePermanently'),
+('dropbox_allow_overwrite','true','Yes'),
+('dropbox_allow_overwrite','false','No'),
+('dropbox_allow_just_upload','true','Yes'),
+('dropbox_allow_just_upload','false','No'),
+('dropbox_allow_student_to_student','true','Yes'),
+('dropbox_allow_student_to_student','false','No'),
+('dropbox_allow_group','true','Yes'),
+('dropbox_allow_group','false','No'),
+('dropbox_allow_mailing','true','Yes'),
+('dropbox_allow_mailing','false','No'),
+('extended_profile','true','Yes'),
+('extended_profile','false','No'),
+('student_view_enabled','true','Yes'),
+('student_view_enabled','false','No'),
+('show_navigation_menu','false','No'),
+('show_navigation_menu','icons','IconsOnly'),
+('show_navigation_menu','text','TextOnly'),
+('show_navigation_menu','iconstext','IconsText'),
+('enable_tool_introduction','true','Yes'),
+('enable_tool_introduction','false','No'),
+('page_after_login', 'index.php', 'CampusHomepage'),
+('page_after_login', 'user_portal.php', 'MyCourses'),
+('page_after_login', 'main/auth/courses.php', 'CourseCatalog'),
+('breadcrumbs_course_homepage', 'get_lang', 'CourseHomepage'),
+('breadcrumbs_course_homepage', 'course_code', 'CourseCode'),
+('breadcrumbs_course_homepage', 'course_title', 'CourseTitle'),
+('example_material_course_creation', 'true', 'Yes'),
+('example_material_course_creation', 'false', 'No'),
+('use_session_mode', 'true', 'Yes'),
+('use_session_mode', 'false', 'No'),
+('allow_email_editor', 'true' ,'Yes'),
+('allow_email_editor', 'false', 'No'),
+('show_email_addresses','true','Yes'),
+('show_email_addresses','false','No'),
+('wcag_anysurfer_public_pages', 'true', 'Yes'),
+('wcag_anysurfer_public_pages', 'false', 'No'),
+('upload_extensions_list_type', 'blacklist', 'Blacklist'),
+('upload_extensions_list_type', 'whitelist', 'Whitelist'),
+('upload_extensions_skip', 'true', 'Remove'),
+('upload_extensions_skip', 'false', 'Rename'),
+('show_number_of_courses', 'true', 'Yes'),
+('show_number_of_courses', 'false', 'No'),
+('show_empty_course_categories', 'true', 'Yes'),
+('show_empty_course_categories', 'false', 'No'),
+('show_back_link_on_top_of_tree', 'true', 'Yes'),
+('show_back_link_on_top_of_tree', 'false', 'No'),
+('show_different_course_language', 'true', 'Yes'),
+('show_different_course_language', 'false', 'No'),
+('split_users_upload_directory', 'true', 'Yes'),
+('split_users_upload_directory', 'false', 'No'),
+('hide_dltt_markup', 'false', 'No'),
+('hide_dltt_markup', 'true', 'Yes'),
+('display_categories_on_homepage','true','Yes'),
+('display_categories_on_homepage','false','No'),
+('default_forum_view', 'flat', 'Flat'),
+('default_forum_view', 'threaded', 'Threaded'),
+('default_forum_view', 'nested', 'Nested'),
+('survey_email_sender_noreply', 'coach', 'CourseCoachEmailSender'),
+('survey_email_sender_noreply', 'noreply', 'NoReplyEmailSender'),
+('openid_authentication','true','Yes'),
+('openid_authentication','false','No'),
+('gradebook_enable','true','Yes'),
+('gradebook_enable','false','No'),
+('user_selected_theme','true','Yes'),
+('user_selected_theme','false','No'),
+('allow_course_theme','true','Yes'),
+('allow_course_theme','false','No'),
+('display_mini_month_calendar', 'true', 'Yes'),
+('display_mini_month_calendar', 'false', 'No'),
+('display_upcoming_events', 'true', 'Yes'),
+('display_upcoming_events', 'false', 'No'),
+('show_closed_courses', 'true', 'Yes'),
+('show_closed_courses', 'false', 'No'),
+('ldap_version', '2', 'LDAPVersion2'),
+('ldap_version', '3', 'LDAPVersion3'),
+('visio_use_rtmpt','true','Yes'),
+('visio_use_rtmpt','false','No'),
+('add_users_by_coach', 'true', 'Yes'),
+('add_users_by_coach', 'false', 'No'),
+('extend_rights_for_coach', 'true', 'Yes'),
+('extend_rights_for_coach', 'false', 'No'),
+('extend_rights_for_coach_on_survey', 'true', 'Yes'),
+('extend_rights_for_coach_on_survey', 'false', 'No'),
+('show_session_coach', 'true', 'Yes'),
+('show_session_coach', 'false', 'No'),
+('allow_users_to_create_courses','true','Yes'),
+('allow_users_to_create_courses','false','No'),
+('breadcrumbs_course_homepage', 'session_name_and_course_title', 'SessionNameAndCourseTitle'),
+('advanced_filemanager','true','Yes'),
+('advanced_filemanager','false','No'),
+('allow_reservation', 'true', 'Yes'),
+('allow_reservation', 'false', 'No'),
+('allow_message_tool', 'true', 'Yes'),
+('allow_message_tool', 'false', 'No'),
+('allow_social_tool', 'true', 'Yes'),
+('allow_social_tool', 'false', 'No'),
+('allow_students_to_browse_courses','true','Yes'),
+('allow_students_to_browse_courses','false','No'),
+('show_email_of_teacher_or_tutor ', 'true', 'Yes'),
+('show_email_of_teacher_or_tutor ', 'false', 'No'),
+('show_session_data ', 'true', 'Yes'),
+('show_session_data ', 'false', 'No'),
+('allow_use_sub_language', 'true', 'Yes'),
+('allow_use_sub_language', 'false', 'No'),
+('show_glossary_in_documents', 'none', 'ShowGlossaryInDocumentsIsNone'),
+('show_glossary_in_documents', 'ismanual', 'ShowGlossaryInDocumentsIsManual'),
+('show_glossary_in_documents', 'isautomatic', 'ShowGlossaryInDocumentsIsAutomatic'),
+('allow_terms_conditions', 'true', 'Yes'),
+('allow_terms_conditions', 'false', 'No'),
+('search_enabled', 'true', 'Yes'),
+('search_enabled', 'false', 'No'),
+('search_show_unlinked_results', 'true', 'SearchShowUnlinkedResults'),
+('search_show_unlinked_results', 'false', 'SearchHideUnlinkedResults'),
+('show_courses_descriptions_in_catalog', 'true', 'Yes'),
+('show_courses_descriptions_in_catalog', 'false', 'No'),
+('allow_coach_to_edit_course_session','true','Yes'),
+('allow_coach_to_edit_course_session','false','No'),
+('show_glossary_in_extra_tools', 'true', 'Yes'),
+('show_glossary_in_extra_tools', 'false', 'No'),
+('send_email_to_admin_when_create_course','true','Yes'),
+('send_email_to_admin_when_create_course','false','No'),
+('go_to_course_after_login','true','Yes'),
+('go_to_course_after_login','false','No'),
+('math_mimetex','true','Yes'),
+('math_mimetex','false','No'),
+('math_asciimathML','true','Yes'),
+('math_asciimathML','false','No'),
+('enabled_asciisvg','true','Yes'),
+('enabled_asciisvg','false','No'),
+('include_asciimathml_script','true','Yes'),
+('include_asciimathml_script','false','No'),
+('youtube_for_students','true','Yes'),
+('youtube_for_students','false','No'),
+('block_copy_paste_for_students','true','Yes'),
+('block_copy_paste_for_students','false','No'),
+('more_buttons_maximized_mode','true','Yes'),
+('more_buttons_maximized_mode','false','No'),
+('students_download_folders','true','Yes'),
+('students_download_folders','false','No'),
+('users_copy_files','true','Yes'),
+('users_copy_files','false','No'),
+('allow_students_to_create_groups_in_social','true','Yes'),
+('allow_students_to_create_groups_in_social','false','No'),
+('allow_send_message_to_all_platform_users','true','Yes'),
+('allow_send_message_to_all_platform_users','false','No'),
+('use_users_timezone', 'true', 'Yes'),
+('use_users_timezone', 'false', 'No'),
+('allow_user_course_subscription_by_course_admin', 'true', 'Yes'),
+('allow_user_course_subscription_by_course_admin', 'false', 'No'),
+('show_link_bug_notification', 'true', 'Yes'),
+('show_link_bug_notification', 'false', 'No'),
+('course_validation', 'true', 'Yes'),
+('course_validation', 'false', 'No'),
+('sso_authentication', 'true', 'Yes'),
+('sso_authentication', 'false', 'No'),
+('sso_authentication_protocol', 'http://', 'http://'),
+('sso_authentication_protocol', 'https://', 'https://'),
+('enabled_wiris','true','Yes'),
+('enabled_wiris','false','No'),
+('allow_spellcheck','true','Yes'),
+('allow_spellcheck','false','No'),
+('force_wiki_paste_as_plain_text','true','Yes'),
+('force_wiki_paste_as_plain_text','false','No'),
+('enabled_googlemaps','true','Yes'),
+('enabled_googlemaps','false','No'),
+('enabled_imgmap','true','Yes'),
+('enabled_imgmap','false','No'),
+('enabled_support_svg','true','Yes'),
+('enabled_support_svg','false','No'),
+('pdf_export_watermark_enable','true','Yes'),
+('pdf_export_watermark_enable','false','No'),
+('pdf_export_watermark_by_course','true','Yes'),
+('pdf_export_watermark_by_course','false','No'),
+('enabled_insertHtml','true','Yes'),
+('enabled_insertHtml','false','No'),
+('students_export2pdf','true','Yes'),
+('students_export2pdf','false','No'),
+('show_users_folders','true','Yes'),
+('show_users_folders','false','No'),
+('show_default_folders','true','Yes'),
+('show_default_folders','false','No'),
+('show_chat_folder','true','Yes'),
+('show_chat_folder','false','No'),
+('enabled_text2audio','true','Yes'),
+('enabled_text2audio','false','No'),
+('enabled_support_pixlr','true','Yes'),
+('enabled_support_pixlr','false','No'),
+('show_groups_to_users','true','Yes'),
+('show_groups_to_users','false','No'),
+('accessibility_font_resize', 'true', 'Yes'),
+('accessibility_font_resize', 'false', 'No'),
+('hide_courses_in_sessions','true','Yes'),
+('hide_courses_in_sessions','false','No'),
+('enable_quiz_scenario', 'true', 'Yes'),
+('enable_quiz_scenario', 'false', 'No'),
+('enable_nanogong','true','Yes'),
+('enable_nanogong','false','No'),
+('show_documents_preview', 'true', 'Yes'),
+('show_documents_preview', 'false', 'No'),
+('htmlpurifier_wiki', 'true', 'Yes'),
+('htmlpurifier_wiki', 'false', 'No'),
+('cas_activate', 'true', 'Yes'),
+('cas_activate', 'false', 'No'),
+('cas_protocol', 'CAS1', 'CAS1Text'),
+('cas_protocol', 'CAS2', 'CAS2Text'),
+('cas_protocol', 'SAML', 'SAMLText'),
+('cas_add_user_activate', 'false', 'No'),
+('cas_add_user_activate', 'platform', 'casAddUserActivatePlatform'),
+('cas_add_user_activate', 'extldap', 'casAddUserActivateLDAP'),
+('update_user_info_cas_with_ldap', 'true', 'Yes'),
+('update_user_info_cas_with_ldap', 'false', 'No'),
+('scorm_cumulative_session_time','true','Yes'),
+('scorm_cumulative_session_time','false','No'),
+('allow_hr_skills_management', 'true', 'Yes'),
+('allow_hr_skills_management', 'false', 'No'),
+('enable_help_link', 'true', 'Yes'),
+('enable_help_link', 'false', 'No'),
+('allow_users_to_change_email_with_no_password', 'true', 'Yes'),
+('allow_users_to_change_email_with_no_password', 'false', 'No'),
+('show_admin_toolbar', 'do_not_show', 'DoNotShow'),
+('show_admin_toolbar', 'show_to_admin', 'ShowToAdminsOnly'),
+('show_admin_toolbar', 'show_to_admin_and_teachers', 'ShowToAdminsAndTeachers'),
+('show_admin_toolbar', 'show_to_all', 'ShowToAllUsers'),
+('use_custom_pages','true','Yes'),
+('use_custom_pages','false','No'),
+('languagePriority1','platform_lang','PlatformLanguage'),
+('languagePriority1','user_profil_lang','UserLanguage'),
+('languagePriority1','user_selected_lang','UserSelectedLanguage'),
+('languagePriority1','course_lang','CourseLanguage'),
+('languagePriority2','platform_lang','PlatformLanguage'),
+('languagePriority2','user_profil_lang','UserLanguage'),
+('languagePriority2','user_selected_lang','UserSelectedLanguage'),
+('languagePriority2','course_lang','CourseLanguage'),
+('languagePriority3','platform_lang','PlatformLanguage'),
+('languagePriority3','user_profil_lang','UserLanguage'),
+('languagePriority3','user_selected_lang','UserSelectedLanguage'),
+('languagePriority3','course_lang','CourseLanguage'),
+('languagePriority4','platform_lang','PlatformLanguage'),
+('languagePriority4','user_profil_lang','UserLanguage'),
+('languagePriority4','user_selected_lang','UserSelectedLanguage'),
+('languagePriority4','course_lang','CourseLanguage'),
+('allow_global_chat', 'true', 'Yes'),
+('allow_global_chat', 'false', 'No'),
+('login_is_email','true','Yes'),
+('login_is_email','false','No'),
+('courses_default_creation_visibility', '3', 'OpenToTheWorld'),
+('courses_default_creation_visibility', '2', 'OpenToThePlatform'),
+('courses_default_creation_visibility', '1', 'Private'),
+('courses_default_creation_visibility', '0', 'CourseVisibilityClosed'),
+('allow_browser_sniffer', 'true', 'Yes'),
+('allow_browser_sniffer', 'false', 'No'),
+('enable_wami_record', 'true', 'Yes'),
+('enable_wami_record', 'false', 'No'),
+('teachers_can_change_score_settings', 'true', 'Yes'),
+('teachers_can_change_score_settings', 'false', 'No'),
+('teachers_can_change_grade_model_settings', 'true', 'Yes'),
+('teachers_can_change_grade_model_settings', 'false', 'No'),
+('gradebook_locking_enabled', 'true', 'Yes'),
+('gradebook_locking_enabled', 'false', 'No'),
+('gradebook_enable_grade_model', 'true', 'Yes'),
+('gradebook_enable_grade_model', 'false', 'No'),
+('allow_session_admins_to_manage_all_sessions', 'true', 'Yes'),
+('allow_session_admins_to_manage_all_sessions', 'false', 'No'),
+('allow_skills_tool', 'true', 'Yes'),
+('allow_skills_tool', 'false', 'No'),
+('allow_public_certificates', 'true', 'Yes'),
+('allow_public_certificates', 'false', 'No'),
+('platform_unsubscribe_allowed', 'true', 'Yes'),
+('platform_unsubscribe_allowed', 'false', 'No'),
+('activate_email_template', 'true', 'Yes'),
+('activate_email_template', 'false', 'No'),
+ ('enable_iframe_inclusion', 'true', 'Yes'),
+('enable_iframe_inclusion', 'false', 'No'),
+('show_hot_courses', 'true', 'Yes'),
+('show_hot_courses', 'false', 'No'),
+('enable_webcam_clip', 'true', 'Yes'),
+('enable_webcam_clip', 'false', 'No');
+
+UNLOCK TABLES;
+
+/*!40000 ALTER TABLE settings_options ENABLE KEYS */;
+
+
+--
+-- Table structure for table sys_announcement
+--
+
+DROP TABLE IF EXISTS sys_announcement;
+CREATE TABLE IF NOT EXISTS sys_announcement (
+  id int unsigned NOT NULL auto_increment,
+  date_start datetime NOT NULL default '0000-00-00 00:00:00',
+  date_end datetime NOT NULL default '0000-00-00 00:00:00',
+  visible_teacher tinyint NOT NULL default 0,
+  visible_student tinyint NOT NULL default 0,
+  visible_guest tinyint NOT NULL default 0,
+  title varchar(250) NOT NULL default '',
+  content text NOT NULL,
+  lang varchar(70) NULL default NULL,
+  access_url_id INT NOT NULL default 1,
+  PRIMARY KEY  (id)
+);
+
+--
+-- Table structure for shared_survey
+--
+
+DROP TABLE IF EXISTS shared_survey;
+CREATE TABLE IF NOT EXISTS shared_survey (
+  survey_id int unsigned NOT NULL auto_increment,
+  code varchar(20) default NULL,
+  title text default NULL,
+  subtitle text default NULL,
+  author varchar(250) default NULL,
+  lang varchar(20) default NULL,
+  template varchar(20) default NULL,
+  intro text,
+  surveythanks text,
+  creation_date datetime NOT NULL default '0000-00-00 00:00:00',
+  course_code varchar(40) NOT NULL default '',
+  PRIMARY KEY  (survey_id),
+  UNIQUE KEY id (survey_id)
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for shared_survey_question
+--
+
+DROP TABLE IF EXISTS shared_survey_question;
+CREATE TABLE IF NOT EXISTS shared_survey_question (
+  question_id int NOT NULL auto_increment,
+  survey_id int NOT NULL default '0',
+  survey_question text NOT NULL,
+  survey_question_comment text NOT NULL,
+  type varchar(250) NOT NULL default '',
+  display varchar(10) NOT NULL default '',
+  sort int NOT NULL default '0',
+  code varchar(40) NOT NULL default '',
+  max_value int NOT NULL,
+  PRIMARY KEY  (question_id)
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for shared_survey_question_option
+--
+
+DROP TABLE IF EXISTS shared_survey_question_option;
+CREATE TABLE IF NOT EXISTS shared_survey_question_option (
+  question_option_id int NOT NULL auto_increment,
+  question_id int NOT NULL default '0',
+  survey_id int NOT NULL default '0',
+  option_text text NOT NULL,
+  sort int NOT NULL default '0',
+  PRIMARY KEY  (question_option_id)
+);
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for templates (User's FCKEditor templates)
+--
+
+DROP TABLE IF EXISTS templates;
+CREATE TABLE IF NOT EXISTS templates (
+  id int NOT NULL auto_increment,
+  title varchar(100) NOT NULL,
+  description varchar(250) NOT NULL,
+  course_code varchar(40) NOT NULL,
+  user_id int NOT NULL,
+  ref_doc int NOT NULL,
+  image varchar(250) NOT NULL,
+  PRIMARY KEY  (id)
+);
+
+
+
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure of openid_association (keep info on openid servers)
+--
+
+DROP TABLE IF EXISTS openid_association;
+CREATE TABLE IF NOT EXISTS openid_association (
+  id int NOT NULL auto_increment,
+  idp_endpoint_uri text NOT NULL,
+  session_type varchar(30) NOT NULL,
+  assoc_handle text NOT NULL,
+  assoc_type text NOT NULL,
+  expires_in bigint NOT NULL,
+  mac_key text NOT NULL,
+  created bigint NOT NULL,
+  PRIMARY KEY  (id)
+);
+--
+-- --------------------------------------------------------
+--
+-- Tables for gradebook
+--
+DROP TABLE IF EXISTS gradebook_category;
+CREATE TABLE IF NOT EXISTS gradebook_category (
+    id int NOT NULL auto_increment,
+    name text NOT NULL,
+    description text,
+    user_id int NOT NULL,
+    course_code varchar(40) default NULL,
+    parent_id int default NULL,
+    weight float NOT NULL,
+    visible tinyint NOT NULL,
+    certif_min_score int DEFAULT NULL,
+    session_id int DEFAULT NULL,
+    document_id int unsigned DEFAULT NULL,
+    locked int NOT NULL DEFAULT 0,
+    default_lowest_eval_exclude TINYINT default null,
+  PRIMARY KEY  (id)
+);
+DROP TABLE IF EXISTS gradebook_evaluation;
+CREATE TABLE IF NOT EXISTS gradebook_evaluation (
+    id int unsigned NOT NULL auto_increment,
+    name text NOT NULL,
+    description text,
+    user_id int NOT NULL,
+    course_code varchar(40) default NULL,
+    category_id int default NULL,
+    created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+    weight FLOAT NOT NULL,
+    max float unsigned NOT NULL,
+    visible int NOT NULL,
+    type varchar(40) NOT NULL default 'evaluation',
+    locked int NOT NULL DEFAULT 0,
+    PRIMARY KEY  (id)
+);
+DROP TABLE IF EXISTS gradebook_link;
+CREATE TABLE IF NOT EXISTS gradebook_link (
+  id int NOT NULL auto_increment,
+  type int NOT NULL,
+  ref_id int NOT NULL,
+  user_id int NOT NULL,
+  course_code varchar(40) NOT NULL,
+  category_id int NOT NULL,
+  created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+  weight float NOT NULL,
+  visible int NOT NULL,
+  locked int NOT NULL DEFAULT 0,
+  PRIMARY KEY  (id)
+);
+DROP TABLE IF EXISTS gradebook_result;
+CREATE TABLE IF NOT EXISTS gradebook_result (
+  id int NOT NULL auto_increment,
+  user_id int NOT NULL,
+  evaluation_id int NOT NULL,
+  created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+  score float unsigned default NULL,
+  PRIMARY KEY  (id)
+);
+DROP TABLE IF EXISTS gradebook_score_display;
+CREATE TABLE IF NOT EXISTS gradebook_score_display (
+  id int NOT NULL auto_increment,
+  score float unsigned NOT NULL,
+  display varchar(40) NOT NULL,
+  category_id int NOT NULL default 0,
+  score_color_percent float unsigned NOT NULL default 0,
+  PRIMARY KEY (id)
+);
+ALTER TABLE gradebook_score_display ADD INDEX(category_id);
+
+DROP TABLE IF EXISTS user_field;
+CREATE TABLE IF NOT EXISTS user_field (
+    id	INT NOT NULL auto_increment,
+    field_type int NOT NULL DEFAULT 1,
+    field_variable	varchar(64) NOT NULL,
+    field_display_text	varchar(64),
+    field_default_value text,
+    field_order int,
+    field_visible tinyint default 0,
+    field_changeable tinyint default 0,
+    field_filter tinyint default 0,
+    tms	DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+DROP TABLE IF EXISTS user_field_options;
+CREATE TABLE IF NOT EXISTS user_field_options (
+    id	int NOT NULL auto_increment,
+    field_id int	NOT NULL,
+    option_value	text,
+    option_display_text varchar(64),
+    option_order int,
+    tms	DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY (id)
+);
+DROP TABLE IF EXISTS user_field_values;
+CREATE TABLE IF NOT EXISTS user_field_values(
+    id	bigint	NOT NULL auto_increment,
+    user_id	int	unsigned NOT NULL,
+    field_id int NOT NULL,
+    field_value	text,
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+ALTER TABLE user_field_values ADD INDEX (user_id, field_id);
+
+
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES (1, 'legal_accept','Legal',0,0);
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES (1, 'already_logged_in','Already logged in',0,0);
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES (1, 'update_type','Update script type',0,0);
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES (10, 'tags','tags',0,0);
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES (1, 'rssfeeds','RSS',0,0);
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES (1, 'dashboard', 'Dashboard', 0, 0);
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES (11, 'timezone', 'Timezone', 0, 0);
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable, field_default_value) values (4, 'mail_notify_invitation',   'MailNotifyInvitation',1,1,'1');
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable, field_default_value) values (4, 'mail_notify_message',      'MailNotifyMessage',1,1,'1');
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable, field_default_value) values (4, 'mail_notify_group_message','MailNotifyGroupMessage',1,1,'1');
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES (1, 'user_chat_status','User chat status',0,0);
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES (1, 'google_calendar_url','Google Calendar URL',0,0);
+
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (8, '1', 'AtOnce',1);
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (8, '8', 'Daily',2);
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (8, '0', 'No',3);
+
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (9, '1', 'AtOnce',1);
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (9, '8', 'Daily',2);
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (9, '0', 'No',3);
+
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (10, '1', 'AtOnce',1);
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (10, '8', 'Daily',2);
+INSERT INTO user_field_options (field_id, option_value, option_display_text, option_order) values (10, '0', 'No',3);
+
+
+
+
+DROP TABLE IF EXISTS gradebook_result_log;
+CREATE TABLE IF NOT EXISTS gradebook_result_log (
+    id int NOT NULL auto_increment,
+    id_result int NOT NULL,
+    user_id int NOT NULL,
+    evaluation_id int NOT NULL,
+    created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+    score float unsigned default NULL,
+    PRIMARY KEY(id)
+);
+
+DROP TABLE IF EXISTS gradebook_linkeval_log;
+CREATE TABLE IF NOT EXISTS gradebook_linkeval_log (
+    id int NOT NULL auto_increment,
+    id_linkeval_log int NOT NULL,
+    name text,
+    description text,
+    created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+    weight smallint default NULL,
+    visible tinyint default NULL,
+    type varchar(20) NOT NULL,
+    user_id_log int NOT NULL,
+    PRIMARY KEY  (id)
+);
+
+--
+-- --------------------------------------------------------
+--
+-- Tables for the access URL feature
+--
+
+DROP TABLE IF EXISTS access_url;
+CREATE TABLE IF NOT EXISTS access_url(
+    id	int	unsigned NOT NULL auto_increment,
+    url	varchar(255) NOT NULL,
+    description text,
+    active	int unsigned not null default 0,
+    created_by	int	not null,
+    tms DATETIME NOT NULL default '0000-00-00 00:00:00',
+    PRIMARY KEY (id)
+);
+
+INSERT INTO access_url(url, description, active, created_by) VALUES ('http://localhost/',' ',1,1);
+
+DROP TABLE IF EXISTS access_url_rel_user;
+CREATE TABLE IF NOT EXISTS access_url_rel_user (
+  access_url_id int unsigned NOT NULL,
+  user_id int unsigned NOT NULL,
+  PRIMARY KEY (access_url_id, user_id)
+);
+
+ALTER TABLE access_url_rel_user ADD INDEX idx_access_url_rel_user_user (user_id);
+ALTER TABLE access_url_rel_user ADD INDEX idx_access_url_rel_user_access_url(access_url_id);
+ALTER TABLE access_url_rel_user ADD INDEX idx_access_url_rel_user_access_url_user (user_id,access_url_id);
+
+-- Adding admin to the first portal
+INSERT INTO access_url_rel_user VALUES(1, 1);
+
+DROP TABLE IF EXISTS access_url_rel_course;
+CREATE TABLE IF NOT EXISTS access_url_rel_course (
+  access_url_id int unsigned NOT NULL,
+  course_code char(40) NOT NULL,
+  PRIMARY KEY (access_url_id, course_code)
+);
+
+
+DROP TABLE IF EXISTS access_url_rel_session;
+CREATE TABLE IF NOT EXISTS access_url_rel_session (
+  access_url_id int unsigned NOT NULL,
+  session_id int unsigned NOT NULL,
+  PRIMARY KEY (access_url_id, session_id)
+);
+
+--
+-- Table structure for table sys_calendar
+--
+DROP TABLE IF EXISTS sys_calendar;
+CREATE TABLE IF NOT EXISTS sys_calendar (
+  id int unsigned NOT NULL auto_increment,
+  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',
+  access_url_id INT NOT NULL default 1,
+  all_day INT NOT NULL DEFAULT 0,
+  PRIMARY KEY (id)
+);
+
+DROP TABLE IF EXISTS system_template;
+CREATE TABLE IF NOT EXISTS system_template (
+  id int UNSIGNED NOT NULL auto_increment,
+  title varchar(250) NOT NULL,
+  comment text NOT NULL,
+  image varchar(250) NOT NULL,
+  content text NOT NULL,
+  PRIMARY KEY  (id)
+);
+
+-- Adding the platform templates
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleCourseTitle', 'TemplateTitleCourseTitleDescription', 'coursetitle.gif', '
+<head>
+                {CSS}
+                <style type="text/css">
+                .gris_title         	{
+                    color: silver;
+                }
+                h1
+                {
+                    text-align: right;
+                }
+                </style>
+
+            </head>
+            <body>
+            <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+            <tbody>
+            <tr>
+            <td style="vertical-align: middle; width: 50%;" colspan="1" rowspan="1">
+                <h1>TITULUS 1<br>
+                <span class="gris_title">TITULUS 2</span><br>
+                </h1>
+            </td>
+            <td style="width: 50%;">
+                <img style="width: 100px; height: 100px;" alt="dokeos logo" src="{COURSE_DIR}images/logo_dokeos.png"></td>
+            </tr>
+            </tbody>
+            </table>
+            <p><br>
+            <br>
+            </p>
+            </body>
+');
+
+/*
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleCheckList', 'TemplateTitleCheckListDescription', 'checklist.gif', '
+      <head>
+                   {CSS}
+                </head>
+                <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                <tbody>
+                <tr>
+                <td style="vertical-align: top; width: 66%;">
+                <h3>Lorem ipsum dolor sit amet</h3>
+                <ul>
+                    <li>consectetur adipisicing elit</li>
+                    <li>sed do eiusmod tempor incididunt</li>
+                    <li>ut labore et dolore magna aliqua</li>
+                </ul>
+
+                <h3>Ut enim ad minim veniam</h3>
+                <ul>
+                    <li>quis nostrud exercitation ullamco</li>
+                    <li>laboris nisi ut aliquip ex ea commodo consequat</li>
+                    <li>Excepteur sint occaecat cupidatat non proident</li>
+                </ul>
+
+                <h3>Sed ut perspiciatis unde omnis</h3>
+                <ul>
+                    <li>iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam</li>
+                    <li>eaque ipsa quae ab illo inventore veritatis</li>
+                    <li>et quasi architecto beatae vitae dicta sunt explicabo.&nbsp;</li>
+                </ul>
+
+                </td>
+                <td style="background: transparent url({IMG_DIR}postit.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; width: 33%; text-align: center; vertical-align: bottom;">
+                <h3>Ut enim ad minima</h3>
+                Veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur.<br>
+                <h3>
+                <img style="width: 180px; height: 144px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_smile.png "><br></h3>
+                </td>
+                </tr>
+                </tbody>
+                </table>
+                <p><br>
+                <br>
+                </p>
+                </body>
+');
+*/
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleTeacher', 'TemplateTitleTeacherDescription', 'yourinstructor.gif', '
+<head>
+                   {CSS}
+                   <style type="text/css">
+                    .text
+                    {
+                        font-weight: normal;
+                    }
+                    </style>
+                </head>
+                <body>
+                    <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                    <tbody>
+                    <tr>
+                    <td></td>
+                    <td style="height: 33%;"></td>
+                    <td></td>
+                    </tr>
+                    <tr>
+                    <td style="width: 25%;"></td>
+                    <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right; font-weight: bold;" colspan="1" rowspan="1">
+                    <span class="text">
+                    <br>
+                    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis pellentesque.</span>
+                    </td>
+                    <td style="width: 25%; font-weight: bold;">
+                    <img style="width: 180px; height: 241px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_case.png "></td>
+                    </tr>
+                    </tbody>
+                    </table>
+                    <p><br>
+                    <br>
+                    </p>
+                </body>
+');
+
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleLeftList', 'TemplateTitleListLeftListDescription', 'leftlist.gif', '
+<head>
+               {CSS}
+           </head>
+            <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                <tbody>
+                <tr>
+                <td style="width: 66%;"></td>
+                <td style="vertical-align: bottom; width: 33%;" colspan="1" rowspan="4">&nbsp;<img style="width: 180px; height: 248px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_reads.png "><br>
+                </td>
+                </tr>
+                <tr align="right">
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">Lorem
+                ipsum dolor sit amet.
+                </td>
+                </tr>
+                <tr align="right">
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
+                Vivamus
+                a quam.&nbsp;<br>
+                </td>
+                </tr>
+                <tr align="right">
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
+                Proin
+                a est stibulum ante ipsum.</td>
+                </tr>
+                </tbody>
+                </table>
+            <p><br>
+            <br>
+            </p>
+            </body>
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleLeftRightList', 'TemplateTitleLeftRightListDescription', 'leftrightlist.gif', '
+
+<head>
+               {CSS}
+            </head>
+            <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; height: 400px; width: 720px;" border="0" cellpadding="15" cellspacing="6">
+                <tbody>
+                <tr>
+                <td></td>
+                <td style="vertical-align: top;" colspan="1" rowspan="4">&nbsp;<img style="width: 180px; height: 294px;" alt="Trainer" src="{COURSE_DIR}images/trainer/trainer_join_hands.png "><br>
+                </td>
+                <td></td>
+                </tr>
+                <tr>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right;">Lorem
+                ipsum dolor sit amet.
+                </td>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: left;">
+                Convallis
+                ut.&nbsp;Cras dui magna.</td>
+                </tr>
+                <tr>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right;">
+                Vivamus
+                a quam.&nbsp;<br>
+                </td>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: left;">
+                Etiam
+                lacinia stibulum ante.<br>
+                </td>
+                </tr>
+                <tr>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right;">
+                Proin
+                a est stibulum ante ipsum.</td>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: left;">
+                Consectetuer
+                adipiscing elit. <br>
+                </td>
+                </tr>
+                </tbody>
+                </table>
+            <p><br>
+            <br>
+            </p>
+            </body>
+
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleRightList', 'TemplateTitleRightListDescription', 'rightlist.gif', '
+    <head>
+               {CSS}
+            </head>
+            <body style="direction: ltr;">
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                <tbody>
+                <tr>
+                <td style="vertical-align: bottom; width: 50%;" colspan="1" rowspan="4"><img style="width: 300px; height: 199px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_points_right.png"><br>
+                </td>
+                <td style="width: 50%;"></td>
+                </tr>
+                <tr>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 50%;">
+                Convallis
+                ut.&nbsp;Cras dui magna.</td>
+                </tr>
+                <tr>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 50%;">
+                Etiam
+                lacinia.<br>
+                </td>
+                </tr>
+                <tr>
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 50%;">
+                Consectetuer
+                adipiscing elit. <br>
+                </td>
+                </tr>
+                </tbody>
+                </table>
+            <p><br>
+            <br>
+            </p>
+            </body>
+');
+
+/*
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleComparison', 'TemplateTitleComparisonDescription', 'compare.gif', '
+<head>
+            {CSS}
+            </head>
+
+            <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                <tr>
+                    <td style="height: 10%; width: 33%;"></td>
+                    <td style="vertical-align: top; width: 33%;" colspan="1" rowspan="2">&nbsp;<img style="width: 180px; height: 271px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_standing.png "><br>
+                    </td>
+                    <td style="height: 10%; width: 33%;"></td>
+                </tr>
+            <tr>
+            <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right;">
+            Lorem ipsum dolor sit amet.
+            </td>
+            <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 33%;">
+            Convallis
+            ut.&nbsp;Cras dui magna.</td>
+            </tr>
+            </body>
+');
+*/
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleDiagram', 'TemplateTitleDiagramDescription', 'diagram.gif', '
+    <head>
+                       {CSS}
+                    </head>
+
+                    <body>
+                    <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                    <tbody>
+                    <tr>
+                    <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; height: 33%; width: 33%;">
+                    <br>
+                    Etiam
+                    lacinia stibulum ante.
+                    Convallis
+                    ut.&nbsp;Cras dui magna.</td>
+                    <td colspan="1" rowspan="3">
+                        <img style="width: 350px; height: 267px;" alt="Alaska chart" src="{COURSE_DIR}images/diagrams/alaska_chart.png "></td>
+                    </tr>
+                    <tr>
+                    <td colspan="1" rowspan="1">
+                    <img style="width: 300px; height: 199px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_points_right.png "></td>
+                    </tr>
+                    <tr>
+                    </tr>
+                    </tbody>
+                    </table>
+                    <p><br>
+                    <br>
+                    </p>
+                    </body>
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleDesc', 'TemplateTitleCheckListDescription', 'description.gif', '
+<head>
+                       {CSS}
+                    </head>
+                    <body>
+                        <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                        <tbody>
+                        <tr>
+                        <td style="width: 50%; vertical-align: top;">
+                            <img style="width: 48px; height: 49px; float: left;" alt="01" src="{COURSE_DIR}images/small/01.png " hspace="5"><br>Lorem ipsum dolor sit amet<br><br><br>
+                            <img style="width: 48px; height: 49px; float: left;" alt="02" src="{COURSE_DIR}images/small/02.png " hspace="5">
+                            <br>Ut enim ad minim veniam<br><br><br>
+                            <img style="width: 48px; height: 49px; float: left;" alt="03" src="{COURSE_DIR}images/small/03.png " hspace="5">Duis aute irure dolor in reprehenderit<br><br><br>
+                            <img style="width: 48px; height: 49px; float: left;" alt="04" src="{COURSE_DIR}images/small/04.png " hspace="5">Neque porro quisquam est</td>
+
+                        <td style="vertical-align: top; width: 50%; text-align: right;" colspan="1" rowspan="1">
+                            <img style="width: 300px; height: 291px;" alt="Gearbox" src="{COURSE_DIR}images/diagrams/gearbox.jpg "><br></td>
+                        </tr><tr></tr>
+                        </tbody>
+                        </table>
+                        <p><br>
+                        <br>
+                        </p>
+                    </body>
+');
+
+/*
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleObjectives', 'TemplateTitleObjectivesDescription', 'courseobjectives.gif', '
+<head>
+                   {CSS}
+                </head>
+
+                <body>
+                    <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                    <tbody>
+                    <tr>
+                    <td style="vertical-align: bottom; width: 33%;" colspan="1" rowspan="2">
+                    <img style="width: 180px; height: 271px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_chair.png "><br>
+                    </td>
+                    <td style="height: 10%; width: 66%;"></td>
+                    </tr>
+                    <tr>
+                    <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 66%;">
+                    <h3>Lorem ipsum dolor sit amet</h3>
+                    <ul>
+                    <li>consectetur adipisicing elit</li>
+                    <li>sed do eiusmod tempor incididunt</li>
+                    <li>ut labore et dolore magna aliqua</li>
+                    </ul>
+                    <h3>Ut enim ad minim veniam</h3>
+                    <ul>
+                    <li>quis nostrud exercitation ullamco</li>
+                    <li>laboris nisi ut aliquip ex ea commodo consequat</li>
+                    <li>Excepteur sint occaecat cupidatat non proident</li>
+                    </ul>
+                    </td>
+                    </tr>
+                    </tbody>
+                    </table>
+                <p><br>
+                <br>
+                </p>
+                </body>
+');
+*/
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleCycle', 'TemplateTitleCycleDescription', 'cyclechart.gif', '
+<head>
+                   {CSS}
+                   <style>
+                   .title
+                   {
+                       color: white; font-weight: bold;
+                   }
+                   </style>
+                </head>
+
+
+                <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="8" cellspacing="6">
+                <tbody>
+                <tr>
+                    <td style="text-align: center; vertical-align: bottom; height: 10%;" colspan="3" rowspan="1">
+                        <img style="width: 250px; height: 76px;" alt="arrow" src="{COURSE_DIR}images/diagrams/top_arrow.png ">
+                    </td>
+                </tr>
+                <tr>
+                    <td style="height: 5%; width: 45%; vertical-align: top; background-color: rgb(153, 153, 153); text-align: center;">
+                        <span class="title">Lorem ipsum</span>
+                    </td>
+
+                    <td style="height: 5%; width: 10%;"></td>
+                    <td style="height: 5%; vertical-align: top; background-color: rgb(153, 153, 153); text-align: center;">
+                        <span class="title">Sed ut perspiciatis</span>
+                    </td>
+                </tr>
+                    <tr>
+                        <td style="background-color: rgb(204, 204, 255); width: 45%; vertical-align: top;">
+                            <ul>
+                                <li>dolor sit amet</li>
+                                <li>consectetur adipisicing elit</li>
+                                <li>sed do eiusmod tempor&nbsp;</li>
+                                <li>adipisci velit, sed quia non numquam</li>
+                                <li>eius modi tempora incidunt ut labore et dolore magnam</li>
+                            </ul>
+                </td>
+                <td style="width: 10%;"></td>
+                <td style="background-color: rgb(204, 204, 255); width: 45%; vertical-align: top;">
+                    <ul>
+                    <li>ut enim ad minim veniam</li>
+                    <li>quis nostrud exercitation</li><li>ullamco laboris nisi ut</li>
+                    <li> Quis autem vel eum iure reprehenderit qui in ea</li>
+                    <li>voluptate velit esse quam nihil molestiae consequatur,</li>
+                    </ul>
+                    </td>
+                    </tr>
+                    <tr align="center">
+                    <td style="height: 10%; vertical-align: top;" colspan="3" rowspan="1">
+                    <img style="width: 250px; height: 76px;" alt="arrow" src="{COURSE_DIR}images/diagrams/bottom_arrow.png ">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
+                </td>
+                </tr>
+                </tbody>
+                </table>
+                <p><br>
+                <br>
+                </p>
+                </body>
+');
+
+/*
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleLearnerWonder', 'TemplateTitleLearnerWonderDescription', 'learnerwonder.gif', '
+<head>
+               {CSS}
+            </head>
+
+            <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                <tbody>
+                <tr>
+                <td style="width: 33%;" colspan="1" rowspan="4">
+                    <img style="width: 120px; height: 348px;" alt="learner wonders" src="{COURSE_DIR}images/silhouette.png "><br>
+                </td>
+                <td style="width: 66%;"></td>
+                </tr>
+                <tr align="center">
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
+                Convallis
+                ut.&nbsp;Cras dui magna.</td>
+                </tr>
+                <tr align="center">
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
+                Etiam
+                lacinia stibulum ante.<br>
+                </td>
+                </tr>
+                <tr align="center">
+                <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
+                Consectetuer
+                adipiscing elit. <br>
+                </td>
+                </tr>
+                </tbody>
+                </table>
+            <p><br>
+            <br>
+            </p>
+            </body>
+');
+*/
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleTimeline', 'TemplateTitleTimelineDescription', 'phasetimeline.gif', '
+<head>
+               {CSS}
+                <style>
+                .title
+                {
+                    font-weight: bold; text-align: center;
+                }
+                </style>
+            </head>
+
+            <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="8" cellspacing="5">
+                <tbody>
+                <tr class="title">
+                    <td style="vertical-align: top; height: 3%; background-color: rgb(224, 224, 224);">Lorem ipsum</td>
+                    <td style="height: 3%;"></td>
+                    <td style="vertical-align: top; height: 3%; background-color: rgb(237, 237, 237);">Perspiciatis</td>
+                    <td style="height: 3%;"></td>
+                    <td style="vertical-align: top; height: 3%; background-color: rgb(245, 245, 245);">Nemo enim</td>
+                </tr>
+
+                <tr>
+                    <td style="vertical-align: top; width: 30%; background-color: rgb(224, 224, 224);">
+                        <ul>
+                        <li>dolor sit amet</li>
+                        <li>consectetur</li>
+                        <li>adipisicing elit</li>
+                    </ul>
+                    <br>
+                    </td>
+                    <td>
+                        <img style="width: 32px; height: 32px;" alt="arrow" src="{COURSE_DIR}images/small/arrow.png ">
+                    </td>
+
+                    <td style="vertical-align: top; width: 30%; background-color: rgb(237, 237, 237);">
+                        <ul>
+                            <li>ut labore</li>
+                            <li>et dolore</li>
+                            <li>magni dolores</li>
+                        </ul>
+                    </td>
+                    <td>
+                        <img style="width: 32px; height: 32px;" alt="arrow" src="{COURSE_DIR}images/small/arrow.png ">
+                    </td>
+
+                    <td style="vertical-align: top; background-color: rgb(245, 245, 245); width: 30%;">
+                        <ul>
+                            <li>neque porro</li>
+                            <li>quisquam est</li>
+                            <li>qui dolorem&nbsp;&nbsp;</li>
+                        </ul>
+                        <br><br>
+                    </td>
+                </tr>
+                </tbody>
+                </table>
+            <p><br>
+            <br>
+            </p>
+            </body>
+');
+
+/*
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleStopAndThink', 'TemplateTitleStopAndThinkDescription', 'stopthink.gif', '
+<head>
+               {CSS}
+            </head>
+            <body>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                <tbody>
+                <tr>
+                <td style="vertical-align: bottom; width: 33%;" colspan="1" rowspan="2">
+                    <img style="width: 180px; height: 169px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_staring.png ">
+                <br>
+                </td>
+                <td style="height: 10%; width: 66%;"></td>
+                </tr>
+                <tr>
+                <td style="background: transparent url({IMG_DIR}postit.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; width: 66%; vertical-align: middle; text-align: center;">
+                    <h3>Attentio sectetur adipisicing elit</h3>
+                    <ul>
+                        <li>sed do eiusmod tempor incididunt</li>
+                        <li>ut labore et dolore magna aliqua</li>
+                        <li>quis nostrud exercitation ullamco</li>
+                    </ul><br></td>
+                </tr>
+                </tbody>
+                </table>
+            <p><br>
+            <br>
+            </p>
+            </body>
+');
+*/
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleTable', 'TemplateTitleCheckListDescription', 'table.gif', '
+<head>
+                   {CSS}
+                   <style type="text/css">
+                .title
+                {
+                    font-weight: bold; text-align: center;
+                }
+
+                .items
+                {
+                    text-align: right;
+                }
+
+
+                    </style>
+
+                </head>
+                <body>
+                <br />
+               <h2>A table</h2>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px;" border="1" cellpadding="5" cellspacing="0">
+                <tbody>
+                <tr class="title">
+                    <td>City</td>
+                    <td>2005</td>
+                    <td>2006</td>
+                    <td>2007</td>
+                    <td>2008</td>
+                </tr>
+                <tr class="items">
+                    <td>Lima</td>
+                    <td>10,40</td>
+                    <td>8,95</td>
+                    <td>9,19</td>
+                    <td>9,76</td>
+                </tr>
+                <tr class="items">
+                <td>New York</td>
+                    <td>18,39</td>
+                    <td>17,52</td>
+                    <td>16,57</td>
+                    <td>16,60</td>
+                </tr>
+                <tr class="items">
+                <td>Barcelona</td>
+                    <td>0,10</td>
+                    <td>0,10</td>
+                    <td>0,05</td>
+                    <td>0,05</td>
+                </tr>
+                <tr class="items">
+                <td>Paris</td>
+                    <td>3,38</td>
+                    <td >3,63</td>
+                    <td>3,63</td>
+                    <td>3,54</td>
+                </tr>
+                </tbody>
+                </table>
+                <br>
+                </body>
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleAudio', 'TemplateTitleAudioDescription', 'audiocomment.gif', '
+<head>
+               {CSS}
+            </head>
+                   <body>
+                    <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                    <tbody>
+                    <tr>
+                    <td>
+                    <div align="center">
+                    <span style="text-align: center;">
+                        <embed  type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="300" height="20" bgcolor="#FFFFFF" src="{REL_PATH}main/inc/lib/mediaplayer/player.swf" allowfullscreen="false" allowscriptaccess="always" flashvars="file={COURSE_DIR}audio/ListeningComprehension.mp3&amp;autostart=true"></embed>
+                    </span></div>
+
+                    <br>
+                    </td>
+                    <td colspan="1" rowspan="3"><br>
+                        <img style="width: 300px; height: 341px; float: right;" alt="image" src="{COURSE_DIR}images/diagrams/head_olfactory_nerve.png "><br></td>
+                    </tr>
+                    <tr>
+                    <td colspan="1" rowspan="1">
+                        <img style="width: 180px; height: 271px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_glasses.png"><br></td>
+                    </tr>
+                    <tr>
+                    </tr>
+                    </tbody>
+                    </table>
+                    <p><br>
+                    <br>
+                    </p>
+                    </body>
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleVideo', 'TemplateTitleVideoDescription', 'video.gif', '
+<head>
+                {CSS}
+            </head>
+
+            <body>
+            <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+            <tbody>
+            <tr>
+            <td style="width: 50%; vertical-align: top;">
+
+                 <div style="text-align: center;" id="player810625-parent">
+                    <div style="border-style: none; overflow: hidden; width: 320px; height: 240px; background-color: rgb(220, 220, 220);">
+
+                        <div id="player810625">
+                            <div id="player810625-config" style="overflow: hidden; display: none; visibility: hidden; width: 0px; height: 0px;">url={REL_PATH}main/default_course_document/video/flv/example.flv width=320 height=240 loop=false play=false downloadable=false fullscreen=true displayNavigation=true displayDigits=true align=left dispPlaylist=none playlistThumbs=false</div>
+                        </div>
+
+                        <embed
+                            type="application/x-shockwave-flash"
+                            src="{REL_PATH}main/inc/lib/mediaplayer/player.swf"
+                            width="320"
+                            height="240"
+                            id="single"
+                            name="single"
+                            quality="high"
+                            allowfullscreen="true"
+                            flashvars="width=320&height=240&autostart=false&file={REL_PATH}main/default_course_document/video/flv/example.flv&repeat=false&image=&showdownload=false&link={REL_PATH}main/default_course_document/video/flv/example.flv&showdigits=true&shownavigation=true&logo="
+                        />
+
+                    </div>
+                </div>
+
+            </td>
+            <td style="background: transparent url({IMG_DIR}faded_grey.png) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 50%;">
+            <h3><br>
+            </h3>
+            <h3>Lorem ipsum dolor sit amet</h3>
+                <ul>
+                <li>consectetur adipisicing elit</li>
+                <li>sed do eiusmod tempor incididunt</li>
+                <li>ut labore et dolore magna aliqua</li>
+                </ul>
+            <h3>Ut enim ad minim veniam</h3>
+                <ul>
+                <li>quis nostrud exercitation ullamco</li>
+                <li>laboris nisi ut aliquip ex ea commodo consequat</li>
+                <li>Excepteur sint occaecat cupidatat non proident</li>
+                </ul>
+            </td>
+            </tr>
+            </tbody>
+            </table>
+            <p><br>
+            <br>
+            </p>
+             <style type="text/css">body{}</style><!-- to fix a strange bug appearing with firefox when editing this template -->
+            </body>
+');
+
+INSERT INTO system_template (title, comment, image, content) VALUES
+('TemplateTitleFlash', 'TemplateTitleFlashDescription', 'flash.gif', '
+<head>
+               {CSS}
+            </head>
+            <body>
+            <center>
+                <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 100%; height: 400px;" border="0" cellpadding="15" cellspacing="6">
+                <tbody>
+                    <tr>
+                    <td align="center">
+                    <embed width="700" height="300" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="{COURSE_DIR}flash/SpinEchoSequence.swf" play="true" loop="true" menu="true"></embed></span><br />
+                    </td>
+                    </tr>
+                </tbody>
+                </table>
+                <p><br>
+                <br>
+                </p>
+            </center>
+            </body>
+');
+
+
+--
+-- --------------------------------------------------------
+--
+-- Tables for reservation
+--
+
+
+--
+-- Table structure for table reservation category
+--
+
+DROP TABLE IF EXISTS reservation_category;
+CREATE TABLE IF NOT EXISTS reservation_category (
+   id  int unsigned NOT NULL auto_increment,
+   parent_id  int NOT NULL default 0,
+   name  varchar(128) NOT NULL default '',
+  PRIMARY KEY  ( id )
+);
+
+--
+-- Table structure for table reservation category_rights
+--
+
+DROP TABLE IF EXISTS reservation_category_rights;
+CREATE TABLE IF NOT EXISTS reservation_category_rights  (
+    id  int unsigned NOT NULL auto_increment,
+    category_id  int NOT NULL default 0,
+    class_id  int NOT NULL default 0,
+    m_items  tinyint NOT NULL default 0,
+    PRIMARY KEY  ( id )
+);
+
+--
+-- Table structure for table  item reservation
+--
+DROP TABLE IF EXISTS reservation_item;
+CREATE TABLE IF NOT EXISTS  reservation_item  (
+   id  int unsigned NOT NULL auto_increment,
+   category_id  int unsigned NOT NULL default 0,
+   course_code  varchar(40) NOT NULL default '',
+   name  varchar(128) NOT NULL default '',
+   description  text NOT NULL,
+   blackout  tinyint NOT NULL default 0,
+   creator  int unsigned NOT NULL default 0,
+   always_available TINYINT NOT NULL default 0,
+  PRIMARY KEY  ( id )
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table reservation item_rights
+--
+
+DROP TABLE IF EXISTS reservation_item_rights;
+CREATE TABLE IF NOT EXISTS  reservation_item_rights  (
+   item_id  int unsigned NOT NULL default 0,
+   class_id  int unsigned NOT NULL default 0,
+   edit_right  tinyint unsigned NOT NULL default 0,
+   delete_right  tinyint unsigned NOT NULL default 0,
+   m_reservation  tinyint unsigned NOT NULL default 0,
+   view_right  tinyint NOT NULL default 0,
+  PRIMARY KEY  ( item_id , class_id )
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for main reservation table
+--
+
+DROP TABLE IF EXISTS reservation_main;
+CREATE TABLE IF NOT EXISTS  reservation_main  (
+   id  int unsigned NOT NULL auto_increment,
+   subid  int unsigned NOT NULL default 0,
+   item_id  int unsigned NOT NULL default 0,
+   auto_accept  tinyint unsigned NOT NULL default 0,
+   max_users  int unsigned NOT NULL default 1,
+   start_at  datetime NOT NULL default '0000-00-00 00:00:00',
+   end_at  datetime NOT NULL default '0000-00-00 00:00:00',
+   subscribe_from  datetime NOT NULL default '0000-00-00 00:00:00',
+   subscribe_until  datetime NOT NULL default '0000-00-00 00:00:00',
+   subscribers  int unsigned NOT NULL default 0,
+   notes  text NOT NULL,
+   timepicker  tinyint NOT NULL default 0,
+   timepicker_min  int NOT NULL default 0,
+   timepicker_max  int NOT NULL default 0,
+  PRIMARY KEY  ( id )
+);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for reservation subscription table
+--
+
+DROP TABLE IF EXISTS reservation_subscription;
+CREATE TABLE IF NOT EXISTS  reservation_subscription  (
+   dummy  int unsigned NOT NULL auto_increment,
+   user_id  int unsigned NOT NULL default 0,
+   reservation_id  int unsigned NOT NULL default 0,
+   accepted  tinyint unsigned NOT NULL default 0,
+   start_at  datetime NOT NULL default '0000-00-00 00:00:00',
+   end_at  datetime NOT NULL default '0000-00-00 00:00:00',
+  PRIMARY KEY  ( dummy )
+);
+
+-- ---------------------------------------------------------
+
+--
+-- Table structure for table user_rel_user
+--
+DROP TABLE IF EXISTS user_rel_user;
+CREATE TABLE IF NOT EXISTS user_rel_user (
+  id bigint unsigned not null auto_increment,
+  user_id int unsigned not null,
+  friend_user_id int unsigned not null,
+  relation_type int not null default 0,
+  last_edit DATETIME,
+  PRIMARY KEY(id)
+);
+
+ALTER TABLE user_rel_user ADD INDEX idx_user_rel_user__user (user_id);
+ALTER TABLE user_rel_user ADD INDEX idx_user_rel_user__friend_user(friend_user_id);
+ALTER TABLE user_rel_user ADD INDEX idx_user_rel_user__user_friend_user(user_id,friend_user_id);
+
+--
+-- Table structure for table user_friend_relation_type
+--
+DROP TABLE IF EXISTS user_friend_relation_type;
+CREATE TABLE IF NOT EXISTS user_friend_relation_type(
+  id int unsigned not null auto_increment,
+  title char(20),
+  PRIMARY KEY(id)
+);
+
+
+--
+-- Table structure for MD5 API keys for users
+--
+
+DROP TABLE IF EXISTS user_api_key;
+CREATE TABLE IF NOT EXISTS user_api_key (
+    id int unsigned NOT NULL auto_increment,
+    user_id int unsigned NOT NULL,
+    api_key char(32) NOT NULL,
+    api_service char(10) NOT NULL default 'dokeos',
+    api_end_point text DEFAULT NULL,
+    created_date datetime DEFAULT NULL,
+    validity_start_date datetime DEFAULT NULL,
+    validity_end_date datetime DEFAULT NULL,
+    description text DEFAULT NULL,
+    PRIMARY KEY (id)
+);
+ALTER TABLE user_api_key ADD INDEX idx_user_api_keys_user (user_id);
+
+--
+-- Table structure for table message
+--
+DROP TABLE IF EXISTS message;
+CREATE TABLE IF NOT EXISTS message(
+    id bigint unsigned not null auto_increment,
+    user_sender_id int unsigned not null,
+    user_receiver_id int unsigned not null,
+    msg_status tinyint unsigned not null default 0, -- 0 read, 1 unread, 3 deleted, 5 pending invitation, 6 accepted invitation, 7 invitation denied
+    send_date datetime not null default '0000-00-00 00:00:00',
+    title varchar(255) not null,
+    content text not null,
+    group_id int unsigned not null default 0,
+    parent_id int unsigned not null default 0,
+    update_date datetime not null default '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+ALTER TABLE message ADD INDEX idx_message_user_sender(user_sender_id);
+ALTER TABLE message ADD INDEX idx_message_user_receiver(user_receiver_id);
+ALTER TABLE message ADD INDEX idx_message_user_sender_user_receiver(user_sender_id,user_receiver_id);
+ALTER TABLE message ADD INDEX idx_message_group(group_id);
+ALTER TABLE message ADD INDEX idx_message_parent(parent_id);
+
+INSERT INTO user_friend_relation_type (id,title)
+VALUES
+(1,'SocialUnknow'),
+(2,'SocialParent'),
+(3,'SocialFriend'),
+(4,'SocialGoodFriend'),
+(5,'SocialEnemy'),
+(6,'SocialDeleted');
+
+--
+-- Table structure for table legal (Terms & Conditions)
+--
+
+DROP TABLE IF EXISTS legal;
+CREATE TABLE IF NOT EXISTS legal (
+  legal_id int NOT NULL auto_increment,
+  language_id int NOT NULL,
+  date int NOT NULL default 0,
+  content text,
+  type int NOT NULL,
+  changes text NOT NULL,
+  version int,
+  PRIMARY KEY (legal_id,language_id)
+);
+
+--
+-- Table structure for certificate with gradebook
+--
+
+DROP TABLE IF EXISTS gradebook_certificate;
+CREATE TABLE IF NOT EXISTS gradebook_certificate (
+    id bigint unsigned not null auto_increment,
+    cat_id int unsigned not null,
+    user_id int unsigned not null,
+    score_certificate float unsigned not null default 0,
+    created_at DATETIME NOT NULL default '0000-00-00 00:00:00',
+    path_certificate text null,
+    PRIMARY KEY(id)
+);
+ALTER TABLE gradebook_certificate ADD INDEX idx_gradebook_certificate_category_id(cat_id);
+ALTER TABLE gradebook_certificate ADD INDEX idx_gradebook_certificate_user_id(user_id);
+ALTER TABLE gradebook_certificate ADD INDEX idx_gradebook_certificate_category_id_user_id(cat_id,user_id);
+
+
+
+--
+-- Tables structure for search tool
+--
+
+-- specific fields tables
+DROP TABLE IF EXISTS specific_field;
+CREATE TABLE IF NOT EXISTS specific_field (
+    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+    code char(1) NOT NULL,
+    name VARCHAR(200) NOT NULL
+);
+
+DROP TABLE IF EXISTS specific_field_values;
+CREATE TABLE IF NOT EXISTS specific_field_values (
+    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+    course_code VARCHAR(40) NOT NULL ,
+    tool_id VARCHAR(100) NOT NULL ,
+    ref_id INT NOT NULL ,
+    field_id INT NOT NULL ,
+    value VARCHAR(200) NOT NULL
+);
+ALTER TABLE specific_field ADD CONSTRAINT unique_specific_field__code UNIQUE (code);
+
+-- search engine references to map dokeos resources
+
+DROP TABLE IF EXISTS search_engine_ref;
+CREATE TABLE IF NOT EXISTS search_engine_ref (
+    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+    course_code VARCHAR( 40 ) NOT NULL,
+    tool_id VARCHAR( 100 ) NOT NULL,
+    ref_id_high_level INT NOT NULL,
+    ref_id_second_level INT NULL,
+    search_did INT NOT NULL
+);
+
+--
+-- Table structure for table sessions categories
+--
+
+DROP TABLE IF EXISTS session_category;
+CREATE TABLE IF NOT EXISTS session_category (
+    id int NOT NULL auto_increment,
+    name varchar(100) default NULL,
+    date_start date default NULL,
+    date_end date default NULL,
+	access_url_id INT NOT NULL default 1,
+  PRIMARY KEY  (id)
+);
+
+
+--
+-- Table structure for table user tag
+--
+
+DROP TABLE IF EXISTS tag;
+CREATE TABLE IF NOT EXISTS tag (
+    id int NOT NULL auto_increment,
+    tag char(255) NOT NULL,
+    field_id int NOT NULL,
+    count int NOT NULL,
+    PRIMARY KEY  (id)
+);
+
+DROP TABLE IF EXISTS user_rel_tag;
+CREATE TABLE IF NOT EXISTS user_rel_tag (
+    id int NOT NULL auto_increment,
+    user_id int NOT NULL,
+    tag_id int NOT NULL,
+    PRIMARY KEY  (id)
+);
+
+--
+-- Table structure for user platform groups
+--
+
+DROP TABLE IF EXISTS groups;
+CREATE TABLE IF NOT EXISTS groups (
+    id int NOT NULL AUTO_INCREMENT,
+    name varchar(255) NOT NULL,
+    description varchar(255) NOT NULL,
+    picture_uri varchar(255) NOT NULL,
+    url varchar(255) NOT NULL,
+    visibility int NOT NULL,
+    updated_on varchar(255) NOT NULL,
+    created_on varchar(255) NOT NULL,
+    PRIMARY KEY (id)
+);
+
+DROP TABLE IF EXISTS group_rel_tag;
+CREATE TABLE IF NOT EXISTS group_rel_tag (
+    id int NOT NULL AUTO_INCREMENT,
+    tag_id int NOT NULL,
+    group_id int NOT NULL,
+    PRIMARY KEY (id)
+);
+
+ALTER TABLE group_rel_tag ADD INDEX ( group_id );
+ALTER TABLE group_rel_tag ADD INDEX ( tag_id );
+
+DROP TABLE IF EXISTS group_rel_user;
+CREATE TABLE IF NOT EXISTS group_rel_user (
+    id int NOT NULL AUTO_INCREMENT,
+    group_id int NOT NULL,
+    user_id int NOT NULL,
+    relation_type int NOT NULL,
+    PRIMARY KEY (id)
+);
+ALTER TABLE group_rel_user ADD INDEX ( group_id );
+ALTER TABLE group_rel_user ADD INDEX ( user_id );
+ALTER TABLE group_rel_user ADD INDEX ( relation_type );
+
+DROP TABLE IF EXISTS group_rel_group;
+CREATE TABLE IF NOT EXISTS group_rel_group (
+	id int NOT NULL AUTO_INCREMENT,
+	group_id int NOT NULL,
+	subgroup_id int NOT NULL,
+	relation_type int NOT NULL,
+	PRIMARY KEY (id)
+);
+
+ALTER TABLE group_rel_group ADD INDEX ( group_id );
+ALTER TABLE group_rel_group ADD INDEX ( subgroup_id );
+ALTER TABLE group_rel_group ADD INDEX ( relation_type );
+
+DROP TABLE IF EXISTS announcement_rel_group;
+CREATE TABLE IF NOT EXISTS announcement_rel_group (
+  group_id int NOT NULL,
+  announcement_id int NOT NULL,
+  PRIMARY KEY (group_id, announcement_id)
+);
+--
+-- Table structure for table message attachment
+--
+
+DROP TABLE IF EXISTS message_attachment;
+CREATE TABLE IF NOT EXISTS message_attachment (
+    id int NOT NULL AUTO_INCREMENT,
+    path varchar(255) NOT NULL,
+    comment text,
+    size int NOT NULL default 0,
+    message_id int NOT NULL,
+    filename varchar(255) NOT NULL,
+    PRIMARY KEY  (id)
+);
+
+
+
+INSERT INTO course_field (field_type, field_variable, field_display_text, field_default_value, field_visible, field_changeable) values (10, 'special_course','Special course', 'Yes', 1 , 1);
+
+--
+-- Table structure for table block
+--
+
+DROP TABLE IF EXISTS block;
+CREATE TABLE IF NOT EXISTS block (
+    id INT NOT NULL AUTO_INCREMENT,
+    name VARCHAR(255) NULL,
+    description TEXT NULL,
+    path VARCHAR(255) NOT NULL,
+    controller VARCHAR(100) NOT NULL,
+    active TINYINT NOT NULL DEFAULT 1,
+    PRIMARY KEY(id)
+);
+ALTER TABLE block ADD UNIQUE(path);
+
+--
+-- Structure for table 'course_request' ("Course validation" feature)
+--
+
+DROP TABLE IF EXISTS course_request;
+CREATE TABLE IF NOT EXISTS course_request (
+  id int NOT NULL AUTO_INCREMENT,
+  code varchar(40) NOT NULL,
+  user_id int unsigned NOT NULL default '0',
+  directory varchar(40) DEFAULT NULL,
+  db_name varchar(40) DEFAULT NULL,
+  course_language varchar(20) DEFAULT NULL,
+  title varchar(250) DEFAULT NULL,
+  description text,
+  category_code varchar(40) DEFAULT NULL,
+  tutor_name varchar(200) DEFAULT NULL,
+  visual_code varchar(40) DEFAULT NULL,
+  request_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  objetives text,
+  target_audience text,
+  status int unsigned NOT NULL default '0',
+  info int unsigned NOT NULL default '0',
+  exemplary_content int unsigned NOT NULL default '0',
+  PRIMARY KEY (id),
+  UNIQUE KEY code (code)
+);
+
+--
+-- Structure for Careers, Promotions and Usergroups
+--
+
+DROP TABLE IF EXISTS career;
+CREATE TABLE IF NOT EXISTS career (
+    id INT NOT NULL AUTO_INCREMENT,
+    name VARCHAR(255) NOT NULL ,
+    description TEXT NOT NULL,
+    status INT NOT NULL default '0',
+    created_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+    updated_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+    PRIMARY KEY (id)
+);
+
+DROP TABLE IF EXISTS promotion;
+CREATE TABLE IF NOT EXISTS promotion (
+    id INT NOT NULL AUTO_INCREMENT,
+    name VARCHAR(255) NOT NULL ,
+    description TEXT NOT NULL,
+    career_id INT NOT NULL,
+    status INT NOT NULL default '0',
+    created_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+    updated_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+    PRIMARY KEY(id)
+);
+
+DROP TABLE IF EXISTS usergroup;
+CREATE TABLE IF NOT EXISTS usergroup (
+    id INT NOT NULL AUTO_INCREMENT,
+    name VARCHAR(255) NOT NULL,
+    description TEXT NOT NULL,
+    PRIMARY KEY (id)
+);
+
+DROP TABLE IF EXISTS usergroup_rel_user;
+CREATE TABLE IF NOT EXISTS usergroup_rel_user    (
+    id 			INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
+    usergroup_id INT NOT NULL,
+    user_id 	INT NOT NULL
+);
+
+DROP TABLE IF EXISTS usergroup_rel_course;
+CREATE TABLE IF NOT EXISTS usergroup_rel_course  (
+    id 			INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
+    usergroup_id INT NOT NULL,
+    course_id 	INT NOT NULL
+);
+
+DROP TABLE IF EXISTS usergroup_rel_session;
+CREATE TABLE IF NOT EXISTS usergroup_rel_session (
+    id 			INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
+    usergroup_id INT NOT NULL,
+    session_id  INT NOT NULL
+);
+
+
+--
+-- Structure for Mail notifications
+--
+
+DROP TABLE IF EXISTS notification;
+CREATE TABLE IF NOT EXISTS notification (
+	id 			BIGINT PRIMARY KEY NOT NULL AUTO_INCREMENT,
+	dest_user_id INT NOT NULL,
+ 	dest_mail 	CHAR(255),
+ 	title 		CHAR(255),
+ 	content 	CHAR(255),
+ 	send_freq 	SMALLINT DEFAULT 1,
+ 	created_at 	DATETIME NOT NULL,
+ 	sent_at 	DATETIME NULL
+);
+
+ALTER TABLE notification ADD index mail_notify_sent_index (sent_at);
+ALTER TABLE notification ADD index mail_notify_freq_index (sent_at, send_freq, created_at);
+
+-- Skills management
+
+DROP TABLE IF EXISTS skill;
+CREATE TABLE IF NOT EXISTS skill (
+  id int NOT NULL AUTO_INCREMENT,
+  name varchar(255) NOT NULL,
+  short_code varchar(100) NOT NULL,
+  description TEXT NOT NULL,
+  access_url_id int NOT NULL,
+  icon varchar(255) NOT NULL,
+  PRIMARY KEY (id)
+);
+
+INSERT INTO skill (name) VALUES ('Root');
+
+DROP TABLE IF EXISTS skill_rel_gradebook;
+CREATE TABLE IF NOT EXISTS skill_rel_gradebook (
+  id int NOT NULL AUTO_INCREMENT,
+  gradebook_id int NOT NULL,
+  skill_id int NOT NULL,
+  type varchar(10) NOT NULL,
+  PRIMARY KEY (id)
+);
+
+DROP TABLE IF EXISTS skill_rel_skill;
+CREATE TABLE IF NOT EXISTS skill_rel_skill (
+  id int NOT NULL AUTO_INCREMENT,
+  skill_id int NOT NULL,
+  parent_id int NOT NULL,
+  relation_type int NOT NULL,
+  level int NOT NULL,
+  PRIMARY KEY (id)
+);
+
+INSERT INTO skill_rel_skill VALUES(1, 1, 0, 0, 0);
+
+DROP TABLE IF EXISTS skill_rel_user;
+CREATE TABLE IF NOT EXISTS skill_rel_user (
+  id int NOT NULL AUTO_INCREMENT,
+  user_id int NOT NULL,
+  skill_id int NOT NULL,
+  acquired_skill_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  assigned_by int NOT NULL,
+  PRIMARY KEY (id)
+);
+
+DROP TABLE IF EXISTS skill_profile;
+CREATE TABLE IF NOT EXISTS skill_profile (
+  id INTEGER  NOT NULL AUTO_INCREMENT,
+  name VARCHAR(255)  NOT NULL,
+  description TEXT  NOT NULL,
+  PRIMARY KEY (id)
+);
+
+DROP TABLE IF EXISTS skill_rel_profile;
+CREATE TABLE IF NOT EXISTS skill_rel_profile (
+  id INTEGER  NOT NULL AUTO_INCREMENT,
+  skill_id INTEGER  NOT NULL,
+  profile_id INTEGER  NOT NULL,
+  PRIMARY KEY (id)
+);
+
+--
+-- Table structure for event email sending
+--
+DROP TABLE IF EXISTS event_email_template;
+CREATE TABLE event_email_template (
+  id int NOT NULL AUTO_INCREMENT,
+  message text,
+  subject varchar(255) DEFAULT NULL,
+  event_type_name varchar(255) DEFAULT NULL,
+  activated tinyint NOT NULL DEFAULT '0',
+  language_id int DEFAULT NULL,
+  PRIMARY KEY (id)
+);
+ALTER TABLE event_email_template ADD INDEX event_name_index (event_type_name);
+
+DROP TABLE IF EXISTS event_sent;
+CREATE TABLE event_sent (
+  id int NOT NULL AUTO_INCREMENT,
+  user_from int NOT NULL,
+  user_to int DEFAULT NULL,
+  event_type_name varchar(100) DEFAULT NULL,
+  PRIMARY KEY (id)
+);
+ALTER TABLE event_sent ADD INDEX event_name_index (event_type_name);
+
+DROP TABLE IF EXISTS user_rel_event_type;
+CREATE TABLE user_rel_event_type (
+  id int NOT NULL AUTO_INCREMENT,
+  user_id int NOT NULL,
+  event_type_name varchar(255) NOT NULL,
+  PRIMARY KEY (id)
+);
+ALTER TABLE user_rel_event_type ADD INDEX event_name_index (event_type_name);
+
+-- Course ranking
+
+DROP TABLE IF EXISTS track_course_ranking;
+CREATE TABLE IF NOT EXISTS track_course_ranking (
+    id   int unsigned not null PRIMARY KEY AUTO_INCREMENT,
+    c_id  int unsigned not null,
+    session_id  int unsigned not null default 0,
+    url_id  int unsigned not null default 0,
+    accesses int unsigned not null default 0,
+    total_score int unsigned not null default 0,
+    users int unsigned not null default 0,
+    creation_date datetime not null
+);
+
+ALTER TABLE track_course_ranking ADD INDEX idx_tcc_cid (c_id);
+ALTER TABLE track_course_ranking ADD INDEX idx_tcc_sid (session_id);
+ALTER TABLE track_course_ranking ADD INDEX idx_tcc_urlid (url_id);
+ALTER TABLE track_course_ranking ADD INDEX idx_tcc_creation_date (creation_date);
+
+DROP TABLE IF EXISTS user_rel_course_vote;
+CREATE TABLE IF NOT EXISTS user_rel_course_vote (
+    id int unsigned not null AUTO_INCREMENT PRIMARY KEY,
+    c_id int unsigned not null,
+    user_id int unsigned not null,
+    session_id int unsigned not null default 0,
+    url_id int unsigned not null default 0,
+    vote int unsigned not null default 0
+);
+
+ALTER TABLE user_rel_course_vote ADD INDEX idx_ucv_cid (c_id);
+ALTER TABLE user_rel_course_vote ADD INDEX idx_ucv_uid (user_id);
+ALTER TABLE user_rel_course_vote ADD INDEX idx_ucv_cuid (user_id, c_id);
+
+-- Global chat
+DROP TABLE IF EXISTS chat;
+CREATE TABLE IF NOT EXISTS chat (
+	id			INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
+	from_user	INTEGER,
+	to_user		INTEGER,
+	message		TEXT NOT NULL,
+	sent		DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+	recd		INTEGER UNSIGNED NOT NULL DEFAULT 0,
+	PRIMARY KEY (id)
+);
+
+ALTER TABLE chat ADD INDEX idx_chat_to_user (to_user);
+ALTER TABLE chat ADD INDEX idx_chat_from_user (from_user);
+
+-- Grade Model
+DROP TABLE IF EXISTS grade_model;
+CREATE TABLE grade_model (
+    id INTEGER NOT NULL AUTO_INCREMENT,
+    name VARCHAR(255) NOT NULL,
+    description TEXT,
+    default_lowest_eval_exclude TINYINT default null,
+    default_external_eval TINYINT default null,
+    default_external_eval_prefix VARCHAR(140) default null,
+    PRIMARY KEY (id)
+);
+
+DROP TABLE IF EXISTS grade_components;
+CREATE TABLE grade_components (
+    id INTEGER NOT NULL AUTO_INCREMENT,
+    percentage VARCHAR(255)  NOT NULL,
+    title VARCHAR(255)  NOT NULL,
+    acronym VARCHAR(255)  NOT NULL,
+    grade_model_id INTEGER NOT NULL,
+    PRIMARY KEY (id)
+);
+
+ALTER TABLE gradebook_category ADD COLUMN grade_model_id INT DEFAULT 0;
+
+DROP TABLE IF EXISTS course_type;
+CREATE TABLE course_type (
+    id int unsigned not null auto_increment primary key,
+    name varchar(50) not null,
+    translation_var char(40) default 'UndefinedCourseTypeLabel',
+    description TEXT default '',
+    props text default ''
+);
+
+INSERT INTO course_type (id, name) VALUES (1, 'All tools');
+INSERT INTO course_type (id, name) VALUES (2, 'Entry exam');
+
+ALTER TABLE course add course_type_id int unsigned default 1;
+
+DROP TABLE IF EXISTS usergroup_rel_question;
+CREATE TABLE usergroup_rel_question (
+    id int unsigned not null auto_increment primary key,
+    c_id int unsigned not null,
+    question_id int unsigned not null,
+    usergroup_id int unsigned not null,
+    coefficient float(6,2)
+);

+ 329 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.9.0/db_stats.sql

@@ -0,0 +1,329 @@
+-- MySQL dump
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+DROP TABLE IF EXISTS track_c_browsers;
+CREATE TABLE track_c_browsers (
+  id int NOT NULL auto_increment,
+  browser varchar(255) NOT NULL default '',
+  counter int NOT NULL default 0,
+  PRIMARY KEY  (id)
+);
+
+DROP TABLE IF EXISTS track_c_countries;
+CREATE TABLE track_c_countries (
+  id int NOT NULL auto_increment,
+  code varchar(40) NOT NULL default '',
+  country varchar(50) NOT NULL default '',
+  counter int NOT NULL default 0,
+  PRIMARY KEY  (id)
+);
+
+DROP TABLE IF EXISTS track_c_os;
+CREATE TABLE track_c_os (
+  id int NOT NULL auto_increment,
+  os varchar(255) NOT NULL default '',
+  counter int NOT NULL default 0,
+  PRIMARY KEY  (id)
+);
+
+DROP TABLE IF EXISTS track_c_providers;
+CREATE TABLE track_c_providers (
+  id int NOT NULL auto_increment,
+  provider varchar(255) NOT NULL default '',
+  counter int NOT NULL default 0,
+  PRIMARY KEY  (id)
+);
+
+DROP TABLE IF EXISTS track_c_referers;
+CREATE TABLE track_c_referers (
+  id int NOT NULL auto_increment,
+  referer varchar(255) NOT NULL default '',
+  counter int NOT NULL default 0,
+  PRIMARY KEY  (id)
+);
+
+DROP TABLE IF EXISTS track_e_access;
+CREATE TABLE track_e_access (
+  access_id int NOT NULL auto_increment,
+  access_user_id int unsigned default NULL,
+  access_date datetime NOT NULL default '0000-00-00 00:00:00',
+  access_cours_code varchar(40) NOT NULL default '',
+  access_tool varchar(30) default NULL,
+  access_session_id int NOT NULL default 0,
+  PRIMARY KEY  (access_id),
+  KEY access_user_id (access_user_id),
+  KEY access_cours_code (access_cours_code)
+);
+
+DROP TABLE IF EXISTS track_e_lastaccess;
+CREATE TABLE track_e_lastaccess (
+  access_id bigint NOT NULL auto_increment,
+  access_user_id int unsigned default NULL,
+  access_date datetime NOT NULL default '0000-00-00 00:00:00',
+  access_cours_code varchar(40) NOT NULL,
+  access_tool varchar(30) default NULL,
+  access_session_id int unsigned default NULL,
+  PRIMARY KEY  (access_id),
+  KEY access_user_id (access_user_id),
+  KEY access_cours_code (access_cours_code),
+  KEY access_session_id (access_session_id)
+);
+
+DROP TABLE IF EXISTS track_e_default;
+CREATE TABLE track_e_default (
+  default_id int NOT NULL auto_increment,
+  default_user_id int unsigned NOT NULL default 0,
+  default_cours_code varchar(40) NOT NULL default '',
+  default_date datetime NOT NULL default '0000-00-00 00:00:00',
+  default_event_type varchar(20) NOT NULL default '',
+  default_value_type varchar(20) NOT NULL default '',
+  default_value text NOT NULL,
+  c_id int unsigned default NULL,
+  PRIMARY KEY  (default_id)
+);
+
+DROP TABLE IF EXISTS track_e_downloads;
+CREATE TABLE track_e_downloads (
+  down_id int NOT NULL auto_increment,
+  down_user_id int unsigned default NULL,
+  down_date datetime NOT NULL default '0000-00-00 00:00:00',
+  down_cours_id varchar(40) NOT NULL default '',
+  down_doc_path varchar(255) NOT NULL default '',
+  down_session_id INT NOT NULL DEFAULT 0,
+  PRIMARY KEY  (down_id),
+  KEY down_user_id (down_user_id),
+  KEY down_cours_id (down_cours_id)
+);
+
+DROP TABLE IF EXISTS track_e_exercices;
+CREATE TABLE track_e_exercices (
+  exe_id int NOT NULL auto_increment,
+  exe_user_id int unsigned default NULL,
+  exe_date datetime NOT NULL default '0000-00-00 00:00:00',
+  exe_cours_id varchar(40) NOT NULL default '',
+  exe_exo_id mediumint unsigned NOT NULL default 0,
+  exe_result float(6,2) NOT NULL default 0,
+  exe_weighting float(6,2) NOT NULL default 0,
+  PRIMARY KEY  (exe_id),
+  KEY exe_user_id (exe_user_id),
+  KEY exe_cours_id (exe_cours_id)
+);
+
+ALTER TABLE track_e_exercices ADD status varchar(20) NOT NULL default '';
+ALTER TABLE track_e_exercices ADD data_tracking text NOT NULL default '';
+ALTER TABLE track_e_exercices ADD start_date datetime NOT NULL default '0000-00-00 00:00:00';
+ALTER TABLE track_e_exercices ADD steps_counter SMALLINT UNSIGNED NOT NULL default 0;
+ALTER TABLE track_e_exercices ADD session_id SMALLINT UNSIGNED NOT NULL default 0;
+ALTER TABLE track_e_exercices ADD INDEX ( session_id ) ;
+ALTER TABLE track_e_exercices ADD orig_lp_id int  NOT NULL default 0;
+ALTER TABLE track_e_exercices ADD orig_lp_item_id int  NOT NULL default 0;
+ALTER TABLE track_e_exercices ADD exe_duration int UNSIGNED NOT NULL default 0;
+ALTER TABLE track_e_exercices ADD COLUMN expired_time_control datetime NOT NULL DEFAULT '0000-00-00 00:00:00';
+ALTER TABLE track_e_exercices ADD COLUMN orig_lp_item_view_id INT NOT NULL DEFAULT 0;
+ALTER TABLE track_e_exercices ADD COLUMN questions_to_check TEXT  NOT NULL DEFAULT '';
+
+DROP TABLE IF EXISTS track_e_attempt;
+CREATE TABLE track_e_attempt (
+    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+    exe_id int default NULL,
+    user_id int NOT NULL default 0,
+    question_id int NOT NULL default 0,
+    answer text NOT NULL,
+    teacher_comment text NOT NULL,
+    marks float(6,2) NOT NULL default 0,
+    course_code varchar(40) NOT NULL default '',
+    position int default 0,
+    tms datetime NOT NULL default '0000-00-00 00:00:00',
+    session_id INT NOT NULL DEFAULT 0,
+    filename VARCHAR(255) DEFAULT NULL
+);
+ALTER TABLE track_e_attempt ADD INDEX (exe_id);
+ALTER TABLE track_e_attempt ADD INDEX (user_id); 
+ALTER TABLE track_e_attempt ADD INDEX (question_id);
+ALTER TABLE track_e_attempt ADD INDEX (session_id);
+
+DROP TABLE IF EXISTS track_e_attempt_recording;
+CREATE TABLE track_e_attempt_recording (
+    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+    exe_id int unsigned NOT NULL, 
+    question_id int unsigned NOT NULL,  
+    marks int NOT NULL,  
+    insert_date datetime NOT NULL default '0000-00-00 00:00:00',  
+    author int unsigned NOT NULL,  
+    teacher_comment text NOT NULL,
+    session_id INT NOT NULL DEFAULT 0
+);
+ALTER TABLE track_e_attempt_recording ADD INDEX (exe_id);
+ALTER TABLE track_e_attempt_recording ADD INDEX (question_id);
+ALTER TABLE track_e_attempt_recording ADD INDEX (session_id);
+
+DROP TABLE IF EXISTS track_e_hotpotatoes;
+CREATE TABLE track_e_hotpotatoes (
+    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+    exe_name VARCHAR( 255 ) NOT NULL ,
+    exe_user_id int unsigned DEFAULT NULL ,
+    exe_date DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL ,
+    exe_cours_id varchar(40) NOT NULL ,
+    exe_result smallint default 0 NOT NULL ,
+    exe_weighting smallint default 0 NOT NULL,
+    KEY exe_user_id (exe_user_id),
+    KEY exe_cours_id (exe_cours_id)
+);
+
+DROP TABLE IF EXISTS track_e_links;
+CREATE TABLE track_e_links (
+  links_id int NOT NULL auto_increment,
+  links_user_id int unsigned default NULL,
+  links_date datetime NOT NULL default '0000-00-00 00:00:00',
+  links_cours_id varchar(40) NOT NULL default '' ,
+  links_link_id int NOT NULL default 0,
+  links_session_id INT NOT NULL DEFAULT 0,
+  PRIMARY KEY  (links_id),
+  KEY links_cours_id (links_cours_id),
+  KEY links_user_id (links_user_id)
+);
+
+DROP TABLE IF EXISTS track_e_login;
+CREATE TABLE track_e_login (
+  login_id int NOT NULL auto_increment,
+  login_user_id int unsigned NOT NULL default 0,
+  login_date datetime NOT NULL default '0000-00-00 00:00:00',
+  login_ip varchar(39) NOT NULL default '',
+  logout_date datetime NULL default NULL,
+  PRIMARY KEY  (login_id),
+  KEY login_user_id (login_user_id)
+);
+
+DROP TABLE IF EXISTS track_e_online;
+CREATE TABLE track_e_online (
+  login_id int NOT NULL auto_increment,
+  login_user_id int unsigned NOT NULL default 0,
+  login_date datetime NOT NULL default '0000-00-00 00:00:00',
+  login_ip varchar(39) NOT NULL default '',
+  course varchar(40) default NULL,
+  session_id INT NOT NULL DEFAULT 0,
+  access_url_id INT NOT NULL DEFAULT 1,
+  PRIMARY KEY  (login_id),
+  KEY login_user_id (login_user_id)
+);
+DROP TABLE IF EXISTS track_e_open;
+CREATE TABLE track_e_open (
+  open_id int NOT NULL auto_increment,
+  open_remote_host tinytext NOT NULL,
+  open_agent tinytext NOT NULL,
+  open_referer tinytext NOT NULL,
+  open_date datetime NOT NULL default '0000-00-00 00:00:00',
+  PRIMARY KEY  (open_id)
+);
+
+DROP TABLE IF EXISTS track_e_uploads;
+CREATE TABLE track_e_uploads (
+  upload_id int NOT NULL auto_increment,
+  upload_user_id int unsigned default NULL,
+  upload_date datetime NOT NULL default '0000-00-00 00:00:00',
+  upload_cours_id varchar(40) NOT NULL default '',
+  upload_work_id int NOT NULL default 0,
+  upload_session_id INT NOT NULL DEFAULT 0,
+  PRIMARY KEY  (upload_id),
+  KEY upload_user_id (upload_user_id),
+  KEY upload_cours_id (upload_cours_id)
+);
+
+DROP TABLE IF EXISTS track_e_course_access;
+CREATE TABLE track_e_course_access (
+  course_access_id int NOT NULL auto_increment,
+  course_code varchar(40) NOT NULL,
+  user_id int NOT NULL,
+  login_course_date datetime NOT NULL default '0000-00-00 00:00:00',
+  logout_course_date datetime default NULL,
+  counter int NOT NULL,
+  session_id int NOT NULL default 0,
+  PRIMARY KEY  (course_access_id)
+);
+
+DROP TABLE IF EXISTS track_e_hotspot;
+CREATE TABLE track_e_hotspot (
+  hotspot_id int NOT NULL auto_increment,
+  hotspot_user_id int NOT NULL,
+  hotspot_course_code varchar(50) NOT NULL,
+  hotspot_exe_id int NOT NULL,
+  hotspot_question_id int NOT NULL,
+  hotspot_answer_id int NOT NULL,
+  hotspot_correct tinyint(3) unsigned NOT NULL,
+  hotspot_coordinate text NOT NULL,
+  PRIMARY KEY  (hotspot_id),
+  KEY hotspot_course_code (hotspot_course_code),
+  KEY hotspot_user_id (hotspot_user_id),
+  KEY hotspot_exe_id (hotspot_exe_id),
+  KEY hotspot_question_id (hotspot_question_id)
+);
+
+DROP TABLE IF EXISTS track_e_item_property;
+
+CREATE TABLE track_e_item_property (
+  id int NOT NULL auto_increment PRIMARY KEY,
+  course_id int NOT NULL,
+  item_property_id int NOT NULL,
+  title varchar(255),
+  content text,
+  progress int NOT NULL default 0,
+  lastedit_date datetime NOT NULL default '0000-00-00 00:00:00',
+  lastedit_user_id int  NOT NULL,
+  session_id int NOT NULL default 0
+);
+
+ALTER TABLE track_e_course_access ADD INDEX (user_id);
+ALTER TABLE track_e_course_access ADD INDEX (login_course_date);
+ALTER TABLE track_e_course_access ADD INDEX (course_code);
+ALTER TABLE track_e_course_access ADD INDEX (session_id);
+ALTER TABLE track_e_access ADD INDEX (access_session_id);
+
+ALTER TABLE track_e_online ADD INDEX (course);
+ALTER TABLE track_e_online ADD INDEX (session_id);
+
+ALTER TABLE track_e_item_property ADD INDEX (course_id, item_property_id, session_id);
+ALTER TABLE track_e_downloads ADD INDEX (down_session_id);  
+ALTER TABLE track_e_links ADD INDEX (links_session_id); 
+ALTER TABLE track_e_uploads ADD INDEX (upload_session_id);  
+
+--
+-- Table structure for LP custom storage API
+--
+DROP TABLE IF EXISTS track_stored_values;
+CREATE TABLE IF NOT EXISTS track_stored_values (
+    id int unsigned not null AUTO_INCREMENT PRIMARY KEY,
+	user_id INT NOT NULL,
+	sco_id INT NOT NULL,
+	course_id CHAR(40) NOT NULL,
+	sv_key CHAR(64) NOT NULL,
+	sv_value TEXT NOT NULL    
+);
+ALTER TABLE track_stored_values ADD KEY (user_id, sco_id, course_id, sv_key);
+ALTER TABLE track_stored_values ADD UNIQUE (user_id, sco_id, course_id, sv_key);
+
+DROP TABLE IF EXISTS track_stored_value_stack;
+CREATE TABLE IF NOT EXISTS track_stored_values_stack (
+    id int unsigned not null AUTO_INCREMENT PRIMARY KEY,
+	user_id INT NOT NULL,
+	sco_id INT NOT NULL,
+	stack_order INT NOT NULL,
+	course_id CHAR(40) NOT NULL,
+	sv_key CHAR(64) NOT NULL,
+	sv_value TEXT NOT NULL
+);
+ALTER TABLE track_stored_values_stack ADD KEY (user_id, sco_id, course_id, sv_key, stack_order);
+ALTER TABLE track_stored_values_stack ADD UNIQUE (user_id, sco_id, course_id, sv_key, stack_order);
+
+DROP TABLE IF EXISTS track_e_attempt_coeff;
+CREATE TABLE track_e_attempt_coeff (
+    id int unsigned not null auto_increment primary key,
+    attempt_id INT NOT NULL, 
+    marks_coeff float(6,2)
+);

+ 53 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.9.0/db_user.sql

@@ -0,0 +1,53 @@
+-- MySQL dump
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+DROP TABLE IF EXISTS personal_agenda;
+CREATE TABLE personal_agenda (
+  id int NOT NULL auto_increment,
+  user int unsigned,
+  title text,
+  `text` text,
+  `date` datetime DEFAULT NULL,
+  enddate datetime DEFAULT NULL,
+  course varchar(255),
+  parent_event_id int NULL,
+  all_day int NOT NULL DEFAULT 0,
+  PRIMARY KEY id (id)
+);
+
+DROP TABLE IF EXISTS personal_agenda_repeat;
+CREATE TABLE personal_agenda_repeat (
+  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 (cal_id)
+);
+
+DROP TABLE IF EXISTS personal_agenda_repeat_not;
+CREATE TABLE personal_agenda_repeat_not (
+  cal_id INT NOT NULL,
+  cal_date INT NOT NULL,
+  PRIMARY KEY ( cal_id, cal_date )
+);
+
+DROP TABLE IF EXISTS user_course_category;
+CREATE TABLE user_course_category (
+  id int unsigned NOT NULL auto_increment,
+  user_id int unsigned NOT NULL default 0,
+  title text NOT NULL,
+  sort int, 
+  PRIMARY KEY  (id)
+);
+
+ALTER TABLE personal_agenda ADD INDEX idx_personal_agenda_user (user);
+ALTER TABLE personal_agenda ADD INDEX idx_personal_agenda_parent (parent_event_id);
+ALTER TABLE user_course_category ADD INDEX idx_user_c_cat_uid (user_id);

+ 326 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.9.0/migrate-db-1.8.8-1.9.0-pre.sql

@@ -0,0 +1,326 @@
+-- This script updates the databases structure before migrating the data from
+-- version 1.8.8 (or version 1.8.8.2, 1.8.8.4) to version 1.9.0
+-- it is intended as a standalone script, however, because of the multiple
+-- databases related difficulties, it should be parsed by a PHP script in
+-- order to connect to and update the right databases.
+-- There is one line per query, allowing the PHP function file() to read
+-- all lines separately into an array. The xxMAINxx-type markers are there
+-- to tell the PHP script which database we're talking about.
+-- By always using the keyword "TABLE" in the queries, we should be able
+-- to retrieve and modify the table name from the PHP script if needed, which
+-- will allow us to deal with the unique-database-type installations
+--
+-- This first part is for the main database
+
+-- xxMAINxx
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('filter_terms', NULL, 'textarea', 'Security', '', 'FilterTermsTitle', 'FilterTermsComment', NULL, NULL, 0);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('header_extra_content', NULL, 'textarea', 'Tracking', '', 'HeaderExtraContentTitle', 'HeaderExtraContentComment', NULL, NULL, 1),('footer_extra_content', NULL, 'textarea', 'Tracking', '', 'FooterExtraContentTitle', 'FooterExtraContentComment', NULL, NULL,1);
+
+ALTER TABLE sys_calendar ADD COLUMN all_day INTEGER NOT NULL DEFAULT 0;
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('show_documents_preview', NULL, 'radio', 'Tools', 'false', 'ShowDocumentPreviewTitle', 'ShowDocumentPreviewComment', NULL, NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('show_documents_preview', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('show_documents_preview', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('htmlpurifier_wiki',NULL,'radio','Editor','false','HtmlPurifierWikiTitle','HtmlPurifierWikiComment',NULL,NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('htmlpurifier_wiki', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('htmlpurifier_wiki', 'false', 'No');
+
+-- CAS feature
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('cas_activate', NULL, 'radio', 'CAS', 'false', 'CasMainActivateTitle', 'CasMainActivateComment', NULL, NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) values ('cas_activate', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) values ('cas_activate', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('cas_server', NULL, 'textfield', 'CAS', '', 'CasMainServerTitle', 'CasMainServerComment', NULL, NULL, 0);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('cas_server_uri', NULL, 'textfield', 'CAS', '', 'CasMainServerURITitle', 'CasMainServerURIComment', NULL, NULL, 0);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('cas_port', NULL, 'textfield', 'CAS', '', 'CasMainPortTitle', 'CasMainPortComment', NULL, NULL, 0);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('cas_protocol', NULL, 'radio', 'CAS', '', 'CasMainProtocolTitle', 'CasMainProtocolComment', NULL, NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) values ('cas_protocol', 'CAS1', 'CAS1Text');
+INSERT INTO settings_options (variable, value, display_text) values ('cas_protocol', 'CAS2', 'CAS2Text');
+INSERT INTO settings_options (variable, value, display_text) values ('cas_protocol', 'SAML', 'SAMLText');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('cas_add_user_activate', NULL, 'radio', 'CAS', 'false', 'CasUserAddActivateTitle', 'CasUserAddActivateComment', NULL, NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) values ('cas_add_user_activate', 'platform', 'casAddUserActivatePlatform');
+INSERT INTO settings_options (variable, value, display_text) values ('cas_add_user_activate', 'extldap', 'casAddUserActivateLDAP');
+INSERT INTO settings_options (variable, value, display_text) values ('cas_add_user_activate', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('update_user_info_cas_with_ldap', NULL, 'radio', 'CAS', 'true', 'UpdateUserInfoCasWithLdapTitle', 'UpdateUserInfoCasWithLdapComment', NULL, NULL, 0)
+
+-- Custom Pages
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('use_custom_pages', NULL, 'radio','Platform','false','UseCustomPagesTitle','UseCustomPagesComment', NULL, NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) values ('use_custom_pages', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) values ('use_custom_pages', 'false', 'No');
+
+-- Pages after login by role
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('student_page_after_login', NULL, 'textfield', 'Platform', '', 'StudentPageAfterLoginTitle', 'StudentPageAfterLoginComment', NULL, NULL, 0);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('teacher_page_after_login', NULL, 'textfield', 'Platform', '', 'TeacherPageAfterLoginTitle', 'TeacherPageAfterLoginComment', NULL, NULL, 0);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('drh_page_after_login', NULL, 'textfield', 'Platform', '', 'DRHPageAfterLoginTitle', 'DRHPageAfterLoginComment', NULL, NULL, 0);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('sessionadmin_page_after_login', NULL, 'textfield', 'Session', '', 'SessionAdminPageAfterLoginTitle', 'SessionAdminPageAfterLoginComment', NULL, NULL, 0);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('student_autosubscribe', NULL, 'textfield', 'Platform', '', 'StudentAutosubscribeTitle', 'StudentAutosubscribeComment', NULL, NULL, 0);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('teacher_autosubscribe', NULL, 'textfield', 'Platform', '', 'TeacherAutosubscribeTitle', 'TeacherAutosubscribeComment', NULL, NULL, 0);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('drh_autosubscribe', NULL, 'textfield', 'Platform', '', 'DRHAutosubscribeTitle', 'DRHAutosubscribeComment', NULL, NULL, 0);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('sessionadmin_autosubscribe', NULL, 'textfield', 'Session', '', 'SessionadminAutosubscribeTitle', 'SessionadminAutosubscribeComment', NULL, NULL, 0);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('show_tabs', 'custom_tab_1', 'checkbox', 'Platform', 'true', 'ShowTabsTitle', 'ShowTabsComment', NULL, 'TabsCustom1', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('show_tabs', 'custom_tab_2', 'checkbox', 'Platform', 'false', 'ShowTabsTitle', 'ShowTabsComment', NULL, 'TabsCustom2', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('show_tabs', 'custom_tab_3', 'checkbox', 'Platform', 'false', 'ShowTabsTitle', 'ShowTabsComment', NULL, 'TabsCustom3', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('languagePriority1', NULL, 'radio', 'Languages', 'course_lang', 'LanguagePriority1Title', 'LanguagePriority1Comment', NULL, NULL, 0);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('languagePriority2', NULL, 'radio', 'Languages', 'user_profil_lang', 'LanguagePriority2Title', 'LanguagePriority2Comment', NULL, NULL, 0);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('languagePriority3', NULL, 'radio', 'Languages', 'user_selected_lang', 'LanguagePriority3Title', 'LanguagePriority3Comment', NULL, NULL, 0);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('languagePriority4', NULL, 'radio', 'Languages', 'platform_lang', 'LanguagePriority4Title', 'LanguagePriority4Comment', NULL, NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('languagePriority1','platform_lang','PlatformLanguage'), ('languagePriority1','user_profil_lang','UserLanguage'), ('languagePriority1','user_selected_lang','UserSelectedLanguage'), ('languagePriority1','course_lang','CourseLanguage'), ('languagePriority2','platform_lang','PlatformLanguage'), ('languagePriority2','user_profil_lang','UserLanguage'), ('languagePriority2','user_selected_lang','UserSelectedLanguage'), ('languagePriority2','course_lang','CourseLanguage'), ('languagePriority3','platform_lang','PlatformLanguage'), ('languagePriority3','user_profil_lang','UserLanguage'), ('languagePriority3','user_selected_lang','UserSelectedLanguage'), ('languagePriority3','course_lang','CourseLanguage'), ('languagePriority4','platform_lang','PlatformLanguage'), ('languagePriority4','user_profil_lang','UserLanguage'), ('languagePriority4','user_selected_lang','UserSelectedLanguage'), ('languagePriority4','course_lang','CourseLanguage');
+-- Email is login
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('login_is_email', NULL, 'radio', 'Platform', 'false', 'LoginIsEmailTitle', 'LoginIsEmailComment', NULL, NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('login_is_email','true','Yes'),('login_is_email','false','No') ;
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('scorm_cumulative_session_time', NULL, 'radio', 'Course', 'true', 'ScormCumulativeSessionTimeTitle', 'ScormCumulativeSessionTimeComment', NULL, NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('scorm_cumulative_session_time','true','Yes'), ('scorm_cumulative_session_time','false','No');
+CREATE TABLE event_type ( id int unsigned NOT NULL AUTO_INCREMENT, name varchar(50) NOT NULL, name_lang_var varchar(50) NOT NULL, desc_lang_var varchar(50) NOT NULL, extendable_variables varchar(255) NOT NULL, PRIMARY KEY (id));
+ALTER TABLE event_type ADD INDEX ( name );
+CREATE TABLE event_type_email_template ( id int unsigned NOT NULL AUTO_INCREMENT, event_type_id int NOT NULL, language_id int NOT NULL, message text NOT NULL, subject varchar(60) NOT NULL, PRIMARY KEY (id));
+ALTER TABLE event_type_email_template ADD INDEX ( language_id );
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) values (1, 'already_logged_in','Already logged in',0,0);
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) values (1, 'update_type','Update script type',0,0);
+CREATE TABLE announcement_rel_group (group_id int NOT NULL, announcement_id int NOT NULL, PRIMARY KEY (group_id, announcement_id));
+CREATE TABLE group_rel_group ( id int NOT NULL AUTO_INCREMENT, group_id int NOT NULL, subgroup_id int NOT NULL, relation_type int NOT NULL, PRIMARY KEY (id));
+ALTER TABLE group_rel_group ADD INDEX ( group_id );
+ALTER TABLE group_rel_group ADD INDEX ( subgroup_id );
+ALTER TABLE group_rel_group ADD INDEX ( relation_type );
+
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('gradebook_enable_grade_model', NULL, 'radio', 'Gradebook', 'false', 'GradebookEnableGradeModelTitle', 'GradebookEnableGradeModelComment', NULL, NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('gradebook_enable_grade_model', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('gradebook_enable_grade_model', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('teachers_can_change_grade_model_settings', NULL, 'radio', 'Gradebook', 'true', 'TeachersCanChangeGradeModelSettingsTitle', 'TeachersCanChangeGradeModelSettingsComment', NULL, NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('teachers_can_change_grade_model_settings', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('teachers_can_change_grade_model_settings', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('gradebook_locking_enabled', NULL, 'radio', 'Gradebook', 'false', 'GradebookEnableLockingTitle', 'GradebookEnableLockingComment', NULL, NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('gradebook_locking_enabled', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('gradebook_locking_enabled', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('teachers_can_change_score_settings', NULL, 'radio', 'Gradebook', 'true', 'TeachersCanChangeScoreSettingsTitle', 'TeachersCanChangeScoreSettingsComment', NULL, NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('teachers_can_change_score_settings', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('teachers_can_change_score_settings', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_users_to_change_email_with_no_password', NULL, 'radio', 'User', 'false', 'AllowUsersToChangeEmailWithNoPasswordTitle', 'AllowUsersToChangeEmailWithNoPasswordComment', NULL, NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_users_to_change_email_with_no_password', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_users_to_change_email_with_no_password', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_session_admins_to_manage_all_sessions', NULL, 'radio', 'Session', 'false', 'AllowSessionAdminsToSeeAllSessionsTitle', 'AllowSessionAdminsToSeeAllSessionsComment', NULL, NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_session_admins_to_manage_all_sessions', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_session_admins_to_manage_all_sessions', 'false', 'No');
+
+-- Shibboleth and Facebook auth and ldap
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('shibboleth_description', NULL, 'radio', 'Shibboleth', 'false', 'ShibbolethMainActivateTitle', 'ShibbolethMainActivateComment', NULL, NULL, 0);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('facebook_description', NULL, 'radio', 'Facebook', 'false', 'FacebookMainActivateTitle', 'FacebookMainActivateComment', NULL, NULL, 0);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('ldap_description', NULL, 'radio', 'LDAP', NULL, 'LdapDescriptionTitle', 'LdapDescriptionComment', NULL, NULL, 0);
+
+ALTER TABLE course_rel_user ADD COLUMN legal_agreement INTEGER DEFAULT 0;
+ALTER TABLE session_rel_course_rel_user ADD COLUMN legal_agreement INTEGER DEFAULT 0;
+ALTER TABLE course ADD COLUMN legal TEXT NOT NULL;
+ALTER TABLE course ADD COLUMN activate_legal INT NOT NULL DEFAULT 0;
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('enable_help_link', NULL, 'radio', 'Platform', 'true', 'EnableHelpLinkTitle', 'EnableHelpLinkComment', NULL, NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_help_link', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_help_link', 'false', 'No');
+
+ALTER TABLE gradebook_category MODIFY COLUMN weight FLOAT NOT NULL;
+ALTER TABLE gradebook_link MODIFY COLUMN weight FLOAT  NOT NULL;
+ALTER TABLE gradebook_link ADD COLUMN locked INT DEFAULT 0;
+ALTER TABLE gradebook_category ADD COLUMN locked INT DEFAULT 0;
+ALTER TABLE gradebook_category ADD COLUMN default_lowest_eval_exclude TINYINT default null;
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_hr_skills_management', NULL, 'radio', 'Gradebook', 'true', 'AllowHRSkillsManagementTitle', 'AllowHRSkillsManagementComment', NULL, NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_hr_skills_management', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_hr_skills_management', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('show_admin_toolbar', NULL, 'radio', 'Platform', 'show_to_admin', 'ShowAdminToolbarTitle', 'ShowAdminToolbarComment', NULL, NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('show_admin_toolbar', 'do_not_show', 'DoNotShow');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('show_admin_toolbar', 'show_to_admin', 'ShowToAdminsOnly');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('show_admin_toolbar', 'show_to_admin_and_teachers', 'ShowToAdminsAndTeachers');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('show_admin_toolbar', 'show_to_all', 'ShowToAllUsers');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_global_chat', NULL, 'radio', 'Platform', 'true', 'AllowGlobalChatTitle', 'AllowGlobalChatComment', NULL, NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_global_chat', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_global_chat', 'false', 'No');
+
+CREATE TABLE chat (id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, from_user INTEGER, to_user INTEGER, message TEXT NOT NULL, sent DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', recd INTEGER UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (id));
+ALTER TABLE chat ADD INDEX idx_chat_to_user (to_user);
+ALTER TABLE chat ADD INDEX idx_chat_from_user (from_user);
+
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES (1, 'google_calendar_url','Google Calendar URL',0,0);
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('courses_default_creation_visibility', NULL, 'radio', 'Course', '2', 'CoursesDefaultCreationVisibilityTitle', 'CoursesDefaultCreationVisibilityComment', NULL, NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('courses_default_creation_visibility', '3', 'OpenToTheWorld');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('courses_default_creation_visibility', '2', 'OpenToThePlatform');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('courses_default_creation_visibility', '1', 'Private');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('courses_default_creation_visibility', '0', 'CourseVisibilityClosed');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_browser_sniffer', NULL, 'radio', 'Tuning', 'false', 'AllowBrowserSnifferTitle', 'AllowBrowserSnifferComment', NULL, NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_browser_sniffer', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_browser_sniffer', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('enable_wami_record', NULL, 'radio', 'Tools', 'false', 'EnableWamiRecordTitle', 'EnableWamiRecordComment', NULL, NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_wami_record', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_wami_record', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_public_certificates', NULL, 'radio', 'Course', 'false', 'AllowPublicCertificatesTitle', 'AllowPublicCertificatesComment', NULL, NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_public_certificates', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_public_certificates', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('enable_iframe_inclusion', NULL, 'radio', 'Editor', 'false', 'EnableIframeInclusionTitle', 'EnableIframeInclusionComment', NULL, NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_iframe_inclusion', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_iframe_inclusion', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('show_hot_courses', NULL, 'radio', 'Platform', 'true', 'ShowHotCoursesTitle', 'ShowHotCoursesComment', NULL, NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('show_hot_courses', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('show_hot_courses', 'false', 'No');
+
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('gradebook_default_weight', NULL, 'textfield', 'Gradebook', '100', 'GradebookDefaultWeightTitle', 'GradebookDefaultWeightComment', NULL, NULL, 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('gradebook_default_grade_model_id', NULL, 'select', 'Gradebook', '', 'GradebookDefaultGradeModelTitle', 'GradebookDefaultGradeModelComment', NULL, NULL, 1);
+
+UPDATE settings_current SET category = 'Session' WHERE variable IN ('show_tutor_data', 'use_session_mode', 'add_users_by_coach', 'show_session_coach', 'show_session_data', 'allow_coach_to_edit_course_session','hide_courses_in_sessions', 'show_groups_to_users');
+
+INSERT INTO language (original_name, english_name, isocode, dokeos_folder, available) VALUES ('&#2476;&#2494;&#2434;&#2482;&#2494;','bengali','bn','bengali',0), ('&#1575;&#1604;&#1589;&#1608;&#1605;&#1575;&#1604;&#1610;&#1577;','somali','so','somali',0);
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('enable_webcam_clip', NULL, 'radio', 'Tools', 'false', 'EnableWebCamClipTitle', 'EnableWebCamClipComment', NULL, NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_webcam_clip', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_webcam_clip', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('tool_visible_by_default_at_creation','documents','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Documents', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('tool_visible_by_default_at_creation','learning_path','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'LearningPath', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('tool_visible_by_default_at_creation','links','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Links', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('tool_visible_by_default_at_creation','announcements','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Announcements', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('tool_visible_by_default_at_creation','forums','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Forums', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('tool_visible_by_default_at_creation','quiz','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Quiz', 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('tool_visible_by_default_at_creation','gradebook','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Gradebook', 1);
+
+-- Course ranking
+CREATE TABLE track_course_ranking (id   int unsigned not null PRIMARY KEY AUTO_INCREMENT, c_id  int unsigned not null, session_id  int unsigned not null default 0, url_id  int unsigned not null default 0, accesses int unsigned not null default 0, total_score int unsigned not null default 0, users int unsigned not null default 0, creation_date datetime not null);
+
+ALTER TABLE track_course_ranking ADD INDEX idx_tcc_cid (c_id);
+ALTER TABLE track_course_ranking ADD INDEX idx_tcc_sid (session_id);
+ALTER TABLE track_course_ranking ADD INDEX idx_tcc_urlid (url_id);
+ALTER TABLE track_course_ranking ADD INDEX idx_tcc_creation_date (creation_date);
+
+CREATE TABLE user_rel_course_vote ( id int unsigned not null AUTO_INCREMENT PRIMARY KEY,  c_id int unsigned not null,  user_id int unsigned not null, session_id int unsigned not null default 0,  url_id int unsigned not null default 0, vote int unsigned not null default 0);
+
+ALTER TABLE user_rel_course_vote ADD INDEX idx_ucv_cid (c_id);
+ALTER TABLE user_rel_course_vote ADD INDEX idx_ucv_uid (user_id);
+ALTER TABLE user_rel_course_vote ADD INDEX idx_ucv_cuid (user_id, c_id);
+
+--User chat status
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES (1, 'user_chat_status','User chat status', 0, 0);
+UPDATE settings_current SET selected_value = 'true' WHERE variable = 'more_buttons_maximized_mode';
+
+--Grade model
+CREATE TABLE grade_model (id INTEGER  NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL, description TEXT, default_lowest_eval_exclude TINYINT default null, default_external_eval_prefix VARCHAR(140) default null, PRIMARY KEY (id));
+CREATE TABLE grade_components (id INTEGER  NOT NULL AUTO_INCREMENT, percentage VARCHAR(255)  NOT NULL, title VARCHAR(255)  NOT NULL, acronym VARCHAR(255)  NOT NULL, grade_model_id INTEGER NOT NULL, PRIMARY KEY (id));
+ALTER TABLE gradebook_category ADD COLUMN grade_model_id INT DEFAULT 0;
+
+UPDATE settings_current SET title = 'DatabaseVersion' WHERE variable = 'chamilo_database_version';
+ALTER TABLE gradebook_evaluation MODIFY COLUMN weight FLOAT NOT NULL;
+
+INSERT INTO settings_options(variable, value, display_text) VALUES ('page_after_login', 'main/auth/courses.php', 'CourseCatalog');
+
+ALTER TABLE settings_current ADD COLUMN access_url_locked INTEGER NOT NULL DEFAULT 0;
+
+-- Event mail
+CREATE TABLE event_email_template (  id int NOT NULL AUTO_INCREMENT,  message text,  subject varchar(255) DEFAULT NULL,  event_type_name varchar(255) DEFAULT NULL,  activated tinyint NOT NULL DEFAULT '0',  language_id int DEFAULT NULL, PRIMARY KEY (id));
+ALTER TABLE event_email_template ADD INDEX event_name_index (event_type_name);
+
+CREATE TABLE event_sent (  id int NOT NULL AUTO_INCREMENT,  user_from int NOT NULL,  user_to int DEFAULT NULL,  event_type_name varchar(100) DEFAULT NULL,  PRIMARY KEY (id));
+ALTER TABLE event_sent ADD INDEX event_name_index (event_type_name);
+
+CREATE TABLE user_rel_event_type (  id int NOT NULL AUTO_INCREMENT,  user_id int NOT NULL,  event_type_name varchar(255) NOT NULL, PRIMARY KEY (id));
+ALTER TABLE user_rel_event_type ADD INDEX event_name_index (event_type_name);
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('activate_email_template', NULL, 'radio', 'Platform', 'false', 'ActivateEmailTemplateTitle', 'ActivateEmailTemplateComment', NULL, NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('activate_email_template', 'true', 'Yes'),('activate_email_template', 'false', 'No');
+
+-- Skills
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_skills_tool', NULL, 'radio', 'Platform', 'false', 'AllowSkillsToolTitle', 'AllowSkillsToolComment', NULL, NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_skills_tool', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_skills_tool', 'false', 'No');
+
+CREATE TABLE IF NOT EXISTS skill ( id int NOT NULL AUTO_INCREMENT, name varchar(255) NOT NULL, short_code varchar(100) NOT NULL, description TEXT NOT NULL, access_url_id int NOT NULL, icon varchar(255) NOT NULL, PRIMARY KEY (id));
+INSERT INTO skill (name) VALUES ('Root');
+
+CREATE TABLE IF NOT EXISTS skill_rel_gradebook ( id int NOT NULL AUTO_INCREMENT, gradebook_id int NOT NULL, skill_id int NOT NULL, type varchar(10) NOT NULL, PRIMARY KEY (id));
+CREATE TABLE IF NOT EXISTS skill_rel_skill (id int NOT NULL AUTO_INCREMENT, skill_id int NOT NULL, parent_id int NOT NULL, relation_type int NOT NULL, level int NOT NULL, PRIMARY KEY (id));
+INSERT INTO skill_rel_skill VALUES(1, 1, 0, 0, 0);
+
+CREATE TABLE IF NOT EXISTS skill_rel_user ( id int NOT NULL AUTO_INCREMENT, user_id int NOT NULL, skill_id int NOT NULL, acquired_skill_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00',assigned_by int NOT NULL,PRIMARY KEY (id));
+CREATE TABLE IF NOT EXISTS skill_profile ( id INTEGER  NOT NULL AUTO_INCREMENT, name VARCHAR(255)  NOT NULL, description TEXT  NOT NULL, PRIMARY KEY (id));
+CREATE TABLE IF NOT EXISTS skill_rel_profile ( id INTEGER  NOT NULL AUTO_INCREMENT, skill_id INTEGER  NOT NULL, profile_id INTEGER  NOT NULL, PRIMARY KEY (id));
+
+-- Removing use_document_title
+DELETE FROM settings_current WHERE variable = 'use_document_title';
+DELETE FROM settings_options WHERE variable = 'use_document_title';
+
+ALTER TABLE course MODIFY COLUMN disk_quota bigint unsigned DEFAULT NULL;
+ALTER TABLE user MODIFY COLUMN username VARCHAR(100) NOT NULL;
+
+UPDATE language SET english_name = 'basque' , dokeos_folder = 'basque' where english_name = 'euskera';
+UPDATE language SET english_name = 'turkish', dokeos_folder = 'turkish' where english_name = 'turkce';
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('platform_unsubscribe_allowed', NULL, 'radio', 'Platform', 'false', 'PlatformUnsubscribeTitle', 'PlatformUnsubscribeComment', NULL, NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) values ('platform_unsubscribe_allowed', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) values ('platform_unsubscribe_allowed', 'false', 'No');
+
+ALTER TABLE usergroup_rel_session       ADD COLUMN id INTEGER NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (id);
+ALTER TABLE usergroup_rel_course        ADD COLUMN id INTEGER NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (id);
+ALTER TABLE usergroup_rel_user          ADD COLUMN id INTEGER NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (id);
+ALTER TABLE admin                       ADD COLUMN id INTEGER NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (id);
+ALTER TABLE reservation_category_rights ADD COLUMN id INTEGER NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (id);
+
+
+CREATE TABLE course_type (id int unsigned not null auto_increment primary key, name varchar(50) not null, translation_var char(40) default 'UndefinedCourseTypeLabel', description TEXT default '', props text default '');
+
+INSERT INTO course_type (id, name) VALUES (1, 'All tools');
+INSERT INTO course_type (id, name) VALUES (2, 'Entry exam');
+
+ALTER TABLE course add course_type_id int unsigned default 1;
+
+CREATE TABLE usergroup_rel_question (id int unsigned not null auto_increment primary key, c_id int unsigned not null, question_id int unsigned not null, usergroup_id int unsigned not null, coefficient float(6,2));
+
+-- Remove settings entry that doesnt exist anymore
+
+DELETE FROM settings_current WHERE variable = 'read_more_limit';
+DELETE FROM settings_current WHERE variable = 'user_order_by';
+DELETE FROM settings_options WHERE variable = 'user_order_by';
+
+ALTER TABLE user_api_key ADD COLUMN api_end_point text DEFAULT NULL;
+ALTER TABLE user_api_key ADD COLUMN created_date datetime DEFAULT NULL;
+ALTER TABLE user_api_key ADD COLUMN validity_start_date datetime DEFAULT NULL;
+ALTER TABLE user_api_key ADD COLUMN validity_end_date datetime DEFAULT NULL;
+ALTER TABLE user_api_key ADD COLUMN description text DEFAULT NULL;
+
+-- Do not move this query
+UPDATE settings_current SET selected_value = '1.9.0.18715' WHERE variable = 'chamilo_database_version';
+
+-- xxSTATSxx
+ALTER TABLE track_e_default  MODIFY COLUMN default_value TEXT;
+ALTER TABLE track_e_exercices ADD COLUMN questions_to_check TEXT NOT NULL DEFAULT '';
+--CREATE TABLE track_filtered_terms (id int, user_id int, course_id int, session_id int, tool_id char(12), filtered_term varchar(255), created_at datetime);
+CREATE TABLE track_stored_values (id int unsigned not null AUTO_INCREMENT PRIMARY KEY, user_id INT NOT NULL, sco_id INT NOT NULL, course_id CHAR(40) NOT NULL, sv_key CHAR(64) NOT NULL, sv_value TEXT NOT NULL);
+ALTER TABLE track_stored_values ADD KEY (user_id, sco_id, course_id, sv_key);
+ALTER TABLE track_stored_values ADD UNIQUE (user_id, sco_id, course_id, sv_key);
+
+CREATE TABLE track_stored_values_stack (id int unsigned not null AUTO_INCREMENT PRIMARY KEY,user_id INT NOT NULL, sco_id INT NOT NULL, stack_order INT NOT NULL, course_id CHAR(40) NOT NULL, sv_key CHAR(64) NOT NULL, sv_value TEXT NOT NULL);
+ALTER TABLE track_stored_values_stack ADD KEY (user_id, sco_id, course_id, sv_key, stack_order);
+ALTER TABLE track_stored_values_stack ADD UNIQUE (user_id, sco_id, course_id, sv_key, stack_order);
+
+ALTER TABLE track_e_attempt ADD COLUMN filename VARCHAR(255) DEFAULT NULL;
+ALTER TABLE track_e_default ADD COLUMN c_id INTEGER DEFAULT NULL;
+
+ALTER TABLE track_e_attempt_recording ADD COLUMN id INTEGER NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (id);
+ALTER TABLE track_e_attempt ADD COLUMN id INTEGER NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (id);
+ALTER TABLE track_e_hotpotatoes ADD COLUMN id INTEGER NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (id);
+
+CREATE TABLE track_e_attempt_coeff ( id int unsigned not null auto_increment primary key, attempt_id INT NOT NULL, marks_coeff float(6,2));
+
+-- xxUSERxx
+ALTER TABLE personal_agenda ADD COLUMN all_day INTEGER NOT NULL DEFAULT 0;

+ 557 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.9.0/update-db-1.8.8-1.9.0.inc.php

@@ -0,0 +1,557 @@
+<?php
+/* For licensing terms, see /license.txt */
+
+$update = function($_configuration, $mainConnection, $courseList, $dryRun, $output)
+{
+
+    $portalSettings = $this->getPortalSettings();
+
+    define('DB_COURSE_PREFIX', 'c_');
+
+    $databaseList = $this->generateDatabaseList($courseList);
+    $courseDatabaseConnectionList = $databaseList['course']; // main  user stats course
+
+    /** @var \Doctrine\DBAL\Connection $userConnection */
+    $userConnection = $this->getHelper($databaseList['user'][0]['database'])->getConnection();
+    /** @var \Doctrine\DBAL\Connection $mainConnection */
+    $mainConnection = $this->getHelper($databaseList['main'][0]['database'])->getConnection();
+    /** @var \Doctrine\DBAL\Connection $statsConnection */
+    $statsConnection = $this->getHelper($databaseList['stats'][0]['database'])->getConnection();
+
+    $mainConnection->beginTransaction();
+
+    try {
+
+        $sql = "SELECT selected_value FROM settings_current WHERE variable='use_session_mode' ";
+        $result = $mainConnection->executeQuery($sql);
+        $output->writeln($sql);
+
+        $result = $result->fetch();
+        $session_mode  = $result['selected_value'];
+        $output->writeln("<comment>Session mode: $session_mode</comment>");
+
+        if ($session_mode == 'true') {
+
+            $sql = "UPDATE settings_current SET selected_value = 'true' WHERE variable='use_session_mode' ";
+            $mainConnection->executeQuery($sql);
+
+            $sql = "SELECT * FROM class";
+            $result = $mainConnection->executeQuery($sql);
+            $rows = $result->fetchAll();
+
+            $classes_added = 0;
+            $mapping_classes = array();
+
+            if (!empty($rows)) {
+                $output->writeln('Moving classes to usergroups ');
+                foreach ($rows as $row) {
+                    $old_id = $row['id'];
+                    unset($row['id']);
+                    unset($row['code']);
+
+                    if ($dryRun) {
+                        $new_user_group_id = 1;
+                    } else {
+                        $mainConnection->insert('usergroup', $row);
+                        $new_user_group_id = $mainConnection->lastInsertId();
+                    }
+
+                    if (is_numeric($new_user_group_id)) {
+                        $mapping_classes[$old_id] = $new_user_group_id;
+                        $classes_added ++;
+                    }
+                }
+                $output->writeln("Classes added: $classes_added");
+            }
+
+            $sql = "SELECT * FROM class_user";
+            $result = $mainConnection->executeQuery($sql);
+            $rows = $result->fetchAll();
+
+            if (!empty($rows)) {
+                $output->writeln('Moving users from class_user to usergroup_rel_user ');
+                foreach ($rows as $row) {
+                    $values = array(
+                        'usergroup_id' => $mapping_classes[$row['class_id']],
+                        'user_id' => $row['user_id']
+                    );
+
+                    if ($dryRun) {
+                        $output->writeln("<comment>Values to be saved:</comment>".implode(', ', $values));
+                    } else {
+                        $mainConnection->insert('usergroup_rel_user', $values);
+                        $output->writeln("<comment>Saving:</comment> ".implode(', ', $values));
+                    }
+                }
+            }
+
+            $sql = "SELECT * FROM course_rel_class";
+            $result = $mainConnection->executeQuery($sql);
+            $rows = $result->fetchAll();
+
+            if (!empty($rows)) {
+                $output->writeln("Moving  course_rel_class to usergroup_rel_course");
+
+                foreach ($rows as $row) {
+                    $course_code = $row['course_code'];
+                    $course_code = addslashes($course_code);
+                    $sql_course = "SELECT id from course WHERE code = '$course_code'";
+
+                    $subResult = $mainConnection->executeQuery($sql_course);
+                    $courseInfo = $subResult->fetch();
+                    $course_id  = $courseInfo['id'];
+                    $values = array(
+                        'usergroup_id' => $mapping_classes[$row['class_id']],
+                        'course_id' => $course_id
+                    );
+
+                    if ($dryRun) {
+                        $output->writeln("<comment>Values to be saved:</comment>".implode(', ', $values));
+                    } else {
+                        $mainConnection->insert('usergroup_rel_course', $values);
+                        $output->writeln("<comment>Saving:</comment> ".implode(', ', $values));
+                    }
+                }
+            }
+        }
+
+        //Moving Stats DB to the main DB
+
+        $stats_table = array(
+            "track_c_browsers",
+            "track_c_countries",
+            "track_c_os",
+            "track_c_providers",
+            "track_c_referers",
+            "track_e_access",
+            "track_e_attempt",
+            "track_e_attempt_recording",
+            "track_e_course_access",
+            "track_e_default",
+            "track_e_downloads",
+            "track_e_exercices",
+            "track_e_hotpotatoes",
+            "track_e_hotspot",
+            "track_e_item_property",
+            "track_e_lastaccess",
+            "track_e_links",
+            "track_e_login",
+            "track_e_online",
+            "track_e_open",
+            "track_e_uploads",
+            "track_stored_values",
+            "track_stored_values_stack",
+        );
+
+        // No rename we assume that stats are in the main db
+        /*
+        foreach ($stats_table as $stat_table) {
+            $sql = "ALTER TABLE $dbStatsForm.$stat_table RENAME $dbNameForm.$stat_table";
+            Database::query($sql);
+            $output->writeln($sql);
+        }
+        iDatabase::select_db($dbNameForm);
+        $statsConnection->
+        */
+
+        //Moving user database to the main database
+        $users_tables = array(
+            "personal_agenda",
+            "personal_agenda_repeat",
+            "personal_agenda_repeat_not",
+            "user_course_category"
+        );
+
+        // No rename we asumme that stats are in the main db
+
+        /*
+        if ($dbNameForm != $dbUserForm) {
+            iDatabase::select_db($dbUserForm);
+            foreach ($users_tables as $table) {
+                $sql = "ALTER TABLE $dbUserForm.$table RENAME $dbNameForm.$table";
+                iDatabase::query($sql);
+                $output->writeln($sql);
+            }
+            iDatabase::select_db($dbNameForm);
+        }*/
+
+        // Adding admin user in the access_url_rel_user table.
+        $sql = "SELECT user_id FROM admin WHERE user_id = 1";
+        $result = $mainConnection->executeQuery($sql);
+        $row = $result->fetch();
+        $has_user_id = !empty($row);
+
+        $sql = "SELECT * FROM access_url_rel_user WHERE user_id = 1 AND access_url_id = 1";
+        $result = $mainConnection->executeQuery($sql);
+        $row = $result->fetch();
+        $has_entry = !empty($row);
+
+        if ($has_user_id && !$has_entry) {
+            $sql = "INSERT INTO access_url_rel_user VALUES(1, 1)";
+            $mainConnection->executeQuery($sql);
+            $output->writeln($sql);
+        }
+
+        //$output->writeln("Dropping c_* tables ...");
+        //$this->dropCourseTables();
+
+        $this->createCourseTables($output, $dryRun);
+
+        if (!empty($courseList)) {
+
+            $output->writeln("<comment>Moving old course tables to the new structure 1: single database</comment>");
+
+            $progress = $this->getHelperSet()->get('progress');
+            $progress->start($output, count($courseList));
+
+            foreach ($courseList as $row_course) {
+
+                $prefix = $this->getTablePrefix($_configuration, $row_course['db_name']);
+
+                // Course tables to be migrated.
+                $table_list = array(
+                    'announcement',
+                    'announcement_attachment',
+                    'attendance',
+                    'attendance_calendar',
+                    'attendance_result',
+                    'attendance_sheet',
+                    'attendance_sheet_log',
+                    'blog',
+                    'blog_attachment',
+                    'blog_comment',
+                    'blog_post',
+                    'blog_rating',
+                    'blog_rel_user',
+                    'blog_task',
+                    'blog_task_rel_user',
+                    'calendar_event',
+                    'calendar_event_attachment',
+                    'calendar_event_repeat',
+                    'calendar_event_repeat_not',
+                    'chat_connected',
+                    'course_description',
+                    'course_setting',
+                    'document',
+                    'dropbox_category',
+                    'dropbox_feedback',
+                    'dropbox_file',
+                    'dropbox_person',
+                    'dropbox_post',
+                    'forum_attachment',
+                    'forum_category',
+                    'forum_forum',
+                    'forum_mailcue',
+                    'forum_notification',
+                    'forum_post',
+                    'forum_thread',
+                    'forum_thread_qualify',
+                    'forum_thread_qualify_log',
+                    'glossary',
+                    'group_category',
+                    'group_info',
+                    'group_rel_tutor',
+                    'group_rel_user',
+                    'item_property',
+                    'link',
+                    'link_category',
+                    'lp',
+                    'lp_item',
+                    'lp_item_view',
+                    'lp_iv_interaction',
+                    'lp_iv_objective',
+                    'lp_view',
+                    'notebook',
+                    'metadata',
+                    'online_connected',
+                    'online_link',
+                    'permission_group',
+                    'permission_task',
+                    'permission_user',
+                    'quiz',
+                    'quiz_answer',
+                    'quiz_question',
+                    'quiz_question_option',
+                    'quiz_rel_question',
+                    'resource',
+                    'role',
+                    'role_group',
+                    'role_permissions',
+                    'role_user',
+                    'student_publication',
+                    'student_publication_assignment',
+                    'survey',
+                    'survey_answer',
+                    'survey_group',
+                    'survey_invitation',
+                    'survey_question',
+                    'survey_question_option',
+                    'thematic',
+                    'thematic_advance',
+                    'thematic_plan',
+                    'tool',
+                    'tool_intro',
+                    'userinfo_content',
+                    'userinfo_def',
+                    'wiki',
+                    'wiki_conf',
+                    'wiki_discuss',
+                    'wiki_mailcue'
+                );
+
+                $output->writeln('');
+                $output->writeln('Course DB: '.$row_course['db_name']);
+
+                $courseConnection = null;
+                foreach ($courseDatabaseConnectionList as $database) {
+                    if ($database['database'] == '_chamilo_course_'.$row_course['db_name']) {
+                        /** @var \Doctrine\DBAL\Connection $courseConnection */
+                        $courseConnection = $this->getHelper($database['database'])->getConnection();
+                    }
+                }
+
+                if (empty($courseConnection)) {
+                    $output->writeln("<info> We can't established a DB connection for this course: ".$row_course['db_name']);
+                }
+
+                foreach ($table_list as $table) {
+                    $old_table = $prefix.$table;
+
+                    $course_id = $row_course['id'];
+                    $new_table = DB_COURSE_PREFIX.$table;
+
+                    $sm = $courseConnection->getSchemaManager();
+                    $tableExists = $sm->tablesExist($old_table);
+
+                    if ($tableExists) {
+                        $sql 	= "SELECT count(*) as count FROM $old_table";
+                        $result = $courseConnection->executeQuery($sql);
+
+                        $old_count = 0;
+                        if ($result) {
+                            $row = $result->fetch();
+                            $old_count = $row['count'];
+                            // $output->writeln("Count(*) in table $old_table: $old_count");
+                        } else {
+                            $output->writeln("Count(*) in table $old_table failed");
+                        }
+
+                        $sql = "SELECT * FROM $old_table";
+                        $result = $courseConnection->executeQuery($sql);
+                        $rows = $result->fetchAll();
+
+                        $count = 0;
+                        foreach ($rows as $row) {
+                            $row['c_id'] = $course_id;
+
+                            if ($dryRun) {
+                                $id = 1;
+                            } else {
+                                $mainConnection->insert($new_table, $row);
+                                $id = $mainConnection->lastInsertId();
+                            }
+
+                            if (is_numeric($id)) {
+                                $count++;
+                            } else {
+                                $errors[$old_table][] = $row;
+                            }
+                        }
+
+                        if ($dryRun) {
+                            $output->writeln("$count/$old_count rows to be inserted in $new_table");
+                        } else {
+                            $output->writeln("$count/$old_count rows inserted in $new_table");
+                        }
+
+                        if ($old_count != $count) {
+                            $output->writeln("<error>Count of new and old table doesn't match: $old_count - $new_table</error>");
+                            $output->writeln("<comment>Check the results:</comment>");
+                            //$output->writeln(print_r($errors, 1));
+                        }
+                    } else {
+                        $output->writeln("<comment>Seems that the table $old_table doesn't exists</comment>");
+                    }
+                }
+                $progress->advance();
+            }
+
+            $progress->finish();
+            $output->writeln("<comment>End course migration</comment>");
+
+
+            /* Start work fix */
+            $output->writeln("<comment>Starting work fix:</comment>");
+
+            /* Fixes the work subfolder and work with no parent issues */
+
+            $work_table = "c_student_publication";
+            $item_table = "c_item_property";
+
+            $sys_course_path = $this->getCourseSysPath();
+
+            $today = time();
+            $user_id = 1;
+
+            if ($dryRun == false) {
+
+                foreach ($courseList as $course) {
+                    $courseId = $course['id']; //int id
+
+                    //1. Searching for works with no parents
+                    $sql 	= "SELECT * FROM $work_table WHERE parent_id = 0 AND filetype ='file' AND c_id = $courseId ";
+                    $result = $mainConnection->executeQuery($sql);
+                    $work_list = $result->fetchAll();
+
+                    $course_dir 		= $sys_course_path.$course['directory'];
+                    $base_work_dir 		= $course_dir.'/work';
+
+                    //2. Looping if there are works with no parents
+                    if (!empty($work_list)) {
+                        $work_dir_created = array();
+
+                        foreach ($work_list as $work) {
+                            $session_id = intval($work['session_id']);
+                            $group_id   = intval($work['post_group_id']);
+                            $work_key   = $session_id.$group_id;
+
+                            $dir_name = "default_tasks_".$group_id."_".$session_id;
+
+                            // Only create the folder once
+                            if (!isset($work_dir_created[$work_key])) {
+                                //2.1 Creating a new work folder
+                                $sql = "INSERT INTO $work_table SET
+                                        c_id                = '$courseId',
+                                        url         		= 'work/".$dir_name."',
+                                        title               = 'Tasks',
+                                        description 		= '',
+                                        author      		= '',
+                                        active              = '1',
+                                        accepted			= '1',
+                                        filetype            = 'folder',
+                                        post_group_id       = '$group_id',
+                                        sent_date           = '".$today."',
+                                        parent_id           = '0',
+                                        qualificator_id     = '',
+                                        user_id 			= '".$user_id."'";
+                                $mainConnection->executeQuery($sql);
+                                $id  = $mainConnection->lastInsertId();
+
+                                //2.2 Adding the folder in item property
+                                if ($id) {
+                                    $sql = "INSERT INTO $item_table (c_id, tool, ref, insert_date, insert_user_id, lastedit_date, lastedit_type, lastedit_user_id, to_group_id, visibility, id_session)
+                                            VALUES ('$courseId', 'work','$id','$today', '$user_id', '$today', 'DirectoryCreated','$user_id', '$group_id', '1', '$session_id')";
+
+                                    $mainConnection->executeQuery($sql);
+                                    $work_dir_created[$work_key] = $id;
+                                    create_unexisting_work_directory($base_work_dir, $dir_name, $portalSettings);
+                                    $final_dir = $base_work_dir.'/'.$dir_name;
+                                }
+                            } else {
+                                $final_dir = $base_work_dir.'/'.$dir_name;
+                            }
+
+                            // 2.3 Updating the url
+                            if (!empty($work_dir_created[$work_key])) {
+                                $parent_id = $work_dir_created[$work_key];
+                                $new_url = "work/".$dir_name.'/'.basename($work['url']);
+                                $new_url = Database::escape_string($new_url);
+                                $sql = "UPDATE $work_table SET url = '$new_url', parent_id = $parent_id, contains_file = '1' WHERE id = {$work['id']} AND c_id = $courseId";
+                                $mainConnection->executeQuery($sql);
+                                if (is_dir($final_dir)) {
+                                    rename($course_dir.'/'.$work['url'], $course_dir.'/'.$new_url);
+                                }
+                            }
+                        }
+                    }
+
+                    // 3.0 Moving subfolders to the root.
+                    $sql 	= "SELECT * FROM $work_table WHERE parent_id <> 0 AND filetype ='folder' AND c_id = $courseId";
+                    $result = $mainConnection->executeQuery($sql);
+                    $work_list = $result->fetchAll();
+
+                    if (!empty($work_list)) {
+                        foreach ($work_list as $work_folder) {
+                            $folder_id = $work_folder['id'];
+                            check_work($mainConnection, $folder_id, $work_folder['url'], $work_table, $base_work_dir, $courseId);
+                        }
+                    }
+                }
+            }
+            $output->writeln("<comment>End work fix</comment>");
+            if ($dryRun) {
+                $output->writeln('<info>Queries were not executed. Because dry-run is on<info>');
+
+            } else {
+                $mainConnection->commit();
+            }
+        }
+    } catch (Exception $e) {
+        $mainConnection->rollback();
+        throw $e;
+    }
+};
+
+/**
+ * @param $mainConnection
+ * @param $folder_id
+ * @param $work_url
+ * @param $work_table
+ * @param $base_work_dir
+ * @param $courseId
+ */
+function check_work($mainConnection, $folder_id, $work_url, $work_table, $base_work_dir, $courseId)
+{
+    $uniq_id = uniqid();
+    //Looking for subfolders
+    $sql 	= "SELECT * FROM $work_table WHERE parent_id = $folder_id AND filetype ='folder' AND c_id = $courseId";
+    $result = $mainConnection->executeQuery($sql);
+    $rows = $result->fetchAll();
+
+    if (!empty($rows)) {
+        foreach ($rows as $row) {
+            check_work($mainConnection, $row['id'], $row['url'], $work_table, $base_work_dir, $courseId);
+        }
+    }
+
+    // Moving the subfolder in the root.
+    $new_url = '/'.basename($work_url).'_mv_'.$uniq_id;
+    $new_url = Database::escape_string($new_url);
+    $sql = "UPDATE $work_table SET url = '$new_url', parent_id = 0 WHERE id = $folder_id AND c_id = $courseId";
+    $mainConnection->executeQuery($sql);
+
+    if (is_dir($base_work_dir.$work_url)) {
+        rename($base_work_dir.$work_url, $base_work_dir.$new_url);
+
+        //Rename all files inside the folder
+        $sql 	= "SELECT * FROM $work_table WHERE parent_id = $folder_id AND filetype ='file' AND c_id = $courseId";
+        $result = $mainConnection->executeQuery($sql);
+        $rows = $result->fetchAll();
+
+        if (!empty($rows)) {
+            foreach ($rows as $row) {
+                $new_url = "work".$new_url.'/'.basename($row['url']);
+                $new_url = Database::escape_string($new_url);
+                $sql = "UPDATE $work_table
+                        SET url = '$new_url', parent_id = $folder_id, contains_file = '1'
+                        WHERE id = {$row['id']} AND c_id = $courseId";
+                $mainConnection->executeQuery($sql);
+            }
+        }
+    }
+}
+
+
+function create_unexisting_work_directory($base_work_dir, $desired_dir_name, $portalSettings)
+{
+    $nb = '';
+    $base_work_dir = (substr($base_work_dir, -1, 1) == '/' ? $base_work_dir : $base_work_dir.'/');
+    while (file_exists($base_work_dir.$desired_dir_name.$nb)) {
+        $nb += 1;
+    }
+    if (mkdir($base_work_dir.$desired_dir_name.$nb, $portalSettings['permissions_for_new_directories'])) {
+        return $desired_dir_name.$nb;
+    } else {
+        return false;
+    }
+}

+ 8 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.9.0/update-files-1.8.8-1.9.0.inc.php

@@ -0,0 +1,8 @@
+<?php
+
+/* For licensing terms, see /license.txt */
+
+$updateFiles = function($_configuration, $mainConnection, $courseList, $dryRun, $output)
+{
+    $this->generateConfFiles($output);
+};

+ 157 - 0
vendor/chamilo/chash/tests/Chash/Resources/configuration.php

@@ -0,0 +1,157 @@
+<?php
+// Chamilo version 1.10.0
+// File generated by /install/index.php script - {DATE_GENERATED}
+/* For licensing terms, see /license.txt */
+/**
+ *		Chamilo configuration
+ *
+ * This file contains a list of variables that can be modified by the campus
+ * site's server administrator. Pay attention when changing these variables,
+ * some changes may cause Chamilo to stop working.
+ * If you changed some settings and want to restore them, please have a look at
+ * configuration.dist.php. That file is an exact copy of the config file at
+ * install time.
+ */
+
+/**
+ * $_configuration define only the bare essential variables
+ * for configuring the platform (paths, database connections, ...).
+ * Changing a $_configuration variable CAN generally break the installation.
+ * Besides the $_configuration, a $_settings array also exists, that
+ * contains variables that can be changed and will not break the platform.
+ * These optional settings are defined in the database, now (table settings_current).
+ */
+
+/**
+ * Database settings
+ */
+// Host.
+$_configuration['db_host']     = 'localhost';
+// Username.
+$_configuration['db_user']     = 'root';
+// Password.
+$_configuration['db_password'] = 'root';
+// Driver.
+$_configuration['db_driver']   = 'pdo_mysql';
+// Database name.
+$_configuration['main_database'] = 'chamilo';
+
+/** Directory settings */
+// URL to the root of your Chamilo installation, e.g.: http://www.mychamilo.com/
+$_configuration['root_web']    = 'http://localhost/';
+
+/** Chamilo will automatically manage all this paths */
+
+// Path to the webroot of system, example: /var/www/chamilo
+//$_configuration['root_sys'] = '/var/www/chamilogits/';
+
+// Path to the data folder, example /var/www/chamilo/data
+//$_configuration['sys_data_path'] = null;
+
+// Path to the config folder, example /var/www/chamilo/config
+//$_configuration['sys_config_path'] = null;
+
+// Path to the temp folder, example /var/www/chamilo/temp
+//$_configuration['sys_temp_path'] = null;
+
+// Path to the logs folder, example /var/www/chamilo/logs
+//$_configuration['sys_log_path'] = null;
+
+// URL to your phpMyAdmin installation.
+// If not empty, a link will be available in the Platform Administration
+$_configuration['db_admin_path']  = '';
+
+/** Login modules settings */
+// CAS IMPLEMENTATION
+// -> Go to your portal Chamilo > Administration > CAS to activate CAS
+// You can leave these lines uncommented even if you don't use CAS authentification
+//$extAuthSource["cas"]["login"] = $_configuration['root_sys'].$_configuration['code_append']."auth/cas/login.php";
+//$extAuthSource["cas"]["newUser"] = $_configuration['root_sys'].$_configuration['code_append']."auth/cas/newUser.php";
+//
+// NEW LDAP IMPLEMENTATION BASED ON external_login info
+// -> Uncomment the two lines bellow to activate LDAP AND edit main/auth/external_login/ldap.conf.php for configuration
+// $extAuthSource["extldap"]["login"] = $_configuration['root_sys'].$_configuration['code_append']."auth/external_login/login.ldap.php";
+// $extAuthSource["extldap"]["newUser"] = $_configuration['root_sys'].$_configuration['code_append']."auth/external_login/newUser.ldap.php";
+//
+// FACEBOOK IMPLEMENTATION BASED ON external_login info
+// -> Uncomment the line bellow to activate Facebook Auth AND edit main/auth/external_login/ldap.conf.php for configuration
+// $_configuration['facebook_auth'] = 1;
+//
+// OTHER EXTERNAL LOGIN INFORMATION
+// To fetch external login information, uncomment those 2 lines and modify  files auth/external_login/newUser.php and auth/external_login/updateUser.php files
+// $extAuthSource["external_login"]["newUser"] = $_configuration['root_sys'].$_configuration['code_append']."auth/external_login/newUser.php";
+// $extAuthSource["external_login"]["updateUser"] = $_configuration['root_sys'].$_configuration['code_append']."auth/external_login/updateUser.php";
+
+/**
+ *
+ * Hosting settings - Allows you to set limits to the Chamilo portal when
+ * hosting it for a third party. These settings can be overwritten by an
+ * optionally-loaded extension file with only the settings (no comments).
+ * The settings use an index at the first level to represent the ID of the
+ * URL in case you use multi-url (otherwise it will always use 1, which is
+ * the ID of the only URL inside the access_url table).
+ */
+// Set a maximum number of users. Default (0) = no limit
+$_configuration[1]['hosting_limit_users'] = 0;
+// Set a maximum number of teachers. Default (0) = no limit
+$_configuration[1]['hosting_limit_teachers'] = 0;
+// Set a maximum number of courses. Default (0) = no limit
+$_configuration[1]['hosting_limit_courses'] = 0;
+// Set a maximum number of sessions. Default (0) = no limit
+$_configuration[1]['hosting_limit_sessions'] = 0;
+// Set a maximum disk space used, in MB (set to 1024 for 1GB, 5120 for 5GB).
+// Default (0) = no limit
+$_configuration[1]['hosting_limit_disk_space'] = 0;
+
+/**
+ * Content Delivery Network (CDN) settings. Only use if you need a separate
+ * server to serve your static data. If you don't know what a CDN is, you
+ * don't need it. These settings are for simple Origin Pull CDNs and are
+ * experimental. Enable only if you really know what you're doing.
+ * This might conflict with multiple-access urls.
+ */
+// Set the following setting to true to start using the CDN
+$_configuration['cdn_enable'] = false;
+// The following setting will be ignored if the previous one is set to false
+$_configuration['cdn'] = array(
+    //You can define several CDNs and split them by extensions
+    //Replace the following by your full CDN URL, which should point to
+    // your Chamilo's root directory. DO NOT INCLUDE a final slash! (won't work)
+    'http://cdn.chamilo.org' => array('.css','.js','.jpg','.jpeg','.png','.gif','.avi','.flv'),
+    // copy the line above and modify following your needs
+);
+
+/**
+ * Session settings
+ */
+// You may have to restart your web server if you change this.
+$_configuration['session_stored_in_db'] = false;
+// Session lifetime
+$_configuration['session_lifetime'] = 3600;
+
+/** Security */
+// Security word for password recovery.
+$_configuration['security_key'] = '4be30aa1bce787e865165baa19bd7a71';
+// Hash function method.
+$_configuration['password_encryption'] = 'sha1';
+//Deny the elimination of users.
+$_configuration['deny_delete_users'] = false;
+//Prevent all admins from using the "login_as" feature.
+$_configuration['login_as_forbidden_globally'] = false;
+
+/** Multiple URL */
+// Activation for multi-url access.
+//$_configuration['multiple_access_urls'] = true;
+
+/** Chamilo version settings */
+$_configuration['system_version']    = '1.10.0';
+$_configuration['system_stable']     = true;
+$_configuration['software_name']     = 'Chamilo';
+$_configuration['software_url']	     = 'http://www.chamilo.org/';
+
+/** Chamilo dev settings */
+// Generate twig templates in every request, prompts SQL errors.
+$_configuration['debug']             = false;
+$_configuration['platform_charset']  = 'utf-8';
+// Show a useful toolbar with memory used, loaded time, request, session, logs information.
+$_configuration['show_profiler']     = false;

+ 13 - 0
vendor/chamilo/chash/tests/Chash/Tests/Command/Database/DropDatabaseCommandTest.php

@@ -0,0 +1,13 @@
+<?php
+
+use Symfony\Component\Console\Application;
+use Symfony\Component\Console\Tester\CommandTester;
+
+class DropDatabaseCommandTest extends PHPUnit_Framework_TestCase
+{
+
+    public function testExecute()
+    {
+
+    }
+}

+ 60 - 0
vendor/chamilo/chash/tests/Chash/Tests/ConsoleTest.php

@@ -0,0 +1,60 @@
+<?php
+
+use Symfony\Component\Console\Application;
+use Symfony\Component\Console\Tester\CommandTester;
+use Chash\Command\Files\CleanConfigFilesCommand;
+
+class ConsoleTest extends PHPUnit_Framework_TestCase
+{
+
+    public function setUp()
+    {
+        $configurationFileContent = file_get_contents(__DIR__.'/../Resources/configuration.php');
+        vfsStreamWrapper::register();
+        $structure = array(
+            'chamilo' => array(
+                'config' => array(
+                    'configuration.php' => $configurationFileContent,
+                ),
+                'tests' => array(),
+                'data' => array('courses')
+            )
+        );
+        vfsStream::setup('root', null, $structure);
+
+    }
+
+    public function testListCommand()
+    {
+        $application = new Application();
+
+        $helpers = array(
+            'configuration' => new Chash\Helpers\ConfigurationHelper()
+        );
+
+        $helperSet = $application->getHelperSet();
+        foreach ($helpers as $name => $helper) {
+            $helperSet->set($helper, $name);
+        }
+
+        $application->add(new CleanConfigFilesCommand());
+
+        $command = $application->find('files:clean_config_files');
+        $this->assertEquals('Chash\Command\Files\CleanConfigFilesCommand', get_class($command));
+
+/*        $commandTester = new CommandTester($command);
+        $returnCode = $commandTester->execute(
+            array(
+                'command' => $command->getName(),
+                '--conf' => 'chamilo/config/configuration.php'
+            )
+        );*/
+
+
+
+//        var_dump(realpath(__DIR__.'/../../Resources/configuration.php'));
+
+  //      $this->assertRegExp('/11/', $commandTester->getDisplay());
+
+    }
+}

+ 26 - 0
vendor/chamilo/chash/tests/Chash/Tests/Helpers/ConfigurationHelperTest.php

@@ -0,0 +1,26 @@
+<?php
+require_once 'vfsStream/vfsStream.php';
+
+use Chash\Helpers\ConfigurationHelper;
+
+/**
+ * Class ConfigurationHelper
+ * @package Chash\Helpers
+ */
+class ConfigurationHelperTest extends PHPUnit_Framework_TestCase
+{
+
+    public function setUp()
+    {
+        vfsStreamWrapper::register();
+        vfsStreamWrapper::setRoot(new vfsStreamDirectory('chamilo'));
+
+    }
+
+    public function testGetConfigurationPath()
+    {
+        $configHelper = new ConfigurationHelper();
+        $configHelper->getConfigurationPath('/var/www/chamilo');
+
+    }
+}

+ 4 - 0
vendor/chamilo/chash/tests/bootstrap.php

@@ -0,0 +1,4 @@
+<?php
+
+$loader = require __DIR__.'/../vendor/autoload.php';
+$loader->add('Chash\Tests', __DIR__);

+ 3 - 3
vendor/composer/autoload_real.php

@@ -2,7 +2,7 @@
 
 // autoload_real.php generated by Composer
 
-class ComposerAutoloaderInit04054f5771fc86b66811cd02790585bf
+class ComposerAutoloaderInit3e8478efc6b09559648c9a999e20ca67
 {
     private static $loader;
 
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit04054f5771fc86b66811cd02790585bf
             return self::$loader;
         }
 
-        spl_autoload_register(array('ComposerAutoloaderInit04054f5771fc86b66811cd02790585bf', 'loadClassLoader'), true, true);
+        spl_autoload_register(array('ComposerAutoloaderInit3e8478efc6b09559648c9a999e20ca67', 'loadClassLoader'), true, true);
         self::$loader = $loader = new \Composer\Autoload\ClassLoader();
-        spl_autoload_unregister(array('ComposerAutoloaderInit04054f5771fc86b66811cd02790585bf', 'loadClassLoader'));
+        spl_autoload_unregister(array('ComposerAutoloaderInit3e8478efc6b09559648c9a999e20ca67', 'loadClassLoader'));
 
         $vendorDir = dirname(__DIR__);
         $baseDir = dirname($vendorDir);