diff --git a/main/inc/lib/database.lib.php b/main/inc/lib/database.lib.php index 0f0cc05e1a..681f4f6b0b 100644 --- a/main/inc/lib/database.lib.php +++ b/main/inc/lib/database.lib.php @@ -1,4 +1,4 @@ - \ No newline at end of file +?> diff --git a/main/install/dokeos_main.sql b/main/install/dokeos_main.sql index 68fd660e29..f957ef505a 100644 --- a/main/install/dokeos_main.sql +++ b/main/install/dokeos_main.sql @@ -648,7 +648,8 @@ VALUES ('course_create_active_tools','survey','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Survey'), ('course_create_active_tools','glossary','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Glossary'), ('course_create_active_tools','notebook','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Notebook'), -('advanced_filemanager',NULL,'radio','Platform','true','AdvancedFileManagerTitle','AdvancedFileManagerComment',NULL,NULL); +('advanced_filemanager',NULL,'radio','Platform','true','AdvancedFileManagerTitle','AdvancedFileManagerComment',NULL,NULL), +('allow_reservation', NULL, 'radio', 'Tools', 'false', 'AllowReservationTitle', 'AllowReservationComment', NULL, NULL); UNLOCK TABLES; /*!40000 ALTER TABLE settings_current ENABLE KEYS */; @@ -800,7 +801,9 @@ VALUES ('allow_users_to_create_courses','false','No'), ('breadcrumbs_course_homepage', 'session_name_and_course_title', 'SessionNameAndCourseTitle'), ('advanced_filemanager','true','Yes'), -('advanced_filemanager','false','No'); +('advanced_filemanager','false','No'), +('allow_reservation', 'true', 'Yes'), +('allow_reservation', 'false', 'No'); UNLOCK TABLES; /*!40000 ALTER TABLE settings_options ENABLE KEYS */; @@ -1072,4 +1075,108 @@ CREATE TABLE IF NOT EXISTS system_template ( image varchar(250) NOT NULL, content text NOT NULL, PRIMARY KEY (id) -); \ No newline at end of file +); + +-- +-- -------------------------------------------------------- +-- +-- Tables for reservation +-- + + +-- +-- Table structure for table reservation category +-- + +CREATE TABLE reservation_category ( + id int unsigned NOT NULL auto_increment, + parent_id int NOT NULL default 0, + name varchar(128) NOT NULL default '', + PRIMARY KEY ( id ) +); + +-- -------------------------------------------------------- + +-- +-- Table structure for table reservation category_rights +-- + +CREATE TABLE reservation_category_rights ( + category_id int NOT NULL default 0, + class_id int NOT NULL default 0, + m_items tinyint NOT NULL default 0 +); + +-- -------------------------------------------------------- + +-- +-- Table structure for table item reservation +-- + +CREATE TABLE reservation_item ( + id int unsigned NOT NULL auto_increment, + category_id int unsigned NOT NULL default 0, + course_code varchar(40) NOT NULL default '', + name varchar(128) NOT NULL default '', + description text NOT NULL, + blackout tinyint NOT NULL default 0, + creator int unsigned NOT NULL default 0, + PRIMARY KEY ( id ) +); + +-- -------------------------------------------------------- + +-- +-- Table structure for table reservation item_rights +-- + +CREATE TABLE reservation_item_rights ( + item_id int unsigned NOT NULL default 0, + class_id int unsigned NOT NULL default 0, + edit_right tinyint unsigned NOT NULL default 0, + delete_right tinyint unsigned NOT NULL default 0, + m_reservation tinyint unsigned NOT NULL default 0, + view_right tinyint NOT NULL default 0, + PRIMARY KEY ( item_id , class_id ) +); + +-- -------------------------------------------------------- + +-- +-- Table structure for main reservation table +-- + +CREATE TABLE reservation_main ( + id int unsigned NOT NULL auto_increment, + subid int unsigned NOT NULL default 0, + item_id int unsigned NOT NULL default 0, + auto_accept tinyint unsigned NOT NULL default 0, + max_users int unsigned NOT NULL default 1, + start_at datetime NOT NULL default '0000-00-00 00:00:00', + end_at datetime NOT NULL default '0000-00-00 00:00:00', + subscribe_from datetime NOT NULL default '0000-00-00 00:00:00', + subscribe_until datetime NOT NULL default '0000-00-00 00:00:00', + subscribers int unsigned NOT NULL default 0, + notes text NOT NULL, + timepicker tinyint NOT NULL default 0, + timepicker_min int NOT NULL default 0, + timepicker_max int NOT NULL default 0, + PRIMARY KEY ( id ) +); + +-- -------------------------------------------------------- + +-- +-- Table structure for reservation subscription table +-- + +CREATE TABLE reservation_subscription ( + dummy int unsigned NOT NULL auto_increment, + user_id int unsigned NOT NULL default 0, + reservation_id int unsigned NOT NULL default 0, + accepted tinyint unsigned NOT NULL default 0, + start_at datetime NOT NULL default '0000-00-00 00:00:00', + end_at datetime NOT NULL default '0000-00-00 00:00:00', + PRIMARY KEY ( dummy ) +); + diff --git a/main/install/migrate-db-1.8.5-1.8.6-pre.sql b/main/install/migrate-db-1.8.5-1.8.6-pre.sql index 7749110f4e..6e105be124 100644 --- a/main/install/migrate-db-1.8.5-1.8.6-pre.sql +++ b/main/install/migrate-db-1.8.5-1.8.6-pre.sql @@ -50,6 +50,15 @@ INSERT INTO settings_options (variable, value, display_text) VALUES ('breadcrumb INSERT INTO course_module (name, link, image, `row`, `column`, position) VALUES ('notebook','notebook/index.php','notebook.gif',2,1,'basic'); CREATE TABLE sys_calendar ( id int unsigned NOT NULL auto_increment, title varchar(200) NOT NULL, content text, start_date datetime NOT NULL default '0000-00-00 00:00:00', end_date datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (id)); CREATE TABLE IF NOT EXISTS system_template (id int UNSIGNED NOT NULL auto_increment, title varchar(250) NOT NULL, comment text NOT NULL, image varchar(250) NOT NULL, content text NOT NULL, PRIMARY KEY (id)); +CREATE TABLE reservation_category (id int unsigned NOT NULL auto_increment, parent_id int NOT NULL default 0, name varchar(128) NOT NULL default '', PRIMARY KEY ( id )); +CREATE TABLE reservation_category_rights (category_id int NOT NULL default 0, class_id int NOT NULL default 0, m_items tinyint NOT NULL default 0); +CREATE TABLE reservation_item (id int unsigned NOT NULL auto_increment, category_id int unsigned NOT NULL default 0, course_code varchar(40) NOT NULL default '', name varchar(128) NOT NULL default '', description text NOT NULL, blackout tinyint NOT NULL default 0, creator int unsigned NOT NULL default 0, PRIMARY KEY ( id )); +CREATE TABLE reservation_item_rights (item_id int unsigned NOT NULL default 0, class_id int unsigned NOT NULL default 0, edit_right tinyint unsigned NOT NULL default 0, delete_right tinyint unsigned NOT NULL default 0, m_reservation tinyint unsigned NOT NULL default 0, view_right tinyint NOT NULL default 0, PRIMARY KEY ( item_id , class_id )); +CREATE TABLE reservation_main (id int unsigned NOT NULL auto_increment, subid int unsigned NOT NULL default 0, item_id int unsigned NOT NULL default 0, auto_accept tinyint unsigned NOT NULL default 0, max_users int unsigned NOT NULL default 1, start_at datetime NOT NULL default '0000-00-00 00:00:00', end_at datetime NOT NULL default '0000-00-00 00:00:00', subscribe_from datetime NOT NULL default '0000-00-00 00:00:00', subscribe_until datetime NOT NULL default '0000-00-00 00:00:00', subscribers int unsigned NOT NULL default 0, notes text NOT NULL, timepicker tinyint NOT NULL default 0, timepicker_min int NOT NULL default 0, timepicker_max int NOT NULL default 0, PRIMARY KEY ( id )); +CREATE TABLE reservation_subscription (dummy int unsigned NOT NULL auto_increment, user_id int unsigned NOT NULL default 0, reservation_id int unsigned NOT NULL default 0, accepted tinyint unsigned NOT NULL default 0, start_at datetime NOT NULL default '0000-00-00 00:00:00', end_at datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY ( dummy )); +INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext) VALUES ('allow_reservation', NULL, 'radio', 'Tools', 'false', 'AllowReservationTitle', 'AllowReservationComment', NULL, NULL); +INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_reservation', 'true', 'Yes'); +INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_reservation', 'false', 'No'); -- xxSTATSxx ALTER TABLE track_e_exercices ADD status varchar(20) NOT NULL default ''; @@ -144,4 +153,5 @@ ALTER TABLE glossary ADD display_order int; CREATE TABLE calendar_event_attachment ( id int NOT NULL auto_increment, path varchar(255) NOT NULL, comment text, size int NOT NULL default 0, agenda_id int NOT NULL, filename varchar(255) NOT NULL, PRIMARY KEY (id) ); CREATE TABLE notebook (notebook_id int unsigned NOT NULL auto_increment,user_id int unsigned NOT NULL,course varchar(40) not null,session_id int NOT NULL default 0,title varchar(255) NOT NULL,description text NOT NULL,creation_date datetime NOT NULL default '0000-00-00 00:00:00',update_date datetime NOT NULL default '0000-00-00 00:00:00',PRIMARY KEY (notebook_id)); INSERT INTO course_setting(variable,value,category) VALUES ('allow_open_chat_window',0,'chat'); -INSERT INTO course_setting(variable,value,category) VALUES ('email_alert_to_teacher_on_new_user_in_course',0,'registration'); \ No newline at end of file +INSERT INTO course_setting(variable,value,category) VALUES ('email_alert_to_teacher_on_new_user_in_course',0,'registration'); +