Merge with 1.10

skala
Julio Montoya 12 years ago
commit 3ca969f130
  1. 376
      main/admin/index.php
  2. 4
      main/admin/user_add.php
  3. 7
      main/inc/lib/api.lib.php
  4. 14
      main/inc/lib/page.lib.php
  5. 161
      main/inc/lib/sessionmanager.lib.php
  6. 5
      main/inc/lib/template.lib.php
  7. 31
      main/inc/lib/usermanager.lib.php
  8. 25
      main/session/add_users_to_session.php
  9. 22
      main/session/example_session.csv
  10. 12
      main/session/session_course_user_list.php
  11. 278
      main/session/session_import.php
  12. 80
      main/template/default/admin/administrator/index.tpl
  13. 56
      main/template/default/admin/settings_index.tpl
  14. 252
      src/ChamiloLMS/Controller/Admin/AdministratorController.php
  15. 14
      tests/datafiller/data_users.php
  16. 4
      vendor/chamilo/chash/src/Chash/Command/Installation/CommonCommand.php
  17. 14
      vendor/chamilo/chash/src/Chash/Command/Installation/UpgradeCommand.php
  18. 4
      vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/db_main.sql
  19. 175
      vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/migrate-db-1.9.0-1.10.0-pre.sql
  20. 76
      vendor/chamilo/chash/src/Chash/Resources/Database/1.8.8/migrate-db-1.8.7-1.8.8-pre.sql
  21. 364
      vendor/chamilo/chash/src/Chash/Resources/Database/1.9.0/migrate-db-1.8.8-1.9.0-pre.sql

@ -1,374 +1,4 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Index page of the admin tools
* @package chamilo.admin
*/
/**
* Code
*/
// Language files that need to be included.
$language_file = array('admin', 'tracking','coursebackup');
// Setting the section (for the tabs).
$this_section = SECTION_PLATFORM_ADMIN;
// Access restrictions.
api_protect_admin_script(true);
$nameTools = get_lang('PlatformAdmin');
// Displaying the header
$message = '';
if (api_is_platform_admin()) {
if (is_dir(api_get_path(SYS_CODE_PATH).'install/') && is_readable(api_get_path(SYS_CODE_PATH).'install/index.php')) {
$message = Display::return_message(get_lang('InstallDirAccessibleSecurityThreat'), 'warning');
}
if (is_dir(api_get_path(SYS_ARCHIVE_PATH)) && !is_writable(api_get_path(SYS_ARCHIVE_PATH))) {
$message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'), 'warning');
}
/* ACTION HANDLING */
if (!empty($_POST['Register'])) {
register_site();
$message = Display::return_message(get_lang('VersionCheckEnabled'), 'confirmation');
}
$keyword_url = Security::remove_XSS((empty($_GET['keyword']) ? '' : $_GET['keyword']));
}
if (isset($_GET['msg']) && isset($_GET['type'])) {
if (in_array($_GET['msg'], array('ArchiveDirCleanupSucceeded', 'ArchiveDirCleanupFailed'))) {
switch($_GET['type']) {
case 'error':
$message = Display::return_message(get_lang($_GET['msg']), 'error');
break;
case 'confirmation':
$message = Display::return_message(get_lang($_GET['msg']), 'confirm');
}
}
}
$blocks = array();
/* Users */
$blocks['users']['icon'] = Display::return_icon('members.gif', get_lang('Users'), array(), ICON_SIZE_SMALL, false);
$blocks['users']['label'] = api_ucfirst(get_lang('Users'));
if (api_is_platform_admin()) {
$search_form = ' <form method="get" class="form-search" action="user_list.php">
<input class="span3" type="text" name="keyword" value="">
<button class="btn" type="submit">'.get_lang('Search').'</button>
</form>';
$blocks['users']['search_form'] = $search_form;
$items = array(
array('url'=>'user_list.php', 'label' => get_lang('UserList')),
array('url'=>'user_add.php', 'label' => get_lang('AddUsers')),
array('url'=>'user_export.php', 'label' => get_lang('ExportUserListXMLCSV')),
array('url'=>'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')),
);
if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
$items[] = array('url'=>'ldap_users_list.php', 'label' => get_lang('ImportLDAPUsersIntoPlatform'));
}
$items[] = array('url'=>'extra_fields.php?type=user', 'label' => get_lang('ManageUserFields'));
$items[] = array('url'=> api_get_path(WEB_PUBLIC_PATH).'admin/administrator/roles', 'label' => get_lang('Roles'));
} else {
$items = array(
array('url'=>'user_list.php', 'label' => get_lang('UserList')),
array('url'=>'user_add.php', 'label' => get_lang('AddUsers')),
array('url'=>'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')),
);
}
$blocks['users']['items'] = $items;
$blocks['users']['extra'] = null;
if (api_is_platform_admin()) {
/* Courses */
$blocks['courses']['icon'] = Display::return_icon('course.gif', get_lang('Courses'), array(), ICON_SIZE_MEDIUM, false);
$blocks['courses']['label'] = api_ucfirst(get_lang('Courses'));
$search_form = ' <form method="get" class="form-search" action="course_list.php">
<input class="span3" type="text" name="keyword" value="">
<button class="btn" type="submit">'.get_lang('Search').'</button>
</form>';
$blocks['courses']['search_form'] = $search_form;
$items = array();
$items[] = array('url'=>'course_list.php', 'label' => get_lang('CourseList'));
if (api_get_setting('course_validation') != 'true') {
$items[] = array('url'=>'course_add.php', 'label' => get_lang('AddCourse'));
} else {
$items[] = array('url'=>'course_request_review.php', 'label' => get_lang('ReviewCourseRequests'));
$items[] = array('url'=>'course_request_accepted.php', 'label' => get_lang('AcceptedCourseRequests'));
$items[] = array('url'=>'course_request_rejected.php', 'label' => get_lang('RejectedCourseRequests'));
}
$items[] = array('url'=>'course_export.php', 'label' => get_lang('ExportCourses'));
$items[] = array('url'=>'course_import.php', 'label' => get_lang('ImportCourses'));
$items[] = array('url'=>'course_category.php', 'label' => get_lang('AdminCategories'));
$items[] = array('url'=>'subscribe_user2course.php', 'label' => get_lang('AddUsersToACourse'));
$items[] = array('url'=>'course_user_import.php', 'label' => get_lang('ImportUsersToACourse'));
$items[] = array('url'=>'extra_fields.php?type=course', 'label' => get_lang('ManageCourseFields'));
$items[] = array('url'=>'extra_fields.php?type=question', 'label' => get_lang('ManageQuestionFields'));
if (api_get_setting('gradebook_enable_grade_model') == 'true') {
$items[] = array('url'=>'grade_models.php', 'label' => get_lang('GradeModel'));
}
if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
$items[] = array('url'=>'ldap_import_students.php', 'label' => get_lang('ImportLDAPUsersIntoCourse'));
}
$blocks['courses']['items'] = $items;
$blocks['courses']['extra'] = null;
/* Platform */
$blocks['platform']['icon'] = Display::return_icon('platform.png', get_lang('Platform'), array(), ICON_SIZE_MEDIUM, false);
$blocks['platform']['label'] = api_ucfirst(get_lang('Platform'));
$search_form = ' <form method="get" action="settings.php" class="form-search">
<input class="span3" type="text" name="search_field" value="" >
<input type="hidden" value="search_setting" name="category">
<button class="btn" type="submit">'.get_lang('Search').'</button>
</form>';
$blocks['platform']['search_form'] = $search_form;
$items = array();
$items[] = array('url'=>'settings.php', 'label' => get_lang('PlatformConfigSettings'));
$items[] = array('url'=>'settings.php?category=Plugins','label' => get_lang('Plugins'));
$items[] = array('url'=>'settings.php?category=Regions','label' => get_lang('Regions'));
$items[] = array('url'=>'system_announcements.php', 'label' => get_lang('SystemAnnouncements'));
$items[] = array('url'=> api_get_path(WEB_CODE_PATH).'calendar/agenda_js.php?type=admin', 'label' => get_lang('GlobalAgenda'));
$items[] = array('url'=>'configure_homepage.php', 'label' => get_lang('ConfigureHomePage'));
$items[] = array('url'=>'configure_inscription.php', 'label' => get_lang('ConfigureInscription'));
$items[] = array('url'=>'statistics/index.php', 'label' => get_lang('Statistics'));
$items[] = array('url'=> api_get_path(WEB_CODE_PATH).'mySpace/company_reports.php', 'label' => get_lang('Reports'));
/* Event settings */
if (api_get_setting('activate_email_template') == 'true') {
$items[] = array('url'=>'event_controller.php?action=listing', 'label' => get_lang('EventMessageManagement'));
}
if (api_get_multiple_access_url()) {
if (api_is_global_platform_admin()) {
$items[] = array('url'=>'access_urls.php', 'label' => get_lang('ConfigureMultipleAccessURLs'));
}
}
if (api_get_setting('allow_reservation') == 'true') {
$items[] = array('url'=>'../reservation/m_category.php', 'label' => get_lang('BookingSystem'));
}
if (api_get_setting('allow_terms_conditions') == 'true') {
$items[] = array('url'=>'legal_add.php', 'label' => get_lang('TermsAndConditions'));
}
$blocks['platform']['items'] = $items;
$blocks['platform']['extra'] = null;
}
/* Sessions */
$blocks['sessions']['icon'] = Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL, false);
$blocks['sessions']['label'] = api_ucfirst(get_lang('Sessions'));
$search_form = ' <form method="GET" class="form-search" action="'.api_get_path(WEB_CODE_PATH).'session/session_list.php">
<input class="span3" type="text" name="keyword" value="">
<button class="btn" type="submit">'.get_lang('Search').'</button>
</form>';
$blocks['sessions']['search_form'] = $search_form;
$items = array();
$items[] = array('url'=> api_get_path(WEB_CODE_PATH).'session/session_list.php', 'label' => get_lang('ListSession'));
$items[] = array('url'=> api_get_path(WEB_CODE_PATH).'session/session_add.php', 'label' => get_lang('AddSession'));
$items[] = array('url'=> 'session_category_list.php', 'label' => get_lang('ListSessionCategory'));
$items[] = array('url'=> api_get_path(WEB_CODE_PATH).'session/session_import.php', 'label' => get_lang('ImportSessionListXMLCSV'));
if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
$items[] = array('url'=>'ldap_import_students_to_session.php', 'label' => get_lang('ImportLDAPUsersIntoSession'));
}
$items[] = array('url'=>api_get_path(WEB_CODE_PATH).'session/session_export.php', 'label' => get_lang('ExportSessionListXMLCSV'));
$items[] = array('url'=>'../coursecopy/copy_course_session.php', 'label' => get_lang('CopyFromCourseInSessionToAnotherSession'));
if (api_is_platform_admin()) {
if (is_dir(api_get_path(SYS_TEST_PATH).'datafiller/')) { // option only visible in development mode. Enable through code if required
$items[] = array('url'=>'user_move_stats.php', 'label' => get_lang('MoveUserStats'));
}
$items[] = array('url'=>'career_dashboard.php', 'label' => get_lang('CareersAndPromotions'));
}
$items[] = array('url'=>'usergroups.php', 'label' => get_lang('Classes'));
$items[] = array('url'=> 'exercise_report.php', 'label' => get_lang('ExerciseReport'));
$items[] = array('url'=>'extra_fields.php?type=session', 'label' => get_lang('ManageSessionFields'));
$blocks['sessions']['items'] = $items;
$blocks['sessions']['extra'] = null;
/* Settings */
if (api_is_platform_admin()) {
$blocks['settings']['icon'] = Display::return_icon('settings.png', get_lang('System'), array(), ICON_SIZE_SMALL, false);
$blocks['settings']['label'] = api_ucfirst(get_lang('System'));
$items = array();
$items[] = array('url'=>'special_exports.php', 'label' => get_lang('SpecialExports'));
if (!empty($_configuration['db_admin_path'])) {
$items[] = array('url'=>$_configuration['db_admin_path'], 'label' => get_lang('AdminDatabases').' ('.get_lang('DBManagementOnlyForServerAdmin').') ');
}
$items[] = array('url'=>'system_status.php', 'label' => get_lang('SystemStatus'));
if (is_dir(api_get_path(SYS_TEST_PATH).'datafiller/')) {
$items[] = array('url'=>'filler.php', 'label' => get_lang('DataFiller'));
}
$items[] = array('url'=>'archive_cleanup.php', 'label' => get_lang('ArchiveDirCleanup'));
$items[] = array('url'=>'system_management.php', 'label' => get_lang('SystemManagement'));
$blocks['settings']['items'] = $items;
$blocks['settings']['extra'] = null;
$blocks['settings']['search_form'] = null;
//Skills
if (api_get_setting('allow_skills_tool') == 'true') {
$blocks['skills']['icon'] = Display::return_icon('logo.png', get_lang('Skills'), array(), ICON_SIZE_SMALL, false);
$blocks['skills']['label'] = get_lang('Skills');
$items = array();
//$items[] = array('url'=>'skills.php', 'label' => get_lang('SkillsTree'));
$items[] = array('url'=>'skills_wheel.php', 'label' => get_lang('SkillsWheel'));
$items[] = array('url'=>'skills_import.php', 'label' => get_lang('SkillsImport'));
//$items[] = array('url'=>'skills_profile.php', 'label' => get_lang('SkillsProfile'));
$items[] = array('url'=>api_get_path(WEB_CODE_PATH).'social/skills_ranking.php', 'label' => get_lang('SkillsRanking'));
$items[] = array('url'=>'skills_gradebook.php', 'label' => get_lang('SkillsAndGradebooks'));
$blocks['skills']['items'] = $items;
$blocks['skills']['extra'] = null;
$blocks['skills']['search_form'] = null;
}
/** Chamilo.org */
$blocks['chamilo']['icon'] = Display::return_icon('logo.png', 'Chamilo.org', array(), ICON_SIZE_SMALL, false);
$blocks['chamilo']['label'] = 'Chamilo.org';
$items = array();
$items[] = array('url'=>'http://www.chamilo.org/', 'label' => get_lang('ChamiloHomepage'));
$items[] = array('url'=>'http://www.chamilo.org/forum', 'label' => get_lang('ChamiloForum'));
$items[] = array('url'=>'../../documentation/installation_guide.html', 'label' => get_lang('InstallationGuide'));
$items[] = array('url'=>'../../documentation/changelog.html', 'label' => get_lang('ChangesInLastVersion'));
$items[] = array('url'=>'../../documentation/credits.html', 'label' => get_lang('ContributorsList'));
$items[] = array('url'=>'../../documentation/security.html', 'label' => get_lang('SecurityGuide'));
$items[] = array('url'=>'../../documentation/optimization.html', 'label' => get_lang('OptimizationGuide'));
$items[] = array('url'=>'http://www.chamilo.org/extensions', 'label' => get_lang('ChamiloExtensions'));
$items[] = array('url'=>'http://www.chamilo.org/en/providers', 'label' => get_lang('ChamiloOfficialServicesProviders'));
$blocks['chamilo']['items'] = $items;
$blocks['chamilo']['extra'] = null;
$blocks['chamilo']['search_form'] = null;
// Try to display a maximum before we check the chamilo version and all that.
//session_write_close(); //close session to avoid blocking concurrent access
//flush(); //send data to client as much as allowed by the web server
//ob_flush();
//Version check
$blocks['version_check']['icon'] = Display::return_icon('logo.png', 'Chamilo.org', array(), ICON_SIZE_SMALL, false);
$blocks['version_check']['label'] = get_lang('VersionCheck');
$blocks['version_check']['extra'] = '<div class="admin-block-version"></div>';
$blocks['version_check']['search_form'] = null;
$blocks['version_check']['items'] = null;
//$blocks['version_check']['class'] = '';
}
$admin_ajax_url = api_get_path(WEB_AJAX_PATH).'admin.ajax.php';
$app['template']->assign('web_admin_ajax_url', $admin_ajax_url);
$app['template']->assign('blocks', $blocks);
$app['template']->display('default/admin/settings_index.tpl');
/**
* Displays either the text for the registration or the message that the installation is (not) up to date
*
* @return string html code
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version august 2006
* @todo have a 6monthly re-registration
*/
function version_check()
{
$tbl_settings = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
$sql = 'SELECT selected_value FROM '.$tbl_settings.' WHERE variable="registered" ';
$result = Database::query($sql);
$row = Database::fetch_array($result, 'ASSOC');
// The site has not been registered yet.
$return = '';
if ($row['selected_value'] == 'false') {
$return .= get_lang('VersionCheckExplanation');
$return .= '<form class="well" action="'.api_get_self().'" id="VersionCheck" name="VersionCheck" method="post">';
$return .= '<label class="checkbox"><input type="checkbox" name="donotlistcampus" value="1" id="checkbox" />'.get_lang('HideCampusFromPublicPlatformsList');
$return .= '</label><button type="submit" class="btn btn-primary" name="Register" value="'.get_lang('EnableVersionCheck').'" id="register" >'.get_lang('EnableVersionCheck').'</button>';
$return .= '</form>';
check_system_version();
} else {
// Site registered. Call anyway
$return .= check_system_version();
}
return $return;
}
/**
* Check if the current installation is up to date
* The code is borrowed from phpBB and slighlty modified
* @author The phpBB Group <support@phpbb.com> (the code)
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University (the modifications)
* @author Yannick Warnier <ywarnier@beeznest.org> for the move to HTTP request
* @copyright (C) 2001 The phpBB Group
* @return language string with some layout (color)
*/
function check_system_version()
{
global $_configuration;
$system_version = trim($_configuration['system_version']); // the chamilo version of your installation
if (ini_get('allow_url_fopen') == 1) {
// The number of courses
$number_of_courses = Statistics::count_courses();
// The number of users
$number_of_users = Statistics::count_users();
$number_of_active_users = Statistics::count_users(null, null, null,true);
$data = array(
'url' => api_get_path(WEB_PATH),
'campus' => api_get_setting('siteName'),
'contact' => api_get_setting('emailAdministrator'),
'version' => $system_version,
'numberofcourses' => $number_of_courses,
'numberofusers' => $number_of_users,
'numberofactiveusers' => $number_of_active_users,
//The donotlistcampus setting recovery should be improved to make
// it true by default - this does not affect numbers counting
'donotlistcampus' => api_get_setting('donotlistcampus'),
'organisation' => api_get_setting('Institution'),
'language' => api_get_setting('platformLanguage'),
'adminname' => api_get_setting('administratorName').' '.api_get_setting('administratorSurname'),
);
$res = api_http_request('version.chamilo.org', 80, '/version.php', $data);
if ($res != 0) {
$version_info = $res;
if ($system_version != $version_info) {
$output = '<br /><span style="color:red">' . get_lang('YourVersionNotUpToDate') . '. '.get_lang('LatestVersionIs').' <b>Chamilo '.$version_info.'</b>. '.get_lang('YourVersionIs').' <b>Chamilo '.$system_version. '</b>. '.str_replace('http://www.chamilo.org', '<a href="http://www.chamilo.org">http://www.chamilo.org</a>', get_lang('PleaseVisitOurWebsite')).'</span>';
} else {
$output = '<br /><span style="color:green">'.get_lang('VersionUpToDate').': Chamilo '.$version_info.'</span>';
}
} else {
$output = '<span style="color:red">' . get_lang('ImpossibleToContactVersionServerPleaseTryAgain') . '</span>';
}
} else {
$output = '<span style="color:red">' . get_lang('AllowurlfopenIsSetToOff') . '</span>';
}
return $output;
}
$url = api_get_path(WEB_PUBLIC_PATH).'admin/administrator';
header('Location: '.$url);
exit;

@ -258,7 +258,7 @@ $(document).ready(function(){
// Set default values
$defaults['admin']['platform_admin'] = 0;
$defaults['mail']['send_mail'] = 1;
$defaults['mail']['send_mail'] = 0;
$defaults['password']['password_auto'] = 1;
$defaults['active'] = 1;
$defaults['expiration_date'] = array();
@ -408,4 +408,4 @@ $app['title'] = $tool_name;
$tpl = $app['template'];
$tpl->assign('message', $message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
$tpl->display_one_col_template();

@ -2059,7 +2059,8 @@ function api_get_session_date_validation($session_info, $course_code, $ignore_vi
* @param int session id
* @return int 0 = session still available, SESSION_VISIBLE_READ_ONLY = 1, SESSION_VISIBLE = 2, SESSION_INVISIBLE = 3
*/
function api_get_session_visibility($session_id, $course_code = null, $ignore_visibility_for_admins = true) {
function api_get_session_visibility($session_id, $course_code = null, $ignore_visibility_for_admins = true)
{
if (api_is_platform_admin()) {
if ($ignore_visibility_for_admins) {
@ -2074,7 +2075,7 @@ function api_get_session_visibility($session_id, $course_code = null, $ignore_vi
if (!empty($session_info)) {
$visibility = $session_info['visibility'];
//1. Checking session date validation
// 1. Checking session date validation
$date_validation = api_get_session_date_validation($session_info, $course_code, $ignore_visibility_for_admins);
if ($date_validation) {
@ -6988,8 +6989,6 @@ function api_is_profile_readable()
return isset($profileIsReadable) ? $profileIsReadable : true;
}
/**
* Function to make an HTTP request through fsockopen (specialised for GET)
* Derived from Jeremy Saintot: http://www.php.net/manual/en/function.fsockopen.php#101872

@ -1168,6 +1168,12 @@ class PageController
return $sessions_with_category;
}
/**
* @param int $user_id
* @param string $filter current|history
* @param int $page
* @return bool|null|string
*/
public function returnSessions($user_id, $filter, $page)
{
if (empty($user_id)) {
@ -1188,12 +1194,6 @@ class PageController
)
);
//$menu->setUri($app['request']->getRequestUri());
/*
$menu->setChildrenAttributes(array(
'currentClass' => 'active'
));*/
$current = $menu->addChild(
get_lang('Current'),
array(
@ -1273,8 +1273,8 @@ class PageController
}
$html = null;
//Showing history title
// Showing history title
if ($loadHistory) {
// $html .= Display::page_subheader(get_lang('HistoryTrainingSession'));
if (empty($session_categories)) {

@ -2066,8 +2066,18 @@ class SessionManager
return $row[0];
}
static function protect_session_edit($id = null) {
$blockTeachers = !api_is_platform_admin() && (!api_is_teacher() || (api_is_teacher() && api_get_setting('allow_teachers_to_create_sessions') == 'false'));
/**
* @param int $id
* @return bool
*/
static function protect_session_edit($id = null)
{
if (api_is_platform_admin()) {
return false;
}
$blockTeachers = !api_is_teacher() || (api_is_teacher() && api_get_setting('allow_teachers_to_create_sessions') == 'false');
if ($blockTeachers) {
api_not_allowed(true);
}
@ -2084,6 +2094,7 @@ class SessionManager
api_not_allowed(true);
}
}
//Blocking teachers that want to edit another session
if ($blockTeachers == false && $session_info['id_coach'] != api_get_user_id()) {
api_not_allowed(true);
@ -2147,7 +2158,8 @@ class SessionManager
$extraFieldId = null,
$daysCoachAccessBeforeBeginning = null,
$daysCoachAccessAfterBeginning = null,
$sessionVisibility = 1
$sessionVisibility = 1,
$fieldsToAvoidUpdate = array()
)
{
$content = file($file);
@ -2189,7 +2201,6 @@ class SessionManager
$tag_names = array();
foreach ($content as $key => $enreg) {
$enreg = explode(';', trim($enreg));
if ($key) {
foreach ($tag_names as $tag_key => $tag_name) {
@ -2221,9 +2232,9 @@ class SessionManager
$date_start = $enreg['DateStart'];
$date_end = $enreg['DateEnd'];
$visibility = isset($enreg['Visibility']) ? $enreg['Visibility'] : $sessionVisibility;
$session_category_id = $enreg['SessionCategory'];
$session_category_id = isset($enreg['SessionCategory']) ? $enreg['SessionCategory'] : null;
// Searching a coach.
// Searching a general coach.
if (!empty($enreg['Coach'])) {
$coach_id = UserManager::get_user_id_from_username($enreg['Coach']);
if ($coach_id === false) {
@ -2239,6 +2250,7 @@ class SessionManager
$unique_name = false; // This MUST be initializead.
$i = 0;
// Change session name, verify that session doesn't exist.
$suffix = null;
while (!$unique_name) {
if ($i > 1) {
$suffix = ' - '.$i;
@ -2255,7 +2267,7 @@ class SessionManager
}
// Creating the session.
$sql_session = "INSERT IGNORE INTO $tbl_session SET
/*$sql_session = "INSERT IGNORE INTO $tbl_session SET
name = '".$session_name."',
id_coach = '$coach_id',
date_start = '$date_start',
@ -2263,8 +2275,18 @@ class SessionManager
visibility = '$visibility',
session_category_id = '$session_category_id',
session_admin_id=".intval($defaultUserId).$extraParameters;
Database::query($sql_session);
$session_id = Database::insert_id();
Database::query($sql_session);*/
$params = array (
'id_coach' => $coach_id,
'visibility' => $visibility,
'name' => $session_name,
'access_start_date' => $date_start,
'access_end_date' => $date_end,
'session_category_id' => $session_category_id,
'session_admin_id' => $defaultUserId,
);
$session_id = SessionManager::add($params);
if ($debug) {
if ($session_id) {
@ -2299,18 +2321,27 @@ class SessionManager
if ($my_session_result === false) {
// Creating a session.
$sql_session = "INSERT IGNORE INTO $tbl_session SET
/*$sql_session = "INSERT IGNORE INTO $tbl_session SET
name = '$session_name',
id_coach = '$coach_id',
date_start = '$date_start',
date_end = '$date_end',
visibility = '$visibility',
session_category_id = '$session_category_id'".$extraParameters;
session_category_id = '$session_category_id' ".$extraParameters;*/
$params = array (
'id_coach' => $coach_id,
'visibility' => $visibility,
'name' => $session_name,
'access_start_date' => $date_start,
'access_end_date' => $date_end,
'session_category_id' => $session_category_id,
'session_admin_id' => $defaultUserId,
);
$session_id = SessionManager::add($params);
Database::query($sql_session);
// We get the last insert id.
$my_session_result = SessionManager::get_session_by_name($session_name);
$session_id = $my_session_result['id'];
/*$my_session_result = SessionManager::get_session_by_name($enreg['SessionName']);
$session_id = $my_session_result['id'];*/
if ($debug) {
if ($session_id) {
@ -2388,25 +2419,13 @@ class SessionManager
foreach ($courses as $course) {
$course_code = api_strtoupper(api_substr($course, 0, api_strpos($course, '[')));
if (CourseManager::course_exists($course_code)) {
$coach = api_strstr($course, '[');
$coach = api_substr($coach, 1, api_strpos($coach,']') - 1);
if (!empty($coach)) {
$coach_id = UserManager::get_user_id_from_username($coach);
if ($coach_id === false) {
$coach_id = '';
}
} else {
$coach = '';
}
$courseInfo = api_get_course_info($course_code);
$courseId = $courseInfo['real_id'];
// Adding the course to a session.
$sql_course = "INSERT IGNORE INTO $tbl_session_course SET
course_code = '$course_code',
id_session='$session_id'";
$sql_course = "INSERT IGNORE INTO $tbl_session_course
SET c_id = '".$courseId."', id_session = '$session_id'";
Database::query($sql_course);
if ($debug) {
@ -2432,7 +2451,7 @@ class SessionManager
if ($coach_id !== false) {
$sql = "INSERT IGNORE INTO $tbl_session_course_user SET
id_user='$coach_id',
course_code='$course_code',
c_id ='$courseId',
id_session = '$session_id',
status = 2 ";
Database::query($sql);
@ -2455,7 +2474,7 @@ class SessionManager
if ($user_id !== false) {
$sql = "INSERT IGNORE INTO $tbl_session_course_user SET
id_user='$user_id',
course_code='$course_code',
c_id = '$courseId',
id_session = '$session_id'";
Database::query($sql);
if ($debug) {
@ -2467,90 +2486,16 @@ class SessionManager
}
}
$sql = "UPDATE $tbl_session_course SET nbr_users='$users_in_course_counter' WHERE course_code='$course_code'";
$sql = "UPDATE $tbl_session_course SET nbr_users='$users_in_course_counter' WHERE c_id ='$courseId'";
Database::query($sql);
$course_info = CourseManager::get_course_information($course_code);
$inserted_in_course[$course_code] = $course_info['title'];
} else {
// TODO: We should create the course as in the XML import.
}
if (CourseManager::course_exists($course_code, true)) {
$list = CourseManager :: get_courses_info_from_visual_code($course_code);
foreach ($list as $vcourse) {
if ($vcourse['code'] == $course_code) {
// Ignore, this has already been inserted.
} else {
$coach = api_strstr($course, '[');
$coach = api_substr($coach, 1, api_strpos($coach,']') - 1);
// Adding the relationship "Session - Course".
$sql_course = "INSERT IGNORE INTO $tbl_session_course SET
course_code = '".$vcourse['code']."',
id_session='$session_id'";
Database::query($sql_course);
if ($debug) {
$logger->addInfo("Sessions - Adding course to session: course: '".$vcourse['code']."' and session #$session_id");
}
// Adding coachs to session course user
foreach ($course_coaches as $course_coach) {
$coach_id = UserManager::get_user_id_from_username($course_coach);
if ($coach_id !== false) {
$sql = "INSERT IGNORE INTO $tbl_session_course_user SET
id_user='$coach_id',
course_code='{$vcourse['code']}',
id_session = '$session_id',
status = 2 ";
Database::query($sql);
if ($debug) {
$logger->addInfo("Sessions - Adding coach to session: user #$coach_id ($course_coach) course: '".$vcourse['code']."' and session #$session_id");
}
} else {
$error_message .= get_lang('UserDoesNotExist').' : '.$course_coach.$eol;
}
}
$users_in_course_counter = 0;
// Adding the relationship "Session - Course - User".
foreach ($course_users as $user) {
$user_id = UserManager::get_user_id_from_username($user);
if ($user_id !== false) {
$sql = "INSERT IGNORE INTO $tbl_session_course_user SET
id_user='$user_id',
course_code='{$vcourse['code']}',
id_session = '$session_id'";
Database::query($sql);
if ($debug) {
$logger->addInfo("Sessions - Adding user to session: user #$user_id ($user) course: '".$vcourse['code']."' and session #$session_id");
}
$users_in_course_counter++;
} else {
$error_message .= get_lang('UserDoesNotExist').' : '.$user.$eol;
}
}
Database::query("UPDATE $tbl_session_course SET nbr_users='$users_in_course_counter' WHERE course_code='".$vcourse['code']."'");
}
}
$inserted_in_course[$vcourse['code']] = $vcourse['title'];
}
}
$access_url_id = api_get_current_access_url_id();
UrlManager::add_session_to_url($session_id, $access_url_id);
$sql_update_users = "UPDATE $tbl_session SET nbr_users='$user_counter', nbr_courses='$course_counter' WHERE id='$session_id'";
$sql_update_users = "UPDATE $tbl_session SET nbr_users ='$user_counter', nbr_courses='$course_counter' WHERE id='$session_id'";
Database::query($sql_update_users);
}
}

@ -1010,14 +1010,15 @@ class Template
// Platform administration
if (api_is_platform_admin(true)) {
$navigation['platform_admin']['url'] = api_get_path(WEB_CODE_PATH).'admin/index.php';
$navigation['platform_admin']['url'] = api_get_path(WEB_PUBLIC_PATH).'admin/administrator';
$navigation['platform_admin']['title'] = get_lang('PlatformAdmin');
} else {
if (api_is_question_manager()) {
$navigation['question_manager']['url'] = api_get_path(WEB_PUBLIC_PATH).'admin/questionmanager';
$navigation['question_manager']['title'] = get_lang('PlatformAdmin');
}
/*$token = $this->app['security']->getToken();
$user = $token->getUser();*/
}
return $navigation;

@ -267,6 +267,7 @@ class UserManager
if (api_get_multiple_access_url()) {
$access_url_id = api_get_current_access_url_id();
}
if (is_array($_configuration[$access_url_id]) && isset($_configuration[$access_url_id]['hosting_limit_users']) && $_configuration[$access_url_id]['hosting_limit_users'] > 0) {
$num = self::get_number_of_users();
if ($num >= $_configuration[$access_url_id]['hosting_limit_users']) {
@ -281,6 +282,7 @@ class UserManager
}
}
// database table definition
$table_user = Database::get_main_table(TABLE_MAIN_USER);
//Checking the user language
@ -349,7 +351,6 @@ class UserManager
"hr_dept_id = $hr_dept_id,".
"active = $active";
$result = Database::query($sql);
// Query execution takes about 0.04s
if ($result) {
//echo "id returned";
@ -360,10 +361,11 @@ class UserManager
//we are adding by default the access_url_user table with access_url_id = 1
UrlManager::add_user_to_url($return, 1);
}
// multi url check takes about 0.01s
/*
global $app;
// Adding user
/** @var Entity\User $user */
/** @var Entity\User $user
$em = $app['orm.ems']['db_write'];
$user = $em->getRepository('Entity\User')->find($return);
@ -372,13 +374,11 @@ class UserManager
if ($role->getRole() == 'ROLE_ADMIN') {
UserManager::add_user_as_admin($return);
}
//->add() takes about no time (0.0003s)
$user->getRolesObj()->add($role);
//->persist() takes about no time either
$em->persist($user);
$t2 = microtime() - $t0;
error_log(__LINE__.': '.$t2);
// this flush takes about 0.05s (20% of whole insert) all by itself
$em->flush();
/*/
// optimized version of the above (takes about 56% of the time - see CT#6640)
@ -419,7 +419,7 @@ class UserManager
}
// Add event to system log
$user_id_manager = api_get_user_id();
// api_get_user_info() takes about 0.01s
// api_get_user_info() takes about 0.01s
//$user_info = api_get_user_info($return);
event_system(LOG_USER_CREATE, LOG_USER_ID, $return, api_get_utc_datetime(), $user_id_manager);
// event_system of object takes about 0.03s
@ -2402,8 +2402,8 @@ class UserManager
}
if ($is_time_over) {
$condition_date_end1 = " AND ((session.access_end_date < '$now' AND session.access_end_date != '0000-00-00 00:00:00' AND session.access_end_date != '' ) OR moved_to <> 0) ";
$condition_date_end2 = " AND ((session.access_end_date < '$now' AND session.access_end_date != '0000-00-00 00:00:00' AND session.access_end_date != '') ) ";
$condition_date_end1 = " AND ((session.access_end_date < '$now' AND access_end_date IS NOT NULL AND session.access_end_date != '0000-00-00 00:00:00' AND session.access_end_date != '' ) OR moved_to <> 0) ";
$condition_date_end2 = " AND ((session.access_end_date < '$now' AND access_end_date IS NOT NULL AND session.access_end_date != '0000-00-00 00:00:00' AND session.access_end_date != '') ) ";
} else {
if (api_is_allowed_to_create_course()) {
//Teachers can access the session depending in the access_coach date
@ -2459,12 +2459,12 @@ class UserManager
if (isset($categoryFilter) && $categoryFilter != '') {
switch ($categoryFilter) {
case 'no_category':
$sql1 .= "AND session_category_id = 0";
$sql2 .= "AND session_category_id = 0";
$sql1 .= "AND (session_category_id = 0 OR session_category_id IS NULL)";
$sql2 .= "AND (session_category_id = 0 OR session_category_id IS NULL)";
break;
case 'with_category':
$sql1 .= "AND session_category_id <> 0";
$sql2 .= "AND session_category_id <> 0";
$sql1 .= "AND (session_category_id <> 0 AND session_category_id IS NOT NULL ) ";
$sql2 .= "AND (session_category_id <> 0 AND session_category_id IS NOT NULL )";
break;
default:
if (!empty($categoryFilter) && is_numeric($categoryFilter)) {
@ -2479,7 +2479,7 @@ class UserManager
$sql3 = null;
if ($get_count) {
$sql3 = $sql2;
$sql3 = $sql1;
} else {
$sql1 .= $order;
$sql2 .= $order;
@ -2536,7 +2536,7 @@ class UserManager
$i++;
}
if (isset($join[$i]) && strcmp($row1['session_category_name'],$join[$i]['session_category_name']) === 0) {
while (isset($join[$i]) && isset($row1['short_name']) && strcmp($row1['short_name'], $join[$i]['short_name']) > 0) {
while (isset($join[$i]) && isset($row1['short_name']) && strcmp($row1['short_name'], $join[$i]['short_name'])>0) {
$ordered_join[] = $join[$i];
$i++;
}
@ -2551,6 +2551,7 @@ class UserManager
if (count($ordered_join) == 0) {
$ordered_join = $join;
}
if (count($ordered_join) > 0) {
//while ($row = Database::fetch_array($result1)) {
foreach ($ordered_join as $row) {
@ -2571,9 +2572,9 @@ class UserManager
$session_info = $row;
// Checking session visibility
$visibility = api_get_session_visibility($session_id, null, $ignore_visibility_for_admins);
switch ($visibility) {
case SESSION_VISIBLE_READ_ONLY:
case SESSION_VISIBLE:

@ -7,11 +7,6 @@
// name of the language file that needs to be included
$language_file = array('admin', 'registration');
// resetting the course id
$cidReset = true;
// including some necessary files
require_once '../inc/global.inc.php';
$xajax = new xajax();
$xajax->registerFunction('search_users');
@ -31,6 +26,7 @@ $interbreadcrumb[] = array(
"name" => get_lang('SessionOverview')
);
// Database Table Definitions
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
@ -46,6 +42,8 @@ if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') {
$add_type = Security::remove_XSS($_REQUEST['add_type']);
}
$add = isset($_GET['add']) ? Security::remove_XSS($_GET['add']) : null;
$page = isset($_GET['page']) ? Security::remove_XSS($_GET['page']) : null;
//checking for extra field with filter on
@ -274,8 +272,7 @@ $nosessionUsersList = $sessionUsersList = array();
$ajax_search = $add_type == 'unique' ? true : false;
$order_clause = api_sort_by_first_name(
) ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
if ($ajax_search) {
$sql = "SELECT user_id, lastname, firstname, username, id_session
FROM $tbl_user u
@ -467,15 +464,11 @@ if ($ajax_search) {
if ($add_type == 'multiple') {
$link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS(
$_GET['add']
).'&add_type=unique">'.Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>';
$link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.$add.'&add_type=unique">'.Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>';
$link_add_type_multiple = Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple');
} else {
$link_add_type_unique = Display::return_icon('single.gif').get_lang('SessionAddTypeUnique');
$link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&amp;add='.Security::remove_XSS(
$_GET['add']
).'&amp;add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>';
$link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&amp;add='.$add.'&amp;add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>';
}
$link_add_group = '<a href="usergroups.php">'.Display::return_icon(
'multiple.gif',
@ -487,7 +480,7 @@ $link_add_group = '<a href="usergroups.php">'.Display::return_icon(
&nbsp;|&nbsp;<?php echo $link_add_group; ?>
</div>
<form name="formulaire" method="post" action="<?php echo api_get_self(
); ?>?page=<?php echo $page; ?>&id_session=<?php echo $id_session; ?><?php if (!empty($_GET['add'])) {
); ?>?page=<?php echo $page; ?>&id_session=<?php echo $id_session; ?><?php if (!empty($add)) {
echo '&add=true';
} ?>"
style="margin:0px;" <?php if ($ajax_search) {
@ -615,7 +608,7 @@ $link_add_group = '<a href="usergroups.php">'.Display::return_icon(
<br/>
<br/>
<?php
if (isset($_GET['add'])) {
if (isset($add)) {
echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang(
'FinishSessionCreation'
).'</button>';
@ -697,5 +690,3 @@ $link_add_group = '<a href="usergroups.php">'.Display::return_icon(
}
</script>
<?php
/* FOOTER */
Display::display_footer();

@ -1,3 +1,21 @@
SessionName;Coach;DateStart;DateEnd;Users;Courses
Session1;jmontoya;2012-06-30 11:00:00;2016-06-30 11:00:00;username1|username2;course1[coach1][username1,username2]|course2[coach1][username1,username2]
Session2;jmontoya;2012-06-30 11:00:00;2016-06-30 11:00:00;username1|username2;course1[coach1][username1,username2]|course2[coach1][username1,username2]
Session1;jmontoya;2012-06-30 11:00:00;2020-06-30 11:00:00;acostea|fapple;course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
Session2;jmontoya;2012-06-30 11:00:00;2020-06-30 11:00:00;acostea|fapple;course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
Session3;jmontoya;2012-06-30 11:00:00;2020-06-30 11:00:00;acostea|fapple;course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
Session4;jmontoya;2012-06-30 11:00:00;2020-06-30 11:00:00;acostea|fapple;course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
Session5;jmontoya;2012-06-30 11:00:00;2020-06-30 11:00:00;acostea|fapple;course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
Session6;jmontoya;2012-06-30 11:00:00;2020-06-30 11:00:00;acostea|fapple;course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
Session7;jmontoya;2012-06-30 11:00:00;2020-06-30 11:00:00;acostea|fapple;course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
Session8;jmontoya;2012-06-30 11:00:00;2020-06-30 11:00:00;acostea|fapple;course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
Session9;jmontoya;2012-06-30 11:00:00;2020-06-30 11:00:00;acostea|fapple;course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
Session10;jmontoya;2012-06-30 11:00:00;2020-06-30 11:00:00;acostea|fapple;course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
Session11;jmontoya;2012-06-30 11:00:00;2020-06-30 11:00:00;acostea|fapple;course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
Session12;jmontoya;2012-06-30 11:00:00;2020-06-30 11:00:00;acostea|fapple;course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
Session13;jmontoya;2012-06-30 11:00:00;2020-06-30 11:00:00;acostea|fapple;course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
Session14;jmontoya;2012-06-30 11:00:00;2020-06-30 11:00:00;acostea|fapple;course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
Session15;jmontoya;2012-06-30 11:00:00;2020-06-30 11:00:00;acostea|fapple;course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
Session16;jmontoya;2012-06-30 11:00:00;2020-06-30 11:00:00;acostea|fapple;course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
Session17;jmontoya;2012-06-30 11:00:00;2020-06-30 11:00:00;acostea|fapple;course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
Session18;jmontoya;2012-06-30 11:00:00;2020-06-30 11:00:00;acostea|fapple;course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
Session19;jmontoya;2012-06-30 11:00:00;2020-06-30 11:00:00;acostea|fapple;course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
Session20;jmontoya;2012-06-30 11:00:00;2020-06-30 11:00:00;acostea|fapple;course1[coach][acostea,fapple]|course2[coach][acostea,fapple]

1 SessionName Coach DateStart DateEnd Users Courses
2 Session1 jmontoya 2012-06-30 11:00:00 2016-06-30 11:00:00 2020-06-30 11:00:00 username1|username2 acostea|fapple course1[coach1][username1,username2]|course2[coach1][username1,username2] course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
3 Session2 jmontoya 2012-06-30 11:00:00 2016-06-30 11:00:00 2020-06-30 11:00:00 username1|username2 acostea|fapple course1[coach1][username1,username2]|course2[coach1][username1,username2] course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
4 Session3 jmontoya 2012-06-30 11:00:00 2020-06-30 11:00:00 acostea|fapple course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
5 Session4 jmontoya 2012-06-30 11:00:00 2020-06-30 11:00:00 acostea|fapple course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
6 Session5 jmontoya 2012-06-30 11:00:00 2020-06-30 11:00:00 acostea|fapple course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
7 Session6 jmontoya 2012-06-30 11:00:00 2020-06-30 11:00:00 acostea|fapple course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
8 Session7 jmontoya 2012-06-30 11:00:00 2020-06-30 11:00:00 acostea|fapple course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
9 Session8 jmontoya 2012-06-30 11:00:00 2020-06-30 11:00:00 acostea|fapple course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
10 Session9 jmontoya 2012-06-30 11:00:00 2020-06-30 11:00:00 acostea|fapple course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
11 Session10 jmontoya 2012-06-30 11:00:00 2020-06-30 11:00:00 acostea|fapple course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
12 Session11 jmontoya 2012-06-30 11:00:00 2020-06-30 11:00:00 acostea|fapple course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
13 Session12 jmontoya 2012-06-30 11:00:00 2020-06-30 11:00:00 acostea|fapple course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
14 Session13 jmontoya 2012-06-30 11:00:00 2020-06-30 11:00:00 acostea|fapple course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
15 Session14 jmontoya 2012-06-30 11:00:00 2020-06-30 11:00:00 acostea|fapple course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
16 Session15 jmontoya 2012-06-30 11:00:00 2020-06-30 11:00:00 acostea|fapple course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
17 Session16 jmontoya 2012-06-30 11:00:00 2020-06-30 11:00:00 acostea|fapple course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
18 Session17 jmontoya 2012-06-30 11:00:00 2020-06-30 11:00:00 acostea|fapple course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
19 Session18 jmontoya 2012-06-30 11:00:00 2020-06-30 11:00:00 acostea|fapple course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
20 Session19 jmontoya 2012-06-30 11:00:00 2020-06-30 11:00:00 acostea|fapple course1[coach][acostea,fapple]|course2[coach][acostea,fapple]
21 Session20 jmontoya 2012-06-30 11:00:00 2020-06-30 11:00:00 acostea|fapple course1[coach][acostea,fapple]|course2[coach][acostea,fapple]

@ -26,12 +26,12 @@ if (empty($course_info)) {
}
$course_code = $course_info['code'];
$courseId = $course_info['real_id'];
$page = intval($_GET['page']);
$action = $_REQUEST['action'];
$courseId = $course_info['real_id'];
$page = isset($_GET['page']) ? intval($_GET['page']) : null;
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
$default_sort = api_sort_by_first_name() ? 'firstname':'lastname';
$sort = in_array($_GET['sort'], array('lastname','firstname','username')) ? $_GET['sort'] : $default_sort;
$idChecked = (is_array($_GET['idChecked']) ? $_GET['idChecked'] : (is_array($_POST['idChecked']) ? $_POST['idChecked'] : null));
$sort = isset($_GET['sort']) && in_array($_GET['sort'], array('lastname','firstname','username')) ? $_GET['sort'] : $default_sort;
$idChecked = isset($_GET['idChecked']) && (is_array($_GET['idChecked']) ? $_GET['idChecked'] : (is_array($_POST['idChecked']) ? $_POST['idChecked'] : null));
$direction = isset($_GET['direction']) && in_array($_GET['direction'], array('desc','asc')) ? $_GET['direction'] : 'desc';
@ -197,4 +197,4 @@ unset($Users);
<button class="save" type="submit"> <?php echo get_lang('Ok'); ?></button>
</form>
<?php
Display::display_footer();
Display::display_footer();

@ -38,7 +38,7 @@ $inserted_in_course = array();
global $_configuration;
if ($_POST['formSent']) {
if (isset($_POST['formSent'])) {
if (isset($_FILES['import_file']['tmp_name']) && !empty($_FILES['import_file']['tmp_name'])) {
$form_sent = $_POST['formSent'];
$file_type = $_POST['file_type'];
@ -423,278 +423,10 @@ if ($_POST['formSent']) {
$error_message .= get_lang('XMLNotValid');
}
} else {
// CSV
$content = file($_FILES['import_file']['tmp_name']);
if (!api_strstr($content[0], ';')) {
$error_message = get_lang('NotCSV');
} else {
$tag_names = array();
foreach ($content as $key => $enreg) {
$enreg = explode(';', trim($enreg));
if ($key) {
foreach ($tag_names as $tag_key => $tag_name) {
$sessions[$key - 1][$tag_name] = $enreg[$tag_key];
}
} else {
foreach ($enreg as $tag_name) {
$tag_names[] = api_preg_replace('/[^a-zA-Z0-9_\-]/', '', $tag_name);
}
if (!in_array('SessionName', $tag_names) || !in_array('DateStart', $tag_names) || !in_array('DateEnd', $tag_names)) {
$error_message = get_lang('NoNeededData');
break;
}
}
}
// Looping the sessions.
foreach ($sessions as $enreg) {
$user_counter = 0;
$course_counter = 0;
$session_name = $enreg['SessionName'];
$date_start = $enreg['DateStart'];
$date_end = $enreg['DateEnd'];
$visibility = $enreg['Visibility'];
$session_category_id = $enreg['SessionCategory'];
// Searching a coach.
if (!empty($enreg['Coach'])) {
$coach_id = UserManager::get_user_id_from_username($enreg['Coach']);
if ($coach_id === false) {
// If the coach-user does not exist - I'm the coach.
$coach_id = api_get_user_id();
}
} else {
$coach_id = api_get_user_id();
}
if (!$updatesession) {
// Always create a session.
$unique_name = false; // This MUST be initializead.
$i = 0;
// Change session name, verify that session doesn't exist.
while (!$unique_name) {
if ($i > 1) {
$suffix = ' - '.$i;
}
$sql = 'SELECT 1 FROM '.$tbl_session.' WHERE name="'.Database::escape_string($session_name.$suffix).'"';
$rs = Database::query($sql);
if (Database::result($rs, 0, 0)) {
$i++;
} else {
$unique_name = true;
$session_name .= $suffix;
}
}
$params = array (
'id_coach' => $coach_id,
'visibility' => $visibility,
'name' => $session_name,
'access_start_date' => $date_start,
'access_end_date' => $date_end,
'session_category_id' => $session_category_id,
'session_admin_id' => api_get_user_id(),
);
$session_id = SessionManager::add($params);
$session_counter++;
} else {
$my_session_result = SessionManager::get_session_by_name($session_name);
if ($my_session_result === false) {
$params = array (
'id_coach' => $coach_id,
'visibility' => $visibility,
'name' => $session_name,
'access_start_date' => $date_start,
'access_end_date' => $date_end,
'session_category_id' => $session_category_id,
'session_admin_id' => api_get_user_id(),
);
$session_id = SessionManager::add($params);
} else {
$session_id = $my_session_result['id'];
$params = array (
'id' => $session_id,
'id_coach' => $coach_id,
'visibility' => $visibility,
'name' => $session_name,
'access_start_date' => $date_start,
'access_end_date' => $date_end,
'session_category_id' => $session_category_id,
'session_admin_id' => api_get_user_id(),
);
SessionManager::update($params);
Database::query("DELETE FROM $tbl_session_user WHERE id_session='$session_id'");
Database::query("DELETE FROM $tbl_session_course WHERE id_session='$session_id'");
Database::query("DELETE FROM $tbl_session_course_user WHERE id_session='$session_id'");
}
$session_counter++;
}
$users = explode('|', $enreg['Users']);
// Adding the relationship "Session - User".
if (is_array($users)) {
foreach ($users as $user) {
$user_id = UserManager::get_user_id_from_username($user);
if ($user_id !== false) {
// Insert new users.
$sql = "INSERT IGNORE INTO $tbl_session_user SET
id_user='$user_id',
id_session = '$session_id'";
$rs_user = Database::query($sql);
$user_counter++;
}
}
}
$courses = explode('|', $enreg['Courses']);
foreach ($courses as $course) {
$course_code = api_strtoupper(api_substr($course, 0, api_strpos($course, '[')));
if (CourseManager::course_exists($course_code)) {
// If the course exists we continue.
$course_info = CourseManager::get_course_information($course_code);
$coach = api_strstr($course, '[');
$coach = api_substr($coach, 1, api_strpos($coach,']') - 1);
if (!empty($coach)) {
$coach_id = UserManager::get_user_id_from_username($coach);
if ($coach_id === false) {
$coach_id = '';
}
} else {
$coach = '';
}
// Adding the course to a session.
$sql_course = "INSERT IGNORE INTO $tbl_session_course SET
course_code = '$course_code',
id_session='$session_id'";
$rs_course = Database::query($sql_course);
$course_counter++;
$course_split = array();
$pattern = "/\[(.*?)\]/";
preg_match_all($pattern, $course, $matches);
if (isset($matches[1])) {
$course_coaches = $matches[1][0];
$course_users = $matches[1][1];
}
$course_users = explode(',', $course_users);
$course_coaches = explode(',', $course_coaches);
// Adding coaches to session course user
if (!empty($course_coaches)) {
foreach ($course_coaches as $course_coach) {
$coach_id = UserManager::get_user_id_from_username($course_coach);
if ($coach_id !== false) {
$sql = "INSERT IGNORE INTO $tbl_session_course_user SET
id_user='$coach_id',
course_code='$course_code',
id_session = '$session_id',
status = 2 ";
$rs_coachs = Database::query($sql);
} else {
$error_message .= get_lang('UserDoesNotExist').' : '.$user.'<br />';
}
}
}
$users_in_course_counter = 0;
// Adding the relationship "Session - Course - User".
foreach ($course_users as $user) {
$user_id = UserManager::get_user_id_from_username($user);
if ($user_id !== false) {
$sql = "INSERT IGNORE INTO $tbl_session_course_user SET
id_user='$user_id',
course_code='$course_code',
id_session = '$session_id'";
$rs_users = Database::query($sql);
$users_in_course_counter++;
} else {
$error_message .= get_lang('UserDoesNotExist').' : '.$user.'<br />';
}
}
$sql = "UPDATE $tbl_session_course SET nbr_users='$users_in_course_counter' WHERE course_code='$course_code'";
Database::query($sql);
$course_info = CourseManager::get_course_information($course_code);
$inserted_in_course[$course_code] = $course_info['title'];
} else {
// TODO: We should create the course as in the XML import.
}
if (CourseManager::course_exists($course_code, true)) {
$list = CourseManager :: get_courses_info_from_visual_code($course_code);
foreach ($list as $vcourse) {
if ($vcourse['code'] == $course_code) {
// Ignore, this has already been inserted.
} else {
$coach = api_strstr($course, '[');
$coach = api_substr($coach, 1, api_strpos($coach,']') - 1);
// Adding the relationship "Session - Course".
$sql_course = "INSERT IGNORE INTO $tbl_session_course SET
course_code = '".$vcourse['code']."',
id_session='$session_id'";
$rs_course = Database::query($sql_course);
// adding coachs to session course user
foreach ($course_coaches as $course_coach) {
$coach_id = UserManager::get_user_id_from_username($course_coach);
if ($coach_id !== false) {
$sql = "INSERT IGNORE INTO $tbl_session_course_user SET
id_user='$coach_id',
course_code='{$vcourse['code']}',
id_session = '$session_id',
status = 2 ";
$rs_coachs = Database::query($sql);
} else {
$error_message .= get_lang('UserDoesNotExist').' : '.$user.'<br />';
}
}
$users_in_course_counter = 0;
// Adding the relationship "Session - Course - User".
foreach ($course_users as $user) {
$user_id = UserManager::get_user_id_from_username($user);
if ($user_id !== false) {
$sql = "INSERT IGNORE INTO $tbl_session_course_user SET
id_user='$user_id',
course_code='{$vcourse['code']}',
id_session = '$session_id'";
$rs_users = Database::query($sql);
$users_in_course_counter++;
} else {
$error_message .= get_lang('UserDoesNotExist').' : '.$user.'<br />';
}
}
Database::query("UPDATE $tbl_session_course SET nbr_users='$users_in_course_counter' WHERE course_code='".$vcourse['code']."'");
}
}
$inserted_in_course[$vcourse['code']] = $vcourse['title'];
}
}
$access_url_id = api_get_current_access_url_id();
UrlManager::add_session_to_url($session_id, $access_url_id);
$sql_update_users = "UPDATE $tbl_session SET nbr_users='$user_counter', nbr_courses='$course_counter' WHERE id='$session_id'";
Database::query($sql_update_users);
}
}
$result = SessionManager::importCSV($_FILES['import_file']['tmp_name'], $updatesession, api_get_user_id());
$error_message = $result['error_message'];
$session_counter = $result['session_counter'];
}
if (!empty($error_message)) {
@ -833,4 +565,4 @@ $form->display();
<?php
/* FOOTER */
Display::display_footer();
Display::display_footer();

@ -1,22 +1,66 @@
{% extends app.template_style ~ "/layout/layout_1_col.tpl" %}
{% block content %}
<ul>
<li>
<a href="{{ url('question_score.controller:indexAction') }}">{{ 'Question score name' |trans }}</a>
</li>
<li>
<a href="{{ url('question_score_name.controller:indexAction') }}">{{ 'Question names' |trans }}</a>
</li>
<li>
<a href="{{ url('role.controller:indexAction') }}">{{ 'Roles' |trans }}</a>
</li>
<li>
<a href="{{ url('branch.controller:indexAction') }}">{{ 'Branches' |trans }}</a>
</li>
<li>
<a href="{{ url('jury.controller:indexAction') }}">{{ 'Juries' |trans }}</a>
</li>
</ul>
<script>
$(function() {
//$("#settings").tabs();
$.ajax({
url:'{{ web_admin_ajax_url }}?a=version',
success:function(version){
$(".admin-block-version").html(version);
}
});
});
</script>
<div id="settings">
<div class="row">
{% for block_item in blocks %}
<div id="tabs-{{ loop.index }}" class="span6">
<div class="well_border {{ block_item.class }}">
<h4>{{ block_item.icon }} {{ block_item.label }}</h4>
<div style="list-style-type:none">
{{ block_item.search_form }}
</div>
{% if block_item.items is not null %}
<ul>
{% for url in block_item.items %}
<li>
<a href="{{ url.url }}">
{{ url.label }}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% if block_item.extra is not null %}
<div>
{{ block_item.extra }}
</div>
{% endif %}
</div>
</div>
{% endfor %}
</div>
<div class="row">
<div class="span6">
<div class="well_border">
<ul>
<li>
<a href="{{ url('question_score.controller:indexAction') }}">{{ 'Question score name' |trans }}</a>
</li>
<li>
<a href="{{ url('question_score_name.controller:indexAction') }}">{{ 'Question names' |trans }}</a>
</li>
<li>
<a href="{{ url('role.controller:indexAction') }}">{{ 'Roles' |trans }}</a>
</li>
</ul>
</div>
</div>
</div>
</div>
{% endblock %}

@ -1,56 +0,0 @@
{% extends app.template_style ~ "/layout/layout_1_col.tpl" %}
{% block content %}
<script>
$(function() {
//$("#settings").tabs();
$.ajax({
url:'{{ web_admin_ajax_url }}?a=version',
success:function(version){
$(".admin-block-version").html(version);
}
});
});
</script>
<div id="settings">
{% for block_item in blocks %}
{% if loop.index % 2 == 1 %}
{% if app.full_width == 1 %}
<div class="row-fluid">
{% else %}
<div class="row">
{% endif %}
{% endif %}
<div id="tabs-{{ loop.index }}" class="span6">
<div class="well_border {{ block_item.class }}">
<h4>{{ block_item.icon }} {{ block_item.label }}</h4>
<div style="list-style-type:none">
{{ block_item.search_form }}
</div>
{% if block_item.items is not null %}
<ul>
{% for url in block_item.items %}
<li>
<a href="{{ url.url }}">
{{ url.label }}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% if block_item.extra is not null %}
<div>
{{ block_item.extra }}
</div>
{% endif %}
</div>
</div>
{% if loop.index % 2 == 0 %}
</div>
{% endif %}
{% endfor %}
</div>
{% endblock %}

@ -29,23 +29,247 @@ class AdministratorController extends CommonController
public function indexAction()
{
$template = $this->get('template');
$response = $template->render_template('admin/administrator/index.tpl');
return new Response($response, 200, array());
}
function getRepository()
{
// Access restrictions.
api_protect_admin_script(true);
}
// @todo fix register/check version
$message = null;
if (!empty($_POST['Register'])) {
register_site();
$message = \Display::return_message(get_lang('VersionCheckEnabled'), 'confirmation');
}
/**
* This method should return a new entity instance to be used for the "create" action.
*
* @abstract
* @return Object
*/
function getNewEntity()
{
$blocks = array();
$adminUrl = api_get_path(WEB_CODE_PATH).'admin/';
/* Users */
$blocks['users']['icon'] = \Display::return_icon('members.gif', get_lang('Users'), array(), ICON_SIZE_SMALL, false);
$blocks['users']['label'] = api_ucfirst(get_lang('Users'));
if (api_is_platform_admin()) {
$search_form = ' <form method="get" class="form-search" action="user_list.php">
<input class="span3" type="text" name="keyword" value="">
<button class="btn" type="submit">'.get_lang('Search').'</button>
</form>';
$blocks['users']['search_form'] = $search_form;
$items = array(
array('url'=>$adminUrl.'user_list.php', 'label' => get_lang('UserList')),
array('url' => $adminUrl.'user_add.php', 'label' => get_lang('AddUsers')),
array('url' => $adminUrl.'user_export.php', 'label' => get_lang('ExportUserListXMLCSV')),
array('url' => $adminUrl.'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')),
);
if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
$items[] = array('url' => $adminUrl.'ldap_users_list.php', 'label' => get_lang('ImportLDAPUsersIntoPlatform'));
}
$items[] = array('url' => $adminUrl.'extra_fields.php?type=user', 'label' => get_lang('ManageUserFields'));
$items[] = array('url'=> api_get_path(WEB_PUBLIC_PATH).'admin/administrator/roles', 'label' => get_lang('Roles'));
} else {
$items = array(
array('url' => $adminUrl.'user_list.php', 'label' => get_lang('UserList')),
array('url' => $adminUrl.'user_add.php', 'label' => get_lang('AddUsers')),
array('url' => $adminUrl.'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')),
);
}
$blocks['users']['items'] = $items;
$blocks['users']['extra'] = null;
if (api_is_platform_admin()) {
/* Courses */
$blocks['courses']['icon'] = \Display::return_icon('course.gif', get_lang('Courses'), array(), ICON_SIZE_MEDIUM, false);
$blocks['courses']['label'] = api_ucfirst(get_lang('Courses'));
$search_form = ' <form method="get" class="form-search" action="course_list.php">
<input class="span3" type="text" name="keyword" value="">
<button class="btn" type="submit">'.get_lang('Search').'</button>
</form>';
$blocks['courses']['search_form'] = $search_form;
$items = array();
$items[] = array('url' => $adminUrl.'course_list.php', 'label' => get_lang('CourseList'));
if (api_get_setting('course_validation') != 'true') {
$items[] = array('url' => $adminUrl.'course_add.php', 'label' => get_lang('AddCourse'));
} else {
$items[] = array('url' => $adminUrl.'course_request_review.php', 'label' => get_lang('ReviewCourseRequests'));
$items[] = array('url' => $adminUrl.'course_request_accepted.php', 'label' => get_lang('AcceptedCourseRequests'));
$items[] = array('url' => $adminUrl.'course_request_rejected.php', 'label' => get_lang('RejectedCourseRequests'));
}
$items[] = array('url' => $adminUrl.'course_export.php', 'label' => get_lang('ExportCourses'));
$items[] = array('url' => $adminUrl.'course_import.php', 'label' => get_lang('ImportCourses'));
$items[] = array('url' => $adminUrl.'course_category.php', 'label' => get_lang('AdminCategories'));
$items[] = array('url' => $adminUrl.'subscribe_user2course.php', 'label' => get_lang('AddUsersToACourse'));
$items[] = array('url' => $adminUrl.'course_user_import.php', 'label' => get_lang('ImportUsersToACourse'));
$items[] = array('url' => $adminUrl.'extra_fields.php?type=course', 'label' => get_lang('ManageCourseFields'));
$items[] = array('url' => $adminUrl.'extra_fields.php?type=question', 'label' => get_lang('ManageQuestionFields'));
if (api_get_setting('gradebook_enable_grade_model') == 'true') {
$items[] = array('url' => $adminUrl.'grade_models.php', 'label' => get_lang('GradeModel'));
}
if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
$items[] = array('url' => $adminUrl.'ldap_import_students.php', 'label' => get_lang('ImportLDAPUsersIntoCourse'));
}
$blocks['courses']['items'] = $items;
$blocks['courses']['extra'] = null;
/* Platform */
$blocks['platform']['icon'] = \Display::return_icon('platform.png', get_lang('Platform'), array(), ICON_SIZE_MEDIUM, false);
$blocks['platform']['label'] = api_ucfirst(get_lang('Platform'));
$search_form = ' <form method="get" action="settings.php" class="form-search">
<input class="span3" type="text" name="search_field" value="" >
<input type="hidden" value="search_setting" name="category">
<button class="btn" type="submit">'.get_lang('Search').'</button>
</form>';
$blocks['platform']['search_form'] = $search_form;
$items = array();
$items[] = array('url' => $adminUrl.'settings.php', 'label' => get_lang('PlatformConfigSettings'));
$items[] = array('url' => $adminUrl.'settings.php?category=Plugins','label' => get_lang('Plugins'));
$items[] = array('url' => $adminUrl.'settings.php?category=Regions','label' => get_lang('Regions'));
$items[] = array('url' => $adminUrl.'system_announcements.php', 'label' => get_lang('SystemAnnouncements'));
$items[] = array('url'=> api_get_path(WEB_CODE_PATH).'calendar/agenda_js.php?type=admin', 'label' => get_lang('GlobalAgenda'));
$items[] = array('url' => $adminUrl.'configure_homepage.php', 'label' => get_lang('ConfigureHomePage'));
$items[] = array('url' => $adminUrl.'configure_inscription.php', 'label' => get_lang('ConfigureInscription'));
$items[] = array('url' => $adminUrl.'statistics/index.php', 'label' => get_lang('Statistics'));
$items[] = array('url'=> api_get_path(WEB_CODE_PATH).'mySpace/company_reports.php', 'label' => get_lang('Reports'));
/* Event settings */
if (api_get_setting('activate_email_template') == 'true') {
$items[] = array('url' => $adminUrl.'event_controller.php?action=listing', 'label' => get_lang('EventMessageManagement'));
}
if (api_get_multiple_access_url()) {
if (api_is_global_platform_admin()) {
$items[] = array('url' => $adminUrl.'access_urls.php', 'label' => get_lang('ConfigureMultipleAccessURLs'));
}
}
if (api_get_setting('allow_reservation') == 'true') {
//$items[] = array('url' => $adminUrl.'../reservation/m_category.php', 'label' => get_lang('BookingSystem'));
}
if (api_get_setting('allow_terms_conditions') == 'true') {
$items[] = array('url' => $adminUrl.'legal_add.php', 'label' => get_lang('TermsAndConditions'));
}
$blocks['platform']['items'] = $items;
$blocks['platform']['extra'] = null;
}
/* Sessions */
$blocks['sessions']['icon'] = \Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL, false);
$blocks['sessions']['label'] = api_ucfirst(get_lang('Sessions'));
$search_form = ' <form method="GET" class="form-search" action="'.api_get_path(WEB_CODE_PATH).'session/session_list.php">
<input class="span3" type="text" name="keyword" value="">
<button class="btn" type="submit">'.get_lang('Search').'</button>
</form>';
$blocks['sessions']['search_form'] = $search_form;
$items = array();
$items[] = array('url'=> api_get_path(WEB_CODE_PATH).'session/session_list.php', 'label' => get_lang('ListSession'));
$items[] = array('url'=> api_get_path(WEB_CODE_PATH).'session/session_add.php', 'label' => get_lang('AddSession'));
$items[] = array('url'=> 'session_category_list.php', 'label' => get_lang('ListSessionCategory'));
$items[] = array('url'=> api_get_path(WEB_CODE_PATH).'session/session_import.php', 'label' => get_lang('ImportSessionListXMLCSV'));
if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
$items[] = array('url' => $adminUrl.'ldap_import_students_to_session.php', 'label' => get_lang('ImportLDAPUsersIntoSession'));
}
$items[] = array('url'=>api_get_path(WEB_CODE_PATH).'session/session_export.php', 'label' => get_lang('ExportSessionListXMLCSV'));
$items[] = array('url' => $adminUrl.'../coursecopy/copy_course_session.php', 'label' => get_lang('CopyFromCourseInSessionToAnotherSession'));
if (api_is_platform_admin()) {
if (is_dir(api_get_path(SYS_TEST_PATH).'datafiller/')) { // option only visible in development mode. Enable through code if required
$items[] = array('url' => $adminUrl.'user_move_stats.php', 'label' => get_lang('MoveUserStats'));
}
$items[] = array('url' => $adminUrl.'career_dashboard.php', 'label' => get_lang('CareersAndPromotions'));
}
$items[] = array('url' => $adminUrl.'usergroups.php', 'label' => get_lang('Classes'));
$items[] = array('url' => $adminUrl.'exercise_report.php', 'label' => get_lang('ExerciseReport'));
$items[] = array('url' => $adminUrl.'extra_fields.php?type=session', 'label' => get_lang('ManageSessionFields'));
$blocks['sessions']['items'] = $items;
$blocks['sessions']['extra'] = null;
/* Settings */
if (api_is_platform_admin()) {
$blocks['settings']['icon'] = \Display::return_icon('settings.png', get_lang('System'), array(), ICON_SIZE_SMALL, false);
$blocks['settings']['label'] = api_ucfirst(get_lang('System'));
$items = array();
$items[] = array('url' => $adminUrl.'special_exports.php', 'label' => get_lang('SpecialExports'));
if (!empty($_configuration['db_admin_path'])) {
$items[] = array('url'=>$_configuration['db_admin_path'], 'label' => get_lang('AdminDatabases').' ('.get_lang('DBManagementOnlyForServerAdmin').') ');
}
$items[] = array('url' => $adminUrl.'system_status.php', 'label' => get_lang('SystemStatus'));
if (is_dir(api_get_path(SYS_TEST_PATH).'datafiller/')) {
$items[] = array('url' => $adminUrl.'filler.php', 'label' => get_lang('DataFiller'));
}
$items[] = array('url' => $adminUrl.'archive_cleanup.php', 'label' => get_lang('ArchiveDirCleanup'));
$items[] = array('url' => $adminUrl.'system_management.php', 'label' => get_lang('SystemManagement'));
$blocks['settings']['items'] = $items;
$blocks['settings']['extra'] = null;
$blocks['settings']['search_form'] = null;
//Skills
if (api_get_setting('allow_skills_tool') == 'true') {
$blocks['skills']['icon'] = \Display::return_icon('logo.png', get_lang('Skills'), array(), ICON_SIZE_SMALL, false);
$blocks['skills']['label'] = get_lang('Skills');
$items = array();
//$items[] = array('url' => $adminUrl.'skills.php', 'label' => get_lang('SkillsTree'));
$items[] = array('url' => $adminUrl.'skills_wheel.php', 'label' => get_lang('SkillsWheel'));
$items[] = array('url' => $adminUrl.'skills_import.php', 'label' => get_lang('SkillsImport'));
//$items[] = array('url' => $adminUrl.'skills_profile.php', 'label' => get_lang('SkillsProfile'));
$items[] = array('url'=>api_get_path(WEB_CODE_PATH).'social/skills_ranking.php', 'label' => get_lang('SkillsRanking'));
$items[] = array('url' => $adminUrl.'skills_gradebook.php', 'label' => get_lang('SkillsAndGradebooks'));
$blocks['skills']['items'] = $items;
$blocks['skills']['extra'] = null;
$blocks['skills']['search_form'] = null;
}
/** Chamilo.org */
$blocks['chamilo']['icon'] = \Display::return_icon('logo.png', 'Chamilo.org', array(), ICON_SIZE_SMALL, false);
$blocks['chamilo']['label'] = 'Chamilo.org';
$items = array();
$items[] = array('url'=>'http://www.chamilo.org/', 'label' => get_lang('ChamiloHomepage'));
$items[] = array('url'=>'http://www.chamilo.org/forum', 'label' => get_lang('ChamiloForum'));
$items[] = array('url'=>'../../documentation/installation_guide.html', 'label' => get_lang('InstallationGuide'));
$items[] = array('url'=>'../../documentation/changelog.html', 'label' => get_lang('ChangesInLastVersion'));
$items[] = array('url'=>'../../documentation/credits.html', 'label' => get_lang('ContributorsList'));
$items[] = array('url'=>'../../documentation/security.html', 'label' => get_lang('SecurityGuide'));
$items[] = array('url'=>'../../documentation/optimization.html', 'label' => get_lang('OptimizationGuide'));
$items[] = array('url'=>'http://www.chamilo.org/extensions', 'label' => get_lang('ChamiloExtensions'));
$items[] = array('url'=>'http://www.chamilo.org/en/providers', 'label' => get_lang('ChamiloOfficialServicesProviders'));
$blocks['chamilo']['items'] = $items;
$blocks['chamilo']['extra'] = null;
$blocks['chamilo']['search_form'] = null;
// Version check
$blocks['version_check']['icon'] = \Display::return_icon('logo.png', 'Chamilo.org', array(), ICON_SIZE_SMALL, false);
$blocks['version_check']['label'] = get_lang('VersionCheck');
$blocks['version_check']['extra'] = '<div class="admin-block-version"></div>';
$blocks['version_check']['search_form'] = null;
$blocks['version_check']['items'] = null;
//$blocks['version_check']['class'] = '';
}
$admin_ajax_url = api_get_path(WEB_AJAX_PATH).'admin.ajax.php';
$template->assign('web_admin_ajax_url', $admin_ajax_url);
$template->assign('blocks', $blocks);
$response = $template->render_template('admin/administrator/index.tpl');
return new Response($response, 200, array());
}
}

@ -55,6 +55,18 @@ $users[] = array(
'active' => 1
);
$users[] = array(
'username' => 'coach',
'pass' => 'coach',
'firstname' => 'coach',
'lastname' => 'coach',
'status' => 1,
'auth_source' => 'platform',
'email' => 'coach@example.com',
'creator_id' => 1,
'active' => 1
);
$users[] = array(
'username' => 'agarcia',
'pass' => 'agarcia',
@ -163,4 +175,4 @@ $users[] = array('username' => 'dstrauss','pass'=> 'dstrauss','firstname' => 'Do
$users[] = array('username' => 'helena','pass'=> 'helena','firstname' => 'Helena','lastname' => 'Duarte','status' => 5,'auth_source' => 'platform','email' => 'helena@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'cgonzales','pass'=> 'cgonzales','firstname' => 'Cecilia','lastname' => 'Gonzales','status' => 5,'auth_source' => 'platform','email' => 'cgonzales@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'amann','pass'=> 'amann','firstname' => 'Aimee','lastname' => 'Mann','status' => 5,'auth_source' => 'platform','email' => 'amann@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'zazup','pass'=> 'zazup','firstname' => 'Zazup','lastname' => 'Zazupar','status' => 5,'auth_source' => 'platform','email' => 'zazup@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'zazup','pass'=> 'zazup','firstname' => 'Zazup','lastname' => 'Zazupar','status' => 5,'auth_source' => 'platform','email' => 'zazup@example.com','creator_id' => 1,'active' => 1);

@ -1031,6 +1031,10 @@ class CommonCommand extends AbstractCommand
}
} catch (\Alchemy\Zippy\Exception\RunTimeException $e) {
$output->writeln("<comment>It seems that this file doesn't contain a Chamilo package:</comment> <info>$updateInstallationOriginal</info>");
unlink($updateInstallation);
$output->writeln("<comment>Removing file</comment>:<info>$updateInstallation</info>");
//$output->writeln("Error:");
//$output->writeln($e->getMessage());
return 0;

@ -88,6 +88,14 @@ class UpgradeCommand extends CommonCommand
$output->writeln("<error>Set the --migration-yml-path and --migration-class-path manually.</error>");
return 0;
}
// Checking Resources/Database dir
$migrationFileFolder = $this->getInstallationFolder();
if (!is_dir($migrationFileFolder)) {
$output->writeln("<comment>The migration directory was not detected: </comment><info>$migrationFileFolder</info>");
return 0;
} else {
$output->writeln("<comment>Reading migrations from directory: </comment><info>$migrationFileFolder</info>");
}
$this->setMigrationConfigurationFile($command->getMigrationFile());
@ -183,7 +191,7 @@ class UpgradeCommand extends CommonCommand
if (empty($versionInfo)) {
$output->writeln("<comment>The version is not supported: $version</comment>");
return false;
return 0;
}
if (isset($versionInfo['hook_to_doctrine_version']) && isset($doctrineVersion)) {
@ -206,7 +214,7 @@ class UpgradeCommand extends CommonCommand
$output->writeln("<comment>Downloading package ...</comment>");
$chamiloLocationPath = $this->getPackage($output, $originalVersion, $updateInstallation, $tempFolder);
if (empty($chamiloLocationPath)) {
$output->writeln("<comment>Can't zip download package for version: $originalVersion</comment>");
$output->writeln("<comment>Chash was not able to unzip the downloaded package for version: $originalVersion</comment>");
return 0;
}
}
@ -364,6 +372,8 @@ class UpgradeCommand extends CommonCommand
$versionInfo = $this->getAvailableVersionInfo($toVersion);
$installPath = $this->getInstallationFolder().$toVersion.'/';
$output->writeln("<comment>Reading installation directory for version $toVersion: <info>'$installPath'</info>");
// Filling sqlList array with "pre" db changes.
if (isset($versionInfo['pre']) && !empty($versionInfo['pre'])) {
$sqlToInstall = $installPath.$versionInfo['pre'];

@ -509,7 +509,7 @@ CREATE TABLE IF NOT EXISTS session (
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,
session_category_id int default 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',
@ -3625,4 +3625,4 @@ CREATE TABLE curriculum_rel_user (
-- Do not move this
UPDATE settings_current SET selected_value = '1.10.0.037' WHERE variable = 'chamilo_database_version';
UPDATE settings_current SET selected_value = '1.10.0.039' WHERE variable = 'chamilo_database_version';

@ -14,20 +14,36 @@
-- 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');
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));
CREATE TABLE IF NOT EXISTS 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 IF NOT EXISTS c_student_publication_rel_document (id INT PRIMARY KEY NOT NULL AUTO_INCREMENT, work_id INT NOT NULL, document_id INT NOT NULL, c_id INT NOT NULL);
CREATE TABLE IF NOT EXISTS c_student_publication_rel_user (id INT PRIMARY KEY NOT NULL AUTO_INCREMENT, work_id INT NOT NULL, user_id INT NOT NULL, c_id INT NOT NULL);
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);
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));
CREATE TABLE IF NOT EXISTS 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 IF NOT EXISTS question_score ( id int NOT NULL AUTO_INCREMENT, name varchar(255) DEFAULT NULL, PRIMARY KEY (id)) DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS c_lp_category (id int unsigned NOT NULL auto_increment, c_id INT unsigned NOT NULL, name VARCHAR(255), position INT, PRIMARY KEY (id));
CREATE TABLE IF NOT EXISTS 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));
CREATE TABLE IF NOT EXISTS 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 IF NOT EXISTS 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;
CREATE TABLE IF NOT EXISTS roles (id INT auto_increment, name VARCHAR(255), role VARCHAR(255) unique, PRIMARY KEY(id));
CREATE TABLE IF NOT EXISTS users_roles (user_id INT NOT NULL, role_id INT NOT NULL, PRIMARY KEY(user_id, role_id));
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));
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));
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');
CREATE TABLE IF NOT EXISTS 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 IF NOT EXISTS 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 IF NOT EXISTS branch_transaction_status (id tinyint not null PRIMARY KEY AUTO_INCREMENT, title char(20));
CREATE TABLE IF NOT EXISTS 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 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;
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';
@ -38,14 +54,12 @@ ALTER TABLE session ADD COLUMN access_start_date datetime default '0000-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 session MODIFY COLUMN session_category_id int default NULL;
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);
@ -68,28 +82,16 @@ 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));
ALTER TABLE c_quiz_question_rel_category MODIFY COLUMN c_id INT unsigned NOT NULL;
ALTER TABLE c_quiz_question_rel_category MODIFY COLUMN question_id INT unsigned NOT NULL;
@ -104,32 +106,12 @@ ALTER TABLE c_quiz ADD COLUMN email_notification_template TEXT DEFAULT '';
ALTER TABLE c_quiz ADD COLUMN model_type INT DEFAULT 1;
ALTER TABLE c_quiz ADD COLUMN score_type_model INT DEFAULT 0;
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';
@ -138,11 +120,7 @@ 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;
@ -166,39 +144,24 @@ 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 );
@ -224,8 +187,6 @@ 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;
@ -261,10 +222,6 @@ 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);
@ -281,11 +238,6 @@ 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;
@ -296,37 +248,13 @@ 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;
ALTER TABLE c_quiz ADD COLUMN global_category_id INT DEFAULT NULL;
-- 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;
@ -368,6 +296,46 @@ ALTER TABLE c_attendance_sheet_log add COLUMN iid int unsigned not null AUTO_INC
ALTER TABLE c_attendance_sheet_log add UNIQUE KEY(c_id,id);
ALTER TABLE c_attendance_sheet_log ENGINE = InnoDB;
ALTER TABLE c_quiz_category ADD COLUMN visibility INT default 1;
ALTER TABLE c_quiz_question ADD INDEX idx_c_q_qst_cpt (c_id, parent_id, type);
ALTER TABLE c_quiz_question_rel_category ADD INDEX idx_c_q_qst_r_cat_qc(question_id, c_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;
ALTER TABLE c_quiz ADD COLUMN global_category_id INT DEFAULT NULL;
-- Admin
INSERT INTO users_roles VALUES (1, 11);
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');
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');
INSERT INTO settings_options(variable, value) VALUES ('last_transaction_id','0');
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);
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);
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');
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);
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');
@ -379,16 +347,11 @@ INSERT INTO settings_options (variable, value, display_text) VALUES ('use_virtua
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('disable_copy_paste', NULL, 'radio', 'Platform', 'false','DisableCopyPasteTitle','DisableCopyPasteComment', NULL, NULL, 1);
INSERT INTO settings_options (variable, value, display_text) VALUES ('disable_copy_paste', 'true', 'Show');
INSERT INTO settings_options (variable, value, display_text) VALUES ('disable_copy_paste', '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;
ALTER TABLE c_quiz_question ADD INDEX idx_c_q_qst_cpt (c_id, parent_id, type);
ALTER TABLE c_quiz_question_rel_category ADD INDEX idx_c_q_qst_r_cat_qc(question_id, c_id);
INSERT INTO branch_transaction_status VALUES (1, 'To be executed'), (2, 'Executed successfully'), (3, 'Execution deprecated'), (4, 'Execution failed');
CREATE TABLE IF NOT EXISTS c_student_publication_rel_document (id INT PRIMARY KEY NOT NULL AUTO_INCREMENT, work_id INT NOT NULL, document_id INT NOT NULL, c_id INT NOT NULL);
CREATE TABLE IF NOT EXISTS c_student_publication_rel_user (id INT PRIMARY KEY NOT NULL AUTO_INCREMENT, work_id INT NOT NULL, user_id INT NOT NULL, c_id INT NOT NULL);
UPDATE course_field SET field_type = 3 WHERE field_variable = 'special_course';
-- Do not move this
UPDATE settings_current SET selected_value = '1.10.0.037' WHERE variable = 'chamilo_database_version';
UPDATE settings_current SET selected_value = '1.10.0.039' WHERE variable = 'chamilo_database_version';

@ -14,25 +14,34 @@
-- 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 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));
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));
CREATE TABLE IF NOT EXISTS 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 IF NOT EXISTS usergroup ( id INT NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL, description TEXT NOT NULL,PRIMARY KEY (id));
CREATE TABLE IF NOT EXISTS usergroup_rel_user ( usergroup_id INT NOT NULL, user_id INT NOT NULL );
CREATE TABLE IF NOT EXISTS usergroup_rel_course ( usergroup_id INT NOT NULL, course_id INT NOT NULL );
CREATE TABLE IF NOT EXISTS usergroup_rel_session ( usergroup_id INT NOT NULL, session_id INT NOT NULL );
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);
CALL drop_index('settings_current', 'unique_setting');
CALL drop_index('settings_options', 'unique_setting_option');
DROP INDEX unique_setting ON settings_current;
DROP INDEX unique_setting_option ON settings_options;
ALTER TABLE course ADD INDEX idx_course_category_code (category_code);
ALTER TABLE course ADD INDEX idx_course_directory (directory(10));
ALTER TABLE user MODIFY COLUMN username VARCHAR(40) NOT NULL;
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;
ALTER TABLE session ADD COLUMN promotion_id INT NOT 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;
ALTER TABLE gradebook_evaluation ADD COLUMN locked int NOT NULL DEFAULT 0;
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;
LOCK TABLES settings_current WRITE, settings_options WRITE;
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');
@ -63,8 +72,6 @@ INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_wi
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');
@ -152,43 +159,23 @@ INSERT INTO settings_current (variable, subkey, type, category, selected_value,
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');
UNLOCK TABLES;
ALTER TABLE gradebook_evaluation ADD COLUMN locked int NOT NULL DEFAULT 0;
INSERT INTO language (original_name, english_name, isocode, dokeos_folder, available) VALUES ('&#2361;&#2367;&#2344;&#2381;&#2342;&#2368;', 'hindi', 'hi', 'hindi', 0);
UPDATE settings_current SET category='Search' WHERE variable='search_enable';
UPDATE settings_current SET variable='chamilo_database_version' WHERE variable='dokeos_database_version';
UPDATE settings_current SET selected_value = '1.8.8.14911' WHERE variable = 'chamilo_database_version';
-- xxSTATSxx
@ -201,31 +188,30 @@ ALTER TABLE personal_agenda ADD INDEX idx_personal_agenda_parent (parent_event_i
ALTER TABLE user_course_category ADD INDEX idx_user_c_cat_uid (user_id);
-- xxCOURSExx
CREATE TABLE {prefix}quiz_question_option (id int NOT NULL, name varchar(255), position int unsigned NOT NULL, PRIMARY KEY (id));
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));
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;
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;
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));

@ -12,315 +12,165 @@
--
-- This first part is for the main database
-- xxMAINxx
-- Optimized version
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);
-- xxMAINxx
LOCK TABLES sys_calendar WRITE;
ALTER TABLE sys_calendar ADD COLUMN all_day INTEGER NOT NULL DEFAULT 0;
UNLOCK TABLES;
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));
LOCK TABLES event_type WRITE;
ALTER TABLE event_type ADD INDEX (name);
UNLOCK TABLES;
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));
LOCK TABLES event_type_email_template WRITE;
ALTER TABLE event_type_email_template ADD INDEX (language_id);
UNLOCK TABLES;
CREATE TABLE IF NOT EXISTS announcement_rel_group (group_id int NOT NULL, announcement_id int NOT NULL, PRIMARY KEY (group_id, announcement_id));
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));
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));
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);
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);
CREATE TABLE IF NOT EXISTS 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 IF NOT EXISTS 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));
CREATE TABLE IF NOT EXISTS 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));
CREATE TABLE IF NOT EXISTS 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));
CREATE TABLE IF NOT EXISTS 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));
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));
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));
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));
CREATE TABLE IF NOT EXISTS 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 '');
CREATE TABLE IF NOT EXISTS 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));
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);
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);
CREATE TABLE IF NOT EXISTS track_e_attempt_coeff ( id int unsigned not null auto_increment primary key, attempt_id INT NOT NULL, marks_coeff float(6,2));
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));
LOCK TABLES group_rel_group WRITE, course_rel_user WRITE, session_rel_course_rel_user WRITE, course WRITE, gradebook_category WRITE, gradebook_link WRITE, chat WRITE, track_course_ranking WRITE, user_rel_course_vote WRITE, user WRITE;
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 gradebook_link MODIFY COLUMN weight FLOAT NOT NULL;
ALTER TABLE gradebook_link ADD COLUMN locked INT DEFAULT 0;
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);
ALTER TABLE course MODIFY COLUMN disk_quota bigint unsigned DEFAULT NULL;
ALTER TABLE user MODIFY COLUMN username VARCHAR(100) NOT NULL;
UNLOCK TABLES;
--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));
LOCK TABLES gradebook_category WRITE, settings_current WRITE, event_email_template WRITE, event_sent WRITE, user_rel_event_type WRITE, usergroup_rel_session WRITE, usergroup_rel_course WRITE, usergroup_rel_user WRITE, admin WRITE, reservation_category_rights WRITE, course WRITE, user_api_key WRITE, track_e_default WRITE, track_e_exercices WRITE;
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);
UNLOCK TABLES;
LOCK TABLES track_e_default WRITE, track_stored_values WRITE, track_stored_values_stack WRITE, track_e_attempt WRITE, track_e_attempt_recording WRITE, track_e_hotpotatoes WRITE, personal_agenda WRITE;
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);
ALTER TABLE personal_agenda ADD COLUMN all_day INTEGER NOT NULL DEFAULT 0;
UNLOCK TABLES;
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), (1, 'update_type','Update script type',0,0), (1, 'google_calendar_url','Google Calendar URL',0,0), (1, 'user_chat_status','User chat status', 0, 0);
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), ('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), ('use_custom_pages', NULL, 'radio','Platform','false','UseCustomPagesTitle','UseCustomPagesComment', NULL, NULL, 1);
INSERT INTO settings_options (variable, value, display_text) VALUES ('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', 'platform', 'casAddUserActivatePlatform'), ('cas_add_user_activate', 'extldap', 'casAddUserActivateLDAP'), ('cas_add_user_activate', 'false', 'No'), ('use_custom_pages', 'true', 'Yes'), ('use_custom_pages', 'false', 'No');
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), ('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), ('show_tabs', 'custom_tab_1', 'checkbox', 'Platform', 'true', 'ShowTabsTitle', 'ShowTabsComment', NULL, 'TabsCustom1', 1), ('show_tabs', 'custom_tab_2', 'checkbox', 'Platform', 'false', 'ShowTabsTitle', 'ShowTabsComment', NULL, 'TabsCustom2', 1), ('show_tabs', 'custom_tab_3', 'checkbox', 'Platform', 'false', 'ShowTabsTitle', 'ShowTabsComment', NULL, 'TabsCustom3', 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);
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'), ('login_is_email', NULL, 'radio', 'Platform', 'false', 'LoginIsEmailTitle', 'LoginIsEmailComment', NULL, NULL, 0), ('scorm_cumulative_session_time', NULL, 'radio', 'Course', 'true', 'ScormCumulativeSessionTimeTitle', 'ScormCumulativeSessionTimeComment', NULL, NULL, 0), ('login_is_email','true','Yes'),('login_is_email','false','No'), ('scorm_cumulative_session_time','true','Yes'), ('scorm_cumulative_session_time','false','No');
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), ('teachers_can_change_grade_model_settings', NULL, 'radio', 'Gradebook', 'true', 'TeachersCanChangeGradeModelSettingsTitle', 'TeachersCanChangeGradeModelSettingsComment', NULL, NULL, 1), ('gradebook_locking_enabled', NULL, 'radio', 'Gradebook', 'false', 'GradebookEnableLockingTitle', 'GradebookEnableLockingComment', 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), ('allow_session_admins_to_manage_all_sessions', NULL, 'radio', 'Session', 'false', 'AllowSessionAdminsToSeeAllSessionsTitle', 'AllowSessionAdminsToSeeAllSessionsComment', NULL, NULL, 1), ('shibboleth_description', NULL, 'radio', 'Shibboleth', 'false', 'ShibbolethMainActivateTitle', 'ShibbolethMainActivateComment', NULL, NULL, 0), ('facebook_description', NULL, 'radio', 'Facebook', 'false', 'FacebookMainActivateTitle', 'FacebookMainActivateComment', NULL, NULL, 0), ('ldap_description', NULL, 'radio', 'LDAP', NULL, 'LdapDescriptionTitle', 'LdapDescriptionComment', NULL, NULL, 0), ('enable_help_link', NULL, 'radio', 'Platform', 'true', 'EnableHelpLinkTitle', 'EnableHelpLinkComment', NULL, NULL, 0), ('allow_hr_skills_management', NULL, 'radio', 'Gradebook', 'true', 'AllowHRSkillsManagementTitle', 'AllowHRSkillsManagementComment', NULL, NULL, 1);
INSERT INTO settings_options (variable, value, display_text) VALUES ('gradebook_enable_grade_model', 'true', 'Yes'), ('gradebook_enable_grade_model', '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'), ('teachers_can_change_score_settings', 'true', 'Yes'), ('teachers_can_change_score_settings', 'false', 'No'), ('allow_users_to_change_email_with_no_password', 'true', 'Yes'), ('allow_users_to_change_email_with_no_password', 'false', 'No'), ('allow_session_admins_to_manage_all_sessions', 'true', 'Yes'), ('allow_session_admins_to_manage_all_sessions', 'false', 'No'), ('enable_help_link', 'true', 'Yes'), (variable, value, display_text) VALUES ('enable_help_link', 'false', 'No'), ('allow_hr_skills_management', 'true', 'Yes'), ('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), ('allow_global_chat', NULL, 'radio', 'Platform', 'true', 'AllowGlobalChatTitle', 'AllowGlobalChatComment', NULL, NULL, 1), ('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), ('allow_public_certificates', NULL, 'radio', 'Course', 'false', 'AllowPublicCertificatesTitle', 'AllowPublicCertificatesComment', NULL, NULL, 1), ('enable_iframe_inclusion', NULL, 'radio', 'Editor', 'false', 'EnableIframeInclusionTitle', 'EnableIframeInclusionComment', NULL, NULL, 1);
INSERT INTO settings_options (variable, value, display_text) VALUES ('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'), ('allow_global_chat', 'true', 'Yes'), ('allow_global_chat', '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'), ('allow_public_certificates', 'true', 'Yes'), ('allow_public_certificates', 'false', 'No'), ('enable_iframe_inclusion', 'true', 'Yes'), ('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), ('gradebook_default_weight', NULL, 'textfield', 'Gradebook', '100', 'GradebookDefaultWeightTitle', 'GradebookDefaultWeightComment', NULL, NULL, 1), ('gradebook_default_grade_model_id', NULL, 'select', 'Gradebook', '', 'GradebookDefaultGradeModelTitle', 'GradebookDefaultGradeModelComment', NULL, NULL, 1);
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), ('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), ('activate_email_template', NULL, 'radio', 'Platform', 'false', 'ActivateEmailTemplateTitle', 'ActivateEmailTemplateComment', NULL, NULL, 0);
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 ('show_hot_courses', 'true', 'Yes'), ('show_hot_courses', 'false', 'No'), ('enable_webcam_clip', 'true', 'Yes'), ('enable_webcam_clip', 'false', 'No'), ('page_after_login', 'main/auth/courses.php', 'CourseCatalog'), ('activate_email_template', 'true', 'Yes'),('activate_email_template', 'false', 'No'), ('allow_skills_tool', 'true', 'Yes'), ('allow_skills_tool', 'false', 'No');
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'), ('platform_unsubscribe_allowed', 'false', 'No');
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 skill (name) VALUES ('Root');
INSERT INTO skill_rel_skill VALUES(1, 1, 0, 0, 0);
INSERT INTO course_type (id, name) VALUES (1, 'All tools');
INSERT INTO course_type (id, name) VALUES (2, 'Entry exam');
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');
UPDATE settings_current SET title = 'DatabaseVersion' WHERE variable = 'chamilo_database_version';
UPDATE settings_current SET selected_value = 'true' WHERE variable = 'more_buttons_maximized_mode';
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));
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';
DELETE FROM settings_current WHERE variable = 'use_document_title';
DELETE FROM settings_options WHERE variable = 'use_document_title';
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';
-- Do not move this query
UPDATE settings_current SET selected_value = '1.9.0.18715b' WHERE variable = 'chamilo_database_version';
-- xxSTATSxx
-- xxUSERxx
ALTER TABLE personal_agenda ADD COLUMN all_day INTEGER NOT NULL DEFAULT 0;
-- xxCOURSExx
CREATE TABLE IF NOT EXISTS metadata (c_id INT NOT NULL, eid VARCHAR(250) NOT NULL, mdxmltext TEXT default '', md5 CHAR(32) default '', htmlcache1 TEXT default '', htmlcache2 TEXT default '', indexabletext TEXT default '', PRIMARY KEY (c_id, eid))
ALTER TABLE lp ADD COLUMN hide_toc_frame INT NOT NULL DEFAULT 0;
ALTER TABLE lp ADD COLUMN seriousgame_mode INT NOT NULL DEFAULT 0;
ALTER TABLE lp_item_view modify column suspend_data longtext;
ALTER TABLE quiz ADD COLUMN review_answers INT NOT NULL DEFAULT 0;
ALTER TABLE student_publication ADD COLUMN contains_file INTEGER NOT NULL DEFAULT 1;
ALTER TABLE student_publication ADD COLUMN allow_text_assignment INTEGER NOT NULL DEFAULT 0;
ALTER TABLE quiz ADD COLUMN random_by_category INT NOT NULL DEFAULT 0;
ALTER TABLE quiz ADD COLUMN text_when_finished TEXT DEFAULT NULL;
ALTER TABLE quiz ADD COLUMN display_category_name INT NOT NULL DEFAULT 1;
ALTER TABLE quiz ADD COLUMN pass_percentage INT DEFAULT NULL;
ALTER TABLE quiz_answer ADD COLUMN answer_code char(10) default '';
ALTER TABLE quiz_question ADD COLUMN question_code char(10) default '';
INSERT INTO course_setting(variable, value, category) VALUES ('allow_public_certificates', 0, 'certificates');

Loading…
Cancel
Save