diff --git a/main/inc/lib/add_course.lib.inc.php b/main/inc/lib/add_course.lib.inc.php
index 6ffe1f28e0..43753b4c03 100644
--- a/main/inc/lib/add_course.lib.inc.php
+++ b/main/inc/lib/add_course.lib.inc.php
@@ -85,7 +85,7 @@ function generate_course_code($course_title)
{
//$wantedCode = strtr($course_title, "�����������������������������������������������������������", "AAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy");
//$wantedCode = substr(str_replace(
- // array('�?','À','Â','Ä','Ã','Å','Æ' ,'Ç','É','È','Ê','Ë','�?','Ì','Î','�?','Ĩ','Ó','Ò','Ô','Ö','Õ','Ø' ,'Œ' ,'Ú','Ù','Û','Ü','Ũ','Ÿ','�?','�?','Ñ','ß' ,'à','á','â','ä','ã','å','æ' ,'ç','Š','é','è','ê','ë','ì','í','î','ï','ĩ','ò','ó','ô','ö','õ','ø' ,'œ' ,'ú','ù','û','ü','ũ','ÿ','ý','ñ','š','€'),
+ // array('Á','À','Â','Ä','Ã','Å','Æ' ,'Ç','É','È','Ê','Ë','Í','Ì','Î','Ï','Ĩ','Ó','Ò','Ô','Ö','Õ','Ø' ,'Œ' ,'Ú','Ù','Û','Ü','Ũ','Ÿ','Ý','Ð','Ñ','ß' ,'à','á','â','ä','ã','å','æ' ,'ç','Š','é','è','ê','ë','ì','í','î','ï','ĩ','ò','ó','ô','ö','õ','ø' ,'œ' ,'ú','ù','û','ü','ũ','ÿ','ý','ñ','š','€'),
// array('A','A','A','A','A','A','Ae','C','E','E','E','E','I','I','I','I','I','O','O','O','O','O','Oe','Oe','U','U','U','U','U','Y','Y','D','N','SS','a','a','a','a','a','a','ae','c','S','e','e','e','e','i','i','i','i','i','o','o','o','o','o','oe','oe','u','u','u','u','u','y','y','n','š','Euro'),
// $course_title)
// ,0,20);
@@ -321,6 +321,8 @@ function update_Db_course($courseDbName)
$TABLETOOLFORUMMAILCUE = $courseDbName . 'forum_mailcue';
$TABLETOOLFORUMATTACHMENT = $courseDbName . 'forum_attachment';
$TABLETOOLFORUMNOTIFICATION = $courseDbName . 'forum_notification';
+ $TABLETOOLFORUMQUALIFY = $courseDbName.'forum_thread_qualify';
+ $TABLETOOLFORUMQUALIFYLOG = $courseDbName.'forum_thread_qualify_log';
// Link
$TABLETOOLLINK = $courseDbName . 'link';
@@ -345,12 +347,6 @@ function update_Db_course($courseDbName)
$TABLETOOLDROPBOXCATEGORY = $courseDbName . 'dropbox_category';
$TABLETOOLDROPBOXFEEDBACK = $courseDbName . 'dropbox_feedback';
- // Learning Path
- $TABLELEARNPATHITEMS = $courseDbName . 'learnpath_item';
- $TABLELEARNPATHCHAPTERS = $courseDbName . 'learnpath_chapter';
- $TABLELEARNPATHMAIN = $courseDbName . 'learnpath_main';
- $TABLELEARNPATHUSERS = $courseDbName . 'learnpath_user';
-
// New Learning path
$TABLELP = $courseDbName . 'lp';
$TABLELPITEM = $courseDbName . 'lp_item';
@@ -527,6 +523,10 @@ function update_Db_course($courseDbName)
thread_date datetime default '0000-00-00 00:00:00',
thread_sticky tinyint unsigned default 0,
locked int NOT NULL default 0,
+ session_id int unsigned default NULL,
+ thread_title_qualify varchar(255) default '',
+ thread_qualify_max int unsigned default 0,
+ thread_close_date datetime default '0000-00-00 00:00:00',
PRIMARY KEY (thread_id)
) TYPE=MyISAM";
@@ -592,7 +592,34 @@ function update_Db_course($courseDbName)
KEY forum_id (forum_id)
)";
api_sql_query($sql, __FILE__, __LINE__);
-
+
+ // Forum thread qualify :Add table forum_thread_qualify
+ $sql = "CREATE TABLE `".$TABLETOOLFORUMQUALIFY."` (
+ id int unsigned PRIMARY KEY AUTO_INCREMENT,
+ user_id int unsigned NOT NULL,
+ thread_id int NOT NULL,
+ qualify int default NULL,
+ qualify_user_id int default NULL,
+ qualify_time datetime default '0000-00-00 00:00:00',
+ session_id int default NULL
+ )";
+ api_sql_query($sql, __FILE__, __LINE__);
+ $sql = "ALTER TABLE `".$TABLETOOLFORUMQUALIFY . "` ADD INDEX (user_id, thread_id)";
+ api_sql_query($sql, __FILE__, __LINE__);
+
+ //Forum thread qualify: Add table forum_thread_qualify_historical
+ $sql = "CREATE TABLE `".$TABLETOOLFORUMQUALIFYLOG."` (
+ id int unsigned PRIMARY KEY AUTO_INCREMENT,
+ user_id int unsigned NOT NULL,
+ thread_id int NOT NULL,
+ qualify int default NULL,
+ qualify_user_id int default NULL,
+ qualify_time datetime default '0000-00-00 00:00:00',
+ session_id int default NULL
+ )";
+ api_sql_query($sql, __FILE__, __LINE__);
+ $sql = "ALTER TABLE `".$TABLETOOLFORUMQUALIFYLOG. "` ADD INDEX (user_id, thread_id)";
+ api_sql_query($sql, __FILE__, __LINE__);
/*
-----------------------------------------------------------
Exercise tool
@@ -706,8 +733,8 @@ function update_Db_course($courseDbName)
content text,
start_date datetime NOT NULL default '0000-00-00 00:00:00',
end_date datetime NOT NULL default '0000-00-00 00:00:00',
- parent_event_id INT NULL,
- session_id SMALLINT unsigned NOT NULL default 0,
+ parent_event_id INT NULL,
+ session_id int unsigned NOT NULL default 0,
PRIMARY KEY (id)
)";
api_sql_query($sql, __FILE__, __LINE__);
@@ -1939,6 +1966,7 @@ function fill_Db_course($courseDbName, $courseRepository, $language,$default_doc
api_sql_query("INSERT INTO `" . $tbl_course_homepage . "` VALUES (NULL, '" . TOOL_STUDENTPUBLICATION . "','work/work.php','works.gif','".string2binary(api_get_setting('course_create_active_tools', 'student_publications')) . "','0','squaregrey.gif','NO','_self','interaction')", __FILE__, __LINE__);
api_sql_query("INSERT INTO `" . $tbl_course_homepage . "` VALUES (NULL, '" . TOOL_SURVEY."','survey/survey_list.php','survey.gif','1','0','','NO','_self','interaction')");
api_sql_query("INSERT INTO `" . $tbl_course_homepage . "` VALUES (NULL, '" . TOOL_WIKI ."','wiki/index.php','wiki.gif','".string2binary(api_get_setting('course_create_active_tools', 'wiki')) . "','0','squaregrey.gif','NO','_self','interaction')", __FILE__, __LINE__);
+ api_sql_query("INSERT INTO `" . $tbl_course_homepage . "` VALUES (NULL, '" . TOOL_GRADEBOOK."','gradebook/index.php','gradebook.gif','".string2binary(api_get_setting('course_create_active_tools', 'gradebook'))."','0','','NO','_self','authoring')");
if(api_get_setting('service_visio','active')=='true')
{
@@ -2152,7 +2180,7 @@ function fill_Db_course($courseDbName, $courseRepository, $language,$default_doc
$html=addslashes('
.'default_course_document/images/mr_dokeos/thinking.jpg) | '.lang2db(get_lang('Antique')).' |
');
api_sql_query('INSERT INTO `'.$TABLEQUIZ . '` (title, description, type, random, active, results_disabled ) VALUES ("'.lang2db(get_lang('ExerciceEx')) . '", "'.$html.'", "1", "0", "1", "0")', __FILE__, __LINE__);
api_sql_query("INSERT INTO `".$TABLEQUIZQUESTIONLIST . "` VALUES ( '1', '".lang2db(get_lang('SocraticIrony')) . "', '".lang2db(get_lang('ManyAnswers')) . "', '10', '1', '2','')", __FILE__, __LINE__);
- api_sql_query("INSERT INTO `".$TABLEQUIZQUESTION . "` VALUES ( '1','1','1')", __FILE__, __LINE__);
+ api_sql_query("INSERT INTO `".$TABLEQUIZQUESTION . "` (question_id, exercice_id, question_order) VALUES (1,1,1)", __FILE__, __LINE__);
/*
@@ -2168,7 +2196,7 @@ function fill_Db_course($courseDbName, $courseRepository, $language,$default_doc
$insert_id = Database :: get_last_insert_id();
api_sql_query("INSERT INTO `".$TABLEITEMPROPERTY . "` (tool,insert_user_id,insert_date,lastedit_date,ref,lastedit_type,lastedit_user_id,to_group_id,to_user_id,visibility) VALUES ('" . TOOL_FORUM . "',1,NOW(),NOW(),$insert_id,'ForumAdded',1,0,NULL,1)", __FILE__, __LINE__);
- api_sql_query("INSERT INTO `$TABLEFORUMTHREADS` VALUES (1, '".lang2db(get_lang('ExampleThread'))."', 1, 0, 1, '', 0, 1, NOW(), 0, 0)", __FILE__, __LINE__);
+ api_sql_query("INSERT INTO `$TABLEFORUMTHREADS` (thread_id, thread_title, forum_id, thread_replies, thread_poster_id, thread_poster_name, thread_views, thread_last_post, thread_date, locked, thread_qualify_max) VALUES (1, '".lang2db(get_lang('ExampleThread'))."', 1, 0, 1, '', 0, 1, NOW(), 0, 10)", __FILE__, __LINE__);
$insert_id = Database :: get_last_insert_id();
api_sql_query("INSERT INTO `".$TABLEITEMPROPERTY . "` (tool,insert_user_id,insert_date,lastedit_date,ref,lastedit_type,lastedit_user_id,to_group_id,to_user_id,visibility) VALUES ('forum_thread',1,NOW(),NOW(),$insert_id,'ForumThreadAdded',1,0,NULL,1)", __FILE__, __LINE__);
@@ -2360,5 +2388,4 @@ function readPropertiesInArchive($archive, $isCompressed = TRUE)
$courseProperties = parse_ini_file($pathToArchiveIni);
rmdir($tmpDirName);
return $courseProperties;
-}
-?>
+}
\ No newline at end of file
diff --git a/main/install/dokeos_main.sql b/main/install/dokeos_main.sql
index ffb6b32aa8..5a58463c98 100644
--- a/main/install/dokeos_main.sql
+++ b/main/install/dokeos_main.sql
@@ -248,7 +248,8 @@ INSERT INTO course_module VALUES
(22,'blog_management','blog/blog_admin.php','blog_admin.gif',1,2,'courseadmin'),
(23,'course_maintenance','course_info/maintenance.php','backup.gif',2,3,'courseadmin'),
(24,'survey','survey/survey_list.php','survey.gif',2,1,'basic'),
-(25,'wiki','wiki/index.php','wiki.gif',2,3,'basic');
+(25,'wiki','wiki/index.php','wiki.gif',2,3,'basic'),
+(26,'gradebook','gradebook/index.php','gradebook.gif',2,2,'basic');
UNLOCK TABLES;
/*!40000 ALTER TABLE course_module ENABLE KEYS */;
@@ -621,7 +622,8 @@ VALUES
('extend_rights_for_coach',NULL,'radio','Security','false','ExtendRightsForCoachTitle','ExtendRightsForCoachComment',NULL,NULL),
('extend_rights_for_coach_on_survey',NULL,'radio','Security','true','ExtendRightsForCoachOnSurveyTitle','ExtendRightsForCoachOnSurveyComment',NULL,NULL),
('course_create_active_tools','wiki','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Wiki'),
-('show_session_coach', NULL, 'radio','Platform','false', 'ShowSessionCoachTitle','ShowSessionCoachComment', NULL, NULL);
+('show_session_coach', NULL, 'radio','Platform','false', 'ShowSessionCoachTitle','ShowSessionCoachComment', NULL, NULL),
+('course_create_active_tools','gradebook','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Gradebook');
UNLOCK TABLES;
/*!40000 ALTER TABLE settings_current ENABLE KEYS */;
@@ -1002,3 +1004,26 @@ CREATE TABLE access_url(
PRIMARY KEY (id)
);
INSERT INTO access_url(url,description,active,created_by) VALUES ('http://localhost/','URL 1',1,1);
+ALTER TABLE gradebook_category ADD session_id int DEFAULT NULL;
+CREATE TABLE gradebook_result_log (
+ id int NOT NULL auto_increment,
+ id_result int NOT NULL,
+ user_id int NOT NULL,
+ evaluation_id int NOT NULL,
+ date_log datetime default '0000-00-00 00:00:00',
+ score float unsigned default NULL,
+ PRIMARY KEY(id)
+);
+
+CREATE TABLE gradebook_linkeval_log (
+ id int NOT NULL auto_increment,
+ id_linkeval_log int NOT NULL,
+ name text,
+ description text,
+ date_log datetime default '0000-00-00 00:00:00',
+ weight smallint default NULL,
+ visible tinyint default NULL,
+ type varchar(20) NOT NULL,
+ user_id_log int NOT NULL,
+ PRIMARY KEY (id)
+);
\ No newline at end of file
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 a61300cc22..3b4c629eec 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
@@ -21,18 +21,23 @@ INSERT INTO settings_options (variable, value, display_text) VALUES ('add_users_
INSERT INTO settings_options (variable, value, display_text) VALUES ('add_users_by_coach', 'false', 'No');
ALTER TABLE session ADD nb_days_access_before_beginning TINYINT NULL DEFAULT '0' AFTER date_end , ADD nb_days_access_after_end TINYINT NULL DEFAULT '0' AFTER nb_days_access_before_beginning ;
ALTER TABLE course_rel_user ADD INDEX (user_id);
-INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url, access_url_changeable) VALUES ('course_create_active_tools', 'wiki', 'checkbox', 'Tools', 'true', 'CourseCreateActiveToolsTitle', 'CourseCreateActiveToolsComment', NULL, 'Wiki', 1, 0);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url, access_url_changeable) VALUES ('course_create_active_tools', 'wiki', 'checkbox', 'Tools', 'true', 'CourseCreateActiveToolsTitle', 'CourseCreateActiveToolsComment', NULL, 'Wiki', 1, 0);
INSERT INTO settings_current (variable, subkey,type,category,selected_value,title,comment,scope,subkeytext)VALUES ('extend_rights_for_coach',NULL,'radio','Security','false','ExtendRightsForCoachTitle','ExtendRightsForCoachComment',NULL,NULL);
INSERT INTO settings_options (variable, value, display_text) VALUES ('extend_rights_for_coach', 'true', 'Yes');
-INSERT INTO settings_options (variable, value, display_text) VALUES ('extend_rights_for_coach', 'false', 'No');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('extend_rights_for_coach', 'false', 'No');
INSERT INTO settings_current (variable, subkey,type,category,selected_value,title,comment,scope,subkeytext)VALUES ('extend_rights_for_coach_on_surveys',NULL,'radio','Security','false','ExtendRightsForCoachOnSurveyTitle','ExtendRightsForCoachOnSurveyComment',NULL,NULL);
INSERT INTO settings_options (variable, value, display_text) VALUES ('extend_rights_for_coach_on_surveys', 'true', 'Yes');
INSERT INTO settings_options (variable, value, display_text) VALUES ('extend_rights_for_coach_on_surveys', 'false', 'No');
INSERT INTO settings_current (variable, subkey,type,category,selected_value,title,comment,scope,subkeytext)VALUES ('show_session_coach',NULL,'radio','Platform','false','ShowSessionCoachTitle','ShowSessionCoachComment',NULL,NULL);
INSERT INTO settings_options (variable, value, display_text) VALUES ('show_session_coach', 'true', 'Yes');
INSERT INTO settings_options (variable, value, display_text) VALUES ('show_session_coach', 'false', 'No');
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url, access_url_changeable) VALUES ('course_create_active_tools','gradebook','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Gradebook',1,0);
INSERT INTO course_module (name, link, image, `row`, `column`, position) VALUES ('wiki','wiki/index.php','wiki.gif',2,3,'basic');
-
+INSERT INTO course_module (name, link, image, `row`, `column`, position) VALUES ('gradebook','gradebook/index.php','gradebook.gif',2,2,'basic');
+ALTER TABLE gradebook_category ADD session_id int DEFAULT NULL;
+CREATE TABLE gradebook_result_log (id int NOT NULL auto_increment,id_result int NOT NULL,user_id int NOT NULL,evaluation_id int NOT NULL,date_log datetime default '0000-00-00 00:00:00',score float unsigned default NULL,PRIMARY KEY(id));
+CREATE TABLE gradebook_linkeval_log (id int NOT NULL auto_increment,id_linkeval_log int NOT NULL,name text,description text,date_log datetime default '0000-00-00 00:00:00',weight smallint default NULL,visible tinyint default NULL,type varchar(20) NOT NULL,user_id_log int NOT NULL,PRIMARY KEY (id));
+
-- xxSTATSxx
ALTER TABLE track_e_exercices ADD status varchar(20) NOT NULL default '';
ALTER TABLE track_e_exercices ADD data_tracking text NOT NULL default '';
@@ -65,6 +70,7 @@ ALTER TABLE survey ADD form_fields TEXT NOT NULL;
ALTER TABLE quiz_answer CHANGE hotspot_type hotspot_type ENUM( 'square', 'circle', 'poly', 'delineation' ) NULL DEFAULT NULL;
ALTER TABLE quiz ADD start_time datetime NOT NULL default '0000-00-00 00:00:00';
ALTER TABLE quiz ADD end_time datetime NOT NULL default '0000-00-00 00:00:00';
+ALTER TABLE quiz ADD max_attempt int NOT NULL default 0;
ALTER TABLE forum_forum ADD forum_image varchar(255) NOT NULL default '';
ALTER TABLE lp ADD preview_image varchar(255) NOT NULL default '';
ALTER TABLE lp ADD author varchar(255) NOT NULL default '';
@@ -78,12 +84,6 @@ ALTER TABLE announcement ADD session_id SMALLINT UNSIGNED NOT NULL;
ALTER TABLE announcement ADD INDEX ( session_id ) ;
ALTER TABLE forum_category ADD session_id SMALLINT UNSIGNED NOT NULL ;
ALTER TABLE forum_category ADD INDEX ( session_id ) ;
-CREATE TABLE student_publication_assignment (id int NOT NULL auto_increment, expires_on datetime NOT NULL default '0000-00-00 00:00:00', ends_on datetime NOT NULL default '0000-00-00 00:00:00', add_to_calendar tinyint NOT NULL, enable_qualification tinyint NOT NULL, publication_id int NOT NULL, PRIMARY KEY (id));
-ALTER TABLE student_publication ADD has_properties INT UNSIGNED NOT NULL;
-ALTER TABLE student_publication ADD qualification INT UNSIGNED NOT NULL;
-ALTER TABLE student_publication ADD date_of_qualification datetime NOT NULL default '0000-00-00 00:00:00';
-ALTER TABLE student_publication ADD parent_id INT UNSIGNED NOT NULL;
-ALTER TABLE student_publication ADD qualificator_id INT UNSIGNED NOT NULL;
ALTER TABLE student_publication ADD session_id SMALLINT UNSIGNED NOT NULL default 0 ;
ALTER TABLE student_publication ADD INDEX ( session_id ) ;
ALTER TABLE calendar_event ADD session_id SMALLINT UNSIGNED NOT NULL default 0 ;
@@ -95,4 +95,20 @@ ALTER TABLE survey ADD INDEX ( session_id ) ;
CREATE TABLE wiki_discuss (id int NOT NULL auto_increment, publication_id int NOT NULL default 0, userc_id int NOT NULL default 0, comment text NOT NULL, p_score varchar(255) default NULL, timestamp timestamp(14) NOT NULL, PRIMARY KEY (id) );
CREATE TABLE wiki_mailcue (id int NOT NULL, user_id int NOT NULL, type text NOT NULL, group_id int DEFAULT NULL, KEY (id) );
ALTER TABLE lp_item ADD audio VARCHAR(250);
-CREATE TABLE wiki_conf (id int NOT NULL auto_increment, feedback1 text NOT NULL, feedback2 text NOT NULL, feedback3 text NOT NULL, max_size int default NULL, max_text int default NULL, allow_attachments int default NULL, PRIMARY KEY (id) );
+CREATE TABLE wiki_conf (id int NOT NULL auto_increment, feedback1 text NOT NULL, feedback2 text NOT NULL, feedback3 text NOT NULL, max_size int default NULL, max_text int default NULL, allow_attachments int default NULL, PRIMARY KEY (id) );
+CREATE TABLE student_publication_assignment (id int NOT NULL auto_increment, expires_on datetime NOT NULL default '0000-00-00 00:00:00', ends_on datetime NOT NULL default '0000-00-00 00:00:00', add_to_calendar tinyint NOT NULL, enable_qualification tinyint NOT NULL, publication_id int NOT NULL, PRIMARY KEY (id));
+ALTER TABLE student_publication ADD has_properties INT UNSIGNED NOT NULL DEFAULT 0;
+ALTER TABLE student_publication ADD qualification INT UNSIGNED NOT NULL DEFAULT 0;
+ALTER TABLE student_publication ADD date_of_qualification datetime NOT NULL default '0000-00-00 00:00:00';
+ALTER TABLE student_publication ADD parent_id INT UNSIGNED NOT NULL DEFAULT 0;
+ALTER TABLE student_publication ADD qualificator_id INT UNSIGNED NOT NULL DEFAULT 0;
+CREATE TABLE forum_thread_qualify (id int unsigned PRIMARY KEY AUTO_INCREMENT, user_id int unsigned NOT NULL,thread_id int NOT NULL,qualify int default NULL,qualify_user_id int default NULL,qualify_time datetime NOT NULL default '0000-00-00 00:00:00', session_id int default NULL);
+ALTER TABLE forum_thread_qualify ADD INDEX (user_id, thread_id);
+ALTER TABLE forum_thread ADD session_id int unsigned default NULL;
+ALTER TABLE forum_thread ADD thread_title_qualify varchar(255) default '';
+ALTER TABLE forum_thread ADD thread_qualify_max int unsigned default 0;
+CREATE TABLE forum_thread_qualify_log (id int unsigned PRIMARY KEY AUTO_INCREMENT, user_id int unsigned NOT NULL,thread_id int NOT NULL,qualify int default NULL,qualify_user_id int default NULL,qualify_time datetime NOT NULL default '0000-00-00 00:00:00', session_id int default NULL);
+ALTER TABLE forum_thread_qualify_log ADD INDEX (user_id, thread_id);
+INSERT INTO tool(name,link,image,visibility,admin,address,added_tool,target,category) VALUES ('gradebook','gradebook/index.php','gradebook.gif',1,'0','squaregrey.gif',0,'_self','authoring');
+ALTER TABLE forum_thread ADD thread_close_date datetime default '0000-00-00 00:00:00';
+ALTER TABLE student_publication ADD view_properties tinyint NULL;
\ No newline at end of file