Parcourir la source

[svn r10944] survey constants

Patrick Cool il y a 18 ans
Parent
commit
2e6cadd28a
1 fichiers modifiés avec 41 ajouts et 38 suppressions
  1. 41 38
      main/inc/lib/database.lib.php

+ 41 - 38
main/inc/lib/database.lib.php

@@ -1,42 +1,42 @@
 <?php
 <?php
 /*
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004-2005 Dokeos S.A.
 	Copyright (c) 2004-2005 Dokeos S.A.
 	Copyright (c) Roan Embrechts, Vrije Universiteit Brussel
 	Copyright (c) Roan Embrechts, Vrije Universiteit Brussel
 	Copyright (c) Patrick Cool, Ghent University
 	Copyright (c) Patrick Cool, Ghent University
 	Copyright (c) Yannick Warnier, Dokeos S.A.
 	Copyright (c) Yannick Warnier, Dokeos S.A.
 	Copyright (c) Bart Mollet, Hogeschool Gent
 	Copyright (c) Bart Mollet, Hogeschool Gent
-	
+
 	For a full list of contributors, see "credits.txt".
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 */
 /**
 /**
-============================================================================== 
+==============================================================================
 *	This is the main database library for Dokeos.
 *	This is the main database library for Dokeos.
 *	Include/require it in your code to use its functionality.
 *	Include/require it in your code to use its functionality.
 *
 *
 *	@package dokeos.library
 *	@package dokeos.library
-* 	@todo the table constants have all to start with TABLE_ 
+* 	@todo the table constants have all to start with TABLE_
 * 		  This is because of the analogy with the tool constants TOOL_
 * 		  This is because of the analogy with the tool constants TOOL_
-============================================================================== 
+==============================================================================
 */
 */
 /*
 /*
-============================================================================== 
+==============================================================================
 		CONSTANTS
 		CONSTANTS
-============================================================================== 
+==============================================================================
 */
 */
 //main database tables
 //main database tables
 define('TABLE_MAIN_COURSE', 'course');
 define('TABLE_MAIN_COURSE', 'course');
@@ -144,20 +144,23 @@ define('TABLE_ONLINE_CONNECTED', 'online_connected');
 define('TABLE_PERSONAL_AGENDA', 'personal_agenda');
 define('TABLE_PERSONAL_AGENDA', 'personal_agenda');
 define('TABLE_USER_COURSE_CATEGORY', 'user_course_category');
 define('TABLE_USER_COURSE_CATEGORY', 'user_course_category');
 //Survey
 //Survey
-// @todo: are these MAIN tables or course tables ? 
+// @todo: are these MAIN tables or course tables ?
 define('TABLE_MAIN_SURVEY', 'survey');
 define('TABLE_MAIN_SURVEY', 'survey');
 define('TABLE_MAIN_GROUP', 'survey_group');
 define('TABLE_MAIN_GROUP', 'survey_group');
 define('TABLE_MAIN_SURVEYQUESTION', 'questions');
 define('TABLE_MAIN_SURVEYQUESTION', 'questions');
 // SURVEY
 // SURVEY
 define('TABLE_SURVEY', 'survey');
 define('TABLE_SURVEY', 'survey');
-define('TABLE_SURVEY_GROUP', 'survey_group');
 define('TABLE_SURVEY_QUESTION', 'survey_question');
 define('TABLE_SURVEY_QUESTION', 'survey_question');
+define('TABLE_SURVEY_QUESTION_OPTION', 'survey_question_option');
+define('TABLE_SURVEY_INVITATION', 'survey_invitation');
+define('TABLE_SURVEY_ANSWER', 'survey_answer');
+
 
 
 /*
 /*
-============================================================================== 
+==============================================================================
 		DATABASE CLASS
 		DATABASE CLASS
 		the class and its functions
 		the class and its functions
-============================================================================== 
+==============================================================================
 */
 */
 /**
 /**
  *	@package dokeos.library
  *	@package dokeos.library
@@ -184,7 +187,7 @@ class Database
 	*/
 	*/
 	function get_statistic_database()
 	function get_statistic_database()
 	{
 	{
-		global $_configuration;		
+		global $_configuration;
 		return $_configuration['statistics_database'];
 		return $_configuration['statistics_database'];
 	}
 	}
 	/**
 	/**
@@ -234,13 +237,13 @@ class Database
 	/**
 	/**
 	*	Returns the database prefix.
 	*	Returns the database prefix.
 	*	All created COURSE databases are prefixed with this string.
 	*	All created COURSE databases are prefixed with this string.
-	*	
+	*
 	*	TIP: this can be convenient e.g. if you have multiple Dokeos installations
 	*	TIP: this can be convenient e.g. if you have multiple Dokeos installations
 	*	on the same physical server.
 	*	on the same physical server.
 	*/
 	*/
 	function get_database_name_prefix()
 	function get_database_name_prefix()
 	{
 	{
-		global $_configuration; 
+		global $_configuration;
 		return $_configuration['db_prefix'];
 		return $_configuration['db_prefix'];
 	}
 	}
 	/**
 	/**
@@ -252,18 +255,18 @@ class Database
 	function get_course_table_prefix()
 	function get_course_table_prefix()
 	{
 	{
 		global $_configuration;
 		global $_configuration;
-		return $_configuration['table_prefix']; 
+		return $_configuration['table_prefix'];
 	}
 	}
 	/*
 	/*
 	-----------------------------------------------------------------------------
 	-----------------------------------------------------------------------------
 		Table Name functions
 		Table Name functions
-		use these functions to get a table name for queries, 
+		use these functions to get a table name for queries,
 		instead of constructing them yourself.
 		instead of constructing them yourself.
-		
+
 		Backticks automatically surround the result,
 		Backticks automatically surround the result,
 		e.g. `COURSE_NAME`.`link`
 		e.g. `COURSE_NAME`.`link`
 		so the queries can look cleaner.
 		so the queries can look cleaner.
-		
+
 		Example:
 		Example:
 		$table = Database::get_course_table(TABLE_DOCUMENT);
 		$table = Database::get_course_table(TABLE_DOCUMENT);
 		$sql_query = "SELECT * FROM $table WHERE $condition";
 		$sql_query = "SELECT * FROM $table WHERE $condition";
@@ -303,7 +306,7 @@ class Database
 	}
 	}
 	/**
 	/**
 	 * This generic function returns the correct and complete name of any statistic table
 	 * This generic function returns the correct and complete name of any statistic table
-	 * of which you pass the short name as a parameter. 
+	 * of which you pass the short name as a parameter.
 	 * Please define table names as constants in this library and use them
 	 * Please define table names as constants in this library and use them
 	 * instead of directly using magic words in your tool code.
 	 * instead of directly using magic words in your tool code.
 	 *
 	 *
@@ -359,10 +362,10 @@ class Database
 		these execute a query and return the result(s).
 		these execute a query and return the result(s).
 	-----------------------------------------------------------------------------
 	-----------------------------------------------------------------------------
 	*/
 	*/
-	
+
 	/**
 	/**
 	*	@return a list (array) of all courses.
 	*	@return a list (array) of all courses.
-	* 	@todo shouldn't this be in the course.lib.php script? 
+	* 	@todo shouldn't this be in the course.lib.php script?
 	*/
 	*/
 	function get_course_list()
 	function get_course_list()
 	{
 	{
@@ -372,12 +375,12 @@ class Database
 		$result = api_store_result($sql_result);
 		$result = api_store_result($sql_result);
 		return $result;
 		return $result;
 	}
 	}
-	
+
 	/**
 	/**
 	*	Returns an array with all database fields for the specified course.
 	*	Returns an array with all database fields for the specified course.
 	*
 	*
 	*	@param the real (system) code of the course (key of the main course table)
 	*	@param the real (system) code of the course (key of the main course table)
-	* 	@todo shouldn't this be in the course.lib.php script? 
+	* 	@todo shouldn't this be in the course.lib.php script?
 	*/
 	*/
 	function get_course_info($course_code)
 	function get_course_info($course_code)
 	{
 	{
@@ -395,7 +398,7 @@ class Database
 	*	@author Roan Embrechts, first version + converted to Database API
 	*	@author Roan Embrechts, first version + converted to Database API
 	*	@version 30 September 2004
 	*	@version 30 September 2004
 	*	@desc find all the information about a specified user. Without parameter this is the current user.
 	*	@desc find all the information about a specified user. Without parameter this is the current user.
-	* 	@todo shouldn't this be in the user.lib.php script? 
+	* 	@todo shouldn't this be in the user.lib.php script?
 	*/
 	*/
 	function get_user_info_from_id($user_id = '')
 	function get_user_info_from_id($user_id = '')
 	{
 	{
@@ -422,7 +425,7 @@ class Database
 	*
 	*
 	*	@todo	add more array entries to abstract course info from field names
 	*	@todo	add more array entries to abstract course info from field names
 	*	@author	Roan Embrechts
 	*	@author	Roan Embrechts
-	* 
+	*
 	* 	@todo what's the use of this function. I think this is better removed.
 	* 	@todo what's the use of this function. I think this is better removed.
 	* 		  There should be consistency in the variable names and the use throughout the scripts
 	* 		  There should be consistency in the variable names and the use throughout the scripts
 	* 		  for the database name we should consistently use or db_name or database (db_name probably being the better one)
 	* 		  for the database name we should consistently use or db_name or database (db_name probably being the better one)
@@ -439,7 +442,7 @@ class Database
 		//$result_array["directory"] = $result_array["directory"];
 		//$result_array["directory"] = $result_array["directory"];
 		/*
 		/*
 		still to do: (info taken from local.inc.php)
 		still to do: (info taken from local.inc.php)
-		
+
 		$_course['id'          ]         = $cData['cours_id'         ]; //auto-assigned integer
 		$_course['id'          ]         = $cData['cours_id'         ]; //auto-assigned integer
 		$_course['name'        ]         = $cData['title'            ];
 		$_course['name'        ]         = $cData['title'            ];
 		$_course['official_code']        = $cData['visual_code'        ]; // use in echo
 		$_course['official_code']        = $cData['visual_code'        ]; // use in echo
@@ -453,7 +456,7 @@ class Database
 		$_course['extLink'     ]['name'] = $cData['department_name'];
 		$_course['extLink'     ]['name'] = $cData['department_name'];
 		$_course['categoryCode']         = $cData['faCode'           ];
 		$_course['categoryCode']         = $cData['faCode'           ];
 		$_course['categoryName']         = $cData['faName'           ];
 		$_course['categoryName']         = $cData['faName'           ];
-		
+
 		$_course['visibility'  ]         = (bool) ($cData['visibility'] == 2 || $cData['visibility'] == 3);
 		$_course['visibility'  ]         = (bool) ($cData['visibility'] == 2 || $cData['visibility'] == 3);
 		$_course['registrationAllowed']  = (bool) ($cData['visibility'] == 1 || $cData['visibility'] == 2);
 		$_course['registrationAllowed']  = (bool) ($cData['visibility'] == 1 || $cData['visibility'] == 2);
 		*/
 		*/
@@ -469,7 +472,7 @@ class Database
 	*	@todo add more array entries to abstract user info from field names
 	*	@todo add more array entries to abstract user info from field names
 	*	@author Roan Embrechts
 	*	@author Roan Embrechts
 	*	@author Patrick Cool
 	*	@author Patrick Cool
-	* 
+	*
 	* 	@todo what's the use of this function. I think this is better removed.
 	* 	@todo what's the use of this function. I think this is better removed.
 	* 		  There should be consistency in the variable names and the use throughout the scripts
 	* 		  There should be consistency in the variable names and the use throughout the scripts
 	*/
 	*/
@@ -482,8 +485,8 @@ class Database
 		#$result_array ['user_id'  ] 	= $result_array['user_id'   ];
 		#$result_array ['user_id'  ] 	= $result_array['user_id'   ];
 		return $result_array;
 		return $result_array;
 	}
 	}
-	
-	
+
+
 	/*
 	/*
 	-----------------------------------------------------------------------------
 	-----------------------------------------------------------------------------
 		Private Functions
 		Private Functions
@@ -598,14 +601,14 @@ class Database
 	{
 	{
 		return mysql_num_rows($res);
 		return mysql_num_rows($res);
 	}
 	}
-	
+
 	function get_course_chat_connected_table($database_name = '')
 	function get_course_chat_connected_table($database_name = '')
 	{
 	{
 		$database_name_with_glue = Database::fix_database_parameter($database_name);
 		$database_name_with_glue = Database::fix_database_parameter($database_name);
 		return Database::format_glued_course_table_name($database_name_with_glue, CHAT_CONNECTED_TABLE);
 		return Database::format_glued_course_table_name($database_name_with_glue, CHAT_CONNECTED_TABLE);
 	}
 	}
-	
-	
+
+
 }
 }
 //end class Database
 //end class Database
 ?>
 ?>