[svn r17683] Adding the Booking System Database (a.k.a Reservation 2 extension) FS#821

skala
Julio Montoya 16 years ago
parent 564ca56a7f
commit 18df5bdc62
  1. 19
      main/inc/lib/database.lib.php
  2. 113
      main/install/dokeos_main.sql
  3. 12
      main/install/migrate-db-1.8.5-1.8.6-pre.sql

@ -1,4 +1,4 @@
<?php // $Id: database.lib.php 17550 2009-01-06 18:56:28Z marvil07 $
<?php // $Id: database.lib.php 17683 2009-01-13 18:08:58Z juliomontoya $
/* See license terms in /dokeos_license.txt */
/**
==============================================================================
@ -58,6 +58,12 @@ define('TABLE_MAIN_SPECIFIC_FIELD_VALUES', 'specific_field_values');
define('TABLE_MAIN_SEARCH_ENGINE_REF', 'search_engine_ref');
define('TABLE_MAIN_ACCESS_URL', 'access_url');
define('TABLE_MAIN_SYSTEM_CALENDAR', 'sys_calendar');
//Reservation System
define('TABLE_MAIN_RESERVATION_ITEM', 'reservation_item');
define('TABLE_MAIN_RESERVATION_RESERVATION', 'reservation_main');
define('TABLE_MAIN_RESERVATION_SUBSCRIBTION', 'reservation_subscription');
define('TABLE_MAIN_RESERVATION_CATEGORY', 'reservation_category');
define('TABLE_MAIN_RESERVATION_ITEM_RIGHTS', 'reservation_item_rights');
//statistic database tables
define('TABLE_STATISTIC_TRACK_E_LASTACCESS', 'track_e_lastaccess');
@ -194,6 +200,8 @@ define('TABLE_GLOSSARY', 'glossary');
// GLOSSARY
define('TABLE_NOTEBOOK', 'notebook');
/*
==============================================================================
DATABASE CLASS
@ -786,9 +794,10 @@ class Database
return $option['course_code'];
} else {
return false;
}
}
}
}
}
//end class Database
?>
?>

@ -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)
);
);
--
-- --------------------------------------------------------
--
-- 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 )
);

@ -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');
INSERT INTO course_setting(variable,value,category) VALUES ('email_alert_to_teacher_on_new_user_in_course',0,'registration');

Loading…
Cancel
Save