added new tables for thematic - partial BT#578

skala
Cristian Fasanando 16 years ago
parent e7599354f6
commit e329442edb
  1. 46
      main/inc/lib/add_course.lib.inc.php
  2. 4
      main/inc/lib/database.lib.php
  3. 2
      main/install/dokeos_main.sql
  4. 8
      main/install/migrate-db-1.8.6.2-1.8.7-pre.sql

@ -392,6 +392,10 @@ function update_Db_course($courseDbName, $language = null)
$TBL_ATTENDANCE_CALENDAR = $courseDbName . 'attendance_calendar';
$TBL_ATTENDANCE_RESULT = $courseDbName . 'attendance_result';
// Thematic
$TBL_THEMATIC = $courseDbName . 'thematic';
$TBL_THEMATIC_PLAN = $courseDbName . 'thematic_plan';
$TBL_THEMATIC_ADVANCE = $courseDbName . 'thematic_advance';
/*
-----------------------------------------------------------
@ -1783,6 +1787,48 @@ function update_Db_course($courseDbName, $language = null)
$sql = "ALTER TABLE `".$TBL_ATTENDANCE_RESULT."` ADD INDEX (user_id)";
Database::query($sql);
// thematic table
$sql = "
CREATE TABLE `".$TBL_THEMATIC."` (
id int NOT NULL auto_increment PRIMARY KEY,
title varchar(255) NOT NULL,
content text NULL,
display_order int unsigned NOT NULL DEFAULT 0,
active tinyint NOT NULL DEFAULT 0,
session_id int NOT NULL DEFAULT 0
)" . $charset_clause;
$result = Database::query($sql) or die(Database::error());
$sql = "ALTER TABLE `".$TBL_THEMATIC."` ADD INDEX (active, session_id)";
Database::query($sql);
// thematic plan table
$sql = "
CREATE TABLE `".$TBL_THEMATIC_PLAN."` (
id int NOT NULL auto_increment PRIMARY KEY,
thematic_id int NOT NULL,
title varchar(255) NOT NULL,
description text NULL,
description_type int NOT NULL
)" . $charset_clause;
$result = Database::query($sql) or die(Database::error());
$sql = "ALTER TABLE `".$TBL_THEMATIC_PLAN."` ADD INDEX (thematic_id, description_type)";
Database::query($sql);
// thematic advance table
$sql = "
CREATE TABLE `".$TBL_THEMATIC_ADVANCE."` (
id int NOT NULL auto_increment PRIMARY KEY,
thematic_id int NOT NULL,
attendance_id int NOT NULL DEFAULT 0,
content text NULL,
start_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
duration int NOT NULL DEFAULT 0,
done_advance tinyint NOT NULL DEFAULT 0
)" . $charset_clause;
$result = Database::query($sql) or die(Database::error());
$sql = "ALTER TABLE `".$TBL_THEMATIC_ADVANCE."` ADD INDEX (thematic_id)";
Database::query($sql);
return 0;
}

@ -268,6 +268,10 @@ define('TABLE_ATTENDANCE_CALENDAR', 'attendance_calendar');
define('TABLE_ATTENDANCE_SHEET', 'attendance_sheet');
define('TABLE_ATTENDANCE_RESULT', 'attendance_result');
// Thematic
define('TABLE_THEMATIC','thematic');
define('TABLE_THEMATIC_PLAN', 'thematic_plan');
define('TABLE_THEMATIC_ADVANCE','thematic_advance');
/* DATABASE CLASS
the class and its functions

@ -733,7 +733,7 @@ VALUES
('show_courses_descriptions_in_catalog', NULL, 'radio', 'Course', 'true', 'ShowCoursesDescriptionsInCatalogTitle', 'ShowCoursesDescriptionsInCatalogComment', NULL, NULL, 1),
('allow_coach_to_edit_course_session',NULL,'radio','Course','false','AllowCoachsToEditInsideTrainingSessions','AllowCoachsToEditInsideTrainingSessionsComment',NULL,NULL, 0),
('show_glossary_in_extra_tools', NULL, 'radio', 'Course', 'false', 'ShowGlossaryInExtraToolsTitle', 'ShowGlossaryInExtraToolsComment', NULL, NULL,1),
('dokeos_database_version', NULL, 'textfield', NULL,'1.8.6.2.9070','DokeosDatabaseVersion','',NULL,NULL,0),
('dokeos_database_version', NULL, 'textfield', NULL,'1.8.6.2.11104','DokeosDatabaseVersion','',NULL,NULL,0),
('send_email_to_admin_when_create_course',NULL,'radio','Platform','false','SendEmailToAdminTitle','SendEmailToAdminComment',NULL,NULL, 1),
('go_to_course_after_login',NULL,'radio','Course','false','GoToCourseAfterLoginTitle','GoToCourseAfterLoginComment',NULL,NULL, 0),
('math_mimetex',NULL,'radio','Editor','false','MathMimetexTitle','MathMimetexComment',NULL,NULL, 0),

@ -68,7 +68,7 @@ INSERT INTO settings_current (variable, subkey, type, category, selected_value,
ALTER TABLE user_field_values CHANGE id id BIGINT NOT NULL AUTO_INCREMENT;
ALTER TABLE user_field_values ADD INDEX (user_id, field_id);
UPDATE settings_current SET selected_value = '1.8.7.10983' WHERE variable = 'dokeos_database_version';
UPDATE settings_current SET selected_value = '1.8.7.11104' WHERE variable = 'dokeos_database_version';
ALTER TABLE course_rel_user DROP PRIMARY KEY, ADD PRIMARY KEY (course_code, user_id, relation_type);
ALTER TABLE session_rel_user DROP PRIMARY KEY, ADD PRIMARY KEY (id_session, id_user, relation_type);
@ -118,3 +118,9 @@ ALTER TABLE lp_view ADD session_id INT NOT NULL DEFAULT 0;
ALTER TABLE lp_view ADD INDEX(session_id);
INSERT INTO course_setting (variable,value,category) VALUES ('allow_user_view_user_list',1,'user');
ALTER TABLE tool_intro ADD COLUMN session_id INT NOT NULL DEFAULT 0 AFTER intro_text, DROP PRIMARY KEY, ADD PRIMARY KEY USING BTREE(id, session_id);
CREATE TABLE thematic (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, title VARCHAR( 255 ) NOT NULL, content TEXT NULL, display_order int unsigned not null default 0, active TINYINT NOT NULL default 0, session_id INT NOT NULL DEFAULT 0);
ALTER TABLE thematic ADD INDEX (active, session_id);
CREATE TABLE thematic_plan (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, thematic_id INT NOT NULL, title VARCHAR(255) NOT NULL, description TEXT NULL, description_type` INT NOT NULL);
ALTER TABLE thematic_plan ADD INDEX (thematic_id, description_type);
CREATE TABLE thematic_advance (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, thematic_id INT NOT NULL, attendance_id INT NOT NULL DEFAULT 0, content TEXT NOT NULL, start_date DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', duration INT NOT NULL DEFAULT 0, done_advance tinyint NOT NULL DEFAULT 0);
ALTER TABLE thematic_advance ADD INDEX (thematic_id);
Loading…
Cancel
Save